UNPKG

@thi.ng/rdom

Version:

Lightweight, reactive, VDOM-less UI/DOM components with async lifecycle and @thi.ng/hiccup compatible

18 lines (17 loc) 680 B
import { maybeParseFloat } from "@thi.ng/strings/parse"; const $input = (stream) => (e) => stream.next(e.target.value); const $inputNum = (stream, fallback = 0) => (e) => stream.next(maybeParseFloat(e.target.value, fallback)); const $inputCheckbox = (stream) => (e) => stream.next(e.target.checked); const $inputTrigger = (stream) => () => stream.next(true); const $inputToggle = (stream) => () => stream.next(!stream.deref()); const $inputFile = (stream) => (e) => stream.next(e.target.files[0]); const $inputFiles = (stream) => (e) => stream.next(e.target.files); export { $input, $inputCheckbox, $inputFile, $inputFiles, $inputNum, $inputToggle, $inputTrigger };