Selaa lähdekoodia

Core Moka classes

Nicolas Petton 10 vuotta sitten
vanhempi
commit
505b64b9c5
9 muutettua tiedostoa jossa 2438 lisäystä ja 0 poistoa
  1. 45 0
      js/Moka-Controllers.deploy.js
  2. 63 0
      js/Moka-Controllers.js
  3. 497 0
      js/Moka-Core.deploy.js
  4. 678 0
      js/Moka-Core.js
  5. 289 0
      js/Moka-Views.deploy.js
  6. 387 0
      js/Moka-Views.js
  7. 37 0
      st/Moka-Controllers.st
  8. 295 0
      st/Moka-Core.st
  9. 147 0
      st/Moka-Views.st

+ 45 - 0
js/Moka-Controllers.deploy.js

@@ -0,0 +1,45 @@
+(function(smalltalk,nil,_st){
+smalltalk.addPackage('Moka-Controllers');
+
+smalltalk.addClass('MKButtonController', smalltalk.MKAspectController, [], 'Moka-Controllers');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onPressed",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._performAction();
+return self}, function($ctx1) {$ctx1.fill(self,"onPressed",{},smalltalk.MKButtonController)})},
+messageSends: ["performAction"]}),
+smalltalk.MKButtonController);
+
+
+
+smalltalk.addClass('MKCheckboxController', smalltalk.MKAspectController, [], 'Moka-Controllers');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onToggled:",
+fn: function (aBoolean){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._performActionWith_(aBoolean);
+return self}, function($ctx1) {$ctx1.fill(self,"onToggled:",{aBoolean:aBoolean},smalltalk.MKCheckboxController)})},
+messageSends: ["performActionWith:"]}),
+smalltalk.MKCheckboxController);
+
+
+
+smalltalk.addClass('MKInputController', smalltalk.MKAspectController, [], 'Moka-Controllers');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onEnterPressed:",
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._performAtionWith_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"onEnterPressed:",{aString:aString},smalltalk.MKInputController)})},
+messageSends: ["performAtionWith:"]}),
+smalltalk.MKInputController);
+
+
+})(global_smalltalk,global_nil,global__st);

+ 63 - 0
js/Moka-Controllers.js

@@ -0,0 +1,63 @@
+(function(smalltalk,nil,_st){
+smalltalk.addPackage('Moka-Controllers');
+
+smalltalk.addClass('MKButtonController', smalltalk.MKAspectController, [], 'Moka-Controllers');
+smalltalk.MKButtonController.comment="I am the default controller for `MKButtonView`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onPressed",
+category: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._performAction();
+return self}, function($ctx1) {$ctx1.fill(self,"onPressed",{},smalltalk.MKButtonController)})},
+args: [],
+source: "onPressed\x0a\x09self performAction",
+messageSends: ["performAction"],
+referencedClasses: []
+}),
+smalltalk.MKButtonController);
+
+
+
+smalltalk.addClass('MKCheckboxController', smalltalk.MKAspectController, [], 'Moka-Controllers');
+smalltalk.MKCheckboxController.comment="I am the default controller for `MKCheckboxView`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onToggled:",
+category: 'actions',
+fn: function (aBoolean){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._performActionWith_(aBoolean);
+return self}, function($ctx1) {$ctx1.fill(self,"onToggled:",{aBoolean:aBoolean},smalltalk.MKCheckboxController)})},
+args: ["aBoolean"],
+source: "onToggled: aBoolean\x0a\x09self performActionWith: aBoolean",
+messageSends: ["performActionWith:"],
+referencedClasses: []
+}),
+smalltalk.MKCheckboxController);
+
+
+
+smalltalk.addClass('MKInputController', smalltalk.MKAspectController, [], 'Moka-Controllers');
+smalltalk.MKInputController.comment="I am the default controller for `MKInputView`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onEnterPressed:",
+category: 'actions',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._performAtionWith_(aString);
+return self}, function($ctx1) {$ctx1.fill(self,"onEnterPressed:",{aString:aString},smalltalk.MKInputController)})},
+args: ["aString"],
+source: "onEnterPressed: aString\x0a\x09self performAtionWith: aString",
+messageSends: ["performAtionWith:"],
+referencedClasses: []
+}),
+smalltalk.MKInputController);
+
+
+})(global_smalltalk,global_nil,global__st);

+ 497 - 0
js/Moka-Core.deploy.js

@@ -0,0 +1,497 @@
+(function(smalltalk,nil,_st){
+smalltalk.addPackage('Moka-Core');
+
+smalltalk.addClass('MKController', smalltalk.Object, ['view', 'model'], 'Moka-Core');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self["@model"];
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"model",{},smalltalk.MKController)})},
+messageSends: []}),
+smalltalk.MKController);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model:",
+fn: function (aModel){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@model"]=aModel;
+return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel},smalltalk.MKController)})},
+messageSends: []}),
+smalltalk.MKController);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "view",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self["@view"];
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"view",{},smalltalk.MKController)})},
+messageSends: []}),
+smalltalk.MKController);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "view:",
+fn: function (aView){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@view"]=aView;
+return self}, function($ctx1) {$ctx1.fill(self,"view:",{aView:aView},smalltalk.MKController)})},
+messageSends: []}),
+smalltalk.MKController);
+
+
+
+smalltalk.addClass('MKAspectController', smalltalk.MKController, ['aspect'], 'Moka-Core');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "aspect",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self["@aspect"];
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"aspect",{},smalltalk.MKAspectController)})},
+messageSends: []}),
+smalltalk.MKAspectController);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "aspect:",
+fn: function (aSelector){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@aspect"]=aSelector;
+return self}, function($ctx1) {$ctx1.fill(self,"aspect:",{aSelector:aSelector},smalltalk.MKAspectController)})},
+messageSends: []}),
+smalltalk.MKAspectController);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "performAction",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._aspect();
+if(($receiver = $1) == nil || $receiver == undefined){
+$1;
+} else {
+_st(self._model())._perform_(self._aspect());
+};
+return self}, function($ctx1) {$ctx1.fill(self,"performAction",{},smalltalk.MKAspectController)})},
+messageSends: ["ifNotNil:", "perform:", "aspect", "model"]}),
+smalltalk.MKAspectController);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "performActionWith:",
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._aspect();
+if(($receiver = $1) == nil || $receiver == undefined){
+$1;
+} else {
+_st(self._model())._perform_withArguments_(_st(self._aspect())._asMutator(),[anObject]);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"performActionWith:",{anObject:anObject},smalltalk.MKAspectController)})},
+messageSends: ["ifNotNil:", "perform:withArguments:", "asMutator", "aspect", "model"]}),
+smalltalk.MKAspectController);
+
+
+
+smalltalk.addClass('MKModel', smalltalk.Object, ['announcer'], 'Moka-Core');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "announce:",
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@announcer"])._announce_(anAnnouncement);
+return self}, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},smalltalk.MKModel)})},
+messageSends: ["announce:"]}),
+smalltalk.MKModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "changed:",
+fn: function (aSelector){
+var self=this;
+function $MKModelChanged(){return smalltalk.MKModelChanged||(typeof MKModelChanged=="undefined"?nil:MKModelChanged)}
+return smalltalk.withContext(function($ctx1) { 
+self._announce_(_st($MKModelChanged())._aspect_(aSelector));
+return self}, function($ctx1) {$ctx1.fill(self,"changed:",{aSelector:aSelector},smalltalk.MKModel)})},
+messageSends: ["announce:", "aspect:"]}),
+smalltalk.MKModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+fn: function (){
+var self=this;
+function $Announcer(){return smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
+return smalltalk.withContext(function($ctx1) { 
+smalltalk.MKModel.superclass.fn.prototype._initialize.apply(_st(self), []);
+self["@announcer"]=_st($Announcer())._new();
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.MKModel)})},
+messageSends: ["initialize", "new"]}),
+smalltalk.MKModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:do:",
+fn: function (anAnnouncement,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@announcer"])._on_do_(anAnnouncement,aBlock);
+return self}, function($ctx1) {$ctx1.fill(self,"on:do:",{anAnnouncement:anAnnouncement,aBlock:aBlock},smalltalk.MKModel)})},
+messageSends: ["on:do:"]}),
+smalltalk.MKModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:send:to:",
+fn: function (anAnnouncement,aSelector,anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@announcer"])._on_send_to_(anAnnouncement,aSelector,anObject);
+return self}, function($ctx1) {$ctx1.fill(self,"on:send:to:",{anAnnouncement:anAnnouncement,aSelector:aSelector,anObject:anObject},smalltalk.MKModel)})},
+messageSends: ["on:send:to:"]}),
+smalltalk.MKModel);
+
+
+
+smalltalk.addClass('MKModelChanged', smalltalk.Object, ['aspect'], 'Moka-Core');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "aspect",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self["@aspect"];
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"aspect",{},smalltalk.MKModelChanged)})},
+messageSends: []}),
+smalltalk.MKModelChanged);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "aspect:",
+fn: function (aSelector){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@aspect"]=aSelector;
+return self}, function($ctx1) {$ctx1.fill(self,"aspect:",{aSelector:aSelector},smalltalk.MKModelChanged)})},
+messageSends: []}),
+smalltalk.MKModelChanged);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "aspect:",
+fn: function (aSelector){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._aspect_(aSelector);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"aspect:",{aSelector:aSelector},smalltalk.MKModelChanged.klass)})},
+messageSends: ["aspect:", "new", "yourself"]}),
+smalltalk.MKModelChanged.klass);
+
+
+smalltalk.addClass('MKView', smalltalk.Widget, ['controller', 'model', 'wrapper'], 'Moka-Core');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "controller",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=self["@controller"];
+if(($receiver = $1) == nil || $receiver == undefined){
+self._controller_(self._defaultController());
+} else {
+$1;
+};
+$2=self["@controller"];
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"controller",{},smalltalk.MKView)})},
+messageSends: ["ifNil:", "controller:", "defaultController"]}),
+smalltalk.MKView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "controller:",
+fn: function (aController){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+self["@controller"]=aController;
+$1=aController;
+_st($1)._view_(self);
+$2=_st($1)._model_(self._model());
+return self}, function($ctx1) {$ctx1.fill(self,"controller:",{aController:aController},smalltalk.MKView)})},
+messageSends: ["view:", "model:", "model"]}),
+smalltalk.MKView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultController",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._defaultControllerClass())._new();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"defaultController",{},smalltalk.MKView)})},
+messageSends: ["new", "defaultControllerClass"]}),
+smalltalk.MKView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultControllerClass",
+fn: function (){
+var self=this;
+function $MKController(){return smalltalk.MKController||(typeof MKController=="undefined"?nil:MKController)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=$MKController();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"defaultControllerClass",{},smalltalk.MKView)})},
+messageSends: []}),
+smalltalk.MKView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self["@model"];
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"model",{},smalltalk.MKView)})},
+messageSends: []}),
+smalltalk.MKView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model:",
+fn: function (aModel){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@model"]=aModel;
+self._observeModel();
+return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel},smalltalk.MKView)})},
+messageSends: ["observeModel"]}),
+smalltalk.MKView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeModel",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self}, function($ctx1) {$ctx1.fill(self,"observeModel",{},smalltalk.MKView)})},
+messageSends: []}),
+smalltalk.MKView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "render",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._appendToJQuery_("body"._asJQuery());
+return self}, function($ctx1) {$ctx1.fill(self,"render",{},smalltalk.MKView)})},
+messageSends: ["appendToJQuery:", "asJQuery"]}),
+smalltalk.MKView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},smalltalk.MKView)})},
+messageSends: []}),
+smalltalk.MKView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderOn:",
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(html)._div();
+_st($1)._class_("moka_view");
+$2=_st($1)._yourself();
+self["@wrapper"]=$2;
+_st(self["@wrapper"])._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._renderContentOn_(html);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html},smalltalk.MKView)})},
+messageSends: ["class:", "div", "yourself", "with:", "renderContentOn:"]}),
+smalltalk.MKView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "update",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self["@wrapper"];
+if(($receiver = $1) == nil || $receiver == undefined){
+self._error_("The view has not been rendered yet");
+} else {
+$1;
+};
+_st(_st(self["@wrapper"])._asJQuery())._empty();
+_st((function(html){
+return smalltalk.withContext(function($ctx2) {
+return self._renderContentOn_(html);
+}, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}))._appendToJQuery_(_st(self["@wrapper"])._asJQuery());
+return self}, function($ctx1) {$ctx1.fill(self,"update",{},smalltalk.MKView)})},
+messageSends: ["ifNil:", "error:", "empty", "asJQuery", "appendToJQuery:", "renderContentOn:"]}),
+smalltalk.MKView);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model:",
+fn: function (aModel){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._model_(aModel);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel},smalltalk.MKView.klass)})},
+messageSends: ["model:", "new", "yourself"]}),
+smalltalk.MKView.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model:controller:",
+fn: function (aModel,aController){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._model_(aModel);
+_st($2)._controller_(aController);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"model:controller:",{aModel:aModel,aController:aController},smalltalk.MKView.klass)})},
+messageSends: ["controller:", "model:", "yourself"]}),
+smalltalk.MKView.klass);
+
+
+smalltalk.addClass('MKAspectView', smalltalk.MKView, ['aspect', 'label'], 'Moka-Core');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "aspect",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self["@aspect"];
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"aspect",{},smalltalk.MKAspectView)})},
+messageSends: []}),
+smalltalk.MKAspectView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "aspect:",
+fn: function (aSelector){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@aspect"]=aSelector;
+_st(self._controller())._aspect_(aSelector);
+return self}, function($ctx1) {$ctx1.fill(self,"aspect:",{aSelector:aSelector},smalltalk.MKAspectView)})},
+messageSends: ["aspect:", "controller"]}),
+smalltalk.MKAspectView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "aspectValue",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._model())._perform_(self._aspect());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"aspectValue",{},smalltalk.MKAspectView)})},
+messageSends: ["perform:", "aspect", "model"]}),
+smalltalk.MKAspectView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeModel",
+fn: function (){
+var self=this;
+function $MKModelChanged(){return smalltalk.MKModelChanged||(typeof MKModelChanged=="undefined"?nil:MKModelChanged)}
+return smalltalk.withContext(function($ctx1) { 
+smalltalk.MKAspectView.superclass.fn.prototype._observeModel.apply(_st(self), []);
+_st(self._model())._on_send_to_($MKModelChanged(),"update:",self);
+return self}, function($ctx1) {$ctx1.fill(self,"observeModel",{},smalltalk.MKAspectView)})},
+messageSends: ["observeModel", "on:send:to:", "model"]}),
+smalltalk.MKAspectView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "update:",
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(anAnnouncement)._aspect()).__eq(self._aspect());
+if(smalltalk.assert($1)){
+self._update();
+};
+return self}, function($ctx1) {$ctx1.fill(self,"update:",{anAnnouncement:anAnnouncement},smalltalk.MKAspectView)})},
+messageSends: ["ifTrue:", "update", "=", "aspect"]}),
+smalltalk.MKAspectView);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model:aspect:",
+fn: function (aModel,aSelector){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._model_(aModel);
+_st($2)._aspect_(aSelector);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"model:aspect:",{aModel:aModel,aSelector:aSelector},smalltalk.MKAspectView.klass)})},
+messageSends: ["aspect:", "model:", "yourself"]}),
+smalltalk.MKAspectView.klass);
+
+})(global_smalltalk,global_nil,global__st);

+ 678 - 0
js/Moka-Core.js

@@ -0,0 +1,678 @@
+(function(smalltalk,nil,_st){
+smalltalk.addPackage('Moka-Core');
+
+smalltalk.addClass('MKController', smalltalk.Object, ['view', 'model'], 'Moka-Core');
+smalltalk.MKController.comment="I implement the Controller part of the MVC pattern in Moka.\x0a\x0aI hold onto my `model` and `view`, set with `MKView >> controller:`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self["@model"];
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"model",{},smalltalk.MKController)})},
+args: [],
+source: "model\x0a\x09^ model",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MKController);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model:",
+category: 'accessing',
+fn: function (aModel){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@model"]=aModel;
+return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel},smalltalk.MKController)})},
+args: ["aModel"],
+source: "model: aModel\x0a\x09model := aModel",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MKController);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "view",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self["@view"];
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"view",{},smalltalk.MKController)})},
+args: [],
+source: "view\x0a\x09^ view",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MKController);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "view:",
+category: 'accessing',
+fn: function (aView){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@view"]=aView;
+return self}, function($ctx1) {$ctx1.fill(self,"view:",{aView:aView},smalltalk.MKController)})},
+args: ["aView"],
+source: "view: aView\x0a\x09view := aView",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MKController);
+
+
+
+smalltalk.addClass('MKAspectController', smalltalk.MKController, ['aspect'], 'Moka-Core');
+smalltalk.MKAspectController.comment="I am an abstract controller for performing one action using an `aspect` on a model.\x0a\x0a## API\x0a\x0a- Use `#aspect:` to plug a selector to be performed on the model\x0a- Subclasses can either use `#performActionWith:` or `#performAction` to evaluate the `aspect` selector on the model with one or no argument.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "aspect",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self["@aspect"];
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"aspect",{},smalltalk.MKAspectController)})},
+args: [],
+source: "aspect\x0a\x09^ aspect",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MKAspectController);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "aspect:",
+category: 'accessing',
+fn: function (aSelector){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@aspect"]=aSelector;
+return self}, function($ctx1) {$ctx1.fill(self,"aspect:",{aSelector:aSelector},smalltalk.MKAspectController)})},
+args: ["aSelector"],
+source: "aspect: aSelector\x0a\x09aspect := aSelector",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MKAspectController);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "performAction",
+category: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._aspect();
+if(($receiver = $1) == nil || $receiver == undefined){
+$1;
+} else {
+_st(self._model())._perform_(self._aspect());
+};
+return self}, function($ctx1) {$ctx1.fill(self,"performAction",{},smalltalk.MKAspectController)})},
+args: [],
+source: "performAction\x0a\x09self aspect ifNotNil: [\x0a\x09\x09self model \x0a\x09\x09\x09perform: self aspect ]",
+messageSends: ["ifNotNil:", "perform:", "aspect", "model"],
+referencedClasses: []
+}),
+smalltalk.MKAspectController);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "performActionWith:",
+category: 'actions',
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._aspect();
+if(($receiver = $1) == nil || $receiver == undefined){
+$1;
+} else {
+_st(self._model())._perform_withArguments_(_st(self._aspect())._asMutator(),[anObject]);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"performActionWith:",{anObject:anObject},smalltalk.MKAspectController)})},
+args: ["anObject"],
+source: "performActionWith: anObject\x0a\x09self aspect ifNotNil: [\x0a\x09\x09self model \x0a\x09\x09\x09perform: self aspect asMutator\x0a\x09\x09\x09withArguments: { anObject } ]",
+messageSends: ["ifNotNil:", "perform:withArguments:", "asMutator", "aspect", "model"],
+referencedClasses: []
+}),
+smalltalk.MKAspectController);
+
+
+
+smalltalk.addClass('MKModel', smalltalk.Object, ['announcer'], 'Moka-Core');
+smalltalk.MKModel.comment="I implement the Model part of the MVC pattern in Moka.\x0a\x0aI am the abstract superclass of all Moka model. The observer pattern is implemented through an `announcer` object.\x0a\x0a## API\x0a\x0a- Listening\x0a\x0a  Use `#on:do:` or `#on:send:to:` to listen to model changes\x0a\x0a- Triggering\x0a\x0a  `#changed:` is the builtin method used to trigger `#update:` in views.\x0a  Use `#announce:` in subclasses to trigger announcements to listeners.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "announce:",
+category: 'announcements',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@announcer"])._announce_(anAnnouncement);
+return self}, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},smalltalk.MKModel)})},
+args: ["anAnnouncement"],
+source: "announce: anAnnouncement\x0a\x09announcer announce: anAnnouncement",
+messageSends: ["announce:"],
+referencedClasses: []
+}),
+smalltalk.MKModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "changed:",
+category: 'announcements',
+fn: function (aSelector){
+var self=this;
+function $MKModelChanged(){return smalltalk.MKModelChanged||(typeof MKModelChanged=="undefined"?nil:MKModelChanged)}
+return smalltalk.withContext(function($ctx1) { 
+self._announce_(_st($MKModelChanged())._aspect_(aSelector));
+return self}, function($ctx1) {$ctx1.fill(self,"changed:",{aSelector:aSelector},smalltalk.MKModel)})},
+args: ["aSelector"],
+source: "changed: aSelector\x0a\x09\x22Trigger `#update:` to all listening aspect views\x22\x0a\x09\x0a\x09self announce: (MKModelChanged aspect: aSelector)",
+messageSends: ["announce:", "aspect:"],
+referencedClasses: ["MKModelChanged"]
+}),
+smalltalk.MKModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+category: 'initialization',
+fn: function (){
+var self=this;
+function $Announcer(){return smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
+return smalltalk.withContext(function($ctx1) { 
+smalltalk.MKModel.superclass.fn.prototype._initialize.apply(_st(self), []);
+self["@announcer"]=_st($Announcer())._new();
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.MKModel)})},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a\x09announcer := Announcer new",
+messageSends: ["initialize", "new"],
+referencedClasses: ["Announcer"]
+}),
+smalltalk.MKModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:do:",
+category: 'announcements',
+fn: function (anAnnouncement,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@announcer"])._on_do_(anAnnouncement,aBlock);
+return self}, function($ctx1) {$ctx1.fill(self,"on:do:",{anAnnouncement:anAnnouncement,aBlock:aBlock},smalltalk.MKModel)})},
+args: ["anAnnouncement", "aBlock"],
+source: "on: anAnnouncement do: aBlock\x0a\x09announcer on: anAnnouncement do: aBlock",
+messageSends: ["on:do:"],
+referencedClasses: []
+}),
+smalltalk.MKModel);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "on:send:to:",
+category: 'announcements',
+fn: function (anAnnouncement,aSelector,anObject){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@announcer"])._on_send_to_(anAnnouncement,aSelector,anObject);
+return self}, function($ctx1) {$ctx1.fill(self,"on:send:to:",{anAnnouncement:anAnnouncement,aSelector:aSelector,anObject:anObject},smalltalk.MKModel)})},
+args: ["anAnnouncement", "aSelector", "anObject"],
+source: "on: anAnnouncement send: aSelector to: anObject\x0a\x09announcer on: anAnnouncement send: aSelector to: anObject",
+messageSends: ["on:send:to:"],
+referencedClasses: []
+}),
+smalltalk.MKModel);
+
+
+
+smalltalk.addClass('MKModelChanged', smalltalk.Object, ['aspect'], 'Moka-Core');
+smalltalk.MKModelChanged.comment="I am an announcement announced when a model is changed.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "aspect",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self["@aspect"];
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"aspect",{},smalltalk.MKModelChanged)})},
+args: [],
+source: "aspect\x0a\x09^ aspect",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MKModelChanged);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "aspect:",
+category: 'accessing',
+fn: function (aSelector){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@aspect"]=aSelector;
+return self}, function($ctx1) {$ctx1.fill(self,"aspect:",{aSelector:aSelector},smalltalk.MKModelChanged)})},
+args: ["aSelector"],
+source: "aspect: aSelector\x0a\x09aspect := aSelector",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MKModelChanged);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "aspect:",
+category: 'instance creation',
+fn: function (aSelector){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._aspect_(aSelector);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"aspect:",{aSelector:aSelector},smalltalk.MKModelChanged.klass)})},
+args: ["aSelector"],
+source: "aspect: aSelector\x0a\x09^ self new\x0a\x09\x09aspect: aSelector;\x0a\x09\x09yourself",
+messageSends: ["aspect:", "new", "yourself"],
+referencedClasses: []
+}),
+smalltalk.MKModelChanged.klass);
+
+
+smalltalk.addClass('MKView', smalltalk.Widget, ['controller', 'model', 'wrapper'], 'Moka-Core');
+smalltalk.MKView.comment="I implement the View part of the MVC pattern in Moka.\x0a\x0a## API\x0a- Instance can be created with the `MKView class >> model:*` convenience methods\x0a- rendering is done through `#renderContentOn:`, to be overridden in concrete view classes\x0a- `#update` provide updating facility, refreshing the entire view\x0a- subclasses can override `#defaultControllerClass` to provide a default controller specific to a view\x0a- subclasses can override `#observeModel`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "controller",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=self["@controller"];
+if(($receiver = $1) == nil || $receiver == undefined){
+self._controller_(self._defaultController());
+} else {
+$1;
+};
+$2=self["@controller"];
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"controller",{},smalltalk.MKView)})},
+args: [],
+source: "controller\x0a\x09\x22Answer the current receiver's controller.\x0a\x09If no controller is installed yet, install the `defaultController`\x0a\x09of the receiver and answer it.\x22\x0a\x09\x0a\x09controller ifNil: [ \x0a\x09\x09self controller: self defaultController ].\x0a\x09^ controller",
+messageSends: ["ifNil:", "controller:", "defaultController"],
+referencedClasses: []
+}),
+smalltalk.MKView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "controller:",
+category: 'accessing',
+fn: function (aController){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+self["@controller"]=aController;
+$1=aController;
+_st($1)._view_(self);
+$2=_st($1)._model_(self._model());
+return self}, function($ctx1) {$ctx1.fill(self,"controller:",{aController:aController},smalltalk.MKView)})},
+args: ["aController"],
+source: "controller: aController\x0a\x09\x22Install `aController` to be the receiver's controller\x22\x0a\x09\x0a\x09controller := aController.\x0a\x09aController \x0a\x09\x09view: self;\x0a\x09\x09model: self model",
+messageSends: ["view:", "model:", "model"],
+referencedClasses: []
+}),
+smalltalk.MKView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultController",
+category: 'factory',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._defaultControllerClass())._new();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"defaultController",{},smalltalk.MKView)})},
+args: [],
+source: "defaultController\x0a\x09^ self defaultControllerClass new",
+messageSends: ["new", "defaultControllerClass"],
+referencedClasses: []
+}),
+smalltalk.MKView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultControllerClass",
+category: 'defaults',
+fn: function (){
+var self=this;
+function $MKController(){return smalltalk.MKController||(typeof MKController=="undefined"?nil:MKController)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=$MKController();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"defaultControllerClass",{},smalltalk.MKView)})},
+args: [],
+source: "defaultControllerClass\x0a\x09^ MKController",
+messageSends: [],
+referencedClasses: ["MKController"]
+}),
+smalltalk.MKView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self["@model"];
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"model",{},smalltalk.MKView)})},
+args: [],
+source: "model\x0a\x09^ model",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MKView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model:",
+category: 'accessing',
+fn: function (aModel){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@model"]=aModel;
+self._observeModel();
+return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel},smalltalk.MKView)})},
+args: ["aModel"],
+source: "model: aModel\x0a\x09model := aModel.\x0a\x09self observeModel",
+messageSends: ["observeModel"],
+referencedClasses: []
+}),
+smalltalk.MKView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeModel",
+category: 'observing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self}, function($ctx1) {$ctx1.fill(self,"observeModel",{},smalltalk.MKView)})},
+args: [],
+source: "observeModel\x0a\x09\x22No op. Override in subclasses\x22",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MKView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "render",
+category: 'rendering',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._appendToJQuery_("body"._asJQuery());
+return self}, function($ctx1) {$ctx1.fill(self,"render",{},smalltalk.MKView)})},
+args: [],
+source: "render\x0a\x09\x22Append the receiver to the BODY element\x22\x0a\x09\x0a\x09self appendToJQuery: 'body' asJQuery",
+messageSends: ["appendToJQuery:", "asJQuery"],
+referencedClasses: []
+}),
+smalltalk.MKView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+category: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},smalltalk.MKView)})},
+args: ["html"],
+source: "renderContentOn: html\x0a\x09\x22Main rendering method, override in subclasses.\x22",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MKView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderOn:",
+category: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(html)._div();
+_st($1)._class_("moka_view");
+$2=_st($1)._yourself();
+self["@wrapper"]=$2;
+_st(self["@wrapper"])._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._renderContentOn_(html);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html},smalltalk.MKView)})},
+args: ["html"],
+source: "renderOn: html\x0a\x09\x22Basic rendering method.\x0a\x09Wraps the content with a `wrapper` div for updating the receiver.\x0a\x09\x0a\x09Do not override this method, but `#renderContentOn:`\x22\x0a\x09\x0a\x09wrapper := html div\x0a\x09\x09class: 'moka_view';\x0a\x09\x09yourself.\x0a\x09wrapper with: [ self renderContentOn: html ]",
+messageSends: ["class:", "div", "yourself", "with:", "renderContentOn:"],
+referencedClasses: []
+}),
+smalltalk.MKView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "update",
+category: 'updating',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self["@wrapper"];
+if(($receiver = $1) == nil || $receiver == undefined){
+self._error_("The view has not been rendered yet");
+} else {
+$1;
+};
+_st(_st(self["@wrapper"])._asJQuery())._empty();
+_st((function(html){
+return smalltalk.withContext(function($ctx2) {
+return self._renderContentOn_(html);
+}, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}))._appendToJQuery_(_st(self["@wrapper"])._asJQuery());
+return self}, function($ctx1) {$ctx1.fill(self,"update",{},smalltalk.MKView)})},
+args: [],
+source: "update\x0a\x09\x22Update the view's content.\x22\x0a\x09\x0a\x09wrapper ifNil: [ self error: 'The view has not been rendered yet' ].\x0a\x09\x0a\x09wrapper asJQuery empty.\x0a\x09[ :html | self renderContentOn: html ] \x0a\x09\x09appendToJQuery: wrapper asJQuery",
+messageSends: ["ifNil:", "error:", "empty", "asJQuery", "appendToJQuery:", "renderContentOn:"],
+referencedClasses: []
+}),
+smalltalk.MKView);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model:",
+category: 'instance creation',
+fn: function (aModel){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._new();
+_st($2)._model_(aModel);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel},smalltalk.MKView.klass)})},
+args: ["aModel"],
+source: "model: aModel\x0a\x09^ self new\x0a\x09\x09model: aModel;\x0a\x09\x09yourself",
+messageSends: ["model:", "new", "yourself"],
+referencedClasses: []
+}),
+smalltalk.MKView.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model:controller:",
+category: 'instance creation',
+fn: function (aModel,aController){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._model_(aModel);
+_st($2)._controller_(aController);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"model:controller:",{aModel:aModel,aController:aController},smalltalk.MKView.klass)})},
+args: ["aModel", "aController"],
+source: "model: aModel controller: aController\x0a\x09^ (self model: aModel)\x0a\x09\x09controller: aController;\x0a\x09\x09yourself",
+messageSends: ["controller:", "model:", "yourself"],
+referencedClasses: []
+}),
+smalltalk.MKView.klass);
+
+
+smalltalk.addClass('MKAspectView', smalltalk.MKView, ['aspect', 'label'], 'Moka-Core');
+smalltalk.MKAspectView.comment="I am an abstract view which state depend on an `aspect` of a model. \x0a\x0a##API\x0a\x0a- Use the `#aspect:` to listen to a specific aspect of a model. Changes will then trigger `#update`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "aspect",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self["@aspect"];
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"aspect",{},smalltalk.MKAspectView)})},
+args: [],
+source: "aspect\x0a\x09^ aspect",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MKAspectView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "aspect:",
+category: 'accessing',
+fn: function (aSelector){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@aspect"]=aSelector;
+_st(self._controller())._aspect_(aSelector);
+return self}, function($ctx1) {$ctx1.fill(self,"aspect:",{aSelector:aSelector},smalltalk.MKAspectView)})},
+args: ["aSelector"],
+source: "aspect: aSelector\x0a\x09aspect := aSelector.\x0a\x09self controller aspect: aSelector",
+messageSends: ["aspect:", "controller"],
+referencedClasses: []
+}),
+smalltalk.MKAspectView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "aspectValue",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._model())._perform_(self._aspect());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"aspectValue",{},smalltalk.MKAspectView)})},
+args: [],
+source: "aspectValue\x0a\x09^ self model perform: self aspect",
+messageSends: ["perform:", "aspect", "model"],
+referencedClasses: []
+}),
+smalltalk.MKAspectView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "observeModel",
+category: 'observing',
+fn: function (){
+var self=this;
+function $MKModelChanged(){return smalltalk.MKModelChanged||(typeof MKModelChanged=="undefined"?nil:MKModelChanged)}
+return smalltalk.withContext(function($ctx1) { 
+smalltalk.MKAspectView.superclass.fn.prototype._observeModel.apply(_st(self), []);
+_st(self._model())._on_send_to_($MKModelChanged(),"update:",self);
+return self}, function($ctx1) {$ctx1.fill(self,"observeModel",{},smalltalk.MKAspectView)})},
+args: [],
+source: "observeModel\x0a\x09super observeModel.\x0a\x09\x0a\x09self model\x0a\x09\x09on: MKModelChanged\x0a\x09\x09send: 'update:'\x0a\x09\x09to: self",
+messageSends: ["observeModel", "on:send:to:", "model"],
+referencedClasses: ["MKModelChanged"]
+}),
+smalltalk.MKAspectView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "update:",
+category: 'updating',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(anAnnouncement)._aspect()).__eq(self._aspect());
+if(smalltalk.assert($1)){
+self._update();
+};
+return self}, function($ctx1) {$ctx1.fill(self,"update:",{anAnnouncement:anAnnouncement},smalltalk.MKAspectView)})},
+args: ["anAnnouncement"],
+source: "update: anAnnouncement\x0a\x09anAnnouncement aspect = self aspect\x0a\x09\x09ifTrue: [ self update ]",
+messageSends: ["ifTrue:", "update", "=", "aspect"],
+referencedClasses: []
+}),
+smalltalk.MKAspectView);
+
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "model:aspect:",
+category: 'instance creation',
+fn: function (aModel,aSelector){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._model_(aModel);
+_st($2)._aspect_(aSelector);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"model:aspect:",{aModel:aModel,aSelector:aSelector},smalltalk.MKAspectView.klass)})},
+args: ["aModel", "aSelector"],
+source: "model: aModel aspect: aSelector\x0a\x09^ (self model: aModel)\x0a\x09\x09aspect: aSelector;\x0a\x09\x09yourself",
+messageSends: ["aspect:", "model:", "yourself"],
+referencedClasses: []
+}),
+smalltalk.MKAspectView.klass);
+
+})(global_smalltalk,global_nil,global__st);

+ 289 - 0
js/Moka-Views.deploy.js

@@ -0,0 +1,289 @@
+(function(smalltalk,nil,_st){
+smalltalk.addPackage('Moka-Views');
+
+smalltalk.addClass('MKButtonView', smalltalk.MKAspectView, ['default', 'label'], 'Moka-Views');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cssClass",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._isDefault();
+_st($2)._ifTrue_("default");
+$3=_st($2)._ifFalse_("");
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"cssClass",{},smalltalk.MKButtonView)})},
+messageSends: ["ifTrue:", "isDefault", "ifFalse:"]}),
+smalltalk.MKButtonView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "default",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self["@default"];
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"default",{},smalltalk.MKButtonView)})},
+messageSends: []}),
+smalltalk.MKButtonView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "default:",
+fn: function (aBoolean){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@default"]=aBoolean;
+return self}, function($ctx1) {$ctx1.fill(self,"default:",{aBoolean:aBoolean},smalltalk.MKButtonView)})},
+messageSends: []}),
+smalltalk.MKButtonView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultControllerClass",
+fn: function (){
+var self=this;
+function $MKButtonController(){return smalltalk.MKButtonController||(typeof MKButtonController=="undefined"?nil:MKButtonController)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=$MKButtonController();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"defaultControllerClass",{},smalltalk.MKButtonView)})},
+messageSends: []}),
+smalltalk.MKButtonView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultLabel",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return "OK";
+}, function($ctx1) {$ctx1.fill(self,"defaultLabel",{},smalltalk.MKButtonView)})},
+messageSends: []}),
+smalltalk.MKButtonView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isDefault",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self._default();
+if(($receiver = $2) == nil || $receiver == undefined){
+$1=false;
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isDefault",{},smalltalk.MKButtonView)})},
+messageSends: ["ifNil:", "default"]}),
+smalltalk.MKButtonView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self["@label"];
+if(($receiver = $2) == nil || $receiver == undefined){
+$1=self._defaultLabel();
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"label",{},smalltalk.MKButtonView)})},
+messageSends: ["ifNil:", "defaultLabel"]}),
+smalltalk.MKButtonView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label:",
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@label"]=aString;
+return self}, function($ctx1) {$ctx1.fill(self,"label:",{aString:aString},smalltalk.MKButtonView)})},
+messageSends: []}),
+smalltalk.MKButtonView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "pressed",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._controller())._onPressed();
+return self}, function($ctx1) {$ctx1.fill(self,"pressed",{},smalltalk.MKButtonView)})},
+messageSends: ["onPressed", "controller"]}),
+smalltalk.MKButtonView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(html)._button();
+_st($1)._class_(self._cssClass());
+_st($1)._with_(self._label());
+$2=_st($1)._onClick_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._pressed();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},smalltalk.MKButtonView)})},
+messageSends: ["class:", "cssClass", "button", "with:", "label", "onClick:", "pressed"]}),
+smalltalk.MKButtonView);
+
+
+
+smalltalk.addClass('MKCheckboxView', smalltalk.MKAspectView, ['label'], 'Moka-Views');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "checked",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self._aspectValue();
+if(($receiver = $2) == nil || $receiver == undefined){
+$1=false;
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"checked",{},smalltalk.MKCheckboxView)})},
+messageSends: ["ifNil:", "aspectValue"]}),
+smalltalk.MKCheckboxView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self["@label"];
+if(($receiver = $2) == nil || $receiver == undefined){
+$1="";
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"label",{},smalltalk.MKCheckboxView)})},
+messageSends: ["ifNil:"]}),
+smalltalk.MKCheckboxView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label:",
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@label"]=aString;
+return self}, function($ctx1) {$ctx1.fill(self,"label:",{aString:aString},smalltalk.MKCheckboxView)})},
+messageSends: []}),
+smalltalk.MKCheckboxView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "pressed",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._controller())._onToggled_(_st(self._checked())._not());
+return self}, function($ctx1) {$ctx1.fill(self,"pressed",{},smalltalk.MKCheckboxView)})},
+messageSends: ["onToggled:", "not", "checked", "controller"]}),
+smalltalk.MKCheckboxView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(html)._input();
+_st($1)._type_("checkbox");
+_st($1)._at_put_("checked",self._checked());
+_st($1)._value_(self._label());
+$2=_st($1)._onClick_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._pressed();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},smalltalk.MKCheckboxView)})},
+messageSends: ["type:", "input", "at:put:", "checked", "value:", "label", "onClick:", "pressed"]}),
+smalltalk.MKCheckboxView);
+
+
+
+smalltalk.addClass('MKInputView', smalltalk.MKAspectView, ['input'], 'Moka-Views');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "enterPressed",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._controller())._onEnterPressed_(self._value());
+return self}, function($ctx1) {$ctx1.fill(self,"enterPressed",{},smalltalk.MKInputView)})},
+messageSends: ["onEnterPressed:", "value", "controller"]}),
+smalltalk.MKInputView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "keyDown:",
+fn: function (anEvent){
+var self=this;
+function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(anEvent)._which()).__eq(_st(_st($String())._cr())._asciiValue());
+if(smalltalk.assert($1)){
+self._enterPressed();
+};
+return self}, function($ctx1) {$ctx1.fill(self,"keyDown:",{anEvent:anEvent},smalltalk.MKInputView)})},
+messageSends: ["ifTrue:", "enterPressed", "=", "asciiValue", "cr", "which"]}),
+smalltalk.MKInputView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(html)._input();
+_st($1)._value_(self._aspectValue());
+_st($1)._onKeyDown_((function(event){
+return smalltalk.withContext(function($ctx2) {
+return self._keyDown_(event);
+}, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1)})}));
+$2=_st($1)._yourself();
+self["@input"]=$2;
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},smalltalk.MKInputView)})},
+messageSends: ["value:", "aspectValue", "input", "onKeyDown:", "keyDown:", "yourself"]}),
+smalltalk.MKInputView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self["@input"])._asJQuery())._val();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.MKInputView)})},
+messageSends: ["val", "asJQuery"]}),
+smalltalk.MKInputView);
+
+
+})(global_smalltalk,global_nil,global__st);

+ 387 - 0
js/Moka-Views.js

@@ -0,0 +1,387 @@
+(function(smalltalk,nil,_st){
+smalltalk.addPackage('Moka-Views');
+
+smalltalk.addClass('MKButtonView', smalltalk.MKAspectView, ['default', 'label'], 'Moka-Views');
+smalltalk.MKButtonView.comment="I am a push button view. My default controller is `MKButtonController`.\x0a\x0aMy controller must answer to `#onPressed`.\x0a\x0a## API\x0a\x0a- Instances can be set a `default` button\x0a- Use `#label:` to set the label string";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "cssClass",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=self._isDefault();
+_st($2)._ifTrue_("default");
+$3=_st($2)._ifFalse_("");
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"cssClass",{},smalltalk.MKButtonView)})},
+args: [],
+source: "cssClass\x0a\x09^ self isDefault \x0a\x09\x09ifTrue: 'default';\x0a\x09\x09ifFalse: ''",
+messageSends: ["ifTrue:", "isDefault", "ifFalse:"],
+referencedClasses: []
+}),
+smalltalk.MKButtonView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "default",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self["@default"];
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"default",{},smalltalk.MKButtonView)})},
+args: [],
+source: "default\x0a\x09^ default",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MKButtonView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "default:",
+category: 'accessing',
+fn: function (aBoolean){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@default"]=aBoolean;
+return self}, function($ctx1) {$ctx1.fill(self,"default:",{aBoolean:aBoolean},smalltalk.MKButtonView)})},
+args: ["aBoolean"],
+source: "default: aBoolean\x0a\x09default := aBoolean",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MKButtonView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultControllerClass",
+category: 'defaults',
+fn: function (){
+var self=this;
+function $MKButtonController(){return smalltalk.MKButtonController||(typeof MKButtonController=="undefined"?nil:MKButtonController)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=$MKButtonController();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"defaultControllerClass",{},smalltalk.MKButtonView)})},
+args: [],
+source: "defaultControllerClass\x0a\x09^ MKButtonController",
+messageSends: [],
+referencedClasses: ["MKButtonController"]
+}),
+smalltalk.MKButtonView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultLabel",
+category: 'defaults',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return "OK";
+}, function($ctx1) {$ctx1.fill(self,"defaultLabel",{},smalltalk.MKButtonView)})},
+args: [],
+source: "defaultLabel\x0a\x09^ 'OK'",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MKButtonView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isDefault",
+category: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self._default();
+if(($receiver = $2) == nil || $receiver == undefined){
+$1=false;
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isDefault",{},smalltalk.MKButtonView)})},
+args: [],
+source: "isDefault\x0a\x09^ self default ifNil: [ false ]",
+messageSends: ["ifNil:", "default"],
+referencedClasses: []
+}),
+smalltalk.MKButtonView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self["@label"];
+if(($receiver = $2) == nil || $receiver == undefined){
+$1=self._defaultLabel();
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"label",{},smalltalk.MKButtonView)})},
+args: [],
+source: "label\x0a\x09^ label ifNil: [ self defaultLabel ]",
+messageSends: ["ifNil:", "defaultLabel"],
+referencedClasses: []
+}),
+smalltalk.MKButtonView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label:",
+category: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@label"]=aString;
+return self}, function($ctx1) {$ctx1.fill(self,"label:",{aString:aString},smalltalk.MKButtonView)})},
+args: ["aString"],
+source: "label: aString\x0a\x09label := aString",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MKButtonView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "pressed",
+category: 'events',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._controller())._onPressed();
+return self}, function($ctx1) {$ctx1.fill(self,"pressed",{},smalltalk.MKButtonView)})},
+args: [],
+source: "pressed\x0a\x09self controller onPressed",
+messageSends: ["onPressed", "controller"],
+referencedClasses: []
+}),
+smalltalk.MKButtonView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+category: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(html)._button();
+_st($1)._class_(self._cssClass());
+_st($1)._with_(self._label());
+$2=_st($1)._onClick_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._pressed();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},smalltalk.MKButtonView)})},
+args: ["html"],
+source: "renderContentOn: html\x0a\x09html button\x0a\x09\x09class: self cssClass;\x0a\x09\x09with: self label;\x0a\x09\x09onClick: [ self pressed ]",
+messageSends: ["class:", "cssClass", "button", "with:", "label", "onClick:", "pressed"],
+referencedClasses: []
+}),
+smalltalk.MKButtonView);
+
+
+
+smalltalk.addClass('MKCheckboxView', smalltalk.MKAspectView, ['label'], 'Moka-Views');
+smalltalk.MKCheckboxView.comment="I am a checkbox view. My default controller is `MKCheckboxController`.\x0a\x0aMy controller must answer to `#onToggled:`.\x0a\x0a##API\x0a\x0a- If no `aspect` is provided, the ckeckbox state will always be off.\x0a- use `#label:` to set the label string.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "checked",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self._aspectValue();
+if(($receiver = $2) == nil || $receiver == undefined){
+$1=false;
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"checked",{},smalltalk.MKCheckboxView)})},
+args: [],
+source: "checked\x0a\x09^ self aspectValue ifNil: [ false ]",
+messageSends: ["ifNil:", "aspectValue"],
+referencedClasses: []
+}),
+smalltalk.MKCheckboxView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label",
+category: 'rendering',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self["@label"];
+if(($receiver = $2) == nil || $receiver == undefined){
+$1="";
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"label",{},smalltalk.MKCheckboxView)})},
+args: [],
+source: "label\x0a\x09^ label ifNil: [ '' ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+smalltalk.MKCheckboxView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "label:",
+category: 'rendering',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@label"]=aString;
+return self}, function($ctx1) {$ctx1.fill(self,"label:",{aString:aString},smalltalk.MKCheckboxView)})},
+args: ["aString"],
+source: "label: aString\x0a\x09label := aString",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MKCheckboxView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "pressed",
+category: 'events',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._controller())._onToggled_(_st(self._checked())._not());
+return self}, function($ctx1) {$ctx1.fill(self,"pressed",{},smalltalk.MKCheckboxView)})},
+args: [],
+source: "pressed\x0a\x09self controller onToggled: self checked not",
+messageSends: ["onToggled:", "not", "checked", "controller"],
+referencedClasses: []
+}),
+smalltalk.MKCheckboxView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+category: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(html)._input();
+_st($1)._type_("checkbox");
+_st($1)._at_put_("checked",self._checked());
+_st($1)._value_(self._label());
+$2=_st($1)._onClick_((function(){
+return smalltalk.withContext(function($ctx2) {
+return self._pressed();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},smalltalk.MKCheckboxView)})},
+args: ["html"],
+source: "renderContentOn: html\x0a\x09html input\x0a\x09\x09type: 'checkbox';\x0a\x09\x09at: 'checked' put: self checked;\x0a\x09\x09value: self label;\x0a\x09\x09onClick: [ self pressed ]",
+messageSends: ["type:", "input", "at:put:", "checked", "value:", "label", "onClick:", "pressed"],
+referencedClasses: []
+}),
+smalltalk.MKCheckboxView);
+
+
+
+smalltalk.addClass('MKInputView', smalltalk.MKAspectView, ['input'], 'Moka-Views');
+smalltalk.MKInputView.comment="I am an input view. My default controller is `MKInputController`.\x0a\x0aMy controller must answer to `#onEnterPressed:`.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "enterPressed",
+category: 'events',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(self._controller())._onEnterPressed_(self._value());
+return self}, function($ctx1) {$ctx1.fill(self,"enterPressed",{},smalltalk.MKInputView)})},
+args: [],
+source: "enterPressed\x0a\x09self controller onEnterPressed: self value",
+messageSends: ["onEnterPressed:", "value", "controller"],
+referencedClasses: []
+}),
+smalltalk.MKInputView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "keyDown:",
+category: 'events',
+fn: function (anEvent){
+var self=this;
+function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(anEvent)._which()).__eq(_st(_st($String())._cr())._asciiValue());
+if(smalltalk.assert($1)){
+self._enterPressed();
+};
+return self}, function($ctx1) {$ctx1.fill(self,"keyDown:",{anEvent:anEvent},smalltalk.MKInputView)})},
+args: ["anEvent"],
+source: "keyDown: anEvent\x0a\x09anEvent which = String cr asciiValue ifTrue: [\x0a\x09\x09self enterPressed ]",
+messageSends: ["ifTrue:", "enterPressed", "=", "asciiValue", "cr", "which"],
+referencedClasses: ["String"]
+}),
+smalltalk.MKInputView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderContentOn:",
+category: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(html)._input();
+_st($1)._value_(self._aspectValue());
+_st($1)._onKeyDown_((function(event){
+return smalltalk.withContext(function($ctx2) {
+return self._keyDown_(event);
+}, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1)})}));
+$2=_st($1)._yourself();
+self["@input"]=$2;
+return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},smalltalk.MKInputView)})},
+args: ["html"],
+source: "renderContentOn: html\x0a\x09input := html input\x0a\x09\x09value: self aspectValue;\x0a\x09\x09onKeyDown: [ :event |\x0a\x09\x09\x09self keyDown: event ];\x0a\x09\x09yourself",
+messageSends: ["value:", "aspectValue", "input", "onKeyDown:", "keyDown:", "yourself"],
+referencedClasses: []
+}),
+smalltalk.MKInputView);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "value",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(_st(self["@input"])._asJQuery())._val();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.MKInputView)})},
+args: [],
+source: "value\x0a\x09^ input asJQuery val",
+messageSends: ["val", "asJQuery"],
+referencedClasses: []
+}),
+smalltalk.MKInputView);
+
+
+})(global_smalltalk,global_nil,global__st);

+ 37 - 0
st/Moka-Controllers.st

@@ -0,0 +1,37 @@
+Smalltalk current createPackage: 'Moka-Controllers'!
+MKAspectController subclass: #MKButtonController
+	instanceVariableNames: ''
+	package: 'Moka-Controllers'!
+!MKButtonController commentStamp!
+I am the default controller for `MKButtonView`.!
+
+!MKButtonController methodsFor: 'actions'!
+
+onPressed
+	self performAction
+! !
+
+MKAspectController subclass: #MKCheckboxController
+	instanceVariableNames: ''
+	package: 'Moka-Controllers'!
+!MKCheckboxController commentStamp!
+I am the default controller for `MKCheckboxView`.!
+
+!MKCheckboxController methodsFor: 'actions'!
+
+onToggled: aBoolean
+	self performActionWith: aBoolean
+! !
+
+MKAspectController subclass: #MKInputController
+	instanceVariableNames: ''
+	package: 'Moka-Controllers'!
+!MKInputController commentStamp!
+I am the default controller for `MKInputView`.!
+
+!MKInputController methodsFor: 'actions'!
+
+onEnterPressed: aString
+	self performAtionWith: aString
+! !
+

+ 295 - 0
st/Moka-Core.st

@@ -0,0 +1,295 @@
+Smalltalk current createPackage: 'Moka-Core'!
+Object subclass: #MKController
+	instanceVariableNames: 'view model'
+	package: 'Moka-Core'!
+!MKController commentStamp!
+I implement the Controller part of the MVC pattern in Moka.
+
+I hold onto my `model` and `view`, set with `MKView >> controller:`.!
+
+!MKController methodsFor: 'accessing'!
+
+model
+	^ model
+!
+
+model: aModel
+	model := aModel
+!
+
+view
+	^ view
+!
+
+view: aView
+	view := aView
+! !
+
+MKController subclass: #MKAspectController
+	instanceVariableNames: 'aspect'
+	package: 'Moka-Core'!
+!MKAspectController commentStamp!
+I am an abstract controller for performing one action using an `aspect` on a model.
+
+## API
+
+- Use `#aspect:` to plug a selector to be performed on the model
+- Subclasses can either use `#performActionWith:` or `#performAction` to evaluate the `aspect` selector on the model with one or no argument.!
+
+!MKAspectController methodsFor: 'accessing'!
+
+aspect
+	^ aspect
+!
+
+aspect: aSelector
+	aspect := aSelector
+! !
+
+!MKAspectController methodsFor: 'actions'!
+
+performAction
+	self aspect ifNotNil: [
+		self model 
+			perform: self aspect ]
+!
+
+performActionWith: anObject
+	self aspect ifNotNil: [
+		self model 
+			perform: self aspect asMutator
+			withArguments: { anObject } ]
+! !
+
+Object subclass: #MKModel
+	instanceVariableNames: 'announcer'
+	package: 'Moka-Core'!
+!MKModel commentStamp!
+I implement the Model part of the MVC pattern in Moka.
+
+I am the abstract superclass of all Moka model. The observer pattern is implemented through an `announcer` object.
+
+## API
+
+- Listening
+
+  Use `#on:do:` or `#on:send:to:` to listen to model changes
+
+- Triggering
+
+  `#changed:` is the builtin method used to trigger `#update:` in views.
+  Use `#announce:` in subclasses to trigger announcements to listeners.!
+
+!MKModel methodsFor: 'announcements'!
+
+announce: anAnnouncement
+	announcer announce: anAnnouncement
+!
+
+changed: aSelector
+	"Trigger `#update:` to all listening aspect views"
+	
+	self announce: (MKModelChanged aspect: aSelector)
+!
+
+on: anAnnouncement do: aBlock
+	announcer on: anAnnouncement do: aBlock
+!
+
+on: anAnnouncement send: aSelector to: anObject
+	announcer on: anAnnouncement send: aSelector to: anObject
+! !
+
+!MKModel methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	announcer := Announcer new
+! !
+
+Object subclass: #MKModelChanged
+	instanceVariableNames: 'aspect'
+	package: 'Moka-Core'!
+!MKModelChanged commentStamp!
+I am an announcement announced when a model is changed.!
+
+!MKModelChanged methodsFor: 'accessing'!
+
+aspect
+	^ aspect
+!
+
+aspect: aSelector
+	aspect := aSelector
+! !
+
+!MKModelChanged class methodsFor: 'instance creation'!
+
+aspect: aSelector
+	^ self new
+		aspect: aSelector;
+		yourself
+! !
+
+Widget subclass: #MKView
+	instanceVariableNames: 'controller model wrapper'
+	package: 'Moka-Core'!
+!MKView commentStamp!
+I implement the View part of the MVC pattern in Moka.
+
+## API
+- Instance can be created with the `MKView class >> model:*` convenience methods
+- rendering is done through `#renderContentOn:`, to be overridden in concrete view classes
+- `#update` provide updating facility, refreshing the entire view
+- subclasses can override `#defaultControllerClass` to provide a default controller specific to a view
+- subclasses can override `#observeModel`.!
+
+!MKView methodsFor: 'accessing'!
+
+controller
+	"Answer the current receiver's controller.
+	If no controller is installed yet, install the `defaultController`
+	of the receiver and answer it."
+	
+	controller ifNil: [ 
+		self controller: self defaultController ].
+	^ controller
+!
+
+controller: aController
+	"Install `aController` to be the receiver's controller"
+	
+	controller := aController.
+	aController 
+		view: self;
+		model: self model
+!
+
+model
+	^ model
+!
+
+model: aModel
+	model := aModel.
+	self observeModel
+! !
+
+!MKView methodsFor: 'defaults'!
+
+defaultControllerClass
+	^ MKController
+! !
+
+!MKView methodsFor: 'factory'!
+
+defaultController
+	^ self defaultControllerClass new
+! !
+
+!MKView methodsFor: 'observing'!
+
+observeModel
+	"No op. Override in subclasses"
+! !
+
+!MKView methodsFor: 'rendering'!
+
+render
+	"Append the receiver to the BODY element"
+	
+	self appendToJQuery: 'body' asJQuery
+!
+
+renderContentOn: html
+	"Main rendering method, override in subclasses."
+!
+
+renderOn: html
+	"Basic rendering method.
+	Wraps the content with a `wrapper` div for updating the receiver.
+	
+	Do not override this method, but `#renderContentOn:`"
+	
+	wrapper := html div
+		class: 'moka_view';
+		yourself.
+	wrapper with: [ self renderContentOn: html ]
+! !
+
+!MKView methodsFor: 'updating'!
+
+update
+	"Update the view's content."
+	
+	wrapper ifNil: [ self error: 'The view has not been rendered yet' ].
+	
+	wrapper asJQuery empty.
+	[ :html | self renderContentOn: html ] 
+		appendToJQuery: wrapper asJQuery
+! !
+
+!MKView class methodsFor: 'instance creation'!
+
+model: aModel
+	^ self new
+		model: aModel;
+		yourself
+!
+
+model: aModel controller: aController
+	^ (self model: aModel)
+		controller: aController;
+		yourself
+! !
+
+MKView subclass: #MKAspectView
+	instanceVariableNames: 'aspect label'
+	package: 'Moka-Core'!
+!MKAspectView commentStamp!
+I am an abstract view which state depend on an `aspect` of a model. 
+
+##API
+
+- Use the `#aspect:` to listen to a specific aspect of a model. Changes will then trigger `#update`.!
+
+!MKAspectView methodsFor: 'accessing'!
+
+aspect
+	^ aspect
+!
+
+aspect: aSelector
+	aspect := aSelector.
+	self controller aspect: aSelector
+!
+
+aspectValue
+	^ self model perform: self aspect
+! !
+
+!MKAspectView methodsFor: 'observing'!
+
+observeModel
+	super observeModel.
+	
+	self model
+		on: MKModelChanged
+		send: 'update:'
+		to: self
+! !
+
+!MKAspectView methodsFor: 'updating'!
+
+update: anAnnouncement
+	anAnnouncement aspect = self aspect
+		ifTrue: [ self update ]
+! !
+
+!MKAspectView class methodsFor: 'instance creation'!
+
+model: aModel aspect: aSelector
+	^ (self model: aModel)
+		aspect: aSelector;
+		yourself
+! !
+

+ 147 - 0
st/Moka-Views.st

@@ -0,0 +1,147 @@
+Smalltalk current createPackage: 'Moka-Views'!
+MKAspectView subclass: #MKButtonView
+	instanceVariableNames: 'default label'
+	package: 'Moka-Views'!
+!MKButtonView commentStamp!
+I am a push button view. My default controller is `MKButtonController`.
+
+My controller must answer to `#onPressed`.
+
+## API
+
+- Instances can be set a `default` button
+- Use `#label:` to set the label string!
+
+!MKButtonView methodsFor: 'accessing'!
+
+cssClass
+	^ self isDefault 
+		ifTrue: 'default';
+		ifFalse: ''
+!
+
+default
+	^ default
+!
+
+default: aBoolean
+	default := aBoolean
+!
+
+label
+	^ label ifNil: [ self defaultLabel ]
+!
+
+label: aString
+	label := aString
+! !
+
+!MKButtonView methodsFor: 'defaults'!
+
+defaultControllerClass
+	^ MKButtonController
+!
+
+defaultLabel
+	^ 'OK'
+! !
+
+!MKButtonView methodsFor: 'events'!
+
+pressed
+	self controller onPressed
+! !
+
+!MKButtonView methodsFor: 'rendering'!
+
+renderContentOn: html
+	html button
+		class: self cssClass;
+		with: self label;
+		onClick: [ self pressed ]
+! !
+
+!MKButtonView methodsFor: 'testing'!
+
+isDefault
+	^ self default ifNil: [ false ]
+! !
+
+MKAspectView subclass: #MKCheckboxView
+	instanceVariableNames: 'label'
+	package: 'Moka-Views'!
+!MKCheckboxView commentStamp!
+I am a checkbox view. My default controller is `MKCheckboxController`.
+
+My controller must answer to `#onToggled:`.
+
+##API
+
+- If no `aspect` is provided, the ckeckbox state will always be off.
+- use `#label:` to set the label string.!
+
+!MKCheckboxView methodsFor: 'accessing'!
+
+checked
+	^ self aspectValue ifNil: [ false ]
+! !
+
+!MKCheckboxView methodsFor: 'events'!
+
+pressed
+	self controller onToggled: self checked not
+! !
+
+!MKCheckboxView methodsFor: 'rendering'!
+
+label
+	^ label ifNil: [ '' ]
+!
+
+label: aString
+	label := aString
+!
+
+renderContentOn: html
+	html input
+		type: 'checkbox';
+		at: 'checked' put: self checked;
+		value: self label;
+		onClick: [ self pressed ]
+! !
+
+MKAspectView subclass: #MKInputView
+	instanceVariableNames: 'input'
+	package: 'Moka-Views'!
+!MKInputView commentStamp!
+I am an input view. My default controller is `MKInputController`.
+
+My controller must answer to `#onEnterPressed:`.!
+
+!MKInputView methodsFor: 'accessing'!
+
+value
+	^ input asJQuery val
+! !
+
+!MKInputView methodsFor: 'events'!
+
+enterPressed
+	self controller onEnterPressed: self value
+!
+
+keyDown: anEvent
+	anEvent which = String cr asciiValue ifTrue: [
+		self enterPressed ]
+! !
+
+!MKInputView methodsFor: 'rendering'!
+
+renderContentOn: html
+	input := html input
+		value: self aspectValue;
+		onKeyDown: [ :event |
+			self keyDown: event ];
+		yourself
+! !
+