sibujs 4.12.0 → 4.13.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 (74) hide show
  1. package/dist/browser.cjs +71 -18
  2. package/dist/browser.js +4 -4
  3. package/dist/build.cjs +6618 -6178
  4. package/dist/build.d.cts +554 -415
  5. package/dist/build.d.ts +554 -415
  6. package/dist/build.js +2091 -1735
  7. package/dist/cdn.dev.global.js +12 -12
  8. package/dist/cdn.full.dev.global.js +13 -13
  9. package/dist/cdn.full.global.js +12 -12
  10. package/dist/cdn.global.js +12 -12
  11. package/dist/{chunk-WFRQ6D7H.js → chunk-22OPSWMF.js} +1 -1
  12. package/dist/{chunk-ZJCHY2IB.js → chunk-2NC56RGY.js} +1 -1
  13. package/dist/{chunk-NB7TFSJE.js → chunk-2O6JJCUR.js} +4 -4
  14. package/dist/{chunk-B2Y5BJSP.js → chunk-4UTGDVSA.js} +70 -16
  15. package/dist/{chunk-NAVLCP4S.js → chunk-5RIBLY2N.js} +4 -4
  16. package/dist/{chunk-T5O2CUHV.js → chunk-5XUGJM3J.js} +1 -1
  17. package/dist/{chunk-HXT2RNH5.js → chunk-ADZHPN2B.js} +1 -1
  18. package/dist/chunk-B36ADEIR.js +21 -0
  19. package/dist/{chunk-DFZL3AX7.js → chunk-C73VBPEF.js} +9 -5
  20. package/dist/{chunk-WH4U2VUE.js → chunk-CPQKWCJ2.js} +13 -5
  21. package/dist/{chunk-LEUEKK4G.js → chunk-EU7T7EB3.js} +2 -2
  22. package/dist/{chunk-QLG5IK7F.js → chunk-G3Z2FEBR.js} +4 -4
  23. package/dist/{chunk-ZPY2UAKM.js → chunk-J4X7ICH4.js} +3 -3
  24. package/dist/{chunk-XX4BRMWF.js → chunk-K4LNUT5L.js} +1 -1
  25. package/dist/{chunk-CI4W6XAU.js → chunk-KC62VURU.js} +3 -3
  26. package/dist/chunk-N5TBYXHW.js +17 -0
  27. package/dist/{chunk-653KGQS2.js → chunk-OIKD7YDY.js} +2 -2
  28. package/dist/{chunk-LYTUTXQP.js → chunk-PBJYCE2Z.js} +46 -4
  29. package/dist/{chunk-EMB5PG7V.js → chunk-QC3NP47A.js} +1 -1
  30. package/dist/{chunk-IHA62NGJ.js → chunk-QKFVMIAV.js} +1 -1
  31. package/dist/{chunk-LXBMVGVB.js → chunk-QZ47OZ25.js} +3 -3
  32. package/dist/{chunk-ZTYCCBU3.js → chunk-VFPLWUT7.js} +44 -26
  33. package/dist/{chunk-RK7EPQPG.js → chunk-YFTBCCVH.js} +1 -1
  34. package/dist/data.cjs +71 -18
  35. package/dist/data.js +5 -5
  36. package/dist/datePicker-DxuxWpgF.d.cts +285 -0
  37. package/dist/datePicker-DxuxWpgF.d.ts +285 -0
  38. package/dist/devtools.cjs +71 -18
  39. package/dist/devtools.js +4 -4
  40. package/dist/ecosystem.cjs +82 -21
  41. package/dist/ecosystem.js +7 -7
  42. package/dist/extras.cjs +131 -23
  43. package/dist/extras.d.cts +2 -2
  44. package/dist/extras.d.ts +2 -2
  45. package/dist/extras.js +21 -20
  46. package/dist/index.cjs +115 -37
  47. package/dist/index.d.cts +59 -5
  48. package/dist/index.d.ts +59 -5
  49. package/dist/index.js +10 -10
  50. package/dist/motion.cjs +69 -16
  51. package/dist/motion.js +3 -3
  52. package/dist/patterns.cjs +71 -18
  53. package/dist/patterns.js +5 -5
  54. package/dist/performance.cjs +69 -16
  55. package/dist/performance.js +4 -4
  56. package/dist/plugins.cjs +1421 -996
  57. package/dist/plugins.d.cts +132 -3
  58. package/dist/plugins.d.ts +132 -3
  59. package/dist/plugins.js +262 -11
  60. package/dist/routeMiddleware-B1sp4P7a.d.ts +688 -0
  61. package/dist/routeMiddleware-CedQTsLK.d.cts +688 -0
  62. package/dist/ssr.cjs +3607 -3524
  63. package/dist/ssr.d.cts +20 -671
  64. package/dist/ssr.d.ts +20 -671
  65. package/dist/ssr.js +15 -7
  66. package/dist/testing.cjs +71 -18
  67. package/dist/testing.js +2 -2
  68. package/dist/ui.cjs +78 -18
  69. package/dist/ui.js +8 -7
  70. package/dist/widgets.cjs +1352 -952
  71. package/dist/widgets.d.cts +100 -268
  72. package/dist/widgets.d.ts +100 -268
  73. package/dist/widgets.js +316 -7
  74. package/package.json +9 -1
@@ -1,21 +1,25 @@
1
+ import {
2
+ claimWidgetKey,
3
+ isWidgetKeyEvent
4
+ } from "./chunk-N5TBYXHW.js";
1
5
  import {
2
6
  watch
3
- } from "./chunk-HXT2RNH5.js";
7
+ } from "./chunk-ADZHPN2B.js";
4
8
  import {
5
9
  createId,
6
10
  domBinding,
7
11
  idSegment
8
- } from "./chunk-WFRQ6D7H.js";
12
+ } from "./chunk-22OPSWMF.js";
9
13
  import {
10
14
  derived
11
- } from "./chunk-RK7EPQPG.js";
15
+ } from "./chunk-YFTBCCVH.js";
12
16
  import {
13
17
  stripHtml
14
18
  } from "./chunk-EXXSN3BW.js";
15
19
  import {
16
20
  batch,
17
21
  signal
18
- } from "./chunk-IHA62NGJ.js";
22
+ } from "./chunk-QKFVMIAV.js";
19
23
 
20
24
  // src/widgets/Combobox.ts
21
25
  var boundComboboxes = /* @__PURE__ */ new WeakMap();
@@ -114,27 +118,34 @@ function combobox(options) {
114
118
  open();
115
119
  };
116
120
  const onKey = (e) => {
121
+ if (isWidgetKeyEvent(e)) return;
117
122
  if (e.key === "ArrowDown") {
118
123
  e.preventDefault();
124
+ claimWidgetKey(e, "combobox");
119
125
  if (!isOpen()) open();
120
126
  highlightNext();
121
127
  } else if (e.key === "ArrowUp") {
122
128
  e.preventDefault();
129
+ claimWidgetKey(e, "combobox");
123
130
  if (!isOpen()) open();
124
131
  highlightPrev();
125
132
  } else if (e.key === "Enter") {
126
133
  if (highlightedIndex() >= 0) {
127
134
  e.preventDefault();
135
+ claimWidgetKey(e, "combobox");
128
136
  selectHighlighted();
129
137
  }
130
138
  } else if (e.key === "Escape") {
131
139
  e.preventDefault();
140
+ claimWidgetKey(e, "combobox");
132
141
  close();
133
142
  } else if (e.key === "Home") {
134
143
  e.preventDefault();
144
+ claimWidgetKey(e, "combobox");
135
145
  if (filteredItems().length > 0) setHighlightedIndex(0);
136
146
  } else if (e.key === "End") {
137
147
  e.preventDefault();
148
+ claimWidgetKey(e, "combobox");
138
149
  const len = filteredItems().length;
139
150
  if (len > 0) setHighlightedIndex(len - 1);
140
151
  }
@@ -303,16 +314,20 @@ function tabs(options) {
303
314
  }
304
315
  }, els.tablist);
305
316
  const onKey = (e) => {
317
+ if (isWidgetKeyEvent(e)) return;
306
318
  if (e.key === "ArrowRight" || e.key === "ArrowDown") {
307
319
  e.preventDefault();
320
+ claimWidgetKey(e, "tabs");
308
321
  nextTab();
309
322
  els.tabs[activeTab()]?.focus();
310
323
  } else if (e.key === "ArrowLeft" || e.key === "ArrowUp") {
311
324
  e.preventDefault();
325
+ claimWidgetKey(e, "tabs");
312
326
  prevTab();
313
327
  els.tabs[activeTab()]?.focus();
314
328
  } else if (e.key === "Home") {
315
329
  e.preventDefault();
330
+ claimWidgetKey(e, "tabs");
316
331
  const first = tabDefs.find((t) => !t.disabled);
317
332
  if (first) {
318
333
  setActiveTabState(first.id);
@@ -320,6 +335,7 @@ function tabs(options) {
320
335
  }
321
336
  } else if (e.key === "End") {
322
337
  e.preventDefault();
338
+ claimWidgetKey(e, "tabs");
323
339
  for (let i = tabDefs.length - 1; i >= 0; i--) {
324
340
  if (!tabDefs[i].disabled) {
325
341
  setActiveTabState(tabDefs[i].id);
@@ -453,8 +469,10 @@ function accordion(options) {
453
469
  if (!trig) continue;
454
470
  const click = () => toggle(item.id);
455
471
  const key = (e) => {
472
+ if (isWidgetKeyEvent(e)) return;
456
473
  if (e.key === "Enter" || e.key === " ") {
457
474
  e.preventDefault();
475
+ claimWidgetKey(e, "accordion");
458
476
  toggle(item.id);
459
477
  }
460
478
  };
@@ -534,8 +552,10 @@ function popover() {
534
552
  toggle();
535
553
  };
536
554
  const onKey = (e) => {
555
+ if (isWidgetKeyEvent(e)) return;
537
556
  if (e.key === "Escape" && isOpen()) {
538
557
  e.stopPropagation();
558
+ claimWidgetKey(e, "popover");
539
559
  close();
540
560
  els.trigger.focus();
541
561
  }
@@ -694,26 +714,33 @@ function select(options) {
694
714
  let typeBuffer = "";
695
715
  let typeTimer = null;
696
716
  const onKey = (e) => {
717
+ if (isWidgetKeyEvent(e)) return;
697
718
  if (e.key === "ArrowDown") {
698
719
  e.preventDefault();
720
+ claimWidgetKey(e, "select");
699
721
  highlightNext();
700
722
  } else if (e.key === "ArrowUp") {
701
723
  e.preventDefault();
724
+ claimWidgetKey(e, "select");
702
725
  highlightPrev();
703
726
  } else if (e.key === "Home") {
704
727
  e.preventDefault();
728
+ claimWidgetKey(e, "select");
705
729
  const first = nextEnabled(-1, 1);
706
730
  if (first !== -1) setHighlightedIndex(first);
707
731
  } else if (e.key === "End") {
708
732
  e.preventDefault();
733
+ claimWidgetKey(e, "select");
709
734
  const last = nextEnabled(items.length, -1);
710
735
  if (last !== -1) setHighlightedIndex(last);
711
736
  } else if (e.key === "Enter" || e.key === " ") {
712
737
  if (highlightedIndex() >= 0) {
713
738
  e.preventDefault();
739
+ claimWidgetKey(e, "select");
714
740
  selectHighlighted();
715
741
  }
716
742
  } else if (e.key.length === 1 && /\S/.test(e.key)) {
743
+ claimWidgetKey(e, "select");
717
744
  typeBuffer += e.key.toLowerCase();
718
745
  if (typeTimer !== null) clearTimeout(typeTimer);
719
746
  typeTimer = setTimeout(() => {
@@ -830,8 +857,10 @@ function tooltip(options) {
830
857
  const onFocus = () => show();
831
858
  const onBlur = () => hide();
832
859
  const onKey = (e) => {
860
+ if (isWidgetKeyEvent(e)) return;
833
861
  if (e.key === "Escape" && isVisible()) {
834
862
  e.stopPropagation();
863
+ claimWidgetKey(e, "tooltip");
835
864
  hide();
836
865
  }
837
866
  };
@@ -1017,8 +1046,10 @@ function fileUpload(options) {
1017
1046
  };
1018
1047
  const onDropClick = () => els.input.click();
1019
1048
  const onDropKey = (e) => {
1049
+ if (isWidgetKeyEvent(e)) return;
1020
1050
  if (e.key === "Enter" || e.key === " ") {
1021
1051
  e.preventDefault();
1052
+ claimWidgetKey(e, "fileUpload");
1022
1053
  els.input.click();
1023
1054
  }
1024
1055
  };
@@ -1346,48 +1377,58 @@ function datePicker(options) {
1346
1377
  setViewDate((prev) => new Date(prev.getFullYear(), prev.getMonth(), prev.getDate() + delta));
1347
1378
  }
1348
1379
  const onKey = (e) => {
1380
+ if (isWidgetKeyEvent(e)) return;
1349
1381
  if (e.key === "ArrowLeft" || e.key === "ArrowRight" || e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "Home" || e.key === "End" || e.key === "PageUp" || e.key === "PageDown") {
1350
1382
  pendingFocus = true;
1351
1383
  }
1352
1384
  switch (e.key) {
1353
1385
  case "ArrowLeft":
1354
1386
  e.preventDefault();
1387
+ claimWidgetKey(e, "datePicker");
1355
1388
  shiftDays(-1);
1356
1389
  break;
1357
1390
  case "ArrowRight":
1358
1391
  e.preventDefault();
1392
+ claimWidgetKey(e, "datePicker");
1359
1393
  shiftDays(1);
1360
1394
  break;
1361
1395
  case "ArrowUp":
1362
1396
  e.preventDefault();
1397
+ claimWidgetKey(e, "datePicker");
1363
1398
  shiftDays(-7);
1364
1399
  break;
1365
1400
  case "ArrowDown":
1366
1401
  e.preventDefault();
1402
+ claimWidgetKey(e, "datePicker");
1367
1403
  shiftDays(7);
1368
1404
  break;
1369
1405
  case "Home":
1370
1406
  e.preventDefault();
1407
+ claimWidgetKey(e, "datePicker");
1371
1408
  setViewDate((p) => new Date(p.getFullYear(), p.getMonth(), p.getDate() - p.getDay()));
1372
1409
  break;
1373
1410
  case "End": {
1374
1411
  e.preventDefault();
1412
+ claimWidgetKey(e, "datePicker");
1375
1413
  setViewDate((p) => new Date(p.getFullYear(), p.getMonth(), p.getDate() + (6 - p.getDay())));
1376
1414
  break;
1377
1415
  }
1378
1416
  case "PageUp":
1379
1417
  e.preventDefault();
1418
+ claimWidgetKey(e, "datePicker");
1380
1419
  if (e.shiftKey) prevYear();
1381
1420
  else prevMonth();
1382
1421
  break;
1383
1422
  case "PageDown":
1384
1423
  e.preventDefault();
1424
+ claimWidgetKey(e, "datePicker");
1385
1425
  if (e.shiftKey) nextYear();
1386
1426
  else nextMonth();
1387
1427
  break;
1388
1428
  case "Enter":
1389
1429
  case " ":
1390
1430
  e.preventDefault();
1431
+ claimWidgetKey(e, "datePicker");
1391
1432
  select2(viewDate());
1392
1433
  break;
1393
1434
  }
@@ -1416,6 +1457,7 @@ function datePicker(options) {
1416
1457
 
1417
1458
  export {
1418
1459
  combobox,
1460
+ snapshotAttributes,
1419
1461
  tabs,
1420
1462
  accordion,
1421
1463
  popover,
@@ -8,7 +8,7 @@ import {
8
8
  retrack,
9
9
  runWithOwnerScope,
10
10
  untracked
11
- } from "./chunk-B2Y5BJSP.js";
11
+ } from "./chunk-4UTGDVSA.js";
12
12
  import {
13
13
  devAssert,
14
14
  reportError
@@ -4,7 +4,7 @@ import {
4
4
  notifySubscribers,
5
5
  queueSignalNotification,
6
6
  recordDependency
7
- } from "./chunk-B2Y5BJSP.js";
7
+ } from "./chunk-4UTGDVSA.js";
8
8
  import {
9
9
  DEV
10
10
  } from "./chunk-NYNYSPK7.js";
@@ -4,14 +4,14 @@ import {
4
4
  } from "./chunk-62BDYGAG.js";
5
5
  import {
6
6
  derived
7
- } from "./chunk-RK7EPQPG.js";
7
+ } from "./chunk-YFTBCCVH.js";
8
8
  import {
9
9
  effect
10
- } from "./chunk-EMB5PG7V.js";
10
+ } from "./chunk-QC3NP47A.js";
11
11
  import {
12
12
  batch,
13
13
  signal
14
- } from "./chunk-IHA62NGJ.js";
14
+ } from "./chunk-QKFVMIAV.js";
15
15
  import {
16
16
  DEV,
17
17
  devWarn,
@@ -135,45 +135,45 @@ import {
135
135
  use,
136
136
  var_,
137
137
  video
138
- } from "./chunk-T5O2CUHV.js";
138
+ } from "./chunk-5XUGJM3J.js";
139
139
  import {
140
140
  trustHTML
141
141
  } from "./chunk-2F4PSJ5Z.js";
142
142
  import {
143
143
  watch
144
- } from "./chunk-HXT2RNH5.js";
144
+ } from "./chunk-ADZHPN2B.js";
145
145
  import {
146
146
  __resetIdCounter,
147
147
  createId,
148
148
  domBinding
149
- } from "./chunk-WFRQ6D7H.js";
149
+ } from "./chunk-22OPSWMF.js";
150
150
  import {
151
151
  SVG_NS,
152
152
  bindChildNode,
153
153
  captureFocusWithin,
154
154
  restoreFocusWithin,
155
155
  tagFactory
156
- } from "./chunk-WH4U2VUE.js";
156
+ } from "./chunk-CPQKWCJ2.js";
157
157
  import {
158
158
  bindAttribute,
159
159
  bindDynamic,
160
160
  requireDocument,
161
161
  setSafeAttribute,
162
162
  setTrustedAttribute
163
- } from "./chunk-XX4BRMWF.js";
163
+ } from "./chunk-K4LNUT5L.js";
164
164
  import {
165
165
  isCodeTextElement
166
166
  } from "./chunk-F2UWOZ6J.js";
167
167
  import {
168
168
  derived
169
- } from "./chunk-RK7EPQPG.js";
169
+ } from "./chunk-YFTBCCVH.js";
170
170
  import {
171
171
  globalSingleton
172
172
  } from "./chunk-7ZHH77QA.js";
173
173
  import {
174
174
  effect,
175
175
  on
176
- } from "./chunk-EMB5PG7V.js";
176
+ } from "./chunk-QC3NP47A.js";
177
177
  import {
178
178
  disableSSR,
179
179
  enableSSR,
@@ -192,7 +192,7 @@ import {
192
192
  external,
193
193
  isBatching,
194
194
  signal
195
- } from "./chunk-IHA62NGJ.js";
195
+ } from "./chunk-QKFVMIAV.js";
196
196
  import {
197
197
  bindOwnerScope,
198
198
  emitDevtools,
@@ -204,10 +204,11 @@ import {
204
204
  retrack,
205
205
  runWithOwnerScope,
206
206
  setMaxDrainIterations,
207
+ structuralBinding,
207
208
  suspendTracking,
208
209
  track,
209
210
  untracked
210
- } from "./chunk-B2Y5BJSP.js";
211
+ } from "./chunk-4UTGDVSA.js";
211
212
  import {
212
213
  DEV,
213
214
  MAX_DRAIN_TEARDOWNS,
@@ -1850,6 +1851,9 @@ function show(condition, element) {
1850
1851
  registerDisposer(resolved, reactiveBinding(update, resolved));
1851
1852
  return resolved;
1852
1853
  }
1854
+ function isDirectiveOptions(value) {
1855
+ return typeof value === "object" && value !== null && !(value instanceof Node);
1856
+ }
1853
1857
  function attachBranch(parent, anchor, branch, attachedOnce, where) {
1854
1858
  const result = typeof branch === "function" ? branch() : branch;
1855
1859
  if (result == null || typeof result === "boolean") return { node: null, owned: false };
@@ -1870,8 +1874,14 @@ function releaseBranchNode(node, owned) {
1870
1874
  if (owned) dispose(node);
1871
1875
  node.parentNode?.removeChild(node);
1872
1876
  }
1873
- function when(condition, thenBranch, elseBranch) {
1877
+ function when(condition, thenBranch, elseBranch, options) {
1874
1878
  requireDocument();
1879
+ if (isDirectiveOptions(elseBranch)) {
1880
+ options = elseBranch;
1881
+ elseBranch = void 0;
1882
+ }
1883
+ const elseNode = elseBranch;
1884
+ const focusPolicy = options?.focus;
1875
1885
  const anchor = document.createComment("when");
1876
1886
  let currentNode = null;
1877
1887
  let lastCondition;
@@ -1891,31 +1901,37 @@ function when(condition, thenBranch, elseBranch) {
1891
1901
  releaseBranchNode(currentNode, currentNodeOwned);
1892
1902
  currentNode = null;
1893
1903
  }
1894
- const branch = show2 ? thenBranch : elseBranch !== void 0 ? elseBranch : null;
1904
+ const branch = show2 ? thenBranch : elseNode !== void 0 ? elseNode : null;
1895
1905
  const attached = untracked(() => attachBranch(parent, anchor, branch, attachedOnce, "when"));
1896
1906
  currentNode = attached.node;
1897
1907
  currentNodeOwned = attached.owned;
1898
- restoreFocusWithin(focused, currentNode ? [currentNode] : [], "when");
1908
+ restoreFocusWithin(focused, currentNode ? [currentNode] : [], "when", focusPolicy);
1899
1909
  initialized = true;
1900
1910
  };
1901
- const stopBinding = reactiveBinding(update, anchor);
1911
+ const binding = structuralBinding(update, anchor);
1902
1912
  registerDisposer(anchor, () => {
1903
1913
  disposed = true;
1904
- stopBinding();
1914
+ binding.stop();
1905
1915
  if (currentNode) releaseBranchNode(currentNode, currentNodeOwned);
1906
1916
  currentNode = null;
1907
1917
  });
1908
1918
  if (!initialized) {
1909
1919
  queueMicrotask(
1910
1920
  bindOwnerScope(() => {
1911
- if (!disposed && !initialized && anchor.parentNode) update();
1921
+ if (!disposed && !initialized && anchor.parentNode) binding.run(update);
1912
1922
  })
1913
1923
  );
1914
1924
  }
1915
1925
  return anchor;
1916
1926
  }
1917
- function match(value, cases, fallback) {
1927
+ function match(value, cases, fallback, options) {
1918
1928
  requireDocument();
1929
+ if (isDirectiveOptions(fallback)) {
1930
+ options = fallback;
1931
+ fallback = void 0;
1932
+ }
1933
+ const fallbackNode = fallback;
1934
+ const focusPolicy = options?.focus;
1919
1935
  const anchor = document.createComment("match");
1920
1936
  let currentNode = null;
1921
1937
  let lastKey;
@@ -1935,24 +1951,24 @@ function match(value, cases, fallback) {
1935
1951
  releaseBranchNode(currentNode, currentNodeOwned);
1936
1952
  currentNode = null;
1937
1953
  }
1938
- const branch = Object.hasOwn(cases, key) ? cases[key] : fallback;
1954
+ const branch = Object.hasOwn(cases, key) ? cases[key] : fallbackNode;
1939
1955
  const attached = untracked(() => attachBranch(parent, anchor, branch ?? null, attachedOnce, "match"));
1940
1956
  currentNode = attached.node;
1941
1957
  currentNodeOwned = attached.owned;
1942
- restoreFocusWithin(focused, currentNode ? [currentNode] : [], "match");
1958
+ restoreFocusWithin(focused, currentNode ? [currentNode] : [], "match", focusPolicy);
1943
1959
  initialized = true;
1944
1960
  };
1945
- const stopBinding = reactiveBinding(update, anchor);
1961
+ const binding = structuralBinding(update, anchor);
1946
1962
  registerDisposer(anchor, () => {
1947
1963
  disposed = true;
1948
- stopBinding();
1964
+ binding.stop();
1949
1965
  if (currentNode) releaseBranchNode(currentNode, currentNodeOwned);
1950
1966
  currentNode = null;
1951
1967
  });
1952
1968
  if (!initialized) {
1953
1969
  queueMicrotask(
1954
1970
  bindOwnerScope(() => {
1955
- if (!disposed && !initialized && anchor.parentNode) update();
1971
+ if (!disposed && !initialized && anchor.parentNode) binding.run(update);
1956
1972
  })
1957
1973
  );
1958
1974
  }
@@ -2002,7 +2018,7 @@ function DynamicComponent(is) {
2002
2018
  shown = next;
2003
2019
  replaceChildrenSafely(container, el);
2004
2020
  }
2005
- const untrack = track(render);
2021
+ const untrack = reactiveBinding(render, container, true);
2006
2022
  registerDisposer(container, untrack);
2007
2023
  return container;
2008
2024
  }
@@ -2224,7 +2240,8 @@ function each(getArray, render, options) {
2224
2240
  }
2225
2241
  });
2226
2242
  }
2227
- const untrack = track(update);
2243
+ const binding = structuralBinding(update);
2244
+ const untrack = binding.stop;
2228
2245
  const disposeRange = () => {
2229
2246
  if (rangeDisposed) return;
2230
2247
  rangeDisposed = true;
@@ -2250,7 +2267,7 @@ function each(getArray, render, options) {
2250
2267
  queueMicrotask(
2251
2268
  bindOwnerScope(() => {
2252
2269
  if (!initialized && !rangeDisposed && anchor.parentNode) {
2253
- update();
2270
+ binding.run(update);
2254
2271
  }
2255
2272
  })
2256
2273
  );
@@ -2732,11 +2749,12 @@ function KeepAlive(activeKey, cases, options) {
2732
2749
  currentNode = node;
2733
2750
  initialized = true;
2734
2751
  };
2735
- const untrack = track(update);
2752
+ const binding = structuralBinding(update);
2753
+ const untrack = binding.stop;
2736
2754
  if (!initialized) {
2737
2755
  queueMicrotask(
2738
2756
  bindOwnerScope(() => {
2739
- if (!initialized && anchor.parentNode) update();
2757
+ if (!initialized && anchor.parentNode) binding.run(update);
2740
2758
  })
2741
2759
  );
2742
2760
  }
@@ -5,7 +5,7 @@ import {
5
5
  recordDependency,
6
6
  retrack,
7
7
  track
8
- } from "./chunk-B2Y5BJSP.js";
8
+ } from "./chunk-4UTGDVSA.js";
9
9
  import {
10
10
  devAssert
11
11
  } from "./chunk-NYNYSPK7.js";
package/dist/data.cjs CHANGED
@@ -331,6 +331,7 @@ function bindOwnerScope(fn) {
331
331
  if (scope === null) return fn;
332
332
  return (...args) => runWithOwnerScope(scope, () => fn(...args));
333
333
  }
334
+ var currentStructOwner = null;
334
335
  var subscriberEpochCounter = 0;
335
336
  function retrack(effectFn, subscriber) {
336
337
  const prev = currentSubscriber;
@@ -350,6 +351,9 @@ function retrack(effectFn, subscriber) {
350
351
  if (prevScope !== null && !sub._epoch && sub._scope === void 0) sub._scope = prevScope;
351
352
  const scope = sub._scope === void 0 ? null : sub._scope;
352
353
  if (scope !== prevScope) currentOwnerScope = scope;
354
+ const prevStructOwner = currentStructOwner;
355
+ if (prevStructOwner !== null && !sub._epoch && !sub._c && sub._owner == null) sub._owner = prevStructOwner;
356
+ if (sub._tok != null) currentStructOwner = sub._tok;
353
357
  const epoch = ++subscriberEpochCounter;
354
358
  sub._epoch = epoch;
355
359
  sub._structDirty = false;
@@ -363,6 +367,7 @@ function retrack(effectFn, subscriber) {
363
367
  } finally {
364
368
  currentSubscriber = prev;
365
369
  currentOwnerScope = prevScope;
370
+ currentStructOwner = prevStructOwner;
366
371
  if (savedDepth !== 0) {
367
372
  suspendDepth = savedDepth;
368
373
  suspendSavedSub = savedSuspendSub;
@@ -419,7 +424,25 @@ function track(effectFn, subscriber) {
419
424
  }
420
425
  return sub._dispose ?? (sub._dispose = () => cleanup(subscriber));
421
426
  }
422
- function reactiveBinding(commit, ownerNode) {
427
+ function reactiveBinding(commit, ownerNode, structural) {
428
+ return createBinding(commit, ownerNode, structural === true)._dispose;
429
+ }
430
+ function structuralBinding(commit, ownerNode) {
431
+ const sub = createBinding(commit, ownerNode, true);
432
+ return {
433
+ stop: sub._dispose,
434
+ run: (fn) => {
435
+ const prev = currentStructOwner;
436
+ currentStructOwner = sub._tok ?? null;
437
+ try {
438
+ return fn();
439
+ } finally {
440
+ currentStructOwner = prev;
441
+ }
442
+ }
443
+ };
444
+ }
445
+ function createBinding(commit, ownerNode, structural) {
423
446
  const run = () => {
424
447
  const s = subscriber;
425
448
  if (s._disposed || s._reentrant) return;
@@ -442,19 +465,25 @@ function reactiveBinding(commit, ownerNode) {
442
465
  subscriber._disposed = false;
443
466
  subscriber._errorPhase = "binding";
444
467
  subscriber._errorNode = ownerNode;
468
+ subscriber._tok = null;
469
+ subscriber._owner = null;
470
+ if (structural) subscriber._tok = { sub: subscriber };
445
471
  try {
446
472
  run();
447
473
  } catch (err) {
448
474
  subscriber._disposed = true;
449
475
  subscriber._errorNode = void 0;
476
+ if (subscriber._tok != null) subscriber._tok.sub = null;
450
477
  cleanup(subscriber);
451
478
  throw err;
452
479
  }
453
- return subscriber._dispose ?? (subscriber._dispose = () => {
480
+ subscriber._dispose = () => {
454
481
  subscriber._disposed = true;
455
482
  subscriber._errorNode = void 0;
483
+ if (subscriber._tok != null) subscriber._tok.sub = null;
456
484
  cleanup(subscriber);
457
- });
485
+ };
486
+ return subscriber;
458
487
  }
459
488
  function recordDependency(signal2) {
460
489
  if (!currentSubscriber) return;
@@ -478,6 +507,7 @@ function recordDependency(signal2) {
478
507
  }
479
508
  function cleanup(subscriber) {
480
509
  const sub = subscriber;
510
+ if (sub._owner != null) sub._owner = null;
481
511
  let node = sub.depsHead ?? null;
482
512
  sub.depsHead = null;
483
513
  sub.depsTail = null;
@@ -537,20 +567,41 @@ function drainQueue() {
537
567
  break;
538
568
  }
539
569
  const sub = pendingQueue[i++];
540
- pendingSet.delete(sub);
541
- if (quarantined.size > 0 && quarantined.has(sub)) continue;
542
- if (sub._hasComputedDep === true && !depsChanged(sub)) continue;
543
- if (tickRepeat(sub)) {
544
- cycleError(sub);
545
- quarantined.add(sub);
546
- continue;
547
- }
548
- const pushed = beginDisposerCapture(sub._cap ?? null);
549
- try {
550
- safeInvoke(sub);
551
- } finally {
552
- if (pushed) endDisposerCapture();
553
- }
570
+ if (!pendingSet.delete(sub)) continue;
571
+ if (sub._owner != null && pendingSet.size > 0) {
572
+ runPendingOwners(sub);
573
+ if (pendingSet.has(sub)) continue;
574
+ }
575
+ runQueued(sub);
576
+ }
577
+ }
578
+ function runPendingOwners(sub) {
579
+ for (; ; ) {
580
+ let outer = null;
581
+ for (let t = sub._owner ?? null; t !== null; ) {
582
+ const o = t.sub;
583
+ if (o === null) break;
584
+ if (pendingSet.has(o)) outer = o;
585
+ t = o._owner ?? null;
586
+ }
587
+ if (outer === null) return;
588
+ pendingSet.delete(outer);
589
+ runQueued(outer);
590
+ }
591
+ }
592
+ function runQueued(sub) {
593
+ if (quarantined.size > 0 && quarantined.has(sub)) return;
594
+ if (sub._hasComputedDep === true && !depsChanged(sub)) return;
595
+ if (tickRepeat(sub)) {
596
+ cycleError(sub);
597
+ quarantined.add(sub);
598
+ return;
599
+ }
600
+ const pushed = beginDisposerCapture(sub._cap ?? null);
601
+ try {
602
+ safeInvoke(sub);
603
+ } finally {
604
+ if (pushed) endDisposerCapture();
554
605
  }
555
606
  }
556
607
  function drainNotificationQueue() {
@@ -686,7 +737,7 @@ function forEachSubscriber(signal2, visit) {
686
737
  }
687
738
 
688
739
  // src/reactivity/track.ts
689
- var _runtimeVersion = true ? "4.12.0" : "dev";
740
+ var _runtimeVersion = true ? "4.13.1" : "dev";
690
741
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
691
742
  function resolveReactiveApi() {
692
743
  const g = globalThis;
@@ -721,6 +772,7 @@ function resolveReactiveApi() {
721
772
  getOwnerScope,
722
773
  runWithOwnerScope,
723
774
  bindOwnerScope,
775
+ structuralBinding,
724
776
  version: _runtimeVersion
725
777
  };
726
778
  g[REGISTRY_KEY] = local;
@@ -747,6 +799,7 @@ var forEachSubscriber2 = API.forEachSubscriber;
747
799
  var getOwnerScope2 = API.getOwnerScope ?? getOwnerScope;
748
800
  var runWithOwnerScope2 = API.runWithOwnerScope ?? runWithOwnerScope;
749
801
  var bindOwnerScope2 = API.bindOwnerScope ?? bindOwnerScope;
802
+ var structuralBinding2 = API.structuralBinding ?? ((commit, ownerNode) => ({ stop: API.reactiveBinding(commit, ownerNode), run: (fn) => fn() }));
750
803
 
751
804
  // src/core/devtoolsHook.ts
752
805
  function emitDevtools(hook, event, payload) {
package/dist/data.js CHANGED
@@ -22,14 +22,14 @@ import {
22
22
  throttle,
23
23
  withLoader,
24
24
  withRetry
25
- } from "./chunk-QLG5IK7F.js";
26
- import "./chunk-RK7EPQPG.js";
25
+ } from "./chunk-G3Z2FEBR.js";
26
+ import "./chunk-YFTBCCVH.js";
27
27
  import "./chunk-7ZHH77QA.js";
28
- import "./chunk-EMB5PG7V.js";
28
+ import "./chunk-QC3NP47A.js";
29
29
  import "./chunk-EXXSN3BW.js";
30
30
  import "./chunk-7XHATCIH.js";
31
- import "./chunk-IHA62NGJ.js";
32
- import "./chunk-B2Y5BJSP.js";
31
+ import "./chunk-QKFVMIAV.js";
32
+ import "./chunk-4UTGDVSA.js";
33
33
  import "./chunk-NYNYSPK7.js";
34
34
  export {
35
35
  __resetQueryCache,