Trapped-Frontend.js 56 KB

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