From c836cead58f8a204251c7c072415cbaaa77a0be9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Tue, 14 May 2019 15:58:30 +0200 Subject: [PATCH] [IMP] playground: remove explicit template keys --- extras/playground/app.js | 2 - extras/playground/playground.css | 2 +- extras/playground/samples.js | 96 ++++++++++++-------------------- extras/playground/templates.xml | 4 +- 4 files changed, 38 insertions(+), 66 deletions(-) diff --git a/extras/playground/app.js b/extras/playground/app.js index bf72dff3..c9af74bb 100644 --- a/extras/playground/app.js +++ b/extras/playground/app.js @@ -64,7 +64,6 @@ while True: class TabbedEditor extends owl.Component { constructor() { super(...arguments); - this.template = "tabbed-editor"; this.state = { currentTab: this.props.display.split("|")[0] }; @@ -142,7 +141,6 @@ class TabbedEditor extends owl.Component { class App extends owl.Component { constructor(...args) { super(...args); - this.template = "playground"; this.version = owl._version; this.SAMPLES = SAMPLES; this.widgets = { TabbedEditor }; diff --git a/extras/playground/playground.css b/extras/playground/playground.css index bbe61778..ab9979a3 100644 --- a/extras/playground/playground.css +++ b/extras/playground/playground.css @@ -22,7 +22,7 @@ body { display: grid; height: 100%; width: 100%; - grid-template-columns: auto 6px 100%; + grid-template-columns: auto 8px 100%; } /* LEFT BAR ****************************************/ diff --git a/extras/playground/samples.js b/extras/playground/samples.js index c2eac2f3..36dd3118 100644 --- a/extras/playground/samples.js +++ b/extras/playground/samples.js @@ -1,7 +1,6 @@ const CLICK_COUNTER = `class ClickCounter extends owl.Component { constructor() { super(...arguments); - this.template = "clickcounter"; this.state = { value: 0 }; } @@ -16,7 +15,7 @@ counter.mount(document.body); `; const CLICK_COUNTER_XML = ` - `; @@ -29,7 +28,6 @@ const CLICK_COUNTER_CSS = `button { const CLICK_COUNTER_ESNEXT = `// This example will not work if your browser does not support ESNext class fields class ClickCounter extends owl.Component { - template = "clickcounter"; state = { value: 0 }; increment() { @@ -45,7 +43,6 @@ counter.mount(document.body); const WIDGET_COMPOSITION = `class ClickCounter extends owl.Component { constructor(parent, props) { super(parent, props); - this.template = "clickcounter"; this.state = { value: props.initialState || 0 }; } @@ -59,7 +56,6 @@ let nextId = 1; class App extends owl.Component { constructor() { super(...arguments); - this.template = "app"; this.state = { counters: [] } this.widgets = { ClickCounter }; } @@ -75,11 +71,11 @@ app.mount(document.body); `; const WIDGET_COMPOSITION_XML = ` - -
+
@@ -97,7 +93,6 @@ const WIDGET_COMPOSITION_CSS = `button { const ANIMATION = `// This example will not work if your browser does not support ESNext class fields class App extends owl.Component { - template = "app"; state = {flag: 0}; toggle() { @@ -111,7 +106,7 @@ app.mount(document.body); `; const ANIMATION_XML = ` -
+
@@ -152,7 +147,6 @@ const ANIMATION_CSS = `button { const LIFECYCLE_DEMO = `class HookWidget extends owl.Component { constructor() { super(...arguments); - this.template = "demo.hookwidget"; this.state = { n: 0 }; console.log("constructor"); } @@ -183,7 +177,6 @@ class ParentWidget extends owl.Component { constructor() { super(...arguments); this.widgets = { HookWidget }; - this.template = "demo.parentwidget"; this.state = { n: 0, flag: true }; } increment() { @@ -200,14 +193,14 @@ widget.mount(document.body); `; const LIFECYCLE_DEMO_XML = ` -
+
-
-
Demo Sub Widget. Props: . State: . (click on me to update me)
+
+
Demo Sub Widget. Props: . State: . (click on me to update me)
`; const BENCHMARK_APP = `//------------------------------------------------------------------------------ @@ -241,7 +234,6 @@ for (let i = 1; i < 16000; i++) { class Counter extends owl.Component { constructor(parent, props) { super(parent, props); - this.template = "counter"; this.state = { counter: props.initialState || 0 }; } @@ -256,7 +248,6 @@ class Counter extends owl.Component { class Message extends owl.Component { constructor() { super(...arguments); - this.template = "message"; this.widgets = { Counter }; } @@ -273,7 +264,6 @@ class Message extends owl.Component { class App extends owl.Component { constructor() { super(...arguments); - this.template = "root"; this.widgets = { Message }; this.state = { messages: messages.slice(0, 10) }; } @@ -351,7 +341,7 @@ const BENCHMARK_APP_CSS = `.main { }`; const BENCHMARK_APP_XML = ` -
+
@@ -374,14 +364,14 @@ const BENCHMARK_APP_XML = `
-
+
-
+
Value: @@ -477,7 +467,6 @@ function makeStore() { // TodoItem //------------------------------------------------------------------------------ class TodoItem extends owl.Component { - template = "todoitem"; state = { isEditing: false }; removeTodo() { @@ -536,7 +525,6 @@ function mapStateToProps(state) { } class TodoApp extends owl.Component { - template = "todoapp"; widgets = { TodoItem }; state = { filter: "all" }; @@ -603,7 +591,7 @@ app.mount(document.body); `; const TODO_APP_STORE_XML = ` -
+

todos

@@ -641,7 +629,7 @@ const TODO_APP_STORE_XML = `
-
  • +