sibujs 4.3.0 → 4.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.
Files changed (77) hide show
  1. package/README.md +34 -4
  2. package/dist/browser.cjs +31 -2
  3. package/dist/browser.d.cts +15 -2
  4. package/dist/browser.d.ts +15 -2
  5. package/dist/browser.js +4 -4
  6. package/dist/build.cjs +92 -13
  7. package/dist/build.js +10 -10
  8. package/dist/cdn.dev.global.js +10 -10
  9. package/dist/cdn.full.dev.global.js +400 -0
  10. package/dist/cdn.full.global.js +398 -0
  11. package/dist/cdn.global.js +10 -10
  12. package/dist/{chunk-GZYQNIPS.js → chunk-2DCGACUU.js} +16 -9
  13. package/dist/{chunk-7BPN4MXR.js → chunk-3JZ4L5TJ.js} +10 -4
  14. package/dist/{chunk-R4EF7V3K.js → chunk-4PMLNECI.js} +4 -4
  15. package/dist/{chunk-IYHM4FWD.js → chunk-7LN645I6.js} +1 -1
  16. package/dist/{chunk-RE6KLGMV.js → chunk-B3WHI2QA.js} +1 -1
  17. package/dist/{chunk-ZVYNIUOG.js → chunk-FTIR4QW2.js} +13 -3
  18. package/dist/{chunk-G7GPNB6N.js → chunk-GW3SCCZG.js} +4 -4
  19. package/dist/{chunk-XGCZ45NH.js → chunk-KEISJXBU.js} +2 -2
  20. package/dist/{chunk-UD6YE2GW.js → chunk-OMJJM3KM.js} +2 -2
  21. package/dist/{chunk-7UBG6LDP.js → chunk-ONOHFDLG.js} +9 -1
  22. package/dist/{chunk-7UK6BSAT.js → chunk-PCT43HW3.js} +1 -1
  23. package/dist/{chunk-VJE6DDYM.js → chunk-R25EFXXC.js} +40 -26
  24. package/dist/{chunk-3E5YNK2F.js → chunk-RBTPLM32.js} +46 -8
  25. package/dist/{chunk-7BJLKDBI.js → chunk-RIXRAYIU.js} +1 -1
  26. package/dist/{chunk-7GQIRV27.js → chunk-RJE2BNI4.js} +3 -3
  27. package/dist/{chunk-2LSY4WDM.js → chunk-S373NSMK.js} +18 -13
  28. package/dist/{chunk-AAHT6AKT.js → chunk-TBYTO6BS.js} +2 -2
  29. package/dist/{chunk-TSL64O5L.js → chunk-UGRX3S57.js} +31 -2
  30. package/dist/{chunk-L4B3Y3OM.js → chunk-VUF4ALSW.js} +1 -1
  31. package/dist/{chunk-USS5ENJ2.js → chunk-VZKNK2V7.js} +9 -4
  32. package/dist/{chunk-MYA5HEK5.js → chunk-XZZOBQAY.js} +1 -1
  33. package/dist/{contracts-Hg6ITAEF.d.cts → contracts-DBdg9J_a.d.cts} +25 -4
  34. package/dist/{contracts-Hg6ITAEF.d.ts → contracts-DBdg9J_a.d.ts} +25 -4
  35. package/dist/{customElement-CNZxEB9G.d.ts → customElement-OB9CIsc5.d.cts} +38 -10
  36. package/dist/{customElement-CNZxEB9G.d.cts → customElement-OB9CIsc5.d.ts} +38 -10
  37. package/dist/data.cjs +81 -9
  38. package/dist/data.js +6 -6
  39. package/dist/devtools.cjs +41 -2
  40. package/dist/devtools.js +4 -4
  41. package/dist/ecosystem.cjs +83 -9
  42. package/dist/ecosystem.d.cts +13 -5
  43. package/dist/ecosystem.d.ts +13 -5
  44. package/dist/ecosystem.js +7 -7
  45. package/dist/extras.cjs +150 -40
  46. package/dist/extras.d.cts +3 -3
  47. package/dist/extras.d.ts +3 -3
  48. package/dist/extras.js +20 -20
  49. package/dist/index.cjs +92 -13
  50. package/dist/index.d.cts +24 -151
  51. package/dist/index.d.ts +24 -151
  52. package/dist/index.js +10 -10
  53. package/dist/motion.cjs +31 -2
  54. package/dist/motion.js +3 -3
  55. package/dist/patterns.cjs +116 -36
  56. package/dist/patterns.d.cts +6 -1
  57. package/dist/patterns.d.ts +6 -1
  58. package/dist/patterns.js +6 -6
  59. package/dist/performance.cjs +31 -2
  60. package/dist/performance.js +4 -4
  61. package/dist/plugins.cjs +39 -2
  62. package/dist/plugins.js +6 -6
  63. package/dist/ssr.cjs +39 -2
  64. package/dist/ssr.js +7 -7
  65. package/dist/tagFactory-DVoDpHye.d.cts +215 -0
  66. package/dist/tagFactory-DVoDpHye.d.ts +215 -0
  67. package/dist/testing.cjs +31 -2
  68. package/dist/testing.js +2 -2
  69. package/dist/ui.cjs +128 -39
  70. package/dist/ui.d.cts +2 -2
  71. package/dist/ui.d.ts +2 -2
  72. package/dist/ui.js +7 -7
  73. package/dist/widgets.cjs +75 -9
  74. package/dist/widgets.js +6 -6
  75. package/package.json +8 -2
  76. package/dist/tagFactory-Bzupt4Pj.d.cts +0 -55
  77. package/dist/tagFactory-Bzupt4Pj.d.ts +0 -55
@@ -1,4 +1,4 @@
1
- export { C as ComponentProps, P as PropDef, a as PropSchema, R as RenderProp, V as Validator, b as assertType, c as compose, d as createGuard, e as createSlots, f as defineComponent, g as defineSlottedComponent, h as defineStrictComponent, v as validateProps, i as validators, w as withBoundary, j as withDefaults, k as withProps, l as withWrapper } from './contracts-Hg6ITAEF.js';
1
+ export { C as ComponentProps, P as PropDef, a as PropSchema, R as RenderProp, V as Validator, b as assertType, c as compose, d as createGuard, e as createSlots, f as defineComponent, g as defineSlottedComponent, h as defineStrictComponent, v as validateProps, i as validators, w as withBoundary, j as withDefaults, k as withProps, l as withWrapper } from './contracts-DBdg9J_a.js';
2
2
 
3
3
  interface MachineConfig<S extends string, E extends string, C extends object = Record<string, unknown>> {
4
4
  initial: S;
@@ -202,6 +202,11 @@ interface TimeTravelReturn<T> {
202
202
  index: () => number;
203
203
  reset: () => void;
204
204
  jumpTo: (index: number) => void;
205
+ /**
206
+ * Dispose the internal `value`, `canUndo` and `canRedo` deriveds and remove
207
+ * them from DevTools. Afterwards they return their last values. Idempotent.
208
+ */
209
+ dispose: () => void;
205
210
  }
206
211
  /**
207
212
  * timeline wraps a state value with undo/redo history.
package/dist/patterns.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  optimisticList,
6
6
  persisted,
7
7
  timeline
8
- } from "./chunk-USS5ENJ2.js";
8
+ } from "./chunk-VZKNK2V7.js";
9
9
  import {
10
10
  RenderProp,
11
11
  assertType,
@@ -21,13 +21,13 @@ import {
21
21
  withDefaults,
22
22
  withProps,
23
23
  withWrapper
24
- } from "./chunk-VJE6DDYM.js";
24
+ } from "./chunk-R25EFXXC.js";
25
25
  import "./chunk-H3SRKIYX.js";
26
- import "./chunk-3E5YNK2F.js";
27
- import "./chunk-7BJLKDBI.js";
26
+ import "./chunk-RBTPLM32.js";
27
+ import "./chunk-RIXRAYIU.js";
28
28
  import "./chunk-5DXA2J44.js";
29
- import "./chunk-MYA5HEK5.js";
30
- import "./chunk-TSL64O5L.js";
29
+ import "./chunk-XZZOBQAY.js";
30
+ import "./chunk-UGRX3S57.js";
31
31
  import "./chunk-2WLZ6757.js";
32
32
  export {
33
33
  RenderProp,
@@ -481,6 +481,15 @@ function untracked(fn) {
481
481
  var subscriberEpochCounter = 0;
482
482
  function retrack(effectFn, subscriber) {
483
483
  const prev = currentSubscriber;
484
+ let savedDepth = 0;
485
+ let savedSuspendSub = null;
486
+ if (trackingSuspended) {
487
+ savedDepth = suspendDepth;
488
+ savedSuspendSub = suspendSavedSub;
489
+ suspendDepth = 0;
490
+ suspendSavedSub = null;
491
+ trackingSuspended = false;
492
+ }
484
493
  currentSubscriber = subscriber;
485
494
  const sub = subscriber;
486
495
  const epoch = ++subscriberEpochCounter;
@@ -495,6 +504,11 @@ function retrack(effectFn, subscriber) {
495
504
  effectFn();
496
505
  } finally {
497
506
  currentSubscriber = prev;
507
+ if (savedDepth !== 0) {
508
+ suspendDepth = savedDepth;
509
+ suspendSavedSub = savedSuspendSub;
510
+ trackingSuspended = true;
511
+ }
498
512
  let node = sub.depsHead ?? null;
499
513
  while (node !== null) {
500
514
  const next = node.subNext;
@@ -514,11 +528,25 @@ function track(effectFn, subscriber) {
514
528
  if (!subscriber) return reactiveBinding(effectFn);
515
529
  cleanup(subscriber);
516
530
  const prev = currentSubscriber;
531
+ let savedDepth = 0;
532
+ let savedSuspendSub = null;
533
+ if (trackingSuspended) {
534
+ savedDepth = suspendDepth;
535
+ savedSuspendSub = suspendSavedSub;
536
+ suspendDepth = 0;
537
+ suspendSavedSub = null;
538
+ trackingSuspended = false;
539
+ }
517
540
  currentSubscriber = subscriber;
518
541
  try {
519
542
  effectFn();
520
543
  } finally {
521
544
  currentSubscriber = prev;
545
+ if (savedDepth !== 0) {
546
+ suspendDepth = savedDepth;
547
+ suspendSavedSub = savedSuspendSub;
548
+ trackingSuspended = true;
549
+ }
522
550
  const sub2 = subscriber;
523
551
  for (let n = sub2.depsHead ?? null; n !== null; n = n.subNext) {
524
552
  const sig = n.sig;
@@ -689,8 +717,9 @@ function propagateDirty(sub) {
689
717
  if (s._c) {
690
718
  const nSig = s._sig;
691
719
  if (nSig) {
692
- if (!nSig._d) {
720
+ if (!nSig._d || nSig._f === true) {
693
721
  nSig._d = true;
722
+ nSig._f = false;
694
723
  stack.push(nSig);
695
724
  }
696
725
  } else {
@@ -790,7 +819,7 @@ function forEachSubscriber(signal2, visit) {
790
819
  }
791
820
 
792
821
  // src/reactivity/track.ts
793
- var _runtimeVersion = true ? "4.3.0" : "dev";
822
+ var _runtimeVersion = true ? "4.5.0" : "dev";
794
823
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
795
824
  function resolveReactiveApi() {
796
825
  const g = globalThis;
@@ -33,17 +33,17 @@ import {
33
33
  transitionState,
34
34
  uniqueId,
35
35
  yieldToMain
36
- } from "./chunk-AAHT6AKT.js";
36
+ } from "./chunk-TBYTO6BS.js";
37
37
  import {
38
38
  trustHTML
39
39
  } from "./chunk-NIOYEGBQ.js";
40
40
  import "./chunk-IXKSNWV5.js";
41
41
  import "./chunk-7ZHH77QA.js";
42
- import "./chunk-7BJLKDBI.js";
42
+ import "./chunk-RIXRAYIU.js";
43
43
  import "./chunk-5DXA2J44.js";
44
44
  import "./chunk-QKRPLZ2V.js";
45
- import "./chunk-MYA5HEK5.js";
46
- import "./chunk-TSL64O5L.js";
45
+ import "./chunk-XZZOBQAY.js";
46
+ import "./chunk-UGRX3S57.js";
47
47
  import "./chunk-2WLZ6757.js";
48
48
  export {
49
49
  DOMPool,
package/dist/plugins.cjs CHANGED
@@ -1402,6 +1402,14 @@ function setSafeAttribute(el, name, value, options = {}) {
1402
1402
  const html2 = isHtmlElement(el);
1403
1403
  const idlName = html2 ? name.toLowerCase() : name;
1404
1404
  if (typeof value === "boolean") {
1405
+ if (name.length > 5 && name.slice(0, 5).toLowerCase() === "aria-") {
1406
+ const token = value ? "true" : "false";
1407
+ if ((ns ? el.getAttributeNS(ns, localName) : el.getAttribute(name)) !== token) {
1408
+ if (ns) el.setAttributeNS(ns, name, token);
1409
+ else el.setAttribute(name, token);
1410
+ }
1411
+ return true;
1412
+ }
1405
1413
  if (html2 && BOOLEAN_IDL_ATTRS.has(idlName) && idlName in el) {
1406
1414
  setProp(el, idlName, value);
1407
1415
  } else if (value) {
@@ -1578,6 +1586,15 @@ function untracked(fn) {
1578
1586
  var subscriberEpochCounter = 0;
1579
1587
  function retrack(effectFn, subscriber) {
1580
1588
  const prev = currentSubscriber;
1589
+ let savedDepth = 0;
1590
+ let savedSuspendSub = null;
1591
+ if (trackingSuspended) {
1592
+ savedDepth = suspendDepth;
1593
+ savedSuspendSub = suspendSavedSub;
1594
+ suspendDepth = 0;
1595
+ suspendSavedSub = null;
1596
+ trackingSuspended = false;
1597
+ }
1581
1598
  currentSubscriber = subscriber;
1582
1599
  const sub2 = subscriber;
1583
1600
  const epoch = ++subscriberEpochCounter;
@@ -1592,6 +1609,11 @@ function retrack(effectFn, subscriber) {
1592
1609
  effectFn();
1593
1610
  } finally {
1594
1611
  currentSubscriber = prev;
1612
+ if (savedDepth !== 0) {
1613
+ suspendDepth = savedDepth;
1614
+ suspendSavedSub = savedSuspendSub;
1615
+ trackingSuspended = true;
1616
+ }
1595
1617
  let node = sub2.depsHead ?? null;
1596
1618
  while (node !== null) {
1597
1619
  const next = node.subNext;
@@ -1611,11 +1633,25 @@ function track(effectFn, subscriber) {
1611
1633
  if (!subscriber) return reactiveBinding(effectFn);
1612
1634
  cleanup(subscriber);
1613
1635
  const prev = currentSubscriber;
1636
+ let savedDepth = 0;
1637
+ let savedSuspendSub = null;
1638
+ if (trackingSuspended) {
1639
+ savedDepth = suspendDepth;
1640
+ savedSuspendSub = suspendSavedSub;
1641
+ suspendDepth = 0;
1642
+ suspendSavedSub = null;
1643
+ trackingSuspended = false;
1644
+ }
1614
1645
  currentSubscriber = subscriber;
1615
1646
  try {
1616
1647
  effectFn();
1617
1648
  } finally {
1618
1649
  currentSubscriber = prev;
1650
+ if (savedDepth !== 0) {
1651
+ suspendDepth = savedDepth;
1652
+ suspendSavedSub = savedSuspendSub;
1653
+ trackingSuspended = true;
1654
+ }
1619
1655
  const sub3 = subscriber;
1620
1656
  for (let n = sub3.depsHead ?? null; n !== null; n = n.subNext) {
1621
1657
  const sig = n.sig;
@@ -1786,8 +1822,9 @@ function propagateDirty(sub2) {
1786
1822
  if (s2._c) {
1787
1823
  const nSig = s2._sig;
1788
1824
  if (nSig) {
1789
- if (!nSig._d) {
1825
+ if (!nSig._d || nSig._f === true) {
1790
1826
  nSig._d = true;
1827
+ nSig._f = false;
1791
1828
  stack.push(nSig);
1792
1829
  }
1793
1830
  } else {
@@ -1887,7 +1924,7 @@ function forEachSubscriber(signal2, visit) {
1887
1924
  }
1888
1925
 
1889
1926
  // src/reactivity/track.ts
1890
- var _runtimeVersion = true ? "4.3.0" : "dev";
1927
+ var _runtimeVersion = true ? "4.5.0" : "dev";
1891
1928
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
1892
1929
  function resolveReactiveApi() {
1893
1930
  const g2 = globalThis;
package/dist/plugins.js CHANGED
@@ -35,7 +35,7 @@ import {
35
35
  } from "./chunk-WWV3SJ3L.js";
36
36
  import {
37
37
  span
38
- } from "./chunk-7UK6BSAT.js";
38
+ } from "./chunk-PCT43HW3.js";
39
39
  import {
40
40
  escapeScriptJson,
41
41
  renderToString,
@@ -43,8 +43,8 @@ import {
43
43
  } from "./chunk-NIOYEGBQ.js";
44
44
  import {
45
45
  resolveClassValue
46
- } from "./chunk-XGCZ45NH.js";
47
- import "./chunk-7UBG6LDP.js";
46
+ } from "./chunk-KEISJXBU.js";
47
+ import "./chunk-ONOHFDLG.js";
48
48
  import {
49
49
  isUrlAttribute,
50
50
  sanitizeStyleAttribute,
@@ -56,7 +56,7 @@ import {
56
56
  } from "./chunk-7ZHH77QA.js";
57
57
  import {
58
58
  effect
59
- } from "./chunk-7BJLKDBI.js";
59
+ } from "./chunk-RIXRAYIU.js";
60
60
  import {
61
61
  getRequestStore
62
62
  } from "./chunk-5DXA2J44.js";
@@ -66,10 +66,10 @@ import {
66
66
  } from "./chunk-QKRPLZ2V.js";
67
67
  import {
68
68
  signal
69
- } from "./chunk-MYA5HEK5.js";
69
+ } from "./chunk-XZZOBQAY.js";
70
70
  import {
71
71
  track
72
- } from "./chunk-TSL64O5L.js";
72
+ } from "./chunk-UGRX3S57.js";
73
73
  import {
74
74
  devWarn,
75
75
  isDev
package/dist/ssr.cjs CHANGED
@@ -1332,6 +1332,15 @@ function untracked(fn) {
1332
1332
  var subscriberEpochCounter = 0;
1333
1333
  function retrack(effectFn, subscriber) {
1334
1334
  const prev = currentSubscriber;
1335
+ let savedDepth = 0;
1336
+ let savedSuspendSub = null;
1337
+ if (trackingSuspended) {
1338
+ savedDepth = suspendDepth;
1339
+ savedSuspendSub = suspendSavedSub;
1340
+ suspendDepth = 0;
1341
+ suspendSavedSub = null;
1342
+ trackingSuspended = false;
1343
+ }
1335
1344
  currentSubscriber = subscriber;
1336
1345
  const sub2 = subscriber;
1337
1346
  const epoch = ++subscriberEpochCounter;
@@ -1346,6 +1355,11 @@ function retrack(effectFn, subscriber) {
1346
1355
  effectFn();
1347
1356
  } finally {
1348
1357
  currentSubscriber = prev;
1358
+ if (savedDepth !== 0) {
1359
+ suspendDepth = savedDepth;
1360
+ suspendSavedSub = savedSuspendSub;
1361
+ trackingSuspended = true;
1362
+ }
1349
1363
  let node = sub2.depsHead ?? null;
1350
1364
  while (node !== null) {
1351
1365
  const next = node.subNext;
@@ -1365,11 +1379,25 @@ function track(effectFn, subscriber) {
1365
1379
  if (!subscriber) return reactiveBinding(effectFn);
1366
1380
  cleanup(subscriber);
1367
1381
  const prev = currentSubscriber;
1382
+ let savedDepth = 0;
1383
+ let savedSuspendSub = null;
1384
+ if (trackingSuspended) {
1385
+ savedDepth = suspendDepth;
1386
+ savedSuspendSub = suspendSavedSub;
1387
+ suspendDepth = 0;
1388
+ suspendSavedSub = null;
1389
+ trackingSuspended = false;
1390
+ }
1368
1391
  currentSubscriber = subscriber;
1369
1392
  try {
1370
1393
  effectFn();
1371
1394
  } finally {
1372
1395
  currentSubscriber = prev;
1396
+ if (savedDepth !== 0) {
1397
+ suspendDepth = savedDepth;
1398
+ suspendSavedSub = savedSuspendSub;
1399
+ trackingSuspended = true;
1400
+ }
1373
1401
  const sub3 = subscriber;
1374
1402
  for (let n = sub3.depsHead ?? null; n !== null; n = n.subNext) {
1375
1403
  const sig = n.sig;
@@ -1540,8 +1568,9 @@ function propagateDirty(sub2) {
1540
1568
  if (s2._c) {
1541
1569
  const nSig = s2._sig;
1542
1570
  if (nSig) {
1543
- if (!nSig._d) {
1571
+ if (!nSig._d || nSig._f === true) {
1544
1572
  nSig._d = true;
1573
+ nSig._f = false;
1545
1574
  stack.push(nSig);
1546
1575
  }
1547
1576
  } else {
@@ -1641,7 +1670,7 @@ function forEachSubscriber(signal2, visit) {
1641
1670
  }
1642
1671
 
1643
1672
  // src/reactivity/track.ts
1644
- var _runtimeVersion = true ? "4.3.0" : "dev";
1673
+ var _runtimeVersion = true ? "4.5.0" : "dev";
1645
1674
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
1646
1675
  function resolveReactiveApi() {
1647
1676
  const g2 = globalThis;
@@ -2468,6 +2497,14 @@ function setSafeAttribute(el, name, value, options = {}) {
2468
2497
  const html2 = isHtmlElement(el);
2469
2498
  const idlName = html2 ? name.toLowerCase() : name;
2470
2499
  if (typeof value === "boolean") {
2500
+ if (name.length > 5 && name.slice(0, 5).toLowerCase() === "aria-") {
2501
+ const token = value ? "true" : "false";
2502
+ if ((ns ? el.getAttributeNS(ns, localName) : el.getAttribute(name)) !== token) {
2503
+ if (ns) el.setAttributeNS(ns, name, token);
2504
+ else el.setAttribute(name, token);
2505
+ }
2506
+ return true;
2507
+ }
2471
2508
  if (html2 && BOOLEAN_IDL_ATTRS.has(idlName) && idlName in el) {
2472
2509
  setProp(el, idlName, value);
2473
2510
  } else if (value) {
package/dist/ssr.js CHANGED
@@ -23,9 +23,9 @@ import {
23
23
  wasm,
24
24
  worker,
25
25
  workerFn
26
- } from "./chunk-7GQIRV27.js";
26
+ } from "./chunk-RJE2BNI4.js";
27
27
  import "./chunk-52XFPGSN.js";
28
- import "./chunk-7UK6BSAT.js";
28
+ import "./chunk-PCT43HW3.js";
29
29
  import {
30
30
  collectStream,
31
31
  deserializeState,
@@ -46,15 +46,15 @@ import {
46
46
  suspenseSwapScript,
47
47
  trustHTML
48
48
  } from "./chunk-NIOYEGBQ.js";
49
- import "./chunk-XGCZ45NH.js";
50
- import "./chunk-7UBG6LDP.js";
49
+ import "./chunk-KEISJXBU.js";
50
+ import "./chunk-ONOHFDLG.js";
51
51
  import "./chunk-IXKSNWV5.js";
52
52
  import "./chunk-7ZHH77QA.js";
53
- import "./chunk-7BJLKDBI.js";
53
+ import "./chunk-RIXRAYIU.js";
54
54
  import "./chunk-5DXA2J44.js";
55
55
  import "./chunk-QKRPLZ2V.js";
56
- import "./chunk-MYA5HEK5.js";
57
- import "./chunk-TSL64O5L.js";
56
+ import "./chunk-XZZOBQAY.js";
57
+ import "./chunk-UGRX3S57.js";
58
58
  import "./chunk-2WLZ6757.js";
59
59
  export {
60
60
  Head,
@@ -0,0 +1,215 @@
1
+ declare const __accessor: unique symbol;
2
+ /**
3
+ * A reactive signal getter returned by signal(), derived(), and similar primitives.
4
+ *
5
+ * Pass an Accessor directly into reactive prop positions — never call it there:
6
+ * ```ts
7
+ * const [count, setCount] = signal(0);
8
+ *
9
+ * div(count) // ✓ reactive — Accessor passed directly
10
+ * div(() => count()) // ✓ reactive — explicit arrow wrapper
11
+ * div(count()) // ✗ static — evaluated once, not reactive
12
+ * ```
13
+ */
14
+ type Accessor<T> = (() => T) & {
15
+ readonly [__accessor]?: never;
16
+ };
17
+ type SetState<T> = (next: T | ((prev: T) => T)) => void;
18
+ type StateTuple<T> = [Accessor<T>, SetState<T>];
19
+ /** Options for signal */
20
+ interface SignalOptions<T = unknown> {
21
+ /** Debug name for devtools inspection. Only used in development. */
22
+ name?: string;
23
+ /** Custom equality function. Defaults to Object.is(). */
24
+ equals?: (prev: T, next: T) => boolean;
25
+ }
26
+ /**
27
+ * signal creates a reactive signal that holds a value of type T.
28
+ * Returns a tuple: [getter, setter].
29
+ *
30
+ * @param initial Initial value
31
+ * @param options Optional config: `{ name: "count" }` for devtools labeling
32
+ * @returns A `[getter, setter]` tuple. Calling the getter inside a reactive
33
+ * context subscribes to the signal; the setter accepts a value or an updater.
34
+ */
35
+ declare function signal<T>(initial: T, options?: SignalOptions<T>): StateTuple<T>;
36
+ /**
37
+ * A valueless reactive token standing in for state SibuJS does not own.
38
+ *
39
+ * See {@link external}.
40
+ */
41
+ interface ExternalSource {
42
+ /**
43
+ * Declare, from inside a reactive computation, that it reads the external
44
+ * state this source represents. Call it in the same places you would read a
45
+ * signal — the top of a binding getter, a `derived()` body, an `effect()`.
46
+ *
47
+ * Outside a tracking context it is a no-op, exactly like reading a signal.
48
+ */
49
+ track(): void;
50
+ /**
51
+ * Declare that the external state changed. Every consumer that called
52
+ * {@link ExternalSource.track} is invalidated.
53
+ *
54
+ * Participates in `batch()` like any signal write: inside a batch, consumers
55
+ * are notified once when the outermost batch flushes.
56
+ */
57
+ invalidate(): void;
58
+ }
59
+ /**
60
+ * Create a reactive source for state that lives outside SibuJS — a domain
61
+ * engine, a media element, a canvas scene, an editor document, a cache a
62
+ * socket writes into.
63
+ *
64
+ * The pattern is two lines: `track()` where you read, `invalidate()` after you
65
+ * mutate.
66
+ *
67
+ * ```ts
68
+ * import { Chess } from "chess.js";
69
+ * import { external } from "sibujs";
70
+ *
71
+ * const game = new Chess(); // owns the rules and the mutable state
72
+ * const moved = external(); // owns "something changed"
73
+ *
74
+ * ctx.text("@status", () => {
75
+ * moved.track(); // this binding reads the engine
76
+ * return game.isCheckmate() ? "Checkmate" : `${game.turn()} to move`;
77
+ * });
78
+ *
79
+ * game.move({ from: "e2", to: "e4" });
80
+ * moved.invalidate(); // every consumer above re-reads
81
+ * ```
82
+ *
83
+ * **One source is one invalidation domain.** Every consumer of a source
84
+ * re-runs on every `invalidate()`, so the granularity of your updates is
85
+ * exactly the granularity of your sources: one for a whole engine is the
86
+ * cheapest to write, several (`board`, `clock`, `history`) let an update touch
87
+ * only what it affects. See `docs/architecture/external-state.md` for the
88
+ * trade-offs and when subdividing is worth it.
89
+ *
90
+ * Ownership, disposal and error routing are the consumer's, not the source's:
91
+ * a disposed binding or effect is never invalidated, and a consumer that
92
+ * throws is reported through the normal runtime error pipeline with its own
93
+ * phase and node.
94
+ *
95
+ * @param options `name` labels the source in devtools (development only).
96
+ */
97
+ declare function external(options?: {
98
+ name?: string;
99
+ }): ExternalSource;
100
+
101
+ /**
102
+ * derived creates a derived reactive signal whose value updates when dependencies change.
103
+ *
104
+ * Uses lazy pull-based evaluation with a single dirty flag:
105
+ * - When a dependency changes, the computed is marked dirty (no re-evaluation).
106
+ * - Dirtiness propagates downstream via propagateDirty.
107
+ * - The getter only re-evaluates when actually read (pull-based).
108
+ * - On re-evaluation, dependencies are re-tracked via retrack() so that
109
+ * derived-of-derived chains propagate correctly without paying the full
110
+ * Set-delete + re-add cost of track()'s cleanup phase.
111
+ *
112
+ * STABILIZATION — why a dirty flag is enough:
113
+ *
114
+ * A dirty computed does NOT imply a changed value. Downstream effects are
115
+ * enqueued by `propagateDirty` at write time, before this computed has had a
116
+ * chance to recompute and compare. Rather than adding a three-color
117
+ * (CLEAN/CHECK/DIRTY) propagation pass — which an earlier revision measured as
118
+ * a regression on every benchmark, because the extra state has nothing to skip
119
+ * when values genuinely change — the engine settles the question lazily at
120
+ * DRAIN time: `cs._validate` recomputes a dirty computed and `cs.__v` is bumped
121
+ * ONLY when the new value differs under this computed's comparator. The
122
+ * scheduler compares that version against what each subscriber last observed
123
+ * and suppresses the run when nothing changed (see `depsChanged` in
124
+ * ../../reactivity/track-core.ts).
125
+ *
126
+ * That keeps the cheap boolean dirty flag AND makes `equals` actually stop
127
+ * propagation, with recomputation still fully lazy: `_validate` only ever runs
128
+ * when an effect is genuinely about to observe the value.
129
+ *
130
+ * DISPOSAL — a derived subscribes to its sources when it is created, and those
131
+ * edges live as long as the sources do. A derived created per mount (one per
132
+ * virtualized row, say) must be released when its owner goes away:
133
+ * `flag.dispose()`, or `onCleanup(flag.dispose, rowNode)` to tie it to a node.
134
+ * A disposed accessor is inert: it keeps returning the last value it settled,
135
+ * never recomputes, never re-subscribes, and never wakes downstream readers.
136
+ * Disposal is idempotent.
137
+ *
138
+ * ERRORS — a recomputation that throws is thrown to the next reader, in that
139
+ * reader's context: a binding reports it with its node (so the nearest
140
+ * `ErrorBoundary` can claim it), an effect reports it, a direct caller can catch
141
+ * it, and a derived reading another derived passes it on. A live derived stays
142
+ * dirty and recomputes on the following read; a derived that disposed itself
143
+ * during the failing run returns its frozen value afterwards.
144
+ *
145
+ * @returns An accessor for the computed value. It recomputes lazily on read
146
+ * after any dependency changes, and carries `dispose()` to release its source
147
+ * subscriptions.
148
+ */
149
+ declare function derived<T>(getter: () => T, options?: {
150
+ name?: string;
151
+ /** Custom equality — when the recomputed value equals the previous,
152
+ * downstream subscribers are not notified. Defaults to `Object.is`. */
153
+ equals?: (a: T, b: T) => boolean;
154
+ }): DerivedAccessor<T>;
155
+ /** Accessor returned by {@link derived}: read it like any getter, release it with `dispose()`. */
156
+ type DerivedAccessor<T> = Accessor<T> & {
157
+ /** Release every source subscription. The accessor then returns its last settled value. Idempotent. */
158
+ dispose: () => void;
159
+ };
160
+
161
+ /**
162
+ * Canonical disposer/teardown signature used across the framework.
163
+ *
164
+ * Returned by `effect()`, `track()`, widget `bind()` methods, and other
165
+ * subscription/lifecycle helpers. All disposers MUST be idempotent — calling
166
+ * twice should be a no-op rather than an error.
167
+ */
168
+ type Dispose = () => void;
169
+ type NodeChild = Node | Element | Text | Comment | string | number | boolean | (() => NodeChild) | null | undefined;
170
+ type NodeChildren = NodeChild | NodeChild[] | NodeChild[][] | (() => NodeChild | NodeChild[]);
171
+
172
+ declare const SVG_NS = "http://www.w3.org/2000/svg";
173
+ interface TagProps {
174
+ id?: string;
175
+ class?: string | (() => string) | Record<string, boolean | (() => boolean)>;
176
+ style?: Record<string, string | number | (() => string | number)> | string | (() => string);
177
+ ref?: {
178
+ current: Element | null;
179
+ };
180
+ nodes?: NodeChildren;
181
+ on?: Record<string, (ev: Event) => void>;
182
+ /** Called with the element after creation — useful for imperative bindings */
183
+ onElement?: (el: HTMLElement) => void;
184
+ [attr: string]: unknown;
185
+ }
186
+ /**
187
+ * Factory for creating HTML or SVG elements with reactive props and nodes.
188
+ *
189
+ * Calling conventions:
190
+ *
191
+ * tag() empty element
192
+ * tag("text") element with text content
193
+ * tag(42) element with numeric text content
194
+ * tag([childA, childB]) element with children (array)
195
+ * tag(node) element wrapping a single existing node
196
+ * tag(getter) element with a reactive child
197
+ * tag("className", children) positional: class + children
198
+ * tag({ ...props }) full props object (children via props.nodes)
199
+ * tag({ ...props }, children) props + children (no need for `nodes:` key!)
200
+ *
201
+ * The last form is the "deeply-nested shorthand" the codebase favours:
202
+ *
203
+ * div({ class: "card" }, [
204
+ * h1({ class: "title" }, "Hello"),
205
+ * p({ class: "body" }, "World"),
206
+ * div({ class: "row" }, [
207
+ * span({ id: "x" }, "child"),
208
+ * ]),
209
+ * ])
210
+ *
211
+ * `children` overrides `props.nodes` when both are present.
212
+ */
213
+ declare const tagFactory: (tag: string, ns?: string) => (first?: TagProps | NodeChildren, second?: NodeChildren) => Element;
214
+
215
+ export { type Accessor as A, type DerivedAccessor as D, type ExternalSource as E, type NodeChild as N, SVG_NS as S, type TagProps as T, type NodeChildren as a, type Dispose as b, type SignalOptions as c, derived as d, external as e, signal as s, tagFactory as t };