sibujs 1.5.0 → 2.0.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 (207) hide show
  1. package/dist/browser.cjs +238 -69
  2. package/dist/browser.d.cts +5 -0
  3. package/dist/browser.d.ts +5 -0
  4. package/dist/browser.js +6 -6
  5. package/dist/build.cjs +916 -292
  6. package/dist/build.js +15 -13
  7. package/dist/cdn.global.js +17 -16
  8. package/dist/chunk-2RA7SHDA.js +65 -0
  9. package/dist/chunk-2UPRY23K.js +80 -0
  10. package/dist/chunk-3JHCYHWN.js +125 -0
  11. package/dist/{chunk-VAPYJN4X.js → chunk-3LR7GLWQ.js} +93 -23
  12. package/dist/{chunk-RJ46C3CS.js → chunk-3NSGB5JN.js} +71 -20
  13. package/dist/{chunk-XUEEGU5O.js → chunk-52YJLLRO.js} +16 -4
  14. package/dist/{chunk-XHK6BDAJ.js → chunk-54EDRCEF.js} +25 -8
  15. package/dist/chunk-7JDB7I65.js +1327 -0
  16. package/dist/{chunk-WZSPOOER.js → chunk-CC65Y57T.js} +8 -5
  17. package/dist/{chunk-23VV7YD3.js → chunk-DFPFITST.js} +25 -30
  18. package/dist/{chunk-BGN5ZMP4.js → chunk-GTBNNBJ6.js} +14 -2
  19. package/dist/chunk-HB24TBAF.js +121 -0
  20. package/dist/{chunk-CZUGLNJS.js → chunk-ITX6OO3F.js} +3 -3
  21. package/dist/{chunk-BGTHZHJ5.js → chunk-JA6667UN.js} +188 -44
  22. package/dist/{chunk-7GRNSCFT.js → chunk-JXMMDLBY.js} +306 -183
  23. package/dist/{chunk-3X2YG6YM.js → chunk-JYD2PWXH.js} +59 -28
  24. package/dist/{chunk-SFKNRVCU.js → chunk-KLRMB5ZS.js} +135 -79
  25. package/dist/{chunk-5X6PP2UK.js → chunk-LMLD24FC.js} +2 -2
  26. package/dist/{chunk-M4NLBH4I.js → chunk-LYTCUZ7H.js} +3 -2
  27. package/dist/{chunk-BMPL52BF.js → chunk-MIUAXB7K.js} +118 -66
  28. package/dist/{chunk-JCDUJN2F.js → chunk-ND2664SF.js} +486 -153
  29. package/dist/{chunk-VQDZK23A.js → chunk-O2MNQFLP.js} +181 -66
  30. package/dist/{chunk-NHUC2QWH.js → chunk-R73P76YZ.js} +1 -1
  31. package/dist/{chunk-2BYQDGN3.js → chunk-SAHNHTFC.js} +234 -63
  32. package/dist/chunk-UCS6AMJ7.js +79 -0
  33. package/dist/{chunk-K4G4ZQNR.js → chunk-VLPPXTYG.js} +84 -38
  34. package/dist/{chunk-OUZZEE4S.js → chunk-WOMYAHHI.js} +17 -11
  35. package/dist/{customElement-BL3Uo8dL.d.cts → customElement-CPfIrbvg.d.cts} +14 -10
  36. package/dist/{customElement-BL3Uo8dL.d.ts → customElement-CPfIrbvg.d.ts} +14 -10
  37. package/dist/data.cjs +410 -99
  38. package/dist/data.d.cts +20 -2
  39. package/dist/data.d.ts +20 -2
  40. package/dist/data.js +11 -9
  41. package/dist/devtools.cjs +513 -223
  42. package/dist/devtools.d.cts +1 -1
  43. package/dist/devtools.d.ts +1 -1
  44. package/dist/devtools.js +12 -6
  45. package/dist/ecosystem.cjs +475 -144
  46. package/dist/ecosystem.d.cts +9 -7
  47. package/dist/ecosystem.d.ts +9 -7
  48. package/dist/ecosystem.js +12 -11
  49. package/dist/extras.cjs +3355 -1541
  50. package/dist/extras.d.cts +9 -9
  51. package/dist/extras.d.ts +9 -9
  52. package/dist/extras.js +58 -45
  53. package/dist/index.cjs +920 -292
  54. package/dist/index.d.cts +71 -8
  55. package/dist/index.d.ts +71 -8
  56. package/dist/index.js +28 -16
  57. package/dist/{introspect-BumjnBKr.d.cts → introspect-BWNjNw64.d.cts} +22 -2
  58. package/dist/{introspect-CZrlcaYy.d.ts → introspect-cY2pg9pW.d.ts} +22 -2
  59. package/dist/motion.cjs +77 -34
  60. package/dist/motion.js +4 -4
  61. package/dist/patterns.cjs +335 -69
  62. package/dist/patterns.d.cts +11 -12
  63. package/dist/patterns.d.ts +11 -12
  64. package/dist/patterns.js +7 -7
  65. package/dist/performance.cjs +279 -108
  66. package/dist/performance.d.cts +23 -16
  67. package/dist/performance.d.ts +23 -16
  68. package/dist/performance.js +13 -8
  69. package/dist/plugin-D30wlGW5.d.cts +71 -0
  70. package/dist/plugin-D30wlGW5.d.ts +71 -0
  71. package/dist/plugins.cjs +635 -260
  72. package/dist/plugins.d.cts +10 -3
  73. package/dist/plugins.d.ts +10 -3
  74. package/dist/plugins.js +106 -38
  75. package/dist/{ssr-Do_SiVoL.d.cts → ssr-CrVNy6Pa.d.cts} +9 -15
  76. package/dist/{ssr-Do_SiVoL.d.ts → ssr-CrVNy6Pa.d.ts} +9 -15
  77. package/dist/{ssr-4PBXAOO3.js → ssr-FXD2PPMC.js} +4 -3
  78. package/dist/ssr.cjs +642 -222
  79. package/dist/ssr.d.cts +26 -6
  80. package/dist/ssr.d.ts +26 -6
  81. package/dist/ssr.js +12 -11
  82. package/dist/{tagFactory-DaJ0YWX6.d.cts → tagFactory-S17H2qxu.d.cts} +9 -1
  83. package/dist/{tagFactory-DaJ0YWX6.d.ts → tagFactory-S17H2qxu.d.ts} +9 -1
  84. package/dist/testing.cjs +252 -63
  85. package/dist/testing.d.cts +17 -4
  86. package/dist/testing.d.ts +17 -4
  87. package/dist/testing.js +100 -44
  88. package/dist/ui.cjs +463 -137
  89. package/dist/ui.d.cts +1 -1
  90. package/dist/ui.d.ts +1 -1
  91. package/dist/ui.js +20 -17
  92. package/dist/widgets.cjs +977 -94
  93. package/dist/widgets.d.cts +104 -2
  94. package/dist/widgets.d.ts +104 -2
  95. package/dist/widgets.js +9 -7
  96. package/package.json +8 -2
  97. package/dist/chunk-32DY64NT.js +0 -282
  98. package/dist/chunk-3AIRKM3B.js +0 -1263
  99. package/dist/chunk-3ARAQO7B.js +0 -398
  100. package/dist/chunk-3CRQALYP.js +0 -877
  101. package/dist/chunk-4EI4AG32.js +0 -482
  102. package/dist/chunk-4MYMUBRS.js +0 -21
  103. package/dist/chunk-5ZYQ6KDD.js +0 -154
  104. package/dist/chunk-6BMPXPUW.js +0 -26
  105. package/dist/chunk-6HLLIF3K.js +0 -398
  106. package/dist/chunk-6LSNVCS2.js +0 -937
  107. package/dist/chunk-6SA3QQES.js +0 -61
  108. package/dist/chunk-77L6NL3X.js +0 -1097
  109. package/dist/chunk-7BF6TK55.js +0 -1097
  110. package/dist/chunk-7TQKR4PP.js +0 -294
  111. package/dist/chunk-7V26P53V.js +0 -712
  112. package/dist/chunk-AZ3ISID5.js +0 -298
  113. package/dist/chunk-B7SWRFUT.js +0 -332
  114. package/dist/chunk-BTU3TJDS.js +0 -365
  115. package/dist/chunk-BW3WT46K.js +0 -937
  116. package/dist/chunk-C6KFWOFV.js +0 -616
  117. package/dist/chunk-CHF5OHIA.js +0 -61
  118. package/dist/chunk-CHJ27IGK.js +0 -26
  119. package/dist/chunk-CMBFNA7L.js +0 -27
  120. package/dist/chunk-DAHRH4ON.js +0 -331
  121. package/dist/chunk-DKOHBI74.js +0 -924
  122. package/dist/chunk-DTCOOBMX.js +0 -725
  123. package/dist/chunk-EBGIRKQY.js +0 -616
  124. package/dist/chunk-EUZND3CB.js +0 -27
  125. package/dist/chunk-EVCZO745.js +0 -365
  126. package/dist/chunk-EWFVA3TJ.js +0 -282
  127. package/dist/chunk-F3FA4F32.js +0 -292
  128. package/dist/chunk-FGOEVHY3.js +0 -60
  129. package/dist/chunk-G3BOQPVO.js +0 -365
  130. package/dist/chunk-GCOK2LC3.js +0 -282
  131. package/dist/chunk-GJPXRJ45.js +0 -37
  132. package/dist/chunk-HGMJFBC7.js +0 -654
  133. package/dist/chunk-JAKHTMQU.js +0 -1000
  134. package/dist/chunk-JCI5M6U6.js +0 -956
  135. package/dist/chunk-K5ZUMYVS.js +0 -89
  136. package/dist/chunk-KQPDEVVS.js +0 -398
  137. package/dist/chunk-L6JRBDNS.js +0 -60
  138. package/dist/chunk-LA6KQEDU.js +0 -712
  139. package/dist/chunk-MB6QFH3I.js +0 -2776
  140. package/dist/chunk-MDVXJWFN.js +0 -304
  141. package/dist/chunk-MEZVEBPN.js +0 -2008
  142. package/dist/chunk-MK4ERFYL.js +0 -2249
  143. package/dist/chunk-MLKGABMK.js +0 -9
  144. package/dist/chunk-MQ5GOYPH.js +0 -2249
  145. package/dist/chunk-MYRV7VDM.js +0 -742
  146. package/dist/chunk-N6IZB6KJ.js +0 -567
  147. package/dist/chunk-NEKUBFPT.js +0 -60
  148. package/dist/chunk-NMRUZALC.js +0 -1097
  149. package/dist/chunk-NYVAC6P5.js +0 -37
  150. package/dist/chunk-NZIIMDWI.js +0 -84
  151. package/dist/chunk-OF7UZIVB.js +0 -725
  152. package/dist/chunk-P3XWXJZU.js +0 -282
  153. package/dist/chunk-P6W3STU4.js +0 -2249
  154. package/dist/chunk-PBHF5WKN.js +0 -616
  155. package/dist/chunk-PDZQY43A.js +0 -616
  156. package/dist/chunk-PTQJDMRT.js +0 -146
  157. package/dist/chunk-PZEGYCF5.js +0 -61
  158. package/dist/chunk-QBMDLBU2.js +0 -975
  159. package/dist/chunk-QWZG56ET.js +0 -2744
  160. package/dist/chunk-RQGQSLQK.js +0 -725
  161. package/dist/chunk-SDLZDHKP.js +0 -107
  162. package/dist/chunk-TDGZL5CU.js +0 -365
  163. package/dist/chunk-TNQWPPE6.js +0 -37
  164. package/dist/chunk-TSOKIX5Z.js +0 -654
  165. package/dist/chunk-UHNL42EF.js +0 -2730
  166. package/dist/chunk-UNXCEF6S.js +0 -21
  167. package/dist/chunk-V2XTI523.js +0 -347
  168. package/dist/chunk-VAU366PN.js +0 -2241
  169. package/dist/chunk-VMVDTCXB.js +0 -712
  170. package/dist/chunk-VQNQZCWJ.js +0 -61
  171. package/dist/chunk-VRW3FULF.js +0 -725
  172. package/dist/chunk-WADYRCO2.js +0 -304
  173. package/dist/chunk-WILQZRO4.js +0 -282
  174. package/dist/chunk-WR5D4EGH.js +0 -26
  175. package/dist/chunk-WUHJISPP.js +0 -298
  176. package/dist/chunk-XYU6TZOW.js +0 -182
  177. package/dist/chunk-Y6GP4QGG.js +0 -276
  178. package/dist/chunk-YECR7UIA.js +0 -347
  179. package/dist/chunk-YUTWTI4B.js +0 -654
  180. package/dist/chunk-Z65KYU7I.js +0 -26
  181. package/dist/chunk-Z6POF5YC.js +0 -975
  182. package/dist/chunk-ZBJP6WFL.js +0 -482
  183. package/dist/chunk-ZD6OAMTH.js +0 -277
  184. package/dist/chunk-ZWKZCBO6.js +0 -317
  185. package/dist/contracts-DDrwxvJ-.d.cts +0 -245
  186. package/dist/contracts-DDrwxvJ-.d.ts +0 -245
  187. package/dist/contracts-DOrhwbke.d.cts +0 -245
  188. package/dist/contracts-DOrhwbke.d.ts +0 -245
  189. package/dist/contracts-xo5ckdRP.d.cts +0 -240
  190. package/dist/contracts-xo5ckdRP.d.ts +0 -240
  191. package/dist/customElement-BKQfbSZQ.d.cts +0 -262
  192. package/dist/customElement-BKQfbSZQ.d.ts +0 -262
  193. package/dist/customElement-D2DJp_xn.d.cts +0 -313
  194. package/dist/customElement-D2DJp_xn.d.ts +0 -313
  195. package/dist/customElement-yz8uyk-0.d.cts +0 -308
  196. package/dist/customElement-yz8uyk-0.d.ts +0 -308
  197. package/dist/introspect-Cb0zgpi2.d.cts +0 -477
  198. package/dist/introspect-Y2xNXGSf.d.ts +0 -477
  199. package/dist/plugin-Bek4RhJY.d.cts +0 -43
  200. package/dist/plugin-Bek4RhJY.d.ts +0 -43
  201. package/dist/ssr-3RXHP5ES.js +0 -38
  202. package/dist/ssr-6GIMY5MX.js +0 -38
  203. package/dist/ssr-BA6sxxUd.d.cts +0 -135
  204. package/dist/ssr-BA6sxxUd.d.ts +0 -135
  205. package/dist/ssr-WKUPVSSK.js +0 -36
  206. package/dist/tagFactory-Dl8QCLga.d.cts +0 -23
  207. package/dist/tagFactory-Dl8QCLga.d.ts +0 -23
@@ -1,5 +1,5 @@
1
- import { T as TrustedHTML } from './ssr-Do_SiVoL.cjs';
2
- export { P as PluginContext, S as SibuPlugin, c as createPlugin, i as inject, p as plugin, r as resetPlugins, t as triggerPluginError, a as triggerPluginMount, b as triggerPluginUnmount } from './plugin-Bek4RhJY.cjs';
1
+ import { T as TrustedHTML } from './ssr-CrVNy6Pa.cjs';
2
+ export { P as PluginContext, a as PluginRegistry, S as SibuPlugin, c as createPlugin, b as createPluginRegistry, i as inject, p as plugin, r as resetPlugins, s as setDefaultPluginRegistry, t as triggerPluginError, d as triggerPluginMount, e as triggerPluginUnmount } from './plugin-D30wlGW5.cjs';
3
3
  export { M as Migration, S as SemVer, V as VERSION, b as bundlerMetadata, c as checkCompatibility, a as compareSemVer, d as createBootSequence, e as createBundle, f as createMigrationRunner, g as createModuleRegistry, h as createSSRCache, i as createTestHarness, j as deferNonCritical, k as env, l as healthCheck, m as lazyModule, p as packageInfo, n as parseSemVer, o as preloadCritical, q as prerenderRoutes, s as satisfies } from './startup-0Qv6aosO.cjs';
4
4
 
5
5
  type Translations = Record<string, string>;
@@ -288,6 +288,13 @@ declare function getRouteInfo(name: string): RouteDef | null;
288
288
  */
289
289
  declare function buildURL(to: NavigationTarget): string;
290
290
  declare function destroyRouter(): void;
291
+ /**
292
+ * Remove the module-level `pagehide` listener. Intended for HMR and tests —
293
+ * normal apps never need to call this (the listener is page-lifetime).
294
+ *
295
+ * @internal
296
+ */
297
+ declare function __removeRouterPagehideHandler(): void;
291
298
  /**
292
299
  * Outlet renders the child route component within a layout.
293
300
  * Use inside a parent route's component to render matched children.
@@ -456,4 +463,4 @@ declare function createSSRRouter(routes: SSRRouteDef[]): {
456
463
  }) => string;
457
464
  };
458
465
 
459
- export { type AsyncComponent, type AsyncRoute, type Component, type ComponentRoute, type Guard, type GuardResult, KeepAliveRoute, type LazyComponent, type LazyRoute, type NavigationFailure, type NavigationGuard, type NavigationNext, type NavigationResult, type NavigationTarget, Outlet, type Params, type RedirectRoute, Route, type RouteBase, type RouteContext, type RouteDef, type RouteMeta, type RouteTransitionOptions, RouterLink, type RouterOptions, type RouterPlugin, type SSRRouteDef, type SSRRouteState, type ScrollBehavior, type ScrollPosition, SibuRouter, Suspense, Trans, addRoute, afterEach, back, beforeEach, beforeResolve, buildURL, createMemoryRouter, createRouter, createSSRRouter, deserializeRouteState, destroyRouter, forward, getAvailableLocales, getLocale, getRouteInfo, getRouteTransition, go, hasRoute, hasTranslation, hydrateRouter, lazy, navigate, preloadRoute, push, registerTranslations, removeRoute, renderRouteToDocument, renderRouteToString, replace, resolveServerRoute, route, router, routerPlugin, routerState, serializeRouteState, setLocale, setRouteTransition, setRoutes, t };
466
+ export { type AsyncComponent, type AsyncRoute, type Component, type ComponentRoute, type Guard, type GuardResult, KeepAliveRoute, type LazyComponent, type LazyRoute, type NavigationFailure, type NavigationGuard, type NavigationNext, type NavigationResult, type NavigationTarget, Outlet, type Params, type RedirectRoute, Route, type RouteBase, type RouteContext, type RouteDef, type RouteMeta, type RouteTransitionOptions, RouterLink, type RouterOptions, type RouterPlugin, type SSRRouteDef, type SSRRouteState, type ScrollBehavior, type ScrollPosition, SibuRouter, Suspense, Trans, __removeRouterPagehideHandler, addRoute, afterEach, back, beforeEach, beforeResolve, buildURL, createMemoryRouter, createRouter, createSSRRouter, deserializeRouteState, destroyRouter, forward, getAvailableLocales, getLocale, getRouteInfo, getRouteTransition, go, hasRoute, hasTranslation, hydrateRouter, lazy, navigate, preloadRoute, push, registerTranslations, removeRoute, renderRouteToDocument, renderRouteToString, replace, resolveServerRoute, route, router, routerPlugin, routerState, serializeRouteState, setLocale, setRouteTransition, setRoutes, t };
package/dist/plugins.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { T as TrustedHTML } from './ssr-Do_SiVoL.js';
2
- export { P as PluginContext, S as SibuPlugin, c as createPlugin, i as inject, p as plugin, r as resetPlugins, t as triggerPluginError, a as triggerPluginMount, b as triggerPluginUnmount } from './plugin-Bek4RhJY.js';
1
+ import { T as TrustedHTML } from './ssr-CrVNy6Pa.js';
2
+ export { P as PluginContext, a as PluginRegistry, S as SibuPlugin, c as createPlugin, b as createPluginRegistry, i as inject, p as plugin, r as resetPlugins, s as setDefaultPluginRegistry, t as triggerPluginError, d as triggerPluginMount, e as triggerPluginUnmount } from './plugin-D30wlGW5.js';
3
3
  export { M as Migration, S as SemVer, V as VERSION, b as bundlerMetadata, c as checkCompatibility, a as compareSemVer, d as createBootSequence, e as createBundle, f as createMigrationRunner, g as createModuleRegistry, h as createSSRCache, i as createTestHarness, j as deferNonCritical, k as env, l as healthCheck, m as lazyModule, p as packageInfo, n as parseSemVer, o as preloadCritical, q as prerenderRoutes, s as satisfies } from './startup-0Qv6aosO.js';
4
4
 
5
5
  type Translations = Record<string, string>;
@@ -288,6 +288,13 @@ declare function getRouteInfo(name: string): RouteDef | null;
288
288
  */
289
289
  declare function buildURL(to: NavigationTarget): string;
290
290
  declare function destroyRouter(): void;
291
+ /**
292
+ * Remove the module-level `pagehide` listener. Intended for HMR and tests —
293
+ * normal apps never need to call this (the listener is page-lifetime).
294
+ *
295
+ * @internal
296
+ */
297
+ declare function __removeRouterPagehideHandler(): void;
291
298
  /**
292
299
  * Outlet renders the child route component within a layout.
293
300
  * Use inside a parent route's component to render matched children.
@@ -456,4 +463,4 @@ declare function createSSRRouter(routes: SSRRouteDef[]): {
456
463
  }) => string;
457
464
  };
458
465
 
459
- export { type AsyncComponent, type AsyncRoute, type Component, type ComponentRoute, type Guard, type GuardResult, KeepAliveRoute, type LazyComponent, type LazyRoute, type NavigationFailure, type NavigationGuard, type NavigationNext, type NavigationResult, type NavigationTarget, Outlet, type Params, type RedirectRoute, Route, type RouteBase, type RouteContext, type RouteDef, type RouteMeta, type RouteTransitionOptions, RouterLink, type RouterOptions, type RouterPlugin, type SSRRouteDef, type SSRRouteState, type ScrollBehavior, type ScrollPosition, SibuRouter, Suspense, Trans, addRoute, afterEach, back, beforeEach, beforeResolve, buildURL, createMemoryRouter, createRouter, createSSRRouter, deserializeRouteState, destroyRouter, forward, getAvailableLocales, getLocale, getRouteInfo, getRouteTransition, go, hasRoute, hasTranslation, hydrateRouter, lazy, navigate, preloadRoute, push, registerTranslations, removeRoute, renderRouteToDocument, renderRouteToString, replace, resolveServerRoute, route, router, routerPlugin, routerState, serializeRouteState, setLocale, setRouteTransition, setRoutes, t };
466
+ export { type AsyncComponent, type AsyncRoute, type Component, type ComponentRoute, type Guard, type GuardResult, KeepAliveRoute, type LazyComponent, type LazyRoute, type NavigationFailure, type NavigationGuard, type NavigationNext, type NavigationResult, type NavigationTarget, Outlet, type Params, type RedirectRoute, Route, type RouteBase, type RouteContext, type RouteDef, type RouteMeta, type RouteTransitionOptions, RouterLink, type RouterOptions, type RouterPlugin, type SSRRouteDef, type SSRRouteState, type ScrollBehavior, type ScrollPosition, SibuRouter, Suspense, Trans, __removeRouterPagehideHandler, addRoute, afterEach, back, beforeEach, beforeResolve, buildURL, createMemoryRouter, createRouter, createSSRRouter, deserializeRouteState, destroyRouter, forward, getAvailableLocales, getLocale, getRouteInfo, getRouteTransition, go, hasRoute, hasTranslation, hydrateRouter, lazy, navigate, preloadRoute, push, registerTranslations, removeRoute, renderRouteToDocument, renderRouteToString, replace, resolveServerRoute, route, router, routerPlugin, routerState, serializeRouteState, setLocale, setRouteTransition, setRoutes, t };
package/dist/plugins.js CHANGED
@@ -18,42 +18,45 @@ import {
18
18
  preloadCritical,
19
19
  prerenderRoutes,
20
20
  satisfies
21
- } from "./chunk-M4NLBH4I.js";
22
- import {
23
- escapeScriptJson,
24
- renderToString
25
- } from "./chunk-3X2YG6YM.js";
21
+ } from "./chunk-LYTCUZ7H.js";
26
22
  import {
27
23
  createPlugin,
24
+ createPluginRegistry,
28
25
  inject,
29
26
  plugin,
30
27
  resetPlugins,
28
+ setDefaultPluginRegistry,
31
29
  triggerPluginError,
32
30
  triggerPluginMount,
33
31
  triggerPluginUnmount
34
- } from "./chunk-K5ZUMYVS.js";
32
+ } from "./chunk-3JHCYHWN.js";
35
33
  import {
36
34
  span
37
- } from "./chunk-P3XWXJZU.js";
38
- import "./chunk-SFKNRVCU.js";
35
+ } from "./chunk-R73P76YZ.js";
36
+ import {
37
+ escapeScriptJson,
38
+ renderToString
39
+ } from "./chunk-JYD2PWXH.js";
40
+ import "./chunk-KLRMB5ZS.js";
41
+ import "./chunk-DFPFITST.js";
39
42
  import {
40
43
  dispose,
41
44
  registerDisposer
42
- } from "./chunk-5ZYQ6KDD.js";
45
+ } from "./chunk-2UPRY23K.js";
43
46
  import {
44
47
  sanitizeUrl
45
- } from "./chunk-CMBFNA7L.js";
48
+ } from "./chunk-UCS6AMJ7.js";
46
49
  import {
47
50
  effect
48
- } from "./chunk-VQNQZCWJ.js";
49
- import "./chunk-EUZND3CB.js";
51
+ } from "./chunk-HB24TBAF.js";
52
+ import "./chunk-2RA7SHDA.js";
50
53
  import {
51
54
  signal
52
- } from "./chunk-NZIIMDWI.js";
55
+ } from "./chunk-CC65Y57T.js";
53
56
  import {
54
57
  track
55
- } from "./chunk-K4G4ZQNR.js";
56
- import "./chunk-5X6PP2UK.js";
58
+ } from "./chunk-VLPPXTYG.js";
59
+ import "./chunk-LMLD24FC.js";
57
60
 
58
61
  // src/plugins/i18n.ts
59
62
  var [currentLocale, setLocaleInternal] = signal("en");
@@ -449,9 +452,11 @@ var ComponentLoader = class {
449
452
  }
450
453
  return component;
451
454
  } catch (error) {
452
- throw new Error(
455
+ const wrapped = new Error(
453
456
  `Failed to load component for route "${routePath}": ${error instanceof Error ? error.message : String(error)}`
454
457
  );
458
+ wrapped.cause = error;
459
+ throw wrapped;
455
460
  }
456
461
  }
457
462
  isAsyncComponent(comp) {
@@ -637,10 +642,13 @@ var _SibuRouter = class _SibuRouter {
637
642
  }
638
643
  if ("redirect" in route2) {
639
644
  const redirectPath = typeof route2.redirect === "function" ? route2.redirect(to) : route2.redirect;
640
- if (typeof redirectPath === "string" && /^https?:\/\/|^\/\//i.test(redirectPath)) {
641
- console.warn(
642
- `[SibuJS Router] Redirect to absolute URL "${redirectPath}" detected. Use relative paths for safer redirects.`
643
- );
645
+ if (typeof redirectPath === "string" && /^(https?:)?\/\//i.test(redirectPath)) {
646
+ if (typeof console !== "undefined") {
647
+ console.error(
648
+ `[SibuJS Router] Refusing absolute/protocol-relative redirect "${redirectPath}" \u2014 open-redirect risk.`
649
+ );
650
+ }
651
+ throw new NavigationFailureError("aborted", from, to);
644
652
  }
645
653
  if (typeof redirectPath === "string" && !isSafeNavigationTarget(redirectPath)) {
646
654
  throw new NavigationFailureError("aborted", from, to);
@@ -843,6 +851,7 @@ function createRouter(routesOrOptions, options = {}) {
843
851
  routes = [];
844
852
  }
845
853
  globalRouter = new SibuRouter(routes, options);
854
+ ensureRouterPagehide();
846
855
  return globalRouter;
847
856
  }
848
857
  function setRoutes(routes) {
@@ -916,7 +925,9 @@ function Route() {
916
925
  let currentTopRoute = null;
917
926
  const cleanupNodes = () => {
918
927
  [currentNode, loadingNode, errorNode].forEach((node) => {
919
- if (node?.parentNode) {
928
+ if (!node) return;
929
+ dispose(node);
930
+ if (node.parentNode) {
920
931
  node.parentNode.removeChild(node);
921
932
  }
922
933
  });
@@ -947,13 +958,24 @@ function Route() {
947
958
  loadingNode = null;
948
959
  }
949
960
  };
950
- const showError = (error) => {
961
+ const showError = (error, routeDef) => {
951
962
  if (!anchor.parentNode) return;
952
963
  cleanupNodes();
953
964
  errorNode = document.createElement("div");
954
965
  errorNode.className = "route-error";
955
966
  errorNode.setAttribute("role", "alert");
956
967
  errorNode.setAttribute("aria-live", "assertive");
968
+ if (routeDef && "component" in routeDef) {
969
+ const src = routeDef.component.toString();
970
+ const importMatch = src.match(/import\(["']([^"']+)["']\)/);
971
+ if (importMatch) {
972
+ errorNode.setAttribute("data-component-source", importMatch[1]);
973
+ }
974
+ if (routeDef.component.name) {
975
+ errorNode.setAttribute("data-component-name", routeDef.component.name);
976
+ }
977
+ }
978
+ errorNode.__routeError = error;
957
979
  const title = document.createElement("h3");
958
980
  title.textContent = "Route Error";
959
981
  title.className = "route-error-title";
@@ -964,12 +986,14 @@ function Route() {
964
986
  retryButton.textContent = "Retry";
965
987
  retryButton.className = "route-error-retry";
966
988
  retryButton.type = "button";
967
- retryButton.addEventListener("click", () => {
989
+ const onRetryClick = () => {
968
990
  if (globalRouter) {
969
991
  globalRouter.clearErrorCache();
970
992
  update();
971
993
  }
972
- });
994
+ };
995
+ retryButton.addEventListener("click", onRetryClick);
996
+ registerDisposer(retryButton, () => retryButton.removeEventListener("click", onRetryClick));
973
997
  errorNode.appendChild(title);
974
998
  errorNode.appendChild(message);
975
999
  errorNode.appendChild(retryButton);
@@ -1001,7 +1025,11 @@ function Route() {
1001
1025
  currentTopRoute = routeDef;
1002
1026
  if ("redirect" in routeDef) {
1003
1027
  const redirectPath = typeof routeDef.redirect === "function" ? routeDef.redirect(route2) : routeDef.redirect;
1004
- queueMicrotask(() => globalRouter?.navigate(redirectPath));
1028
+ queueMicrotask(() => {
1029
+ globalRouter?.navigate(redirectPath).catch((err) => {
1030
+ if (typeof console !== "undefined") console.error("[router] redirect failed:", err);
1031
+ });
1032
+ });
1005
1033
  return;
1006
1034
  }
1007
1035
  if ("component" in routeDef) {
@@ -1020,7 +1048,7 @@ function Route() {
1020
1048
  } catch (error) {
1021
1049
  hideLoading();
1022
1050
  console.error("[Route] Component error:", error);
1023
- showError(error instanceof Error ? error : new Error(String(error)));
1051
+ showError(error instanceof Error ? error : new Error(String(error)), routeDef);
1024
1052
  }
1025
1053
  }
1026
1054
  } catch (error) {
@@ -1040,13 +1068,16 @@ function Route() {
1040
1068
  await originalUpdate();
1041
1069
  routeInitialized = true;
1042
1070
  };
1043
- track(wrappedUpdate);
1071
+ const routeTeardown = track(wrappedUpdate);
1044
1072
  if (!routeInitialized) {
1045
1073
  queueMicrotask(() => {
1046
1074
  if (!routeInitialized && anchor.parentNode) wrappedUpdate();
1047
1075
  });
1048
1076
  }
1049
- routeCleanups.push(cleanupNodes);
1077
+ routeCleanups.push(() => {
1078
+ routeTeardown();
1079
+ cleanupNodes();
1080
+ });
1050
1081
  return anchor;
1051
1082
  }
1052
1083
  function KeepAliveRoute(options) {
@@ -1075,7 +1106,11 @@ function KeepAliveRoute(options) {
1075
1106
  const { route: routeDef } = match;
1076
1107
  if ("redirect" in routeDef) {
1077
1108
  const redirectPath = typeof routeDef.redirect === "function" ? routeDef.redirect(route2) : routeDef.redirect;
1078
- queueMicrotask(() => globalRouter?.navigate(redirectPath));
1109
+ queueMicrotask(() => {
1110
+ globalRouter?.navigate(redirectPath).catch((err) => {
1111
+ if (typeof console !== "undefined") console.error("[router] redirect failed:", err);
1112
+ });
1113
+ });
1079
1114
  return;
1080
1115
  }
1081
1116
  if (!("component" in routeDef)) return;
@@ -1145,13 +1180,14 @@ function KeepAliveRoute(options) {
1145
1180
  await update();
1146
1181
  initialized = true;
1147
1182
  };
1148
- track(wrappedUpdate);
1183
+ const kaTeardown = track(wrappedUpdate);
1149
1184
  if (!initialized) {
1150
1185
  queueMicrotask(() => {
1151
1186
  if (!initialized && anchor.parentNode) wrappedUpdate();
1152
1187
  });
1153
1188
  }
1154
1189
  routeCleanups.push(() => {
1190
+ kaTeardown();
1155
1191
  for (const node of cache.values()) {
1156
1192
  dispose(node);
1157
1193
  if (node.parentNode) node.parentNode.removeChild(node);
@@ -1218,12 +1254,18 @@ function RouterLink(props) {
1218
1254
  }
1219
1255
  });
1220
1256
  }
1221
- link.addEventListener("click", (e) => {
1257
+ const onLinkClick = (e) => {
1222
1258
  if (target || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.button !== 0) {
1223
1259
  return;
1224
1260
  }
1225
1261
  e.preventDefault();
1226
- globalRouter?.navigate(to, { replace: replace2 });
1262
+ globalRouter?.navigate(to, { replace: replace2 }).catch((err) => {
1263
+ if (typeof console !== "undefined") console.error("[router] link navigate failed:", err);
1264
+ });
1265
+ };
1266
+ link.addEventListener("click", onLinkClick);
1267
+ registerDisposer(link, () => {
1268
+ link.removeEventListener("click", onLinkClick);
1227
1269
  });
1228
1270
  return link;
1229
1271
  }
@@ -1334,10 +1376,21 @@ function destroyRouter() {
1334
1376
  globalRouter = null;
1335
1377
  }
1336
1378
  }
1337
- if (typeof window !== "undefined") {
1338
- window.addEventListener("beforeunload", () => {
1339
- destroyRouter();
1340
- });
1379
+ var _routerPagehideHandler = null;
1380
+ function ensureRouterPagehide() {
1381
+ if (_routerPagehideHandler || typeof window === "undefined") return;
1382
+ _routerPagehideHandler = (event) => {
1383
+ if (event.persisted === false) {
1384
+ destroyRouter();
1385
+ }
1386
+ };
1387
+ window.addEventListener("pagehide", _routerPagehideHandler);
1388
+ }
1389
+ function __removeRouterPagehideHandler() {
1390
+ if (_routerPagehideHandler && typeof window !== "undefined") {
1391
+ window.removeEventListener("pagehide", _routerPagehideHandler);
1392
+ _routerPagehideHandler = null;
1393
+ }
1341
1394
  }
1342
1395
  function Outlet() {
1343
1396
  const anchor = document.createComment("route-outlet-nested");
@@ -1363,12 +1416,20 @@ function Outlet() {
1363
1416
  console.error("[Outlet] Failed to render child route:", error);
1364
1417
  }
1365
1418
  };
1366
- track(update);
1419
+ const outletTeardown = track(update);
1367
1420
  if (!anchor.parentNode) {
1368
1421
  queueMicrotask(() => {
1369
1422
  if (anchor.parentNode) update();
1370
1423
  });
1371
1424
  }
1425
+ routeCleanups.push(() => {
1426
+ outletTeardown();
1427
+ if (currentNode) {
1428
+ dispose(currentNode);
1429
+ if (currentNode.parentNode) currentNode.parentNode.removeChild(currentNode);
1430
+ currentNode = null;
1431
+ }
1432
+ });
1372
1433
  return anchor;
1373
1434
  }
1374
1435
  function addRoute(route2, parentPath) {
@@ -1681,10 +1742,14 @@ function hydrateRouter(routes, options) {
1681
1742
  if (container && serverState.path) {
1682
1743
  const resolved = resolveServerRoute(serverState.path, routes);
1683
1744
  if (resolved.component) {
1684
- import("./ssr-4PBXAOO3.js").then(({ hydrate }) => {
1745
+ import("./ssr-FXD2PPMC.js").then(({ hydrate }) => {
1685
1746
  if (resolved.component) {
1686
1747
  hydrate(resolved.component, container);
1687
1748
  }
1749
+ }).catch((err) => {
1750
+ if (typeof console !== "undefined") {
1751
+ console.error("[SibuJS routerSSR] failed to load hydrate:", err);
1752
+ }
1688
1753
  });
1689
1754
  }
1690
1755
  }
@@ -1765,6 +1830,7 @@ export {
1765
1830
  Suspense,
1766
1831
  Trans,
1767
1832
  VERSION,
1833
+ __removeRouterPagehideHandler,
1768
1834
  addRoute,
1769
1835
  afterEach,
1770
1836
  back,
@@ -1780,6 +1846,7 @@ export {
1780
1846
  createMigrationRunner,
1781
1847
  createModuleRegistry,
1782
1848
  createPlugin,
1849
+ createPluginRegistry,
1783
1850
  createRouter,
1784
1851
  createSSRCache,
1785
1852
  createSSRRouter,
@@ -1822,6 +1889,7 @@ export {
1822
1889
  routerState,
1823
1890
  satisfies,
1824
1891
  serializeRouteState,
1892
+ setDefaultPluginRegistry,
1825
1893
  setLocale,
1826
1894
  setRouteTransition,
1827
1895
  setRoutes,
@@ -98,10 +98,6 @@ declare function collectStream(stream: AsyncGenerator<string> | AsyncIterable<st
98
98
  * Uses pull-based backpressure — chunks are produced on demand.
99
99
  */
100
100
  declare function renderToReadableStream(element: HTMLElement | DocumentFragment | Node): ReadableStream<string>;
101
- /**
102
- * Marks an element as a hydration island. During partial hydration
103
- * only elements marked with `data-sibu-island` will be hydrated.
104
- */
105
101
  declare function island(id: string, component: () => HTMLElement): HTMLElement;
106
102
  /**
107
103
  * Hydrate only elements marked as islands (`data-sibu-island`).
@@ -122,6 +118,10 @@ declare function hydrateProgressively(container: HTMLElement, islands: Record<st
122
118
  /**
123
119
  * Reset SSR state between requests. Call at the start of each SSR render
124
120
  * to prevent ID drift in long-lived server processes.
121
+ *
122
+ * When running inside `runInSSRContext`, each request already owns its
123
+ * own counter via AsyncLocalStorage — this hook only touches the
124
+ * module-global fallback used outside that context.
125
125
  */
126
126
  declare function resetSSRState(): void;
127
127
  /**
@@ -134,6 +134,8 @@ declare function resetSSRState(): void;
134
134
  declare function ssrSuspense(props: {
135
135
  fallback: () => HTMLElement;
136
136
  content: () => Promise<HTMLElement>;
137
+ /** Milliseconds before the content promise is rejected. Defaults to 30000. */
138
+ timeoutMs?: number;
137
139
  }): {
138
140
  element: HTMLElement;
139
141
  promise: Promise<{
@@ -176,17 +178,9 @@ declare function renderToSuspenseStream(element: HTMLElement | DocumentFragment
176
178
  * older engines and could break out of string context.
177
179
  */
178
180
  declare function escapeScriptJson(json: string): string;
179
- /**
180
- * Serialize application state into an HTML script tag for SSR.
181
- * The serialized data is embedded in the document and picked up
182
- * on the client with `deserializeState()`.
183
- *
184
- * Security: the serialized JSON is escaped against `<`/`>`/`&` so nothing
185
- * can close the `<script>` tag, plus `U+2028` / `U+2029` which otherwise
186
- * break out of string literals on pre-ES2019 engines. Supports a `nonce`
187
- * attribute so the script is compatible with strict CSP.
188
- */
189
- declare function serializeState(state: Record<string, unknown>, nonce?: string): string;
181
+ declare function serializeState(state: Record<string, unknown>, nonce?: string, options?: {
182
+ maxBytes?: number;
183
+ }): string;
190
184
  /**
191
185
  * Retrieve state that was embedded by `serializeState()` during SSR.
192
186
  *
@@ -98,10 +98,6 @@ declare function collectStream(stream: AsyncGenerator<string> | AsyncIterable<st
98
98
  * Uses pull-based backpressure — chunks are produced on demand.
99
99
  */
100
100
  declare function renderToReadableStream(element: HTMLElement | DocumentFragment | Node): ReadableStream<string>;
101
- /**
102
- * Marks an element as a hydration island. During partial hydration
103
- * only elements marked with `data-sibu-island` will be hydrated.
104
- */
105
101
  declare function island(id: string, component: () => HTMLElement): HTMLElement;
106
102
  /**
107
103
  * Hydrate only elements marked as islands (`data-sibu-island`).
@@ -122,6 +118,10 @@ declare function hydrateProgressively(container: HTMLElement, islands: Record<st
122
118
  /**
123
119
  * Reset SSR state between requests. Call at the start of each SSR render
124
120
  * to prevent ID drift in long-lived server processes.
121
+ *
122
+ * When running inside `runInSSRContext`, each request already owns its
123
+ * own counter via AsyncLocalStorage — this hook only touches the
124
+ * module-global fallback used outside that context.
125
125
  */
126
126
  declare function resetSSRState(): void;
127
127
  /**
@@ -134,6 +134,8 @@ declare function resetSSRState(): void;
134
134
  declare function ssrSuspense(props: {
135
135
  fallback: () => HTMLElement;
136
136
  content: () => Promise<HTMLElement>;
137
+ /** Milliseconds before the content promise is rejected. Defaults to 30000. */
138
+ timeoutMs?: number;
137
139
  }): {
138
140
  element: HTMLElement;
139
141
  promise: Promise<{
@@ -176,17 +178,9 @@ declare function renderToSuspenseStream(element: HTMLElement | DocumentFragment
176
178
  * older engines and could break out of string context.
177
179
  */
178
180
  declare function escapeScriptJson(json: string): string;
179
- /**
180
- * Serialize application state into an HTML script tag for SSR.
181
- * The serialized data is embedded in the document and picked up
182
- * on the client with `deserializeState()`.
183
- *
184
- * Security: the serialized JSON is escaped against `<`/`>`/`&` so nothing
185
- * can close the `<script>` tag, plus `U+2028` / `U+2029` which otherwise
186
- * break out of string literals on pre-ES2019 engines. Supports a `nonce`
187
- * attribute so the script is compatible with strict CSP.
188
- */
189
- declare function serializeState(state: Record<string, unknown>, nonce?: string): string;
181
+ declare function serializeState(state: Record<string, unknown>, nonce?: string, options?: {
182
+ maxBytes?: number;
183
+ }): string;
190
184
  /**
191
185
  * Retrieve state that was embedded by `serializeState()` during SSR.
192
186
  *
@@ -16,9 +16,10 @@ import {
16
16
  ssrSuspense,
17
17
  suspenseSwapScript,
18
18
  trustHTML
19
- } from "./chunk-3X2YG6YM.js";
20
- import "./chunk-CMBFNA7L.js";
21
- import "./chunk-5X6PP2UK.js";
19
+ } from "./chunk-JYD2PWXH.js";
20
+ import "./chunk-UCS6AMJ7.js";
21
+ import "./chunk-2RA7SHDA.js";
22
+ import "./chunk-LMLD24FC.js";
22
23
  export {
23
24
  collectStream,
24
25
  deserializeState,