{"version":3,"sources":["https://lively-kernel.org/lively4/BP2019RH1/components/bp2019-individual-center-control-widget.js"],"names":["Morph","Bp2019IndividualCenterControlWidget","initialize","windowTitle","registerButtons","lively","html","registerKeys","addEventListener","evt","onDblClick","get","value","getAttribute","animate","backgroundColor","duration","onKeyDown","notify","charCode","onPlusButton","parseFloat","onMinusButton","livelyPrepareSave","setAttribute","livelyPreMigrate","livelyMigrate","other","someJavaScriptProperty","livelyInspect","contentNode","inspector","livelyExample","style","appendChild"],"mappings":"AAAA;;;;;;;;;;;;;;AAEOA,W;;;;;;;;;;;;;;;;;;AAEQ,YAAMC,mCAAN,SAAkDD,KAAlD,CAAwD;AACrE,cAAME,UAAN,GAAmB;AACjB,eAAKC,WAAL,GAAmB,qCAAnB;AACA,eAAKC,eAAL;;AAEAC,iBAAOC,IAAP,CAAYC,YAAZ,CAAyB,IAAzB,EAJiB,CAIe;;AAEhCF,iBAAOG,gBAAP,CAAwB,UAAxB,EAAoC,IAApC,EAA0C,UAA1C,EACEC,OAAO,KAAKC,UAAL,CAAgBD,GAAhB;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AATA,YAWC,KAAKE,GAAL,CAAS,YAAT,EAAuBC,KAAvB,GAA+B,KAAKC,YAAL,CAAkB,aAAlB,KAAoC,CAAnE;AACF;;AAEDH,qBAAa;AACX,eAAKI,OAAL,CAAa,CACX,EAACC,iBAAiB,WAAlB,EADW,EAEX,EAACA,iBAAiB,KAAlB,EAFW,EAGX,EAACA,iBAAiB,WAAlB,EAHW,CAAb,EAIG;AACDC,sBAAU;AADT,WAJH;AAOD;;AAED;AACAC,kBAAUR,GAAV,EAAe;AACbJ,iBAAOa,MAAP,CAAc,cAAcT,IAAIU,QAAhC;AACD;;AAED;AACAC,uBAAe;AACb,eAAKT,GAAL,CAAS,YAAT,EAAuBC,KAAvB,GAAgCS,WAAW,KAAKV,GAAL,CAAS,YAAT,EAAuBC,KAAlC,IAA2C,CAA3E;AACD;;AAEDU,wBAAgB;AACd,eAAKX,GAAL,CAAS,YAAT,EAAuBC,KAAvB,GAAgCS,WAAW,KAAKV,GAAL,CAAS,YAAT,EAAuBC,KAAlC,IAA2C,CAA3E;AACD;;AAED;;AAEA;AACAW,4BAAoB;AAClB,eAAKC,YAAL,CAAkB,aAAlB,EAAiC,KAAKb,GAAL,CAAS,YAAT,EAAuBC,KAAxD;AACD;;AAEDa,2BAAmB;AACjB;AACD;;AAEDC,sBAAcC,KAAd,EAAqB;AACnB;AACA;AACA,eAAKC,sBAAL,GAA8BD,MAAMC,sBAApC;AACD;;AAEDC,sBAAcC,WAAd,EAA2BC,SAA3B,EAAsC;AACpC;AACD;;AAED,cAAMC,aAAN,GAAsB;AACpB;AACA;AACA,eAAKC,KAAL,CAAWlB,eAAX,GAA6B,WAA7B;AACA,eAAKa,sBAAL,GAA8B,EAA9B;AACA,eAAKM,WAAL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACD;;AAxEoE;;yBAAlDjC,mC","file":"bp2019-individual-center-control-widget.js","sourcesContent":["\"enable aexpr\";\n\nimport Morph from 'src/components/widgets/lively-morph.js';\n\nexport default class Bp2019IndividualCenterControlWidget extends Morph {\n  async initialize() {\n    this.windowTitle = \"Bp2019IndividualCenterControlWidget\";\n    this.registerButtons()\n\n    lively.html.registerKeys(this); // automatically installs handler for some methods\n    \n    lively.addEventListener(\"template\", this, \"dblclick\", \n      evt => this.onDblClick(evt))\n    // #Note 1\n    // ``lively.addEventListener`` automatically registers the listener\n    // so that the the handler can be deactivated using:\n    // ``lively.removeEventListener(\"template\", this)``\n    // #Note 1\n    // registering a closure instead of the function allows the class to make \n    // use of a dispatch at runtime. That means the ``onDblClick`` method can be\n    // replaced during development\n    \n     this.get(\"#textField\").value = this.getAttribute(\"data-mydata\") || 0\n  }\n  \n  onDblClick() {\n    this.animate([\n      {backgroundColor: \"lightgray\"},\n      {backgroundColor: \"red\"},\n      {backgroundColor: \"lightgray\"},\n    ], {\n      duration: 1000\n    })\n  }\n  \n  // this method is autmatically registered through the ``registerKeys`` method\n  onKeyDown(evt) {\n    lively.notify(\"Key Down!\" + evt.charCode)\n  }\n  \n  // this method is automatically registered as handler through ``registerButtons``\n  onPlusButton() {\n    this.get(\"#textField\").value =  parseFloat(this.get(\"#textField\").value) + 1\n  }\n  \n  onMinusButton() {\n    this.get(\"#textField\").value =  parseFloat(this.get(\"#textField\").value) - 1\n  }\n\n  /* Lively-specific API */\n\n  // store something that would be lost\n  livelyPrepareSave() {\n    this.setAttribute(\"data-mydata\", this.get(\"#textField\").value)\n  }\n  \n  livelyPreMigrate() {\n    // is called on the old object before the migration\n  }\n  \n  livelyMigrate(other) {\n    // whenever a component is replaced with a newer version during development\n    // this method is called on the new object during migration, but before initialization\n    this.someJavaScriptProperty = other.someJavaScriptProperty\n  }\n  \n  livelyInspect(contentNode, inspector) {\n    // do nothing\n  }\n  \n  async livelyExample() {\n    // this customizes a default instance to a pretty example\n    // this is used by the \n    this.style.backgroundColor = \"lightgray\"\n    this.someJavaScriptProperty = 42\n    this.appendChild(<div>This is my content</div>)\n  }\n  \n  \n}"]}