diff --git a/example/Components/bg_texture.png b/example/Components/bg_texture.png deleted file mode 100644 index f7bd7e8..0000000 Binary files a/example/Components/bg_texture.png and /dev/null differ diff --git a/example/Components/button-demo.html b/example/Components/button-demo.html deleted file mode 100644 index 6ab58a2..0000000 --- a/example/Components/button-demo.html +++ /dev/null @@ -1,22 +0,0 @@ - - \ No newline at end of file diff --git a/example/Components/index.html b/example/Components/index.html deleted file mode 100644 index 416dc74..0000000 --- a/example/Components/index.html +++ /dev/null @@ -1,244 +0,0 @@ - - - - - slim.js - Productive Web Components Library - - - - - - - - - - - - - - - - - - - -© 2016 Avichay Eyal. All code provided is open source under the MIT License -Fork me on GitHub - - - -
- -

With es6 and slim you could write native web components double-time with no hassle of using external libraries that affect your workflow

-
-

SLIM is your PRODUCTIVE way
for writing NATIVE web components

- -

Featuring

- - -
bower install slimjs
-npm install slim-js
- -

Data binding and Text-to-data Binding

todo-task-item.js

document.registerElement( - 'todo-task-item', - class extends SlimBaseElement { - - get updateOnAttributes() { - return ['name', 'done', 'todoid'] - } - - get template() { - return ` - <div id="container"> - <span id="number" bind>[[data.todoId]]</span> - <input type="checkbox" done="[done]"/> - <span id="title" text="[name]" bind>[[data.name]]</span> - <input type="button" value="X"> - </div>` - } - - update() { - super.update() // propogate downstream the DOM - var checkbox = this.find('input[type=checkbox]') - var delButton = this.find('input[value="X"]') - - checkbox.dataItem = this.data - if (this.data.done) { - checkbox.setAttribute('checked', 'checked') - } else { - checkbox.removeAttribute('checked') - } - - checkbox.onchange = () => { - checkbox.dataItem.done = checkbox.checked - } - - delButton.onclick = () => { - checkbox.dataItem.delete() - } - } - - })
- -

Using repeater

todo-task-list.js

document.registerElement( - 'todo-task-list', - class extends SlimBaseElement { - - // @override - get updateOnAttributes() { - return ['model'] - } - - // @override - get template() { - return `<s-repeat source="items"><todo-task-item></todo-task-item></s-repeat>` - } - - // @override abstract - afterRender() { - this.model.addEventListener('change', () => { - this.find('s-repeat').update() - }) - this.find('s-repeat').update() - }}) - - get items() { - return this.model.todos - }
- -

Using injection

Todo.html

<todo-task-list model="{model}"></todo-task-list> -
- -

TodoModel.js

-class TodoModel { - - constructor extends EventDispatcher() { - this.todos = [] - } - - addTask(value) { - this.todos.push( { - name: value, - done: false, - todoId: this.todos.length + 1, - delete: function() { - instance.removeTask(this.todoId) - }}) - - this.dispatchEvent(new Event('change')) - } - - removeTask(taskId) { - this.todos.splice(taskId - 1, 1) - this.todos.forEach( (todo, index) => { - todo.todoId = index + 1 - }) - this.dispatchEvent(new Event('change')) - } - -} - -const singleton = new TodoModel() - -SlimInjector.define('model', () => { return singleton })
- - -
- - - \ No newline at end of file diff --git a/example/Components/injection-demo.html b/example/Components/injection-demo.html deleted file mode 100644 index 5797e37..0000000 --- a/example/Components/injection-demo.html +++ /dev/null @@ -1,25 +0,0 @@ - \ No newline at end of file diff --git a/example/Components/repeat-demo.html b/example/Components/repeat-demo.html deleted file mode 100644 index bd3e585..0000000 --- a/example/Components/repeat-demo.html +++ /dev/null @@ -1,20 +0,0 @@ - \ No newline at end of file diff --git a/example/Components/repeat-item.html b/example/Components/repeat-item.html deleted file mode 100644 index a654399..0000000 --- a/example/Components/repeat-item.html +++ /dev/null @@ -1,20 +0,0 @@ - \ No newline at end of file diff --git a/example/Components/slim.js.logo.png b/example/Components/slim.js.logo.png deleted file mode 100644 index 837031f..0000000 Binary files a/example/Components/slim.js.logo.png and /dev/null differ