@rhi-zone/rainbow-ui 0.2.0-alpha.4 → 0.2.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +36 -35
- package/dist/widget.d.ts +22 -6
- package/dist/widget.js +190 -186
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { h as
|
|
2
|
-
import { above as
|
|
3
|
-
import { createForm as
|
|
1
|
+
import { h as l } from "./html-C8SnQjvU.js";
|
|
2
|
+
import { above as g, beside as p, bindAttr as f, bindCheckbox as x, bindClass as S, bindInput as w, bindSelect as W, bindShow as v, bindText as y, checkboxWidget as k, concat as C, dynamic as E, each as F, eachKeyed as A, focus as I, foldWidget as K, h as L, inputWidget as N, lift as B, map as D, match as J, mount as T, narrow as V, numberInputWidget as j, on as q, prop as z, register as G, selectWidget as H, show as M, slot as O, stack as P, subscribe as Q, subscribeNow as R, template as U, textareaWidget as X, watchAll as Y, withScope as Z } from "./widget.js";
|
|
3
|
+
import { createForm as $, createFormState as ee, isDirty as te, isFormValid as ne, shouldShowError as oe } from "./form-state.js";
|
|
4
4
|
import { signal as a } from "@rhi-zone/rainbow";
|
|
5
|
-
import { attrBoolean as
|
|
5
|
+
import { attrBoolean as re, attrJson as se, attrNumber as ae, attrString as ce, attrsFrom as de, defineElement as be } from "./elements.js";
|
|
6
6
|
function d(e, n, t, r, o) {
|
|
7
7
|
const i = e(
|
|
8
8
|
n,
|
|
@@ -23,12 +23,12 @@ function b(e) {
|
|
|
23
23
|
return e.addEventListener("change", t), [n, () => e.removeEventListener("change", t)];
|
|
24
24
|
}
|
|
25
25
|
export {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
g as above,
|
|
27
|
+
re as attrBoolean,
|
|
28
|
+
se as attrJson,
|
|
29
|
+
ae as attrNumber,
|
|
30
|
+
ce as attrString,
|
|
31
|
+
de as attrsFrom,
|
|
32
32
|
p as beside,
|
|
33
33
|
f as bindAttr,
|
|
34
34
|
x as bindCheckbox,
|
|
@@ -40,37 +40,38 @@ export {
|
|
|
40
40
|
b as bindingsStoreSignal,
|
|
41
41
|
k as checkboxWidget,
|
|
42
42
|
C as concat,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
$ as createForm,
|
|
44
|
+
ee as createFormState,
|
|
45
|
+
be as defineElement,
|
|
46
46
|
E as dynamic,
|
|
47
47
|
F as each,
|
|
48
48
|
A as eachKeyed,
|
|
49
49
|
I as focus,
|
|
50
50
|
K as foldWidget,
|
|
51
51
|
L as h,
|
|
52
|
-
|
|
52
|
+
l as html,
|
|
53
53
|
N as inputWidget,
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
te as isDirty,
|
|
55
|
+
ne as isFormValid,
|
|
56
56
|
d as keybindsContext,
|
|
57
|
-
B as
|
|
58
|
-
D as
|
|
59
|
-
J as
|
|
60
|
-
T as
|
|
61
|
-
V as
|
|
62
|
-
j as
|
|
63
|
-
q as
|
|
64
|
-
z as
|
|
65
|
-
G as
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
M as
|
|
69
|
-
O as
|
|
70
|
-
P as
|
|
71
|
-
Q as
|
|
72
|
-
R as
|
|
73
|
-
U as
|
|
74
|
-
X as
|
|
75
|
-
Y as
|
|
57
|
+
B as lift,
|
|
58
|
+
D as map,
|
|
59
|
+
J as match,
|
|
60
|
+
T as mount,
|
|
61
|
+
V as narrow,
|
|
62
|
+
j as numberInputWidget,
|
|
63
|
+
q as on,
|
|
64
|
+
z as prop,
|
|
65
|
+
G as register,
|
|
66
|
+
H as selectWidget,
|
|
67
|
+
oe as shouldShowError,
|
|
68
|
+
M as show,
|
|
69
|
+
O as slot,
|
|
70
|
+
P as stack,
|
|
71
|
+
Q as subscribe,
|
|
72
|
+
R as subscribeNow,
|
|
73
|
+
U as template,
|
|
74
|
+
X as textareaWidget,
|
|
75
|
+
Y as watchAll,
|
|
76
|
+
Z as withScope
|
|
76
77
|
};
|
package/dist/widget.d.ts
CHANGED
|
@@ -458,19 +458,35 @@ export declare function selectWidget(options: {
|
|
|
458
458
|
label: string;
|
|
459
459
|
}[], attrs?: SelectAttrs): Widget<string, SelectEl>;
|
|
460
460
|
/**
|
|
461
|
-
* A reactive child: either a
|
|
462
|
-
*
|
|
461
|
+
* A reactive child: either a plain string or a widget that accepts the same
|
|
462
|
+
* signal type `T` and returns any element.
|
|
463
|
+
*
|
|
464
|
+
* `AnyEl` is intentionally excluded. Passing a pre-built element directly would
|
|
465
|
+
* require `cloneNode(true)` on each widget invocation, silently dropping event
|
|
466
|
+
* listeners. Use `lift(el)` to wrap a freshly-built element instead.
|
|
467
|
+
*/
|
|
468
|
+
export type RChild<T> = string | Widget<T, AnyEl>;
|
|
469
|
+
/**
|
|
470
|
+
* Lift a static element into the widget context. Use this to pass a
|
|
471
|
+
* pre-built `AnyEl` as a child to an `h.*` reactive factory:
|
|
472
|
+
*
|
|
473
|
+
* h.div({}, lift(iconEl), reactiveChild)
|
|
474
|
+
*
|
|
475
|
+
* The element is inserted as-is — no cloning — so event listeners are
|
|
476
|
+
* preserved. Only use `lift` when the element is freshly built at widget
|
|
477
|
+
* call time (i.e. inside the widget function body). Do NOT lift a module-
|
|
478
|
+
* level static element — it can only have one parent at a time.
|
|
463
479
|
*/
|
|
464
|
-
export
|
|
480
|
+
export declare function lift<T, E extends AnyEl>(el: E): Widget<T, E>;
|
|
465
481
|
/**
|
|
466
482
|
* Reactive hyperscript factories — the same element tags as `html.ts` but
|
|
467
483
|
* returning `Widget<T, El>` instead of `El`. Import as:
|
|
468
484
|
*
|
|
469
485
|
* import { h } from '@rhi-zone/rainbow-ui/widget'
|
|
470
486
|
*
|
|
471
|
-
* Widget children receive the same signal as their parent.
|
|
472
|
-
*
|
|
473
|
-
*
|
|
487
|
+
* Widget children receive the same signal as their parent. String children
|
|
488
|
+
* create fresh text nodes. To pass a pre-built element, wrap it with `lift(el)`
|
|
489
|
+
* so it is inserted directly without cloning — preserving event listeners.
|
|
474
490
|
*/
|
|
475
491
|
export declare const h: {
|
|
476
492
|
readonly div: <T>(attrs: GlobalAttrs, ...children: RChild<T>[]) => (s: Signal<T>) => El<"div", HTMLDivElement>;
|
package/dist/widget.js
CHANGED
|
@@ -1,350 +1,353 @@
|
|
|
1
1
|
import { index as E, stateful as L, field as W, lens as B, tagged as $, signal as j } from "@rhi-zone/rainbow";
|
|
2
2
|
import { i as _, s as F, o as I, t as O } from "./html-C8SnQjvU.js";
|
|
3
|
-
let
|
|
3
|
+
let k = null;
|
|
4
4
|
function l(e) {
|
|
5
|
-
|
|
5
|
+
k == null || k.push(e);
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
return
|
|
7
|
+
function m(e) {
|
|
8
|
+
const t = k, o = [];
|
|
9
|
+
k = o;
|
|
10
|
+
const n = e();
|
|
11
|
+
return k = t, [n, () => {
|
|
12
12
|
for (const c of o) c();
|
|
13
13
|
}];
|
|
14
14
|
}
|
|
15
15
|
function V(e) {
|
|
16
|
-
return
|
|
16
|
+
return m(e);
|
|
17
17
|
}
|
|
18
|
-
function w(e,
|
|
19
|
-
l(e.subscribe(
|
|
18
|
+
function w(e, t) {
|
|
19
|
+
l(e.subscribe(t));
|
|
20
20
|
}
|
|
21
21
|
function H(e) {
|
|
22
22
|
l(e);
|
|
23
23
|
}
|
|
24
|
-
function R(e,
|
|
25
|
-
const [
|
|
26
|
-
return o.appendChild(
|
|
27
|
-
|
|
24
|
+
function R(e, t, o) {
|
|
25
|
+
const [n, c] = m(() => e(t));
|
|
26
|
+
return o.appendChild(n.node), () => {
|
|
27
|
+
n.node.remove(), c();
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
function P(e,
|
|
31
|
-
return (o) => e(o.focus(
|
|
30
|
+
function P(e, t) {
|
|
31
|
+
return (o) => e(o.focus(t));
|
|
32
32
|
}
|
|
33
|
-
function U(e,
|
|
34
|
-
return P(e, W(
|
|
33
|
+
function U(e, t) {
|
|
34
|
+
return P(e, W(t));
|
|
35
35
|
}
|
|
36
|
-
function z(e,
|
|
36
|
+
function z(e, t) {
|
|
37
37
|
return (o) => {
|
|
38
|
-
const
|
|
39
|
-
|
|
38
|
+
const n = document.createElement("div");
|
|
39
|
+
n.dataset.narrow = "";
|
|
40
40
|
let c = null, r = null;
|
|
41
|
-
const
|
|
42
|
-
r =
|
|
43
|
-
const [a, f] =
|
|
44
|
-
c = f,
|
|
41
|
+
const u = o, d = () => {
|
|
42
|
+
r = u.narrow(t);
|
|
43
|
+
const [a, f] = m(() => e(r));
|
|
44
|
+
c = f, n.appendChild(a.node);
|
|
45
45
|
};
|
|
46
46
|
return w(o, (a) => {
|
|
47
|
-
const f =
|
|
48
|
-
f !== void 0 && c === null ?
|
|
49
|
-
}),
|
|
47
|
+
const f = t.view(a);
|
|
48
|
+
f !== void 0 && c === null ? d() : f === void 0 && c !== null && (c(), c = null, r = null, n.replaceChildren());
|
|
49
|
+
}), t.view(o.get()) !== void 0 && d(), l(() => c == null ? void 0 : c()), { _tag: "div", node: n };
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
function D(e) {
|
|
53
|
-
return (
|
|
54
|
-
const o =
|
|
55
|
-
|
|
53
|
+
return (t) => {
|
|
54
|
+
const o = t, n = document.createElement("div");
|
|
55
|
+
n.dataset.each = "";
|
|
56
56
|
let c = [];
|
|
57
|
-
const r = (
|
|
57
|
+
const r = (d) => {
|
|
58
58
|
for (const s of c) s();
|
|
59
|
-
c = [],
|
|
60
|
-
for (let s = 0; s <
|
|
59
|
+
c = [], n.replaceChildren();
|
|
60
|
+
for (let s = 0; s < d.length; s++) {
|
|
61
61
|
const a = s, f = B(
|
|
62
62
|
(p) => p[a],
|
|
63
63
|
(p, h) => {
|
|
64
|
-
const
|
|
65
|
-
return
|
|
64
|
+
const g = [...h];
|
|
65
|
+
return g[a] = p, g;
|
|
66
66
|
}
|
|
67
|
-
),
|
|
68
|
-
c.push(C),
|
|
67
|
+
), b = o.focus(f), [v, C] = m(() => e(b));
|
|
68
|
+
c.push(C), n.appendChild(v.node);
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
|
-
r(
|
|
72
|
-
const
|
|
73
|
-
return w(
|
|
74
|
-
for (const
|
|
75
|
-
}), { _tag: "div", node:
|
|
71
|
+
r(t.get());
|
|
72
|
+
const u = t.map((d) => d.length);
|
|
73
|
+
return w(u, () => r(t.get())), l(() => {
|
|
74
|
+
for (const d of c) d();
|
|
75
|
+
}), { _tag: "div", node: n };
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
-
function G(e,
|
|
78
|
+
function G(e, t) {
|
|
79
79
|
return (o) => {
|
|
80
|
-
const
|
|
80
|
+
const n = o, c = document.createElement("div");
|
|
81
81
|
c.dataset.beside = "";
|
|
82
|
-
const r =
|
|
83
|
-
return c.appendChild(
|
|
82
|
+
const r = n.focus(E(0)), u = n.focus(E(1)), [d, s] = m(() => e(r)), [a, f] = m(() => t(u));
|
|
83
|
+
return c.appendChild(d.node), c.appendChild(a.node), l(s), l(f), { _tag: "div", node: c };
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
|
-
function J(e,
|
|
86
|
+
function J(e, t) {
|
|
87
87
|
return (o) => {
|
|
88
|
-
const
|
|
88
|
+
const n = o, c = document.createElement("div");
|
|
89
89
|
c.dataset.above = "";
|
|
90
|
-
const r =
|
|
91
|
-
return c.appendChild(
|
|
90
|
+
const r = n.focus(E(0)), u = n.focus(E(1)), [d, s] = m(() => e(r)), [a, f] = m(() => t(u));
|
|
91
|
+
return c.appendChild(d.node), c.appendChild(a.node), l(s), l(f), { _tag: "div", node: c };
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
|
-
function Q(e,
|
|
94
|
+
function Q(e, t) {
|
|
95
95
|
return (o) => {
|
|
96
|
-
const
|
|
97
|
-
return n
|
|
96
|
+
const n = L(e, o);
|
|
97
|
+
return t(n);
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
|
-
function X(e,
|
|
100
|
+
function X(e, t) {
|
|
101
101
|
return (o) => {
|
|
102
|
-
const
|
|
103
|
-
return e(
|
|
102
|
+
const n = o.narrow(t);
|
|
103
|
+
return e(n);
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
|
-
function Y(e,
|
|
106
|
+
function Y(e, t) {
|
|
107
107
|
return (o) => {
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
const [c, r] =
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
|
|
108
|
+
const n = document.createElement("div");
|
|
109
|
+
n.dataset.show = "";
|
|
110
|
+
const [c, r] = m(() => e(o));
|
|
111
|
+
n.appendChild(c.node), l(r);
|
|
112
|
+
const u = (d) => {
|
|
113
|
+
n.style.display = t(d) ? "" : "none";
|
|
114
114
|
};
|
|
115
|
-
return
|
|
115
|
+
return u(o.get()), w(o, u), { _tag: "div", node: n };
|
|
116
116
|
};
|
|
117
117
|
}
|
|
118
|
-
function Z(e,
|
|
118
|
+
function Z(e, t) {
|
|
119
119
|
return (o) => {
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
const [c, r] =
|
|
123
|
-
return
|
|
120
|
+
const n = document.createElement("div");
|
|
121
|
+
n.dataset.concat = "";
|
|
122
|
+
const [c, r] = m(() => e(o)), [u, d] = m(() => t(o));
|
|
123
|
+
return n.appendChild(c.node), n.appendChild(u.node), l(r), l(d), { _tag: "div", node: n };
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
126
|
function ee(...e) {
|
|
127
|
-
return (
|
|
127
|
+
return (t) => {
|
|
128
128
|
const o = document.createElement("div");
|
|
129
129
|
o.dataset.stack = "";
|
|
130
|
-
for (const
|
|
131
|
-
const [c, r] =
|
|
130
|
+
for (const n of e) {
|
|
131
|
+
const [c, r] = m(() => n(t));
|
|
132
132
|
o.appendChild(c.node), l(r);
|
|
133
133
|
}
|
|
134
134
|
return { _tag: "div", node: o };
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
|
-
function te(e,
|
|
138
|
-
const
|
|
139
|
-
return
|
|
137
|
+
function te(e, t, o) {
|
|
138
|
+
const n = document.createElement("template");
|
|
139
|
+
return n.innerHTML = e, (c) => {
|
|
140
140
|
const r = document.createElement("div");
|
|
141
|
-
r.dataset.templ = "", r.appendChild(
|
|
142
|
-
const
|
|
143
|
-
for (const
|
|
144
|
-
const s =
|
|
141
|
+
r.dataset.templ = "", r.appendChild(n.content.cloneNode(!0));
|
|
142
|
+
const u = {};
|
|
143
|
+
for (const d of Object.keys(t)) {
|
|
144
|
+
const s = t[d], a = r.querySelector(`${s}[data-ref="${d}"]`);
|
|
145
145
|
if (a === null)
|
|
146
146
|
throw new Error(
|
|
147
|
-
`templ: ref "${
|
|
147
|
+
`templ: ref "${d}" not found — expected <${s} data-ref="${d}"> in template`
|
|
148
148
|
);
|
|
149
|
-
d
|
|
149
|
+
u[d] = { _tag: s, node: a };
|
|
150
150
|
}
|
|
151
|
-
return o(c,
|
|
151
|
+
return o(c, u), { _tag: "div", node: r };
|
|
152
152
|
};
|
|
153
153
|
}
|
|
154
|
-
function ne(e,
|
|
155
|
-
const c = (
|
|
154
|
+
function ne(e, t, o, n) {
|
|
155
|
+
const c = (n == null ? void 0 : n.container) ?? "div", r = document.createElement(c);
|
|
156
156
|
r.dataset.eachKeyed = "";
|
|
157
|
-
const
|
|
158
|
-
const
|
|
157
|
+
const u = /* @__PURE__ */ new Map(), d = (a, f) => {
|
|
158
|
+
const b = j(f);
|
|
159
159
|
let v = !1, C = () => {
|
|
160
160
|
};
|
|
161
|
-
"set" in e && (C =
|
|
161
|
+
"set" in e && (C = b.subscribe((g) => {
|
|
162
162
|
if (v) return;
|
|
163
|
-
const x = e.get(), N = x.findIndex((
|
|
164
|
-
if (N !== -1 && !Object.is(x[N],
|
|
165
|
-
const
|
|
166
|
-
|
|
163
|
+
const x = e.get(), N = x.findIndex((y) => t(y) === a);
|
|
164
|
+
if (N !== -1 && !Object.is(x[N], g)) {
|
|
165
|
+
const y = [...x];
|
|
166
|
+
y[N] = g, e.set(y);
|
|
167
167
|
}
|
|
168
168
|
}));
|
|
169
|
-
const [p, h] =
|
|
169
|
+
const [p, h] = m(() => o(b));
|
|
170
170
|
return {
|
|
171
|
-
itemSignal:
|
|
171
|
+
itemSignal: b,
|
|
172
172
|
childNode: p.node,
|
|
173
173
|
cleanup: () => {
|
|
174
174
|
h(), C();
|
|
175
175
|
},
|
|
176
|
-
setFromParent: (
|
|
177
|
-
v = !0,
|
|
176
|
+
setFromParent: (g) => {
|
|
177
|
+
v = !0, b.set(g), v = !1;
|
|
178
178
|
}
|
|
179
179
|
};
|
|
180
180
|
}, s = (a) => {
|
|
181
181
|
var C;
|
|
182
|
-
const f = a.map(
|
|
183
|
-
for (const [p, h] of
|
|
184
|
-
|
|
182
|
+
const f = a.map(t), b = new Set(f);
|
|
183
|
+
for (const [p, h] of u)
|
|
184
|
+
b.has(p) || (h.cleanup(), (C = h.childNode.parentNode) == null || C.removeChild(h.childNode), u.delete(p));
|
|
185
185
|
for (let p = 0; p < a.length; p++) {
|
|
186
|
-
const h = f[p],
|
|
187
|
-
|
|
186
|
+
const h = f[p], g = a[p];
|
|
187
|
+
u.has(h) ? u.get(h).setFromParent(g) : u.set(h, d(h, g));
|
|
188
188
|
}
|
|
189
189
|
let v = null;
|
|
190
190
|
for (let p = a.length - 1; p >= 0; p--) {
|
|
191
|
-
const h =
|
|
191
|
+
const h = u.get(f[p]);
|
|
192
192
|
(h.childNode.parentNode !== r || h.childNode.nextSibling !== v) && r.insertBefore(h.childNode, v), v = h.childNode;
|
|
193
193
|
}
|
|
194
194
|
};
|
|
195
195
|
return s(e.get()), w(e, s), l(() => {
|
|
196
|
-
for (const a of
|
|
196
|
+
for (const a of u.values()) a.cleanup();
|
|
197
197
|
}), { _tag: c, node: r };
|
|
198
198
|
}
|
|
199
|
-
function A(e,
|
|
200
|
-
const
|
|
201
|
-
e.addEventListener(
|
|
199
|
+
function A(e, t, o) {
|
|
200
|
+
const n = o;
|
|
201
|
+
e.addEventListener(t, n), l(() => e.removeEventListener(t, n));
|
|
202
202
|
}
|
|
203
|
-
function S(e,
|
|
204
|
-
e.value =
|
|
205
|
-
const o = () =>
|
|
203
|
+
function S(e, t) {
|
|
204
|
+
e.value = t.get();
|
|
205
|
+
const o = () => t.set(e.value);
|
|
206
206
|
e.addEventListener("input", o);
|
|
207
|
-
const
|
|
207
|
+
const n = t.subscribe((r) => {
|
|
208
208
|
e.value !== r && (e.value = r);
|
|
209
209
|
}), c = () => {
|
|
210
|
-
e.removeEventListener("input", o),
|
|
210
|
+
e.removeEventListener("input", o), n();
|
|
211
211
|
};
|
|
212
212
|
return l(c), c;
|
|
213
213
|
}
|
|
214
|
-
function T(e,
|
|
215
|
-
A(e, "change", () =>
|
|
214
|
+
function T(e, t) {
|
|
215
|
+
A(e, "change", () => t.set(e.value)), w(t, (o) => {
|
|
216
216
|
e.value !== o && (e.value = o);
|
|
217
217
|
});
|
|
218
218
|
}
|
|
219
|
-
function q(e,
|
|
220
|
-
A(e, "change", () =>
|
|
219
|
+
function q(e, t) {
|
|
220
|
+
A(e, "change", () => t.set(e.checked)), w(t, (o) => {
|
|
221
221
|
e.checked !== o && (e.checked = o);
|
|
222
222
|
});
|
|
223
223
|
}
|
|
224
|
-
function oe(e,
|
|
225
|
-
|
|
224
|
+
function oe(e, t) {
|
|
225
|
+
t(e.get()), l(e.subscribe(t));
|
|
226
226
|
}
|
|
227
|
-
function ce(e,
|
|
228
|
-
e.textContent =
|
|
227
|
+
function ce(e, t) {
|
|
228
|
+
e.textContent = t.get(), l(t.subscribe((o) => {
|
|
229
229
|
e.textContent = o;
|
|
230
230
|
}));
|
|
231
231
|
}
|
|
232
|
-
function re(e,
|
|
233
|
-
e.setAttribute(
|
|
234
|
-
e.setAttribute(
|
|
232
|
+
function re(e, t, o) {
|
|
233
|
+
e.setAttribute(t, o.get()), l(o.subscribe((n) => {
|
|
234
|
+
e.setAttribute(t, n);
|
|
235
235
|
}));
|
|
236
236
|
}
|
|
237
|
-
function
|
|
238
|
-
e.classList.toggle(
|
|
239
|
-
e.classList.toggle(
|
|
237
|
+
function ue(e, t, o) {
|
|
238
|
+
e.classList.toggle(t, o.get()), l(o.subscribe((n) => {
|
|
239
|
+
e.classList.toggle(t, n);
|
|
240
240
|
}));
|
|
241
241
|
}
|
|
242
|
-
function
|
|
243
|
-
|
|
244
|
-
const o = e.map((
|
|
242
|
+
function de(e, t) {
|
|
243
|
+
t();
|
|
244
|
+
const o = e.map((n) => n.subscribe(t));
|
|
245
245
|
return () => {
|
|
246
|
-
for (const
|
|
246
|
+
for (const n of o) n();
|
|
247
247
|
};
|
|
248
248
|
}
|
|
249
|
-
function ie(e,
|
|
250
|
-
return e.style.display =
|
|
249
|
+
function ie(e, t) {
|
|
250
|
+
return e.style.display = t.get() ? "" : "none", t.subscribe((o) => {
|
|
251
251
|
e.style.display = o ? "" : "none";
|
|
252
252
|
});
|
|
253
253
|
}
|
|
254
|
-
function ae(e,
|
|
254
|
+
function ae(e, t) {
|
|
255
255
|
return (o) => {
|
|
256
|
-
const
|
|
257
|
-
|
|
256
|
+
const n = document.createElement("div");
|
|
257
|
+
n.dataset.match = "";
|
|
258
258
|
let c = null, r = null;
|
|
259
|
-
const
|
|
260
|
-
const s =
|
|
259
|
+
const u = (d) => {
|
|
260
|
+
const s = d[e];
|
|
261
261
|
if (s === r) return;
|
|
262
|
-
c == null || c(), c = null,
|
|
263
|
-
const a =
|
|
262
|
+
c == null || c(), c = null, n.replaceChildren(), r = s;
|
|
263
|
+
const a = t[s];
|
|
264
264
|
if (a == null) return;
|
|
265
265
|
const f = o.narrow($(e, s));
|
|
266
|
-
let
|
|
267
|
-
[
|
|
266
|
+
let b;
|
|
267
|
+
[b, c] = m(
|
|
268
268
|
() => a(f)
|
|
269
|
-
),
|
|
269
|
+
), n.appendChild(b.node);
|
|
270
270
|
};
|
|
271
|
-
return w(o,
|
|
271
|
+
return w(o, u), u(o.get()), l(() => c == null ? void 0 : c()), { _tag: "div", node: n };
|
|
272
272
|
};
|
|
273
273
|
}
|
|
274
|
-
function se(e,
|
|
274
|
+
function se(e, t) {
|
|
275
275
|
const o = document.createElement("div");
|
|
276
276
|
o.dataset.foldWidget = "";
|
|
277
|
-
let
|
|
277
|
+
let n = null;
|
|
278
278
|
const c = (r) => {
|
|
279
|
-
|
|
280
|
-
let
|
|
279
|
+
n !== null && (n(), n = null), o.replaceChildren();
|
|
280
|
+
let u = null;
|
|
281
281
|
switch (r.status) {
|
|
282
282
|
case "notAsked":
|
|
283
|
-
|
|
283
|
+
u = t.notAsked ?? null;
|
|
284
284
|
break;
|
|
285
285
|
case "loading":
|
|
286
|
-
|
|
286
|
+
u = t.loading ?? null;
|
|
287
287
|
break;
|
|
288
288
|
case "failure":
|
|
289
|
-
|
|
289
|
+
u = t.failure ? () => t.failure(r.error) : null;
|
|
290
290
|
break;
|
|
291
291
|
case "success":
|
|
292
|
-
|
|
292
|
+
u = t.success ? () => t.success(r.value) : null;
|
|
293
293
|
break;
|
|
294
294
|
}
|
|
295
|
-
if (
|
|
296
|
-
let
|
|
297
|
-
[
|
|
295
|
+
if (u !== null) {
|
|
296
|
+
let d;
|
|
297
|
+
[d, n] = m(u), o.appendChild(d.node);
|
|
298
298
|
}
|
|
299
299
|
};
|
|
300
|
-
return c(e.get()), l(e.subscribe(c)), l(() =>
|
|
300
|
+
return c(e.get()), l(e.subscribe(c)), l(() => n == null ? void 0 : n()), { _tag: "div", node: o };
|
|
301
301
|
}
|
|
302
302
|
function le(e) {
|
|
303
|
-
return (
|
|
304
|
-
const o =
|
|
305
|
-
return
|
|
303
|
+
return (t) => {
|
|
304
|
+
const o = t, n = _(e ?? {});
|
|
305
|
+
return n.node.value = o.get(), S(n.node, o), n;
|
|
306
306
|
};
|
|
307
307
|
}
|
|
308
308
|
function fe(e) {
|
|
309
|
-
return (
|
|
310
|
-
const o =
|
|
311
|
-
return
|
|
309
|
+
return (t) => {
|
|
310
|
+
const o = t, n = O(e ?? {});
|
|
311
|
+
return n.node.value = o.get(), S(n.node, o), n;
|
|
312
312
|
};
|
|
313
313
|
}
|
|
314
314
|
function pe(e) {
|
|
315
|
-
return (
|
|
316
|
-
const o =
|
|
317
|
-
return
|
|
315
|
+
return (t) => {
|
|
316
|
+
const o = t, n = _({ ...e, type: "checkbox" });
|
|
317
|
+
return n.node.checked = o.get(), q(n.node, o), n;
|
|
318
318
|
};
|
|
319
319
|
}
|
|
320
320
|
function he(e) {
|
|
321
|
-
return (
|
|
322
|
-
const o =
|
|
323
|
-
return
|
|
324
|
-
const c =
|
|
321
|
+
return (t) => {
|
|
322
|
+
const o = t, n = _({ ...e, type: "number" });
|
|
323
|
+
return n.node.value = String(o.get()), A(n.node, "input", () => {
|
|
324
|
+
const c = n.node.valueAsNumber;
|
|
325
325
|
isNaN(c) || o.set(c);
|
|
326
|
-
}), w(
|
|
327
|
-
|
|
328
|
-
}),
|
|
326
|
+
}), w(t, (c) => {
|
|
327
|
+
n.node.valueAsNumber !== c && (n.node.value = String(c));
|
|
328
|
+
}), n;
|
|
329
329
|
};
|
|
330
330
|
}
|
|
331
|
-
function
|
|
331
|
+
function me(e, t) {
|
|
332
332
|
return (o) => {
|
|
333
|
-
const
|
|
334
|
-
return c.node.value =
|
|
333
|
+
const n = o, c = F(t ?? {}, ...e.map((r) => I({ value: r.value }, r.label)));
|
|
334
|
+
return c.node.value = n.get(), T(c.node, n), c;
|
|
335
335
|
};
|
|
336
336
|
}
|
|
337
|
+
function be(e) {
|
|
338
|
+
return (t) => e;
|
|
339
|
+
}
|
|
337
340
|
function i(e) {
|
|
338
|
-
return (
|
|
341
|
+
return (t, ...o) => (n) => {
|
|
339
342
|
const c = document.createElement(e);
|
|
340
|
-
for (const [r,
|
|
341
|
-
|
|
343
|
+
for (const [r, u] of Object.entries(t))
|
|
344
|
+
u == null || u === !1 || c.setAttribute(r, u === !0 ? "" : String(u));
|
|
342
345
|
for (const r of o)
|
|
343
|
-
typeof r == "function" ? c.appendChild(r(
|
|
346
|
+
typeof r == "function" ? c.appendChild(r(n).node) : c.appendChild(document.createTextNode(r));
|
|
344
347
|
return { _tag: e, node: c };
|
|
345
348
|
};
|
|
346
349
|
}
|
|
347
|
-
const
|
|
350
|
+
const ge = {
|
|
348
351
|
// Sectioning / flow
|
|
349
352
|
div: i("div"),
|
|
350
353
|
section: i("section"),
|
|
@@ -378,13 +381,13 @@ const me = {
|
|
|
378
381
|
form: i("form"),
|
|
379
382
|
fieldset: i("fieldset")
|
|
380
383
|
};
|
|
381
|
-
function
|
|
382
|
-
const c = o(
|
|
384
|
+
function ve(e, t, o, n) {
|
|
385
|
+
const c = o(t.get());
|
|
383
386
|
if (c === void 0) {
|
|
384
387
|
e.remove();
|
|
385
388
|
return;
|
|
386
389
|
}
|
|
387
|
-
const r = c(
|
|
390
|
+
const r = c(n ?? t);
|
|
388
391
|
e.replaceWith(r.node);
|
|
389
392
|
}
|
|
390
393
|
export {
|
|
@@ -392,7 +395,7 @@ export {
|
|
|
392
395
|
G as beside,
|
|
393
396
|
re as bindAttr,
|
|
394
397
|
q as bindCheckbox,
|
|
395
|
-
|
|
398
|
+
ue as bindClass,
|
|
396
399
|
S as bindInput,
|
|
397
400
|
T as bindSelect,
|
|
398
401
|
ie as bindShow,
|
|
@@ -404,8 +407,9 @@ export {
|
|
|
404
407
|
ne as eachKeyed,
|
|
405
408
|
P as focus,
|
|
406
409
|
se as foldWidget,
|
|
407
|
-
|
|
410
|
+
ge as h,
|
|
408
411
|
le as inputWidget,
|
|
412
|
+
be as lift,
|
|
409
413
|
X as map,
|
|
410
414
|
ae as match,
|
|
411
415
|
R as mount,
|
|
@@ -414,14 +418,14 @@ export {
|
|
|
414
418
|
A as on,
|
|
415
419
|
U as prop,
|
|
416
420
|
H as register,
|
|
417
|
-
|
|
421
|
+
me as selectWidget,
|
|
418
422
|
Y as show,
|
|
419
|
-
|
|
423
|
+
ve as slot,
|
|
420
424
|
ee as stack,
|
|
421
425
|
w as subscribe,
|
|
422
426
|
oe as subscribeNow,
|
|
423
427
|
te as template,
|
|
424
428
|
fe as textareaWidget,
|
|
425
|
-
|
|
429
|
+
de as watchAll,
|
|
426
430
|
V as withScope
|
|
427
431
|
};
|