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