This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| # encoding: UTF-8 | |
| require 'yaml' | |
| require 'delegate' | |
| class TagNew < SimpleDelegator | |
| def object_class | |
| __getobj__.class | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { ht } from '@crui/core' | |
| export const Title = ht('h1', 'TODO App') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { hc, text } from '@crui/core' | |
| const Title = hc('h1', [ | |
| text('TODO App') | |
| ]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { h, props } from '@crui/core'; | |
| const input = h('input', props({ className: 'add-todo-submit' })) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { h, sc2, props, on } from '@crui/core' | |
| const input = h('input', sc2( | |
| props({ className: 'add-todo-submit' }), | |
| on('input', (e) => doSomething(e)), | |
| )) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { h, sc2, props } from '@crui/reactive/elems' | |
| import { StreamBox } from '@crui/reactive/rx/box' | |
| import { bindValue } from '@crui/reactive/setups/bind' | |
| const $box = new StreamBox('') | |
| const input = h('input', sc2( | |
| props({ className: 'add-todo-input' }), | |
| bindValue($box) | |
| )) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { h, sc, props, onClick, ctext } from '@crui/core' | |
| const submit = h('button', sc([ | |
| ctext('Add') | |
| props({ className: 'add-todo-submit' }), | |
| onClick((e) => { | |
| e.preventDefault() | |
| // what to do? | |
| }), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { h, sc, props, onClick, ctext } from '@crui/core' | |
| import { StreamBox } from '@crui/reactive/rx/box'; | |
| type AddTodo = (todo: string) => void | |
| const submit = (todo: StreamBox<string>, addTodo: AddTodo) => ( | |
| h('button', sc([ | |
| ctext('Add') | |
| props({ className: 'add-todo-submit' }), | |
| onClick((e) => { | |
| e.preventDefault() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { StreamBox, RW$B } from '@crui/reactive/rx/box'; | |
| export type Todo = { | |
| text: string, | |
| } | |
| export type TodoList = Todo[] | |
| export class TodoStore { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const submit = (store: TodoStore) => ( | |
| h('button', sc([ | |
| ctext('Add') | |
| props({ className: 'add-todo-submit' }), | |
| onClick((e) => { | |
| e.preventDefault() | |
| store.addTodo(todo.get()) | |
| store.getInput().set('') | |
| }), | |
| ])) |
OlderNewer