@bquery/bquery 1.4.0 → 1.6.0
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/README.md +586 -527
- package/dist/component/component.d.ts +13 -5
- package/dist/component/component.d.ts.map +1 -1
- package/dist/component/html.d.ts +40 -3
- package/dist/component/html.d.ts.map +1 -1
- package/dist/component/index.d.ts +4 -2
- package/dist/component/index.d.ts.map +1 -1
- package/dist/component/library.d.ts +34 -0
- package/dist/component/library.d.ts.map +1 -0
- package/dist/component/types.d.ts +132 -13
- package/dist/component/types.d.ts.map +1 -1
- package/dist/component-BEQgt5hl.js +600 -0
- package/dist/component-BEQgt5hl.js.map +1 -0
- package/dist/component.es.mjs +7 -184
- package/dist/config-DRmZZno3.js +40 -0
- package/dist/config-DRmZZno3.js.map +1 -0
- package/dist/core-BGQJVw0-.js +35 -0
- package/dist/core-BGQJVw0-.js.map +1 -0
- package/dist/core-CCEabVHl.js +648 -0
- package/dist/core-CCEabVHl.js.map +1 -0
- package/dist/core.es.mjs +45 -1261
- package/dist/effect-AFRW_Plg.js +84 -0
- package/dist/effect-AFRW_Plg.js.map +1 -0
- package/dist/full.d.ts +8 -8
- package/dist/full.d.ts.map +1 -1
- package/dist/full.es.mjs +101 -91
- package/dist/full.iife.js +173 -3
- package/dist/full.iife.js.map +1 -1
- package/dist/full.umd.js +173 -3
- package/dist/full.umd.js.map +1 -1
- package/dist/index.es.mjs +147 -139
- package/dist/motion/transition.d.ts +1 -1
- package/dist/motion/transition.d.ts.map +1 -1
- package/dist/motion/types.d.ts +11 -1
- package/dist/motion/types.d.ts.map +1 -1
- package/dist/motion-D9TcHxOF.js +415 -0
- package/dist/motion-D9TcHxOF.js.map +1 -0
- package/dist/motion.es.mjs +25 -361
- package/dist/object-qGpWr6-J.js +38 -0
- package/dist/object-qGpWr6-J.js.map +1 -0
- package/dist/platform/announcer.d.ts +59 -0
- package/dist/platform/announcer.d.ts.map +1 -0
- package/dist/platform/config.d.ts +92 -0
- package/dist/platform/config.d.ts.map +1 -0
- package/dist/platform/cookies.d.ts +45 -0
- package/dist/platform/cookies.d.ts.map +1 -0
- package/dist/platform/index.d.ts +8 -0
- package/dist/platform/index.d.ts.map +1 -1
- package/dist/platform/meta.d.ts +62 -0
- package/dist/platform/meta.d.ts.map +1 -0
- package/dist/platform-Dr9b6fsq.js +362 -0
- package/dist/platform-Dr9b6fsq.js.map +1 -0
- package/dist/platform.es.mjs +11 -248
- package/dist/reactive/async-data.d.ts +114 -0
- package/dist/reactive/async-data.d.ts.map +1 -0
- package/dist/reactive/index.d.ts +2 -2
- package/dist/reactive/index.d.ts.map +1 -1
- package/dist/reactive/signal.d.ts +2 -0
- package/dist/reactive/signal.d.ts.map +1 -1
- package/dist/reactive-DSkct0dO.js +254 -0
- package/dist/reactive-DSkct0dO.js.map +1 -0
- package/dist/reactive.es.mjs +18 -32
- package/dist/router-CbDhl8rS.js +188 -0
- package/dist/router-CbDhl8rS.js.map +1 -0
- package/dist/router.es.mjs +11 -200
- package/dist/sanitize-Bs2dkMby.js +313 -0
- package/dist/sanitize-Bs2dkMby.js.map +1 -0
- package/dist/security/constants.d.ts.map +1 -1
- package/dist/security/index.d.ts +4 -2
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/sanitize.d.ts +4 -1
- package/dist/security/sanitize.d.ts.map +1 -1
- package/dist/security/trusted-html.d.ts +53 -0
- package/dist/security/trusted-html.d.ts.map +1 -0
- package/dist/security.es.mjs +11 -56
- package/dist/store/define-store.d.ts +1 -1
- package/dist/store/define-store.d.ts.map +1 -1
- package/dist/store/mapping.d.ts +1 -1
- package/dist/store/mapping.d.ts.map +1 -1
- package/dist/store/persisted.d.ts +1 -1
- package/dist/store/persisted.d.ts.map +1 -1
- package/dist/store/types.d.ts +2 -2
- package/dist/store/types.d.ts.map +1 -1
- package/dist/store/watch.d.ts +1 -1
- package/dist/store/watch.d.ts.map +1 -1
- package/dist/store-BwDvI45q.js +263 -0
- package/dist/store-BwDvI45q.js.map +1 -0
- package/dist/store.es.mjs +12 -25
- package/dist/storybook/index.d.ts +37 -0
- package/dist/storybook/index.d.ts.map +1 -0
- package/dist/storybook.es.mjs +151 -0
- package/dist/storybook.es.mjs.map +1 -0
- package/dist/untrack-B0rVscTc.js +7 -0
- package/dist/untrack-B0rVscTc.js.map +1 -0
- package/dist/view-C70lA3vf.js +397 -0
- package/dist/view-C70lA3vf.js.map +1 -0
- package/dist/view.es.mjs +11 -430
- package/package.json +141 -132
- package/src/component/component.ts +524 -289
- package/src/component/html.ts +153 -53
- package/src/component/index.ts +50 -40
- package/src/component/library.ts +518 -0
- package/src/component/types.ts +256 -85
- package/src/core/collection.ts +628 -628
- package/src/core/element.ts +774 -774
- package/src/core/index.ts +48 -48
- package/src/core/utils/function.ts +151 -151
- package/src/full.ts +229 -187
- package/src/motion/animate.ts +113 -113
- package/src/motion/flip.ts +176 -176
- package/src/motion/scroll.ts +57 -57
- package/src/motion/spring.ts +150 -150
- package/src/motion/timeline.ts +246 -246
- package/src/motion/transition.ts +97 -51
- package/src/motion/types.ts +11 -1
- package/src/platform/announcer.ts +208 -0
- package/src/platform/config.ts +163 -0
- package/src/platform/cookies.ts +165 -0
- package/src/platform/index.ts +21 -0
- package/src/platform/meta.ts +168 -0
- package/src/platform/storage.ts +215 -215
- package/src/reactive/async-data.ts +486 -0
- package/src/reactive/core.ts +114 -114
- package/src/reactive/effect.ts +54 -54
- package/src/reactive/index.ts +15 -1
- package/src/reactive/internals.ts +122 -122
- package/src/reactive/signal.ts +9 -0
- package/src/security/constants.ts +3 -1
- package/src/security/index.ts +17 -10
- package/src/security/sanitize-core.ts +364 -364
- package/src/security/sanitize.ts +70 -66
- package/src/security/trusted-html.ts +71 -0
- package/src/store/define-store.ts +49 -48
- package/src/store/mapping.ts +74 -73
- package/src/store/persisted.ts +62 -61
- package/src/store/types.ts +92 -94
- package/src/store/watch.ts +53 -52
- package/src/storybook/index.ts +479 -0
- package/src/view/evaluate.ts +290 -290
- package/dist/batch-x7b2eZST.js +0 -13
- package/dist/batch-x7b2eZST.js.map +0 -1
- package/dist/component.es.mjs.map +0 -1
- package/dist/core-BhpuvPhy.js +0 -170
- package/dist/core-BhpuvPhy.js.map +0 -1
- package/dist/core.es.mjs.map +0 -1
- package/dist/full.es.mjs.map +0 -1
- package/dist/index.es.mjs.map +0 -1
- package/dist/motion.es.mjs.map +0 -1
- package/dist/persisted-DHoi3uEs.js +0 -278
- package/dist/persisted-DHoi3uEs.js.map +0 -1
- package/dist/platform.es.mjs.map +0 -1
- package/dist/reactive.es.mjs.map +0 -1
- package/dist/router.es.mjs.map +0 -1
- package/dist/sanitize-Cxvxa-DX.js +0 -283
- package/dist/sanitize-Cxvxa-DX.js.map +0 -1
- package/dist/security.es.mjs.map +0 -1
- package/dist/store.es.mjs.map +0 -1
- package/dist/type-guards-BdKlYYlS.js +0 -32
- package/dist/type-guards-BdKlYYlS.js.map +0 -1
- package/dist/untrack-DNnnqdlR.js +0 -6
- package/dist/untrack-DNnnqdlR.js.map +0 -1
- package/dist/view.es.mjs.map +0 -1
- package/dist/watch-DXXv3iAI.js +0 -58
- package/dist/watch-DXXv3iAI.js.map +0 -1
package/dist/view.es.mjs
CHANGED
|
@@ -1,432 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { b as ge } from "./batch-x7b2eZST.js";
|
|
6
|
-
const N = 500;
|
|
7
|
-
class D {
|
|
8
|
-
constructor(e) {
|
|
9
|
-
this.cache = /* @__PURE__ */ new Map(), this.maxSize = e;
|
|
10
|
-
}
|
|
11
|
-
get(e) {
|
|
12
|
-
const s = this.cache.get(e);
|
|
13
|
-
return s !== void 0 && (this.cache.delete(e), this.cache.set(e, s)), s;
|
|
14
|
-
}
|
|
15
|
-
set(e, s) {
|
|
16
|
-
if (this.cache.has(e))
|
|
17
|
-
this.cache.delete(e);
|
|
18
|
-
else if (this.cache.size >= this.maxSize) {
|
|
19
|
-
const r = this.cache.keys().next().value;
|
|
20
|
-
r !== void 0 && this.cache.delete(r);
|
|
21
|
-
}
|
|
22
|
-
this.cache.set(e, s);
|
|
23
|
-
}
|
|
24
|
-
clear() {
|
|
25
|
-
this.cache.clear();
|
|
26
|
-
}
|
|
27
|
-
get size() {
|
|
28
|
-
return this.cache.size;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
const I = new D(N), O = new D(N), de = () => {
|
|
32
|
-
I.clear(), O.clear();
|
|
33
|
-
}, U = (n) => new Proxy(n, {
|
|
34
|
-
get(e, s) {
|
|
35
|
-
if (typeof s != "string")
|
|
36
|
-
return Reflect.get(e, s);
|
|
37
|
-
const r = e[s];
|
|
38
|
-
return z(r) || V(r) ? r.value : r;
|
|
39
|
-
},
|
|
40
|
-
has(e, s) {
|
|
41
|
-
return typeof s != "string" ? Reflect.has(e, s) : s in e;
|
|
42
|
-
}
|
|
43
|
-
}), y = (n, e) => {
|
|
44
|
-
try {
|
|
45
|
-
const s = U(e);
|
|
46
|
-
let r = I.get(n);
|
|
47
|
-
return r || (r = new Function("$ctx", `with($ctx) { return (${n}); }`), I.set(n, r)), r(s);
|
|
48
|
-
} catch (s) {
|
|
49
|
-
console.error(`bQuery view: Error evaluating "${n}"`, s);
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
}, M = (n, e) => {
|
|
53
|
-
try {
|
|
54
|
-
let s = O.get(n);
|
|
55
|
-
return s || (s = new Function("$ctx", `with($ctx) { return (${n}); }`), O.set(n, s)), s(e);
|
|
56
|
-
} catch (s) {
|
|
57
|
-
console.error(`bQuery view: Error evaluating "${n}"`, s);
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
}, _ = (n) => {
|
|
61
|
-
const e = {}, s = n.trim().replace(/^\{|\}$/g, "").trim();
|
|
62
|
-
if (!s) return e;
|
|
63
|
-
const r = [];
|
|
64
|
-
let t = "", l = 0, i = null;
|
|
65
|
-
for (let c = 0; c < s.length; c++) {
|
|
66
|
-
const o = s[c];
|
|
67
|
-
if (o === '"' || o === "'" || o === "`") {
|
|
68
|
-
let a = 0, u = c - 1;
|
|
69
|
-
for (; u >= 0 && s[u] === "\\"; )
|
|
70
|
-
a++, u--;
|
|
71
|
-
a % 2 === 0 && (i === null ? i = o : i === o && (i = null)), t += o;
|
|
72
|
-
continue;
|
|
73
|
-
}
|
|
74
|
-
if (i !== null) {
|
|
75
|
-
t += o;
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
o === "(" || o === "[" || o === "{" ? (l++, t += o) : o === ")" || o === "]" || o === "}" ? (l--, t += o) : o === "," && l === 0 ? (r.push(t.trim()), t = "") : t += o;
|
|
79
|
-
}
|
|
80
|
-
t.trim() && r.push(t.trim());
|
|
81
|
-
for (const c of r) {
|
|
82
|
-
let o = -1, a = 0, u = null;
|
|
83
|
-
for (let h = 0; h < c.length; h++) {
|
|
84
|
-
const f = c[h];
|
|
85
|
-
if (f === '"' || f === "'" || f === "`") {
|
|
86
|
-
let q = 0, S = h - 1;
|
|
87
|
-
for (; S >= 0 && c[S] === "\\"; )
|
|
88
|
-
q++, S--;
|
|
89
|
-
q % 2 === 0 && (u === null ? u = f : u === f && (u = null));
|
|
90
|
-
continue;
|
|
91
|
-
}
|
|
92
|
-
if (u === null) {
|
|
93
|
-
if (f === "(" || f === "[" || f === "{")
|
|
94
|
-
a++;
|
|
95
|
-
else if (f === ")" || f === "]" || f === "}")
|
|
96
|
-
a--;
|
|
97
|
-
else if (f === ":" && a === 0) {
|
|
98
|
-
o = h;
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
if (o > -1) {
|
|
104
|
-
const h = c.slice(0, o).trim().replace(/^['"]|['"]$/g, ""), f = c.slice(o + 1).trim();
|
|
105
|
-
e[h] = f;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return e;
|
|
109
|
-
}, X = (n) => (e, s, r, t) => {
|
|
110
|
-
const l = E(() => {
|
|
111
|
-
const i = y(s, r);
|
|
112
|
-
i == null || i === !1 ? e.removeAttribute(n) : i === !0 ? e.setAttribute(n, "") : e.setAttribute(n, String(i));
|
|
113
|
-
});
|
|
114
|
-
t.push(l);
|
|
115
|
-
}, G = (n, e, s, r) => {
|
|
116
|
-
let t = /* @__PURE__ */ new Set();
|
|
117
|
-
const l = E(() => {
|
|
118
|
-
const i = /* @__PURE__ */ new Set();
|
|
119
|
-
if (e.trimStart().startsWith("{")) {
|
|
120
|
-
const c = _(e);
|
|
121
|
-
for (const [o, a] of Object.entries(c)) {
|
|
122
|
-
const u = y(a, s);
|
|
123
|
-
n.classList.toggle(o, !!u), i.add(o);
|
|
124
|
-
}
|
|
125
|
-
} else if (/^\s*\[/.test(e)) {
|
|
126
|
-
const c = y(e, s);
|
|
127
|
-
if (Array.isArray(c))
|
|
128
|
-
for (const o of c)
|
|
129
|
-
o && (n.classList.add(o), i.add(o));
|
|
130
|
-
} else {
|
|
131
|
-
const c = y(e, s);
|
|
132
|
-
typeof c == "string" ? c.split(/\s+/).forEach((o) => {
|
|
133
|
-
o && (n.classList.add(o), i.add(o));
|
|
134
|
-
}) : Array.isArray(c) && c.forEach((o) => {
|
|
135
|
-
o && (n.classList.add(o), i.add(o));
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
for (const c of t)
|
|
139
|
-
i.has(c) || n.classList.remove(c);
|
|
140
|
-
t = i;
|
|
141
|
-
});
|
|
142
|
-
r.push(l);
|
|
143
|
-
}, J = (n, e, s, r, t, l) => {
|
|
144
|
-
if (!s)
|
|
145
|
-
return e;
|
|
146
|
-
const i = {
|
|
147
|
-
...l,
|
|
148
|
-
[r]: n
|
|
149
|
-
};
|
|
150
|
-
return t && (i[t] = e), y(s, i);
|
|
151
|
-
}, Y = (n) => {
|
|
152
|
-
const { prefix: e, processElement: s, processChildren: r } = n;
|
|
153
|
-
return (t, l, i, c) => {
|
|
154
|
-
const o = t.parentNode;
|
|
155
|
-
if (!o) return;
|
|
156
|
-
const a = l.match(/^\(?(\w+)(?:\s*,\s*(\w+))?\)?\s+in\s+(\S.*)$/);
|
|
157
|
-
if (!a) {
|
|
158
|
-
console.error(`bQuery view: Invalid bq-for expression "${l}"`);
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
const [, u, h, f] = a, q = t.getAttribute(":key") || t.getAttribute(`${e}-key`), S = t.cloneNode(!0);
|
|
162
|
-
S.removeAttribute(`${e}-for`), S.removeAttribute(":key"), S.removeAttribute(`${e}-key`);
|
|
163
|
-
const Q = document.createComment(`bq-for: ${l}`);
|
|
164
|
-
o.replaceChild(Q, t);
|
|
165
|
-
let C = /* @__PURE__ */ new Map(), j = [];
|
|
166
|
-
const F = (d, p, w) => {
|
|
167
|
-
const A = S.cloneNode(!0), k = [], L = P(d), $ = h ? P(p) : null, m = {
|
|
168
|
-
...i,
|
|
169
|
-
[u]: L
|
|
170
|
-
};
|
|
171
|
-
return h && $ && (m[h] = $), s(A, m, e, k), r(A, m, e, k), {
|
|
172
|
-
key: w,
|
|
173
|
-
element: A,
|
|
174
|
-
cleanups: k,
|
|
175
|
-
item: d,
|
|
176
|
-
index: p,
|
|
177
|
-
itemSignal: L,
|
|
178
|
-
indexSignal: $
|
|
179
|
-
};
|
|
180
|
-
}, R = (d) => {
|
|
181
|
-
for (const p of d.cleanups)
|
|
182
|
-
p();
|
|
183
|
-
d.element.remove();
|
|
184
|
-
}, K = (d, p, w) => {
|
|
185
|
-
Object.is(d.item, p) || (d.item = p, d.itemSignal.value = p), d.index !== w && (d.index = w, d.indexSignal && (d.indexSignal.value = w));
|
|
186
|
-
}, B = E(() => {
|
|
187
|
-
const d = y(f, i);
|
|
188
|
-
if (!Array.isArray(d)) {
|
|
189
|
-
for (const m of C.values())
|
|
190
|
-
R(m);
|
|
191
|
-
C.clear(), j = [];
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
const p = [], w = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Set();
|
|
195
|
-
d.forEach((m, v) => {
|
|
196
|
-
let b = J(m, v, q, u, h, i);
|
|
197
|
-
A.has(b) && (console.warn(
|
|
198
|
-
`bq-for: Duplicate key "${String(b)}" detected at index ${v}. Falling back to index-based key for this item. Ensure :key expressions produce unique values for each item.`
|
|
199
|
-
), b = { __bqDuplicateKey: b, __bqIndex: v }), A.add(b), p.push(b), w.set(b, { item: m, index: v });
|
|
200
|
-
});
|
|
201
|
-
const k = [];
|
|
202
|
-
for (const m of j)
|
|
203
|
-
w.has(m) || k.push(m);
|
|
204
|
-
for (const m of k) {
|
|
205
|
-
const v = C.get(m);
|
|
206
|
-
v && (R(v), C.delete(m));
|
|
207
|
-
}
|
|
208
|
-
const L = /* @__PURE__ */ new Map();
|
|
209
|
-
let $ = Q;
|
|
210
|
-
for (let m = 0; m < p.length; m++) {
|
|
211
|
-
const v = p[m], { item: b, index: H } = w.get(v);
|
|
212
|
-
let g = C.get(v);
|
|
213
|
-
g ? (K(g, b, H), L.set(v, g), $.nextSibling !== g.element && $.after(g.element), $ = g.element) : (g = F(b, H, v), L.set(v, g), $.after(g.element), $ = g.element);
|
|
214
|
-
}
|
|
215
|
-
C = L, j = p;
|
|
216
|
-
});
|
|
217
|
-
c.push(() => {
|
|
218
|
-
B();
|
|
219
|
-
for (const d of C.values())
|
|
220
|
-
for (const p of d.cleanups)
|
|
221
|
-
p();
|
|
222
|
-
C.clear();
|
|
223
|
-
});
|
|
224
|
-
};
|
|
225
|
-
}, x = (n) => (e, s, r, t) => {
|
|
226
|
-
const l = E(() => {
|
|
227
|
-
const i = y(s, r), c = String(i ?? "");
|
|
228
|
-
e.innerHTML = n ? Z(c) : c;
|
|
229
|
-
});
|
|
230
|
-
t.push(l);
|
|
231
|
-
}, ee = (n, e, s, r) => {
|
|
232
|
-
const t = document.createComment(`bq-if: ${e}`);
|
|
233
|
-
let l = !0;
|
|
234
|
-
const i = E(() => {
|
|
235
|
-
const c = y(e, s);
|
|
236
|
-
c && !l ? (t.replaceWith(n), l = !0) : !c && l && (n.replaceWith(t), l = !1);
|
|
237
|
-
});
|
|
238
|
-
r.push(i);
|
|
239
|
-
}, te = (n, e, s, r) => {
|
|
240
|
-
const t = n, l = M(e, s);
|
|
241
|
-
if (!z(l)) {
|
|
242
|
-
console.warn(`bQuery view: bq-model requires a signal, got "${e}"`);
|
|
243
|
-
return;
|
|
244
|
-
}
|
|
245
|
-
const i = l, c = t.type === "checkbox", o = t.type === "radio", a = () => {
|
|
246
|
-
c ? t.checked = !!i.value : o ? t.checked = i.value === t.value : t.value = String(i.value ?? "");
|
|
247
|
-
}, u = E(() => {
|
|
248
|
-
a();
|
|
249
|
-
});
|
|
250
|
-
r.push(u);
|
|
251
|
-
const h = t.tagName === "SELECT" ? "change" : "input", f = () => {
|
|
252
|
-
c ? i.value = t.checked : o ? t.checked && (i.value = t.value) : i.value = t.value;
|
|
253
|
-
};
|
|
254
|
-
t.addEventListener(h, f), r.push(() => t.removeEventListener(h, f));
|
|
255
|
-
}, ne = (n) => (e, s, r, t) => {
|
|
256
|
-
const l = (i) => {
|
|
257
|
-
const c = { ...r, $event: i, $el: e };
|
|
258
|
-
if (!s.includes("(")) {
|
|
259
|
-
const a = M(s, c);
|
|
260
|
-
if (typeof a == "function") {
|
|
261
|
-
a(i);
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
M(s, c);
|
|
267
|
-
};
|
|
268
|
-
e.addEventListener(n, l), t.push(() => e.removeEventListener(n, l));
|
|
269
|
-
};
|
|
270
|
-
function se(n) {
|
|
271
|
-
const e = Object.getOwnPropertyDescriptor(n, "value");
|
|
272
|
-
return e ? "value" in e ? e.writable === !0 : typeof e.set == "function" : !1;
|
|
273
|
-
}
|
|
274
|
-
const re = (n, e, s, r) => {
|
|
275
|
-
const t = M(
|
|
276
|
-
e,
|
|
277
|
-
s
|
|
278
|
-
);
|
|
279
|
-
z(t) ? (t.value = n, r.push(() => {
|
|
280
|
-
t.value = null;
|
|
281
|
-
})) : typeof t == "object" && t !== null && se(t) && (t.value = n, r.push(() => {
|
|
282
|
-
t.value = null;
|
|
283
|
-
}));
|
|
284
|
-
}, oe = (n, e, s, r) => {
|
|
285
|
-
const t = n;
|
|
286
|
-
let l = t.style.display;
|
|
287
|
-
if (!l || l === "none") {
|
|
288
|
-
const c = t.ownerDocument.defaultView?.getComputedStyle(t).display ?? "";
|
|
289
|
-
l = c !== "none" ? c : "";
|
|
290
|
-
}
|
|
291
|
-
const i = E(() => {
|
|
292
|
-
const c = y(e, s);
|
|
293
|
-
t.style.display = c ? l : "none";
|
|
294
|
-
});
|
|
295
|
-
r.push(i);
|
|
296
|
-
}, ie = (n, e, s, r) => {
|
|
297
|
-
const t = n;
|
|
298
|
-
let l = /* @__PURE__ */ new Set();
|
|
299
|
-
const i = E(() => {
|
|
300
|
-
const c = /* @__PURE__ */ new Set();
|
|
301
|
-
if (e.trimStart().startsWith("{")) {
|
|
302
|
-
const o = _(e);
|
|
303
|
-
for (const [a, u] of Object.entries(o)) {
|
|
304
|
-
const h = y(u, s), f = a.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
305
|
-
t.style.setProperty(f, String(h ?? "")), c.add(f);
|
|
306
|
-
}
|
|
307
|
-
} else {
|
|
308
|
-
const o = y(e, s);
|
|
309
|
-
if (o && typeof o == "object")
|
|
310
|
-
for (const [a, u] of Object.entries(o)) {
|
|
311
|
-
const h = a.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
312
|
-
t.style.setProperty(h, String(u ?? "")), c.add(h);
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
for (const o of l)
|
|
316
|
-
c.has(o) || t.style.removeProperty(o);
|
|
317
|
-
l = c;
|
|
318
|
-
});
|
|
319
|
-
r.push(i);
|
|
320
|
-
}, ce = (n, e, s, r) => {
|
|
321
|
-
const t = E(() => {
|
|
322
|
-
const l = y(e, s);
|
|
323
|
-
n.textContent = String(l ?? "");
|
|
324
|
-
});
|
|
325
|
-
r.push(t);
|
|
326
|
-
}, W = (n, e, s, r, t) => {
|
|
327
|
-
const l = Array.from(n.attributes);
|
|
328
|
-
for (const i of l) {
|
|
329
|
-
const { name: c, value: o } = i;
|
|
330
|
-
if (!c.startsWith(`${s}-`)) continue;
|
|
331
|
-
const a = c.slice(s.length + 1);
|
|
332
|
-
if (a === "for") {
|
|
333
|
-
t.for(n, o, e, r);
|
|
334
|
-
return;
|
|
335
|
-
}
|
|
336
|
-
if (a === "text")
|
|
337
|
-
t.text(n, o, e, r);
|
|
338
|
-
else if (a === "html")
|
|
339
|
-
t.html(n, o, e, r);
|
|
340
|
-
else if (a === "if")
|
|
341
|
-
t.if(n, o, e, r);
|
|
342
|
-
else if (a === "show")
|
|
343
|
-
t.show(n, o, e, r);
|
|
344
|
-
else if (a === "class")
|
|
345
|
-
t.class(n, o, e, r);
|
|
346
|
-
else if (a === "style")
|
|
347
|
-
t.style(n, o, e, r);
|
|
348
|
-
else if (a === "model")
|
|
349
|
-
t.model(n, o, e, r);
|
|
350
|
-
else if (a === "ref")
|
|
351
|
-
t.ref(n, o, e, r);
|
|
352
|
-
else if (a.startsWith("bind:")) {
|
|
353
|
-
const u = a.slice(5);
|
|
354
|
-
t.bind(u)(n, o, e, r);
|
|
355
|
-
} else if (a.startsWith("on:")) {
|
|
356
|
-
const u = a.slice(3);
|
|
357
|
-
t.on(u)(n, o, e, r);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
}, T = (n, e, s, r, t) => {
|
|
361
|
-
const l = Array.from(n.children);
|
|
362
|
-
for (const i of l)
|
|
363
|
-
i.hasAttribute(`${s}-for`) ? W(i, e, s, r, t) : (W(i, e, s, r, t), T(i, e, s, r, t));
|
|
364
|
-
}, le = (n, e, s = {}) => {
|
|
365
|
-
const { prefix: r = "bq", sanitize: t = !0 } = s, l = typeof n == "string" ? document.querySelector(n) : n;
|
|
366
|
-
if (!l)
|
|
367
|
-
throw new Error(`bQuery view: Element "${n}" not found.`);
|
|
368
|
-
if (l.hasAttribute(`${r}-for`))
|
|
369
|
-
throw new Error(
|
|
370
|
-
`bQuery view: Cannot mount on element with ${r}-for directive. Wrap the ${r}-for element in a container instead.`
|
|
371
|
-
);
|
|
372
|
-
const i = [], c = {
|
|
373
|
-
text: ce,
|
|
374
|
-
html: x(t),
|
|
375
|
-
if: ee,
|
|
376
|
-
show: oe,
|
|
377
|
-
class: G,
|
|
378
|
-
style: ie,
|
|
379
|
-
model: te,
|
|
380
|
-
ref: re,
|
|
381
|
-
for: Y({
|
|
382
|
-
prefix: r,
|
|
383
|
-
processElement: (a, u, h, f) => W(a, u, h, f, c),
|
|
384
|
-
processChildren: (a, u, h, f) => T(a, u, h, f, c)
|
|
385
|
-
}),
|
|
386
|
-
bind: X,
|
|
387
|
-
on: ne
|
|
388
|
-
};
|
|
389
|
-
return ((a, u, h) => {
|
|
390
|
-
const f = a.hasAttribute(`${r}-for`);
|
|
391
|
-
W(a, u, r, h, c), f || T(a, u, r, h, c);
|
|
392
|
-
})(l, e, i), {
|
|
393
|
-
el: l,
|
|
394
|
-
context: e,
|
|
395
|
-
update: (a) => {
|
|
396
|
-
Object.assign(e, a);
|
|
397
|
-
},
|
|
398
|
-
destroy: () => {
|
|
399
|
-
for (const a of i)
|
|
400
|
-
a();
|
|
401
|
-
i.length = 0;
|
|
402
|
-
}
|
|
403
|
-
};
|
|
404
|
-
}, me = (n, e = {}) => (s) => {
|
|
405
|
-
const r = document.createElement("div");
|
|
406
|
-
r.innerHTML = n.trim();
|
|
407
|
-
const t = r.firstElementChild;
|
|
408
|
-
if (!t)
|
|
409
|
-
throw new Error("bQuery view: Template must contain a single root element.");
|
|
410
|
-
if (r.childElementCount > 1)
|
|
411
|
-
throw new Error(
|
|
412
|
-
`bQuery view: Template must contain exactly one root element, found ${r.childElementCount}.`
|
|
413
|
-
);
|
|
414
|
-
const { prefix: l = "bq" } = e;
|
|
415
|
-
if (t.hasAttribute(`${l}-for`) || t.hasAttribute(`${l}-if`)) {
|
|
416
|
-
const i = t.hasAttribute(`${l}-for`) ? "for" : "if";
|
|
417
|
-
throw new Error(
|
|
418
|
-
`bQuery view: Template root element cannot have ${l}-${i} directive. Wrap the ${l}-${i} element in a container instead.`
|
|
419
|
-
);
|
|
420
|
-
}
|
|
421
|
-
return le(t, s, e);
|
|
422
|
-
};
|
|
1
|
+
import { t as r } from "./effect-AFRW_Plg.js";
|
|
2
|
+
import { d as o, f as e } from "./reactive-DSkct0dO.js";
|
|
3
|
+
import { n as s } from "./core-BGQJVw0-.js";
|
|
4
|
+
import { n as f, r as c, t as i } from "./view-C70lA3vf.js";
|
|
423
5
|
export {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
6
|
+
e as batch,
|
|
7
|
+
c as clearExpressionCache,
|
|
8
|
+
o as computed,
|
|
9
|
+
i as createTemplate,
|
|
10
|
+
r as effect,
|
|
11
|
+
f as mount,
|
|
12
|
+
s as signal
|
|
431
13
|
};
|
|
432
|
-
//# sourceMappingURL=view.es.mjs.map
|