Trapped-Frontend.js 53 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435
  1. define("gh_herby_trapped/Trapped-Frontend", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects", "amber_core/Canvas", "amber_core/Kernel-Collections"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Trapped-Frontend');
  3. smalltalk.packages["Trapped-Frontend"].transport = {"type":"amd","amdNamespace":"gh_herby_trapped"};
  4. smalltalk.addClass('TrappedBinder', smalltalk.Object, ['brush'], 'Trapped-Frontend');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "brush:",
  8. category: 'accessing',
  9. fn: function (aTagBrush){
  10. var self=this;
  11. return smalltalk.withContext(function($ctx1) {
  12. self["@brush"]=aTagBrush;
  13. return self}, function($ctx1) {$ctx1.fill(self,"brush:",{aTagBrush:aTagBrush},smalltalk.TrappedBinder)})},
  14. args: ["aTagBrush"],
  15. source: "brush: aTagBrush\x0a\x09brush := aTagBrush",
  16. messageSends: [],
  17. referencedClasses: []
  18. }),
  19. smalltalk.TrappedBinder);
  20. smalltalk.addMethod(
  21. smalltalk.method({
  22. selector: "installFor:",
  23. category: 'action',
  24. fn: function (path){
  25. var self=this;
  26. return smalltalk.withContext(function($ctx1) {
  27. _st(self["@brush"])._trap_read_(path,self._showBlock());
  28. return self}, function($ctx1) {$ctx1.fill(self,"installFor:",{path:path},smalltalk.TrappedBinder)})},
  29. args: ["path"],
  30. source: "installFor: path\x0a\x09brush trap: path read: self showBlock",
  31. messageSends: ["trap:read:", "showBlock"],
  32. referencedClasses: []
  33. }),
  34. smalltalk.TrappedBinder);
  35. smalltalk.addMethod(
  36. smalltalk.method({
  37. selector: "prim:",
  38. category: 'converting',
  39. fn: function (anObject){
  40. var self=this;
  41. return smalltalk.withContext(function($ctx1) {
  42. return anObject.valueOf();
  43. return self}, function($ctx1) {$ctx1.fill(self,"prim:",{anObject:anObject},smalltalk.TrappedBinder)})},
  44. args: ["anObject"],
  45. source: "prim: anObject\x0a\x09<return anObject.valueOf()>",
  46. messageSends: [],
  47. referencedClasses: []
  48. }),
  49. smalltalk.TrappedBinder);
  50. smalltalk.addMethod(
  51. smalltalk.method({
  52. selector: "showBlock",
  53. category: 'action',
  54. fn: function (){
  55. var self=this;
  56. return smalltalk.withContext(function($ctx1) {
  57. var $2,$4,$5,$3,$1;
  58. $1=(function(model){
  59. return smalltalk.withContext(function($ctx2) {
  60. $2=self["@brush"];
  61. _st($2)._empty();
  62. $4=$2;
  63. if(($receiver = model) == nil || $receiver == null){
  64. $5=(function(){
  65. return smalltalk.withContext(function($ctx3) {
  66. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})});
  67. } else {
  68. $5=model;
  69. };
  70. $3=_st($4)._with_($5);
  71. return $3;
  72. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1,1)})});
  73. return $1;
  74. }, function($ctx1) {$ctx1.fill(self,"showBlock",{},smalltalk.TrappedBinder)})},
  75. args: [],
  76. source: "showBlock\x0a\x09^[ :model | brush empty; with: (model ifNil: [[]]) ]",
  77. messageSends: ["empty", "with:", "ifNil:"],
  78. referencedClasses: []
  79. }),
  80. smalltalk.TrappedBinder);
  81. smalltalk.addClass('TrappedCheckedBinder', smalltalk.TrappedBinder, [], 'Trapped-Frontend');
  82. smalltalk.addMethod(
  83. smalltalk.method({
  84. selector: "installFor:",
  85. category: 'action',
  86. fn: function (path){
  87. var self=this;
  88. return smalltalk.withContext(function($ctx1) {
  89. smalltalk.TrappedCheckedBinder.superclass.fn.prototype._installFor_.apply(_st(self), [path]);
  90. _st(path)._trapDescend_((function(snap){
  91. return smalltalk.withContext(function($ctx2) {
  92. return _st(self["@brush"])._onChange_((function(){
  93. return smalltalk.withContext(function($ctx3) {
  94. return _st(snap)._modify_((function(){
  95. return smalltalk.withContext(function($ctx4) {
  96. return _st(_st(_st(self["@brush"])._asJQuery())._attr_("checked"))._notNil();
  97. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)})}));
  98. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  99. }, function($ctx2) {$ctx2.fillBlock({snap:snap},$ctx1,1)})}));
  100. return self}, function($ctx1) {$ctx1.fill(self,"installFor:",{path:path},smalltalk.TrappedCheckedBinder)})},
  101. args: ["path"],
  102. source: "installFor: path\x0a\x09super installFor: path.\x0a path trapDescend: [ :snap |\x0a\x09 brush onChange: [ snap modify: [\x0a (brush asJQuery attr: 'checked') notNil\x0a ]]\x0a ]",
  103. messageSends: ["installFor:", "trapDescend:", "onChange:", "modify:", "notNil", "attr:", "asJQuery"],
  104. referencedClasses: []
  105. }),
  106. smalltalk.TrappedCheckedBinder);
  107. smalltalk.addMethod(
  108. smalltalk.method({
  109. selector: "showBlock",
  110. category: 'action',
  111. fn: function (){
  112. var self=this;
  113. return smalltalk.withContext(function($ctx1) {
  114. var $2,$3,$1;
  115. $1=(function(model){
  116. return smalltalk.withContext(function($ctx2) {
  117. $2=_st(self["@brush"])._asJQuery();
  118. if(($receiver = model) == nil || $receiver == null){
  119. $3=false;
  120. } else {
  121. $3=self._prim_(model);
  122. };
  123. return _st($2)._attr_put_("checked",$3);
  124. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1,1)})});
  125. return $1;
  126. }, function($ctx1) {$ctx1.fill(self,"showBlock",{},smalltalk.TrappedCheckedBinder)})},
  127. args: [],
  128. source: "showBlock\x0a\x09^[ :model | brush asJQuery attr: 'checked' put: (model ifNotNil: [ self prim: model ] ifNil: [ false ]) ]",
  129. messageSends: ["attr:put:", "asJQuery", "ifNotNil:ifNil:", "prim:"],
  130. referencedClasses: []
  131. }),
  132. smalltalk.TrappedCheckedBinder);
  133. smalltalk.addClass('TrappedValBinder', smalltalk.TrappedBinder, [], 'Trapped-Frontend');
  134. smalltalk.addMethod(
  135. smalltalk.method({
  136. selector: "installFor:",
  137. category: 'action',
  138. fn: function (path){
  139. var self=this;
  140. return smalltalk.withContext(function($ctx1) {
  141. smalltalk.TrappedValBinder.superclass.fn.prototype._installFor_.apply(_st(self), [path]);
  142. _st(path)._trapDescend_((function(snap){
  143. return smalltalk.withContext(function($ctx2) {
  144. return _st(self["@brush"])._onChange_((function(){
  145. return smalltalk.withContext(function($ctx3) {
  146. return _st(snap)._modify_((function(){
  147. return smalltalk.withContext(function($ctx4) {
  148. return _st(_st(self["@brush"])._asJQuery())._val();
  149. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)})}));
  150. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  151. }, function($ctx2) {$ctx2.fillBlock({snap:snap},$ctx1,1)})}));
  152. return self}, function($ctx1) {$ctx1.fill(self,"installFor:",{path:path},smalltalk.TrappedValBinder)})},
  153. args: ["path"],
  154. source: "installFor: path\x0a\x09super installFor: path.\x0a path trapDescend: [ :snap |\x0a\x09 brush onChange: [ snap modify: [\x0a brush asJQuery val\x0a ]]\x0a ]",
  155. messageSends: ["installFor:", "trapDescend:", "onChange:", "modify:", "val", "asJQuery"],
  156. referencedClasses: []
  157. }),
  158. smalltalk.TrappedValBinder);
  159. smalltalk.addMethod(
  160. smalltalk.method({
  161. selector: "showBlock",
  162. category: 'action',
  163. fn: function (){
  164. var self=this;
  165. return smalltalk.withContext(function($ctx1) {
  166. var $2,$3,$1;
  167. $1=(function(model){
  168. return smalltalk.withContext(function($ctx2) {
  169. $2=_st(self["@brush"])._asJQuery();
  170. if(($receiver = model) == nil || $receiver == null){
  171. $3=(function(){
  172. return smalltalk.withContext(function($ctx3) {
  173. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})});
  174. } else {
  175. $3=self._prim_(model);
  176. };
  177. return _st($2)._val_($3);
  178. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1,1)})});
  179. return $1;
  180. }, function($ctx1) {$ctx1.fill(self,"showBlock",{},smalltalk.TrappedValBinder)})},
  181. args: [],
  182. source: "showBlock\x0a\x09^[ :model | brush asJQuery val: (model ifNotNil: [self prim: model] ifNil: [[]]) ]",
  183. messageSends: ["val:", "asJQuery", "ifNotNil:ifNil:", "prim:"],
  184. referencedClasses: []
  185. }),
  186. smalltalk.TrappedValBinder);
  187. smalltalk.addClass('TrappedDataCarrier', smalltalk.Object, ['target', 'model', 'chain'], 'Trapped-Frontend');
  188. smalltalk.addMethod(
  189. smalltalk.method({
  190. selector: "chain:",
  191. category: 'accessing',
  192. fn: function (aDataChain){
  193. var self=this;
  194. return smalltalk.withContext(function($ctx1) {
  195. self["@chain"]=aDataChain;
  196. return self}, function($ctx1) {$ctx1.fill(self,"chain:",{aDataChain:aDataChain},smalltalk.TrappedDataCarrier)})},
  197. args: ["aDataChain"],
  198. source: "chain: aDataChain\x0a\x09chain := aDataChain",
  199. messageSends: [],
  200. referencedClasses: []
  201. }),
  202. smalltalk.TrappedDataCarrier);
  203. smalltalk.addMethod(
  204. smalltalk.method({
  205. selector: "modifyTarget",
  206. category: 'action',
  207. fn: function (){
  208. var self=this;
  209. return smalltalk.withContext(function($ctx1) {
  210. _st(self._target())._modify_((function(){
  211. return smalltalk.withContext(function($ctx2) {
  212. return self._value();
  213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  214. return self}, function($ctx1) {$ctx1.fill(self,"modifyTarget",{},smalltalk.TrappedDataCarrier)})},
  215. args: [],
  216. source: "modifyTarget\x0a\x09self target modify: [ self value ]",
  217. messageSends: ["modify:", "target", "value"],
  218. referencedClasses: []
  219. }),
  220. smalltalk.TrappedDataCarrier);
  221. smalltalk.addMethod(
  222. smalltalk.method({
  223. selector: "target",
  224. category: 'accessing',
  225. fn: function (){
  226. var self=this;
  227. return smalltalk.withContext(function($ctx1) {
  228. var $1;
  229. $1=self["@target"];
  230. return $1;
  231. }, function($ctx1) {$ctx1.fill(self,"target",{},smalltalk.TrappedDataCarrier)})},
  232. args: [],
  233. source: "target\x0a\x09^target",
  234. messageSends: [],
  235. referencedClasses: []
  236. }),
  237. smalltalk.TrappedDataCarrier);
  238. smalltalk.addMethod(
  239. smalltalk.method({
  240. selector: "target:",
  241. category: 'accessing',
  242. fn: function (anObject){
  243. var self=this;
  244. return smalltalk.withContext(function($ctx1) {
  245. self["@target"]=anObject;
  246. return self}, function($ctx1) {$ctx1.fill(self,"target:",{anObject:anObject},smalltalk.TrappedDataCarrier)})},
  247. args: ["anObject"],
  248. source: "target: anObject\x0a\x09target := anObject",
  249. messageSends: [],
  250. referencedClasses: []
  251. }),
  252. smalltalk.TrappedDataCarrier);
  253. smalltalk.addMethod(
  254. smalltalk.method({
  255. selector: "toTargetContents",
  256. category: 'action',
  257. fn: function (){
  258. var self=this;
  259. return smalltalk.withContext(function($ctx1) {
  260. _st(self._target())._contents_(self._value());
  261. return self}, function($ctx1) {$ctx1.fill(self,"toTargetContents",{},smalltalk.TrappedDataCarrier)})},
  262. args: [],
  263. source: "toTargetContents\x0a\x09self target contents: self value",
  264. messageSends: ["contents:", "target", "value"],
  265. referencedClasses: []
  266. }),
  267. smalltalk.TrappedDataCarrier);
  268. smalltalk.addMethod(
  269. smalltalk.method({
  270. selector: "value",
  271. category: 'accessing',
  272. fn: function (){
  273. var self=this;
  274. return smalltalk.withContext(function($ctx1) {
  275. var $1;
  276. $1=self["@model"];
  277. return $1;
  278. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.TrappedDataCarrier)})},
  279. args: [],
  280. source: "value\x0a\x09^model",
  281. messageSends: [],
  282. referencedClasses: []
  283. }),
  284. smalltalk.TrappedDataCarrier);
  285. smalltalk.addMethod(
  286. smalltalk.method({
  287. selector: "value:",
  288. category: 'accessing',
  289. fn: function (anObject){
  290. var self=this;
  291. return smalltalk.withContext(function($ctx1) {
  292. self["@model"]=anObject;
  293. return self}, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},smalltalk.TrappedDataCarrier)})},
  294. args: ["anObject"],
  295. source: "value: anObject\x0a\x09model := anObject",
  296. messageSends: [],
  297. referencedClasses: []
  298. }),
  299. smalltalk.TrappedDataCarrier);
  300. smalltalk.addMethod(
  301. smalltalk.method({
  302. selector: "on:target:",
  303. category: 'not yet classified',
  304. fn: function (aDataChain,anObject){
  305. var self=this;
  306. return smalltalk.withContext(function($ctx1) {
  307. var $2,$3,$1;
  308. $2=self._new();
  309. _st($2)._chain_(aDataChain);
  310. _st($2)._target_(anObject);
  311. $3=_st($2)._yourself();
  312. $1=$3;
  313. return $1;
  314. }, function($ctx1) {$ctx1.fill(self,"on:target:",{aDataChain:aDataChain,anObject:anObject},smalltalk.TrappedDataCarrier.klass)})},
  315. args: ["aDataChain", "anObject"],
  316. source: "on: aDataChain target: anObject\x0a\x09^self new\x0a\x09\x09chain: aDataChain;\x0a\x09\x09target: anObject;\x0a\x09\x09yourself",
  317. messageSends: ["chain:", "new", "target:", "yourself"],
  318. referencedClasses: []
  319. }),
  320. smalltalk.TrappedDataCarrier.klass);
  321. smalltalk.addClass('TrappedDataCarrierToModel', smalltalk.TrappedDataCarrier, ['index'], 'Trapped-Frontend');
  322. smalltalk.addMethod(
  323. smalltalk.method({
  324. selector: "proceed",
  325. category: 'not yet classified',
  326. fn: function (){
  327. var self=this;
  328. return smalltalk.withContext(function($ctx1) {
  329. var $1;
  330. $1=self["@index"];
  331. if(($receiver = $1) == nil || $receiver == null){
  332. self["@index"]=_st(self["@chain"])._lastProcessorNo();
  333. } else {
  334. self["@index"]=_st(self["@index"]).__minus((1));
  335. };
  336. _st(_st(self["@chain"])._processorNo_(self["@index"]))._toModel_(self);
  337. return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},smalltalk.TrappedDataCarrierToModel)})},
  338. args: [],
  339. source: "proceed\x0a\x09index := index ifNil: [ chain lastProcessorNo ] ifNotNil: [ index - 1 ].\x0a\x09(chain processorNo: index) toModel: self",
  340. messageSends: ["ifNil:ifNotNil:", "lastProcessorNo", "-", "toModel:", "processorNo:"],
  341. referencedClasses: []
  342. }),
  343. smalltalk.TrappedDataCarrierToModel);
  344. smalltalk.addClass('TrappedDataCarrierToView', smalltalk.TrappedDataCarrier, ['index'], 'Trapped-Frontend');
  345. smalltalk.addMethod(
  346. smalltalk.method({
  347. selector: "proceed",
  348. category: 'not yet classified',
  349. fn: function (){
  350. var self=this;
  351. return smalltalk.withContext(function($ctx1) {
  352. var $1;
  353. $1=self["@index"];
  354. if(($receiver = $1) == nil || $receiver == null){
  355. self["@index"]=_st(self["@chain"])._firstProcessorNo();
  356. } else {
  357. self["@index"]=_st(self["@index"]).__plus((1));
  358. };
  359. _st(_st(self["@chain"])._processorNo_(self["@index"]))._toView_(self);
  360. return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},smalltalk.TrappedDataCarrierToView)})},
  361. args: [],
  362. source: "proceed\x0a\x09index := index ifNil: [ chain firstProcessorNo ] ifNotNil: [ index + 1 ].\x0a\x09(chain processorNo: index) toView: self",
  363. messageSends: ["ifNil:ifNotNil:", "firstProcessorNo", "+", "toView:", "processorNo:"],
  364. referencedClasses: []
  365. }),
  366. smalltalk.TrappedDataCarrierToView);
  367. smalltalk.addClass('TrappedDataChain', smalltalk.Object, ['processors'], 'Trapped-Frontend');
  368. smalltalk.addMethod(
  369. smalltalk.method({
  370. selector: "firstProcessorNo",
  371. category: 'accessing',
  372. fn: function (){
  373. var self=this;
  374. return smalltalk.withContext(function($ctx1) {
  375. return (1);
  376. }, function($ctx1) {$ctx1.fill(self,"firstProcessorNo",{},smalltalk.TrappedDataChain)})},
  377. args: [],
  378. source: "firstProcessorNo\x0a\x09^1",
  379. messageSends: [],
  380. referencedClasses: []
  381. }),
  382. smalltalk.TrappedDataChain);
  383. smalltalk.addMethod(
  384. smalltalk.method({
  385. selector: "forSnapshot:andBrush:",
  386. category: 'action',
  387. fn: function (aSnapshot,aTagBrush){
  388. var self=this;
  389. var toViewCarrier,toModelCarrier;
  390. function $TrappedDataCarrierToView(){return smalltalk.TrappedDataCarrierToView||(typeof TrappedDataCarrierToView=="undefined"?nil:TrappedDataCarrierToView)}
  391. function $TrappedDataCarrierToModel(){return smalltalk.TrappedDataCarrierToModel||(typeof TrappedDataCarrierToModel=="undefined"?nil:TrappedDataCarrierToModel)}
  392. return smalltalk.withContext(function($ctx1) {
  393. toViewCarrier=_st($TrappedDataCarrierToView())._on_target_(self,aTagBrush);
  394. $ctx1.sendIdx["on:target:"]=1;
  395. toModelCarrier=_st($TrappedDataCarrierToModel())._on_target_(self,aSnapshot);
  396. _st(self["@processors"])._do_((function(each){
  397. return smalltalk.withContext(function($ctx2) {
  398. return _st(each)._installToView_toModel_(toViewCarrier,toModelCarrier);
  399. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  400. return self}, function($ctx1) {$ctx1.fill(self,"forSnapshot:andBrush:",{aSnapshot:aSnapshot,aTagBrush:aTagBrush,toViewCarrier:toViewCarrier,toModelCarrier:toModelCarrier},smalltalk.TrappedDataChain)})},
  401. args: ["aSnapshot", "aTagBrush"],
  402. source: "forSnapshot: aSnapshot andBrush: aTagBrush\x0a\x09| toViewCarrier toModelCarrier |\x0a\x09toViewCarrier := TrappedDataCarrierToView on: self target: aTagBrush.\x0a\x09toModelCarrier := TrappedDataCarrierToModel on: self target: aSnapshot.\x0a\x09processors do: [ :each | each installToView: toViewCarrier toModel: toModelCarrier ]",
  403. messageSends: ["on:target:", "do:", "installToView:toModel:"],
  404. referencedClasses: ["TrappedDataCarrierToView", "TrappedDataCarrierToModel"]
  405. }),
  406. smalltalk.TrappedDataChain);
  407. smalltalk.addMethod(
  408. smalltalk.method({
  409. selector: "lastProcessorNo",
  410. category: 'accessing',
  411. fn: function (){
  412. var self=this;
  413. return smalltalk.withContext(function($ctx1) {
  414. var $1;
  415. $1=_st(self["@processors"])._size();
  416. return $1;
  417. }, function($ctx1) {$ctx1.fill(self,"lastProcessorNo",{},smalltalk.TrappedDataChain)})},
  418. args: [],
  419. source: "lastProcessorNo\x0a\x09^processors size",
  420. messageSends: ["size"],
  421. referencedClasses: []
  422. }),
  423. smalltalk.TrappedDataChain);
  424. smalltalk.addMethod(
  425. smalltalk.method({
  426. selector: "processorNo:",
  427. category: 'accessing',
  428. fn: function (aNumber){
  429. var self=this;
  430. return smalltalk.withContext(function($ctx1) {
  431. var $1;
  432. $1=_st(self["@processors"])._at_(aNumber);
  433. return $1;
  434. }, function($ctx1) {$ctx1.fill(self,"processorNo:",{aNumber:aNumber},smalltalk.TrappedDataChain)})},
  435. args: ["aNumber"],
  436. source: "processorNo: aNumber\x0a\x09^processors at: aNumber",
  437. messageSends: ["at:"],
  438. referencedClasses: []
  439. }),
  440. smalltalk.TrappedDataChain);
  441. smalltalk.addMethod(
  442. smalltalk.method({
  443. selector: "processors:",
  444. category: 'accessing',
  445. fn: function (anArray){
  446. var self=this;
  447. return smalltalk.withContext(function($ctx1) {
  448. self["@processors"]=anArray;
  449. return self}, function($ctx1) {$ctx1.fill(self,"processors:",{anArray:anArray},smalltalk.TrappedDataChain)})},
  450. args: ["anArray"],
  451. source: "processors: anArray\x0a\x09processors := anArray",
  452. messageSends: [],
  453. referencedClasses: []
  454. }),
  455. smalltalk.TrappedDataChain);
  456. smalltalk.addMethod(
  457. smalltalk.method({
  458. selector: "blackboardReaderWriter",
  459. category: 'private',
  460. fn: function (){
  461. var self=this;
  462. function $TrappedProcessorBlackboard(){return smalltalk.TrappedProcessorBlackboard||(typeof TrappedProcessorBlackboard=="undefined"?nil:TrappedProcessorBlackboard)}
  463. return smalltalk.withContext(function($ctx1) {
  464. var $1;
  465. $1=_st($TrappedProcessorBlackboard())._new();
  466. return $1;
  467. }, function($ctx1) {$ctx1.fill(self,"blackboardReaderWriter",{},smalltalk.TrappedDataChain.klass)})},
  468. args: [],
  469. source: "blackboardReaderWriter\x0a\x09^TrappedProcessorBlackboard new",
  470. messageSends: ["new"],
  471. referencedClasses: ["TrappedProcessorBlackboard"]
  472. }),
  473. smalltalk.TrappedDataChain.klass);
  474. smalltalk.addMethod(
  475. smalltalk.method({
  476. selector: "new:",
  477. category: 'instance creation',
  478. fn: function (anArray){
  479. var self=this;
  480. return smalltalk.withContext(function($ctx1) {
  481. var $2,$3,$1;
  482. $2=self._new();
  483. _st($2)._processors_(_st([self._blackboardReaderWriter()]).__comma(anArray));
  484. $3=_st($2)._yourself();
  485. $1=$3;
  486. return $1;
  487. }, function($ctx1) {$ctx1.fill(self,"new:",{anArray:anArray},smalltalk.TrappedDataChain.klass)})},
  488. args: ["anArray"],
  489. source: "new: anArray\x0a\x09^self new\x0a\x09\x09processors: { self blackboardReaderWriter }, anArray;\x0a\x09\x09yourself",
  490. messageSends: ["processors:", "new", ",", "blackboardReaderWriter", "yourself"],
  491. referencedClasses: []
  492. }),
  493. smalltalk.TrappedDataChain.klass);
  494. smalltalk.addMethod(
  495. smalltalk.method({
  496. selector: "newFromProcessorNames:",
  497. category: 'instance creation',
  498. fn: function (anArray){
  499. var self=this;
  500. function $TrappedProcessor(){return smalltalk.TrappedProcessor||(typeof TrappedProcessor=="undefined"?nil:TrappedProcessor)}
  501. return smalltalk.withContext(function($ctx1) {
  502. var $1;
  503. $1=self._new_(_st(anArray)._collect_((function(each){
  504. return smalltalk.withContext(function($ctx2) {
  505. return _st($TrappedProcessor())._perform_(each);
  506. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})));
  507. return $1;
  508. }, function($ctx1) {$ctx1.fill(self,"newFromProcessorNames:",{anArray:anArray},smalltalk.TrappedDataChain.klass)})},
  509. args: ["anArray"],
  510. source: "newFromProcessorNames: anArray\x0a\x09^self new: (anArray collect: [ :each | TrappedProcessor perform: each ])",
  511. messageSends: ["new:", "collect:", "perform:"],
  512. referencedClasses: ["TrappedProcessor"]
  513. }),
  514. smalltalk.TrappedDataChain.klass);
  515. smalltalk.addClass('TrappedDumbView', smalltalk.Widget, [], 'Trapped-Frontend');
  516. smalltalk.TrappedDumbView.comment="I just read and show an actual path.";
  517. smalltalk.addMethod(
  518. smalltalk.method({
  519. selector: "renderOn:",
  520. category: 'rendering',
  521. fn: function (html){
  522. var self=this;
  523. return smalltalk.withContext(function($ctx1) {
  524. _st(_st(html)._root())._trap_([]);
  525. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html},smalltalk.TrappedDumbView)})},
  526. args: ["html"],
  527. source: "renderOn: html\x0a\x09html root trap: #()",
  528. messageSends: ["trap:", "root"],
  529. referencedClasses: []
  530. }),
  531. smalltalk.TrappedDumbView);
  532. smalltalk.addClass('TrappedProcessor', smalltalk.Object, [], 'Trapped-Frontend');
  533. smalltalk.TrappedProcessor.comment="I process data in TrappedDataChain.\x0aI am stateless flyweight (aka servant)\x0aand will get all necessary data as arguments in API calls.\x0a\x0aMy public API is:\x0a - installToView:toModel:\x0a This gets two TrappedDataCarriers set up without actual data\x0a and at the beginning of their chains. It should do one-time\x0a installation task needed (install event handlers etc.).\x0a To start a chain, do: dataCarrier copy value: data; proceed.\x0a - toView:\x0a This performs transformation of TrappedDataCarrier on its way from model to view.\x0a Should call aDataCarrier proceed to proceed to subsequent step.\x0a - toModel:\x0a This performs transformation of TrappedDataToken on its way from view to model.\x0a Should call aDataCarrier proceed to proceed to subsequent step.\x0a";
  534. smalltalk.addMethod(
  535. smalltalk.method({
  536. selector: "installToView:toModel:",
  537. category: 'installation',
  538. fn: function (aDataCarrier,anotherDataCarrier){
  539. var self=this;
  540. return smalltalk.withContext(function($ctx1) {
  541. return self}, function($ctx1) {$ctx1.fill(self,"installToView:toModel:",{aDataCarrier:aDataCarrier,anotherDataCarrier:anotherDataCarrier},smalltalk.TrappedProcessor)})},
  542. args: ["aDataCarrier", "anotherDataCarrier"],
  543. source: "installToView: aDataCarrier toModel: anotherDataCarrier\x0a\x09\x22by default, do nothing\x22",
  544. messageSends: [],
  545. referencedClasses: []
  546. }),
  547. smalltalk.TrappedProcessor);
  548. smalltalk.addMethod(
  549. smalltalk.method({
  550. selector: "toModel:",
  551. category: 'data transformation',
  552. fn: function (aDataCarrier){
  553. var self=this;
  554. return smalltalk.withContext(function($ctx1) {
  555. _st(aDataCarrier)._proceed();
  556. return self}, function($ctx1) {$ctx1.fill(self,"toModel:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessor)})},
  557. args: ["aDataCarrier"],
  558. source: "toModel: aDataCarrier\x0a\x09\x22by default, proceed\x22\x0a\x09aDataCarrier proceed",
  559. messageSends: ["proceed"],
  560. referencedClasses: []
  561. }),
  562. smalltalk.TrappedProcessor);
  563. smalltalk.addMethod(
  564. smalltalk.method({
  565. selector: "toView:",
  566. category: 'data transformation',
  567. fn: function (aDataCarrier){
  568. var self=this;
  569. return smalltalk.withContext(function($ctx1) {
  570. _st(aDataCarrier)._proceed();
  571. return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessor)})},
  572. args: ["aDataCarrier"],
  573. source: "toView: aDataCarrier\x0a\x09\x22by default, proceed\x22\x0a\x09aDataCarrier proceed",
  574. messageSends: ["proceed"],
  575. referencedClasses: []
  576. }),
  577. smalltalk.TrappedProcessor);
  578. smalltalk.addMethod(
  579. smalltalk.method({
  580. selector: "contents",
  581. category: 'factory',
  582. fn: function (){
  583. var self=this;
  584. function $TrappedProcessorContents(){return smalltalk.TrappedProcessorContents||(typeof TrappedProcessorContents=="undefined"?nil:TrappedProcessorContents)}
  585. return smalltalk.withContext(function($ctx1) {
  586. var $1;
  587. $1=_st($TrappedProcessorContents())._new();
  588. return $1;
  589. }, function($ctx1) {$ctx1.fill(self,"contents",{},smalltalk.TrappedProcessor.klass)})},
  590. args: [],
  591. source: "contents\x0a\x09^TrappedProcessorContents new",
  592. messageSends: ["new"],
  593. referencedClasses: ["TrappedProcessorContents"]
  594. }),
  595. smalltalk.TrappedProcessor.klass);
  596. smalltalk.addClass('TrappedProcessorBlackboard', smalltalk.TrappedProcessor, [], 'Trapped-Frontend');
  597. smalltalk.TrappedProcessorBlackboard.comment="I am used internally to fetch data from blackboard\x0aor write it back.";
  598. smalltalk.addMethod(
  599. smalltalk.method({
  600. selector: "installToView:toModel:",
  601. category: 'installation',
  602. fn: function (aDataCarrier,anotherDataCarrier){
  603. var self=this;
  604. var snap;
  605. function $KeyedPubSubUnsubscribe(){return smalltalk.KeyedPubSubUnsubscribe||(typeof KeyedPubSubUnsubscribe=="undefined"?nil:KeyedPubSubUnsubscribe)}
  606. return smalltalk.withContext(function($ctx1) {
  607. var $1,$2,$3;
  608. snap=_st(anotherDataCarrier)._target();
  609. $ctx1.sendIdx["target"]=1;
  610. _st(snap)._watch_((function(data){
  611. return smalltalk.withContext(function($ctx2) {
  612. $1=_st(_st(_st(_st(_st(aDataCarrier)._target())._asJQuery())._closest_("html"))._toArray())._isEmpty();
  613. if(smalltalk.assert($1)){
  614. _st($KeyedPubSubUnsubscribe())._signal();
  615. };
  616. return _st(snap)._do_((function(){
  617. return smalltalk.withContext(function($ctx3) {
  618. $2=_st(aDataCarrier)._copy();
  619. _st($2)._value_(data);
  620. $3=_st($2)._proceed();
  621. return $3;
  622. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  623. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,1)})}));
  624. return self}, function($ctx1) {$ctx1.fill(self,"installToView:toModel:",{aDataCarrier:aDataCarrier,anotherDataCarrier:anotherDataCarrier,snap:snap},smalltalk.TrappedProcessorBlackboard)})},
  625. args: ["aDataCarrier", "anotherDataCarrier"],
  626. source: "installToView: aDataCarrier toModel: anotherDataCarrier\x0a\x09| snap |\x0a\x09snap := anotherDataCarrier target.\x0a\x09snap watch: [ :data |\x0a\x09\x09(aDataCarrier target asJQuery closest: 'html') toArray isEmpty ifTrue: [ KeyedPubSubUnsubscribe signal ].\x0a snap do: [ aDataCarrier copy value: data; proceed ] ]",
  627. messageSends: ["target", "watch:", "ifTrue:", "isEmpty", "toArray", "closest:", "asJQuery", "signal", "do:", "value:", "copy", "proceed"],
  628. referencedClasses: ["KeyedPubSubUnsubscribe"]
  629. }),
  630. smalltalk.TrappedProcessorBlackboard);
  631. smalltalk.addMethod(
  632. smalltalk.method({
  633. selector: "toModel:",
  634. category: 'data transformation',
  635. fn: function (aDataCarrier){
  636. var self=this;
  637. return smalltalk.withContext(function($ctx1) {
  638. _st(aDataCarrier)._modifyTarget();
  639. return self}, function($ctx1) {$ctx1.fill(self,"toModel:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorBlackboard)})},
  640. args: ["aDataCarrier"],
  641. source: "toModel: aDataCarrier\x0a\x09aDataCarrier modifyTarget",
  642. messageSends: ["modifyTarget"],
  643. referencedClasses: []
  644. }),
  645. smalltalk.TrappedProcessorBlackboard);
  646. smalltalk.addClass('TrappedProcessorContents', smalltalk.TrappedProcessor, [], 'Trapped-Frontend');
  647. smalltalk.TrappedProcessorContents.comment="I put data into target via contents: in toView:";
  648. smalltalk.addMethod(
  649. smalltalk.method({
  650. selector: "toView:",
  651. category: 'data transformation',
  652. fn: function (aDataCarrier){
  653. var self=this;
  654. return smalltalk.withContext(function($ctx1) {
  655. _st(aDataCarrier)._toTargetContents();
  656. return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessorContents)})},
  657. args: ["aDataCarrier"],
  658. source: "toView: aDataCarrier\x0a\x09aDataCarrier toTargetContents",
  659. messageSends: ["toTargetContents"],
  660. referencedClasses: []
  661. }),
  662. smalltalk.TrappedProcessorContents);
  663. smalltalk.addClass('TrappedSingleton', smalltalk.Object, [], 'Trapped-Frontend');
  664. smalltalk.addMethod(
  665. smalltalk.method({
  666. selector: "start:",
  667. category: 'action',
  668. fn: function (args){
  669. var self=this;
  670. return smalltalk.withContext(function($ctx1) {
  671. var $1;
  672. $1=self._subclassResponsibility();
  673. return $1;
  674. }, function($ctx1) {$ctx1.fill(self,"start:",{args:args},smalltalk.TrappedSingleton)})},
  675. args: ["args"],
  676. source: "start: args\x0a\x09^ self subclassResponsibility",
  677. messageSends: ["subclassResponsibility"],
  678. referencedClasses: []
  679. }),
  680. smalltalk.TrappedSingleton);
  681. smalltalk.TrappedSingleton.klass.iVarNames = ['current'];
  682. smalltalk.addMethod(
  683. smalltalk.method({
  684. selector: "current",
  685. category: 'accessing',
  686. fn: function (){
  687. var self=this;
  688. return smalltalk.withContext(function($ctx1) {
  689. var $2,$1;
  690. $2=self["@current"];
  691. if(($receiver = $2) == nil || $receiver == null){
  692. self["@current"]=self._new();
  693. $1=self["@current"];
  694. } else {
  695. $1=$2;
  696. };
  697. return $1;
  698. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.TrappedSingleton.klass)})},
  699. args: [],
  700. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  701. messageSends: ["ifNil:", "new"],
  702. referencedClasses: []
  703. }),
  704. smalltalk.TrappedSingleton.klass);
  705. smalltalk.addMethod(
  706. smalltalk.method({
  707. selector: "start:",
  708. category: 'action',
  709. fn: function (args){
  710. var self=this;
  711. return smalltalk.withContext(function($ctx1) {
  712. _st(self._current())._start_(args);
  713. return self}, function($ctx1) {$ctx1.fill(self,"start:",{args:args},smalltalk.TrappedSingleton.klass)})},
  714. args: ["args"],
  715. source: "start: args\x0a\x09self current start: args",
  716. messageSends: ["start:", "current"],
  717. referencedClasses: []
  718. }),
  719. smalltalk.TrappedSingleton.klass);
  720. smalltalk.addClass('Trapped', smalltalk.TrappedSingleton, ['registry'], 'Trapped-Frontend');
  721. smalltalk.addMethod(
  722. smalltalk.method({
  723. selector: "binder:",
  724. category: 'binders',
  725. fn: function (aTagBrush){
  726. var self=this;
  727. var binder,tag;
  728. function $TrappedCheckedBinder(){return smalltalk.TrappedCheckedBinder||(typeof TrappedCheckedBinder=="undefined"?nil:TrappedCheckedBinder)}
  729. function $TrappedValBinder(){return smalltalk.TrappedValBinder||(typeof TrappedValBinder=="undefined"?nil:TrappedValBinder)}
  730. function $TrappedBinder(){return smalltalk.TrappedBinder||(typeof TrappedBinder=="undefined"?nil:TrappedBinder)}
  731. return smalltalk.withContext(function($ctx1) {
  732. var $1,$2,$3,$4,$6,$7,$5;
  733. tag=_st(_st(aTagBrush)._element())._nodeName();
  734. $1=_st(tag).__eq("INPUT");
  735. $ctx1.sendIdx["="]=1;
  736. if(smalltalk.assert($1)){
  737. var type;
  738. type=_st(_st(aTagBrush)._asJQuery())._attr_("type");
  739. type;
  740. $2=_st(type).__eq("checkbox");
  741. $ctx1.sendIdx["="]=2;
  742. if(smalltalk.assert($2)){
  743. binder=_st($TrappedCheckedBinder())._new();
  744. $ctx1.sendIdx["new"]=1;
  745. binder;
  746. };
  747. $3=_st(type).__eq("text");
  748. if(smalltalk.assert($3)){
  749. binder=_st($TrappedValBinder())._new();
  750. $ctx1.sendIdx["new"]=2;
  751. binder;
  752. };
  753. };
  754. $4=binder;
  755. if(($receiver = $4) == nil || $receiver == null){
  756. binder=_st($TrappedBinder())._new();
  757. binder;
  758. } else {
  759. $4;
  760. };
  761. $6=binder;
  762. _st($6)._brush_(aTagBrush);
  763. $7=_st($6)._yourself();
  764. $5=$7;
  765. return $5;
  766. }, function($ctx1) {$ctx1.fill(self,"binder:",{aTagBrush:aTagBrush,binder:binder,tag:tag},smalltalk.Trapped)})},
  767. args: ["aTagBrush"],
  768. source: "binder: aTagBrush\x0a \x22Prototype; will select based on tag etc.\x22\x0a | binder tag |\x0a tag := aTagBrush element nodeName.\x0a tag = 'INPUT' ifTrue: [\x0a | type |\x0a type := aTagBrush asJQuery attr: 'type'.\x0a type = 'checkbox' ifTrue: [ binder := TrappedCheckedBinder new ].\x0a type = 'text' ifTrue: [ binder := TrappedValBinder new ]\x0a ].\x0a binder ifNil: [ binder := TrappedBinder new ].\x0a ^ binder brush: aTagBrush; yourself",
  769. messageSends: ["nodeName", "element", "ifTrue:", "=", "attr:", "asJQuery", "new", "ifNil:", "brush:", "yourself"],
  770. referencedClasses: ["TrappedCheckedBinder", "TrappedValBinder", "TrappedBinder"]
  771. }),
  772. smalltalk.Trapped);
  773. smalltalk.addMethod(
  774. smalltalk.method({
  775. selector: "byName:",
  776. category: 'accessing',
  777. fn: function (aString){
  778. var self=this;
  779. return smalltalk.withContext(function($ctx1) {
  780. var $1;
  781. $1=_st(self["@registry"])._at_(aString);
  782. return $1;
  783. }, function($ctx1) {$ctx1.fill(self,"byName:",{aString:aString},smalltalk.Trapped)})},
  784. args: ["aString"],
  785. source: "byName: aString\x0a\x09^ registry at: aString",
  786. messageSends: ["at:"],
  787. referencedClasses: []
  788. }),
  789. smalltalk.Trapped);
  790. smalltalk.addMethod(
  791. smalltalk.method({
  792. selector: "descend:snapshotDo:",
  793. category: 'action',
  794. fn: function (anArray,aBlock){
  795. var self=this;
  796. var tpsc;
  797. function $TrappedPathStack(){return smalltalk.TrappedPathStack||(typeof TrappedPathStack=="undefined"?nil:TrappedPathStack)}
  798. function $TrappedSnapshot(){return smalltalk.TrappedSnapshot||(typeof TrappedSnapshot=="undefined"?nil:TrappedSnapshot)}
  799. return smalltalk.withContext(function($ctx1) {
  800. tpsc=_st($TrappedPathStack())._current();
  801. _st(tpsc)._append_do_(anArray,(function(){
  802. var path,model;
  803. return smalltalk.withContext(function($ctx2) {
  804. path=_st(_st(tpsc)._elements())._copy();
  805. path;
  806. model=self._byName_(_st(path)._first());
  807. model;
  808. return _st(aBlock)._value_(_st(_st($TrappedSnapshot())._new())._path_model_(path,model));
  809. }, function($ctx2) {$ctx2.fillBlock({path:path,model:model},$ctx1,1)})}));
  810. return self}, function($ctx1) {$ctx1.fill(self,"descend:snapshotDo:",{anArray:anArray,aBlock:aBlock,tpsc:tpsc},smalltalk.Trapped)})},
  811. args: ["anArray", "aBlock"],
  812. source: "descend: anArray snapshotDo: aBlock\x0a\x09| tpsc |\x0a tpsc := TrappedPathStack current.\x0a tpsc append: anArray do: [\x0a | path model |\x0a path := tpsc elements copy.\x0a \x09 model := self byName: path first.\x0a aBlock value: (TrappedSnapshot new path: path model: model)\x0a ]",
  813. messageSends: ["current", "append:do:", "copy", "elements", "byName:", "first", "value:", "path:model:", "new"],
  814. referencedClasses: ["TrappedPathStack", "TrappedSnapshot"]
  815. }),
  816. smalltalk.Trapped);
  817. smalltalk.addMethod(
  818. smalltalk.method({
  819. selector: "initialize",
  820. category: 'initialization',
  821. fn: function (){
  822. var self=this;
  823. return smalltalk.withContext(function($ctx1) {
  824. smalltalk.Trapped.superclass.fn.prototype._initialize.apply(_st(self), []);
  825. self["@registry"]=smalltalk.HashedCollection._from_([]);
  826. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Trapped)})},
  827. args: [],
  828. source: "initialize\x0a\x09super initialize.\x0a\x09registry := #{}.",
  829. messageSends: ["initialize"],
  830. referencedClasses: []
  831. }),
  832. smalltalk.Trapped);
  833. smalltalk.addMethod(
  834. smalltalk.method({
  835. selector: "register:",
  836. category: 'accessing',
  837. fn: function (aListKeyedEntity){
  838. var self=this;
  839. return smalltalk.withContext(function($ctx1) {
  840. self._register_name_(aListKeyedEntity,_st(_st(aListKeyedEntity)._class())._name());
  841. return self}, function($ctx1) {$ctx1.fill(self,"register:",{aListKeyedEntity:aListKeyedEntity},smalltalk.Trapped)})},
  842. args: ["aListKeyedEntity"],
  843. source: "register: aListKeyedEntity\x0a\x09self register: aListKeyedEntity name: aListKeyedEntity class name",
  844. messageSends: ["register:name:", "name", "class"],
  845. referencedClasses: []
  846. }),
  847. smalltalk.Trapped);
  848. smalltalk.addMethod(
  849. smalltalk.method({
  850. selector: "register:name:",
  851. category: 'accessing',
  852. fn: function (aListKeyedEntity,aString){
  853. var self=this;
  854. return smalltalk.withContext(function($ctx1) {
  855. _st(self["@registry"])._at_put_(aString,aListKeyedEntity);
  856. return self}, function($ctx1) {$ctx1.fill(self,"register:name:",{aListKeyedEntity:aListKeyedEntity,aString:aString},smalltalk.Trapped)})},
  857. args: ["aListKeyedEntity", "aString"],
  858. source: "register: aListKeyedEntity name: aString\x0a\x09registry at: aString put: aListKeyedEntity",
  859. messageSends: ["at:put:"],
  860. referencedClasses: []
  861. }),
  862. smalltalk.Trapped);
  863. smalltalk.addMethod(
  864. smalltalk.method({
  865. selector: "start:",
  866. category: 'action',
  867. fn: function (args){
  868. var self=this;
  869. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  870. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  871. return smalltalk.withContext(function($ctx1) {
  872. var $1,$2;
  873. _st(args)._do_((function(each){
  874. return smalltalk.withContext(function($ctx2) {
  875. return self._register_(each);
  876. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  877. $1="[data-trap]"._asJQuery();
  878. $ctx1.sendIdx["asJQuery"]=1;
  879. _st($1)._each_((function(index,elem){
  880. var trap,jq,viewName,modelName,tokens,path;
  881. return smalltalk.withContext(function($ctx2) {
  882. jq=_st(elem)._asJQuery();
  883. jq;
  884. trap=_st(jq)._attr_("data-trap");
  885. trap;
  886. tokens=_st(trap)._tokenize_(":");
  887. $ctx2.sendIdx["tokenize:"]=1;
  888. tokens;
  889. $2=_st(_st(tokens)._size()).__eq((1));
  890. if(smalltalk.assert($2)){
  891. tokens=_st(["TrappedDumbView"]).__comma(tokens);
  892. $ctx2.sendIdx[","]=1;
  893. tokens;
  894. };
  895. viewName=_st(tokens)._first();
  896. $ctx2.sendIdx["first"]=1;
  897. viewName;
  898. tokens=_st(_st(_st(tokens)._second())._tokenize_(" "))._select_((function(each){
  899. return smalltalk.withContext(function($ctx3) {
  900. return _st(each)._notEmpty();
  901. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)})}));
  902. tokens;
  903. modelName=_st(tokens)._first();
  904. modelName;
  905. path=_st($Trapped())._parse_(_st(tokens)._allButFirst());
  906. path;
  907. return _st(_st([modelName]).__comma(path))._trapDescend_((function(){
  908. return smalltalk.withContext(function($ctx3) {
  909. return _st(_st(_st(_st($Smalltalk())._current())._at_(viewName))._new())._appendToJQuery_(jq);
  910. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)})}));
  911. }, function($ctx2) {$ctx2.fillBlock({index:index,elem:elem,trap:trap,jq:jq,viewName:viewName,modelName:modelName,tokens:tokens,path:path},$ctx1,2)})}));
  912. return self}, function($ctx1) {$ctx1.fill(self,"start:",{args:args},smalltalk.Trapped)})},
  913. args: ["args"],
  914. source: "start: args\x0a args do: [ :each | self register: each ].\x0a\x09'[data-trap]' asJQuery each: [ :index :elem |\x0a \x09| trap jq viewName modelName tokens path |\x0a jq := elem asJQuery.\x0a trap := jq attr: 'data-trap'.\x0a tokens := trap tokenize: ':'.\x0a tokens size = 1 ifTrue: [ tokens := { 'TrappedDumbView' }, tokens ].\x0a viewName := tokens first.\x0a tokens := (tokens second tokenize: ' ') select: [ :each | each notEmpty ].\x0a modelName := tokens first.\x0a path := Trapped parse: tokens allButFirst.\x0a { modelName }, path trapDescend: [(Smalltalk current at: viewName) new appendToJQuery: jq].\x0a ]",
  915. messageSends: ["do:", "register:", "each:", "asJQuery", "attr:", "tokenize:", "ifTrue:", "=", "size", ",", "first", "select:", "second", "notEmpty", "parse:", "allButFirst", "trapDescend:", "appendToJQuery:", "new", "at:", "current"],
  916. referencedClasses: ["Trapped", "Smalltalk"]
  917. }),
  918. smalltalk.Trapped);
  919. smalltalk.addMethod(
  920. smalltalk.method({
  921. selector: "envelope:loop:before:tag:do:",
  922. category: 'private',
  923. fn: function (envelope,model,endjq,aSymbol,aBlock){
  924. var self=this;
  925. var envjq;
  926. return smalltalk.withContext(function($ctx1) {
  927. envjq=_st(envelope)._asJQuery();
  928. _st(model)._withIndexDo_((function(item,i){
  929. return smalltalk.withContext(function($ctx2) {
  930. _st(envelope)._with_((function(html){
  931. return smalltalk.withContext(function($ctx3) {
  932. return _st(_st(html)._perform_(aSymbol))._trap_read_([i],aBlock);
  933. }, function($ctx3) {$ctx3.fillBlock({html:html},$ctx2,2)})}));
  934. return _st(_st(_st(envjq)._children())._detach())._insertBefore_(endjq);
  935. }, function($ctx2) {$ctx2.fillBlock({item:item,i:i},$ctx1,1)})}));
  936. _st(envjq)._remove();
  937. return self}, function($ctx1) {$ctx1.fill(self,"envelope:loop:before:tag:do:",{envelope:envelope,model:model,endjq:endjq,aSymbol:aSymbol,aBlock:aBlock,envjq:envjq},smalltalk.Trapped.klass)})},
  938. args: ["envelope", "model", "endjq", "aSymbol", "aBlock"],
  939. source: "envelope: envelope loop: model before: endjq tag: aSymbol do: aBlock\x0a \x09| envjq |\x0a envjq := envelope asJQuery.\x0a model withIndexDo: [ :item :i |\x0a envelope with: [ :html | (html perform: aSymbol) trap: {i} read: aBlock ].\x0a envjq children detach insertBefore: endjq.\x0a ].\x0a envjq remove",
  940. messageSends: ["asJQuery", "withIndexDo:", "with:", "trap:read:", "perform:", "insertBefore:", "detach", "children", "remove"],
  941. referencedClasses: []
  942. }),
  943. smalltalk.Trapped.klass);
  944. smalltalk.addMethod(
  945. smalltalk.method({
  946. selector: "loop:between:and:tag:do:",
  947. category: 'private',
  948. fn: function (model,start,end,aSymbol,aBlock){
  949. var self=this;
  950. return smalltalk.withContext(function($ctx1) {
  951. var $2,$1;
  952. $2=_st(start)._asJQuery();
  953. $ctx1.sendIdx["asJQuery"]=1;
  954. $1=_st($2)._nextUntil_(_st(end)._element());
  955. _st($1)._remove();
  956. _st(start)._with_((function(html){
  957. return smalltalk.withContext(function($ctx2) {
  958. if(($receiver = model) == nil || $receiver == null){
  959. return model;
  960. } else {
  961. return self._envelope_loop_before_tag_do_(_st(html)._div(),model,_st(end)._asJQuery(),aSymbol,aBlock);
  962. };
  963. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)})}));
  964. return self}, function($ctx1) {$ctx1.fill(self,"loop:between:and:tag:do:",{model:model,start:start,end:end,aSymbol:aSymbol,aBlock:aBlock},smalltalk.Trapped.klass)})},
  965. args: ["model", "start", "end", "aSymbol", "aBlock"],
  966. source: "loop: model between: start and: end tag: aSymbol do: aBlock\x0a (start asJQuery nextUntil: end element) remove.\x0a start with: [ :html | model ifNotNil: [\x0a \x09self envelope: html div loop: model before: end asJQuery tag: aSymbol do: aBlock\x0a\x09]]",
  967. messageSends: ["remove", "nextUntil:", "asJQuery", "element", "with:", "ifNotNil:", "envelope:loop:before:tag:do:", "div"],
  968. referencedClasses: []
  969. }),
  970. smalltalk.Trapped.klass);
  971. smalltalk.addMethod(
  972. smalltalk.method({
  973. selector: "parse:",
  974. category: 'accessing',
  975. fn: function (anArray){
  976. var self=this;
  977. return smalltalk.withContext(function($ctx1) {
  978. var $2,$3,$1;
  979. $1=_st(anArray)._collect_((function(each){
  980. var asNum;
  981. return smalltalk.withContext(function($ctx2) {
  982. asNum=_st(each)._asNumber();
  983. asNum;
  984. $2=_st(asNum).__eq(asNum);
  985. $ctx2.sendIdx["="]=1;
  986. if(smalltalk.assert($2)){
  987. return asNum;
  988. } else {
  989. $3=_st(_st(each)._first()).__eq("#");
  990. if(smalltalk.assert($3)){
  991. return [_st(each)._allButFirst()];
  992. } else {
  993. return each;
  994. };
  995. };
  996. }, function($ctx2) {$ctx2.fillBlock({each:each,asNum:asNum},$ctx1,1)})}));
  997. return $1;
  998. }, function($ctx1) {$ctx1.fill(self,"parse:",{anArray:anArray},smalltalk.Trapped.klass)})},
  999. args: ["anArray"],
  1000. source: "parse: anArray\x0a\x09^anArray collect: [ :each |\x0a \x09| asNum |\x0a \x09asNum := each asNumber.\x0a asNum = asNum ifTrue: [ asNum ] ifFalse: [\x0a\x09\x09\x09each first = '#' ifTrue: [ { each allButFirst } ] ifFalse: [ each ]]]",
  1001. messageSends: ["collect:", "asNumber", "ifTrue:ifFalse:", "=", "first", "allButFirst"],
  1002. referencedClasses: []
  1003. }),
  1004. smalltalk.Trapped.klass);
  1005. smalltalk.addClass('TrappedPathStack', smalltalk.TrappedSingleton, ['elements'], 'Trapped-Frontend');
  1006. smalltalk.addMethod(
  1007. smalltalk.method({
  1008. selector: "append:do:",
  1009. category: 'descending',
  1010. fn: function (anArray,aBlock){
  1011. var self=this;
  1012. return smalltalk.withContext(function($ctx1) {
  1013. self._with_do_(_st(self["@elements"]).__comma(anArray),aBlock);
  1014. return self}, function($ctx1) {$ctx1.fill(self,"append:do:",{anArray:anArray,aBlock:aBlock},smalltalk.TrappedPathStack)})},
  1015. args: ["anArray", "aBlock"],
  1016. source: "append: anArray do: aBlock\x0a self with: elements, anArray do: aBlock",
  1017. messageSends: ["with:do:", ","],
  1018. referencedClasses: []
  1019. }),
  1020. smalltalk.TrappedPathStack);
  1021. smalltalk.addMethod(
  1022. smalltalk.method({
  1023. selector: "elements",
  1024. category: 'accessing',
  1025. fn: function (){
  1026. var self=this;
  1027. return smalltalk.withContext(function($ctx1) {
  1028. var $1;
  1029. $1=self["@elements"];
  1030. return $1;
  1031. }, function($ctx1) {$ctx1.fill(self,"elements",{},smalltalk.TrappedPathStack)})},
  1032. args: [],
  1033. source: "elements\x0a\x09^elements",
  1034. messageSends: [],
  1035. referencedClasses: []
  1036. }),
  1037. smalltalk.TrappedPathStack);
  1038. smalltalk.addMethod(
  1039. smalltalk.method({
  1040. selector: "initialize",
  1041. category: 'initialization',
  1042. fn: function (){
  1043. var self=this;
  1044. return smalltalk.withContext(function($ctx1) {
  1045. smalltalk.TrappedPathStack.superclass.fn.prototype._initialize.apply(_st(self), []);
  1046. self["@elements"]=[];
  1047. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.TrappedPathStack)})},
  1048. args: [],
  1049. source: "initialize\x0a super initialize.\x0a\x09elements := #().",
  1050. messageSends: ["initialize"],
  1051. referencedClasses: []
  1052. }),
  1053. smalltalk.TrappedPathStack);
  1054. smalltalk.addMethod(
  1055. smalltalk.method({
  1056. selector: "with:do:",
  1057. category: 'descending',
  1058. fn: function (anArray,aBlock){
  1059. var self=this;
  1060. var old;
  1061. return smalltalk.withContext(function($ctx1) {
  1062. old=self["@elements"];
  1063. _st((function(){
  1064. return smalltalk.withContext(function($ctx2) {
  1065. self["@elements"]=anArray;
  1066. self["@elements"];
  1067. return _st(aBlock)._value();
  1068. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  1069. return smalltalk.withContext(function($ctx2) {
  1070. self["@elements"]=old;
  1071. return self["@elements"];
  1072. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1073. return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anArray:anArray,aBlock:aBlock,old:old},smalltalk.TrappedPathStack)})},
  1074. args: ["anArray", "aBlock"],
  1075. source: "with: anArray do: aBlock\x0a\x09| old |\x0a old := elements.\x0a [ elements := anArray.\x0a\x09aBlock value ] ensure: [ elements := old ]",
  1076. messageSends: ["ensure:", "value"],
  1077. referencedClasses: []
  1078. }),
  1079. smalltalk.TrappedPathStack);
  1080. smalltalk.addClass('TrappedSnapshot', smalltalk.Object, ['path', 'model'], 'Trapped-Frontend');
  1081. smalltalk.addMethod(
  1082. smalltalk.method({
  1083. selector: "do:",
  1084. category: 'action',
  1085. fn: function (aBlock){
  1086. var self=this;
  1087. function $TrappedPathStack(){return smalltalk.TrappedPathStack||(typeof TrappedPathStack=="undefined"?nil:TrappedPathStack)}
  1088. return smalltalk.withContext(function($ctx1) {
  1089. _st(_st($TrappedPathStack())._current())._with_do_(self["@path"],(function(){
  1090. return smalltalk.withContext(function($ctx2) {
  1091. return _st(aBlock)._value_(self["@model"]);
  1092. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1093. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.TrappedSnapshot)})},
  1094. args: ["aBlock"],
  1095. source: "do: aBlock\x0a\x09TrappedPathStack current with: path do: [ aBlock value: model ]",
  1096. messageSends: ["with:do:", "current", "value:"],
  1097. referencedClasses: ["TrappedPathStack"]
  1098. }),
  1099. smalltalk.TrappedSnapshot);
  1100. smalltalk.addMethod(
  1101. smalltalk.method({
  1102. selector: "model",
  1103. category: 'accessing',
  1104. fn: function (){
  1105. var self=this;
  1106. return smalltalk.withContext(function($ctx1) {
  1107. var $1;
  1108. $1=self["@model"];
  1109. return $1;
  1110. }, function($ctx1) {$ctx1.fill(self,"model",{},smalltalk.TrappedSnapshot)})},
  1111. args: [],
  1112. source: "model\x0a\x09^model",
  1113. messageSends: [],
  1114. referencedClasses: []
  1115. }),
  1116. smalltalk.TrappedSnapshot);
  1117. smalltalk.addMethod(
  1118. smalltalk.method({
  1119. selector: "modify:",
  1120. category: 'action',
  1121. fn: function (aBlock){
  1122. var self=this;
  1123. return smalltalk.withContext(function($ctx1) {
  1124. _st(self._model())._modify_do_(_st(self._path())._allButFirst(),aBlock);
  1125. return self}, function($ctx1) {$ctx1.fill(self,"modify:",{aBlock:aBlock},smalltalk.TrappedSnapshot)})},
  1126. args: ["aBlock"],
  1127. source: "modify: aBlock\x0a\x09self model modify: self path allButFirst do: aBlock",
  1128. messageSends: ["modify:do:", "model", "allButFirst", "path"],
  1129. referencedClasses: []
  1130. }),
  1131. smalltalk.TrappedSnapshot);
  1132. smalltalk.addMethod(
  1133. smalltalk.method({
  1134. selector: "path",
  1135. category: 'accessing',
  1136. fn: function (){
  1137. var self=this;
  1138. return smalltalk.withContext(function($ctx1) {
  1139. var $1;
  1140. $1=self["@path"];
  1141. return $1;
  1142. }, function($ctx1) {$ctx1.fill(self,"path",{},smalltalk.TrappedSnapshot)})},
  1143. args: [],
  1144. source: "path\x0a\x09^path",
  1145. messageSends: [],
  1146. referencedClasses: []
  1147. }),
  1148. smalltalk.TrappedSnapshot);
  1149. smalltalk.addMethod(
  1150. smalltalk.method({
  1151. selector: "path:model:",
  1152. category: 'accessing',
  1153. fn: function (anArray,aTrappedMW){
  1154. var self=this;
  1155. return smalltalk.withContext(function($ctx1) {
  1156. self["@path"]=anArray;
  1157. self["@model"]=aTrappedMW;
  1158. return self}, function($ctx1) {$ctx1.fill(self,"path:model:",{anArray:anArray,aTrappedMW:aTrappedMW},smalltalk.TrappedSnapshot)})},
  1159. args: ["anArray", "aTrappedMW"],
  1160. source: "path: anArray model: aTrappedMW\x0a\x09path := anArray.\x0a model := aTrappedMW",
  1161. messageSends: [],
  1162. referencedClasses: []
  1163. }),
  1164. smalltalk.TrappedSnapshot);
  1165. smalltalk.addMethod(
  1166. smalltalk.method({
  1167. selector: "watch:",
  1168. category: 'action',
  1169. fn: function (aBlock){
  1170. var self=this;
  1171. return smalltalk.withContext(function($ctx1) {
  1172. _st(self._model())._watch_do_(_st(self._path())._allButFirst(),aBlock);
  1173. return self}, function($ctx1) {$ctx1.fill(self,"watch:",{aBlock:aBlock},smalltalk.TrappedSnapshot)})},
  1174. args: ["aBlock"],
  1175. source: "watch: aBlock\x0a\x09self model watch: self path allButFirst do: aBlock",
  1176. messageSends: ["watch:do:", "model", "allButFirst", "path"],
  1177. referencedClasses: []
  1178. }),
  1179. smalltalk.TrappedSnapshot);
  1180. smalltalk.addMethod(
  1181. smalltalk.method({
  1182. selector: "trapDescend:",
  1183. category: '*Trapped-Frontend',
  1184. fn: function (aBlock){
  1185. var self=this;
  1186. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  1187. return smalltalk.withContext(function($ctx1) {
  1188. _st(_st($Trapped())._current())._descend_snapshotDo_(self,aBlock);
  1189. return self}, function($ctx1) {$ctx1.fill(self,"trapDescend:",{aBlock:aBlock},smalltalk.Array)})},
  1190. args: ["aBlock"],
  1191. source: "trapDescend: aBlock\x0a\x09Trapped current descend: self snapshotDo: aBlock",
  1192. messageSends: ["descend:snapshotDo:", "current"],
  1193. referencedClasses: ["Trapped"]
  1194. }),
  1195. smalltalk.Array);
  1196. smalltalk.addMethod(
  1197. smalltalk.method({
  1198. selector: "trapIter:tag:do:",
  1199. category: '*Trapped-Frontend',
  1200. fn: function (path,aSymbol,aBlock){
  1201. var self=this;
  1202. var start,end;
  1203. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  1204. return smalltalk.withContext(function($ctx1) {
  1205. self._with_((function(html){
  1206. return smalltalk.withContext(function($ctx2) {
  1207. start=_st(html)._script();
  1208. $ctx2.sendIdx["script"]=1;
  1209. start;
  1210. end=_st(html)._script();
  1211. return end;
  1212. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)})}));
  1213. _st(start)._trap_read_(path,(function(model){
  1214. return smalltalk.withContext(function($ctx2) {
  1215. return _st($Trapped())._loop_between_and_tag_do_(model,start,end,aSymbol,aBlock);
  1216. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1,2)})}));
  1217. return self}, function($ctx1) {$ctx1.fill(self,"trapIter:tag:do:",{path:path,aSymbol:aSymbol,aBlock:aBlock,start:start,end:end},smalltalk.HTMLCanvas)})},
  1218. args: ["path", "aSymbol", "aBlock"],
  1219. source: "trapIter: path tag: aSymbol do: aBlock\x0a\x09| start end |\x0a self with: [ :html | start := html script. end := html script ].\x0a start trap: path read: [ :model |\x0a \x09Trapped loop: model between: start and: end tag: aSymbol do: aBlock.\x0a ]",
  1220. messageSends: ["with:", "script", "trap:read:", "loop:between:and:tag:do:"],
  1221. referencedClasses: ["Trapped"]
  1222. }),
  1223. smalltalk.HTMLCanvas);
  1224. smalltalk.addMethod(
  1225. smalltalk.method({
  1226. selector: "trap:",
  1227. category: '*Trapped-Frontend',
  1228. fn: function (path){
  1229. var self=this;
  1230. return smalltalk.withContext(function($ctx1) {
  1231. self._trap_processors_(path,["contents"]);
  1232. return self}, function($ctx1) {$ctx1.fill(self,"trap:",{path:path},smalltalk.TagBrush)})},
  1233. args: ["path"],
  1234. source: "trap: path\x0a\x09self trap: path processors: #(contents)",
  1235. messageSends: ["trap:processors:"],
  1236. referencedClasses: []
  1237. }),
  1238. smalltalk.TagBrush);
  1239. smalltalk.addMethod(
  1240. smalltalk.method({
  1241. selector: "trap:processors:",
  1242. category: '*Trapped-Frontend',
  1243. fn: function (path,anArray){
  1244. var self=this;
  1245. function $TrappedDataChain(){return smalltalk.TrappedDataChain||(typeof TrappedDataChain=="undefined"?nil:TrappedDataChain)}
  1246. return smalltalk.withContext(function($ctx1) {
  1247. _st(path)._trapDescend_((function(snap){
  1248. return smalltalk.withContext(function($ctx2) {
  1249. return _st(_st($TrappedDataChain())._newFromProcessorNames_(anArray))._forSnapshot_andBrush_(snap,self);
  1250. }, function($ctx2) {$ctx2.fillBlock({snap:snap},$ctx1,1)})}));
  1251. return self}, function($ctx1) {$ctx1.fill(self,"trap:processors:",{path:path,anArray:anArray},smalltalk.TagBrush)})},
  1252. args: ["path", "anArray"],
  1253. source: "trap: path processors: anArray\x0a\x09path trapDescend: [ :snap |\x0a\x09\x09(TrappedDataChain newFromProcessorNames: anArray)\x0a\x09\x09\x09forSnapshot: snap andBrush: self ]",
  1254. messageSends: ["trapDescend:", "forSnapshot:andBrush:", "newFromProcessorNames:"],
  1255. referencedClasses: ["TrappedDataChain"]
  1256. }),
  1257. smalltalk.TagBrush);
  1258. smalltalk.addMethod(
  1259. smalltalk.method({
  1260. selector: "trap:read:",
  1261. category: '*Trapped-Frontend',
  1262. fn: function (path,aBlock){
  1263. var self=this;
  1264. function $KeyedPubSubUnsubscribe(){return smalltalk.KeyedPubSubUnsubscribe||(typeof KeyedPubSubUnsubscribe=="undefined"?nil:KeyedPubSubUnsubscribe)}
  1265. return smalltalk.withContext(function($ctx1) {
  1266. var $1;
  1267. _st(path)._trapDescend_((function(snap){
  1268. return smalltalk.withContext(function($ctx2) {
  1269. return _st(snap)._watch_((function(data){
  1270. return smalltalk.withContext(function($ctx3) {
  1271. $1=_st(_st(_st(self._asJQuery())._closest_("html"))._toArray())._isEmpty();
  1272. if(smalltalk.assert($1)){
  1273. _st($KeyedPubSubUnsubscribe())._signal();
  1274. };
  1275. return _st(snap)._do_((function(){
  1276. return smalltalk.withContext(function($ctx4) {
  1277. return self._with_((function(html){
  1278. return smalltalk.withContext(function($ctx5) {
  1279. return _st(aBlock)._value_value_(data,html);
  1280. }, function($ctx5) {$ctx5.fillBlock({html:html},$ctx4,5)})}));
  1281. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)})}));
  1282. }, function($ctx3) {$ctx3.fillBlock({data:data},$ctx2,2)})}));
  1283. }, function($ctx2) {$ctx2.fillBlock({snap:snap},$ctx1,1)})}));
  1284. return self}, function($ctx1) {$ctx1.fill(self,"trap:read:",{path:path,aBlock:aBlock},smalltalk.TagBrush)})},
  1285. args: ["path", "aBlock"],
  1286. source: "trap: path read: aBlock\x0a\x09path trapDescend: [ :snap |\x0a snap watch: [ :data |\x0a (self asJQuery closest: 'html') toArray isEmpty ifTrue: [ KeyedPubSubUnsubscribe signal ].\x0a \x09snap do: [ self with: [ :html | aBlock value: data value: html ] ]\x0a \x09]\x0a ]",
  1287. messageSends: ["trapDescend:", "watch:", "ifTrue:", "isEmpty", "toArray", "closest:", "asJQuery", "signal", "do:", "with:", "value:value:"],
  1288. referencedClasses: ["KeyedPubSubUnsubscribe"]
  1289. }),
  1290. smalltalk.TagBrush);
  1291. smalltalk.addMethod(
  1292. smalltalk.method({
  1293. selector: "trapGuard:contents:",
  1294. category: '*Trapped-Frontend',
  1295. fn: function (anArray,aBlock){
  1296. var self=this;
  1297. return smalltalk.withContext(function($ctx1) {
  1298. var $1,$2,$3,$4,$5;
  1299. []._trapDescend_((function(snap){
  1300. var shown;
  1301. return smalltalk.withContext(function($ctx2) {
  1302. shown=nil;
  1303. shown;
  1304. return self._trap_read_(anArray,(function(gdata){
  1305. var sanitized;
  1306. return smalltalk.withContext(function($ctx3) {
  1307. if(($receiver = gdata) == nil || $receiver == null){
  1308. sanitized=false;
  1309. } else {
  1310. sanitized=gdata;
  1311. };
  1312. sanitized;
  1313. $1=_st(shown).__eq(sanitized);
  1314. if(! smalltalk.assert($1)){
  1315. shown=sanitized;
  1316. shown;
  1317. $2=shown;
  1318. if(smalltalk.assert($2)){
  1319. _st(snap)._do_((function(){
  1320. return smalltalk.withContext(function($ctx4) {
  1321. return self._contents_(aBlock);
  1322. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)})}));
  1323. $3=self._asJQuery();
  1324. $ctx3.sendIdx["asJQuery"]=1;
  1325. return _st($3)._show();
  1326. } else {
  1327. $4=self._asJQuery();
  1328. _st($4)._hide();
  1329. $5=_st($4)._empty();
  1330. return $5;
  1331. };
  1332. };
  1333. }, function($ctx3) {$ctx3.fillBlock({gdata:gdata,sanitized:sanitized},$ctx2,2)})}));
  1334. }, function($ctx2) {$ctx2.fillBlock({snap:snap,shown:shown},$ctx1,1)})}));
  1335. return self}, function($ctx1) {$ctx1.fill(self,"trapGuard:contents:",{anArray:anArray,aBlock:aBlock},smalltalk.TagBrush)})},
  1336. args: ["anArray", "aBlock"],
  1337. source: "trapGuard: anArray contents: aBlock\x0a\x09#() trapDescend: [ :snap |\x0a\x09 | shown |\x0a \x09shown := nil.\x0a\x09 self trap: anArray read: [ :gdata |\x0a\x09\x09\x09| sanitized |\x0a\x09\x09\x09sanitized := gdata ifNil: [ false ].\x0a \x09 shown = sanitized ifFalse: [\x0a \x09 shown := sanitized.\x0a \x09shown\x0a\x09\x09\x09\x09\x09ifTrue: [ snap do: [ self contents: aBlock ]. self asJQuery show ]\x0a\x09\x09\x09\x09\x09ifFalse: [ self asJQuery hide; empty ] ] ] ]",
  1338. messageSends: ["trapDescend:", "trap:read:", "ifNil:", "ifFalse:", "=", "ifTrue:ifFalse:", "do:", "contents:", "show", "asJQuery", "hide", "empty"],
  1339. referencedClasses: []
  1340. }),
  1341. smalltalk.TagBrush);
  1342. });