sibujs 3.3.1 → 3.3.2

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 (60) hide show
  1. package/dist/browser.cjs +21 -15
  2. package/dist/browser.js +5 -5
  3. package/dist/build.cjs +48 -20
  4. package/dist/build.js +13 -13
  5. package/dist/cdn.global.js +7 -7
  6. package/dist/{chunk-IKLYI3RF.js → chunk-2ARSB7NG.js} +36 -13
  7. package/dist/{chunk-TEFZT5PJ.js → chunk-4NJEAPLI.js} +1 -1
  8. package/dist/{chunk-F7FXQ3QS.js → chunk-5VH3GIDX.js} +1 -1
  9. package/dist/{chunk-RYMOSG5B.js → chunk-62V653X2.js} +16 -21
  10. package/dist/{chunk-XH2RTYEQ.js → chunk-655B7MMR.js} +3 -3
  11. package/dist/{chunk-37BUKSLH.js → chunk-6TCOWMGY.js} +1 -1
  12. package/dist/{chunk-6LTFHJQG.js → chunk-A7CZH3GN.js} +3 -3
  13. package/dist/{chunk-ULLTNDRA.js → chunk-AEOLHSSQ.js} +3 -3
  14. package/dist/chunk-CCSJMTRN.js +15 -0
  15. package/dist/{chunk-R3QEDXFS.js → chunk-EX77FXTT.js} +1 -1
  16. package/dist/{chunk-ZUVLC7TM.js → chunk-FJIRS3FM.js} +1 -1
  17. package/dist/{chunk-Z37APKBV.js → chunk-FJO2ZL4Q.js} +4 -4
  18. package/dist/{chunk-WW6DAGGR.js → chunk-G6N3LMO2.js} +1 -1
  19. package/dist/{chunk-WL7BIR6O.js → chunk-IQJ36UTJ.js} +1 -1
  20. package/dist/{chunk-WZG2SZOT.js → chunk-JCQG2I2G.js} +1 -1
  21. package/dist/{chunk-MHBCEJQO.js → chunk-N5TQVEKE.js} +2 -2
  22. package/dist/{chunk-4UUMSLSL.js → chunk-P7C7SEJV.js} +4 -4
  23. package/dist/{chunk-VOVVTOEA.js → chunk-Q46YIQYW.js} +2 -2
  24. package/dist/{chunk-NHKQKKZU.js → chunk-QCFBIVIQ.js} +1 -1
  25. package/dist/{chunk-SLMFA3ZZ.js → chunk-RLTFJYDN.js} +2 -2
  26. package/dist/{chunk-GOJMFRBL.js → chunk-S3NFJO6L.js} +20 -14
  27. package/dist/{chunk-AMIKDMLP.js → chunk-YUBEOWII.js} +5 -5
  28. package/dist/{chunk-M5KBNOSJ.js → chunk-YUR5SX7F.js} +2 -2
  29. package/dist/{chunk-LU2MQXQQ.js → chunk-ZEUP4TUD.js} +2 -2
  30. package/dist/data.cjs +21 -15
  31. package/dist/data.js +7 -7
  32. package/dist/devtools.cjs +21 -15
  33. package/dist/devtools.js +5 -5
  34. package/dist/ecosystem.cjs +21 -15
  35. package/dist/ecosystem.js +8 -8
  36. package/dist/extras.cjs +32 -31
  37. package/dist/extras.js +22 -22
  38. package/dist/index.cjs +50 -20
  39. package/dist/index.d.cts +20 -7
  40. package/dist/index.d.ts +20 -7
  41. package/dist/index.js +17 -13
  42. package/dist/motion.cjs +1 -1
  43. package/dist/motion.js +3 -3
  44. package/dist/patterns.cjs +21 -15
  45. package/dist/patterns.js +6 -6
  46. package/dist/performance.cjs +21 -15
  47. package/dist/performance.js +6 -6
  48. package/dist/plugins.cjs +110 -103
  49. package/dist/plugins.js +95 -94
  50. package/dist/{ssr-6D67RAVB.js → ssr-2PPULEK2.js} +2 -2
  51. package/dist/ssr.cjs +21 -15
  52. package/dist/ssr.js +9 -9
  53. package/dist/testing.cjs +21 -15
  54. package/dist/testing.js +3 -3
  55. package/dist/ui.cjs +36 -34
  56. package/dist/ui.js +8 -8
  57. package/dist/widgets.cjs +21 -15
  58. package/dist/widgets.js +7 -7
  59. package/package.json +1 -1
  60. package/dist/chunk-YT6HQ6AM.js +0 -14
package/dist/plugins.js CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  preloadCritical,
19
19
  prerenderRoutes,
20
20
  satisfies
21
- } from "./chunk-ZUVLC7TM.js";
21
+ } from "./chunk-FJIRS3FM.js";
22
22
  import {
23
23
  isUnsafeKey
24
24
  } from "./chunk-H3SRKIYX.js";
@@ -35,14 +35,14 @@ import {
35
35
  } from "./chunk-3JHCYHWN.js";
36
36
  import {
37
37
  span
38
- } from "./chunk-37BUKSLH.js";
38
+ } from "./chunk-6TCOWMGY.js";
39
39
  import {
40
40
  escapeScriptJson,
41
41
  isDangerousMetaRefresh,
42
42
  renderToString
43
- } from "./chunk-R3QEDXFS.js";
44
- import "./chunk-LU2MQXQQ.js";
45
- import "./chunk-NHKQKKZU.js";
43
+ } from "./chunk-EX77FXTT.js";
44
+ import "./chunk-ZEUP4TUD.js";
45
+ import "./chunk-QCFBIVIQ.js";
46
46
  import {
47
47
  dispose,
48
48
  registerDisposer
@@ -55,14 +55,14 @@ import {
55
55
  } from "./chunk-L3GAGWCC.js";
56
56
  import {
57
57
  effect
58
- } from "./chunk-MHBCEJQO.js";
59
- import "./chunk-GOJMFRBL.js";
58
+ } from "./chunk-N5TQVEKE.js";
59
+ import "./chunk-S3NFJO6L.js";
60
60
  import {
61
61
  signal
62
- } from "./chunk-WZG2SZOT.js";
62
+ } from "./chunk-JCQG2I2G.js";
63
63
  import {
64
64
  track
65
- } from "./chunk-TEFZT5PJ.js";
65
+ } from "./chunk-4NJEAPLI.js";
66
66
  import "./chunk-COY6PUD2.js";
67
67
 
68
68
  // src/plugins/i18n.ts
@@ -864,7 +864,8 @@ var NavigationFailureError = class extends Error {
864
864
  };
865
865
  }
866
866
  };
867
- var globalRouter = null;
867
+ var ROUTER_KEY = /* @__PURE__ */ Symbol.for("sibujs.router.v1");
868
+ var _routerRef = globalThis[ROUTER_KEY] ?? (globalThis[ROUTER_KEY] = { current: null });
868
869
  function normalizeRoutes(routes) {
869
870
  return routes.map((route2) => {
870
871
  const normalizedChildren = route2.children && route2.children.length > 0 ? normalizeRoutes(route2.children) : route2.children;
@@ -884,8 +885,8 @@ function normalizeRoutes(routes) {
884
885
  });
885
886
  }
886
887
  function createRouter(routesOrOptions, options = {}) {
887
- if (globalRouter) {
888
- globalRouter.destroy();
888
+ if (_routerRef.current) {
889
+ _routerRef.current.destroy();
889
890
  }
890
891
  let routes;
891
892
  if (Array.isArray(routesOrOptions)) {
@@ -894,69 +895,69 @@ function createRouter(routesOrOptions, options = {}) {
894
895
  options = routesOrOptions;
895
896
  routes = [];
896
897
  }
897
- globalRouter = new SibuRouter(routes, options);
898
+ _routerRef.current = new SibuRouter(routes, options);
898
899
  ensureRouterPagehide();
899
- return globalRouter;
900
+ return _routerRef.current;
900
901
  }
901
902
  function setRoutes(routes) {
902
- if (!globalRouter) throw new Error("Router not initialized. Call createRouter() first.");
903
- globalRouter.updateRoutes(normalizeRoutes(routes));
903
+ if (!_routerRef.current) throw new Error("Router not initialized. Call createRouter() first.");
904
+ _routerRef.current.updateRoutes(normalizeRoutes(routes));
904
905
  }
905
906
  function route() {
906
- if (!globalRouter) throw new Error("Router not initialized. Call createRouter() first.");
907
- return globalRouter.currentRoute;
907
+ if (!_routerRef.current) throw new Error("Router not initialized. Call createRouter() first.");
908
+ return _routerRef.current.currentRoute;
908
909
  }
909
910
  function router() {
910
- if (!globalRouter) throw new Error("Router not initialized. Call createRouter() first.");
911
+ if (!_routerRef.current) throw new Error("Router not initialized. Call createRouter() first.");
911
912
  return {
912
- currentRoute: globalRouter.currentRoute,
913
- isReady: globalRouter.isReady,
914
- isNavigating: globalRouter.isNavigating,
915
- push: (to) => globalRouter?.push(to),
916
- replace: (to) => globalRouter?.replace(to),
917
- go: (delta) => globalRouter?.go(delta),
918
- back: () => globalRouter?.back(),
919
- forward: () => globalRouter?.forward(),
920
- beforeEach: (guard) => globalRouter?.beforeEach(guard),
921
- beforeResolve: (guard) => globalRouter?.beforeResolve(guard),
922
- afterEach: (hook) => globalRouter?.afterEach(hook)
913
+ currentRoute: _routerRef.current.currentRoute,
914
+ isReady: _routerRef.current.isReady,
915
+ isNavigating: _routerRef.current.isNavigating,
916
+ push: (to) => _routerRef.current?.push(to),
917
+ replace: (to) => _routerRef.current?.replace(to),
918
+ go: (delta) => _routerRef.current?.go(delta),
919
+ back: () => _routerRef.current?.back(),
920
+ forward: () => _routerRef.current?.forward(),
921
+ beforeEach: (guard) => _routerRef.current?.beforeEach(guard),
922
+ beforeResolve: (guard) => _routerRef.current?.beforeResolve(guard),
923
+ afterEach: (hook) => _routerRef.current?.afterEach(hook)
923
924
  };
924
925
  }
925
926
  function navigate(to, options) {
926
- if (!globalRouter) throw new Error("Router not initialized. Call createRouter() first.");
927
- return globalRouter.navigate(to, options);
927
+ if (!_routerRef.current) throw new Error("Router not initialized. Call createRouter() first.");
928
+ return _routerRef.current.navigate(to, options);
928
929
  }
929
930
  function push(to) {
930
- if (!globalRouter) throw new Error("Router not initialized. Call createRouter() first.");
931
- return globalRouter.push(to);
931
+ if (!_routerRef.current) throw new Error("Router not initialized. Call createRouter() first.");
932
+ return _routerRef.current.push(to);
932
933
  }
933
934
  function replace(to) {
934
- if (!globalRouter) throw new Error("Router not initialized. Call createRouter() first.");
935
- return globalRouter.replace(to);
935
+ if (!_routerRef.current) throw new Error("Router not initialized. Call createRouter() first.");
936
+ return _routerRef.current.replace(to);
936
937
  }
937
938
  function go(delta) {
938
- if (!globalRouter) throw new Error("Router not initialized. Call createRouter() first.");
939
- globalRouter.go(delta);
939
+ if (!_routerRef.current) throw new Error("Router not initialized. Call createRouter() first.");
940
+ _routerRef.current.go(delta);
940
941
  }
941
942
  function back() {
942
- if (!globalRouter) throw new Error("Router not initialized. Call createRouter() first.");
943
- globalRouter.back();
943
+ if (!_routerRef.current) throw new Error("Router not initialized. Call createRouter() first.");
944
+ _routerRef.current.back();
944
945
  }
945
946
  function forward() {
946
- if (!globalRouter) throw new Error("Router not initialized. Call createRouter() first.");
947
- globalRouter.forward();
947
+ if (!_routerRef.current) throw new Error("Router not initialized. Call createRouter() first.");
948
+ _routerRef.current.forward();
948
949
  }
949
950
  function beforeEach(guard) {
950
- if (!globalRouter) throw new Error("Router not initialized. Call createRouter() first.");
951
- return globalRouter.beforeEach(guard);
951
+ if (!_routerRef.current) throw new Error("Router not initialized. Call createRouter() first.");
952
+ return _routerRef.current.beforeEach(guard);
952
953
  }
953
954
  function beforeResolve(guard) {
954
- if (!globalRouter) throw new Error("Router not initialized. Call createRouter() first.");
955
- return globalRouter.beforeResolve(guard);
955
+ if (!_routerRef.current) throw new Error("Router not initialized. Call createRouter() first.");
956
+ return _routerRef.current.beforeResolve(guard);
956
957
  }
957
958
  function afterEach(hook) {
958
- if (!globalRouter) throw new Error("Router not initialized. Call createRouter() first.");
959
- return globalRouter.afterEach(hook);
959
+ if (!_routerRef.current) throw new Error("Router not initialized. Call createRouter() first.");
960
+ return _routerRef.current.afterEach(hook);
960
961
  }
961
962
  var routeCleanups = [];
962
963
  function Route() {
@@ -1030,8 +1031,8 @@ function Route() {
1030
1031
  retryButton.className = "route-error-retry";
1031
1032
  retryButton.type = "button";
1032
1033
  const onRetryClick = () => {
1033
- if (globalRouter) {
1034
- globalRouter.clearErrorCache();
1034
+ if (_routerRef.current) {
1035
+ _routerRef.current.clearErrorCache();
1035
1036
  update();
1036
1037
  }
1037
1038
  };
@@ -1043,11 +1044,11 @@ function Route() {
1043
1044
  anchor.parentNode.insertBefore(errorNode, anchor.nextSibling);
1044
1045
  };
1045
1046
  const update = async () => {
1046
- if (!globalRouter) return;
1047
+ if (!_routerRef.current) return;
1047
1048
  const seq = ++navSeq;
1048
- const route2 = globalRouter.currentRoute;
1049
+ const route2 = _routerRef.current.currentRoute;
1049
1050
  try {
1050
- const match = globalRouter["matcher"].match(route2.path);
1051
+ const match = _routerRef.current["matcher"].match(route2.path);
1051
1052
  if (!match) {
1052
1053
  currentTopRoute = null;
1053
1054
  cleanupNodes();
@@ -1060,7 +1061,7 @@ function Route() {
1060
1061
  if ("redirect" in routeDef) {
1061
1062
  const redirectPath = typeof routeDef.redirect === "function" ? routeDef.redirect(route2) : routeDef.redirect;
1062
1063
  queueMicrotask(() => {
1063
- globalRouter?.navigate(redirectPath).catch((err) => {
1064
+ _routerRef.current?.navigate(redirectPath).catch((err) => {
1064
1065
  if (typeof console !== "undefined") console.error("[router] redirect failed:", err);
1065
1066
  });
1066
1067
  });
@@ -1072,7 +1073,7 @@ function Route() {
1072
1073
  if (isAsync) {
1073
1074
  showLoading();
1074
1075
  }
1075
- const component = await globalRouter.loadComponent(routeDef, route2.path);
1076
+ const component = await _routerRef.current.loadComponent(routeDef, route2.path);
1076
1077
  if (seq !== navSeq) return;
1077
1078
  const node = component();
1078
1079
  if (node && anchor.parentNode) {
@@ -1113,11 +1114,11 @@ function Route() {
1113
1114
  return anchor;
1114
1115
  }
1115
1116
  function KeepAliveRoute(options) {
1116
- if (!globalRouter) throw new Error("Router not initialized. Call createRouter() first.");
1117
+ if (!_routerRef.current) throw new Error("Router not initialized. Call createRouter() first.");
1117
1118
  const anchor = document.createComment("keep-alive-route");
1118
1119
  const cache = /* @__PURE__ */ new Map();
1119
1120
  const lruOrder = [];
1120
- const routerOpts = globalRouter["options"];
1121
+ const routerOpts = _routerRef.current["options"];
1121
1122
  const keepAliveOpt = routerOpts.keepAlive;
1122
1123
  const maxCache = options?.max ?? (typeof keepAliveOpt === "number" ? keepAliveOpt : 20);
1123
1124
  const includeNames = options?.include ?? (Array.isArray(keepAliveOpt) ? keepAliveOpt : void 0);
@@ -1127,19 +1128,19 @@ function KeepAliveRoute(options) {
1127
1128
  let isUpdating = false;
1128
1129
  let pendingUpdate = false;
1129
1130
  const update = async () => {
1130
- if (!globalRouter) return;
1131
+ if (!_routerRef.current) return;
1131
1132
  if (isUpdating) {
1132
1133
  pendingUpdate = true;
1133
1134
  return;
1134
1135
  }
1135
- const route2 = globalRouter.currentRoute;
1136
- const match = globalRouter["matcher"].match(route2.path);
1136
+ const route2 = _routerRef.current.currentRoute;
1137
+ const match = _routerRef.current["matcher"].match(route2.path);
1137
1138
  if (!match) return;
1138
1139
  const { route: routeDef } = match;
1139
1140
  if ("redirect" in routeDef) {
1140
1141
  const redirectPath = typeof routeDef.redirect === "function" ? routeDef.redirect(route2) : routeDef.redirect;
1141
1142
  queueMicrotask(() => {
1142
- globalRouter?.navigate(redirectPath).catch((err) => {
1143
+ _routerRef.current?.navigate(redirectPath).catch((err) => {
1143
1144
  if (typeof console !== "undefined") console.error("[router] redirect failed:", err);
1144
1145
  });
1145
1146
  });
@@ -1172,9 +1173,9 @@ function KeepAliveRoute(options) {
1172
1173
  }
1173
1174
  lruOrder.push(cacheKey);
1174
1175
  } else {
1175
- const component = await globalRouter.loadComponent(routeDef, route2.path);
1176
+ const component = await _routerRef.current.loadComponent(routeDef, route2.path);
1176
1177
  const node = component();
1177
- if (!node || route2.path !== globalRouter.currentRoute.path) {
1178
+ if (!node || route2.path !== _routerRef.current.currentRoute.path) {
1178
1179
  isUpdating = false;
1179
1180
  return;
1180
1181
  }
@@ -1233,11 +1234,11 @@ function KeepAliveRoute(options) {
1233
1234
  return anchor;
1234
1235
  }
1235
1236
  function RouterLink(props) {
1236
- if (!globalRouter) throw new Error("Router not initialized. Call createRouter() first.");
1237
+ if (!_routerRef.current) throw new Error("Router not initialized. Call createRouter() first.");
1237
1238
  const { to, replace: replace2 = false, activeClass, exactActiveClass, nodes, target, rel, class: classAttr, ...attrs } = props;
1238
1239
  const baseClass = typeof classAttr === "string" ? classAttr : "";
1239
- const routeGetter = globalRouter.routeGetter;
1240
- const rawHref = globalRouter["resolvePath"](to);
1240
+ const routeGetter = _routerRef.current.routeGetter;
1241
+ const rawHref = _routerRef.current["resolvePath"](to);
1241
1242
  const href = isSafeNavigationTarget(rawHref) ? rawHref : "#";
1242
1243
  const hrefPath = href.split("?")[0].split("#")[0];
1243
1244
  const link = document.createElement("a");
@@ -1252,7 +1253,7 @@ function RouterLink(props) {
1252
1253
  } else if (rel) {
1253
1254
  link.rel = rel;
1254
1255
  }
1255
- const options = globalRouter["options"];
1256
+ const options = _routerRef.current["options"];
1256
1257
  const effectCleanup = effect(() => {
1257
1258
  const route2 = routeGetter();
1258
1259
  const isActive = route2.path.startsWith(hrefPath);
@@ -1302,7 +1303,7 @@ function RouterLink(props) {
1302
1303
  return;
1303
1304
  }
1304
1305
  e.preventDefault();
1305
- globalRouter?.navigate(to, { replace: replace2 }).catch((err) => {
1306
+ _routerRef.current?.navigate(to, { replace: replace2 }).catch((err) => {
1306
1307
  if (typeof console !== "undefined") console.error("[router] link navigate failed:", err);
1307
1308
  });
1308
1309
  };
@@ -1388,35 +1389,35 @@ function lazy(importFn) {
1388
1389
  return importFn;
1389
1390
  }
1390
1391
  async function preloadRoute(to) {
1391
- if (!globalRouter) throw new Error("Router not initialized. Call createRouter() first.");
1392
- const path = globalRouter["resolvePath"](to);
1393
- const match = globalRouter["matcher"].match(path.split("?")[0].split("#")[0]);
1392
+ if (!_routerRef.current) throw new Error("Router not initialized. Call createRouter() first.");
1393
+ const path = _routerRef.current["resolvePath"](to);
1394
+ const match = _routerRef.current["matcher"].match(path.split("?")[0].split("#")[0]);
1394
1395
  if (match && "component" in match.route) {
1395
1396
  try {
1396
- await globalRouter.loadComponent(match.route, path);
1397
+ await _routerRef.current.loadComponent(match.route, path);
1397
1398
  } catch (error) {
1398
1399
  console.warn("[Router] Preload failed:", error);
1399
1400
  }
1400
1401
  }
1401
1402
  }
1402
1403
  function hasRoute(name) {
1403
- if (!globalRouter) return false;
1404
- return globalRouter["matcher"].findByName(name) !== null;
1404
+ if (!_routerRef.current) return false;
1405
+ return _routerRef.current["matcher"].findByName(name) !== null;
1405
1406
  }
1406
1407
  function getRouteInfo(name) {
1407
- if (!globalRouter) return null;
1408
- return globalRouter["matcher"].findByName(name);
1408
+ if (!_routerRef.current) return null;
1409
+ return _routerRef.current["matcher"].findByName(name);
1409
1410
  }
1410
1411
  function buildURL(to) {
1411
- if (!globalRouter) throw new Error("Router not initialized. Call createRouter() first.");
1412
- return globalRouter["resolvePath"](to);
1412
+ if (!_routerRef.current) throw new Error("Router not initialized. Call createRouter() first.");
1413
+ return _routerRef.current["resolvePath"](to);
1413
1414
  }
1414
1415
  function destroyRouter() {
1415
1416
  for (const fn of routeCleanups) fn();
1416
1417
  routeCleanups.length = 0;
1417
- if (globalRouter) {
1418
- globalRouter.destroy();
1419
- globalRouter = null;
1418
+ if (_routerRef.current) {
1419
+ _routerRef.current.destroy();
1420
+ _routerRef.current = null;
1420
1421
  }
1421
1422
  }
1422
1423
  var _routerPagehideHandler = null;
@@ -1449,9 +1450,9 @@ function Outlet() {
1449
1450
  currentChild = null;
1450
1451
  };
1451
1452
  const update = async () => {
1452
- if (!globalRouter) return;
1453
+ if (!_routerRef.current) return;
1453
1454
  const seq = ++navSeq;
1454
- const route2 = globalRouter.currentRoute;
1455
+ const route2 = _routerRef.current.currentRoute;
1455
1456
  if (route2.matched.length < 2) {
1456
1457
  clearCurrent();
1457
1458
  return;
@@ -1464,7 +1465,7 @@ function Outlet() {
1464
1465
  if (childRoute === currentChild && currentNode) return;
1465
1466
  try {
1466
1467
  const cacheKey = `${route2.path}\0${childRoute.path}`;
1467
- const component = await globalRouter.loadComponent(childRoute, cacheKey);
1468
+ const component = await _routerRef.current.loadComponent(childRoute, cacheKey);
1468
1469
  if (seq !== navSeq) return;
1469
1470
  const node = component();
1470
1471
  if (node && anchor.parentNode) {
@@ -1495,16 +1496,16 @@ function Outlet() {
1495
1496
  return anchor;
1496
1497
  }
1497
1498
  function addRoute(route2, parentPath) {
1498
- if (!globalRouter) throw new Error("Router not initialized. Call createRouter() first.");
1499
- globalRouter.addRoute(route2, parentPath);
1499
+ if (!_routerRef.current) throw new Error("Router not initialized. Call createRouter() first.");
1500
+ _routerRef.current.addRoute(route2, parentPath);
1500
1501
  }
1501
1502
  function removeRoute(path) {
1502
- if (!globalRouter) throw new Error("Router not initialized. Call createRouter() first.");
1503
- globalRouter.removeRoute(path);
1503
+ if (!_routerRef.current) throw new Error("Router not initialized. Call createRouter() first.");
1504
+ _routerRef.current.removeRoute(path);
1504
1505
  }
1505
1506
  function routerState() {
1506
- if (!globalRouter) throw new Error("Router not initialized. Call createRouter() first.");
1507
- const router2 = globalRouter;
1507
+ if (!_routerRef.current) throw new Error("Router not initialized. Call createRouter() first.");
1508
+ const router2 = _routerRef.current;
1508
1509
  return {
1509
1510
  currentPath: () => router2.currentRoute.path,
1510
1511
  params: () => router2.currentRoute.params,
@@ -1518,12 +1519,12 @@ function routerState() {
1518
1519
  var routerPlugins = [];
1519
1520
  function routerPlugin(plugin2) {
1520
1521
  routerPlugins.push(plugin2);
1521
- if (globalRouter?.isReady && plugin2.onReady) {
1522
+ if (_routerRef.current?.isReady && plugin2.onReady) {
1522
1523
  plugin2.onReady();
1523
1524
  }
1524
1525
  let removeGuard = null;
1525
- if (globalRouter && plugin2.onNavigate) {
1526
- removeGuard = globalRouter.afterEach((to, from) => {
1526
+ if (_routerRef.current && plugin2.onNavigate) {
1527
+ removeGuard = _routerRef.current.afterEach((to, from) => {
1527
1528
  plugin2.onNavigate?.(to, from);
1528
1529
  });
1529
1530
  }
@@ -1800,7 +1801,7 @@ function hydrateRouter(routes, options) {
1800
1801
  if (container && serverState.path) {
1801
1802
  const resolved = resolveServerRoute(serverState.path, routes);
1802
1803
  if (resolved.component) {
1803
- import("./ssr-6D67RAVB.js").then(({ hydrate }) => {
1804
+ import("./ssr-2PPULEK2.js").then(({ hydrate }) => {
1804
1805
  if (resolved.component) {
1805
1806
  hydrate(resolved.component, container);
1806
1807
  }
@@ -17,9 +17,9 @@ import {
17
17
  ssrSuspense,
18
18
  suspenseSwapScript,
19
19
  trustHTML
20
- } from "./chunk-R3QEDXFS.js";
20
+ } from "./chunk-EX77FXTT.js";
21
21
  import "./chunk-L3GAGWCC.js";
22
- import "./chunk-GOJMFRBL.js";
22
+ import "./chunk-S3NFJO6L.js";
23
23
  import "./chunk-COY6PUD2.js";
24
24
  export {
25
25
  collectStream,
package/dist/ssr.cjs CHANGED
@@ -87,23 +87,29 @@ function devWarn(message) {
87
87
  }
88
88
 
89
89
  // src/core/ssr-context.ts
90
- var als = null;
91
- try {
92
- if (typeof process !== "undefined" && process.versions && process.versions.node) {
93
- let mod = null;
94
- const getBuiltin = process.getBuiltinModule;
95
- if (typeof getBuiltin === "function") {
96
- mod = getBuiltin("node:async_hooks");
97
- } else {
98
- const req = Function("return typeof require==='function'?require:null")();
99
- if (req) mod = req("node:async_hooks");
90
+ var SSR_KEY = /* @__PURE__ */ Symbol.for("sibujs.ssr.v1");
91
+ function detectSSRShared() {
92
+ let detected = null;
93
+ try {
94
+ if (typeof process !== "undefined" && process.versions && process.versions.node) {
95
+ let mod = null;
96
+ const getBuiltin = process.getBuiltinModule;
97
+ if (typeof getBuiltin === "function") {
98
+ mod = getBuiltin("node:async_hooks");
99
+ } else {
100
+ const req = Function("return typeof require==='function'?require:null")();
101
+ if (req) mod = req("node:async_hooks");
102
+ }
103
+ if (mod) detected = new mod.AsyncLocalStorage();
100
104
  }
101
- if (mod) als = new mod.AsyncLocalStorage();
105
+ } catch {
106
+ detected = null;
102
107
  }
103
- } catch {
104
- als = null;
108
+ return { als: detected, fallbackStore: { ssr: false, suspenseIdCounter: 0 } };
105
109
  }
106
- var fallbackStore = { ssr: false, suspenseIdCounter: 0 };
110
+ var _shared = globalThis[SSR_KEY] ?? (globalThis[SSR_KEY] = detectSSRShared());
111
+ var als = _shared.als;
112
+ var fallbackStore = _shared.fallbackStore;
107
113
  function getSSRStore() {
108
114
  if (als) {
109
115
  const s2 = als.getStore();
@@ -1123,7 +1129,7 @@ function forEachSubscriber(signal2, visit) {
1123
1129
 
1124
1130
  // src/reactivity/track.ts
1125
1131
  var _isDev4 = isDev();
1126
- var _runtimeVersion = typeof __SIBU_VERSION__ !== "undefined" ? __SIBU_VERSION__ : "dev";
1132
+ var _runtimeVersion = true ? "3.3.2" : "dev";
1127
1133
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
1128
1134
  function resolveReactiveApi() {
1129
1135
  const g2 = globalThis;
package/dist/ssr.js CHANGED
@@ -22,8 +22,8 @@ import {
22
22
  wasm,
23
23
  worker,
24
24
  workerFn
25
- } from "./chunk-6LTFHJQG.js";
26
- import "./chunk-37BUKSLH.js";
25
+ } from "./chunk-A7CZH3GN.js";
26
+ import "./chunk-6TCOWMGY.js";
27
27
  import {
28
28
  collectStream,
29
29
  deserializeState,
@@ -43,15 +43,15 @@ import {
43
43
  ssrSuspense,
44
44
  suspenseSwapScript,
45
45
  trustHTML
46
- } from "./chunk-R3QEDXFS.js";
47
- import "./chunk-LU2MQXQQ.js";
48
- import "./chunk-NHKQKKZU.js";
46
+ } from "./chunk-EX77FXTT.js";
47
+ import "./chunk-ZEUP4TUD.js";
48
+ import "./chunk-QCFBIVIQ.js";
49
49
  import "./chunk-5VGSK6D2.js";
50
50
  import "./chunk-L3GAGWCC.js";
51
- import "./chunk-MHBCEJQO.js";
52
- import "./chunk-GOJMFRBL.js";
53
- import "./chunk-WZG2SZOT.js";
54
- import "./chunk-TEFZT5PJ.js";
51
+ import "./chunk-N5TQVEKE.js";
52
+ import "./chunk-S3NFJO6L.js";
53
+ import "./chunk-JCQG2I2G.js";
54
+ import "./chunk-4NJEAPLI.js";
55
55
  import "./chunk-COY6PUD2.js";
56
56
  export {
57
57
  Head,
package/dist/testing.cjs CHANGED
@@ -1980,7 +1980,7 @@ function forEachSubscriber(signal, visit) {
1980
1980
 
1981
1981
  // src/reactivity/track.ts
1982
1982
  var _isDev4 = isDev();
1983
- var _runtimeVersion = typeof __SIBU_VERSION__ !== "undefined" ? __SIBU_VERSION__ : "dev";
1983
+ var _runtimeVersion = true ? "3.3.2" : "dev";
1984
1984
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
1985
1985
  function resolveReactiveApi() {
1986
1986
  const g = globalThis;
@@ -2037,23 +2037,29 @@ var getSubscriberDeps2 = API.getSubscriberDeps;
2037
2037
  var forEachSubscriber2 = API.forEachSubscriber;
2038
2038
 
2039
2039
  // src/core/ssr-context.ts
2040
- var als = null;
2041
- try {
2042
- if (typeof process !== "undefined" && process.versions && process.versions.node) {
2043
- let mod = null;
2044
- const getBuiltin = process.getBuiltinModule;
2045
- if (typeof getBuiltin === "function") {
2046
- mod = getBuiltin("node:async_hooks");
2047
- } else {
2048
- const req = Function("return typeof require==='function'?require:null")();
2049
- if (req) mod = req("node:async_hooks");
2040
+ var SSR_KEY = /* @__PURE__ */ Symbol.for("sibujs.ssr.v1");
2041
+ function detectSSRShared() {
2042
+ let detected = null;
2043
+ try {
2044
+ if (typeof process !== "undefined" && process.versions && process.versions.node) {
2045
+ let mod = null;
2046
+ const getBuiltin = process.getBuiltinModule;
2047
+ if (typeof getBuiltin === "function") {
2048
+ mod = getBuiltin("node:async_hooks");
2049
+ } else {
2050
+ const req = Function("return typeof require==='function'?require:null")();
2051
+ if (req) mod = req("node:async_hooks");
2052
+ }
2053
+ if (mod) detected = new mod.AsyncLocalStorage();
2050
2054
  }
2051
- if (mod) als = new mod.AsyncLocalStorage();
2055
+ } catch {
2056
+ detected = null;
2052
2057
  }
2053
- } catch {
2054
- als = null;
2058
+ return { als: detected, fallbackStore: { ssr: false, suspenseIdCounter: 0 } };
2055
2059
  }
2056
- var fallbackStore = { ssr: false, suspenseIdCounter: 0 };
2060
+ var _shared = globalThis[SSR_KEY] ?? (globalThis[SSR_KEY] = detectSSRShared());
2061
+ var als = _shared.als;
2062
+ var fallbackStore = _shared.fallbackStore;
2057
2063
  function getSSRStore() {
2058
2064
  if (als) {
2059
2065
  const s = als.getStore();
package/dist/testing.js CHANGED
@@ -3,9 +3,9 @@ import {
3
3
  } from "./chunk-5VGSK6D2.js";
4
4
  import {
5
5
  effect
6
- } from "./chunk-MHBCEJQO.js";
7
- import "./chunk-GOJMFRBL.js";
8
- import "./chunk-TEFZT5PJ.js";
6
+ } from "./chunk-N5TQVEKE.js";
7
+ import "./chunk-S3NFJO6L.js";
8
+ import "./chunk-4NJEAPLI.js";
9
9
  import "./chunk-COY6PUD2.js";
10
10
 
11
11
  // src/testing/a11y.ts