|
@@ -0,0 +1,191 @@
|
|
|
+define("amber-snapsvg/AmberSnapsvg", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
|
|
|
+var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
|
|
|
+$core.addPackage('AmberSnapsvg');
|
|
|
+$core.packages["AmberSnapsvg"].transport = {"type":"amd","amdNamespace":"amber-snapsvg"};
|
|
|
+
|
|
|
+$core.addClass('AmberSnapsvg', $globals.Object, [], 'AmberSnapsvg');
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "augmentPage",
|
|
|
+protocol: 'starting',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+var $1,$2;
|
|
|
+$1="#amber-with"._asJQuery();
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+$ctx1.sendIdx["asJQuery"]=1;
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+$recv($1)._click_((function(){
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+return self._doAmberWith();
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}));
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+$ctx1.sendIdx["click:"]=1;
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+$2="#jquery-append"._asJQuery();
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+$ctx1.sendIdx["asJQuery"]=2;
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+$recv($2)._click_((function(){
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+return self._doJQueryAppend();
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}));
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+$ctx1.sendIdx["click:"]=2;
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+$recv("#snapsvg-button"._asJQuery())._click_((function(){
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+return self._doSnapSvg();
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}));
|
|
|
+return self;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"augmentPage",{},$globals.AmberSnapsvg)});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+},
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: [],
|
|
|
+source: "augmentPage\x0a\x09'#amber-with' asJQuery click: [ self doAmberWith ].\x0a\x09'#jquery-append' asJQuery click: [ self doJQueryAppend ].\x0a\x09'#snapsvg-button' asJQuery click: [self doSnapSvg]",
|
|
|
+referencedClasses: [],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+messageSends: ["click:", "asJQuery", "doAmberWith", "doJQueryAppend", "doSnapSvg"]
|
|
|
+}),
|
|
|
+$globals.AmberSnapsvg);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "doAmberWith",
|
|
|
+protocol: 'action',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+var tag;
|
|
|
+function $HTMLCanvas(){return $globals.HTMLCanvas||(typeof HTMLCanvas=="undefined"?nil:HTMLCanvas)}
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+tag=$recv($recv($HTMLCanvas())._onJQuery_("#output-list"._asJQuery()))._root();
|
|
|
+$recv(tag)._with_((function(html){
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+return $recv($recv(html)._li())._with_("Amber Web #with: added me!");
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}));
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+$ctx1.sendIdx["with:"]=1;
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+return self;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"doAmberWith",{tag:tag},$globals.AmberSnapsvg)});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+},
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: [],
|
|
|
+source: "doAmberWith\x0a\x09| tag |\x0a\x09tag := (HTMLCanvas onJQuery: '#output-list' asJQuery) root.\x0a\x09tag with: [ :html | html li with: 'Amber Web #with: added me!' ]",
|
|
|
+referencedClasses: ["HTMLCanvas"],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+messageSends: ["root", "onJQuery:", "asJQuery", "with:", "li"]
|
|
|
+}),
|
|
|
+$globals.AmberSnapsvg);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "doJQueryAppend",
|
|
|
+protocol: 'action',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+$recv("#output-list"._asJQuery())._append_("<li>jQuery append added me!</li>");
|
|
|
+return self;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"doJQueryAppend",{},$globals.AmberSnapsvg)});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+},
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: [],
|
|
|
+source: "doJQueryAppend\x0a\x09'#output-list' asJQuery append: '<li>jQuery append added me!</li>'",
|
|
|
+referencedClasses: [],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+messageSends: ["append:", "asJQuery"]
|
|
|
+}),
|
|
|
+$globals.AmberSnapsvg);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "doSnapSvg",
|
|
|
+protocol: 'action',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+var s,snapLib,bigCircle,smallCircle;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+snapLib=$recv(require)._value_("snap.svg");
|
|
|
+s=$recv(snapLib)._value_value_((300),(600));
|
|
|
+bigCircle=$recv(s)._circle_value_value_((150),(150),(100));
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+$ctx1.sendIdx["circle:value:value:"]=1;
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+$recv(bigCircle)._attr_($globals.HashedCollection._newFromPairs_(["fill","#bada55","stroke","#000","strokeWidth",(5)]));
|
|
|
+smallCircle=$recv(s)._circle_value_value_((100),(150),(70));
|
|
|
+return self;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"doSnapSvg",{s:s,snapLib:snapLib,bigCircle:bigCircle,smallCircle:smallCircle},$globals.AmberSnapsvg)});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+},
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: [],
|
|
|
+source: "doSnapSvg\x0a\x22translation to Smalltalk points 1 to 4 of\x0ahttp://snapsvg.io/start/ \x22\x0a\x0a| s snapLib bigCircle smallCircle |\x0a\x0asnapLib := require value: 'snap.svg'.\x0as := snapLib value: 300 value: 600.\x0a\x0abigCircle := s circle: 150 value: 150 value: 100.\x0abigCircle attr: #{'fill' -> '#bada55'. 'stroke' -> '#000'. 'strokeWidth' -> 5}.\x0asmallCircle := s circle: 100 value: 150 value: 70.\x0a\x22Transcript show: s outerSVG.\x22\x0a\x22s inspect\x22",
|
|
|
+referencedClasses: [],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+messageSends: ["value:", "value:value:", "circle:value:value:", "attr:"]
|
|
|
+}),
|
|
|
+$globals.AmberSnapsvg);
|
|
|
+
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "start",
|
|
|
+protocol: 'starting',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+$recv(self._new())._augmentPage();
|
|
|
+return self;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"start",{},$globals.AmberSnapsvg.klass)});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+},
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: [],
|
|
|
+source: "start\x0a\x09self new augmentPage",
|
|
|
+referencedClasses: [],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+messageSends: ["augmentPage", "new"]
|
|
|
+}),
|
|
|
+$globals.AmberSnapsvg.klass);
|
|
|
+
|
|
|
+});
|