Trapped-Frontend.js 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413
  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)._detect_ifNone_((function(each){
  306. return smalltalk.withContext(function($ctx2) {
  307. return _st(each)._isExpectingModelData();
  308. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  309. return smalltalk.withContext(function($ctx2) {
  310. return nil;
  311. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  312. if(($receiver = $1) == nil || $receiver == null){
  313. _st(anArray)._add_(self._dataTerminator());
  314. } else {
  315. _st(anArray)._addFirst_(self._blackboardReaderWriter());
  316. };
  317. $3=self._new();
  318. _st($3)._processors_(anArray);
  319. $4=_st($3)._yourself();
  320. $2=$4;
  321. return $2;
  322. }, function($ctx1) {$ctx1.fill(self,"new:",{anArray:anArray},smalltalk.TrappedProcessingChain.klass)})},
  323. args: ["anArray"],
  324. source: "new: anArray\x0a\x09(anArray detect: [ :each | each isExpectingModelData ] ifNone: [ nil ])\x0a\x09\x09ifNil: [ anArray add: self dataTerminator ]\x0a\x09\x09ifNotNil: [ anArray addFirst: self blackboardReaderWriter ].\x0a\x09^self new\x0a\x09\x09processors: anArray;\x0a\x09\x09yourself",
  325. messageSends: ["ifNil:ifNotNil:", "detect:ifNone:", "isExpectingModelData", "add:", "dataTerminator", "addFirst:", "blackboardReaderWriter", "processors:", "new", "yourself"],
  326. referencedClasses: []
  327. }),
  328. smalltalk.TrappedProcessingChain.klass);
  329. smalltalk.addMethod(
  330. smalltalk.method({
  331. selector: "newFromProcessorSpecs:",
  332. category: 'instance creation',
  333. fn: function (anArray){
  334. var self=this;
  335. function $TrappedProcessor(){return smalltalk.TrappedProcessor||(typeof TrappedProcessor=="undefined"?nil:TrappedProcessor)}
  336. return smalltalk.withContext(function($ctx1) {
  337. var $2,$3,$1;
  338. $1=self._new_(_st(_st(anArray)._ifEmpty_((function(){
  339. return smalltalk.withContext(function($ctx2) {
  340. return ["contents"];
  341. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._collect_((function(each){
  342. return smalltalk.withContext(function($ctx2) {
  343. $2=_st(each)._isString();
  344. if(smalltalk.assert($2)){
  345. return _st($TrappedProcessor())._perform_(each);
  346. } else {
  347. var selector,args;
  348. selector="";
  349. selector;
  350. args=[];
  351. args;
  352. _st(each)._withIndexDo_((function(element,index){
  353. return smalltalk.withContext(function($ctx3) {
  354. $3=_st(index)._odd();
  355. if(smalltalk.assert($3)){
  356. selector=_st(selector).__comma(element);
  357. $ctx3.sendIdx[","]=1;
  358. return selector;
  359. } else {
  360. selector=_st(selector).__comma(":");
  361. selector;
  362. return _st(args)._add_(element);
  363. };
  364. }, function($ctx3) {$ctx3.fillBlock({element:element,index:index},$ctx2,5)})}));
  365. return _st($TrappedProcessor())._perform_withArguments_(selector,args);
  366. };
  367. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  368. return $1;
  369. }, function($ctx1) {$ctx1.fill(self,"newFromProcessorSpecs:",{anArray:anArray},smalltalk.TrappedProcessingChain.klass)})},
  370. args: ["anArray"],
  371. source: "newFromProcessorSpecs: anArray\x0a\x09^self new: ((anArray ifEmpty: [ #(contents) ]) collect: [ :each | each isString\x0a\x09\x09ifTrue: [ TrappedProcessor perform: each ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09| selector args |\x0a\x09\x09\x09selector := ''.\x0a\x09\x09\x09args := #().\x0a\x09\x09\x09each withIndexDo: [ :element :index | index odd\x0a\x09\x09\x09\x09ifTrue: [ selector := selector, element ]\x0a\x09\x09\x09\x09ifFalse: [ selector := selector, ':'. args add: element ] ].\x0a\x09\x09\x09TrappedProcessor perform: selector withArguments: args ] ])",
  372. messageSends: ["new:", "collect:", "ifEmpty:", "ifTrue:ifFalse:", "isString", "perform:", "withIndexDo:", "odd", ",", "add:", "perform:withArguments:"],
  373. referencedClasses: ["TrappedProcessor"]
  374. }),
  375. smalltalk.TrappedProcessingChain.klass);
  376. smalltalk.addClass('TrappedProcessor', smalltalk.Object, [], 'Trapped-Frontend');
  377. 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";
  378. smalltalk.addMethod(
  379. smalltalk.method({
  380. selector: "installToView:toModel:",
  381. category: 'installation',
  382. fn: function (aDataCarrier,anotherDataCarrier){
  383. var self=this;
  384. return smalltalk.withContext(function($ctx1) {
  385. return self}, function($ctx1) {$ctx1.fill(self,"installToView:toModel:",{aDataCarrier:aDataCarrier,anotherDataCarrier:anotherDataCarrier},smalltalk.TrappedProcessor)})},
  386. args: ["aDataCarrier", "anotherDataCarrier"],
  387. source: "installToView: aDataCarrier toModel: anotherDataCarrier\x0a\x09\x22by default, do nothing\x22",
  388. messageSends: [],
  389. referencedClasses: []
  390. }),
  391. smalltalk.TrappedProcessor);
  392. smalltalk.addMethod(
  393. smalltalk.method({
  394. selector: "isExpectingModelData",
  395. category: 'testing',
  396. fn: function (){
  397. var self=this;
  398. return smalltalk.withContext(function($ctx1) {
  399. return false;
  400. }, function($ctx1) {$ctx1.fill(self,"isExpectingModelData",{},smalltalk.TrappedProcessor)})},
  401. args: [],
  402. source: "isExpectingModelData\x0a\x09^false",
  403. messageSends: [],
  404. referencedClasses: []
  405. }),
  406. smalltalk.TrappedProcessor);
  407. smalltalk.addMethod(
  408. smalltalk.method({
  409. selector: "toModel:",
  410. category: 'data transformation',
  411. fn: function (aDataCarrier){
  412. var self=this;
  413. return smalltalk.withContext(function($ctx1) {
  414. _st(aDataCarrier)._proceed();
  415. return self}, function($ctx1) {$ctx1.fill(self,"toModel:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessor)})},
  416. args: ["aDataCarrier"],
  417. source: "toModel: aDataCarrier\x0a\x09\x22by default, proceed\x22\x0a\x09aDataCarrier proceed",
  418. messageSends: ["proceed"],
  419. referencedClasses: []
  420. }),
  421. smalltalk.TrappedProcessor);
  422. smalltalk.addMethod(
  423. smalltalk.method({
  424. selector: "toView:",
  425. category: 'data transformation',
  426. fn: function (aDataCarrier){
  427. var self=this;
  428. return smalltalk.withContext(function($ctx1) {
  429. _st(aDataCarrier)._proceed();
  430. return self}, function($ctx1) {$ctx1.fill(self,"toView:",{aDataCarrier:aDataCarrier},smalltalk.TrappedProcessor)})},
  431. args: ["aDataCarrier"],
  432. source: "toView: aDataCarrier\x0a\x09\x22by default, proceed\x22\x0a\x09aDataCarrier proceed",
  433. messageSends: ["proceed"],
  434. referencedClasses: []
  435. }),
  436. smalltalk.TrappedProcessor);
  437. smalltalk.addMethod(
  438. smalltalk.method({
  439. selector: "contents",
  440. category: 'factory',
  441. fn: function (){
  442. var self=this;
  443. function $TrappedProcessorContents(){return smalltalk.TrappedProcessorContents||(typeof TrappedProcessorContents=="undefined"?nil:TrappedProcessorContents)}
  444. return smalltalk.withContext(function($ctx1) {
  445. var $1;
  446. $1=_st($TrappedProcessorContents())._new();
  447. return $1;
  448. }, function($ctx1) {$ctx1.fill(self,"contents",{},smalltalk.TrappedProcessor.klass)})},
  449. args: [],
  450. source: "contents\x0a\x09^TrappedProcessorContents new",
  451. messageSends: ["new"],
  452. referencedClasses: ["TrappedProcessorContents"]
  453. }),
  454. smalltalk.TrappedProcessor.klass);
  455. smalltalk.addMethod(
  456. smalltalk.method({
  457. selector: "guardContents:",
  458. category: 'factory',
  459. fn: function (anArray){
  460. var self=this;
  461. function $TrappedProcessorGuardContents(){return smalltalk.TrappedProcessorGuardContents||(typeof TrappedProcessorGuardContents=="undefined"?nil:TrappedProcessorGuardContents)}
  462. return smalltalk.withContext(function($ctx1) {
  463. var $1;
  464. $1=_st($TrappedProcessorGuardContents())._new_(anArray);
  465. return $1;
  466. }, function($ctx1) {$ctx1.fill(self,"guardContents:",{anArray:anArray},smalltalk.TrappedProcessor.klass)})},
  467. args: ["anArray"],
  468. source: "guardContents: anArray\x0a\x09^TrappedProcessorGuardContents new: anArray",
  469. messageSends: ["new:"],
  470. referencedClasses: ["TrappedProcessorGuardContents"]
  471. }),
  472. smalltalk.TrappedProcessor.klass);
  473. smalltalk.addMethod(
  474. smalltalk.method({
  475. selector: "guardProc:",
  476. category: 'factory',
  477. fn: function (anArray){
  478. var self=this;
  479. function $TrappedProcessorGuardProc(){return smalltalk.TrappedProcessorGuardProc||(typeof TrappedProcessorGuardProc=="undefined"?nil:TrappedProcessorGuardProc)}
  480. return smalltalk.withContext(function($ctx1) {
  481. var $1;
  482. $1=_st($TrappedProcessorGuardProc())._new_(anArray);
  483. return $1;
  484. }, function($ctx1) {$ctx1.fill(self,"guardProc:",{anArray:anArray},smalltalk.TrappedProcessor.klass)})},
  485. args: ["anArray"],
  486. source: "guardProc: anArray\x0a\x09^TrappedProcessorGuardProc new: anArray",
  487. messageSends: ["new:"],
  488. referencedClasses: ["TrappedProcessorGuardProc"]
  489. }),
  490. smalltalk.TrappedProcessor.klass);
  491. smalltalk.addMethod(
  492. smalltalk.method({
  493. selector: "inputChecked",
  494. category: 'factory',
  495. fn: function (){
  496. var self=this;
  497. function $TrappedProcessorInputChecked(){return smalltalk.TrappedProcessorInputChecked||(typeof TrappedProcessorInputChecked=="undefined"?nil:TrappedProcessorInputChecked)}
  498. return smalltalk.withContext(function($ctx1) {
  499. var $1;
  500. $1=_st($TrappedProcessorInputChecked())._new();
  501. return $1;
  502. }, function($ctx1) {$ctx1.fill(self,"inputChecked",{},smalltalk.TrappedProcessor.klass)})},
  503. args: [],
  504. source: "inputChecked\x0a\x09^TrappedProcessorInputChecked new",
  505. messageSends: ["new"],
  506. referencedClasses: ["TrappedProcessorInputChecked"]
  507. }),
  508. smalltalk.TrappedProcessor.klass);
  509. smalltalk.addMethod(
  510. smalltalk.method({
  511. selector: "inputValue",
  512. category: 'factory',
  513. fn: function (){
  514. var self=this;
  515. function $TrappedProcessorInputValue(){return smalltalk.TrappedProcessorInputValue||(typeof TrappedProcessorInputValue=="undefined"?nil:TrappedProcessorInputValue)}
  516. return smalltalk.withContext(function($ctx1) {
  517. var $1;
  518. $1=_st($TrappedProcessorInputValue())._new();
  519. return $1;
  520. }, function($ctx1) {$ctx1.fill(self,"inputValue",{},smalltalk.TrappedProcessor.klass)})},
  521. args: [],
  522. source: "inputValue\x0a\x09^TrappedProcessorInputValue new",
  523. messageSends: ["new"],
  524. referencedClasses: ["TrappedProcessorInputValue"]
  525. }),
  526. smalltalk.TrappedProcessor.klass);
  527. smalltalk.addMethod(
  528. smalltalk.method({
  529. selector: "path",
  530. category: 'factory',
  531. fn: function (){
  532. var self=this;
  533. function $TrappedProcessorDescend(){return smalltalk.TrappedProcessorDescend||(typeof TrappedProcessorDescend=="undefined"?nil:TrappedProcessorDescend)}
  534. return smalltalk.withContext(function($ctx1) {
  535. var $1;
  536. $1=_st($TrappedProcessorDescend())._new();
  537. return $1;
  538. }, function($ctx1) {$ctx1.fill(self,"path",{},smalltalk.TrappedProcessor.klass)})},
  539. args: [],
  540. source: "path\x0a\x09^TrappedProcessorDescend new",
  541. messageSends: ["new"],
  542. referencedClasses: ["TrappedProcessorDescend"]
  543. }),
  544. smalltalk.TrappedProcessor.klass);
  545. smalltalk.addMethod(
  546. smalltalk.method({
  547. selector: "signal:",
  548. category: 'factory',
  549. fn: function (aString){
  550. var self=this;
  551. function $TrappedProcessorSignal(){return smalltalk.TrappedProcessorSignal||(typeof TrappedProcessorSignal=="undefined"?nil:TrappedProcessorSignal)}
  552. return smalltalk.withContext(function($ctx1) {
  553. var $1;
  554. $1=_st($TrappedProcessorSignal())._new_(aString);
  555. return $1;
  556. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},smalltalk.TrappedProcessor.klass)})},
  557. args: ["aString"],
  558. source: "signal: aString\x0a\x09^TrappedProcessorSignal new: aString",
  559. messageSends: ["new:"],
  560. referencedClasses: ["TrappedProcessorSignal"]
  561. }),
  562. smalltalk.TrappedProcessor.klass);
  563. smalltalk.addMethod(
  564. smalltalk.method({
  565. selector: "whenClicked",
  566. category: 'factory',
  567. fn: function (){
  568. var self=this;
  569. function $TrappedProcessorWhenClicked(){return smalltalk.TrappedProcessorWhenClicked||(typeof TrappedProcessorWhenClicked=="undefined"?nil:TrappedProcessorWhenClicked)}
  570. return smalltalk.withContext(function($ctx1) {
  571. var $1;
  572. $1=_st($TrappedProcessorWhenClicked())._new();
  573. return $1;
  574. }, function($ctx1) {$ctx1.fill(self,"whenClicked",{},smalltalk.TrappedProcessor.klass)})},
  575. args: [],
  576. source: "whenClicked\x0a\x09^TrappedProcessorWhenClicked new",
  577. messageSends: ["new"],
  578. referencedClasses: ["TrappedProcessorWhenClicked"]
  579. }),
  580. smalltalk.TrappedProcessor.klass);
  581. smalltalk.addMethod(
  582. smalltalk.method({
  583. selector: "whenSubmitted",
  584. category: 'factory',
  585. fn: function (){
  586. var self=this;
  587. function $TrappedProcessorWhenSubmitted(){return smalltalk.TrappedProcessorWhenSubmitted||(typeof TrappedProcessorWhenSubmitted=="undefined"?nil:TrappedProcessorWhenSubmitted)}
  588. return smalltalk.withContext(function($ctx1) {
  589. var $1;
  590. $1=_st($TrappedProcessorWhenSubmitted())._new();
  591. return $1;
  592. }, function($ctx1) {$ctx1.fill(self,"whenSubmitted",{},smalltalk.TrappedProcessor.klass)})},
  593. args: [],
  594. source: "whenSubmitted\x0a\x09^TrappedProcessorWhenSubmitted new",
  595. messageSends: ["new"],
  596. referencedClasses: ["TrappedProcessorWhenSubmitted"]
  597. }),
  598. smalltalk.TrappedProcessor.klass);
  599. smalltalk.addMethod(
  600. smalltalk.method({
  601. selector: "widget:",
  602. category: 'factory',
  603. fn: function (aString){
  604. var self=this;
  605. function $TrappedProcessorWidget(){return smalltalk.TrappedProcessorWidget||(typeof TrappedProcessorWidget=="undefined"?nil:TrappedProcessorWidget)}
  606. return smalltalk.withContext(function($ctx1) {
  607. var $1;
  608. $1=_st($TrappedProcessorWidget())._new_(aString);
  609. return $1;
  610. }, function($ctx1) {$ctx1.fill(self,"widget:",{aString:aString},smalltalk.TrappedProcessor.klass)})},
  611. args: ["aString"],
  612. source: "widget: aString\x0a\x09^TrappedProcessorWidget new: aString",
  613. messageSends: ["new:"],
  614. referencedClasses: ["TrappedProcessorWidget"]
  615. }),
  616. smalltalk.TrappedProcessor.klass);
  617. smalltalk.addClass('TrappedSingleton', smalltalk.Object, [], 'Trapped-Frontend');
  618. smalltalk.addMethod(
  619. smalltalk.method({
  620. selector: "start:",
  621. category: 'action',
  622. fn: function (args){
  623. var self=this;
  624. return smalltalk.withContext(function($ctx1) {
  625. var $1;
  626. $1=self._subclassResponsibility();
  627. return $1;
  628. }, function($ctx1) {$ctx1.fill(self,"start:",{args:args},smalltalk.TrappedSingleton)})},
  629. args: ["args"],
  630. source: "start: args\x0a\x09^ self subclassResponsibility",
  631. messageSends: ["subclassResponsibility"],
  632. referencedClasses: []
  633. }),
  634. smalltalk.TrappedSingleton);
  635. smalltalk.TrappedSingleton.klass.iVarNames = ['current'];
  636. smalltalk.addMethod(
  637. smalltalk.method({
  638. selector: "current",
  639. category: 'accessing',
  640. fn: function (){
  641. var self=this;
  642. return smalltalk.withContext(function($ctx1) {
  643. var $2,$1;
  644. $2=self["@current"];
  645. if(($receiver = $2) == nil || $receiver == null){
  646. self["@current"]=self._new();
  647. $1=self["@current"];
  648. } else {
  649. $1=$2;
  650. };
  651. return $1;
  652. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.TrappedSingleton.klass)})},
  653. args: [],
  654. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  655. messageSends: ["ifNil:", "new"],
  656. referencedClasses: []
  657. }),
  658. smalltalk.TrappedSingleton.klass);
  659. smalltalk.addMethod(
  660. smalltalk.method({
  661. selector: "start:",
  662. category: 'action',
  663. fn: function (args){
  664. var self=this;
  665. return smalltalk.withContext(function($ctx1) {
  666. _st(self._current())._start_(args);
  667. return self}, function($ctx1) {$ctx1.fill(self,"start:",{args:args},smalltalk.TrappedSingleton.klass)})},
  668. args: ["args"],
  669. source: "start: args\x0a\x09self current start: args",
  670. messageSends: ["start:", "current"],
  671. referencedClasses: []
  672. }),
  673. smalltalk.TrappedSingleton.klass);
  674. smalltalk.addClass('Trapped', smalltalk.TrappedSingleton, ['registry'], 'Trapped-Frontend');
  675. smalltalk.addMethod(
  676. smalltalk.method({
  677. selector: "byName:",
  678. category: 'accessing',
  679. fn: function (aString){
  680. var self=this;
  681. return smalltalk.withContext(function($ctx1) {
  682. var $1;
  683. $1=_st(self["@registry"])._at_(aString);
  684. return $1;
  685. }, function($ctx1) {$ctx1.fill(self,"byName:",{aString:aString},smalltalk.Trapped)})},
  686. args: ["aString"],
  687. source: "byName: aString\x0a\x09^ registry at: aString",
  688. messageSends: ["at:"],
  689. referencedClasses: []
  690. }),
  691. smalltalk.Trapped);
  692. smalltalk.addMethod(
  693. smalltalk.method({
  694. selector: "descend:snapshotDo:",
  695. category: 'action',
  696. fn: function (anArray,aBlock){
  697. var self=this;
  698. var tpsc;
  699. function $TrappedPathStack(){return smalltalk.TrappedPathStack||(typeof TrappedPathStack=="undefined"?nil:TrappedPathStack)}
  700. function $TrappedSnapshot(){return smalltalk.TrappedSnapshot||(typeof TrappedSnapshot=="undefined"?nil:TrappedSnapshot)}
  701. return smalltalk.withContext(function($ctx1) {
  702. tpsc=_st($TrappedPathStack())._current();
  703. _st(tpsc)._append_do_(anArray,(function(){
  704. var path,model;
  705. return smalltalk.withContext(function($ctx2) {
  706. path=_st(_st(tpsc)._elements())._copy();
  707. path;
  708. model=self._byName_(_st(path)._first());
  709. model;
  710. return _st(aBlock)._value_(_st(_st($TrappedSnapshot())._new())._path_model_(path,model));
  711. }, function($ctx2) {$ctx2.fillBlock({path:path,model:model},$ctx1,1)})}));
  712. return self}, function($ctx1) {$ctx1.fill(self,"descend:snapshotDo:",{anArray:anArray,aBlock:aBlock,tpsc:tpsc},smalltalk.Trapped)})},
  713. args: ["anArray", "aBlock"],
  714. 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 ]",
  715. messageSends: ["current", "append:do:", "copy", "elements", "byName:", "first", "value:", "path:model:", "new"],
  716. referencedClasses: ["TrappedPathStack", "TrappedSnapshot"]
  717. }),
  718. smalltalk.Trapped);
  719. smalltalk.addMethod(
  720. smalltalk.method({
  721. selector: "initialize",
  722. category: 'initialization',
  723. fn: function (){
  724. var self=this;
  725. return smalltalk.withContext(function($ctx1) {
  726. smalltalk.Trapped.superclass.fn.prototype._initialize.apply(_st(self), []);
  727. self["@registry"]=smalltalk.HashedCollection._from_([]);
  728. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Trapped)})},
  729. args: [],
  730. source: "initialize\x0a\x09super initialize.\x0a\x09registry := #{}.",
  731. messageSends: ["initialize"],
  732. referencedClasses: []
  733. }),
  734. smalltalk.Trapped);
  735. smalltalk.addMethod(
  736. smalltalk.method({
  737. selector: "injectToJQuery:",
  738. category: 'action',
  739. fn: function (aJQuery){
  740. var self=this;
  741. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  742. function $HTMLCanvas(){return smalltalk.HTMLCanvas||(typeof HTMLCanvas=="undefined"?nil:HTMLCanvas)}
  743. return smalltalk.withContext(function($ctx1) {
  744. var $1;
  745. _st(aJQuery)._each_((function(index,elem){
  746. var jq;
  747. return smalltalk.withContext(function($ctx2) {
  748. jq=_st(elem)._asJQuery();
  749. jq;
  750. $1=_st(jq)._is_("[data-trap]");
  751. if(smalltalk.assert($1)){
  752. var parsed;
  753. parsed=_st($Trapped())._parse_(_st(jq)._attr_("data-trap"));
  754. parsed;
  755. _st(jq)._removeAttr_("data-trap");
  756. _st(parsed)._do_((function(rule){
  757. return smalltalk.withContext(function($ctx3) {
  758. return _st(_st(_st($HTMLCanvas())._onJQuery_(jq))._root())._trap_processors_(_st(rule)._first(),_st(rule)._at_ifAbsent_((2),(function(){
  759. return smalltalk.withContext(function($ctx4) {
  760. return [];
  761. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)})})));
  762. }, function($ctx3) {$ctx3.fillBlock({rule:rule},$ctx2,3)})}));
  763. };
  764. return self._injectToJQuery_(_st(jq)._children());
  765. }, function($ctx2) {$ctx2.fillBlock({index:index,elem:elem,jq:jq},$ctx1,1)})}));
  766. return self}, function($ctx1) {$ctx1.fill(self,"injectToJQuery:",{aJQuery:aJQuery},smalltalk.Trapped)})},
  767. args: ["aJQuery"],
  768. 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 ]",
  769. messageSends: ["each:", "asJQuery", "ifTrue:", "is:", "parse:", "attr:", "removeAttr:", "do:", "trap:processors:", "root", "onJQuery:", "first", "at:ifAbsent:", "injectToJQuery:", "children"],
  770. referencedClasses: ["Trapped", "HTMLCanvas"]
  771. }),
  772. smalltalk.Trapped);
  773. smalltalk.addMethod(
  774. smalltalk.method({
  775. selector: "register:",
  776. category: 'accessing',
  777. fn: function (aListKeyedEntity){
  778. var self=this;
  779. return smalltalk.withContext(function($ctx1) {
  780. self._register_name_(aListKeyedEntity,_st(_st(aListKeyedEntity)._class())._name());
  781. return self}, function($ctx1) {$ctx1.fill(self,"register:",{aListKeyedEntity:aListKeyedEntity},smalltalk.Trapped)})},
  782. args: ["aListKeyedEntity"],
  783. source: "register: aListKeyedEntity\x0a\x09self register: aListKeyedEntity name: aListKeyedEntity class name",
  784. messageSends: ["register:name:", "name", "class"],
  785. referencedClasses: []
  786. }),
  787. smalltalk.Trapped);
  788. smalltalk.addMethod(
  789. smalltalk.method({
  790. selector: "register:name:",
  791. category: 'accessing',
  792. fn: function (aListKeyedEntity,aString){
  793. var self=this;
  794. return smalltalk.withContext(function($ctx1) {
  795. _st(self["@registry"])._at_put_(aString,aListKeyedEntity);
  796. return self}, function($ctx1) {$ctx1.fill(self,"register:name:",{aListKeyedEntity:aListKeyedEntity,aString:aString},smalltalk.Trapped)})},
  797. args: ["aListKeyedEntity", "aString"],
  798. source: "register: aListKeyedEntity name: aString\x0a\x09registry at: aString put: aListKeyedEntity",
  799. messageSends: ["at:put:"],
  800. referencedClasses: []
  801. }),
  802. smalltalk.Trapped);
  803. smalltalk.addMethod(
  804. smalltalk.method({
  805. selector: "start:",
  806. category: 'action',
  807. fn: function (args){
  808. var self=this;
  809. return smalltalk.withContext(function($ctx1) {
  810. _st(args)._do_((function(each){
  811. return smalltalk.withContext(function($ctx2) {
  812. return self._register_(each);
  813. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  814. self._injectToJQuery_("html"._asJQuery());
  815. return self}, function($ctx1) {$ctx1.fill(self,"start:",{args:args},smalltalk.Trapped)})},
  816. args: ["args"],
  817. source: "start: args\x0a\x09args do: [ :each | self register: each ].\x0a\x09self injectToJQuery: 'html' asJQuery",
  818. messageSends: ["do:", "register:", "injectToJQuery:", "asJQuery"],
  819. referencedClasses: []
  820. }),
  821. smalltalk.Trapped);
  822. smalltalk.addMethod(
  823. smalltalk.method({
  824. selector: "envelope:loop:before:tag:do:",
  825. category: 'private',
  826. fn: function (envelope,model,endjq,aSymbol,aBlock){
  827. var self=this;
  828. var envjq;
  829. return smalltalk.withContext(function($ctx1) {
  830. envjq=_st(envelope)._asJQuery();
  831. _st(model)._withIndexDo_((function(item,i){
  832. return smalltalk.withContext(function($ctx2) {
  833. _st(envelope)._with_((function(html){
  834. return smalltalk.withContext(function($ctx3) {
  835. return _st(_st(html)._perform_(aSymbol))._trap_read_([i],aBlock);
  836. }, function($ctx3) {$ctx3.fillBlock({html:html},$ctx2,2)})}));
  837. return _st(_st(_st(envjq)._children())._detach())._insertBefore_(endjq);
  838. }, function($ctx2) {$ctx2.fillBlock({item:item,i:i},$ctx1,1)})}));
  839. _st(envjq)._remove();
  840. return self}, function($ctx1) {$ctx1.fill(self,"envelope:loop:before:tag:do:",{envelope:envelope,model:model,endjq:endjq,aSymbol:aSymbol,aBlock:aBlock,envjq:envjq},smalltalk.Trapped.klass)})},
  841. args: ["envelope", "model", "endjq", "aSymbol", "aBlock"],
  842. source: "envelope: envelope loop: model before: endjq tag: aSymbol do: aBlock\x0a \x09| envjq |\x0a envjq := envelope asJQuery.\x0a model withIndexDo: [ :item :i |\x0a envelope with: [ :html | (html perform: aSymbol) trap: {i} read: aBlock ].\x0a envjq children detach insertBefore: endjq.\x0a ].\x0a envjq remove",
  843. messageSends: ["asJQuery", "withIndexDo:", "with:", "trap:read:", "perform:", "insertBefore:", "detach", "children", "remove"],
  844. referencedClasses: []
  845. }),
  846. smalltalk.Trapped.klass);
  847. smalltalk.addMethod(
  848. smalltalk.method({
  849. selector: "loop:between:and:tag:do:",
  850. category: 'private',
  851. fn: function (model,start,end,aSymbol,aBlock){
  852. var self=this;
  853. return smalltalk.withContext(function($ctx1) {
  854. var $2,$1;
  855. $2=_st(start)._asJQuery();
  856. $ctx1.sendIdx["asJQuery"]=1;
  857. $1=_st($2)._nextUntil_(_st(end)._element());
  858. _st($1)._remove();
  859. _st(start)._with_((function(html){
  860. return smalltalk.withContext(function($ctx2) {
  861. if(($receiver = model) == nil || $receiver == null){
  862. return model;
  863. } else {
  864. return self._envelope_loop_before_tag_do_(_st(html)._div(),model,_st(end)._asJQuery(),aSymbol,aBlock);
  865. };
  866. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)})}));
  867. return self}, function($ctx1) {$ctx1.fill(self,"loop:between:and:tag:do:",{model:model,start:start,end:end,aSymbol:aSymbol,aBlock:aBlock},smalltalk.Trapped.klass)})},
  868. args: ["model", "start", "end", "aSymbol", "aBlock"],
  869. source: "loop: model between: start and: end tag: aSymbol do: aBlock\x0a (start asJQuery nextUntil: end element) remove.\x0a start with: [ :html | model ifNotNil: [\x0a \x09self envelope: html div loop: model before: end asJQuery tag: aSymbol do: aBlock\x0a\x09]]",
  870. messageSends: ["remove", "nextUntil:", "asJQuery", "element", "with:", "ifNotNil:", "envelope:loop:before:tag:do:", "div"],
  871. referencedClasses: []
  872. }),
  873. smalltalk.Trapped.klass);
  874. smalltalk.addMethod(
  875. smalltalk.method({
  876. selector: "parse:",
  877. category: 'accessing',
  878. fn: function (aString){
  879. var self=this;
  880. return smalltalk.withContext(function($ctx1) {
  881. var $2,$3,$4,$5,$6,$8,$7,$9,$10,$11,$12,$13,$14,$1;
  882. $2=_st(aString)._tokenize_(".");
  883. $ctx1.sendIdx["tokenize:"]=1;
  884. $1=_st($2)._collect_((function(rule){
  885. return smalltalk.withContext(function($ctx2) {
  886. $3=_st(rule)._tokenize_(":");
  887. $ctx2.sendIdx["tokenize:"]=2;
  888. return _st($3)._collect_((function(message){
  889. var result,stack,anArray;
  890. return smalltalk.withContext(function($ctx3) {
  891. anArray=_st(message)._tokenize_(" ");
  892. anArray;
  893. result=[];
  894. result;
  895. stack=[result];
  896. stack;
  897. _st(anArray)._do_((function(each){
  898. var asNum,inner,close;
  899. return smalltalk.withContext(function($ctx4) {
  900. close=(0);
  901. close;
  902. inner=each;
  903. inner;
  904. _st((function(){
  905. return smalltalk.withContext(function($ctx5) {
  906. $4=_st(inner)._notEmpty();
  907. $ctx5.sendIdx["notEmpty"]=1;
  908. return _st($4)._and_((function(){
  909. return smalltalk.withContext(function($ctx6) {
  910. $5=_st(inner)._first();
  911. $ctx6.sendIdx["first"]=1;
  912. return _st($5).__eq("(");
  913. $ctx6.sendIdx["="]=1;
  914. }, function($ctx6) {$ctx6.fillBlock({},$ctx5,5)})}));
  915. $ctx5.sendIdx["and:"]=1;
  916. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,4)})}))._whileTrue_((function(){
  917. return smalltalk.withContext(function($ctx5) {
  918. inner=_st(inner)._allButFirst();
  919. $ctx5.sendIdx["allButFirst"]=1;
  920. inner;
  921. $6=stack;
  922. $8=_st(stack)._last();
  923. $ctx5.sendIdx["last"]=1;
  924. $7=_st($8)._add_([]);
  925. $ctx5.sendIdx["add:"]=2;
  926. return _st($6)._add_($7);
  927. $ctx5.sendIdx["add:"]=1;
  928. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,6)})}));
  929. $ctx4.sendIdx["whileTrue:"]=1;
  930. _st((function(){
  931. return smalltalk.withContext(function($ctx5) {
  932. $9=_st(inner)._notEmpty();
  933. $ctx5.sendIdx["notEmpty"]=2;
  934. return _st($9)._and_((function(){
  935. return smalltalk.withContext(function($ctx6) {
  936. $10=_st(inner)._last();
  937. $ctx6.sendIdx["last"]=2;
  938. return _st($10).__eq(")");
  939. $ctx6.sendIdx["="]=2;
  940. }, function($ctx6) {$ctx6.fillBlock({},$ctx5,8)})}));
  941. $ctx5.sendIdx["and:"]=2;
  942. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,7)})}))._whileTrue_((function(){
  943. return smalltalk.withContext(function($ctx5) {
  944. inner=_st(inner)._allButLast();
  945. inner;
  946. close=_st(close).__plus((1));
  947. return close;
  948. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,9)})}));
  949. $11=_st(_st(inner)._notEmpty())._and_((function(){
  950. return smalltalk.withContext(function($ctx5) {
  951. return _st(_st(inner)._first()).__eq("#");
  952. $ctx5.sendIdx["="]=3;
  953. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,10)})}));
  954. if(smalltalk.assert($11)){
  955. inner=[_st(inner)._allButFirst()];
  956. inner;
  957. };
  958. $12=_st(inner)._isString();
  959. if(smalltalk.assert($12)){
  960. asNum=_st(_st(inner)._ifEmpty_((function(){
  961. return smalltalk.withContext(function($ctx5) {
  962. return "NaN";
  963. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,13)})})))._asNumber();
  964. } else {
  965. asNum=inner;
  966. };
  967. asNum;
  968. $13=_st(asNum).__eq(asNum);
  969. if(smalltalk.assert($13)){
  970. $14=_st(stack)._last();
  971. $ctx4.sendIdx["last"]=3;
  972. _st($14)._add_(asNum);
  973. $ctx4.sendIdx["add:"]=3;
  974. } else {
  975. _st(inner)._ifNotEmpty_((function(){
  976. return smalltalk.withContext(function($ctx5) {
  977. return _st(_st(stack)._last())._add_(inner);
  978. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,17)})}));
  979. };
  980. return _st(close)._timesRepeat_((function(){
  981. return smalltalk.withContext(function($ctx5) {
  982. return _st(stack)._removeLast();
  983. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,18)})}));
  984. }, function($ctx4) {$ctx4.fillBlock({each:each,asNum:asNum,inner:inner,close:close},$ctx3,3)})}));
  985. return result;
  986. }, function($ctx3) {$ctx3.fillBlock({message:message,result:result,stack:stack,anArray:anArray},$ctx2,2)})}));
  987. }, function($ctx2) {$ctx2.fillBlock({rule:rule},$ctx1,1)})}));
  988. $ctx1.sendIdx["collect:"]=1;
  989. return $1;
  990. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},smalltalk.Trapped.klass)})},
  991. args: ["aString"],
  992. 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 ] ]",
  993. messageSends: ["collect:", "tokenize:", "do:", "whileTrue:", "and:", "notEmpty", "=", "first", "allButFirst", "add:", "last", "allButLast", "+", "ifTrue:", "ifTrue:ifFalse:", "isString", "asNumber", "ifEmpty:", "ifNotEmpty:", "timesRepeat:", "removeLast"],
  994. referencedClasses: []
  995. }),
  996. smalltalk.Trapped.klass);
  997. smalltalk.addClass('TrappedPathStack', smalltalk.TrappedSingleton, ['elements'], 'Trapped-Frontend');
  998. smalltalk.addMethod(
  999. smalltalk.method({
  1000. selector: "append:do:",
  1001. category: 'descending',
  1002. fn: function (anArray,aBlock){
  1003. var self=this;
  1004. return smalltalk.withContext(function($ctx1) {
  1005. self._with_do_(_st(self["@elements"]).__comma(anArray),aBlock);
  1006. return self}, function($ctx1) {$ctx1.fill(self,"append:do:",{anArray:anArray,aBlock:aBlock},smalltalk.TrappedPathStack)})},
  1007. args: ["anArray", "aBlock"],
  1008. source: "append: anArray do: aBlock\x0a self with: elements, anArray do: aBlock",
  1009. messageSends: ["with:do:", ","],
  1010. referencedClasses: []
  1011. }),
  1012. smalltalk.TrappedPathStack);
  1013. smalltalk.addMethod(
  1014. smalltalk.method({
  1015. selector: "elements",
  1016. category: 'accessing',
  1017. fn: function (){
  1018. var self=this;
  1019. return smalltalk.withContext(function($ctx1) {
  1020. var $1;
  1021. $1=self["@elements"];
  1022. return $1;
  1023. }, function($ctx1) {$ctx1.fill(self,"elements",{},smalltalk.TrappedPathStack)})},
  1024. args: [],
  1025. source: "elements\x0a\x09^elements",
  1026. messageSends: [],
  1027. referencedClasses: []
  1028. }),
  1029. smalltalk.TrappedPathStack);
  1030. smalltalk.addMethod(
  1031. smalltalk.method({
  1032. selector: "initialize",
  1033. category: 'initialization',
  1034. fn: function (){
  1035. var self=this;
  1036. return smalltalk.withContext(function($ctx1) {
  1037. smalltalk.TrappedPathStack.superclass.fn.prototype._initialize.apply(_st(self), []);
  1038. self["@elements"]=[];
  1039. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.TrappedPathStack)})},
  1040. args: [],
  1041. source: "initialize\x0a super initialize.\x0a\x09elements := #().",
  1042. messageSends: ["initialize"],
  1043. referencedClasses: []
  1044. }),
  1045. smalltalk.TrappedPathStack);
  1046. smalltalk.addMethod(
  1047. smalltalk.method({
  1048. selector: "with:do:",
  1049. category: 'descending',
  1050. fn: function (anArray,aBlock){
  1051. var self=this;
  1052. var old;
  1053. return smalltalk.withContext(function($ctx1) {
  1054. old=self["@elements"];
  1055. _st((function(){
  1056. return smalltalk.withContext(function($ctx2) {
  1057. self["@elements"]=anArray;
  1058. self["@elements"];
  1059. return _st(aBlock)._value();
  1060. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  1061. return smalltalk.withContext(function($ctx2) {
  1062. self["@elements"]=old;
  1063. return self["@elements"];
  1064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1065. return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anArray:anArray,aBlock:aBlock,old:old},smalltalk.TrappedPathStack)})},
  1066. args: ["anArray", "aBlock"],
  1067. source: "with: anArray do: aBlock\x0a\x09| old |\x0a old := elements.\x0a [ elements := anArray.\x0a\x09aBlock value ] ensure: [ elements := old ]",
  1068. messageSends: ["ensure:", "value"],
  1069. referencedClasses: []
  1070. }),
  1071. smalltalk.TrappedPathStack);
  1072. smalltalk.addClass('TrappedSnapshot', smalltalk.Object, ['path', 'model'], 'Trapped-Frontend');
  1073. smalltalk.addMethod(
  1074. smalltalk.method({
  1075. selector: "do:",
  1076. category: 'action',
  1077. fn: function (aBlock){
  1078. var self=this;
  1079. function $TrappedPathStack(){return smalltalk.TrappedPathStack||(typeof TrappedPathStack=="undefined"?nil:TrappedPathStack)}
  1080. return smalltalk.withContext(function($ctx1) {
  1081. _st(_st($TrappedPathStack())._current())._with_do_(self["@path"],(function(){
  1082. return smalltalk.withContext(function($ctx2) {
  1083. return _st(aBlock)._value_(self["@model"]);
  1084. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1085. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.TrappedSnapshot)})},
  1086. args: ["aBlock"],
  1087. source: "do: aBlock\x0a\x09TrappedPathStack current with: path do: [ aBlock value: model ]",
  1088. messageSends: ["with:do:", "current", "value:"],
  1089. referencedClasses: ["TrappedPathStack"]
  1090. }),
  1091. smalltalk.TrappedSnapshot);
  1092. smalltalk.addMethod(
  1093. smalltalk.method({
  1094. selector: "model",
  1095. category: 'accessing',
  1096. fn: function (){
  1097. var self=this;
  1098. return smalltalk.withContext(function($ctx1) {
  1099. var $1;
  1100. $1=self["@model"];
  1101. return $1;
  1102. }, function($ctx1) {$ctx1.fill(self,"model",{},smalltalk.TrappedSnapshot)})},
  1103. args: [],
  1104. source: "model\x0a\x09^model",
  1105. messageSends: [],
  1106. referencedClasses: []
  1107. }),
  1108. smalltalk.TrappedSnapshot);
  1109. smalltalk.addMethod(
  1110. smalltalk.method({
  1111. selector: "modify:",
  1112. category: 'action',
  1113. fn: function (aBlock){
  1114. var self=this;
  1115. return smalltalk.withContext(function($ctx1) {
  1116. _st(self._model())._modify_do_(_st(self._path())._allButFirst(),aBlock);
  1117. return self}, function($ctx1) {$ctx1.fill(self,"modify:",{aBlock:aBlock},smalltalk.TrappedSnapshot)})},
  1118. args: ["aBlock"],
  1119. source: "modify: aBlock\x0a\x09self model modify: self path allButFirst do: aBlock",
  1120. messageSends: ["modify:do:", "model", "allButFirst", "path"],
  1121. referencedClasses: []
  1122. }),
  1123. smalltalk.TrappedSnapshot);
  1124. smalltalk.addMethod(
  1125. smalltalk.method({
  1126. selector: "path",
  1127. category: 'accessing',
  1128. fn: function (){
  1129. var self=this;
  1130. return smalltalk.withContext(function($ctx1) {
  1131. var $1;
  1132. $1=self["@path"];
  1133. return $1;
  1134. }, function($ctx1) {$ctx1.fill(self,"path",{},smalltalk.TrappedSnapshot)})},
  1135. args: [],
  1136. source: "path\x0a\x09^path",
  1137. messageSends: [],
  1138. referencedClasses: []
  1139. }),
  1140. smalltalk.TrappedSnapshot);
  1141. smalltalk.addMethod(
  1142. smalltalk.method({
  1143. selector: "path:model:",
  1144. category: 'accessing',
  1145. fn: function (anArray,aTrappedMW){
  1146. var self=this;
  1147. return smalltalk.withContext(function($ctx1) {
  1148. self["@path"]=anArray;
  1149. self["@model"]=aTrappedMW;
  1150. return self}, function($ctx1) {$ctx1.fill(self,"path:model:",{anArray:anArray,aTrappedMW:aTrappedMW},smalltalk.TrappedSnapshot)})},
  1151. args: ["anArray", "aTrappedMW"],
  1152. source: "path: anArray model: aTrappedMW\x0a\x09path := anArray.\x0a model := aTrappedMW",
  1153. messageSends: [],
  1154. referencedClasses: []
  1155. }),
  1156. smalltalk.TrappedSnapshot);
  1157. smalltalk.addMethod(
  1158. smalltalk.method({
  1159. selector: "watch:",
  1160. category: 'action',
  1161. fn: function (aBlock){
  1162. var self=this;
  1163. return smalltalk.withContext(function($ctx1) {
  1164. _st(self._model())._watch_do_(_st(self._path())._allButFirst(),aBlock);
  1165. return self}, function($ctx1) {$ctx1.fill(self,"watch:",{aBlock:aBlock},smalltalk.TrappedSnapshot)})},
  1166. args: ["aBlock"],
  1167. source: "watch: aBlock\x0a\x09self model watch: self path allButFirst do: aBlock",
  1168. messageSends: ["watch:do:", "model", "allButFirst", "path"],
  1169. referencedClasses: []
  1170. }),
  1171. smalltalk.TrappedSnapshot);
  1172. smalltalk.addMethod(
  1173. smalltalk.method({
  1174. selector: "trapDescend:",
  1175. category: '*Trapped-Frontend',
  1176. fn: function (aBlock){
  1177. var self=this;
  1178. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  1179. return smalltalk.withContext(function($ctx1) {
  1180. _st(_st($Trapped())._current())._descend_snapshotDo_(self,aBlock);
  1181. return self}, function($ctx1) {$ctx1.fill(self,"trapDescend:",{aBlock:aBlock},smalltalk.Array)})},
  1182. args: ["aBlock"],
  1183. source: "trapDescend: aBlock\x0a\x09Trapped current descend: self snapshotDo: aBlock",
  1184. messageSends: ["descend:snapshotDo:", "current"],
  1185. referencedClasses: ["Trapped"]
  1186. }),
  1187. smalltalk.Array);
  1188. smalltalk.addMethod(
  1189. smalltalk.method({
  1190. selector: "trapIter:tag:do:",
  1191. category: '*Trapped-Frontend',
  1192. fn: function (path,aSymbol,aBlock){
  1193. var self=this;
  1194. var start,end;
  1195. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  1196. return smalltalk.withContext(function($ctx1) {
  1197. self._with_((function(html){
  1198. return smalltalk.withContext(function($ctx2) {
  1199. start=_st(html)._script();
  1200. $ctx2.sendIdx["script"]=1;
  1201. start;
  1202. end=_st(html)._script();
  1203. return end;
  1204. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)})}));
  1205. _st(start)._trap_read_(path,(function(model){
  1206. return smalltalk.withContext(function($ctx2) {
  1207. return _st($Trapped())._loop_between_and_tag_do_(model,start,end,aSymbol,aBlock);
  1208. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1,2)})}));
  1209. return self}, function($ctx1) {$ctx1.fill(self,"trapIter:tag:do:",{path:path,aSymbol:aSymbol,aBlock:aBlock,start:start,end:end},smalltalk.HTMLCanvas)})},
  1210. args: ["path", "aSymbol", "aBlock"],
  1211. source: "trapIter: path tag: aSymbol do: aBlock\x0a\x09| start end |\x0a self with: [ :html | start := html script. end := html script ].\x0a start trap: path read: [ :model |\x0a \x09Trapped loop: model between: start and: end tag: aSymbol do: aBlock.\x0a ]",
  1212. messageSends: ["with:", "script", "trap:read:", "loop:between:and:tag:do:"],
  1213. referencedClasses: ["Trapped"]
  1214. }),
  1215. smalltalk.HTMLCanvas);
  1216. smalltalk.addMethod(
  1217. smalltalk.method({
  1218. selector: "trap:",
  1219. category: '*Trapped-Frontend',
  1220. fn: function (path){
  1221. var self=this;
  1222. return smalltalk.withContext(function($ctx1) {
  1223. self._trap_processors_(path,[]);
  1224. return self}, function($ctx1) {$ctx1.fill(self,"trap:",{path:path},smalltalk.TagBrush)})},
  1225. args: ["path"],
  1226. source: "trap: path\x0a\x09self trap: path processors: #()",
  1227. messageSends: ["trap:processors:"],
  1228. referencedClasses: []
  1229. }),
  1230. smalltalk.TagBrush);
  1231. smalltalk.addMethod(
  1232. smalltalk.method({
  1233. selector: "trap:processors:",
  1234. category: '*Trapped-Frontend',
  1235. fn: function (path,anArray){
  1236. var self=this;
  1237. function $TrappedProcessingChain(){return smalltalk.TrappedProcessingChain||(typeof TrappedProcessingChain=="undefined"?nil:TrappedProcessingChain)}
  1238. return smalltalk.withContext(function($ctx1) {
  1239. _st(path)._trapDescend_((function(snap){
  1240. return smalltalk.withContext(function($ctx2) {
  1241. return _st(_st($TrappedProcessingChain())._newFromProcessorSpecs_(anArray))._forSnapshot_andBrush_(snap,self);
  1242. }, function($ctx2) {$ctx2.fillBlock({snap:snap},$ctx1,1)})}));
  1243. return self}, function($ctx1) {$ctx1.fill(self,"trap:processors:",{path:path,anArray:anArray},smalltalk.TagBrush)})},
  1244. args: ["path", "anArray"],
  1245. source: "trap: path processors: anArray\x0a\x09path trapDescend: [ :snap |\x0a\x09\x09(TrappedProcessingChain newFromProcessorSpecs: anArray)\x0a\x09\x09\x09forSnapshot: snap andBrush: self ]",
  1246. messageSends: ["trapDescend:", "forSnapshot:andBrush:", "newFromProcessorSpecs:"],
  1247. referencedClasses: ["TrappedProcessingChain"]
  1248. }),
  1249. smalltalk.TagBrush);
  1250. smalltalk.addMethod(
  1251. smalltalk.method({
  1252. selector: "trap:read:",
  1253. category: '*Trapped-Frontend',
  1254. fn: function (path,aBlock){
  1255. var self=this;
  1256. function $KeyedPubSubUnsubscribe(){return smalltalk.KeyedPubSubUnsubscribe||(typeof KeyedPubSubUnsubscribe=="undefined"?nil:KeyedPubSubUnsubscribe)}
  1257. return smalltalk.withContext(function($ctx1) {
  1258. var $1;
  1259. _st(path)._trapDescend_((function(snap){
  1260. return smalltalk.withContext(function($ctx2) {
  1261. return _st(snap)._watch_((function(data){
  1262. return smalltalk.withContext(function($ctx3) {
  1263. $1=_st(_st(_st(self._asJQuery())._closest_("html"))._toArray())._isEmpty();
  1264. if(smalltalk.assert($1)){
  1265. _st($KeyedPubSubUnsubscribe())._signal();
  1266. };
  1267. return _st(snap)._do_((function(){
  1268. return smalltalk.withContext(function($ctx4) {
  1269. return self._with_((function(html){
  1270. return smalltalk.withContext(function($ctx5) {
  1271. return _st(aBlock)._value_value_(data,html);
  1272. }, function($ctx5) {$ctx5.fillBlock({html:html},$ctx4,5)})}));
  1273. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)})}));
  1274. }, function($ctx3) {$ctx3.fillBlock({data:data},$ctx2,2)})}));
  1275. }, function($ctx2) {$ctx2.fillBlock({snap:snap},$ctx1,1)})}));
  1276. return self}, function($ctx1) {$ctx1.fill(self,"trap:read:",{path:path,aBlock:aBlock},smalltalk.TagBrush)})},
  1277. args: ["path", "aBlock"],
  1278. 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 ]",
  1279. messageSends: ["trapDescend:", "watch:", "ifTrue:", "isEmpty", "toArray", "closest:", "asJQuery", "signal", "do:", "with:", "value:value:"],
  1280. referencedClasses: ["KeyedPubSubUnsubscribe"]
  1281. }),
  1282. smalltalk.TagBrush);
  1283. smalltalk.addMethod(
  1284. smalltalk.method({
  1285. selector: "trapGuard:contents:",
  1286. category: '*Trapped-Frontend',
  1287. fn: function (anArray,aBlock){
  1288. var self=this;
  1289. return smalltalk.withContext(function($ctx1) {
  1290. var $1,$2,$3,$4,$5;
  1291. []._trapDescend_((function(snap){
  1292. var shown;
  1293. return smalltalk.withContext(function($ctx2) {
  1294. shown=nil;
  1295. shown;
  1296. return self._trap_read_(anArray,(function(gdata){
  1297. var sanitized;
  1298. return smalltalk.withContext(function($ctx3) {
  1299. if(($receiver = gdata) == nil || $receiver == null){
  1300. sanitized=false;
  1301. } else {
  1302. sanitized=gdata;
  1303. };
  1304. sanitized;
  1305. $1=_st(shown).__eq(sanitized);
  1306. if(! smalltalk.assert($1)){
  1307. shown=sanitized;
  1308. shown;
  1309. $2=shown;
  1310. if(smalltalk.assert($2)){
  1311. _st(snap)._do_((function(){
  1312. return smalltalk.withContext(function($ctx4) {
  1313. return self._contents_(aBlock);
  1314. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)})}));
  1315. $3=self._asJQuery();
  1316. $ctx3.sendIdx["asJQuery"]=1;
  1317. return _st($3)._show();
  1318. } else {
  1319. $4=self._asJQuery();
  1320. _st($4)._hide();
  1321. $5=_st($4)._empty();
  1322. return $5;
  1323. };
  1324. };
  1325. }, function($ctx3) {$ctx3.fillBlock({gdata:gdata,sanitized:sanitized},$ctx2,2)})}));
  1326. }, function($ctx2) {$ctx2.fillBlock({snap:snap,shown:shown},$ctx1,1)})}));
  1327. return self}, function($ctx1) {$ctx1.fill(self,"trapGuard:contents:",{anArray:anArray,aBlock:aBlock},smalltalk.TagBrush)})},
  1328. args: ["anArray", "aBlock"],
  1329. 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 ] ] ] ]",
  1330. messageSends: ["trapDescend:", "trap:read:", "ifNil:", "ifFalse:", "=", "ifTrue:ifFalse:", "do:", "contents:", "show", "asJQuery", "hide", "empty"],
  1331. referencedClasses: []
  1332. }),
  1333. smalltalk.TagBrush);
  1334. });