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