sibujs 4.13.0 → 4.14.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 (107) hide show
  1. package/README.md +1 -1
  2. package/dist/browser.cjs +15 -2
  3. package/dist/browser.js +9 -7
  4. package/dist/build.cjs +880 -281
  5. package/dist/build.d.cts +68 -3
  6. package/dist/build.d.ts +68 -3
  7. package/dist/build.js +88 -30
  8. package/dist/cdn.dev.global.js +12 -12
  9. package/dist/cdn.full.dev.global.js +13 -13
  10. package/dist/cdn.full.global.js +12 -12
  11. package/dist/cdn.global.js +12 -12
  12. package/dist/{chunk-7K7W4AA5.js → chunk-2TTRW2TE.js} +6 -6
  13. package/dist/{chunk-J6FW5TV6.js → chunk-3HEX6QJQ.js} +5 -3
  14. package/dist/chunk-3HZOSMPX.js +90 -0
  15. package/dist/{chunk-GNSRXK34.js → chunk-4FJSAUKB.js} +11 -3
  16. package/dist/{chunk-IV74C2YX.js → chunk-4TQDTWWN.js} +6 -5
  17. package/dist/{chunk-L3QHS4O4.js → chunk-7ILEHTVX.js} +1 -1
  18. package/dist/{chunk-CK5F2IR5.js → chunk-A454RAEK.js} +4 -4
  19. package/dist/{chunk-BRRRVLHQ.js → chunk-AE32RGWX.js} +10 -6
  20. package/dist/{chunk-EXXSN3BW.js → chunk-B3HOT4TK.js} +1 -1
  21. package/dist/{chunk-F4W7WYXY.js → chunk-BKZ5N6NK.js} +8 -6
  22. package/dist/{chunk-MNEITZ27.js → chunk-BNXRWZZV.js} +49 -8
  23. package/dist/chunk-BOYKGGVD.js +2015 -0
  24. package/dist/{chunk-G6366I2A.js → chunk-CCKUNHVU.js} +2 -2
  25. package/dist/{chunk-346BYZL2.js → chunk-CJ7KS3DF.js} +16 -10
  26. package/dist/chunk-CNPT6NKV.js +1859 -0
  27. package/dist/{chunk-ENFRHCMK.js → chunk-F67F77IA.js} +2 -2
  28. package/dist/{chunk-TUCPL2HB.js → chunk-GIJ33UJZ.js} +1 -1
  29. package/dist/chunk-GVAMIU6K.js +195 -0
  30. package/dist/{chunk-HDKDBC6V.js → chunk-HQIAL7F2.js} +8 -6
  31. package/dist/{chunk-ZE5LF44R.js → chunk-JTFQ7IL4.js} +8 -8
  32. package/dist/{chunk-AM6DZLBM.js → chunk-LJMX4SQ7.js} +2 -2
  33. package/dist/{chunk-HVVRXRGO.js → chunk-MIRKTVH4.js} +7 -14
  34. package/dist/{chunk-YJ57VR6Y.js → chunk-N7A6FKWW.js} +5 -3
  35. package/dist/chunk-NT3ZYB5S.js +167 -0
  36. package/dist/{chunk-Z3EZX6DZ.js → chunk-QS6GMWDD.js} +151 -86
  37. package/dist/chunk-R5U7XKVJ.js +16 -0
  38. package/dist/{chunk-3C56VNCK.js → chunk-RVR5NPFL.js} +3 -3
  39. package/dist/{chunk-F2UWOZ6J.js → chunk-RVWJGWCL.js} +2 -2
  40. package/dist/{chunk-NYNYSPK7.js → chunk-S37PZD6I.js} +30 -45
  41. package/dist/{chunk-QV5WEOFD.js → chunk-SVULV7O4.js} +119 -26
  42. package/dist/{chunk-C2FAO6VQ.js → chunk-TLS4NVIB.js} +5 -5
  43. package/dist/{chunk-M25RIH6Y.js → chunk-UUIKJJIK.js} +10 -8
  44. package/dist/chunk-UYTYNCMZ.js +199 -0
  45. package/dist/chunk-VM2U5LEL.js +2596 -0
  46. package/dist/{chunk-24L5RDPS.js → chunk-Y4LUM2XS.js} +8 -6
  47. package/dist/data.cjs +265 -35
  48. package/dist/data.d.cts +31 -1
  49. package/dist/data.d.ts +31 -1
  50. package/dist/data.js +16 -10
  51. package/dist/devtools.cjs +15 -2
  52. package/dist/devtools.js +9 -7
  53. package/dist/{dispose-GEIG2KOF.js → dispose-EIHHHDC7.js} +3 -1
  54. package/dist/ecosystem.cjs +62 -23
  55. package/dist/ecosystem.js +14 -12
  56. package/dist/extras.cjs +3520 -270
  57. package/dist/extras.d.cts +3 -3
  58. package/dist/extras.d.ts +3 -3
  59. package/dist/extras.js +39 -29
  60. package/dist/index.cjs +442 -253
  61. package/dist/index.d.cts +93 -283
  62. package/dist/index.d.ts +93 -283
  63. package/dist/index.js +26 -16
  64. package/dist/motion.cjs +12 -1
  65. package/dist/motion.js +6 -4
  66. package/dist/patterns.cjs +15 -2
  67. package/dist/patterns.js +10 -8
  68. package/dist/performance.cjs +36 -2
  69. package/dist/performance.d.cts +2 -2
  70. package/dist/performance.d.ts +2 -2
  71. package/dist/performance.js +14 -10
  72. package/dist/plugins.cjs +5225 -1807
  73. package/dist/plugins.d.cts +8 -834
  74. package/dist/plugins.d.ts +8 -834
  75. package/dist/plugins.js +64 -2329
  76. package/dist/prerenderServer-MXJEVWA3.js +350 -0
  77. package/dist/renderRoute-DP20XwMS.d.cts +86 -0
  78. package/dist/renderRoute-fxgsm2Ir.d.ts +86 -0
  79. package/dist/routeHead-CE9SV-cH.d.cts +995 -0
  80. package/dist/routeHead-DzVxPviY.d.ts +995 -0
  81. package/dist/{routeMiddleware-B1sp4P7a.d.ts → routeMiddleware-BySbueoE.d.ts} +0 -25
  82. package/dist/{routeMiddleware-CedQTsLK.d.cts → routeMiddleware-CijZD5eW.d.cts} +0 -25
  83. package/dist/ssr-JpGpHnpC.d.cts +841 -0
  84. package/dist/ssr-JpGpHnpC.d.ts +841 -0
  85. package/dist/{ssr-VBM6J5SJ.js → ssr-NECEU4X4.js} +15 -6
  86. package/dist/ssr-dom.cjs +1862 -0
  87. package/dist/ssr-dom.d.cts +341 -0
  88. package/dist/ssr-dom.d.ts +341 -0
  89. package/dist/ssr-dom.js +19 -0
  90. package/dist/ssr.cjs +7630 -2064
  91. package/dist/ssr.d.cts +63 -5
  92. package/dist/ssr.d.ts +63 -5
  93. package/dist/ssr.js +136 -14
  94. package/dist/testing.cjs +6543 -87
  95. package/dist/testing.d.cts +80 -1
  96. package/dist/testing.d.ts +80 -1
  97. package/dist/testing.js +117 -4
  98. package/dist/ui.cjs +36 -2
  99. package/dist/ui.js +17 -14
  100. package/dist/widgets.cjs +14 -1
  101. package/dist/widgets.js +11 -9
  102. package/package.json +9 -2
  103. package/dist/chunk-2F4PSJ5Z.js +0 -765
  104. package/dist/chunk-7XHATCIH.js +0 -121
  105. package/dist/chunk-B36ADEIR.js +0 -21
  106. package/dist/ssr-Db0Sgdu3.d.cts +0 -245
  107. package/dist/ssr-Db0Sgdu3.d.ts +0 -245
package/dist/devtools.cjs CHANGED
@@ -256,10 +256,21 @@ function defaultReport(error, context) {
256
256
  if (typeof console === "undefined") return;
257
257
  console.error(`[SibuJS] Uncaught error during ${describe(context)}: ${error.message}`, error);
258
258
  }
259
+ function requestErrorSink() {
260
+ const shared = globalThis[/* @__PURE__ */ Symbol.for("sibujs.ssr.v1")];
261
+ if (!shared) return void 0;
262
+ const store = shared.als ? shared.als.getStore() : shared.fallbackDepth > 0 ? shared.fallbackStore : void 0;
263
+ return store?.errors;
264
+ }
259
265
  function reportError(error, context) {
260
266
  const err = normalizeError(error);
261
267
  untrackedRun(() => {
262
268
  if (claimedByBoundary(err, context)) return;
269
+ const sink = requestErrorSink();
270
+ if (sink) {
271
+ sink.push({ error: err, context });
272
+ return;
273
+ }
263
274
  const s = state();
264
275
  const handler = s.handler;
265
276
  if (handler && s.handlerDepth === 0) {
@@ -921,7 +932,7 @@ function forEachSubscriber(signal2, visit) {
921
932
  }
922
933
 
923
934
  // src/reactivity/track.ts
924
- var _runtimeVersion = true ? "4.13.0" : "dev";
935
+ var _runtimeVersion = true ? "4.14.0" : "dev";
925
936
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
926
937
  function resolveReactiveApi() {
927
938
  const g = globalThis;
@@ -2118,6 +2129,8 @@ function detectSSRShared() {
2118
2129
  }
2119
2130
  if (mod) detected = new mod.AsyncLocalStorage();
2120
2131
  }
2132
+ const globalAls = globalThis.AsyncLocalStorage;
2133
+ if (!detected && typeof globalAls === "function") detected = new globalAls();
2121
2134
  } catch {
2122
2135
  detected = null;
2123
2136
  }
@@ -2206,7 +2219,7 @@ function disposeEffect(ctx) {
2206
2219
  }
2207
2220
  function effect(effectFn, options) {
2208
2221
  devAssert(typeof effectFn === "function", "effect: argument must be a function.");
2209
- if (isSSR()) return () => {
2222
+ if (isSSR() && !options?.server) return () => {
2210
2223
  };
2211
2224
  const ctx = {
2212
2225
  fn: effectFn,
package/dist/devtools.js CHANGED
@@ -35,16 +35,18 @@ import {
35
35
  trackCleanup,
36
36
  walkDependencyGraph,
37
37
  withErrorTracking
38
- } from "./chunk-24L5RDPS.js";
38
+ } from "./chunk-Y4LUM2XS.js";
39
39
  import "./chunk-7ZHH77QA.js";
40
- import "./chunk-BRRRVLHQ.js";
41
- import "./chunk-EXXSN3BW.js";
42
- import "./chunk-7XHATCIH.js";
43
- import "./chunk-GNSRXK34.js";
44
- import "./chunk-HVVRXRGO.js";
40
+ import "./chunk-AE32RGWX.js";
41
+ import "./chunk-B3HOT4TK.js";
42
+ import "./chunk-UYTYNCMZ.js";
43
+ import "./chunk-4FJSAUKB.js";
44
+ import "./chunk-MIRKTVH4.js";
45
+ import "./chunk-S37PZD6I.js";
45
46
  import {
46
47
  isDev
47
- } from "./chunk-NYNYSPK7.js";
48
+ } from "./chunk-NT3ZYB5S.js";
49
+ import "./chunk-R5U7XKVJ.js";
48
50
 
49
51
  // src/devtools/signalGraph.ts
50
52
  function getHook() {
@@ -11,7 +11,9 @@ import {
11
11
  reportDrainRunaway,
12
12
  unregisterDisposer,
13
13
  withDisposerRollback
14
- } from "./chunk-NYNYSPK7.js";
14
+ } from "./chunk-S37PZD6I.js";
15
+ import "./chunk-NT3ZYB5S.js";
16
+ import "./chunk-R5U7XKVJ.js";
15
17
  export {
16
18
  MAX_DRAIN_TEARDOWNS,
17
19
  beginDisposerCapture,
@@ -103,12 +103,12 @@ function claimedByBoundary(error, context) {
103
103
  }
104
104
  function resolveEventTarget(node) {
105
105
  const ELEMENT_NODE = 1;
106
- let current = node;
107
- while (current) {
108
- if (current.nodeType === ELEMENT_NODE && typeof current.dispatchEvent === "function") {
109
- return current;
106
+ let current2 = node;
107
+ while (current2) {
108
+ if (current2.nodeType === ELEMENT_NODE && typeof current2.dispatchEvent === "function") {
109
+ return current2;
110
110
  }
111
- current = current.parentNode;
111
+ current2 = current2.parentNode;
112
112
  }
113
113
  const self = node;
114
114
  return typeof self.dispatchEvent === "function" ? self : null;
@@ -117,10 +117,21 @@ function defaultReport(error, context) {
117
117
  if (typeof console === "undefined") return;
118
118
  console.error(`[SibuJS] Uncaught error during ${describe(context)}: ${error.message}`, error);
119
119
  }
120
+ function requestErrorSink() {
121
+ const shared = globalThis[/* @__PURE__ */ Symbol.for("sibujs.ssr.v1")];
122
+ if (!shared) return void 0;
123
+ const store = shared.als ? shared.als.getStore() : shared.fallbackDepth > 0 ? shared.fallbackStore : void 0;
124
+ return store?.errors;
125
+ }
120
126
  function reportError(error, context) {
121
127
  const err = normalizeError(error);
122
128
  untrackedRun(() => {
123
129
  if (claimedByBoundary(err, context)) return;
130
+ const sink = requestErrorSink();
131
+ if (sink) {
132
+ sink.push({ error: err, context });
133
+ return;
134
+ }
124
135
  const s = state();
125
136
  const handler = s.handler;
126
137
  if (handler && s.handlerDepth === 0) {
@@ -141,6 +152,31 @@ function reportError(error, context) {
141
152
  });
142
153
  }
143
154
 
155
+ // src/core/rendering/adoptScope.ts
156
+ var current = null;
157
+ function createScopedElement(tag, ns) {
158
+ const c = current;
159
+ if (c?.s.on) {
160
+ const el = c.s.el(tag, ns, c.p + (c.n++).toString(36));
161
+ if (el) return el;
162
+ }
163
+ return ns ? document.createElementNS(ns, tag) : document.createElement(tag);
164
+ }
165
+ function captureScope() {
166
+ const c = current;
167
+ return c?.s.on ? { p: `${c.p}${(c.n++).toString(36)}.`, n: 0, s: c.s } : null;
168
+ }
169
+ function inScope(scope, fn) {
170
+ const prev = current;
171
+ if (!scope && !prev) return fn();
172
+ current = scope?.s.on ? { p: scope.p, n: 0, s: scope.s } : null;
173
+ try {
174
+ return fn();
175
+ } finally {
176
+ current = prev;
177
+ }
178
+ }
179
+
144
180
  // src/core/rendering/dispose.ts
145
181
  var elementDisposers = /* @__PURE__ */ new WeakMap();
146
182
  var MAX_DRAIN_TEARDOWNS = 1e4;
@@ -184,9 +220,9 @@ function dispose(node) {
184
220
  const stack = [node];
185
221
  const order = [];
186
222
  while (stack.length > 0) {
187
- const current = stack.pop();
188
- order.push(current);
189
- const children = Array.from(current.childNodes);
223
+ const current2 = stack.pop();
224
+ order.push(current2);
225
+ const children = Array.from(current2.childNodes);
190
226
  for (let i = 0; i < children.length; i++) {
191
227
  stack.push(children[i]);
192
228
  }
@@ -793,7 +829,7 @@ function forEachSubscriber(signal2, visit) {
793
829
  }
794
830
 
795
831
  // src/reactivity/track.ts
796
- var _runtimeVersion = true ? "4.13.0" : "dev";
832
+ var _runtimeVersion = true ? "4.14.0" : "dev";
797
833
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
798
834
  function resolveReactiveApi() {
799
835
  const g = globalThis;
@@ -880,6 +916,8 @@ function detectSSRShared() {
880
916
  }
881
917
  if (mod) detected = new mod.AsyncLocalStorage();
882
918
  }
919
+ const globalAls = globalThis.AsyncLocalStorage;
920
+ if (!detected && typeof globalAls === "function") detected = new globalAls();
883
921
  } catch {
884
922
  detected = null;
885
923
  }
@@ -968,7 +1006,7 @@ function disposeEffect(ctx) {
968
1006
  }
969
1007
  function effect(effectFn, options) {
970
1008
  devAssert(typeof effectFn === "function", "effect: argument must be a function.");
971
- if (isSSR()) return () => {
1009
+ if (isSSR() && !options?.server) return () => {
972
1010
  };
973
1011
  const ctx = {
974
1012
  fn: effectFn,
@@ -1628,19 +1666,19 @@ function sanitizeSrcset(value) {
1628
1666
  if (url.endsWith(",")) {
1629
1667
  url = url.replace(/,+$/, "");
1630
1668
  } else {
1631
- let current = "";
1669
+ let current2 = "";
1632
1670
  let inParens = false;
1633
1671
  while (i < n) {
1634
1672
  const ch = input[i];
1635
1673
  if (inParens) {
1636
- current += ch;
1674
+ current2 += ch;
1637
1675
  if (ch === ")") inParens = false;
1638
1676
  i++;
1639
1677
  continue;
1640
1678
  }
1641
1679
  if (isSrcsetWhitespace(ch)) {
1642
- if (current) descriptors.push(current);
1643
- current = "";
1680
+ if (current2) descriptors.push(current2);
1681
+ current2 = "";
1644
1682
  i++;
1645
1683
  continue;
1646
1684
  }
@@ -1649,10 +1687,10 @@ function sanitizeSrcset(value) {
1649
1687
  break;
1650
1688
  }
1651
1689
  if (ch === "(") inParens = true;
1652
- current += ch;
1690
+ current2 += ch;
1653
1691
  i++;
1654
1692
  }
1655
- if (current) descriptors.push(current);
1693
+ if (current2) descriptors.push(current2);
1656
1694
  }
1657
1695
  if (url === "") continue;
1658
1696
  if (descriptors.length > 1) continue;
@@ -2221,8 +2259,8 @@ function commitSafeAttribute(el, name, value, options) {
2221
2259
  else el.removeAttribute(name);
2222
2260
  return true;
2223
2261
  }
2224
- const current = ns ? el.getAttributeNS(ns, localName) : el.getAttribute(name);
2225
- if (current === safe) return true;
2262
+ const current2 = ns ? el.getAttributeNS(ns, localName) : el.getAttribute(name);
2263
+ if (current2 === safe) return true;
2226
2264
  if (ns) el.setAttributeNS(ns, name, safe);
2227
2265
  else el.setAttribute(name, safe);
2228
2266
  return true;
@@ -2353,10 +2391,11 @@ function restoreFocusWithin(snapshot, nodes, where, policy) {
2353
2391
  // src/reactivity/bindChildNode.ts
2354
2392
  function bindChildNode(placeholder, getter) {
2355
2393
  let lastNodes = [];
2394
+ const scope = captureScope();
2356
2395
  function commit() {
2357
2396
  let result;
2358
2397
  try {
2359
- result = getter();
2398
+ result = inScope(scope, getter);
2360
2399
  } catch (err) {
2361
2400
  reportError(err, { phase: "binding", name: "bindChildNode", node: placeholder });
2362
2401
  return;
@@ -2611,7 +2650,7 @@ function tagFactory(tag, ns) {
2611
2650
  throw new Error(`tagFactory: refusing to create <${tag}> \u2014 tag is blocked for security reasons.`);
2612
2651
  }
2613
2652
  if (typeof document === "undefined") noDocument();
2614
- const el = ns ? document.createElementNS(ns, tag) : document.createElement(tag);
2653
+ const el = createScopedElement(tag, ns);
2615
2654
  if (first === void 0) return el;
2616
2655
  if (typeof first === "string") {
2617
2656
  if (second !== void 0) {
@@ -2802,9 +2841,9 @@ function componentAdapter(config) {
2802
2841
  components[name] = (props = {}, children) => {
2803
2842
  const { variant, size, class: userClass, ...rest } = props;
2804
2843
  const themeClasses = () => {
2805
- const current = theme.config();
2806
- const overrides = current.classOverrides ?? {};
2807
- const pick = (key, fallback) => Object.hasOwn(overrides, key) ? overrides[key] : reprefix(fallback, current.prefix);
2844
+ const current2 = theme.config();
2845
+ const overrides = current2.classOverrides ?? {};
2846
+ const pick = (key, fallback) => Object.hasOwn(overrides, key) ? overrides[key] : reprefix(fallback, current2.prefix);
2808
2847
  const classes = [pick(name, mapping.baseClass)];
2809
2848
  const variantClass = ownString(mapping.variants, variant);
2810
2849
  if (variant && variantClass) {
package/dist/ecosystem.js CHANGED
@@ -7,20 +7,22 @@ import {
7
7
  mobXAdapter,
8
8
  reduxAdapter,
9
9
  zustandAdapter
10
- } from "./chunk-7K7W4AA5.js";
11
- import "./chunk-J6FW5TV6.js";
12
- import "./chunk-346BYZL2.js";
13
- import "./chunk-HDKDBC6V.js";
14
- import "./chunk-F2UWOZ6J.js";
15
- import "./chunk-YJ57VR6Y.js";
10
+ } from "./chunk-2TTRW2TE.js";
11
+ import "./chunk-3HEX6QJQ.js";
12
+ import "./chunk-CJ7KS3DF.js";
13
+ import "./chunk-HQIAL7F2.js";
14
+ import "./chunk-RVWJGWCL.js";
15
+ import "./chunk-N7A6FKWW.js";
16
16
  import "./chunk-7ZHH77QA.js";
17
- import "./chunk-BRRRVLHQ.js";
18
- import "./chunk-EXXSN3BW.js";
19
- import "./chunk-7XHATCIH.js";
17
+ import "./chunk-AE32RGWX.js";
18
+ import "./chunk-B3HOT4TK.js";
19
+ import "./chunk-UYTYNCMZ.js";
20
20
  import "./chunk-5HZXGZ6T.js";
21
- import "./chunk-GNSRXK34.js";
22
- import "./chunk-HVVRXRGO.js";
23
- import "./chunk-NYNYSPK7.js";
21
+ import "./chunk-4FJSAUKB.js";
22
+ import "./chunk-MIRKTVH4.js";
23
+ import "./chunk-S37PZD6I.js";
24
+ import "./chunk-NT3ZYB5S.js";
25
+ import "./chunk-R5U7XKVJ.js";
24
26
  export {
25
27
  antdAdapter,
26
28
  chakraAdapter,