Trapped-Frontend.js 59 KB

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