NAME
hwl - dom widget primitives
SYNOPSIS
// #include /lib/odc
// #include /lib/hwl
btn = H('button', {
cls: 'primary',
textContent: 'Save',
handlers: { click: () => save() },
})
btn.props(() => ({ className: pending.get() && 'busy' }))
document.body.append(btn.$e)
Counter = W(({ props, obs }) => {
const n = obs(0)
return H('div', { lv: [
H('button', { handlers: { click: () => n.set(n.get() + 1) } })
.props(() => ({ textContent: `${props.label.get()}: ${n.get()}` })),
]})
}, { label: 'Clicks' })
counter = Counter()
counter.props({ label: 'Hits' })
counter.dis()
wobbles = O([{ id: 1, name: 'ducky' }, { id: 2, name: 'noodle' }])
List(wobbles, w => H('p', { textContent: w.name }), { cls: 'wob' })
List(() => wobbles.get().filter(hungry), Wobble)
List(tags, t => H('span', { textContent: t }), { key: t => t })
DESCRIPTION
The hwl library provides three reactive DOM widgets.