Trapped-Frontend.js 58 KB

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