UNPKG

verstak

Version:
29 lines (28 loc) 979 B
import { Mode, setBasis } from "reactronic"; import { Block } from "verstak"; import { rxModel } from "./common/Utils.js"; export function Spinner(declaration) { return (Block(setBasis(declaration, { preparation() { var _a; (_a = this.model) !== null && _a !== void 0 ? _a : (this.model = composeSpinnerModel()); }, body() { const m = this.model; if (m.active) Block({ mode: Mode.primitive, body() { this.text = "loading..."; }, }); }, }))); } export function composeSpinnerModel(props) { var _a, _b; return rxModel({ 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 : "", }); }