Trapped-Frontend.js 60 KB

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