Trapped-Frontend.js 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419
  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: "watch:",
  1074. category: 'action',
  1075. fn: function (aBlock){
  1076. var self=this;
  1077. return smalltalk.withContext(function($ctx1) {
  1078. _st(self._model())._watch_do_(_st(self._path())._allButFirst(),aBlock);
  1079. return self}, function($ctx1) {$ctx1.fill(self,"watch:",{aBlock:aBlock},smalltalk.TrappedSnapshot)})},
  1080. args: ["aBlock"],
  1081. source: "watch: aBlock\x0a\x09self model watch: self path allButFirst do: aBlock",
  1082. messageSends: ["watch:do:", "model", "allButFirst", "path"],
  1083. referencedClasses: []
  1084. }),
  1085. smalltalk.TrappedSnapshot);
  1086. smalltalk.addMethod(
  1087. smalltalk.method({
  1088. selector: "asTrapProcSendTo:",
  1089. category: '*Trapped-Frontend',
  1090. fn: function (anObject){
  1091. var self=this;
  1092. return smalltalk.withContext(function($ctx1) {
  1093. var $1;
  1094. $1=_st("Trapped cannot use processor descriptor of ".__comma(_st(self._class())._name())).__comma(" type.");
  1095. $ctx1.sendIdx[","]=1;
  1096. self._error_($1);
  1097. return self}, function($ctx1) {$ctx1.fill(self,"asTrapProcSendTo:",{anObject:anObject},smalltalk.Object)})},
  1098. args: ["anObject"],
  1099. source: "asTrapProcSendTo: anObject\x0a\x09self error: 'Trapped cannot use processor descriptor of ', self class name, ' type.'",
  1100. messageSends: ["error:", ",", "name", "class"],
  1101. referencedClasses: []
  1102. }),
  1103. smalltalk.Object);
  1104. smalltalk.addMethod(
  1105. smalltalk.method({
  1106. selector: "asTrapProcSendTo:",
  1107. category: '*Trapped-Frontend',
  1108. fn: function (anObject){
  1109. var self=this;
  1110. return smalltalk.withContext(function($ctx1) {
  1111. var $1;
  1112. $1=_st(anObject)._perform_(self);
  1113. return $1;
  1114. }, function($ctx1) {$ctx1.fill(self,"asTrapProcSendTo:",{anObject:anObject},smalltalk.String)})},
  1115. args: ["anObject"],
  1116. source: "asTrapProcSendTo: anObject\x0a\x09^anObject perform: self",
  1117. messageSends: ["perform:"],
  1118. referencedClasses: []
  1119. }),
  1120. smalltalk.String);
  1121. smalltalk.addMethod(
  1122. smalltalk.method({
  1123. selector: "asTrapProcSendTo:",
  1124. category: '*Trapped-Frontend',
  1125. fn: function (anObject){
  1126. var self=this;
  1127. var selector,args;
  1128. return smalltalk.withContext(function($ctx1) {
  1129. var $1,$2;
  1130. selector="";
  1131. args=[];
  1132. self._withIndexDo_((function(element,index){
  1133. return smalltalk.withContext(function($ctx2) {
  1134. $1=_st(index)._odd();
  1135. if(smalltalk.assert($1)){
  1136. selector=_st(selector).__comma(element);
  1137. $ctx2.sendIdx[","]=1;
  1138. return selector;
  1139. } else {
  1140. selector=_st(selector).__comma(":");
  1141. selector;
  1142. return _st(args)._add_(element);
  1143. };
  1144. }, function($ctx2) {$ctx2.fillBlock({element:element,index:index},$ctx1,1)})}));
  1145. $2=_st(anObject)._perform_withArguments_(selector,args);
  1146. return $2;
  1147. }, function($ctx1) {$ctx1.fill(self,"asTrapProcSendTo:",{anObject:anObject,selector:selector,args:args},smalltalk.Array)})},
  1148. args: ["anObject"],
  1149. 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",
  1150. messageSends: ["withIndexDo:", "ifTrue:ifFalse:", "odd", ",", "add:", "perform:withArguments:"],
  1151. referencedClasses: []
  1152. }),
  1153. smalltalk.Array);
  1154. smalltalk.addMethod(
  1155. smalltalk.method({
  1156. selector: "trapDescend:",
  1157. category: '*Trapped-Frontend',
  1158. fn: function (aBlock){
  1159. var self=this;
  1160. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  1161. return smalltalk.withContext(function($ctx1) {
  1162. _st(_st($Trapped())._current())._descend_snapshotDo_(self,aBlock);
  1163. return self}, function($ctx1) {$ctx1.fill(self,"trapDescend:",{aBlock:aBlock},smalltalk.Array)})},
  1164. args: ["aBlock"],
  1165. source: "trapDescend: aBlock\x0a\x09Trapped current descend: self snapshotDo: aBlock",
  1166. messageSends: ["descend:snapshotDo:", "current"],
  1167. referencedClasses: ["Trapped"]
  1168. }),
  1169. smalltalk.Array);
  1170. smalltalk.addMethod(
  1171. smalltalk.method({
  1172. selector: "trapIter:do:",
  1173. category: '*Trapped-Frontend',
  1174. fn: function (path,aBlock){
  1175. var self=this;
  1176. return smalltalk.withContext(function($ctx1) {
  1177. self._with_((function(html){
  1178. return smalltalk.withContext(function($ctx2) {
  1179. return _st(_st(html)._noscript())._trapIter_after_(path,aBlock);
  1180. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)})}));
  1181. return self}, function($ctx1) {$ctx1.fill(self,"trapIter:do:",{path:path,aBlock:aBlock},smalltalk.HTMLCanvas)})},
  1182. args: ["path", "aBlock"],
  1183. source: "trapIter: path do: aBlock\x0a self with: [ :html | html noscript trapIter: path after: aBlock ]",
  1184. messageSends: ["with:", "trapIter:after:", "noscript"],
  1185. referencedClasses: []
  1186. }),
  1187. smalltalk.HTMLCanvas);
  1188. smalltalk.addMethod(
  1189. smalltalk.method({
  1190. selector: "trap:",
  1191. category: '*Trapped-Frontend',
  1192. fn: function (path){
  1193. var self=this;
  1194. return smalltalk.withContext(function($ctx1) {
  1195. self._trap_processors_(path,[]);
  1196. return self}, function($ctx1) {$ctx1.fill(self,"trap:",{path:path},smalltalk.TagBrush)})},
  1197. args: ["path"],
  1198. source: "trap: path\x0a\x09self trap: path processors: #()",
  1199. messageSends: ["trap:processors:"],
  1200. referencedClasses: []
  1201. }),
  1202. smalltalk.TagBrush);
  1203. smalltalk.addMethod(
  1204. smalltalk.method({
  1205. selector: "trap:processors:",
  1206. category: '*Trapped-Frontend',
  1207. fn: function (path,anArray){
  1208. var self=this;
  1209. function $TrappedProcessingChain(){return smalltalk.TrappedProcessingChain||(typeof TrappedProcessingChain=="undefined"?nil:TrappedProcessingChain)}
  1210. return smalltalk.withContext(function($ctx1) {
  1211. _st(path)._trapDescend_((function(snap){
  1212. return smalltalk.withContext(function($ctx2) {
  1213. return _st(_st($TrappedProcessingChain())._newFromProcessorSpecs_(anArray))._forSnapshot_andBrush_(snap,self);
  1214. }, function($ctx2) {$ctx2.fillBlock({snap:snap},$ctx1,1)})}));
  1215. return self}, function($ctx1) {$ctx1.fill(self,"trap:processors:",{path:path,anArray:anArray},smalltalk.TagBrush)})},
  1216. args: ["path", "anArray"],
  1217. source: "trap: path processors: anArray\x0a\x09path trapDescend: [ :snap |\x0a\x09\x09(TrappedProcessingChain newFromProcessorSpecs: anArray)\x0a\x09\x09\x09forSnapshot: snap andBrush: self ]",
  1218. messageSends: ["trapDescend:", "forSnapshot:andBrush:", "newFromProcessorSpecs:"],
  1219. referencedClasses: ["TrappedProcessingChain"]
  1220. }),
  1221. smalltalk.TagBrush);
  1222. smalltalk.addMethod(
  1223. smalltalk.method({
  1224. selector: "trap:read:",
  1225. category: '*Trapped-Frontend',
  1226. fn: function (path,aBlock){
  1227. var self=this;
  1228. function $KeyedPubSubUnsubscribe(){return smalltalk.KeyedPubSubUnsubscribe||(typeof KeyedPubSubUnsubscribe=="undefined"?nil:KeyedPubSubUnsubscribe)}
  1229. return smalltalk.withContext(function($ctx1) {
  1230. var $1;
  1231. _st(path)._trapDescend_((function(snap){
  1232. return smalltalk.withContext(function($ctx2) {
  1233. return _st(snap)._watch_((function(data){
  1234. return smalltalk.withContext(function($ctx3) {
  1235. $1=_st(_st(_st(self._asJQuery())._closest_("html"))._toArray())._isEmpty();
  1236. if(smalltalk.assert($1)){
  1237. _st($KeyedPubSubUnsubscribe())._signal();
  1238. };
  1239. return _st(snap)._do_((function(){
  1240. return smalltalk.withContext(function($ctx4) {
  1241. return self._with_((function(html){
  1242. return smalltalk.withContext(function($ctx5) {
  1243. return _st(aBlock)._value_value_(data,html);
  1244. }, function($ctx5) {$ctx5.fillBlock({html:html},$ctx4,5)})}));
  1245. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)})}));
  1246. }, function($ctx3) {$ctx3.fillBlock({data:data},$ctx2,2)})}));
  1247. }, function($ctx2) {$ctx2.fillBlock({snap:snap},$ctx1,1)})}));
  1248. return self}, function($ctx1) {$ctx1.fill(self,"trap:read:",{path:path,aBlock:aBlock},smalltalk.TagBrush)})},
  1249. args: ["path", "aBlock"],
  1250. 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 ]",
  1251. messageSends: ["trapDescend:", "watch:", "ifTrue:", "isEmpty", "toArray", "closest:", "asJQuery", "signal", "do:", "with:", "value:value:"],
  1252. referencedClasses: ["KeyedPubSubUnsubscribe"]
  1253. }),
  1254. smalltalk.TagBrush);
  1255. smalltalk.addMethod(
  1256. smalltalk.method({
  1257. selector: "trapGuard:contents:",
  1258. category: '*Trapped-Frontend',
  1259. fn: function (anArray,aBlock){
  1260. var self=this;
  1261. return smalltalk.withContext(function($ctx1) {
  1262. var $1,$2,$3,$4,$5;
  1263. []._trapDescend_((function(snap){
  1264. var shown;
  1265. return smalltalk.withContext(function($ctx2) {
  1266. shown=nil;
  1267. shown;
  1268. return self._trap_read_(anArray,(function(gdata){
  1269. var sanitized;
  1270. return smalltalk.withContext(function($ctx3) {
  1271. if(($receiver = gdata) == nil || $receiver == null){
  1272. sanitized=false;
  1273. } else {
  1274. sanitized=gdata;
  1275. };
  1276. sanitized;
  1277. $1=_st(shown).__eq(sanitized);
  1278. if(! smalltalk.assert($1)){
  1279. shown=sanitized;
  1280. shown;
  1281. $2=shown;
  1282. if(smalltalk.assert($2)){
  1283. _st(snap)._do_((function(){
  1284. return smalltalk.withContext(function($ctx4) {
  1285. return self._contents_(aBlock);
  1286. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)})}));
  1287. $3=self._asJQuery();
  1288. $ctx3.sendIdx["asJQuery"]=1;
  1289. return _st($3)._show();
  1290. } else {
  1291. $4=self._asJQuery();
  1292. _st($4)._hide();
  1293. $5=_st($4)._empty();
  1294. return $5;
  1295. };
  1296. };
  1297. }, function($ctx3) {$ctx3.fillBlock({gdata:gdata,sanitized:sanitized},$ctx2,2)})}));
  1298. }, function($ctx2) {$ctx2.fillBlock({snap:snap,shown:shown},$ctx1,1)})}));
  1299. return self}, function($ctx1) {$ctx1.fill(self,"trapGuard:contents:",{anArray:anArray,aBlock:aBlock},smalltalk.TagBrush)})},
  1300. args: ["anArray", "aBlock"],
  1301. 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 ] ] ] ]",
  1302. messageSends: ["trapDescend:", "trap:read:", "ifNil:", "ifFalse:", "=", "ifTrue:ifFalse:", "do:", "contents:", "show", "asJQuery", "hide", "empty"],
  1303. referencedClasses: []
  1304. }),
  1305. smalltalk.TagBrush);
  1306. smalltalk.addMethod(
  1307. smalltalk.method({
  1308. selector: "trapIter:after:",
  1309. category: '*Trapped-Frontend',
  1310. fn: function (path,aBlock){
  1311. var self=this;
  1312. var end;
  1313. function $TagBrush(){return smalltalk.TagBrush||(typeof TagBrush=="undefined"?nil:TagBrush)}
  1314. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  1315. return smalltalk.withContext(function($ctx1) {
  1316. var $2,$1;
  1317. $2="<noscript />"._asJQuery();
  1318. $ctx1.sendIdx["asJQuery"]=1;
  1319. $1=_st($2)._insertAfter_(self._asJQuery());
  1320. end=_st($TagBrush())._fromJQuery_canvas_($1,self["@canvas"]);
  1321. self._trap_read_(path,(function(model){
  1322. return smalltalk.withContext(function($ctx2) {
  1323. return _st($Trapped())._loop_between_and_do_(model,self,end,aBlock);
  1324. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1,1)})}));
  1325. return self}, function($ctx1) {$ctx1.fill(self,"trapIter:after:",{path:path,aBlock:aBlock,end:end},smalltalk.TagBrush)})},
  1326. args: ["path", "aBlock"],
  1327. 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 ]",
  1328. messageSends: ["fromJQuery:canvas:", "insertAfter:", "asJQuery", "trap:read:", "loop:between:and:do:"],
  1329. referencedClasses: ["TagBrush", "Trapped"]
  1330. }),
  1331. smalltalk.TagBrush);
  1332. });