0.0.23 • Published 3 years ago
ui-scheme v0.0.23
Small frontend library for creating reusable UI blocks without any implicit magic.
The API documentation and guides will be ready later.
Please see an example below (classic todo-list).
import {UI, Scheme, Styles, EventsChannel} from "ui-scheme"
import Input from "./Input"
import Button from "./Button"
import Task from "./Task"
class TodoList extends UI
{
createScheme() {
return new Scheme({
form: new Scheme('form', {
input: new Input(),
createButton: new Button({text: 'Add'})
}),
items: 'div'
});
}
addTask(name, isDone) {
isDone = isDone === true;
let task = new Task(name, isDone, this.channel);
task.appendTo(this.items);
}
onRender() {
this.form.on('submit', event => {
event.preventDefault()
let name = this.form.input.val().trim()
if (name !== '') {
this.addTask(name, false)
this.form.input.val('')
}
});
}
}
Somewhere in browser...
<body>
<div id="todo-list"></div>
<script>
// Render todo list into corresponding div.
new TodoList().appendTo('#todo-list');
</script>
</body>
0.0.20
3 years ago
0.0.21
3 years ago
0.0.22
3 years ago
0.0.23
3 years ago
0.0.16
3 years ago
0.0.17
3 years ago
0.0.18
3 years ago
0.0.19
3 years ago
0.0.15
4 years ago
0.0.13
4 years ago
0.0.14
4 years ago
0.0.12
4 years ago
0.0.10
4 years ago
0.0.11
4 years ago
0.0.9
4 years ago
0.0.8
4 years ago
0.0.7
4 years ago
0.0.6
4 years ago
0.0.5
4 years ago
0.0.3
4 years ago
0.0.4
4 years ago
0.0.2
4 years ago
0.0.1
5 years ago