sibujs 4.5.0 → 4.7.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 +1 -1
- package/dist/browser.cjs +326 -133
- package/dist/browser.d.cts +46 -14
- package/dist/browser.d.ts +46 -14
- package/dist/browser.js +8 -6
- package/dist/build.cjs +2094 -1033
- package/dist/build.d.cts +133 -44
- package/dist/build.d.ts +133 -44
- package/dist/build.js +1372 -574
- package/dist/cdn.dev.global.js +10 -10
- package/dist/cdn.full.dev.global.js +11 -11
- package/dist/cdn.full.global.js +10 -10
- package/dist/cdn.global.js +10 -10
- package/dist/{chunk-2DCGACUU.js → chunk-2BPG2XDA.js} +251 -66
- package/dist/{chunk-IXKSNWV5.js → chunk-2INLLLMZ.js} +1 -1
- package/dist/{chunk-4PMLNECI.js → chunk-3QWBSL5R.js} +98 -29
- package/dist/{chunk-KKLW7YWL.js → chunk-4AWA2PVD.js} +275 -144
- package/dist/chunk-5HZXGZ6T.js +24 -0
- package/dist/{chunk-PCT43HW3.js → chunk-7LUJQAOJ.js} +1 -1
- package/dist/{chunk-5DXA2J44.js → chunk-7XHATCIH.js} +5 -2
- package/dist/chunk-BC2SECJD.js +44 -0
- package/dist/{chunk-TBYTO6BS.js → chunk-BSY63EM6.js} +136 -80
- package/dist/{chunk-FTIR4QW2.js → chunk-DKXRACVN.js} +6 -8
- package/dist/{chunk-ONOHFDLG.js → chunk-FNJXNGYZ.js} +3 -3
- package/dist/{chunk-XZZOBQAY.js → chunk-FQRUXCEE.js} +6 -5
- package/dist/{chunk-NIOYEGBQ.js → chunk-HURREPU2.js} +27 -13
- package/dist/chunk-J6FW5TV6.js +233 -0
- package/dist/{chunk-UGRX3S57.js → chunk-JWKYU5GV.js} +22 -4
- package/dist/chunk-NYNYSPK7.js +318 -0
- package/dist/{chunk-RBTPLM32.js → chunk-RUSSKG6G.js} +13 -12
- package/dist/{chunk-7LN645I6.js → chunk-SLM3IA34.js} +3 -3
- package/dist/{chunk-R25EFXXC.js → chunk-TUCPL2HB.js} +3 -3
- package/dist/{chunk-B3WHI2QA.js → chunk-UNWRJRKC.js} +55 -31
- package/dist/{chunk-KEISJXBU.js → chunk-UOL2ECCS.js} +44 -17
- package/dist/{chunk-RJE2BNI4.js → chunk-VZSG24LS.js} +108 -45
- package/dist/{chunk-RIXRAYIU.js → chunk-WEQ3DMVL.js} +10 -4
- package/dist/{chunk-3JZ4L5TJ.js → chunk-WOLJZUFQ.js} +354 -90
- package/dist/{chunk-S373NSMK.js → chunk-XYV3EDB7.js} +283 -123
- package/dist/{chunk-VZKNK2V7.js → chunk-XZR4PXRE.js} +296 -38
- package/dist/{chunk-GW3SCCZG.js → chunk-Z3OHK6QT.js} +153 -110
- package/dist/{chunk-OMJJM3KM.js → chunk-ZVL7TY4K.js} +287 -130
- package/dist/{contracts-DBdg9J_a.d.ts → contracts-CLqzJnOV.d.ts} +36 -17
- package/dist/{contracts-DBdg9J_a.d.cts → contracts-CTOJXu-x.d.cts} +36 -17
- package/dist/{customElement-OB9CIsc5.d.cts → customElement-MmInOW1U.d.cts} +21 -0
- package/dist/{customElement-OB9CIsc5.d.ts → customElement-MmInOW1U.d.ts} +21 -0
- package/dist/data.cjs +410 -155
- package/dist/data.d.cts +166 -12
- package/dist/data.d.ts +166 -12
- package/dist/data.js +12 -9
- package/dist/devtools.cjs +98 -61
- package/dist/devtools.js +7 -8
- package/dist/dispose-GEIG2KOF.js +28 -0
- package/dist/ecosystem.cjs +372 -126
- package/dist/ecosystem.d.cts +20 -3
- package/dist/ecosystem.d.ts +20 -3
- package/dist/ecosystem.js +12 -12
- package/dist/extras.cjs +2366 -909
- package/dist/extras.d.cts +11 -9
- package/dist/extras.d.ts +11 -9
- package/dist/extras.js +39 -28
- package/dist/index.cjs +421 -158
- package/dist/index.d.cts +213 -171
- package/dist/index.d.ts +213 -171
- package/dist/index.js +24 -27
- package/dist/motion.cjs +118 -44
- package/dist/motion.js +5 -5
- package/dist/patterns.cjs +344 -53
- package/dist/patterns.d.cts +28 -9
- package/dist/patterns.d.ts +28 -9
- package/dist/patterns.js +8 -8
- package/dist/performance.cjs +325 -220
- package/dist/performance.d.cts +2 -2
- package/dist/performance.d.ts +2 -2
- package/dist/performance.js +8 -9
- package/dist/plugin-DVgSnTfK.d.cts +112 -0
- package/dist/plugin-DVgSnTfK.d.ts +112 -0
- package/dist/plugins.cjs +664 -233
- package/dist/plugins.d.cts +127 -14
- package/dist/plugins.d.ts +127 -14
- package/dist/plugins.js +96 -42
- package/dist/signal-EotCj4hS.d.cts +110 -0
- package/dist/signal-EotCj4hS.d.ts +110 -0
- package/dist/{ssr-BiPRdZ6n.d.cts → ssr-Bli9XRW5.d.cts} +5 -0
- package/dist/{ssr-BiPRdZ6n.d.ts → ssr-Bli9XRW5.d.ts} +5 -0
- package/dist/{ssr-Y7XOEPEN.js → ssr-XOTUASDO.js} +4 -5
- package/dist/ssr.cjs +229 -84
- package/dist/ssr.d.cts +9 -3
- package/dist/ssr.d.ts +9 -3
- package/dist/ssr.js +11 -12
- package/dist/{startup-BMpaiMhP.d.ts → startup-BLfSeL15.d.cts} +73 -22
- package/dist/{startup-BMpaiMhP.d.cts → startup-BLfSeL15.d.ts} +73 -22
- package/dist/tagFactory-8qL9LCIx.d.cts +156 -0
- package/dist/tagFactory-BL2fymez.d.ts +156 -0
- package/dist/testing.cjs +2503 -2191
- package/dist/testing.d.cts +56 -5
- package/dist/testing.d.ts +56 -5
- package/dist/testing.js +580 -307
- package/dist/types-CJFViL6Q.d.cts +26 -0
- package/dist/types-CJFViL6Q.d.ts +26 -0
- package/dist/ui.cjs +732 -329
- package/dist/ui.d.cts +41 -7
- package/dist/ui.d.ts +41 -7
- package/dist/ui.js +151 -56
- package/dist/widgets.cjs +267 -291
- package/dist/widgets.js +9 -10
- package/package.json +4 -2
- package/dist/chunk-2WLZ6757.js +0 -149
- package/dist/chunk-CCSJMTRN.js +0 -15
- package/dist/chunk-QKRPLZ2V.js +0 -108
- package/dist/chunk-VUF4ALSW.js +0 -60
- package/dist/chunk-WWV3SJ3L.js +0 -131
- package/dist/dispose-46BOMMQJ.js +0 -19
- package/dist/plugin-D30wlGW5.d.cts +0 -71
- package/dist/plugin-D30wlGW5.d.ts +0 -71
- package/dist/tagFactory-DVoDpHye.d.cts +0 -215
- package/dist/tagFactory-DVoDpHye.d.ts +0 -215
package/dist/plugins.d.cts
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { A as Accessor } from './signal-EotCj4hS.cjs';
|
|
2
|
+
import { N as NodeChildren } from './types-CJFViL6Q.cjs';
|
|
3
|
+
import { T as TrustedHTML } from './ssr-Bli9XRW5.cjs';
|
|
4
|
+
export { P as PluginContext, a as PluginInstallCancelledError, b as PluginRegistry, S as SibuPlugin, c as createPlugin, d as createPluginRegistry, i as inject, e as isPluginInstallCancelledError, p as plugin, r as resetPlugins, s as setDefaultPluginRegistry, t as triggerPluginError, f as triggerPluginMount, g as triggerPluginUnmount } from './plugin-DVgSnTfK.cjs';
|
|
5
|
+
export { L as LazyModule, M as Migration, a as MigrationStorageError, P as PackageExportTarget, S as SemVer, V as VERSION, b as bundlerMetadata, c as checkCompatibility, d as compareSemVer, e as createBootSequence, f as createBundle, g as createMigrationRunner, h as createModuleRegistry, i as createSSRCache, j as createTestHarness, k as deferNonCritical, l as env, m as healthCheck, n as lazyModule, p as packageInfo, o as parseSemVer, q as preloadCritical, r as prerenderRoutes, s as satisfies } from './startup-BLfSeL15.cjs';
|
|
4
6
|
|
|
5
7
|
type Translations = Record<string, string>;
|
|
6
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Interpolation parameters for `t()`, `translated()` and `Trans()`.
|
|
10
|
+
*
|
|
11
|
+
* A value may be a GETTER (a signal accessor or any `() => value`). Getters are
|
|
12
|
+
* called at lookup time, so inside a binding the parameter is tracked exactly
|
|
13
|
+
* like the locale: `translated("hello", { name: userName })` re-renders when
|
|
14
|
+
* either `userName` or the locale changes.
|
|
15
|
+
*/
|
|
16
|
+
type TranslationParams = Record<string, string | number | (() => string | number)>;
|
|
17
|
+
type Params$1 = TranslationParams;
|
|
7
18
|
/**
|
|
8
19
|
* Set the active locale.
|
|
9
20
|
*
|
|
@@ -56,21 +67,72 @@ declare function getLocale(): string;
|
|
|
56
67
|
* because the assignment form would invoke the inherited `__proto__` setter for
|
|
57
68
|
* a locale of that name instead of registering it. Locale names and translation
|
|
58
69
|
* keys are treated literally throughout — see PROTOTYPE SAFETY above.
|
|
70
|
+
*
|
|
71
|
+
* NOTIFY. Every registration bumps the dictionary revision, so bindings that
|
|
72
|
+
* already rendered a key re-run and pick the new message up — the order of
|
|
73
|
+
* `setLocale()` and `registerTranslations()` no longer matters. The bump comes
|
|
74
|
+
* after publication, so a re-running binding can only ever see the new
|
|
75
|
+
* dictionary.
|
|
59
76
|
*/
|
|
60
77
|
declare function registerTranslations(locale: string, messages: Translations): void;
|
|
61
78
|
/**
|
|
62
79
|
* Translate `key` in the current locale, falling back to the key itself when it
|
|
63
80
|
* is not registered. A registered empty string is a translation and is returned
|
|
64
81
|
* unchanged; the previous `|| key` discarded it and returned the key.
|
|
82
|
+
*
|
|
83
|
+
* `t()` returns a STRING — a snapshot. It is live only when it is read inside a
|
|
84
|
+
* binding (`span(() => t("hello"))`), because that binding is what re-runs.
|
|
85
|
+
* Called directly in a component body, `span(t("hello"))` renders the message
|
|
86
|
+
* once and never updates. For anything on screen prefer {@link translated},
|
|
87
|
+
* which hands the binding a getter and works for text children and attributes
|
|
88
|
+
* alike. `t()` remains the right call for one-off strings: event handlers,
|
|
89
|
+
* `confirm()` prompts, log lines, server renders.
|
|
90
|
+
*
|
|
91
|
+
* Parameter getters are resolved on every call, so `t("hi", { name: userName })`
|
|
92
|
+
* inside a binding tracks `userName` too.
|
|
65
93
|
*/
|
|
66
94
|
declare function t(key: string, params?: Params$1): string;
|
|
67
95
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
96
|
+
* A LIVE translation: returns a getter that re-reads the message every time a
|
|
97
|
+
* binding calls it. Pass it anywhere the tag factories accept a reactive value
|
|
98
|
+
* — a text child or any attribute — and only that one text node or attribute
|
|
99
|
+
* updates when the locale changes, when messages for it are registered later,
|
|
100
|
+
* or when a getter parameter changes. The surrounding elements are never
|
|
101
|
+
* rebuilt, so focus, typed input values and element identity survive a language
|
|
102
|
+
* switch.
|
|
103
|
+
*
|
|
104
|
+
* During SSR the binding evaluates once, using the locale of the current
|
|
105
|
+
* request.
|
|
106
|
+
*
|
|
107
|
+
* @param key Translation key
|
|
108
|
+
* @param params Optional interpolation parameters; values may be getters
|
|
109
|
+
* @returns An accessor producing the translated string
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```ts
|
|
113
|
+
* const [userName] = signal("Ada");
|
|
114
|
+
*
|
|
115
|
+
* header([
|
|
116
|
+
* h1(translated("app.title")),
|
|
117
|
+
* span(translated("greeting", { name: userName })),
|
|
118
|
+
* input({ placeholder: translated("search.placeholder"), "aria-label": translated("search.label") }),
|
|
119
|
+
* ]);
|
|
120
|
+
*
|
|
121
|
+
* setLocale("es"); // text and attributes update in place — no re-render
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
declare function translated(key: string, params?: Params$1): Accessor<string>;
|
|
125
|
+
/**
|
|
126
|
+
* Trans component — renders a translated string reactively inside a `<span>`.
|
|
127
|
+
* Automatically updates when the client locale changes, when messages for the
|
|
128
|
+
* active locale are registered, and when a getter parameter changes. During SSR
|
|
129
|
+
* it renders once, using the locale belonging to the current request.
|
|
130
|
+
*
|
|
131
|
+
* When no wrapper element is wanted, pass {@link translated} straight to the
|
|
132
|
+
* parent instead: `p(translated("greeting"))`.
|
|
71
133
|
*
|
|
72
134
|
* @param key Translation key
|
|
73
|
-
* @param params Optional interpolation parameters
|
|
135
|
+
* @param params Optional interpolation parameters; values may be getters
|
|
74
136
|
* @returns An HTMLElement (span) that reactively shows the translated text
|
|
75
137
|
*
|
|
76
138
|
* @example
|
|
@@ -78,8 +140,8 @@ declare function t(key: string, params?: Params$1): string;
|
|
|
78
140
|
* registerTranslations("en", { greeting: "Hello, {name}!" });
|
|
79
141
|
* registerTranslations("es", { greeting: "Hola, {name}!" });
|
|
80
142
|
*
|
|
81
|
-
* div([Trans("greeting", { name:
|
|
82
|
-
* // When locale changes, the text updates automatically
|
|
143
|
+
* div([Trans("greeting", { name: userName })]);
|
|
144
|
+
* // When the locale or userName changes, the text updates automatically
|
|
83
145
|
* ```
|
|
84
146
|
*/
|
|
85
147
|
declare function Trans(key: string, params?: Params$1): HTMLElement;
|
|
@@ -98,6 +160,9 @@ declare function hasTranslation(key: string): boolean;
|
|
|
98
160
|
*
|
|
99
161
|
* Own enumerable keys, so a locale is listed exactly when it was registered -
|
|
100
162
|
* including one named `"__proto__"`, which publication now stores literally.
|
|
163
|
+
*
|
|
164
|
+
* Read inside a binding the list is live: registering a new locale re-runs it,
|
|
165
|
+
* so a language picker built from it picks up lazily loaded locales.
|
|
101
166
|
*/
|
|
102
167
|
declare function getAvailableLocales(): string[];
|
|
103
168
|
|
|
@@ -127,6 +192,41 @@ interface RouteBase {
|
|
|
127
192
|
readonly children?: RouteDef[];
|
|
128
193
|
readonly beforeEnter?: Guard | Guard[];
|
|
129
194
|
readonly alias?: string | string[];
|
|
195
|
+
/**
|
|
196
|
+
* Identity of the mounted instance of this route's component.
|
|
197
|
+
*
|
|
198
|
+
* When a navigation stays on this route but the key changes, the outlet
|
|
199
|
+
* disposes the old instance (running its `onUnmount` / `onCleanup`
|
|
200
|
+
* callbacks and releasing its bindings) and mounts a fresh one — so a page
|
|
201
|
+
* that reads `route().params.id` once at setup always sees the right id.
|
|
202
|
+
*
|
|
203
|
+
* **Default:** the path params this record declares in its *own* path (and
|
|
204
|
+
* aliases). `/records/1` → `/records/2` remounts; `?tab=a` → `?tab=b` or a
|
|
205
|
+
* hash change does not. A parent layout is not remounted when only a child's
|
|
206
|
+
* param changes — the child's `Outlet()` remounts the child instead. A
|
|
207
|
+
* record with no params of its own is never remounted by a param change, and
|
|
208
|
+
* a `*` tail (`pathMatch`) is not part of the default: a catch-all keeps its
|
|
209
|
+
* instance and reads `pathMatch` reactively (`key: (r) => r.params.pathMatch`
|
|
210
|
+
* remounts per path).
|
|
211
|
+
*
|
|
212
|
+
* **Override:** return any string derived from the route. Return a constant
|
|
213
|
+
* to keep one long-lived instance across param changes (the instance must
|
|
214
|
+
* then read params reactively, e.g. `routerState().params()` or
|
|
215
|
+
* `() => route().params.id`). Include query values to also remount on a
|
|
216
|
+
* query change.
|
|
217
|
+
*
|
|
218
|
+
* Called untracked with the committed route. Ignored by `KeepAliveRoute()`,
|
|
219
|
+
* which already keeps one instance per full location.
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```ts
|
|
223
|
+
* // Keep one instance for every record; the page reads params reactively.
|
|
224
|
+
* { path: "/records/:id", component: RecordPage, key: () => "record" }
|
|
225
|
+
* // Also remount when ?tab changes.
|
|
226
|
+
* { path: "/records/:id", component: RecordPage, key: (r) => `${r.params.id}|${r.query.tab ?? ""}` }
|
|
227
|
+
* ```
|
|
228
|
+
*/
|
|
229
|
+
readonly key?: (route: RouteContext) => string;
|
|
130
230
|
}
|
|
131
231
|
interface ComponentRoute extends RouteBase {
|
|
132
232
|
readonly component: Component;
|
|
@@ -367,6 +467,11 @@ declare function setRoutes(routes: RouteDef[]): void;
|
|
|
367
467
|
/**
|
|
368
468
|
* Read the current route as a plain snapshot.
|
|
369
469
|
*
|
|
470
|
+
* Reading it once in a route component's setup is safe: when a navigation
|
|
471
|
+
* changes that route's own params, the outlet mounts a fresh instance (see
|
|
472
|
+
* `RouteBase.key`). Inside a getter — `() => route().params.id` — the read is
|
|
473
|
+
* reactive, which is what a long-lived layout or a constant-`key` route needs.
|
|
474
|
+
*
|
|
370
475
|
* @returns The active {@link RouteContext} (path, params, query, hash).
|
|
371
476
|
* @throws If no router has been created yet.
|
|
372
477
|
*/
|
|
@@ -456,7 +561,10 @@ declare function beforeResolve(guard: NavigationGuard): () => void;
|
|
|
456
561
|
declare function afterEach(hook: (to: RouteContext, from: RouteContext) => void): () => void;
|
|
457
562
|
/**
|
|
458
563
|
* The route outlet: renders whichever component matches the current route, and
|
|
459
|
-
* swaps it
|
|
564
|
+
* swaps it when the top-level matched record or its instance key changes. By
|
|
565
|
+
* default the key is that record's own path params, so `/records/1` →
|
|
566
|
+
* `/records/2` mounts a fresh instance while a query- or hash-only change keeps
|
|
567
|
+
* the current one (see `RouteBase.key`).
|
|
460
568
|
*
|
|
461
569
|
* @returns A Comment anchor that manages the matched component. Like every
|
|
462
570
|
* factory here it hands back a live node the caller can insert directly.
|
|
@@ -525,11 +633,11 @@ declare function RouterLink(props: {
|
|
|
525
633
|
activeClass?: string;
|
|
526
634
|
exactActiveClass?: string;
|
|
527
635
|
/** @deprecated Pass children positionally: `RouterLink(props, children)`. */
|
|
528
|
-
nodes?:
|
|
636
|
+
nodes?: NodeChildren;
|
|
529
637
|
target?: string;
|
|
530
638
|
rel?: string;
|
|
531
639
|
[key: string]: unknown;
|
|
532
|
-
}, children?:
|
|
640
|
+
}, children?: NodeChildren): HTMLAnchorElement;
|
|
533
641
|
/**
|
|
534
642
|
* Async boundary for code-split / deferred content.
|
|
535
643
|
*
|
|
@@ -617,6 +725,11 @@ declare function __removeRouterPagehideHandler(): void;
|
|
|
617
725
|
/**
|
|
618
726
|
* Outlet renders the child route component within a layout.
|
|
619
727
|
* Use inside a parent route's component to render matched children.
|
|
728
|
+
*
|
|
729
|
+
* The child is remounted when the matched child record changes or when its
|
|
730
|
+
* instance key does — by default the params declared below the top-level
|
|
731
|
+
* record, so a child-only param change remounts the child and leaves the
|
|
732
|
+
* layout in place (see `RouteBase.key`).
|
|
620
733
|
*/
|
|
621
734
|
declare function Outlet(): Node;
|
|
622
735
|
/**
|
|
@@ -782,4 +895,4 @@ declare function createSSRRouter(routes: SSRRouteDef[]): {
|
|
|
782
895
|
}) => string;
|
|
783
896
|
};
|
|
784
897
|
|
|
785
|
-
export { type AsyncComponent, type AsyncRoute, type Component, type ComponentRoute, type Guard, type GuardResult, KeepAliveRoute, type LazyComponent, type LazyRoute, type NavigationFailure, type NavigationFailureReason, 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, __getNavigationEpoch, __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 };
|
|
898
|
+
export { type AsyncComponent, type AsyncRoute, type Component, type ComponentRoute, type Guard, type GuardResult, KeepAliveRoute, type LazyComponent, type LazyRoute, type NavigationFailure, type NavigationFailureReason, 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, type TranslationParams, __getNavigationEpoch, __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, translated };
|
package/dist/plugins.d.ts
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { A as Accessor } from './signal-EotCj4hS.js';
|
|
2
|
+
import { N as NodeChildren } from './types-CJFViL6Q.js';
|
|
3
|
+
import { T as TrustedHTML } from './ssr-Bli9XRW5.js';
|
|
4
|
+
export { P as PluginContext, a as PluginInstallCancelledError, b as PluginRegistry, S as SibuPlugin, c as createPlugin, d as createPluginRegistry, i as inject, e as isPluginInstallCancelledError, p as plugin, r as resetPlugins, s as setDefaultPluginRegistry, t as triggerPluginError, f as triggerPluginMount, g as triggerPluginUnmount } from './plugin-DVgSnTfK.js';
|
|
5
|
+
export { L as LazyModule, M as Migration, a as MigrationStorageError, P as PackageExportTarget, S as SemVer, V as VERSION, b as bundlerMetadata, c as checkCompatibility, d as compareSemVer, e as createBootSequence, f as createBundle, g as createMigrationRunner, h as createModuleRegistry, i as createSSRCache, j as createTestHarness, k as deferNonCritical, l as env, m as healthCheck, n as lazyModule, p as packageInfo, o as parseSemVer, q as preloadCritical, r as prerenderRoutes, s as satisfies } from './startup-BLfSeL15.js';
|
|
4
6
|
|
|
5
7
|
type Translations = Record<string, string>;
|
|
6
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Interpolation parameters for `t()`, `translated()` and `Trans()`.
|
|
10
|
+
*
|
|
11
|
+
* A value may be a GETTER (a signal accessor or any `() => value`). Getters are
|
|
12
|
+
* called at lookup time, so inside a binding the parameter is tracked exactly
|
|
13
|
+
* like the locale: `translated("hello", { name: userName })` re-renders when
|
|
14
|
+
* either `userName` or the locale changes.
|
|
15
|
+
*/
|
|
16
|
+
type TranslationParams = Record<string, string | number | (() => string | number)>;
|
|
17
|
+
type Params$1 = TranslationParams;
|
|
7
18
|
/**
|
|
8
19
|
* Set the active locale.
|
|
9
20
|
*
|
|
@@ -56,21 +67,72 @@ declare function getLocale(): string;
|
|
|
56
67
|
* because the assignment form would invoke the inherited `__proto__` setter for
|
|
57
68
|
* a locale of that name instead of registering it. Locale names and translation
|
|
58
69
|
* keys are treated literally throughout — see PROTOTYPE SAFETY above.
|
|
70
|
+
*
|
|
71
|
+
* NOTIFY. Every registration bumps the dictionary revision, so bindings that
|
|
72
|
+
* already rendered a key re-run and pick the new message up — the order of
|
|
73
|
+
* `setLocale()` and `registerTranslations()` no longer matters. The bump comes
|
|
74
|
+
* after publication, so a re-running binding can only ever see the new
|
|
75
|
+
* dictionary.
|
|
59
76
|
*/
|
|
60
77
|
declare function registerTranslations(locale: string, messages: Translations): void;
|
|
61
78
|
/**
|
|
62
79
|
* Translate `key` in the current locale, falling back to the key itself when it
|
|
63
80
|
* is not registered. A registered empty string is a translation and is returned
|
|
64
81
|
* unchanged; the previous `|| key` discarded it and returned the key.
|
|
82
|
+
*
|
|
83
|
+
* `t()` returns a STRING — a snapshot. It is live only when it is read inside a
|
|
84
|
+
* binding (`span(() => t("hello"))`), because that binding is what re-runs.
|
|
85
|
+
* Called directly in a component body, `span(t("hello"))` renders the message
|
|
86
|
+
* once and never updates. For anything on screen prefer {@link translated},
|
|
87
|
+
* which hands the binding a getter and works for text children and attributes
|
|
88
|
+
* alike. `t()` remains the right call for one-off strings: event handlers,
|
|
89
|
+
* `confirm()` prompts, log lines, server renders.
|
|
90
|
+
*
|
|
91
|
+
* Parameter getters are resolved on every call, so `t("hi", { name: userName })`
|
|
92
|
+
* inside a binding tracks `userName` too.
|
|
65
93
|
*/
|
|
66
94
|
declare function t(key: string, params?: Params$1): string;
|
|
67
95
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
96
|
+
* A LIVE translation: returns a getter that re-reads the message every time a
|
|
97
|
+
* binding calls it. Pass it anywhere the tag factories accept a reactive value
|
|
98
|
+
* — a text child or any attribute — and only that one text node or attribute
|
|
99
|
+
* updates when the locale changes, when messages for it are registered later,
|
|
100
|
+
* or when a getter parameter changes. The surrounding elements are never
|
|
101
|
+
* rebuilt, so focus, typed input values and element identity survive a language
|
|
102
|
+
* switch.
|
|
103
|
+
*
|
|
104
|
+
* During SSR the binding evaluates once, using the locale of the current
|
|
105
|
+
* request.
|
|
106
|
+
*
|
|
107
|
+
* @param key Translation key
|
|
108
|
+
* @param params Optional interpolation parameters; values may be getters
|
|
109
|
+
* @returns An accessor producing the translated string
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```ts
|
|
113
|
+
* const [userName] = signal("Ada");
|
|
114
|
+
*
|
|
115
|
+
* header([
|
|
116
|
+
* h1(translated("app.title")),
|
|
117
|
+
* span(translated("greeting", { name: userName })),
|
|
118
|
+
* input({ placeholder: translated("search.placeholder"), "aria-label": translated("search.label") }),
|
|
119
|
+
* ]);
|
|
120
|
+
*
|
|
121
|
+
* setLocale("es"); // text and attributes update in place — no re-render
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
declare function translated(key: string, params?: Params$1): Accessor<string>;
|
|
125
|
+
/**
|
|
126
|
+
* Trans component — renders a translated string reactively inside a `<span>`.
|
|
127
|
+
* Automatically updates when the client locale changes, when messages for the
|
|
128
|
+
* active locale are registered, and when a getter parameter changes. During SSR
|
|
129
|
+
* it renders once, using the locale belonging to the current request.
|
|
130
|
+
*
|
|
131
|
+
* When no wrapper element is wanted, pass {@link translated} straight to the
|
|
132
|
+
* parent instead: `p(translated("greeting"))`.
|
|
71
133
|
*
|
|
72
134
|
* @param key Translation key
|
|
73
|
-
* @param params Optional interpolation parameters
|
|
135
|
+
* @param params Optional interpolation parameters; values may be getters
|
|
74
136
|
* @returns An HTMLElement (span) that reactively shows the translated text
|
|
75
137
|
*
|
|
76
138
|
* @example
|
|
@@ -78,8 +140,8 @@ declare function t(key: string, params?: Params$1): string;
|
|
|
78
140
|
* registerTranslations("en", { greeting: "Hello, {name}!" });
|
|
79
141
|
* registerTranslations("es", { greeting: "Hola, {name}!" });
|
|
80
142
|
*
|
|
81
|
-
* div([Trans("greeting", { name:
|
|
82
|
-
* // When locale changes, the text updates automatically
|
|
143
|
+
* div([Trans("greeting", { name: userName })]);
|
|
144
|
+
* // When the locale or userName changes, the text updates automatically
|
|
83
145
|
* ```
|
|
84
146
|
*/
|
|
85
147
|
declare function Trans(key: string, params?: Params$1): HTMLElement;
|
|
@@ -98,6 +160,9 @@ declare function hasTranslation(key: string): boolean;
|
|
|
98
160
|
*
|
|
99
161
|
* Own enumerable keys, so a locale is listed exactly when it was registered -
|
|
100
162
|
* including one named `"__proto__"`, which publication now stores literally.
|
|
163
|
+
*
|
|
164
|
+
* Read inside a binding the list is live: registering a new locale re-runs it,
|
|
165
|
+
* so a language picker built from it picks up lazily loaded locales.
|
|
101
166
|
*/
|
|
102
167
|
declare function getAvailableLocales(): string[];
|
|
103
168
|
|
|
@@ -127,6 +192,41 @@ interface RouteBase {
|
|
|
127
192
|
readonly children?: RouteDef[];
|
|
128
193
|
readonly beforeEnter?: Guard | Guard[];
|
|
129
194
|
readonly alias?: string | string[];
|
|
195
|
+
/**
|
|
196
|
+
* Identity of the mounted instance of this route's component.
|
|
197
|
+
*
|
|
198
|
+
* When a navigation stays on this route but the key changes, the outlet
|
|
199
|
+
* disposes the old instance (running its `onUnmount` / `onCleanup`
|
|
200
|
+
* callbacks and releasing its bindings) and mounts a fresh one — so a page
|
|
201
|
+
* that reads `route().params.id` once at setup always sees the right id.
|
|
202
|
+
*
|
|
203
|
+
* **Default:** the path params this record declares in its *own* path (and
|
|
204
|
+
* aliases). `/records/1` → `/records/2` remounts; `?tab=a` → `?tab=b` or a
|
|
205
|
+
* hash change does not. A parent layout is not remounted when only a child's
|
|
206
|
+
* param changes — the child's `Outlet()` remounts the child instead. A
|
|
207
|
+
* record with no params of its own is never remounted by a param change, and
|
|
208
|
+
* a `*` tail (`pathMatch`) is not part of the default: a catch-all keeps its
|
|
209
|
+
* instance and reads `pathMatch` reactively (`key: (r) => r.params.pathMatch`
|
|
210
|
+
* remounts per path).
|
|
211
|
+
*
|
|
212
|
+
* **Override:** return any string derived from the route. Return a constant
|
|
213
|
+
* to keep one long-lived instance across param changes (the instance must
|
|
214
|
+
* then read params reactively, e.g. `routerState().params()` or
|
|
215
|
+
* `() => route().params.id`). Include query values to also remount on a
|
|
216
|
+
* query change.
|
|
217
|
+
*
|
|
218
|
+
* Called untracked with the committed route. Ignored by `KeepAliveRoute()`,
|
|
219
|
+
* which already keeps one instance per full location.
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```ts
|
|
223
|
+
* // Keep one instance for every record; the page reads params reactively.
|
|
224
|
+
* { path: "/records/:id", component: RecordPage, key: () => "record" }
|
|
225
|
+
* // Also remount when ?tab changes.
|
|
226
|
+
* { path: "/records/:id", component: RecordPage, key: (r) => `${r.params.id}|${r.query.tab ?? ""}` }
|
|
227
|
+
* ```
|
|
228
|
+
*/
|
|
229
|
+
readonly key?: (route: RouteContext) => string;
|
|
130
230
|
}
|
|
131
231
|
interface ComponentRoute extends RouteBase {
|
|
132
232
|
readonly component: Component;
|
|
@@ -367,6 +467,11 @@ declare function setRoutes(routes: RouteDef[]): void;
|
|
|
367
467
|
/**
|
|
368
468
|
* Read the current route as a plain snapshot.
|
|
369
469
|
*
|
|
470
|
+
* Reading it once in a route component's setup is safe: when a navigation
|
|
471
|
+
* changes that route's own params, the outlet mounts a fresh instance (see
|
|
472
|
+
* `RouteBase.key`). Inside a getter — `() => route().params.id` — the read is
|
|
473
|
+
* reactive, which is what a long-lived layout or a constant-`key` route needs.
|
|
474
|
+
*
|
|
370
475
|
* @returns The active {@link RouteContext} (path, params, query, hash).
|
|
371
476
|
* @throws If no router has been created yet.
|
|
372
477
|
*/
|
|
@@ -456,7 +561,10 @@ declare function beforeResolve(guard: NavigationGuard): () => void;
|
|
|
456
561
|
declare function afterEach(hook: (to: RouteContext, from: RouteContext) => void): () => void;
|
|
457
562
|
/**
|
|
458
563
|
* The route outlet: renders whichever component matches the current route, and
|
|
459
|
-
* swaps it
|
|
564
|
+
* swaps it when the top-level matched record or its instance key changes. By
|
|
565
|
+
* default the key is that record's own path params, so `/records/1` →
|
|
566
|
+
* `/records/2` mounts a fresh instance while a query- or hash-only change keeps
|
|
567
|
+
* the current one (see `RouteBase.key`).
|
|
460
568
|
*
|
|
461
569
|
* @returns A Comment anchor that manages the matched component. Like every
|
|
462
570
|
* factory here it hands back a live node the caller can insert directly.
|
|
@@ -525,11 +633,11 @@ declare function RouterLink(props: {
|
|
|
525
633
|
activeClass?: string;
|
|
526
634
|
exactActiveClass?: string;
|
|
527
635
|
/** @deprecated Pass children positionally: `RouterLink(props, children)`. */
|
|
528
|
-
nodes?:
|
|
636
|
+
nodes?: NodeChildren;
|
|
529
637
|
target?: string;
|
|
530
638
|
rel?: string;
|
|
531
639
|
[key: string]: unknown;
|
|
532
|
-
}, children?:
|
|
640
|
+
}, children?: NodeChildren): HTMLAnchorElement;
|
|
533
641
|
/**
|
|
534
642
|
* Async boundary for code-split / deferred content.
|
|
535
643
|
*
|
|
@@ -617,6 +725,11 @@ declare function __removeRouterPagehideHandler(): void;
|
|
|
617
725
|
/**
|
|
618
726
|
* Outlet renders the child route component within a layout.
|
|
619
727
|
* Use inside a parent route's component to render matched children.
|
|
728
|
+
*
|
|
729
|
+
* The child is remounted when the matched child record changes or when its
|
|
730
|
+
* instance key does — by default the params declared below the top-level
|
|
731
|
+
* record, so a child-only param change remounts the child and leaves the
|
|
732
|
+
* layout in place (see `RouteBase.key`).
|
|
620
733
|
*/
|
|
621
734
|
declare function Outlet(): Node;
|
|
622
735
|
/**
|
|
@@ -782,4 +895,4 @@ declare function createSSRRouter(routes: SSRRouteDef[]): {
|
|
|
782
895
|
}) => string;
|
|
783
896
|
};
|
|
784
897
|
|
|
785
|
-
export { type AsyncComponent, type AsyncRoute, type Component, type ComponentRoute, type Guard, type GuardResult, KeepAliveRoute, type LazyComponent, type LazyRoute, type NavigationFailure, type NavigationFailureReason, 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, __getNavigationEpoch, __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 };
|
|
898
|
+
export { type AsyncComponent, type AsyncRoute, type Component, type ComponentRoute, type Guard, type GuardResult, KeepAliveRoute, type LazyComponent, type LazyRoute, type NavigationFailure, type NavigationFailureReason, 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, type TranslationParams, __getNavigationEpoch, __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, translated };
|