Trapped-Frontend.js 57 KB

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