Trapped-Frontend.js 56 KB

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