{"version":3,"sources":["https://lively-kernel.org/lively4/lively4-leo/src/babylonian-programming-editor/demos/todo/example-todo.js"],"names":["Morph","ExampleTodo","initialize","windowTitle","list","get","todos","Todo","render","innerHTML","todo","appendChild","constructor","title","isDone","toString","element","document","createElement","classList","add","textContent"],"mappings":";;;;;;;;;AAAOA,W;;;;;;;;;;;AAAAA,gD;;;;;;;;AACP;;AAEe,YAAMC,WAAN,SAA0BD,KAA1B,CAAgC;AAC7CE,qBAAa;AACX,eAAKC,WAAL,GAAmB,aAAnB;AACA,eAAKC,IAAL,GAAY,KAAKC,GAAL,CAAS,OAAT,CAAZ;;AAEA,eAAKC,KAAL,GAAa,CACX,IAAIC,IAAJ,CAAS,cAAT,CADW,EAEX,IAAIA,IAAJ,CAAS,aAAT,CAFW,EAGX,IAAIA,IAAJ,CAAS,eAAT,EAA0B,IAA1B,CAHW,CAAb;;AAMA,eAAKC,MAAL;AACD;;AAEDA,iBAAS;AACP,eAAKJ,IAAL,CAAUK,SAAV,GAAsB,EAAtB;AACA,eAAI,IAAIC,IAAR,IAAgB,KAAKJ,KAArB,EAA4B;AAC1B,iBAAKF,IAAL,CAAUO,WAAV,CAAsBD,KAAKF,MAAL,EAAtB;AACD;AACF;AAnB4C;;yBAA1BP,W;;;;;;;;6BAAAA,4C;;;;;;;;AAuBd,YAAMM,IAAN,CAAW;AAChBK,oBAAYC,QAAQ,EAApB,EAAwBC,SAAS,KAAjC,EAAwC;AACtC,eAAKD,KAAL,GAAaA,KAAb;AACA,eAAKC,MAAL,GAAcA,MAAd;AACD;;AAEDC,mBAAW;AACT,iBAAQ,GAAE,KAAKF,KAAM,GAAE,KAAKC,MAAL,GAAc,SAAd,GAA0B,EAAG,EAApD;AACD;;AAEDN,iBAAS;AACP,gBAAMQ,6BAAUC,SAASC,aAAT,CAAuB,IAAvB,CAAV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAN;AACAF,kBAAQG,SAAR,CAAkBC,GAAlB,CAAsB,MAAtB;AACAJ,kBAAQK,WAAR,GAAsB,KAAKR,KAA3B;AACA,cAAG,KAAKC,MAAR,EAAgB;AACdE,oBAAQG,SAAR,CAAkBC,GAAlB,CAAsB,MAAtB;AACD;AACD,iBAAOJ,OAAP;AACD;AAlBe;;;;;;;;;;0BAALT,qC","file":"example-todo.js","sourcesContent":["import Morph from \"src/components/widgets/lively-morph.js\";\n//import { Todo } from \"src/babylonian-programming-editor/demos/todo/todo.js\";\n\nexport default class ExampleTodo extends Morph {\n  initialize() {\n    this.windowTitle = \"ExampleTodo\";\n    this.list = this.get(\"#list\");\n    \n    this.todos = [\n      new Todo(\"Do Something\"),\n      new Todo(\"Go shopping\"),\n      new Todo(\"Did Something\", true),\n    ];\n    \n    this.render();\n  }\n  \n  render() {\n    this.list.innerHTML = \"\";\n    for(let todo of this.todos) {\n      this.list.appendChild(todo.render());\n    }\n  }\n}\n\n\nexport class Todo {\n  constructor(title = \"\", isDone = false) {\n    this.title = title;\n    this.isDone = isDone;\n  }\n  \n  toString() {\n    return `${this.title}${this.isDone ? \" (Done)\" : \"\"}`;\n  }\n  \n  render() {\n    const element = document.createElement(\"li\");\n    element.classList.add(\"todo\");\n    element.textContent = this.title;\n    if(this.isDone) {\n      element.classList.add(\"done\");\n    }\n    return element;\n  }\n}\n"]}