UNPKG

verstak

Version:
24 lines (23 loc) 908 B
import { ReactiveTreeNode, Mode } from "reactronic"; import { Division, JustText } from "verstak"; import { triggeringModel } from "./common/Utils.js"; export function Spinner(declaration) { return (Division(ReactiveTreeNode.withBasis(declaration, { mode: Mode.autonomous, preparation: el => { var _a; (_a = el.model) !== null && _a !== void 0 ? _a : (el.model = composeSpinnerModel()); }, script: el => { const m = el.model; m.active && JustText("loading..."); }, }))); } export function composeSpinnerModel(props) { var _a, _b; return triggeringModel({ active: (_a = props === null || props === void 0 ? void 0 : props.active) !== null && _a !== void 0 ? _a : false, color: (_b = props === null || props === void 0 ? void 0 : props.color) !== null && _b !== void 0 ? _b : "", }); }