Trapped-Frontend.deploy.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  1. smalltalk.addPackage('Trapped-Frontend', {});
  2. smalltalk.addClass('TrappedBinder', smalltalk.Object, ['brush'], 'Trapped-Frontend');
  3. smalltalk.addMethod(
  4. "_brush_",
  5. smalltalk.method({
  6. selector: "brush:",
  7. fn: function (aTagBrush){
  8. var self=this;
  9. return smalltalk.withContext(function($ctx1) { self["@brush"]=aTagBrush;
  10. return self}, function($ctx1) {$ctx1.fill(self,"brush:",{aTagBrush:aTagBrush}, smalltalk.TrappedBinder)})}
  11. }),
  12. smalltalk.TrappedBinder);
  13. smalltalk.addMethod(
  14. "_installFor_",
  15. smalltalk.method({
  16. selector: "installFor:",
  17. fn: function (path){
  18. var self=this;
  19. return smalltalk.withContext(function($ctx1) { _st(self["@brush"])._trap_read_(path,_st(self)._showBlock());
  20. return self}, function($ctx1) {$ctx1.fill(self,"installFor:",{path:path}, smalltalk.TrappedBinder)})}
  21. }),
  22. smalltalk.TrappedBinder);
  23. smalltalk.addMethod(
  24. "_prim_",
  25. smalltalk.method({
  26. selector: "prim:",
  27. fn: function (anObject){
  28. var self=this;
  29. return smalltalk.withContext(function($ctx1) { return anObject.valueOf();
  30. return self}, function($ctx1) {$ctx1.fill(self,"prim:",{anObject:anObject}, smalltalk.TrappedBinder)})}
  31. }),
  32. smalltalk.TrappedBinder);
  33. smalltalk.addMethod(
  34. "_showBlock",
  35. smalltalk.method({
  36. selector: "showBlock",
  37. fn: function (){
  38. var self=this;
  39. return smalltalk.withContext(function($ctx1) { var $2,$4,$6,$5,$3,$1;
  40. $1=(function(model){
  41. return smalltalk.withContext(function($ctx2) { $2=self["@brush"];
  42. _st($2)._empty();
  43. $4=$2;
  44. $6=model;
  45. if(($receiver = $6) == nil || $receiver == undefined){
  46. $5=(function(){
  47. return smalltalk.withContext(function($ctx3) { }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})});
  48. } else {
  49. $5=$6;
  50. };
  51. $3=_st($4)._with_($5);
  52. return $3;
  53. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1)})});
  54. return $1;
  55. }, function($ctx1) {$ctx1.fill(self,"showBlock",{}, smalltalk.TrappedBinder)})}
  56. }),
  57. smalltalk.TrappedBinder);
  58. smalltalk.addClass('TrappedCheckedBinder', smalltalk.TrappedBinder, [], 'Trapped-Frontend');
  59. smalltalk.addMethod(
  60. "_installFor_",
  61. smalltalk.method({
  62. selector: "installFor:",
  63. fn: function (path){
  64. var self=this;
  65. return smalltalk.withContext(function($ctx1) { smalltalk.TrappedBinder.fn.prototype._installFor_.apply(_st(self), [path]);
  66. _st(path)._trapDescend_((function(snap){
  67. return smalltalk.withContext(function($ctx2) { return _st(self["@brush"])._onChange_((function(){
  68. return smalltalk.withContext(function($ctx3) { return _st(snap)._modify_((function(){
  69. return smalltalk.withContext(function($ctx4) { return _st(_st(_st(self["@brush"])._asJQuery())._attr_("checked"))._notNil();
  70. }, function($ctx4) {$ctx4.fillBlock({},$ctx1)})}));
  71. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  72. }, function($ctx2) {$ctx2.fillBlock({snap:snap},$ctx1)})}));
  73. return self}, function($ctx1) {$ctx1.fill(self,"installFor:",{path:path}, smalltalk.TrappedCheckedBinder)})}
  74. }),
  75. smalltalk.TrappedCheckedBinder);
  76. smalltalk.addMethod(
  77. "_showBlock",
  78. smalltalk.method({
  79. selector: "showBlock",
  80. fn: function (){
  81. var self=this;
  82. return smalltalk.withContext(function($ctx1) { var $1;
  83. $1=(function(model){
  84. return smalltalk.withContext(function($ctx2) { return _st(_st(self["@brush"])._asJQuery())._attr_put_("checked",_st(model)._ifNotNil_ifNil_((function(){
  85. return smalltalk.withContext(function($ctx3) { return _st(self)._prim_(model);
  86. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}),(function(){
  87. return smalltalk.withContext(function($ctx3) { return false;
  88. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})})));
  89. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1)})});
  90. return $1;
  91. }, function($ctx1) {$ctx1.fill(self,"showBlock",{}, smalltalk.TrappedCheckedBinder)})}
  92. }),
  93. smalltalk.TrappedCheckedBinder);
  94. smalltalk.addClass('TrappedValBinder', smalltalk.TrappedBinder, [], 'Trapped-Frontend');
  95. smalltalk.addMethod(
  96. "_installFor_",
  97. smalltalk.method({
  98. selector: "installFor:",
  99. fn: function (path){
  100. var self=this;
  101. return smalltalk.withContext(function($ctx1) { smalltalk.TrappedBinder.fn.prototype._installFor_.apply(_st(self), [path]);
  102. _st(path)._trapDescend_((function(snap){
  103. return smalltalk.withContext(function($ctx2) { return _st(self["@brush"])._onChange_((function(){
  104. return smalltalk.withContext(function($ctx3) { return _st(snap)._modify_((function(){
  105. return smalltalk.withContext(function($ctx4) { return _st(_st(self["@brush"])._asJQuery())._val();
  106. }, function($ctx4) {$ctx4.fillBlock({},$ctx1)})}));
  107. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  108. }, function($ctx2) {$ctx2.fillBlock({snap:snap},$ctx1)})}));
  109. return self}, function($ctx1) {$ctx1.fill(self,"installFor:",{path:path}, smalltalk.TrappedValBinder)})}
  110. }),
  111. smalltalk.TrappedValBinder);
  112. smalltalk.addMethod(
  113. "_showBlock",
  114. smalltalk.method({
  115. selector: "showBlock",
  116. fn: function (){
  117. var self=this;
  118. return smalltalk.withContext(function($ctx1) { var $1;
  119. $1=(function(model){
  120. return smalltalk.withContext(function($ctx2) { return _st(_st(self["@brush"])._asJQuery())._val_(_st(model)._ifNotNil_ifNil_((function(){
  121. return smalltalk.withContext(function($ctx3) { return _st(self)._prim_(model);
  122. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}),(function(){
  123. return smalltalk.withContext(function($ctx3) { return (function(){
  124. return smalltalk.withContext(function($ctx4) { }, function($ctx4) {$ctx4.fillBlock({},$ctx1)})});
  125. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})})));
  126. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1)})});
  127. return $1;
  128. }, function($ctx1) {$ctx1.fill(self,"showBlock",{}, smalltalk.TrappedValBinder)})}
  129. }),
  130. smalltalk.TrappedValBinder);
  131. smalltalk.addClass('TrappedDumbView', smalltalk.Widget, [], 'Trapped-Frontend');
  132. smalltalk.addMethod(
  133. "_renderOn_",
  134. smalltalk.method({
  135. selector: "renderOn:",
  136. fn: function (html){
  137. var self=this;
  138. return smalltalk.withContext(function($ctx1) { _st(_st(html)._root())._trap_([]);
  139. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html}, smalltalk.TrappedDumbView)})}
  140. }),
  141. smalltalk.TrappedDumbView);
  142. smalltalk.addClass('TrappedSingleton', smalltalk.Object, [], 'Trapped-Frontend');
  143. smalltalk.addMethod(
  144. "_start_",
  145. smalltalk.method({
  146. selector: "start:",
  147. fn: function (args){
  148. var self=this;
  149. return smalltalk.withContext(function($ctx1) { var $1;
  150. $1=_st(self)._subclassResponsibility();
  151. return $1;
  152. }, function($ctx1) {$ctx1.fill(self,"start:",{args:args}, smalltalk.TrappedSingleton)})}
  153. }),
  154. smalltalk.TrappedSingleton);
  155. smalltalk.TrappedSingleton.klass.iVarNames = ['current'];
  156. smalltalk.addMethod(
  157. "_current",
  158. smalltalk.method({
  159. selector: "current",
  160. fn: function (){
  161. var self=this;
  162. return smalltalk.withContext(function($ctx1) { var $2,$1;
  163. $2=self["@current"];
  164. if(($receiver = $2) == nil || $receiver == undefined){
  165. self["@current"]=_st(self)._new();
  166. $1=self["@current"];
  167. } else {
  168. $1=$2;
  169. };
  170. return $1;
  171. }, function($ctx1) {$ctx1.fill(self,"current",{}, smalltalk.TrappedSingleton.klass)})}
  172. }),
  173. smalltalk.TrappedSingleton.klass);
  174. smalltalk.addMethod(
  175. "_start_",
  176. smalltalk.method({
  177. selector: "start:",
  178. fn: function (args){
  179. var self=this;
  180. return smalltalk.withContext(function($ctx1) { _st(_st(self)._current())._start_(args);
  181. return self}, function($ctx1) {$ctx1.fill(self,"start:",{args:args}, smalltalk.TrappedSingleton.klass)})}
  182. }),
  183. smalltalk.TrappedSingleton.klass);
  184. smalltalk.addClass('Trapped', smalltalk.TrappedSingleton, ['registry'], 'Trapped-Frontend');
  185. smalltalk.addMethod(
  186. "_binder_",
  187. smalltalk.method({
  188. selector: "binder:",
  189. fn: function (aTagBrush){
  190. var self=this;
  191. var binder,tag;
  192. return smalltalk.withContext(function($ctx1) { var $1,$3,$4,$2,$5,$7,$8,$6;
  193. tag=_st(_st(aTagBrush)._element())._nodeName();
  194. $1=_st(tag).__eq("INPUT");
  195. $2=(function(){
  196. var type;
  197. return smalltalk.withContext(function($ctx2) { type=_st(_st(aTagBrush)._asJQuery())._attr_("type");
  198. type;
  199. $3=_st(type).__eq("checkbox");
  200. if(smalltalk.assert($3)){
  201. binder=_st((smalltalk.TrappedCheckedBinder || TrappedCheckedBinder))._new();
  202. binder;
  203. };
  204. $4=_st(type).__eq("text");
  205. if(smalltalk.assert($4)){
  206. binder=_st((smalltalk.TrappedValBinder || TrappedValBinder))._new();
  207. return binder;
  208. };
  209. }, function($ctx2) {$ctx2.fillBlock({type:type},$ctx1)})});
  210. _st($1)._ifTrue_($2);
  211. $5=binder;
  212. if(($receiver = $5) == nil || $receiver == undefined){
  213. binder=_st((smalltalk.TrappedBinder || TrappedBinder))._new();
  214. binder;
  215. } else {
  216. $5;
  217. };
  218. $7=binder;
  219. _st($7)._brush_(aTagBrush);
  220. $8=_st($7)._yourself();
  221. $6=$8;
  222. return $6;
  223. }, function($ctx1) {$ctx1.fill(self,"binder:",{aTagBrush:aTagBrush,binder:binder,tag:tag}, smalltalk.Trapped)})}
  224. }),
  225. smalltalk.Trapped);
  226. smalltalk.addMethod(
  227. "_byName_",
  228. smalltalk.method({
  229. selector: "byName:",
  230. fn: function (aString){
  231. var self=this;
  232. return smalltalk.withContext(function($ctx1) { var $1;
  233. $1=_st(self["@registry"])._at_(aString);
  234. return $1;
  235. }, function($ctx1) {$ctx1.fill(self,"byName:",{aString:aString}, smalltalk.Trapped)})}
  236. }),
  237. smalltalk.Trapped);
  238. smalltalk.addMethod(
  239. "_descend_snapshotDo_",
  240. smalltalk.method({
  241. selector: "descend:snapshotDo:",
  242. fn: function (anArray,aBlock){
  243. var self=this;
  244. var tpsc;
  245. return smalltalk.withContext(function($ctx1) { tpsc=_st((smalltalk.TrappedPathStack || TrappedPathStack))._current();
  246. _st(tpsc)._append_do_(anArray,(function(){
  247. var path,model;
  248. return smalltalk.withContext(function($ctx2) { path=_st(_st(tpsc)._elements())._copy();
  249. path;
  250. model=_st(self)._byName_(_st(path)._first());
  251. model;
  252. return _st(aBlock)._value_(_st(_st((smalltalk.TrappedSnapshot || TrappedSnapshot))._new())._path_model_(path,model));
  253. }, function($ctx2) {$ctx2.fillBlock({path:path,model:model},$ctx1)})}));
  254. return self}, function($ctx1) {$ctx1.fill(self,"descend:snapshotDo:",{anArray:anArray,aBlock:aBlock,tpsc:tpsc}, smalltalk.Trapped)})}
  255. }),
  256. smalltalk.Trapped);
  257. smalltalk.addMethod(
  258. "_initialize",
  259. smalltalk.method({
  260. selector: "initialize",
  261. fn: function (){
  262. var self=this;
  263. return smalltalk.withContext(function($ctx1) { smalltalk.TrappedSingleton.fn.prototype._initialize.apply(_st(self), []);
  264. self["@registry"]=smalltalk.HashedCollection._fromPairs_([]);
  265. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.Trapped)})}
  266. }),
  267. smalltalk.Trapped);
  268. smalltalk.addMethod(
  269. "_register_",
  270. smalltalk.method({
  271. selector: "register:",
  272. fn: function (aListKeyedEntity){
  273. var self=this;
  274. return smalltalk.withContext(function($ctx1) { _st(self)._register_name_(aListKeyedEntity,_st(_st(aListKeyedEntity)._class())._name());
  275. return self}, function($ctx1) {$ctx1.fill(self,"register:",{aListKeyedEntity:aListKeyedEntity}, smalltalk.Trapped)})}
  276. }),
  277. smalltalk.Trapped);
  278. smalltalk.addMethod(
  279. "_register_name_",
  280. smalltalk.method({
  281. selector: "register:name:",
  282. fn: function (aListKeyedEntity,aString){
  283. var self=this;
  284. return smalltalk.withContext(function($ctx1) { _st(self["@registry"])._at_put_(aString,aListKeyedEntity);
  285. return self}, function($ctx1) {$ctx1.fill(self,"register:name:",{aListKeyedEntity:aListKeyedEntity,aString:aString}, smalltalk.Trapped)})}
  286. }),
  287. smalltalk.Trapped);
  288. smalltalk.addMethod(
  289. "_start_",
  290. smalltalk.method({
  291. selector: "start:",
  292. fn: function (args){
  293. var self=this;
  294. return smalltalk.withContext(function($ctx1) { var $1,$3,$2;
  295. _st(args)._do_((function(each){
  296. return smalltalk.withContext(function($ctx2) { return _st(self)._register_(each);
  297. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  298. $1=_st("[data-trap]")._asJQuery();
  299. $2=(function(index,elem){
  300. var trap,jq,viewName,modelName,tokens,path;
  301. return smalltalk.withContext(function($ctx2) { jq=_st(elem)._asJQuery();
  302. jq;
  303. trap=_st(jq)._attr_("data-trap");
  304. trap;
  305. tokens=_st(trap)._tokenize_(":");
  306. tokens;
  307. $3=_st(_st(tokens)._size()).__eq((1));
  308. if(smalltalk.assert($3)){
  309. tokens=_st(["TrappedDumbView"]).__comma(tokens);
  310. tokens;
  311. };
  312. viewName=_st(tokens)._first();
  313. viewName;
  314. tokens=_st(_st(_st(tokens)._second())._tokenize_(" "))._select_((function(each){
  315. return smalltalk.withContext(function($ctx3) { return _st(each)._notEmpty();
  316. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  317. tokens;
  318. modelName=_st(tokens)._first();
  319. modelName;
  320. path=_st((smalltalk.Trapped || Trapped))._parse_(_st(tokens)._allButFirst());
  321. path;
  322. return _st(_st([modelName]).__comma(path))._trapDescend_((function(){
  323. return smalltalk.withContext(function($ctx3) { return _st(_st(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_(viewName))._new())._appendToJQuery_(jq);
  324. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  325. }, function($ctx2) {$ctx2.fillBlock({index:index,elem:elem,trap:trap,jq:jq,viewName:viewName,modelName:modelName,tokens:tokens,path:path},$ctx1)})});
  326. _st($1)._each_($2);
  327. return self}, function($ctx1) {$ctx1.fill(self,"start:",{args:args}, smalltalk.Trapped)})}
  328. }),
  329. smalltalk.Trapped);
  330. smalltalk.addMethod(
  331. "_parse_",
  332. smalltalk.method({
  333. selector: "parse:",
  334. fn: function (anArray){
  335. var self=this;
  336. return smalltalk.withContext(function($ctx1) { var $2,$4,$5,$7,$6,$3,$1;
  337. $2=anArray;
  338. $3=(function(each){
  339. var asNum;
  340. return smalltalk.withContext(function($ctx2) { _st(asNum).__eq(_st(each)._asNumber());
  341. $4=_st(asNum).__eq(asNum);
  342. $5=(function(){
  343. return smalltalk.withContext(function($ctx3) { return asNum;
  344. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})});
  345. $6=(function(){
  346. return smalltalk.withContext(function($ctx3) { $7=_st(_st(each)._first()).__eq("#");
  347. if(smalltalk.assert($7)){
  348. return _st(_st(each)._allButFirst())._asSymbol();
  349. } else {
  350. return each;
  351. };
  352. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})});
  353. return _st($4)._ifTrue_ifFalse_($5,$6);
  354. }, function($ctx2) {$ctx2.fillBlock({each:each,asNum:asNum},$ctx1)})});
  355. $1=_st($2)._collect_($3);
  356. return $1;
  357. }, function($ctx1) {$ctx1.fill(self,"parse:",{anArray:anArray}, smalltalk.Trapped.klass)})}
  358. }),
  359. smalltalk.Trapped.klass);
  360. smalltalk.addClass('TrappedPathStack', smalltalk.TrappedSingleton, ['elements'], 'Trapped-Frontend');
  361. smalltalk.addMethod(
  362. "_append_do_",
  363. smalltalk.method({
  364. selector: "append:do:",
  365. fn: function (anArray,aBlock){
  366. var self=this;
  367. return smalltalk.withContext(function($ctx1) { _st(self)._with_do_(_st(self["@elements"]).__comma(anArray),aBlock);
  368. return self}, function($ctx1) {$ctx1.fill(self,"append:do:",{anArray:anArray,aBlock:aBlock}, smalltalk.TrappedPathStack)})}
  369. }),
  370. smalltalk.TrappedPathStack);
  371. smalltalk.addMethod(
  372. "_elements",
  373. smalltalk.method({
  374. selector: "elements",
  375. fn: function (){
  376. var self=this;
  377. return smalltalk.withContext(function($ctx1) { var $1;
  378. $1=self["@elements"];
  379. return $1;
  380. }, function($ctx1) {$ctx1.fill(self,"elements",{}, smalltalk.TrappedPathStack)})}
  381. }),
  382. smalltalk.TrappedPathStack);
  383. smalltalk.addMethod(
  384. "_initialize",
  385. smalltalk.method({
  386. selector: "initialize",
  387. fn: function (){
  388. var self=this;
  389. return smalltalk.withContext(function($ctx1) { smalltalk.TrappedSingleton.fn.prototype._initialize.apply(_st(self), []);
  390. self["@elements"]=[];
  391. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.TrappedPathStack)})}
  392. }),
  393. smalltalk.TrappedPathStack);
  394. smalltalk.addMethod(
  395. "_with_do_",
  396. smalltalk.method({
  397. selector: "with:do:",
  398. fn: function (anArray,aBlock){
  399. var self=this;
  400. var old;
  401. return smalltalk.withContext(function($ctx1) { old=self["@elements"];
  402. _st((function(){
  403. return smalltalk.withContext(function($ctx2) { self["@elements"]=anArray;
  404. self["@elements"];
  405. return _st(aBlock)._value();
  406. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._ensure_((function(){
  407. return smalltalk.withContext(function($ctx2) { self["@elements"]=old;
  408. return self["@elements"];
  409. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  410. return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anArray:anArray,aBlock:aBlock,old:old}, smalltalk.TrappedPathStack)})}
  411. }),
  412. smalltalk.TrappedPathStack);
  413. smalltalk.addClass('TrappedSnapshot', smalltalk.Object, ['path', 'model'], 'Trapped-Frontend');
  414. smalltalk.addMethod(
  415. "_do_",
  416. smalltalk.method({
  417. selector: "do:",
  418. fn: function (aBlock){
  419. var self=this;
  420. return smalltalk.withContext(function($ctx1) { _st(_st((smalltalk.TrappedPathStack || TrappedPathStack))._current())._with_do_(self["@path"],(function(){
  421. return smalltalk.withContext(function($ctx2) { return _st(aBlock)._value_(self["@model"]);
  422. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  423. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.TrappedSnapshot)})}
  424. }),
  425. smalltalk.TrappedSnapshot);
  426. smalltalk.addMethod(
  427. "_model",
  428. smalltalk.method({
  429. selector: "model",
  430. fn: function (){
  431. var self=this;
  432. return smalltalk.withContext(function($ctx1) { var $1;
  433. $1=self["@model"];
  434. return $1;
  435. }, function($ctx1) {$ctx1.fill(self,"model",{}, smalltalk.TrappedSnapshot)})}
  436. }),
  437. smalltalk.TrappedSnapshot);
  438. smalltalk.addMethod(
  439. "_modify_",
  440. smalltalk.method({
  441. selector: "modify:",
  442. fn: function (aBlock){
  443. var self=this;
  444. return smalltalk.withContext(function($ctx1) { _st(_st(self)._model())._modify_do_(_st(_st(self)._path())._allButFirst(),aBlock);
  445. return self}, function($ctx1) {$ctx1.fill(self,"modify:",{aBlock:aBlock}, smalltalk.TrappedSnapshot)})}
  446. }),
  447. smalltalk.TrappedSnapshot);
  448. smalltalk.addMethod(
  449. "_path",
  450. smalltalk.method({
  451. selector: "path",
  452. fn: function (){
  453. var self=this;
  454. return smalltalk.withContext(function($ctx1) { var $1;
  455. $1=self["@path"];
  456. return $1;
  457. }, function($ctx1) {$ctx1.fill(self,"path",{}, smalltalk.TrappedSnapshot)})}
  458. }),
  459. smalltalk.TrappedSnapshot);
  460. smalltalk.addMethod(
  461. "_path_model_",
  462. smalltalk.method({
  463. selector: "path:model:",
  464. fn: function (anArray,aTrappedMW){
  465. var self=this;
  466. return smalltalk.withContext(function($ctx1) { self["@path"]=anArray;
  467. self["@model"]=aTrappedMW;
  468. return self}, function($ctx1) {$ctx1.fill(self,"path:model:",{anArray:anArray,aTrappedMW:aTrappedMW}, smalltalk.TrappedSnapshot)})}
  469. }),
  470. smalltalk.TrappedSnapshot);
  471. smalltalk.addMethod(
  472. "_trapDescend_",
  473. smalltalk.method({
  474. selector: "trapDescend:",
  475. fn: function (aBlock){
  476. var self=this;
  477. return smalltalk.withContext(function($ctx1) { _st(_st((smalltalk.Trapped || Trapped))._current())._descend_snapshotDo_(self,aBlock);
  478. return self}, function($ctx1) {$ctx1.fill(self,"trapDescend:",{aBlock:aBlock}, smalltalk.Array)})}
  479. }),
  480. smalltalk.Array);
  481. smalltalk.addMethod(
  482. "_trap_",
  483. smalltalk.method({
  484. selector: "trap:",
  485. fn: function (path){
  486. var self=this;
  487. return smalltalk.withContext(function($ctx1) { _st(_st(_st((smalltalk.Trapped || Trapped))._current())._binder_(self))._installFor_(path);
  488. return self}, function($ctx1) {$ctx1.fill(self,"trap:",{path:path}, smalltalk.TagBrush)})}
  489. }),
  490. smalltalk.TagBrush);
  491. smalltalk.addMethod(
  492. "_trap_read_",
  493. smalltalk.method({
  494. selector: "trap:read:",
  495. fn: function (path,aBlock){
  496. var self=this;
  497. return smalltalk.withContext(function($ctx1) { var $1,$3,$4,$6,$5,$2;
  498. $1=path;
  499. $2=(function(snap){
  500. return smalltalk.withContext(function($ctx2) { $3=_st(snap)._model();
  501. $4=_st(_st(snap)._path())._allButFirst();
  502. $5=(function(data){
  503. return smalltalk.withContext(function($ctx3) { $6=_st(_st(_st(_st(self)._asJQuery())._closest_("html"))._toArray())._isEmpty();
  504. if(smalltalk.assert($6)){
  505. _st((smalltalk.KeyedPubSubUnsubscribe || KeyedPubSubUnsubscribe))._signal();
  506. };
  507. return _st(snap)._do_((function(){
  508. return smalltalk.withContext(function($ctx4) { return _st(self)._with_((function(html){
  509. return smalltalk.withContext(function($ctx5) { return _st(aBlock)._value_value_(data,html);
  510. }, function($ctx5) {$ctx5.fillBlock({html:html},$ctx1)})}));
  511. }, function($ctx4) {$ctx4.fillBlock({},$ctx1)})}));
  512. }, function($ctx3) {$ctx3.fillBlock({data:data},$ctx1)})});
  513. return _st($3)._watch_do_($4,$5);
  514. }, function($ctx2) {$ctx2.fillBlock({snap:snap},$ctx1)})});
  515. _st($1)._trapDescend_($2);
  516. return self}, function($ctx1) {$ctx1.fill(self,"trap:read:",{path:path,aBlock:aBlock}, smalltalk.TagBrush)})}
  517. }),
  518. smalltalk.TagBrush);
  519. smalltalk.addMethod(
  520. "_trap_toggle_",
  521. smalltalk.method({
  522. selector: "trap:toggle:",
  523. fn: function (path,aBlock){
  524. var self=this;
  525. return smalltalk.withContext(function($ctx1) { _st(self)._trap_toggle_ifNotPresent_(path,aBlock,(function(){
  526. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._asJQuery())._hide();
  527. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  528. return self}, function($ctx1) {$ctx1.fill(self,"trap:toggle:",{path:path,aBlock:aBlock}, smalltalk.TagBrush)})}
  529. }),
  530. smalltalk.TagBrush);
  531. smalltalk.addMethod(
  532. "_trap_toggle_ifNotPresent_",
  533. smalltalk.method({
  534. selector: "trap:toggle:ifNotPresent:",
  535. fn: function (path,aBlock,anotherBlock){
  536. var self=this;
  537. var shown;
  538. return smalltalk.withContext(function($ctx1) { var $1,$2,$4,$6,$7,$9,$8,$5,$3;
  539. shown=nil;
  540. $1=self;
  541. $2=path;
  542. $3=(function(data,html){
  543. return smalltalk.withContext(function($ctx2) { $4=_st(shown).__eq(_st(data)._notNil());
  544. $5=(function(){
  545. return smalltalk.withContext(function($ctx3) { shown=_st(data)._notNil();
  546. shown;
  547. $6=_st(self)._asJQuery();
  548. _st($6)._empty();
  549. $7=_st($6)._show();
  550. $7;
  551. $9=shown;
  552. if(smalltalk.assert($9)){
  553. $8=aBlock;
  554. } else {
  555. $8=anotherBlock;
  556. };
  557. return _st($8)._value_value_(data,html);
  558. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})});
  559. return _st($4)._ifFalse_($5);
  560. }, function($ctx2) {$ctx2.fillBlock({data:data,html:html},$ctx1)})});
  561. _st($1)._trap_read_($2,$3);
  562. return self}, function($ctx1) {$ctx1.fill(self,"trap:toggle:ifNotPresent:",{path:path,aBlock:aBlock,anotherBlock:anotherBlock,shown:shown}, smalltalk.TagBrush)})}
  563. }),
  564. smalltalk.TagBrush);
  565. smalltalk.addMethod(
  566. "_trapIter_tag_do_",
  567. smalltalk.method({
  568. selector: "trapIter:tag:do:",
  569. fn: function (path,aSymbol,aBlock){
  570. var self=this;
  571. return smalltalk.withContext(function($ctx1) { var $1,$2,$4,$3;
  572. $1=self;
  573. $2=path;
  574. $3=(function(model,html){
  575. return smalltalk.withContext(function($ctx2) { _st(_st(html)._root())._empty();
  576. $4=model;
  577. if(($receiver = $4) == nil || $receiver == undefined){
  578. return $4;
  579. } else {
  580. return _st(model)._withIndexDo_((function(item,i){
  581. return smalltalk.withContext(function($ctx3) { return _st(_st(html)._perform_(aSymbol))._trap_read_([i],aBlock);
  582. }, function($ctx3) {$ctx3.fillBlock({item:item,i:i},$ctx1)})}));
  583. };
  584. }, function($ctx2) {$ctx2.fillBlock({model:model,html:html},$ctx1)})});
  585. _st($1)._trap_read_($2,$3);
  586. return self}, function($ctx1) {$ctx1.fill(self,"trapIter:tag:do:",{path:path,aSymbol:aSymbol,aBlock:aBlock}, smalltalk.TagBrush)})}
  587. }),
  588. smalltalk.TagBrush);