Trapped-Frontend.js 55 KB

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