Trapped-Frontend.js 58 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545
  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:inPlaceOf:",
  687. category: 'private',
  688. fn: function (anObject,aTagBrush){
  689. var self=this;
  690. return smalltalk.withContext(function($ctx1) {
  691. var $1,$2;
  692. $1=_st(aTagBrush)._asJQuery();
  693. $ctx1.sendIdx["asJQuery"]=1;
  694. _st($1)._append_(_st(anObject)._clone());
  695. $2=_st(aTagBrush)._asJQuery();
  696. $ctx1.sendIdx["asJQuery"]=2;
  697. self._injectToJQuery_($2);
  698. _st(_st(_st(aTagBrush)._asJQuery())._contents())._unwrap();
  699. return self}, function($ctx1) {$ctx1.fill(self,"cloneAndInject:inPlaceOf:",{anObject:anObject,aTagBrush:aTagBrush},smalltalk.Trapped)})},
  700. args: ["anObject", "aTagBrush"],
  701. source: "cloneAndInject: anObject inPlaceOf: aTagBrush\x0a\x09aTagBrush asJQuery append: anObject clone.\x0a\x09self injectToJQuery: aTagBrush asJQuery.\x0a\x09aTagBrush asJQuery contents unwrap",
  702. messageSends: ["append:", "asJQuery", "clone", "injectToJQuery:", "unwrap", "contents"],
  703. referencedClasses: []
  704. }),
  705. smalltalk.Trapped);
  706. smalltalk.addMethod(
  707. smalltalk.method({
  708. selector: "descend:snapshotDo:",
  709. category: 'private',
  710. fn: function (anArray,aBlock){
  711. var self=this;
  712. var tpsc;
  713. function $TrappedPathStack(){return smalltalk.TrappedPathStack||(typeof TrappedPathStack=="undefined"?nil:TrappedPathStack)}
  714. function $TrappedSnapshot(){return smalltalk.TrappedSnapshot||(typeof TrappedSnapshot=="undefined"?nil:TrappedSnapshot)}
  715. return smalltalk.withContext(function($ctx1) {
  716. tpsc=_st($TrappedPathStack())._current();
  717. _st(tpsc)._append_do_(anArray,(function(){
  718. var path,model;
  719. return smalltalk.withContext(function($ctx2) {
  720. path=_st(_st(tpsc)._elements())._copy();
  721. path;
  722. model=self._byName_(_st(path)._first());
  723. model;
  724. return _st(aBlock)._value_(_st(_st($TrappedSnapshot())._new())._path_model_(path,model));
  725. }, function($ctx2) {$ctx2.fillBlock({path:path,model:model},$ctx1,1)})}));
  726. return self}, function($ctx1) {$ctx1.fill(self,"descend:snapshotDo:",{anArray:anArray,aBlock:aBlock,tpsc:tpsc},smalltalk.Trapped)})},
  727. args: ["anArray", "aBlock"],
  728. 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 ]",
  729. messageSends: ["current", "append:do:", "copy", "elements", "byName:", "first", "value:", "path:model:", "new"],
  730. referencedClasses: ["TrappedPathStack", "TrappedSnapshot"]
  731. }),
  732. smalltalk.Trapped);
  733. smalltalk.addMethod(
  734. smalltalk.method({
  735. selector: "initialize",
  736. category: 'initialization',
  737. fn: function (){
  738. var self=this;
  739. return smalltalk.withContext(function($ctx1) {
  740. smalltalk.Trapped.superclass.fn.prototype._initialize.apply(_st(self), []);
  741. self["@registry"]=smalltalk.HashedCollection._from_([]);
  742. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Trapped)})},
  743. args: [],
  744. source: "initialize\x0a\x09super initialize.\x0a\x09registry := #{}.",
  745. messageSends: ["initialize"],
  746. referencedClasses: []
  747. }),
  748. smalltalk.Trapped);
  749. smalltalk.addMethod(
  750. smalltalk.method({
  751. selector: "injectToJQuery:",
  752. category: 'private',
  753. fn: function (aJQuery){
  754. var self=this;
  755. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  756. function $HTMLCanvas(){return smalltalk.HTMLCanvas||(typeof HTMLCanvas=="undefined"?nil:HTMLCanvas)}
  757. return smalltalk.withContext(function($ctx1) {
  758. var $1;
  759. _st(aJQuery)._each_((function(index,elem){
  760. var jq;
  761. return smalltalk.withContext(function($ctx2) {
  762. jq=_st(elem)._asJQuery();
  763. jq;
  764. $1=_st(jq)._is_("[data-trap]");
  765. if(smalltalk.assert($1)){
  766. var parsed;
  767. parsed=_st($Trapped())._parse_(_st(jq)._attr_("data-trap"));
  768. parsed;
  769. _st(jq)._removeAttr_("data-trap");
  770. _st(parsed)._do_((function(rule){
  771. return smalltalk.withContext(function($ctx3) {
  772. return _st(_st(_st($HTMLCanvas())._onJQuery_(jq))._root())._trap_processors_(_st(rule)._first(),_st(rule)._at_ifAbsent_((2),(function(){
  773. return smalltalk.withContext(function($ctx4) {
  774. return [];
  775. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)})})));
  776. }, function($ctx3) {$ctx3.fillBlock({rule:rule},$ctx2,3)})}));
  777. };
  778. return self._injectToJQuery_(_st(jq)._children());
  779. }, function($ctx2) {$ctx2.fillBlock({index:index,elem:elem,jq:jq},$ctx1,1)})}));
  780. return self}, function($ctx1) {$ctx1.fill(self,"injectToJQuery:",{aJQuery:aJQuery},smalltalk.Trapped)})},
  781. args: ["aJQuery"],
  782. 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 ]",
  783. messageSends: ["each:", "asJQuery", "ifTrue:", "is:", "parse:", "attr:", "removeAttr:", "do:", "trap:processors:", "root", "onJQuery:", "first", "at:ifAbsent:", "injectToJQuery:", "children"],
  784. referencedClasses: ["Trapped", "HTMLCanvas"]
  785. }),
  786. smalltalk.Trapped);
  787. smalltalk.addMethod(
  788. smalltalk.method({
  789. selector: "register:",
  790. category: 'accessing',
  791. fn: function (aListKeyedEntity){
  792. var self=this;
  793. return smalltalk.withContext(function($ctx1) {
  794. self._register_name_(aListKeyedEntity,_st(_st(aListKeyedEntity)._class())._name());
  795. return self}, function($ctx1) {$ctx1.fill(self,"register:",{aListKeyedEntity:aListKeyedEntity},smalltalk.Trapped)})},
  796. args: ["aListKeyedEntity"],
  797. source: "register: aListKeyedEntity\x0a\x09self register: aListKeyedEntity name: aListKeyedEntity class name",
  798. messageSends: ["register:name:", "name", "class"],
  799. referencedClasses: []
  800. }),
  801. smalltalk.Trapped);
  802. smalltalk.addMethod(
  803. smalltalk.method({
  804. selector: "register:name:",
  805. category: 'accessing',
  806. fn: function (aListKeyedEntity,aString){
  807. var self=this;
  808. return smalltalk.withContext(function($ctx1) {
  809. _st(self["@registry"])._at_put_(aString,aListKeyedEntity);
  810. return self}, function($ctx1) {$ctx1.fill(self,"register:name:",{aListKeyedEntity:aListKeyedEntity,aString:aString},smalltalk.Trapped)})},
  811. args: ["aListKeyedEntity", "aString"],
  812. source: "register: aListKeyedEntity name: aString\x0a\x09registry at: aString put: aListKeyedEntity",
  813. messageSends: ["at:put:"],
  814. referencedClasses: []
  815. }),
  816. smalltalk.Trapped);
  817. smalltalk.addMethod(
  818. smalltalk.method({
  819. selector: "start:",
  820. category: 'action',
  821. fn: function (args){
  822. var self=this;
  823. return smalltalk.withContext(function($ctx1) {
  824. _st(args)._do_((function(each){
  825. return smalltalk.withContext(function($ctx2) {
  826. return self._register_(each);
  827. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  828. self._injectToJQuery_("html"._asJQuery());
  829. return self}, function($ctx1) {$ctx1.fill(self,"start:",{args:args},smalltalk.Trapped)})},
  830. args: ["args"],
  831. source: "start: args\x0a\x09args do: [ :each | self register: each ].\x0a\x09self injectToJQuery: 'html' asJQuery",
  832. messageSends: ["do:", "register:", "injectToJQuery:", "asJQuery"],
  833. referencedClasses: []
  834. }),
  835. smalltalk.Trapped);
  836. smalltalk.addMethod(
  837. smalltalk.method({
  838. selector: "loop:before:do:",
  839. category: 'private',
  840. fn: function (model,endjq,aBlock){
  841. var self=this;
  842. function $HTMLCanvas(){return smalltalk.HTMLCanvas||(typeof HTMLCanvas=="undefined"?nil:HTMLCanvas)}
  843. return smalltalk.withContext(function($ctx1) {
  844. _st(model)._withIndexDo_((function(item,i){
  845. var env,envjq;
  846. return smalltalk.withContext(function($ctx2) {
  847. envjq=_st("<div/>"._asJQuery())._insertBefore_(endjq);
  848. envjq;
  849. _st([i])._trapDescend_((function(){
  850. return smalltalk.withContext(function($ctx3) {
  851. return _st(_st(_st($HTMLCanvas())._onJQuery_(envjq))._root())._with_(aBlock);
  852. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  853. return _st(_st(envjq)._contents())._unwrap();
  854. }, function($ctx2) {$ctx2.fillBlock({item:item,i:i,env:env,envjq:envjq},$ctx1,1)})}));
  855. return self}, function($ctx1) {$ctx1.fill(self,"loop:before:do:",{model:model,endjq:endjq,aBlock:aBlock},smalltalk.Trapped.klass)})},
  856. args: ["model", "endjq", "aBlock"],
  857. source: "loop: model before: endjq do: aBlock\x0a\x09model withIndexDo: [ :item :i |\x0a\x09\x09| env envjq |\x0a\x09\x09envjq := '<div/>' asJQuery insertBefore: endjq.\x0a\x09\x09{i} trapDescend: [ (HTMLCanvas onJQuery: envjq) root with: aBlock ].\x0a\x09\x09envjq contents unwrap ]",
  858. messageSends: ["withIndexDo:", "insertBefore:", "asJQuery", "trapDescend:", "with:", "root", "onJQuery:", "unwrap", "contents"],
  859. referencedClasses: ["HTMLCanvas"]
  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._loop_before_do_(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\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]]",
  885. messageSends: ["remove", "nextUntil:", "asJQuery", "element", "with:", "ifNotNil:", "loop:before:do:"],
  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: "read:",
  1175. category: 'action',
  1176. fn: function (aBlock){
  1177. var self=this;
  1178. return smalltalk.withContext(function($ctx1) {
  1179. _st(self._model())._read_do_(_st(self._path())._allButFirst(),aBlock);
  1180. return self}, function($ctx1) {$ctx1.fill(self,"read:",{aBlock:aBlock},smalltalk.TrappedSnapshot)})},
  1181. args: ["aBlock"],
  1182. source: "read: aBlock\x0a\x09self model read: self path allButFirst do: aBlock",
  1183. messageSends: ["read:do:", "model", "allButFirst", "path"],
  1184. referencedClasses: []
  1185. }),
  1186. smalltalk.TrappedSnapshot);
  1187. smalltalk.addMethod(
  1188. smalltalk.method({
  1189. selector: "watch:",
  1190. category: 'action',
  1191. fn: function (aBlock){
  1192. var self=this;
  1193. return smalltalk.withContext(function($ctx1) {
  1194. _st(self._model())._watch_do_(_st(self._path())._allButFirst(),aBlock);
  1195. return self}, function($ctx1) {$ctx1.fill(self,"watch:",{aBlock:aBlock},smalltalk.TrappedSnapshot)})},
  1196. args: ["aBlock"],
  1197. source: "watch: aBlock\x0a\x09self model watch: self path allButFirst do: aBlock",
  1198. messageSends: ["watch:do:", "model", "allButFirst", "path"],
  1199. referencedClasses: []
  1200. }),
  1201. smalltalk.TrappedSnapshot);
  1202. smalltalk.addMethod(
  1203. smalltalk.method({
  1204. selector: "asTrapProcSendTo:",
  1205. category: '*Trapped-Frontend',
  1206. fn: function (anObject){
  1207. var self=this;
  1208. return smalltalk.withContext(function($ctx1) {
  1209. var $1;
  1210. $1=_st("Trapped cannot use processor descriptor of ".__comma(_st(self._class())._name())).__comma(" type.");
  1211. $ctx1.sendIdx[","]=1;
  1212. self._error_($1);
  1213. return self}, function($ctx1) {$ctx1.fill(self,"asTrapProcSendTo:",{anObject:anObject},smalltalk.Object)})},
  1214. args: ["anObject"],
  1215. source: "asTrapProcSendTo: anObject\x0a\x09self error: 'Trapped cannot use processor descriptor of ', self class name, ' type.'",
  1216. messageSends: ["error:", ",", "name", "class"],
  1217. referencedClasses: []
  1218. }),
  1219. smalltalk.Object);
  1220. smalltalk.addMethod(
  1221. smalltalk.method({
  1222. selector: "asTrapProcSendTo:",
  1223. category: '*Trapped-Frontend',
  1224. fn: function (anObject){
  1225. var self=this;
  1226. return smalltalk.withContext(function($ctx1) {
  1227. var $1;
  1228. $1=_st(anObject)._perform_(self);
  1229. return $1;
  1230. }, function($ctx1) {$ctx1.fill(self,"asTrapProcSendTo:",{anObject:anObject},smalltalk.String)})},
  1231. args: ["anObject"],
  1232. source: "asTrapProcSendTo: anObject\x0a\x09^anObject perform: self",
  1233. messageSends: ["perform:"],
  1234. referencedClasses: []
  1235. }),
  1236. smalltalk.String);
  1237. smalltalk.addMethod(
  1238. smalltalk.method({
  1239. selector: "asTrapProcSendTo:",
  1240. category: '*Trapped-Frontend',
  1241. fn: function (anObject){
  1242. var self=this;
  1243. var selector,args;
  1244. return smalltalk.withContext(function($ctx1) {
  1245. var $1,$2;
  1246. selector="";
  1247. args=[];
  1248. self._withIndexDo_((function(element,index){
  1249. return smalltalk.withContext(function($ctx2) {
  1250. $1=_st(index)._odd();
  1251. if(smalltalk.assert($1)){
  1252. selector=_st(selector).__comma(element);
  1253. $ctx2.sendIdx[","]=1;
  1254. return selector;
  1255. } else {
  1256. selector=_st(selector).__comma(":");
  1257. selector;
  1258. return _st(args)._add_(element);
  1259. };
  1260. }, function($ctx2) {$ctx2.fillBlock({element:element,index:index},$ctx1,1)})}));
  1261. $2=_st(anObject)._perform_withArguments_(selector,args);
  1262. return $2;
  1263. }, function($ctx1) {$ctx1.fill(self,"asTrapProcSendTo:",{anObject:anObject,selector:selector,args:args},smalltalk.Array)})},
  1264. args: ["anObject"],
  1265. 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",
  1266. messageSends: ["withIndexDo:", "ifTrue:ifFalse:", "odd", ",", "add:", "perform:withArguments:"],
  1267. referencedClasses: []
  1268. }),
  1269. smalltalk.Array);
  1270. smalltalk.addMethod(
  1271. smalltalk.method({
  1272. selector: "trapDescend:",
  1273. category: '*Trapped-Frontend',
  1274. fn: function (aBlock){
  1275. var self=this;
  1276. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  1277. return smalltalk.withContext(function($ctx1) {
  1278. _st(_st($Trapped())._current())._descend_snapshotDo_(self,aBlock);
  1279. return self}, function($ctx1) {$ctx1.fill(self,"trapDescend:",{aBlock:aBlock},smalltalk.Array)})},
  1280. args: ["aBlock"],
  1281. source: "trapDescend: aBlock\x0a\x09Trapped current descend: self snapshotDo: aBlock",
  1282. messageSends: ["descend:snapshotDo:", "current"],
  1283. referencedClasses: ["Trapped"]
  1284. }),
  1285. smalltalk.Array);
  1286. smalltalk.addMethod(
  1287. smalltalk.method({
  1288. selector: "trapIter:do:",
  1289. category: '*Trapped-Frontend',
  1290. fn: function (path,aBlock){
  1291. var self=this;
  1292. return smalltalk.withContext(function($ctx1) {
  1293. var $1,$2;
  1294. self._with_((function(html){
  1295. return smalltalk.withContext(function($ctx2) {
  1296. $1=_st(html)._tag_("script");
  1297. _st($1)._at_put_("type","application/x-beacon");
  1298. $2=_st($1)._trapIter_after_(path,aBlock);
  1299. return $2;
  1300. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)})}));
  1301. return self}, function($ctx1) {$ctx1.fill(self,"trapIter:do:",{path:path,aBlock:aBlock},smalltalk.HTMLCanvas)})},
  1302. args: ["path", "aBlock"],
  1303. source: "trapIter: path do: aBlock\x0a self with: [ :html | (html tag: 'script') at: 'type' put: 'application/x-beacon'; trapIter: path after: aBlock ]",
  1304. messageSends: ["with:", "at:put:", "tag:", "trapIter:after:"],
  1305. referencedClasses: []
  1306. }),
  1307. smalltalk.HTMLCanvas);
  1308. smalltalk.addMethod(
  1309. smalltalk.method({
  1310. selector: "trap:",
  1311. category: '*Trapped-Frontend',
  1312. fn: function (path){
  1313. var self=this;
  1314. return smalltalk.withContext(function($ctx1) {
  1315. self._trap_processors_(path,[]);
  1316. return self}, function($ctx1) {$ctx1.fill(self,"trap:",{path:path},smalltalk.TagBrush)})},
  1317. args: ["path"],
  1318. source: "trap: path\x0a\x09self trap: path processors: #()",
  1319. messageSends: ["trap:processors:"],
  1320. referencedClasses: []
  1321. }),
  1322. smalltalk.TagBrush);
  1323. smalltalk.addMethod(
  1324. smalltalk.method({
  1325. selector: "trap:processors:",
  1326. category: '*Trapped-Frontend',
  1327. fn: function (path,anArray){
  1328. var self=this;
  1329. function $TrappedProcessingChain(){return smalltalk.TrappedProcessingChain||(typeof TrappedProcessingChain=="undefined"?nil:TrappedProcessingChain)}
  1330. return smalltalk.withContext(function($ctx1) {
  1331. _st(path)._trapDescend_((function(snap){
  1332. return smalltalk.withContext(function($ctx2) {
  1333. return _st(_st($TrappedProcessingChain())._newFromProcessorSpecs_(anArray))._forSnapshot_andBrush_(snap,self);
  1334. }, function($ctx2) {$ctx2.fillBlock({snap:snap},$ctx1,1)})}));
  1335. return self}, function($ctx1) {$ctx1.fill(self,"trap:processors:",{path:path,anArray:anArray},smalltalk.TagBrush)})},
  1336. args: ["path", "anArray"],
  1337. source: "trap: path processors: anArray\x0a\x09path trapDescend: [ :snap |\x0a\x09\x09(TrappedProcessingChain newFromProcessorSpecs: anArray)\x0a\x09\x09\x09forSnapshot: snap andBrush: self ]",
  1338. messageSends: ["trapDescend:", "forSnapshot:andBrush:", "newFromProcessorSpecs:"],
  1339. referencedClasses: ["TrappedProcessingChain"]
  1340. }),
  1341. smalltalk.TagBrush);
  1342. smalltalk.addMethod(
  1343. smalltalk.method({
  1344. selector: "trap:read:",
  1345. category: '*Trapped-Frontend',
  1346. fn: function (path,aBlock){
  1347. var self=this;
  1348. function $KeyedPubSubUnsubscribe(){return smalltalk.KeyedPubSubUnsubscribe||(typeof KeyedPubSubUnsubscribe=="undefined"?nil:KeyedPubSubUnsubscribe)}
  1349. return smalltalk.withContext(function($ctx1) {
  1350. var $1;
  1351. _st(path)._trapDescend_((function(snap){
  1352. return smalltalk.withContext(function($ctx2) {
  1353. return _st(snap)._watch_((function(data){
  1354. return smalltalk.withContext(function($ctx3) {
  1355. $1=_st(_st(_st(self._asJQuery())._closest_("html"))._toArray())._isEmpty();
  1356. if(smalltalk.assert($1)){
  1357. _st($KeyedPubSubUnsubscribe())._signal();
  1358. };
  1359. return _st(snap)._do_((function(){
  1360. return smalltalk.withContext(function($ctx4) {
  1361. return self._with_((function(html){
  1362. return smalltalk.withContext(function($ctx5) {
  1363. return _st(aBlock)._value_value_(data,html);
  1364. }, function($ctx5) {$ctx5.fillBlock({html:html},$ctx4,5)})}));
  1365. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)})}));
  1366. }, function($ctx3) {$ctx3.fillBlock({data:data},$ctx2,2)})}));
  1367. }, function($ctx2) {$ctx2.fillBlock({snap:snap},$ctx1,1)})}));
  1368. return self}, function($ctx1) {$ctx1.fill(self,"trap:read:",{path:path,aBlock:aBlock},smalltalk.TagBrush)})},
  1369. args: ["path", "aBlock"],
  1370. 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 ]",
  1371. messageSends: ["trapDescend:", "watch:", "ifTrue:", "isEmpty", "toArray", "closest:", "asJQuery", "signal", "do:", "with:", "value:value:"],
  1372. referencedClasses: ["KeyedPubSubUnsubscribe"]
  1373. }),
  1374. smalltalk.TagBrush);
  1375. smalltalk.addMethod(
  1376. smalltalk.method({
  1377. selector: "trapGuard:contents:",
  1378. category: '*Trapped-Frontend',
  1379. fn: function (anArray,aBlock){
  1380. var self=this;
  1381. return smalltalk.withContext(function($ctx1) {
  1382. var $1,$2,$3,$4,$5;
  1383. []._trapDescend_((function(snap){
  1384. var shown;
  1385. return smalltalk.withContext(function($ctx2) {
  1386. shown=nil;
  1387. shown;
  1388. return self._trap_read_(anArray,(function(gdata){
  1389. var sanitized;
  1390. return smalltalk.withContext(function($ctx3) {
  1391. if(($receiver = gdata) == nil || $receiver == null){
  1392. sanitized=false;
  1393. } else {
  1394. sanitized=gdata;
  1395. };
  1396. sanitized;
  1397. $1=_st(shown).__eq(sanitized);
  1398. if(! smalltalk.assert($1)){
  1399. shown=sanitized;
  1400. shown;
  1401. $2=shown;
  1402. if(smalltalk.assert($2)){
  1403. _st(snap)._do_((function(){
  1404. return smalltalk.withContext(function($ctx4) {
  1405. return self._contents_(aBlock);
  1406. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)})}));
  1407. $3=self._asJQuery();
  1408. $ctx3.sendIdx["asJQuery"]=1;
  1409. return _st($3)._show();
  1410. } else {
  1411. $4=self._asJQuery();
  1412. _st($4)._hide();
  1413. $5=_st($4)._empty();
  1414. return $5;
  1415. };
  1416. };
  1417. }, function($ctx3) {$ctx3.fillBlock({gdata:gdata,sanitized:sanitized},$ctx2,2)})}));
  1418. }, function($ctx2) {$ctx2.fillBlock({snap:snap,shown:shown},$ctx1,1)})}));
  1419. return self}, function($ctx1) {$ctx1.fill(self,"trapGuard:contents:",{anArray:anArray,aBlock:aBlock},smalltalk.TagBrush)})},
  1420. args: ["anArray", "aBlock"],
  1421. 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 ] ] ] ]",
  1422. messageSends: ["trapDescend:", "trap:read:", "ifNil:", "ifFalse:", "=", "ifTrue:ifFalse:", "do:", "contents:", "show", "asJQuery", "hide", "empty"],
  1423. referencedClasses: []
  1424. }),
  1425. smalltalk.TagBrush);
  1426. smalltalk.addMethod(
  1427. smalltalk.method({
  1428. selector: "trapIter:after:",
  1429. category: '*Trapped-Frontend',
  1430. fn: function (path,aBlock){
  1431. var self=this;
  1432. var end;
  1433. function $TagBrush(){return smalltalk.TagBrush||(typeof TagBrush=="undefined"?nil:TagBrush)}
  1434. function $Trapped(){return smalltalk.Trapped||(typeof Trapped=="undefined"?nil:Trapped)}
  1435. return smalltalk.withContext(function($ctx1) {
  1436. var $2,$1;
  1437. $2="<script type=\x22application/x-beacon\x22 />"._asJQuery();
  1438. $ctx1.sendIdx["asJQuery"]=1;
  1439. $1=_st($2)._insertAfter_(self._asJQuery());
  1440. end=_st($TagBrush())._fromJQuery_canvas_($1,self["@canvas"]);
  1441. self._trap_read_(path,(function(model){
  1442. return smalltalk.withContext(function($ctx2) {
  1443. return _st($Trapped())._loop_between_and_do_(model,self,end,aBlock);
  1444. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1,1)})}));
  1445. return self}, function($ctx1) {$ctx1.fill(self,"trapIter:after:",{path:path,aBlock:aBlock,end:end},smalltalk.TagBrush)})},
  1446. args: ["path", "aBlock"],
  1447. 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 ]",
  1448. messageSends: ["fromJQuery:canvas:", "insertAfter:", "asJQuery", "trap:read:", "loop:between:and:do:"],
  1449. referencedClasses: ["TagBrush", "Trapped"]
  1450. }),
  1451. smalltalk.TagBrush);
  1452. });