sibujs 1.4.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.
- package/README.md +105 -119
- package/dist/browser.cjs +288 -80
- package/dist/browser.d.cts +19 -9
- package/dist/browser.d.ts +19 -9
- package/dist/browser.js +6 -6
- package/dist/build.cjs +1019 -313
- package/dist/build.d.cts +1 -1
- package/dist/build.d.ts +1 -1
- package/dist/build.js +15 -13
- package/dist/cdn.global.js +17 -16
- package/dist/chunk-2RA7SHDA.js +65 -0
- package/dist/chunk-2UPRY23K.js +80 -0
- package/dist/chunk-3JHCYHWN.js +125 -0
- package/dist/{chunk-ZWKZCBO6.js → chunk-3LR7GLWQ.js} +154 -33
- package/dist/{chunk-3AIRKM3B.js → chunk-3NSGB5JN.js} +115 -34
- package/dist/{chunk-3ARAQO7B.js → chunk-52YJLLRO.js} +29 -6
- package/dist/chunk-54EDRCEF.js +93 -0
- package/dist/chunk-7JDB7I65.js +1327 -0
- package/dist/{chunk-WZSPOOER.js → chunk-CC65Y57T.js} +8 -5
- package/dist/{chunk-23VV7YD3.js → chunk-DFPFITST.js} +25 -30
- package/dist/{chunk-WR5D4EGH.js → chunk-GTBNNBJ6.js} +14 -2
- package/dist/chunk-HB24TBAF.js +121 -0
- package/dist/{chunk-CZUGLNJS.js → chunk-ITX6OO3F.js} +3 -3
- package/dist/{chunk-JAKHTMQU.js → chunk-JA6667UN.js} +206 -46
- package/dist/{chunk-77L6NL3X.js → chunk-JXMMDLBY.js} +306 -183
- package/dist/{chunk-3X2YG6YM.js → chunk-JYD2PWXH.js} +59 -28
- package/dist/{chunk-F3FA4F32.js → chunk-KLRMB5ZS.js} +135 -79
- package/dist/{chunk-5X6PP2UK.js → chunk-LMLD24FC.js} +2 -2
- package/dist/{chunk-M4NLBH4I.js → chunk-LYTCUZ7H.js} +3 -2
- package/dist/{chunk-TSOKIX5Z.js → chunk-MIUAXB7K.js} +126 -74
- package/dist/{chunk-QWZG56ET.js → chunk-ND2664SF.js} +558 -190
- package/dist/{chunk-JCI5M6U6.js → chunk-O2MNQFLP.js} +261 -79
- package/dist/{chunk-EWFVA3TJ.js → chunk-R73P76YZ.js} +1 -1
- package/dist/{chunk-2BYQDGN3.js → chunk-SAHNHTFC.js} +234 -63
- package/dist/chunk-UCS6AMJ7.js +79 -0
- package/dist/{chunk-ZD6OAMTH.js → chunk-VLPPXTYG.js} +90 -35
- package/dist/{chunk-OUZZEE4S.js → chunk-WOMYAHHI.js} +17 -11
- package/dist/{contracts-xo5ckdRP.d.cts → contracts-ey_Qh8ef.d.cts} +7 -8
- package/dist/{contracts-xo5ckdRP.d.ts → contracts-ey_Qh8ef.d.ts} +7 -8
- package/dist/{customElement-D2DJp_xn.d.cts → customElement-CPfIrbvg.d.cts} +18 -9
- package/dist/{customElement-D2DJp_xn.d.ts → customElement-CPfIrbvg.d.ts} +18 -9
- package/dist/data.cjs +452 -100
- package/dist/data.d.cts +20 -2
- package/dist/data.d.ts +20 -2
- package/dist/data.js +11 -9
- package/dist/devtools.cjs +535 -247
- package/dist/devtools.d.cts +1 -1
- package/dist/devtools.d.ts +1 -1
- package/dist/devtools.js +34 -30
- package/dist/ecosystem.cjs +499 -143
- package/dist/ecosystem.d.cts +13 -11
- package/dist/ecosystem.d.ts +13 -11
- package/dist/ecosystem.js +12 -11
- package/dist/extras.cjs +3639 -1629
- package/dist/extras.d.cts +11 -11
- package/dist/extras.d.ts +11 -11
- package/dist/extras.js +58 -45
- package/dist/index.cjs +1023 -313
- package/dist/index.d.cts +128 -55
- package/dist/index.d.ts +128 -55
- package/dist/index.js +28 -16
- package/dist/{introspect-BumjnBKr.d.cts → introspect-BWNjNw64.d.cts} +22 -2
- package/dist/{introspect-CZrlcaYy.d.ts → introspect-cY2pg9pW.d.ts} +22 -2
- package/dist/motion.cjs +90 -36
- package/dist/motion.d.cts +1 -1
- package/dist/motion.d.ts +1 -1
- package/dist/motion.js +4 -4
- package/dist/patterns.cjs +414 -81
- package/dist/patterns.d.cts +53 -20
- package/dist/patterns.d.ts +53 -20
- package/dist/patterns.js +7 -7
- package/dist/performance.cjs +364 -108
- package/dist/performance.d.cts +29 -17
- package/dist/performance.d.ts +29 -17
- package/dist/performance.js +13 -6
- package/dist/plugin-D30wlGW5.d.cts +71 -0
- package/dist/plugin-D30wlGW5.d.ts +71 -0
- package/dist/plugins.cjs +652 -271
- package/dist/plugins.d.cts +13 -6
- package/dist/plugins.d.ts +13 -6
- package/dist/plugins.js +116 -50
- package/dist/{ssr-Do_SiVoL.d.cts → ssr-CrVNy6Pa.d.cts} +9 -15
- package/dist/{ssr-Do_SiVoL.d.ts → ssr-CrVNy6Pa.d.ts} +9 -15
- package/dist/{ssr-4PBXAOO3.js → ssr-FXD2PPMC.js} +4 -3
- package/dist/ssr.cjs +648 -219
- package/dist/ssr.d.cts +27 -7
- package/dist/ssr.d.ts +27 -7
- package/dist/ssr.js +12 -11
- package/dist/{tagFactory-DaJ0YWX6.d.ts → tagFactory-S17H2qxu.d.cts} +9 -1
- package/dist/{tagFactory-DaJ0YWX6.d.cts → tagFactory-S17H2qxu.d.ts} +9 -1
- package/dist/testing.cjs +252 -63
- package/dist/testing.d.cts +17 -4
- package/dist/testing.d.ts +17 -4
- package/dist/testing.js +100 -44
- package/dist/ui.cjs +576 -168
- package/dist/ui.d.cts +13 -16
- package/dist/ui.d.ts +13 -16
- package/dist/ui.js +20 -17
- package/dist/widgets.cjs +1001 -93
- package/dist/widgets.d.cts +104 -2
- package/dist/widgets.d.ts +104 -2
- package/dist/widgets.js +9 -7
- package/package.json +8 -2
- package/dist/chunk-32DY64NT.js +0 -282
- package/dist/chunk-3CRQALYP.js +0 -877
- package/dist/chunk-4EI4AG32.js +0 -482
- package/dist/chunk-4MYMUBRS.js +0 -21
- package/dist/chunk-6HLLIF3K.js +0 -398
- package/dist/chunk-6LSNVCS2.js +0 -937
- package/dist/chunk-6SA3QQES.js +0 -61
- package/dist/chunk-7BF6TK55.js +0 -1097
- package/dist/chunk-7TQKR4PP.js +0 -294
- package/dist/chunk-7V26P53V.js +0 -712
- package/dist/chunk-AZ3ISID5.js +0 -298
- package/dist/chunk-B7SWRFUT.js +0 -332
- package/dist/chunk-BGN5ZMP4.js +0 -26
- package/dist/chunk-BTU3TJDS.js +0 -365
- package/dist/chunk-BW3WT46K.js +0 -937
- package/dist/chunk-C6KFWOFV.js +0 -616
- package/dist/chunk-CHF5OHIA.js +0 -61
- package/dist/chunk-CHJ27IGK.js +0 -26
- package/dist/chunk-CMBFNA7L.js +0 -27
- package/dist/chunk-DAHRH4ON.js +0 -331
- package/dist/chunk-DKOHBI74.js +0 -924
- package/dist/chunk-DTCOOBMX.js +0 -725
- package/dist/chunk-EBGIRKQY.js +0 -616
- package/dist/chunk-EUZND3CB.js +0 -27
- package/dist/chunk-EVCZO745.js +0 -365
- package/dist/chunk-FGOEVHY3.js +0 -60
- package/dist/chunk-G3BOQPVO.js +0 -365
- package/dist/chunk-GCOK2LC3.js +0 -282
- package/dist/chunk-HGMJFBC7.js +0 -654
- package/dist/chunk-K5ZUMYVS.js +0 -89
- package/dist/chunk-KQPDEVVS.js +0 -398
- package/dist/chunk-L6JRBDNS.js +0 -60
- package/dist/chunk-LA6KQEDU.js +0 -712
- package/dist/chunk-MDVXJWFN.js +0 -304
- package/dist/chunk-MEZVEBPN.js +0 -2008
- package/dist/chunk-MK4ERFYL.js +0 -2249
- package/dist/chunk-MLKGABMK.js +0 -9
- package/dist/chunk-MQ5GOYPH.js +0 -2249
- package/dist/chunk-N6IZB6KJ.js +0 -567
- package/dist/chunk-NEKUBFPT.js +0 -60
- package/dist/chunk-NHUC2QWH.js +0 -282
- package/dist/chunk-NMRUZALC.js +0 -1097
- package/dist/chunk-NYVAC6P5.js +0 -37
- package/dist/chunk-OF7UZIVB.js +0 -725
- package/dist/chunk-P6W3STU4.js +0 -2249
- package/dist/chunk-PBHF5WKN.js +0 -616
- package/dist/chunk-PTQJDMRT.js +0 -146
- package/dist/chunk-PZEGYCF5.js +0 -61
- package/dist/chunk-QBMDLBU2.js +0 -975
- package/dist/chunk-RQGQSLQK.js +0 -725
- package/dist/chunk-SDLZDHKP.js +0 -107
- package/dist/chunk-TNQWPPE6.js +0 -37
- package/dist/chunk-UHNL42EF.js +0 -2730
- package/dist/chunk-UNXCEF6S.js +0 -21
- package/dist/chunk-V2XTI523.js +0 -347
- package/dist/chunk-VAU366PN.js +0 -2241
- package/dist/chunk-VMVDTCXB.js +0 -712
- package/dist/chunk-VRW3FULF.js +0 -725
- package/dist/chunk-WADYRCO2.js +0 -304
- package/dist/chunk-WILQZRO4.js +0 -282
- package/dist/chunk-WUHJISPP.js +0 -298
- package/dist/chunk-XYU6TZOW.js +0 -182
- package/dist/chunk-Y6GP4QGG.js +0 -276
- package/dist/chunk-YECR7UIA.js +0 -347
- package/dist/chunk-YUTWTI4B.js +0 -654
- package/dist/chunk-Z65KYU7I.js +0 -26
- package/dist/chunk-Z6POF5YC.js +0 -975
- package/dist/chunk-ZBJP6WFL.js +0 -482
- package/dist/contracts-DDrwxvJ-.d.cts +0 -245
- package/dist/contracts-DDrwxvJ-.d.ts +0 -245
- package/dist/contracts-DOrhwbke.d.cts +0 -245
- package/dist/contracts-DOrhwbke.d.ts +0 -245
- package/dist/customElement-BKQfbSZQ.d.cts +0 -262
- package/dist/customElement-BKQfbSZQ.d.ts +0 -262
- package/dist/customElement-yz8uyk-0.d.cts +0 -308
- package/dist/customElement-yz8uyk-0.d.ts +0 -308
- package/dist/introspect-Cb0zgpi2.d.cts +0 -477
- package/dist/introspect-Y2xNXGSf.d.ts +0 -477
- package/dist/plugin-Bek4RhJY.d.cts +0 -43
- package/dist/plugin-Bek4RhJY.d.ts +0 -43
- package/dist/ssr-3RXHP5ES.js +0 -38
- package/dist/ssr-6GIMY5MX.js +0 -38
- package/dist/ssr-BA6sxxUd.d.cts +0 -135
- package/dist/ssr-BA6sxxUd.d.ts +0 -135
- package/dist/ssr-WKUPVSSK.js +0 -36
- package/dist/tagFactory-Dl8QCLga.d.cts +0 -23
- package/dist/tagFactory-Dl8QCLga.d.ts +0 -23
package/dist/plugins.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TrustedHTML } from './ssr-
|
|
2
|
-
export { P as PluginContext, S as SibuPlugin, c as createPlugin, i as inject, p as plugin, r as resetPlugins, t as triggerPluginError,
|
|
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>;
|
|
@@ -24,7 +24,7 @@ declare function t(key: string, params?: Params$1): string;
|
|
|
24
24
|
* registerTranslations("en", { greeting: "Hello, {name}!" });
|
|
25
25
|
* registerTranslations("es", { greeting: "Hola, {name}!" });
|
|
26
26
|
*
|
|
27
|
-
* div(
|
|
27
|
+
* div([Trans("greeting", { name: "World" })]);
|
|
28
28
|
* // When locale changes, the text updates automatically
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
@@ -235,11 +235,11 @@ declare function Route(): Node;
|
|
|
235
235
|
* ```ts
|
|
236
236
|
* // Cache all routes (max 10)
|
|
237
237
|
* createRouter(routes, { keepAlive: 10 });
|
|
238
|
-
* mount(() => div(
|
|
238
|
+
* mount(() => div([nav, KeepAliveRoute()]), root);
|
|
239
239
|
*
|
|
240
240
|
* // Or cache specific routes by name
|
|
241
241
|
* createRouter(routes, { keepAlive: ["dashboard", "settings"] });
|
|
242
|
-
* mount(() => div(
|
|
242
|
+
* mount(() => div([nav, KeepAliveRoute()]), root);
|
|
243
243
|
*
|
|
244
244
|
* // Or override per-outlet
|
|
245
245
|
* KeepAliveRoute({ max: 5, include: ["dashboard"] })
|
|
@@ -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-
|
|
2
|
-
export { P as PluginContext, S as SibuPlugin, c as createPlugin, i as inject, p as plugin, r as resetPlugins, t as triggerPluginError,
|
|
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>;
|
|
@@ -24,7 +24,7 @@ declare function t(key: string, params?: Params$1): string;
|
|
|
24
24
|
* registerTranslations("en", { greeting: "Hello, {name}!" });
|
|
25
25
|
* registerTranslations("es", { greeting: "Hola, {name}!" });
|
|
26
26
|
*
|
|
27
|
-
* div(
|
|
27
|
+
* div([Trans("greeting", { name: "World" })]);
|
|
28
28
|
* // When locale changes, the text updates automatically
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
@@ -235,11 +235,11 @@ declare function Route(): Node;
|
|
|
235
235
|
* ```ts
|
|
236
236
|
* // Cache all routes (max 10)
|
|
237
237
|
* createRouter(routes, { keepAlive: 10 });
|
|
238
|
-
* mount(() => div(
|
|
238
|
+
* mount(() => div([nav, KeepAliveRoute()]), root);
|
|
239
239
|
*
|
|
240
240
|
* // Or cache specific routes by name
|
|
241
241
|
* createRouter(routes, { keepAlive: ["dashboard", "settings"] });
|
|
242
|
-
* mount(() => div(
|
|
242
|
+
* mount(() => div([nav, KeepAliveRoute()]), root);
|
|
243
243
|
*
|
|
244
244
|
* // Or override per-outlet
|
|
245
245
|
* KeepAliveRoute({ max: 5, include: ["dashboard"] })
|
|
@@ -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-
|
|
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-
|
|
32
|
+
} from "./chunk-3JHCYHWN.js";
|
|
35
33
|
import {
|
|
36
34
|
span
|
|
37
|
-
} from "./chunk-
|
|
38
|
-
import
|
|
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-
|
|
45
|
+
} from "./chunk-2UPRY23K.js";
|
|
43
46
|
import {
|
|
44
47
|
sanitizeUrl
|
|
45
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-UCS6AMJ7.js";
|
|
46
49
|
import {
|
|
47
50
|
effect
|
|
48
|
-
} from "./chunk-
|
|
49
|
-
import "./chunk-
|
|
51
|
+
} from "./chunk-HB24TBAF.js";
|
|
52
|
+
import "./chunk-2RA7SHDA.js";
|
|
50
53
|
import {
|
|
51
54
|
signal
|
|
52
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-CC65Y57T.js";
|
|
53
56
|
import {
|
|
54
57
|
track
|
|
55
|
-
} from "./chunk-
|
|
56
|
-
import "./chunk-
|
|
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");
|
|
@@ -73,9 +76,7 @@ function t(key, params) {
|
|
|
73
76
|
return params ? message.replace(/\{(\w+)\}/g, (_, p) => String(params[p] ?? "")) : message;
|
|
74
77
|
}
|
|
75
78
|
function Trans(key, params) {
|
|
76
|
-
return span(
|
|
77
|
-
nodes: () => t(key, params)
|
|
78
|
-
});
|
|
79
|
+
return span(() => t(key, params));
|
|
79
80
|
}
|
|
80
81
|
function hasTranslation(key) {
|
|
81
82
|
const locale = currentLocale();
|
|
@@ -206,9 +207,12 @@ var RouteMatcher = class {
|
|
|
206
207
|
return this.namedRoutes.get(name) || null;
|
|
207
208
|
}
|
|
208
209
|
matchPattern(path, routePath) {
|
|
209
|
-
if (routePath === "*"
|
|
210
|
+
if (routePath === "*") {
|
|
211
|
+
return { params: { pathMatch: path } };
|
|
212
|
+
}
|
|
213
|
+
if (routePath.endsWith("/*")) {
|
|
210
214
|
const basePath = routePath.slice(0, -2);
|
|
211
|
-
if (path.startsWith(basePath)) {
|
|
215
|
+
if (path === basePath || path.startsWith(`${basePath}/`)) {
|
|
212
216
|
return { params: { pathMatch: path.slice(basePath.length) } };
|
|
213
217
|
}
|
|
214
218
|
return null;
|
|
@@ -327,6 +331,8 @@ var GuardManager = class {
|
|
|
327
331
|
const next = (result) => {
|
|
328
332
|
if (resolved || signal2.aborted) return;
|
|
329
333
|
resolved = true;
|
|
334
|
+
clearTimeout(timeoutId);
|
|
335
|
+
signal2.removeEventListener("abort", abortHandler);
|
|
330
336
|
if (result instanceof Error) {
|
|
331
337
|
reject(result);
|
|
332
338
|
} else if (result === false) {
|
|
@@ -340,10 +346,10 @@ var GuardManager = class {
|
|
|
340
346
|
const abortHandler = () => {
|
|
341
347
|
if (!resolved) {
|
|
342
348
|
resolved = true;
|
|
349
|
+
clearTimeout(timeoutId);
|
|
343
350
|
reject(new Error("Navigation aborted"));
|
|
344
351
|
}
|
|
345
352
|
};
|
|
346
|
-
signal2.addEventListener("abort", abortHandler);
|
|
347
353
|
const timeoutId = setTimeout(() => {
|
|
348
354
|
if (!resolved) {
|
|
349
355
|
resolved = true;
|
|
@@ -351,6 +357,7 @@ var GuardManager = class {
|
|
|
351
357
|
reject(new Error("Guard timeout"));
|
|
352
358
|
}
|
|
353
359
|
}, this.timeout);
|
|
360
|
+
signal2.addEventListener("abort", abortHandler);
|
|
354
361
|
try {
|
|
355
362
|
guard(to, from, next);
|
|
356
363
|
} catch (error) {
|
|
@@ -361,12 +368,6 @@ var GuardManager = class {
|
|
|
361
368
|
reject(error instanceof Error ? error : new Error(String(error)));
|
|
362
369
|
}
|
|
363
370
|
}
|
|
364
|
-
Promise.resolve().then(() => {
|
|
365
|
-
if (resolved) {
|
|
366
|
-
clearTimeout(timeoutId);
|
|
367
|
-
signal2.removeEventListener("abort", abortHandler);
|
|
368
|
-
}
|
|
369
|
-
});
|
|
370
371
|
});
|
|
371
372
|
}
|
|
372
373
|
addBeforeEach(guard) {
|
|
@@ -451,9 +452,11 @@ var ComponentLoader = class {
|
|
|
451
452
|
}
|
|
452
453
|
return component;
|
|
453
454
|
} catch (error) {
|
|
454
|
-
|
|
455
|
+
const wrapped = new Error(
|
|
455
456
|
`Failed to load component for route "${routePath}": ${error instanceof Error ? error.message : String(error)}`
|
|
456
457
|
);
|
|
458
|
+
wrapped.cause = error;
|
|
459
|
+
throw wrapped;
|
|
457
460
|
}
|
|
458
461
|
}
|
|
459
462
|
isAsyncComponent(comp) {
|
|
@@ -639,10 +642,13 @@ var _SibuRouter = class _SibuRouter {
|
|
|
639
642
|
}
|
|
640
643
|
if ("redirect" in route2) {
|
|
641
644
|
const redirectPath = typeof route2.redirect === "function" ? route2.redirect(to) : route2.redirect;
|
|
642
|
-
if (typeof redirectPath === "string" && /^https
|
|
643
|
-
console
|
|
644
|
-
|
|
645
|
-
|
|
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);
|
|
646
652
|
}
|
|
647
653
|
if (typeof redirectPath === "string" && !isSafeNavigationTarget(redirectPath)) {
|
|
648
654
|
throw new NavigationFailureError("aborted", from, to);
|
|
@@ -845,6 +851,7 @@ function createRouter(routesOrOptions, options = {}) {
|
|
|
845
851
|
routes = [];
|
|
846
852
|
}
|
|
847
853
|
globalRouter = new SibuRouter(routes, options);
|
|
854
|
+
ensureRouterPagehide();
|
|
848
855
|
return globalRouter;
|
|
849
856
|
}
|
|
850
857
|
function setRoutes(routes) {
|
|
@@ -918,7 +925,9 @@ function Route() {
|
|
|
918
925
|
let currentTopRoute = null;
|
|
919
926
|
const cleanupNodes = () => {
|
|
920
927
|
[currentNode, loadingNode, errorNode].forEach((node) => {
|
|
921
|
-
if (node
|
|
928
|
+
if (!node) return;
|
|
929
|
+
dispose(node);
|
|
930
|
+
if (node.parentNode) {
|
|
922
931
|
node.parentNode.removeChild(node);
|
|
923
932
|
}
|
|
924
933
|
});
|
|
@@ -949,13 +958,24 @@ function Route() {
|
|
|
949
958
|
loadingNode = null;
|
|
950
959
|
}
|
|
951
960
|
};
|
|
952
|
-
const showError = (error) => {
|
|
961
|
+
const showError = (error, routeDef) => {
|
|
953
962
|
if (!anchor.parentNode) return;
|
|
954
963
|
cleanupNodes();
|
|
955
964
|
errorNode = document.createElement("div");
|
|
956
965
|
errorNode.className = "route-error";
|
|
957
966
|
errorNode.setAttribute("role", "alert");
|
|
958
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;
|
|
959
979
|
const title = document.createElement("h3");
|
|
960
980
|
title.textContent = "Route Error";
|
|
961
981
|
title.className = "route-error-title";
|
|
@@ -966,12 +986,14 @@ function Route() {
|
|
|
966
986
|
retryButton.textContent = "Retry";
|
|
967
987
|
retryButton.className = "route-error-retry";
|
|
968
988
|
retryButton.type = "button";
|
|
969
|
-
|
|
989
|
+
const onRetryClick = () => {
|
|
970
990
|
if (globalRouter) {
|
|
971
991
|
globalRouter.clearErrorCache();
|
|
972
992
|
update();
|
|
973
993
|
}
|
|
974
|
-
}
|
|
994
|
+
};
|
|
995
|
+
retryButton.addEventListener("click", onRetryClick);
|
|
996
|
+
registerDisposer(retryButton, () => retryButton.removeEventListener("click", onRetryClick));
|
|
975
997
|
errorNode.appendChild(title);
|
|
976
998
|
errorNode.appendChild(message);
|
|
977
999
|
errorNode.appendChild(retryButton);
|
|
@@ -1003,7 +1025,11 @@ function Route() {
|
|
|
1003
1025
|
currentTopRoute = routeDef;
|
|
1004
1026
|
if ("redirect" in routeDef) {
|
|
1005
1027
|
const redirectPath = typeof routeDef.redirect === "function" ? routeDef.redirect(route2) : routeDef.redirect;
|
|
1006
|
-
queueMicrotask(() =>
|
|
1028
|
+
queueMicrotask(() => {
|
|
1029
|
+
globalRouter?.navigate(redirectPath).catch((err) => {
|
|
1030
|
+
if (typeof console !== "undefined") console.error("[router] redirect failed:", err);
|
|
1031
|
+
});
|
|
1032
|
+
});
|
|
1007
1033
|
return;
|
|
1008
1034
|
}
|
|
1009
1035
|
if ("component" in routeDef) {
|
|
@@ -1022,7 +1048,7 @@ function Route() {
|
|
|
1022
1048
|
} catch (error) {
|
|
1023
1049
|
hideLoading();
|
|
1024
1050
|
console.error("[Route] Component error:", error);
|
|
1025
|
-
showError(error instanceof Error ? error : new Error(String(error)));
|
|
1051
|
+
showError(error instanceof Error ? error : new Error(String(error)), routeDef);
|
|
1026
1052
|
}
|
|
1027
1053
|
}
|
|
1028
1054
|
} catch (error) {
|
|
@@ -1042,13 +1068,16 @@ function Route() {
|
|
|
1042
1068
|
await originalUpdate();
|
|
1043
1069
|
routeInitialized = true;
|
|
1044
1070
|
};
|
|
1045
|
-
track(wrappedUpdate);
|
|
1071
|
+
const routeTeardown = track(wrappedUpdate);
|
|
1046
1072
|
if (!routeInitialized) {
|
|
1047
1073
|
queueMicrotask(() => {
|
|
1048
1074
|
if (!routeInitialized && anchor.parentNode) wrappedUpdate();
|
|
1049
1075
|
});
|
|
1050
1076
|
}
|
|
1051
|
-
routeCleanups.push(
|
|
1077
|
+
routeCleanups.push(() => {
|
|
1078
|
+
routeTeardown();
|
|
1079
|
+
cleanupNodes();
|
|
1080
|
+
});
|
|
1052
1081
|
return anchor;
|
|
1053
1082
|
}
|
|
1054
1083
|
function KeepAliveRoute(options) {
|
|
@@ -1077,7 +1106,11 @@ function KeepAliveRoute(options) {
|
|
|
1077
1106
|
const { route: routeDef } = match;
|
|
1078
1107
|
if ("redirect" in routeDef) {
|
|
1079
1108
|
const redirectPath = typeof routeDef.redirect === "function" ? routeDef.redirect(route2) : routeDef.redirect;
|
|
1080
|
-
queueMicrotask(() =>
|
|
1109
|
+
queueMicrotask(() => {
|
|
1110
|
+
globalRouter?.navigate(redirectPath).catch((err) => {
|
|
1111
|
+
if (typeof console !== "undefined") console.error("[router] redirect failed:", err);
|
|
1112
|
+
});
|
|
1113
|
+
});
|
|
1081
1114
|
return;
|
|
1082
1115
|
}
|
|
1083
1116
|
if (!("component" in routeDef)) return;
|
|
@@ -1147,13 +1180,14 @@ function KeepAliveRoute(options) {
|
|
|
1147
1180
|
await update();
|
|
1148
1181
|
initialized = true;
|
|
1149
1182
|
};
|
|
1150
|
-
track(wrappedUpdate);
|
|
1183
|
+
const kaTeardown = track(wrappedUpdate);
|
|
1151
1184
|
if (!initialized) {
|
|
1152
1185
|
queueMicrotask(() => {
|
|
1153
1186
|
if (!initialized && anchor.parentNode) wrappedUpdate();
|
|
1154
1187
|
});
|
|
1155
1188
|
}
|
|
1156
1189
|
routeCleanups.push(() => {
|
|
1190
|
+
kaTeardown();
|
|
1157
1191
|
for (const node of cache.values()) {
|
|
1158
1192
|
dispose(node);
|
|
1159
1193
|
if (node.parentNode) node.parentNode.removeChild(node);
|
|
@@ -1220,12 +1254,18 @@ function RouterLink(props) {
|
|
|
1220
1254
|
}
|
|
1221
1255
|
});
|
|
1222
1256
|
}
|
|
1223
|
-
|
|
1257
|
+
const onLinkClick = (e) => {
|
|
1224
1258
|
if (target || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.button !== 0) {
|
|
1225
1259
|
return;
|
|
1226
1260
|
}
|
|
1227
1261
|
e.preventDefault();
|
|
1228
|
-
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);
|
|
1229
1269
|
});
|
|
1230
1270
|
return link;
|
|
1231
1271
|
}
|
|
@@ -1336,10 +1376,21 @@ function destroyRouter() {
|
|
|
1336
1376
|
globalRouter = null;
|
|
1337
1377
|
}
|
|
1338
1378
|
}
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
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
|
+
}
|
|
1343
1394
|
}
|
|
1344
1395
|
function Outlet() {
|
|
1345
1396
|
const anchor = document.createComment("route-outlet-nested");
|
|
@@ -1365,12 +1416,20 @@ function Outlet() {
|
|
|
1365
1416
|
console.error("[Outlet] Failed to render child route:", error);
|
|
1366
1417
|
}
|
|
1367
1418
|
};
|
|
1368
|
-
track(update);
|
|
1419
|
+
const outletTeardown = track(update);
|
|
1369
1420
|
if (!anchor.parentNode) {
|
|
1370
1421
|
queueMicrotask(() => {
|
|
1371
1422
|
if (anchor.parentNode) update();
|
|
1372
1423
|
});
|
|
1373
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
|
+
});
|
|
1374
1433
|
return anchor;
|
|
1375
1434
|
}
|
|
1376
1435
|
function addRoute(route2, parentPath) {
|
|
@@ -1683,10 +1742,14 @@ function hydrateRouter(routes, options) {
|
|
|
1683
1742
|
if (container && serverState.path) {
|
|
1684
1743
|
const resolved = resolveServerRoute(serverState.path, routes);
|
|
1685
1744
|
if (resolved.component) {
|
|
1686
|
-
import("./ssr-
|
|
1745
|
+
import("./ssr-FXD2PPMC.js").then(({ hydrate }) => {
|
|
1687
1746
|
if (resolved.component) {
|
|
1688
1747
|
hydrate(resolved.component, container);
|
|
1689
1748
|
}
|
|
1749
|
+
}).catch((err) => {
|
|
1750
|
+
if (typeof console !== "undefined") {
|
|
1751
|
+
console.error("[SibuJS routerSSR] failed to load hydrate:", err);
|
|
1752
|
+
}
|
|
1690
1753
|
});
|
|
1691
1754
|
}
|
|
1692
1755
|
}
|
|
@@ -1767,6 +1830,7 @@ export {
|
|
|
1767
1830
|
Suspense,
|
|
1768
1831
|
Trans,
|
|
1769
1832
|
VERSION,
|
|
1833
|
+
__removeRouterPagehideHandler,
|
|
1770
1834
|
addRoute,
|
|
1771
1835
|
afterEach,
|
|
1772
1836
|
back,
|
|
@@ -1782,6 +1846,7 @@ export {
|
|
|
1782
1846
|
createMigrationRunner,
|
|
1783
1847
|
createModuleRegistry,
|
|
1784
1848
|
createPlugin,
|
|
1849
|
+
createPluginRegistry,
|
|
1785
1850
|
createRouter,
|
|
1786
1851
|
createSSRCache,
|
|
1787
1852
|
createSSRRouter,
|
|
@@ -1824,6 +1889,7 @@ export {
|
|
|
1824
1889
|
routerState,
|
|
1825
1890
|
satisfies,
|
|
1826
1891
|
serializeRouteState,
|
|
1892
|
+
setDefaultPluginRegistry,
|
|
1827
1893
|
setLocale,
|
|
1828
1894
|
setRouteTransition,
|
|
1829
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
|
-
|
|
181
|
-
|
|
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
|
-
|
|
181
|
-
|
|
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-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
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,
|