Trapped-Frontend.js 55 KB

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