sibujs 3.1.0 → 3.2.1

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 (78) hide show
  1. package/README.md +6 -0
  2. package/dist/browser.cjs +16 -8
  3. package/dist/browser.js +6 -5
  4. package/dist/build.cjs +235 -147
  5. package/dist/build.js +35 -24
  6. package/dist/cdn.global.js +7 -7
  7. package/dist/{chunk-WYU7CYJ3.js → chunk-2C4E3HBM.js} +5 -5
  8. package/dist/{chunk-3DYB5B3S.js → chunk-4JCAUOLN.js} +45 -23
  9. package/dist/{chunk-2HAGQWDV.js → chunk-5N74TKLD.js} +1 -1
  10. package/dist/{chunk-SVVAUX7J.js → chunk-7XDYVJLE.js} +19 -9
  11. package/dist/{chunk-2N2UL7O4.js → chunk-BGNLPNGV.js} +20 -12
  12. package/dist/{chunk-RK4BQG25.js → chunk-C427DVQF.js} +1 -1
  13. package/dist/{chunk-ZIBE2SAT.js → chunk-FDY42FIU.js} +3 -2
  14. package/dist/{chunk-GQ7RRFPU.js → chunk-FOI23UJL.js} +11 -1
  15. package/dist/{chunk-2RA7SHDA.js → chunk-GOJMFRBL.js} +20 -4
  16. package/dist/{chunk-IVOUCSZL.js → chunk-GOUM4JCT.js} +6 -6
  17. package/dist/chunk-H3SRKIYX.js +17 -0
  18. package/dist/{chunk-3DJH25UO.js → chunk-H6PCHJZQ.js} +2 -2
  19. package/dist/{chunk-UCS6AMJ7.js → chunk-HMJFCBRR.js} +26 -3
  20. package/dist/{chunk-JYD2PWXH.js → chunk-HXMS4SNP.js} +22 -15
  21. package/dist/{chunk-SC437AMI.js → chunk-JYXOEYI4.js} +12 -18
  22. package/dist/{chunk-KB3BA2XK.js → chunk-NFYWLRUO.js} +11 -18
  23. package/dist/{chunk-QNQY5DUS.js → chunk-NPIEEKPT.js} +20 -11
  24. package/dist/{chunk-UYX2NDOH.js → chunk-OYLPZO4N.js} +33 -15
  25. package/dist/{chunk-LYTCUZ7H.js → chunk-RDRSWYNP.js} +1 -1
  26. package/dist/{chunk-2ZJ7TSW4.js → chunk-RLUJL2MV.js} +4 -8
  27. package/dist/{chunk-CR4MXPHB.js → chunk-V2MTG5FT.js} +99 -36
  28. package/dist/{chunk-CNZ35WI2.js → chunk-VJE6DDYM.js} +2 -2
  29. package/dist/{chunk-PMSDFTK3.js → chunk-VOCE4NNK.js} +157 -75
  30. package/dist/{chunk-WKUXSE7V.js → chunk-X67UYC74.js} +12 -11
  31. package/dist/{chunk-EFOAE5NC.js → chunk-YFDGQWDA.js} +1 -1
  32. package/dist/{chunk-3U4ZVXVD.js → chunk-Z2FWAE4B.js} +6 -2
  33. package/dist/data.cjs +190 -94
  34. package/dist/data.d.cts +7 -1
  35. package/dist/data.d.ts +7 -1
  36. package/dist/data.js +8 -8
  37. package/dist/devtools.cjs +38 -10
  38. package/dist/devtools.d.cts +1 -1
  39. package/dist/devtools.d.ts +1 -1
  40. package/dist/devtools.js +6 -6
  41. package/dist/ecosystem.cjs +123 -63
  42. package/dist/ecosystem.js +9 -9
  43. package/dist/extras.cjs +380 -196
  44. package/dist/extras.d.cts +2 -2
  45. package/dist/extras.d.ts +2 -2
  46. package/dist/extras.js +27 -24
  47. package/dist/index.cjs +214 -136
  48. package/dist/index.d.cts +15 -2
  49. package/dist/index.d.ts +15 -2
  50. package/dist/index.js +15 -13
  51. package/dist/{introspect-BZWKvQUZ.d.ts → introspect-DOZfmC-4.d.ts} +1 -1
  52. package/dist/{introspect-DsJlDD2T.d.cts → introspect-RjLfIFpL.d.cts} +1 -1
  53. package/dist/motion.cjs +10 -0
  54. package/dist/motion.js +3 -3
  55. package/dist/patterns.cjs +45 -40
  56. package/dist/patterns.js +8 -7
  57. package/dist/performance.cjs +101 -25
  58. package/dist/performance.d.cts +2 -2
  59. package/dist/performance.d.ts +2 -2
  60. package/dist/performance.js +8 -7
  61. package/dist/plugins.cjs +234 -160
  62. package/dist/plugins.d.cts +1 -1
  63. package/dist/plugins.d.ts +1 -1
  64. package/dist/plugins.js +127 -69
  65. package/dist/{ssr-FXD2PPMC.js → ssr-2QDQ27EV.js} +5 -3
  66. package/dist/{ssr-CrVNy6Pa.d.cts → ssr-D62yFwuw.d.cts} +8 -1
  67. package/dist/{ssr-CrVNy6Pa.d.ts → ssr-D62yFwuw.d.ts} +8 -1
  68. package/dist/ssr.cjs +145 -66
  69. package/dist/ssr.d.cts +1 -1
  70. package/dist/ssr.d.ts +1 -1
  71. package/dist/ssr.js +12 -10
  72. package/dist/testing.cjs +9 -4
  73. package/dist/testing.js +3 -3
  74. package/dist/ui.cjs +54 -38
  75. package/dist/ui.js +10 -9
  76. package/dist/widgets.cjs +40 -24
  77. package/dist/widgets.js +8 -8
  78. package/package.json +3 -1
@@ -1,22 +1,22 @@
1
1
  import {
2
2
  bindAttribute
3
- } from "./chunk-2ZJ7TSW4.js";
3
+ } from "./chunk-RLUJL2MV.js";
4
4
  import {
5
5
  derived
6
- } from "./chunk-SC437AMI.js";
6
+ } from "./chunk-JYXOEYI4.js";
7
7
  import {
8
8
  dispose,
9
9
  registerDisposer
10
10
  } from "./chunk-2UPRY23K.js";
11
11
  import {
12
12
  effect
13
- } from "./chunk-ZIBE2SAT.js";
13
+ } from "./chunk-FDY42FIU.js";
14
14
  import {
15
15
  signal
16
- } from "./chunk-RK4BQG25.js";
16
+ } from "./chunk-C427DVQF.js";
17
17
  import {
18
18
  track
19
- } from "./chunk-3U4ZVXVD.js";
19
+ } from "./chunk-Z2FWAE4B.js";
20
20
 
21
21
  // src/ui/form.ts
22
22
  function required(message = "This field is required") {
@@ -245,7 +245,10 @@ function VirtualList(props) {
245
245
  const visibleCount = Math.ceil(props.containerHeight / props.itemHeight) + 2 * overscan;
246
246
  const endIndex = Math.min(items.length, startIndex + visibleCount);
247
247
  content.style.top = `${startIndex * props.itemHeight}px`;
248
- content.innerHTML = "";
248
+ while (content.firstChild) {
249
+ dispose(content.firstChild);
250
+ content.removeChild(content.firstChild);
251
+ }
249
252
  for (let i = startIndex; i < endIndex; i++) {
250
253
  const itemEl = props.renderItem(items[i], i);
251
254
  itemEl.style.height = `${props.itemHeight}px`;
@@ -253,7 +256,7 @@ function VirtualList(props) {
253
256
  content.appendChild(itemEl);
254
257
  }
255
258
  };
256
- effect(update);
259
+ registerDisposer(container, effect(update));
257
260
  return container;
258
261
  }
259
262
 
@@ -394,7 +397,10 @@ function inputMask(options) {
394
397
  }
395
398
  }
396
399
  }
397
- input.setSelectionRange(newCursor, newCursor);
400
+ try {
401
+ input.setSelectionRange(newCursor, newCursor);
402
+ } catch {
403
+ }
398
404
  };
399
405
  const onFocus = () => {
400
406
  if (!input.value) {
@@ -436,9 +442,12 @@ function aria(element, attrs) {
436
442
  const ariaKey = key.startsWith("aria-") ? key : `aria-${key}`;
437
443
  if (typeof value === "function") {
438
444
  const getter = value;
439
- track(() => {
440
- element.setAttribute(ariaKey, String(getter()));
441
- });
445
+ registerDisposer(
446
+ element,
447
+ track(() => {
448
+ element.setAttribute(ariaKey, String(getter()));
449
+ })
450
+ );
442
451
  } else {
443
452
  element.setAttribute(ariaKey, String(value));
444
453
  }
@@ -1,17 +1,19 @@
1
1
  import {
2
2
  div,
3
3
  span
4
- } from "./chunk-2HAGQWDV.js";
4
+ } from "./chunk-5N74TKLD.js";
5
5
  import {
6
- sanitizeUrl
7
- } from "./chunk-UCS6AMJ7.js";
6
+ isEventHandlerAttr,
7
+ sanitizeUrl,
8
+ stripControlChars
9
+ } from "./chunk-HMJFCBRR.js";
8
10
  import {
9
11
  effect
10
- } from "./chunk-ZIBE2SAT.js";
12
+ } from "./chunk-FDY42FIU.js";
11
13
  import {
12
14
  batch,
13
15
  signal
14
- } from "./chunk-RK4BQG25.js";
16
+ } from "./chunk-C427DVQF.js";
15
17
 
16
18
  // src/platform/head.ts
17
19
  var HEAD_URL_ATTRS = /* @__PURE__ */ new Set(["href", "src"]);
@@ -19,21 +21,25 @@ function sanitizeHeadAttr(key, value) {
19
21
  if (HEAD_URL_ATTRS.has(key)) return sanitizeUrl(value);
20
22
  return value;
21
23
  }
24
+ function isDangerousRefreshContent(content) {
25
+ const normalized = stripControlChars(content).toLowerCase();
26
+ return normalized.includes("url=javascript:") || normalized.includes("url=data:") || normalized.includes("url=vbscript:") || normalized.includes("url=blob:");
27
+ }
28
+ function getMetaAttr(metaProps, name) {
29
+ for (const k in metaProps) {
30
+ if (k.toLowerCase() === name) return metaProps[k];
31
+ }
32
+ return void 0;
33
+ }
22
34
  function isDangerousMetaRefresh(metaProps) {
23
- const httpEquiv = metaProps["http-equiv"];
35
+ const httpEquiv = getMetaAttr(metaProps, "http-equiv");
24
36
  if (typeof httpEquiv !== "string") return false;
25
37
  if (httpEquiv.toLowerCase() !== "refresh") return false;
26
- const content = metaProps.content;
38
+ const content = getMetaAttr(metaProps, "content");
27
39
  if (typeof content !== "string") return false;
28
- const normalized = content.replace(/[\x00-\x20\x7f-\x9f]+/g, "").toLowerCase();
29
- return normalized.includes("url=javascript:") || normalized.includes("url=data:") || normalized.includes("url=vbscript:") || normalized.includes("url=blob:");
40
+ return isDangerousRefreshContent(content);
30
41
  }
31
42
  var SAFE_HEAD_ATTR_NAME = /^[A-Za-z_:][-A-Za-z0-9_.:]*$/;
32
- function isEventHandlerAttr(name) {
33
- if (name.length < 3) return false;
34
- const lower = name.toLowerCase();
35
- return lower[0] === "o" && lower[1] === "n" && lower.charCodeAt(2) >= 97 && lower.charCodeAt(2) <= 122;
36
- }
37
43
  function isSafeHeadAttr(name) {
38
44
  if (!SAFE_HEAD_ATTR_NAME.test(name)) return false;
39
45
  if (isEventHandlerAttr(name)) return false;
@@ -69,15 +75,27 @@ function Head(props) {
69
75
  if (props.meta) {
70
76
  for (const metaProps of props.meta) {
71
77
  if (isDangerousMetaRefresh(metaProps)) continue;
78
+ const httpEquiv = getMetaAttr(metaProps, "http-equiv");
79
+ const isRefreshNow = () => {
80
+ const eq = typeof httpEquiv === "function" ? httpEquiv() : httpEquiv;
81
+ return typeof eq === "string" && eq.toLowerCase() === "refresh";
82
+ };
72
83
  const el = document.createElement("meta");
73
84
  for (const [key, value] of Object.entries(metaProps)) {
74
85
  if (!isSafeHeadAttr(key)) continue;
86
+ const isContent = key.toLowerCase() === "content";
75
87
  if (typeof value === "function") {
76
88
  const cleanupFn = effect(() => {
77
- el.setAttribute(key, sanitizeHeadAttr(key, value()));
89
+ const resolved = value();
90
+ if (isContent && isRefreshNow() && isDangerousRefreshContent(resolved)) {
91
+ el.removeAttribute(key);
92
+ return;
93
+ }
94
+ el.setAttribute(key, sanitizeHeadAttr(key, resolved));
78
95
  });
79
96
  effectCleanups.push(cleanupFn);
80
97
  } else {
98
+ if (isContent && isRefreshNow() && isDangerousRefreshContent(value)) continue;
81
99
  el.setAttribute(key, sanitizeHeadAttr(key, value));
82
100
  }
83
101
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  renderToString
3
- } from "./chunk-JYD2PWXH.js";
3
+ } from "./chunk-HXMS4SNP.js";
4
4
 
5
5
  // src/plugins/modular.ts
6
6
  function createModuleRegistry() {
@@ -1,10 +1,11 @@
1
1
  import {
2
+ isEventHandlerAttr,
2
3
  isUrlAttribute,
3
4
  sanitizeUrl
4
- } from "./chunk-UCS6AMJ7.js";
5
+ } from "./chunk-HMJFCBRR.js";
5
6
  import {
6
7
  reactiveBinding
7
- } from "./chunk-3U4ZVXVD.js";
8
+ } from "./chunk-Z2FWAE4B.js";
8
9
  import {
9
10
  devWarn,
10
11
  isDev
@@ -15,11 +16,6 @@ var _isDev = isDev();
15
16
  function setProp(el, key, val) {
16
17
  el[key] = val;
17
18
  }
18
- function isEventHandlerAttr(name) {
19
- if (name.length < 3) return false;
20
- const lower = name.toLowerCase();
21
- return lower[0] === "o" && lower[1] === "n" && lower.charCodeAt(2) >= 97 && lower.charCodeAt(2) <= 122;
22
- }
23
19
  function bindAttribute(el, attr, getter) {
24
20
  if (isEventHandlerAttr(attr)) {
25
21
  if (_isDev)
@@ -74,7 +70,7 @@ function bindDynamic(el, nameGetter, valueGetter) {
74
70
  if (_isDev) devWarn(`bindDynamic: value getter threw: ${err instanceof Error ? err.message : String(err)}`);
75
71
  return;
76
72
  }
77
- if ((name[0] === "o" || name[0] === "O") && (name[1] === "n" || name[1] === "N")) return;
73
+ if (isEventHandlerAttr(name)) return;
78
74
  if (prevName !== null && prevName !== name) {
79
75
  el.removeAttribute(prevName);
80
76
  }
@@ -139,56 +139,58 @@ import {
139
139
  use,
140
140
  var_,
141
141
  video
142
- } from "./chunk-2HAGQWDV.js";
142
+ } from "./chunk-5N74TKLD.js";
143
143
  import {
144
144
  watch
145
- } from "./chunk-3DJH25UO.js";
145
+ } from "./chunk-H6PCHJZQ.js";
146
146
  import {
147
147
  trustHTML
148
- } from "./chunk-JYD2PWXH.js";
148
+ } from "./chunk-HXMS4SNP.js";
149
149
  import {
150
150
  context
151
- } from "./chunk-EFOAE5NC.js";
151
+ } from "./chunk-YFDGQWDA.js";
152
152
  import {
153
153
  SVG_NS,
154
154
  bindChildNode,
155
155
  tagFactory
156
- } from "./chunk-WKUXSE7V.js";
156
+ } from "./chunk-X67UYC74.js";
157
157
  import {
158
158
  bindAttribute,
159
159
  bindDynamic
160
- } from "./chunk-2ZJ7TSW4.js";
160
+ } from "./chunk-RLUJL2MV.js";
161
161
  import {
162
162
  derived
163
- } from "./chunk-SC437AMI.js";
163
+ } from "./chunk-JYXOEYI4.js";
164
164
  import {
165
165
  checkLeaks,
166
166
  dispose,
167
167
  registerDisposer
168
168
  } from "./chunk-2UPRY23K.js";
169
169
  import {
170
+ isEventHandlerAttr,
170
171
  isUrlAttribute,
171
172
  sanitizeSrcset,
172
173
  sanitizeUrl
173
- } from "./chunk-UCS6AMJ7.js";
174
+ } from "./chunk-HMJFCBRR.js";
174
175
  import {
175
176
  effect,
176
177
  on
177
- } from "./chunk-ZIBE2SAT.js";
178
+ } from "./chunk-FDY42FIU.js";
178
179
  import {
179
180
  disableSSR,
180
181
  enableSSR,
182
+ getRequestScopedCache,
181
183
  getSSRStore,
182
184
  isSSR,
183
185
  runInSSRContext,
184
186
  withSSR
185
- } from "./chunk-2RA7SHDA.js";
187
+ } from "./chunk-GOJMFRBL.js";
186
188
  import {
187
189
  batch,
188
190
  enqueueBatchedSignal,
189
191
  isBatching,
190
192
  signal
191
- } from "./chunk-RK4BQG25.js";
193
+ } from "./chunk-C427DVQF.js";
192
194
  import {
193
195
  notifySubscribers,
194
196
  recordDependency,
@@ -196,7 +198,7 @@ import {
196
198
  setMaxDrainIterations,
197
199
  track,
198
200
  untracked
199
- } from "./chunk-3U4ZVXVD.js";
201
+ } from "./chunk-Z2FWAE4B.js";
200
202
  import {
201
203
  __export,
202
204
  devAssert,
@@ -286,6 +288,7 @@ __export(index_exports, {
286
288
  footer: () => footer,
287
289
  form: () => form,
288
290
  g: () => g,
291
+ getRequestScopedCache: () => getRequestScopedCache,
289
292
  getSSRStore: () => getSSRStore,
290
293
  getSlot: () => getSlot,
291
294
  h1: () => h1,
@@ -528,14 +531,28 @@ function parseTemplate(strings) {
528
531
  }
529
532
  return { kind: "mixed", statics, exprs };
530
533
  }
531
- const valStart = pos;
532
- while (pos < len) {
533
- const c = template2.charCodeAt(pos);
534
- if (c === 32 || c === 9 || c === 10 || c === 13 || c === 62 || c === 47) break;
535
- pos++;
534
+ {
535
+ const statics = [];
536
+ const exprs = [];
537
+ let current = "";
538
+ while (pos < len) {
539
+ const c = template2.charCodeAt(pos);
540
+ if (c === 32 || c === 9 || c === 10 || c === 13 || c === 62) break;
541
+ const innerIdx = tryExprIdx();
542
+ if (innerIdx >= 0) {
543
+ statics.push(current);
544
+ current = "";
545
+ exprs.push(innerIdx);
546
+ } else {
547
+ current += template2[pos++];
548
+ }
549
+ }
550
+ statics.push(current);
551
+ if (exprs.length === 0) {
552
+ return { kind: "static", value: statics[0] };
553
+ }
554
+ return { kind: "mixed", statics, exprs };
536
555
  }
537
- const val = template2.slice(valStart, pos);
538
- return { kind: "static", value: val };
539
556
  }
540
557
  function parseAttrs() {
541
558
  const attrs = [];
@@ -592,6 +609,30 @@ function parseTemplate(strings) {
592
609
  while (pos < len) {
593
610
  if (template2[pos] === "<" && pos + 1 < len && template2[pos + 1] === "/") break;
594
611
  if (template2[pos] === "<") {
612
+ const next = template2[pos + 1];
613
+ if (next === "!") {
614
+ if (template2.startsWith("<!--", pos)) {
615
+ const end = template2.indexOf("-->", pos + 4);
616
+ pos = end === -1 ? len : end + 3;
617
+ } else if (template2.startsWith("<![CDATA[", pos)) {
618
+ const end = template2.indexOf("]]>", pos + 9);
619
+ pos = end === -1 ? len : end + 3;
620
+ } else {
621
+ const end = template2.indexOf(">", pos);
622
+ pos = end === -1 ? len : end + 1;
623
+ }
624
+ continue;
625
+ }
626
+ if (next === "?") {
627
+ const end = template2.indexOf(">", pos);
628
+ pos = end === -1 ? len : end + 1;
629
+ continue;
630
+ }
631
+ if (!(next >= "a" && next <= "z") && !(next >= "A" && next <= "Z")) {
632
+ children.push({ t: 1, value: "<" });
633
+ pos++;
634
+ continue;
635
+ }
595
636
  pos++;
596
637
  const tag = readTagName();
597
638
  const attrs = parseAttrs();
@@ -640,7 +681,7 @@ function executeElement(tmpl, values) {
640
681
  case 1: {
641
682
  const name = attr.name;
642
683
  const lname = name.toLowerCase();
643
- if (lname[0] === "o" && lname[1] === "n") break;
684
+ if (isEventHandlerAttr(name)) break;
644
685
  const val = values[attr.idx];
645
686
  if (typeof val === "function") {
646
687
  registerDisposer(el, bindAttribute(el, name, val));
@@ -889,6 +930,11 @@ function each(getArray, render, options) {
889
930
  workMap.clear();
890
931
  keyIndexMap.clear();
891
932
  for (let i2 = 0; i2 < newLen; i2++) {
933
+ if (_isDev2 && keyIndexMap.has(newKeys[i2])) {
934
+ devWarn(
935
+ `each: duplicate key "${String(newKeys[i2])}" at index ${i2} (first seen at ${keyIndexMap.get(newKeys[i2])}). Keys must be unique \u2014 duplicates cause rows to be dropped or mis-ordered.`
936
+ );
937
+ }
892
938
  keyIndexMap.set(newKeys[i2], i2);
893
939
  }
894
940
  for (let i2 = 0; i2 < newLen; i2++) {
@@ -1120,7 +1166,7 @@ function show(condition, element) {
1120
1166
  const update = () => {
1121
1167
  element.style.display = condition() ? "" : "none";
1122
1168
  };
1123
- track(update);
1169
+ registerDisposer(element, track(update));
1124
1170
  return element;
1125
1171
  }
1126
1172
  function when(condition, thenBranch, elseBranch) {
@@ -1147,7 +1193,7 @@ function when(condition, thenBranch, elseBranch) {
1147
1193
  }
1148
1194
  initialized = true;
1149
1195
  };
1150
- track(update);
1196
+ registerDisposer(anchor, track(update));
1151
1197
  if (!initialized) {
1152
1198
  queueMicrotask(() => {
1153
1199
  if (!initialized && anchor.parentNode) update();
@@ -1182,7 +1228,7 @@ function match(value, cases, fallback) {
1182
1228
  }
1183
1229
  initialized = true;
1184
1230
  };
1185
- track(update);
1231
+ registerDisposer(anchor, track(update));
1186
1232
  if (!initialized) {
1187
1233
  queueMicrotask(() => {
1188
1234
  if (!initialized && anchor.parentNode) update();
@@ -1223,6 +1269,12 @@ function KeepAlive(activeKey, cases, options) {
1223
1269
  return;
1224
1270
  }
1225
1271
  node = factory();
1272
+ if (node instanceof DocumentFragment) {
1273
+ const wrapper = document.createElement("div");
1274
+ wrapper.style.display = "contents";
1275
+ wrapper.appendChild(node);
1276
+ node = wrapper;
1277
+ }
1226
1278
  cache2.set(key, node);
1227
1279
  lruOrder.push(key);
1228
1280
  if (max > 0 && lruOrder.length > max) {
@@ -1402,12 +1454,12 @@ function store(initialState) {
1402
1454
  signals[key] = [getter, setter];
1403
1455
  });
1404
1456
  const store2 = new Proxy({}, {
1405
- get(_, prop) {
1406
- if (prop in signals) {
1457
+ get(target, prop) {
1458
+ if (typeof prop === "string" && Object.hasOwn(signals, prop)) {
1407
1459
  const getter = signals[prop][0];
1408
1460
  return getter();
1409
1461
  }
1410
- return void 0;
1462
+ return Reflect.get(target, prop);
1411
1463
  },
1412
1464
  set() {
1413
1465
  throw new Error(
@@ -1427,7 +1479,7 @@ function store(initialState) {
1427
1479
  const nextState = typeof patch === "function" ? patch(current) : patch;
1428
1480
  batch(() => {
1429
1481
  Object.entries(nextState).forEach(([key, value]) => {
1430
- if (key in signals) {
1482
+ if (Object.hasOwn(signals, key)) {
1431
1483
  signals[key][1](value);
1432
1484
  }
1433
1485
  });
@@ -1725,6 +1777,14 @@ function deepEqual(a2, b2, seen) {
1725
1777
  }
1726
1778
  return true;
1727
1779
  }
1780
+ if (a2 instanceof DataView) {
1781
+ if (!(b2 instanceof DataView)) return false;
1782
+ if (a2.byteLength !== b2.byteLength) return false;
1783
+ for (let i2 = 0; i2 < a2.byteLength; i2++) {
1784
+ if (a2.getUint8(i2) !== b2.getUint8(i2)) return false;
1785
+ }
1786
+ return true;
1787
+ }
1728
1788
  if (ArrayBuffer.isView(a2) && ArrayBuffer.isView(b2)) {
1729
1789
  const ta = a2;
1730
1790
  const tb = b2;
@@ -1743,7 +1803,7 @@ function deepEqual(a2, b2, seen) {
1743
1803
  const keysB = Object.keys(objB);
1744
1804
  if (keysA.length !== keysB.length) return false;
1745
1805
  return keysA.every(
1746
- (key) => deepEqual(objA[key], objB[key], seen)
1806
+ (key) => Object.hasOwn(objB, key) && deepEqual(objA[key], objB[key], seen)
1747
1807
  );
1748
1808
  }
1749
1809
  function deepSignal(initial) {
@@ -2215,34 +2275,37 @@ function Suspense({ nodes, fallback }) {
2215
2275
  container.appendChild(fallbackEl);
2216
2276
  let suspenseDisposed = false;
2217
2277
  let observer = null;
2278
+ let childEl = null;
2218
2279
  registerDisposer(container, () => {
2219
2280
  suspenseDisposed = true;
2220
2281
  if (observer) {
2221
2282
  observer.disconnect();
2222
2283
  observer = null;
2223
2284
  }
2285
+ if (childEl && !container.contains(childEl)) dispose(childEl);
2224
2286
  });
2225
2287
  queueMicrotask(() => {
2226
2288
  if (suspenseDisposed) return;
2227
2289
  try {
2228
- const childEl = nodes();
2229
- if (childEl.classList.contains("sibu-lazy")) {
2230
- if (!childEl.querySelector(".sibu-lazy-loading")) {
2231
- container.replaceChildren(childEl);
2290
+ const el = nodes();
2291
+ childEl = el;
2292
+ if (el.classList.contains("sibu-lazy")) {
2293
+ if (!el.querySelector(".sibu-lazy-loading")) {
2294
+ container.replaceChildren(el);
2232
2295
  return;
2233
2296
  }
2234
2297
  observer = new MutationObserver(() => {
2235
2298
  if (suspenseDisposed) return;
2236
- const loading = childEl.querySelector(".sibu-lazy-loading");
2299
+ const loading = el.querySelector(".sibu-lazy-loading");
2237
2300
  if (!loading) {
2238
2301
  observer?.disconnect();
2239
2302
  observer = null;
2240
- container.replaceChildren(childEl);
2303
+ container.replaceChildren(el);
2241
2304
  }
2242
2305
  });
2243
- observer.observe(childEl, { childList: true, subtree: true });
2306
+ observer.observe(el, { childList: true, subtree: true });
2244
2307
  } else {
2245
- container.replaceChildren(childEl);
2308
+ container.replaceChildren(el);
2246
2309
  }
2247
2310
  } catch (err) {
2248
2311
  const errorObj = err instanceof Error ? err : new Error(String(err));
@@ -33,7 +33,7 @@ function withBoundary(name, component) {
33
33
  function createSlots(slots) {
34
34
  return {
35
35
  renderSlot(name, fallback) {
36
- const slotFn = slots[name];
36
+ const slotFn = Object.hasOwn(slots, name) ? slots[name] : void 0;
37
37
  if (slotFn) {
38
38
  const result = slotFn();
39
39
  if (Array.isArray(result)) {
@@ -47,7 +47,7 @@ function createSlots(slots) {
47
47
  return fallback ? fallback() : null;
48
48
  },
49
49
  hasSlot(name) {
50
- return name in slots;
50
+ return Object.hasOwn(slots, name);
51
51
  }
52
52
  };
53
53
  }