sibujs 3.4.0 → 4.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/LICENSE +21 -21
- package/README.md +118 -15
- package/dist/browser.cjs +410 -101
- package/dist/browser.d.cts +50 -5
- package/dist/browser.d.ts +50 -5
- package/dist/browser.js +8 -6
- package/dist/build.cjs +777 -385
- package/dist/build.js +15 -15
- package/dist/cdn.global.js +11 -7
- package/dist/{chunk-JCO7AHNU.js → chunk-3EKJK5FZ.js} +73 -34
- package/dist/chunk-4MFZMLUU.js +147 -0
- package/dist/chunk-52XFPGSN.js +123 -0
- package/dist/chunk-5INI7D2L.js +194 -0
- package/dist/{chunk-OAVXAFAY.js → chunk-6LG2T7LO.js} +5 -5
- package/dist/{chunk-OOUQUCNN.js → chunk-ACBT6UZS.js} +57 -22
- package/dist/{chunk-F7HW2NI5.js → chunk-AW6HPJ3L.js} +1 -1
- package/dist/chunk-DHDZ7IVN.js +109 -0
- package/dist/{chunk-JNGGM2XE.js → chunk-DQVUBVNX.js} +16 -25
- package/dist/{chunk-AXFWGY32.js → chunk-DR7H6UGM.js} +232 -67
- package/dist/{chunk-WSGLJYFI.js → chunk-E62UADKL.js} +9 -3
- package/dist/{chunk-3Z2NGWQI.js → chunk-ES2GERY2.js} +1 -1
- package/dist/{chunk-S3V6ZXPI.js → chunk-EWEE7NBF.js} +115 -41
- package/dist/{chunk-3DVGCW7O.js → chunk-F64ZPCFE.js} +8 -8
- package/dist/{chunk-APFRCIRI.js → chunk-GCSGGA3Q.js} +295 -198
- package/dist/{chunk-EX77FXTT.js → chunk-HYCCIYNS.js} +228 -51
- package/dist/{chunk-ELXMRSVN.js → chunk-NF3LYCQH.js} +259 -124
- package/dist/chunk-O3QQ3XOL.js +61 -0
- package/dist/{chunk-BUKYCWHX.js → chunk-PBQEW5VW.js} +14 -10
- package/dist/{chunk-H5FI5WDP.js → chunk-RRIDJQ5C.js} +3 -3
- package/dist/{chunk-S3NFJO6L.js → chunk-TIRZCERI.js} +36 -5
- package/dist/{chunk-ODXVQ3CS.js → chunk-VFHIVEPF.js} +309 -188
- package/dist/chunk-VPP2FONR.js +142 -0
- package/dist/{chunk-KZBEVFXZ.js → chunk-W55YHPEP.js} +5 -3
- package/dist/{chunk-FKQG7FTY.js → chunk-WN6WDFCB.js} +4 -4
- package/dist/{chunk-CEBWDD63.js → chunk-WOOMUJFT.js} +228 -86
- package/dist/{chunk-ITWCTZYH.js → chunk-Z2CE42DB.js} +19 -25
- package/dist/{contracts-ey_Qh8ef.d.cts → contracts-Hg6ITAEF.d.cts} +6 -6
- package/dist/{contracts-ey_Qh8ef.d.ts → contracts-Hg6ITAEF.d.ts} +6 -6
- package/dist/{customElement-CPfIrbvg.d.ts → customElement-CKLoO63w.d.cts} +73 -11
- package/dist/{customElement-CPfIrbvg.d.cts → customElement-CKLoO63w.d.ts} +73 -11
- package/dist/data.cjs +483 -205
- package/dist/data.d.cts +139 -7
- package/dist/data.d.ts +139 -7
- package/dist/data.js +9 -9
- package/dist/devtools.cjs +222 -87
- package/dist/devtools.js +8 -8
- package/dist/dispose-4FZ6OFXR.js +19 -0
- package/dist/ecosystem.cjs +419 -175
- package/dist/ecosystem.js +11 -11
- package/dist/extras.cjs +1981 -765
- package/dist/extras.d.cts +7 -7
- package/dist/extras.d.ts +7 -7
- package/dist/extras.js +29 -26
- package/dist/index.cjs +784 -385
- package/dist/index.d.cts +299 -28
- package/dist/index.d.ts +299 -28
- package/dist/index.js +33 -18
- package/dist/motion.cjs +180 -50
- package/dist/motion.d.cts +26 -0
- package/dist/motion.d.ts +26 -0
- package/dist/motion.js +5 -5
- package/dist/patterns.cjs +437 -170
- package/dist/patterns.d.cts +60 -13
- package/dist/patterns.d.ts +60 -13
- package/dist/patterns.js +7 -7
- package/dist/performance.cjs +333 -148
- package/dist/performance.d.cts +55 -7
- package/dist/performance.d.ts +55 -7
- package/dist/performance.js +9 -9
- package/dist/plugins.cjs +1374 -576
- package/dist/plugins.d.cts +227 -9
- package/dist/plugins.d.ts +227 -9
- package/dist/plugins.js +613 -321
- package/dist/{ssr-D62yFwuw.d.cts → ssr-BiPRdZ6n.d.cts} +44 -15
- package/dist/{ssr-D62yFwuw.d.ts → ssr-BiPRdZ6n.d.ts} +44 -15
- package/dist/{ssr-2PPULEK2.js → ssr-JFP5535P.js} +5 -4
- package/dist/ssr.cjs +1104 -443
- package/dist/ssr.d.cts +230 -20
- package/dist/ssr.d.ts +230 -20
- package/dist/ssr.js +15 -12
- package/dist/{startup-0Qv6aosO.d.cts → startup-BMpaiMhP.d.cts} +1 -1
- package/dist/{startup-0Qv6aosO.d.ts → startup-BMpaiMhP.d.ts} +1 -1
- package/dist/testing.cjs +205 -63
- package/dist/testing.d.cts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +8 -10
- package/dist/ui.cjs +640 -199
- package/dist/ui.d.cts +2 -2
- package/dist/ui.d.ts +2 -2
- package/dist/ui.js +10 -10
- package/dist/widgets.cjs +207 -82
- package/dist/widgets.js +9 -9
- package/package.json +12 -7
- package/dist/chunk-5VGSK6D2.js +0 -80
- package/dist/chunk-COY6PUD2.js +0 -34
- package/dist/chunk-K35BAR4P.js +0 -96
- package/dist/chunk-L3GAGWCC.js +0 -111
- package/dist/chunk-RT3IYFN2.js +0 -38
package/dist/plugins.d.cts
CHANGED
|
@@ -1,19 +1,73 @@
|
|
|
1
|
-
import { T as TrustedHTML } from './ssr-
|
|
1
|
+
import { T as TrustedHTML } from './ssr-BiPRdZ6n.cjs';
|
|
2
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
|
-
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-
|
|
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-BMpaiMhP.cjs';
|
|
4
4
|
|
|
5
5
|
type Translations = Record<string, string>;
|
|
6
6
|
type Params$1 = Record<string, string | number>;
|
|
7
|
+
/**
|
|
8
|
+
* Set the active locale.
|
|
9
|
+
*
|
|
10
|
+
* Inside an SSR request this sets the locale for THAT request only, leaving the
|
|
11
|
+
* application-wide default alone, so one request can never change what a
|
|
12
|
+
* concurrent one renders. Outside a request it updates the client locale
|
|
13
|
+
* reactively, exactly as before.
|
|
14
|
+
*/
|
|
7
15
|
declare function setLocale(locale: string): void;
|
|
8
16
|
/**
|
|
9
|
-
* Get the current locale
|
|
17
|
+
* Get the current locale.
|
|
18
|
+
*
|
|
19
|
+
* Inside an SSR request this is the locale that request selected, or — when it
|
|
20
|
+
* never called `setLocale()` — the application default, which preserves the
|
|
21
|
+
* established `"en"` behaviour while still honouring an application that sets a
|
|
22
|
+
* different default at startup.
|
|
23
|
+
*
|
|
24
|
+
* Outside a request it is the client locale, and the read is reactive: a
|
|
25
|
+
* subscriber re-runs when `setLocale()` changes it.
|
|
10
26
|
*/
|
|
11
27
|
declare function getLocale(): string;
|
|
28
|
+
/**
|
|
29
|
+
* Register translation messages for a locale.
|
|
30
|
+
*
|
|
31
|
+
* Dictionaries are APPLICATION-GLOBAL, including when this is called from
|
|
32
|
+
* inside an SSR request: messages registered anywhere are visible everywhere,
|
|
33
|
+
* and merging preserves whatever was registered before.
|
|
34
|
+
*
|
|
35
|
+
* PREPARE, THEN COMMIT. `messages` is caller-controlled, and spreading it runs
|
|
36
|
+
* the caller's property getters and proxy traps — arbitrary synchronous code
|
|
37
|
+
* that can call this function again. Merging in a single expression
|
|
38
|
+
*
|
|
39
|
+
* locales[locale] = { ...locales[locale], ...messages };
|
|
40
|
+
*
|
|
41
|
+
* captures the dictionary BEFORE that code runs and writes it back after, so a
|
|
42
|
+
* nested registration that committed in between is silently erased. Copying
|
|
43
|
+
* `messages` first leaves a plain object with no getters left, so by the time
|
|
44
|
+
* the live dictionary is read for the merge no caller code can run again.
|
|
45
|
+
*
|
|
46
|
+
* Precedence, deliberately: the outer call's prepared values win over a nested
|
|
47
|
+
* call's for the same key — it is the registration the caller asked for last,
|
|
48
|
+
* and its value was computed from what it intended to publish. Nested keys the
|
|
49
|
+
* outer object does not mention survive untouched.
|
|
50
|
+
*
|
|
51
|
+
* A getter that throws leaves the dictionary exactly as it was: preparation has
|
|
52
|
+
* published nothing. A nested registration that completed before the throw is
|
|
53
|
+
* unaffected, because it committed on its own.
|
|
54
|
+
*
|
|
55
|
+
* Publication uses `Object.defineProperty` rather than `locales[locale] = ...`,
|
|
56
|
+
* because the assignment form would invoke the inherited `__proto__` setter for
|
|
57
|
+
* a locale of that name instead of registering it. Locale names and translation
|
|
58
|
+
* keys are treated literally throughout — see PROTOTYPE SAFETY above.
|
|
59
|
+
*/
|
|
12
60
|
declare function registerTranslations(locale: string, messages: Translations): void;
|
|
61
|
+
/**
|
|
62
|
+
* Translate `key` in the current locale, falling back to the key itself when it
|
|
63
|
+
* is not registered. A registered empty string is a translation and is returned
|
|
64
|
+
* unchanged; the previous `|| key` discarded it and returned the key.
|
|
65
|
+
*/
|
|
13
66
|
declare function t(key: string, params?: Params$1): string;
|
|
14
67
|
/**
|
|
15
68
|
* Trans component — renders a translated string reactively.
|
|
16
|
-
* Automatically updates when the locale changes.
|
|
69
|
+
* Automatically updates when the client locale changes. During SSR it renders
|
|
70
|
+
* once, using the locale belonging to the current request.
|
|
17
71
|
*
|
|
18
72
|
* @param key Translation key
|
|
19
73
|
* @param params Optional interpolation parameters
|
|
@@ -30,11 +84,20 @@ declare function t(key: string, params?: Params$1): string;
|
|
|
30
84
|
*/
|
|
31
85
|
declare function Trans(key: string, params?: Params$1): HTMLElement;
|
|
32
86
|
/**
|
|
33
|
-
* Check if a translation key exists for the current locale
|
|
87
|
+
* Check if a translation key exists for the current locale — the request's
|
|
88
|
+
* locale during SSR, the client locale otherwise.
|
|
89
|
+
*
|
|
90
|
+
* Registered keys only. `toString`, `constructor` and the rest of
|
|
91
|
+
* `Object.prototype` are not translations unless an application registers them,
|
|
92
|
+
* and a registered empty string counts as present.
|
|
34
93
|
*/
|
|
35
94
|
declare function hasTranslation(key: string): boolean;
|
|
36
95
|
/**
|
|
37
|
-
* Get all available locales.
|
|
96
|
+
* Get all available locales. Dictionaries are application-global, so this is
|
|
97
|
+
* the same set inside and outside a request.
|
|
98
|
+
*
|
|
99
|
+
* Own enumerable keys, so a locale is listed exactly when it was registered -
|
|
100
|
+
* including one named `"__proto__"`, which publication now stores literally.
|
|
38
101
|
*/
|
|
39
102
|
declare function getAvailableLocales(): string[];
|
|
40
103
|
|
|
@@ -93,6 +156,20 @@ interface RouterOptions {
|
|
|
93
156
|
readonly linkActiveClass?: string;
|
|
94
157
|
readonly linkExactActiveClass?: string;
|
|
95
158
|
readonly fallback?: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Scroll position to restore after a navigation commits.
|
|
161
|
+
*
|
|
162
|
+
* A **browser-only, post-navigation side effect**:
|
|
163
|
+
*
|
|
164
|
+
* - In a runtime without the required scrolling primitives
|
|
165
|
+
* (`requestAnimationFrame` and `window.scrollTo`) the hook is **not invoked
|
|
166
|
+
* at all** — it is browser code, and its result would be discarded anyway.
|
|
167
|
+
* - It runs *after* the route and history have committed. An exception it
|
|
168
|
+
* throws is reported to the console but never retroactively fails an
|
|
169
|
+
* already-committed navigation: `NavigationResult.success` stays `true` and
|
|
170
|
+
* `currentRoute` stays authoritative.
|
|
171
|
+
* - Returning a falsy value means "do not scroll" and is not an error.
|
|
172
|
+
*/
|
|
96
173
|
readonly scrollBehavior?: ScrollBehavior;
|
|
97
174
|
readonly guardTimeout?: number;
|
|
98
175
|
readonly cacheSize?: number;
|
|
@@ -111,8 +188,34 @@ interface ScrollPosition {
|
|
|
111
188
|
readonly x: number;
|
|
112
189
|
readonly y: number;
|
|
113
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* Why a navigation failed, at a finer grain than `type`.
|
|
193
|
+
*
|
|
194
|
+
* `type: "aborted"` alone cannot tell a caller whether the user was denied
|
|
195
|
+
* access, whether they simply clicked a newer link, or whether the app tore the
|
|
196
|
+
* router down — three situations that call for very different handling (show a
|
|
197
|
+
* message / stay silent / stay silent). `reason` disambiguates them without
|
|
198
|
+
* changing the existing `type` values, so code branching on `type` keeps
|
|
199
|
+
* working unchanged.
|
|
200
|
+
*
|
|
201
|
+
* - `guard` — a navigation guard returned `false`.
|
|
202
|
+
* - `superseded` — a newer navigation started before this one could commit.
|
|
203
|
+
* Expected during rapid navigation; normally not surfaced to users.
|
|
204
|
+
* - `router-destroyed` — the router was destroyed while this navigation was in
|
|
205
|
+
* flight.
|
|
206
|
+
* - `redirect-loop` — redirect resolution exceeded the maximum hop count.
|
|
207
|
+
* - `unsafe-target` — the target or a redirect used a blocked URI scheme, or was
|
|
208
|
+
* an absolute/protocol-relative URL (open-redirect protection).
|
|
209
|
+
* - `duplicate` — the target is identical to the current route.
|
|
210
|
+
* - `error` — an unexpected error escaped the navigation pipeline.
|
|
211
|
+
*/
|
|
212
|
+
type NavigationFailureReason = "guard" | "superseded" | "router-destroyed" | "redirect-loop" | "unsafe-target" | "duplicate" | "error";
|
|
114
213
|
interface NavigationFailure {
|
|
115
214
|
readonly type: "aborted" | "cancelled" | "duplicated" | "timeout";
|
|
215
|
+
/**
|
|
216
|
+
* Finer-grained cause. Additive — existing checks on `type` are unaffected.
|
|
217
|
+
*/
|
|
218
|
+
readonly reason?: NavigationFailureReason;
|
|
116
219
|
readonly from: RouteContext;
|
|
117
220
|
readonly to: RouteContext;
|
|
118
221
|
readonly error?: Error;
|
|
@@ -123,6 +226,8 @@ type NavigationResult = {
|
|
|
123
226
|
} | {
|
|
124
227
|
success: false;
|
|
125
228
|
type: NavigationFailure["type"];
|
|
229
|
+
/** Mirrors `failure.reason`; see {@link NavigationFailureReason}. */
|
|
230
|
+
reason?: NavigationFailureReason;
|
|
126
231
|
failure: NavigationFailure;
|
|
127
232
|
};
|
|
128
233
|
type NavigationTarget = string | {
|
|
@@ -132,6 +237,30 @@ type NavigationTarget = string | {
|
|
|
132
237
|
query?: Params;
|
|
133
238
|
hash?: string;
|
|
134
239
|
};
|
|
240
|
+
/**
|
|
241
|
+
* Component loader with caching and error recovery
|
|
242
|
+
*/
|
|
243
|
+
/**
|
|
244
|
+
* How the router will produce an instance of a route's component.
|
|
245
|
+
*
|
|
246
|
+
* Deliberately never holds an `Element`: an instance produced by one invocation
|
|
247
|
+
* must never become a reusable factory. (LOAD-002)
|
|
248
|
+
*
|
|
249
|
+
* The two kinds are structural, not provisional:
|
|
250
|
+
*
|
|
251
|
+
* - `factory` — invoke once per instance, only when an instance is needed.
|
|
252
|
+
* Everything unbranded lands here: synchronous, `async`, and
|
|
253
|
+
* Promise-returning component factories alike.
|
|
254
|
+
* - `deferred` — an **explicitly branded** `lazy()` module loader. This is the
|
|
255
|
+
* only kind preload may execute. (LOAD-004)
|
|
256
|
+
*/
|
|
257
|
+
type RoutePlan = {
|
|
258
|
+
kind: "factory";
|
|
259
|
+
component: Component;
|
|
260
|
+
} | {
|
|
261
|
+
kind: "deferred";
|
|
262
|
+
load: AsyncComponent | LazyComponent;
|
|
263
|
+
};
|
|
135
264
|
declare class SibuRouter {
|
|
136
265
|
private options;
|
|
137
266
|
private matcher;
|
|
@@ -143,6 +272,8 @@ declare class SibuRouter {
|
|
|
143
272
|
private isReadyGetter;
|
|
144
273
|
private isReadySetter;
|
|
145
274
|
private cleanup;
|
|
275
|
+
private destroyed;
|
|
276
|
+
private navEpoch;
|
|
146
277
|
constructor(routes: RouteDef[], options?: RouterOptions);
|
|
147
278
|
private initialize;
|
|
148
279
|
private createInitialRoute;
|
|
@@ -153,14 +284,42 @@ declare class SibuRouter {
|
|
|
153
284
|
replace?: boolean;
|
|
154
285
|
state?: unknown;
|
|
155
286
|
skipHistory?: boolean;
|
|
287
|
+
initialResolution?: boolean;
|
|
156
288
|
}): Promise<NavigationResult>;
|
|
157
289
|
private static readonly MAX_REDIRECT_DEPTH;
|
|
158
290
|
private performNavigation;
|
|
159
291
|
private resolvePath;
|
|
160
292
|
private isSameRoute;
|
|
161
293
|
private updateHistory;
|
|
294
|
+
/**
|
|
295
|
+
* Apply the configured `scrollBehavior`, if the runtime can actually scroll.
|
|
296
|
+
*
|
|
297
|
+
* This runs *after* the route has been committed, so an exception here does
|
|
298
|
+
* not merely skip scrolling — it propagates out of `navigateInternal` and the
|
|
299
|
+
* navigation is reported as `success: false` while the route state says it
|
|
300
|
+
* succeeded. In a DOM-less runtime the bare `requestAnimationFrame` did
|
|
301
|
+
* exactly that: a legal `scrollBehavior` option made every navigation report
|
|
302
|
+
* failure under SSR and in memory-router-style tests. (MEM-001)
|
|
303
|
+
*
|
|
304
|
+
* Policy A, consistent with the history write in `updateHistory()` (NODE-001):
|
|
305
|
+
* the route still commits, and only the browser-only side effect is skipped.
|
|
306
|
+
*
|
|
307
|
+
* Both primitives are probed, not just `window` — `requestAnimationFrame` and
|
|
308
|
+
* `scrollTo` can be missing independently (jsdom without a rAF polyfill, a
|
|
309
|
+
* partial DOM shim). `requestAnimationFrame` is invoked as a method on the
|
|
310
|
+
* global object rather than through a detached reference, since browsers
|
|
311
|
+
* reject a bare call with "Illegal invocation".
|
|
312
|
+
*/
|
|
162
313
|
private handleScrollBehavior;
|
|
163
|
-
|
|
314
|
+
/**
|
|
315
|
+
* Resolve how this route's component will be produced, without instantiating
|
|
316
|
+
* anything. Pair with {@link instantiateComponent} at the commit boundary.
|
|
317
|
+
*/
|
|
318
|
+
loadPlan(route: RouteDef, routePath: string): Promise<RoutePlan>;
|
|
319
|
+
/** Create exactly one real instance from an already-resolved plan. */
|
|
320
|
+
instantiateComponent(plan: RoutePlan, route: RouteDef, routePath: string): Promise<Element>;
|
|
321
|
+
/** Resolve a route's module/factory without creating any component instance. */
|
|
322
|
+
preloadPlan(route: RouteDef, routePath: string): Promise<void>;
|
|
164
323
|
beforeEach(guard: NavigationGuard): () => void;
|
|
165
324
|
beforeResolve(guard: NavigationGuard): () => void;
|
|
166
325
|
afterEach(hook: (to: RouteContext, from: RouteContext) => void): () => void;
|
|
@@ -171,6 +330,8 @@ declare class SibuRouter {
|
|
|
171
330
|
forward(): void;
|
|
172
331
|
get currentRoute(): RouteContext;
|
|
173
332
|
get isReady(): boolean;
|
|
333
|
+
/** @internal Navigation generation — see `navEpoch`. Not a public API. */
|
|
334
|
+
get navigationEpoch(): number;
|
|
174
335
|
get isNavigating(): boolean;
|
|
175
336
|
destroy(): void;
|
|
176
337
|
clearCache(): void;
|
|
@@ -229,6 +390,30 @@ declare function Route(): Node;
|
|
|
229
390
|
* Uses the `keepAlive` option from RouterOptions if set, or accepts
|
|
230
391
|
* explicit options.
|
|
231
392
|
*
|
|
393
|
+
* ## Cache identity
|
|
394
|
+
*
|
|
395
|
+
* A cached view is keyed by the **full location** — path + query + hash — so
|
|
396
|
+
* `/search?q=a`, `/search?q=b`, and `/docs#one` are three distinct cached views.
|
|
397
|
+
* Keying on `route.path` alone would serve one query's cached DOM and state for
|
|
398
|
+
* another.
|
|
399
|
+
*
|
|
400
|
+
* ## Reuse and disposal
|
|
401
|
+
*
|
|
402
|
+
* | Event | Effect on a cached view |
|
|
403
|
+
* |---|---|
|
|
404
|
+
* | navigated away from | detached, kept in cache, **not** disposed |
|
|
405
|
+
* | navigated back to | the same node is re-attached — no remount |
|
|
406
|
+
* | evicted past `max` (LRU) | disposed and dropped |
|
|
407
|
+
* | excluded by `include` | never cached; disposed on navigation away |
|
|
408
|
+
* | outlet disposed | whole cache disposed and cleared |
|
|
409
|
+
*
|
|
410
|
+
* ## Cache identity is not async ownership
|
|
411
|
+
*
|
|
412
|
+
* The cache key answers *"which cached view is this?"*. It never answers *"may
|
|
413
|
+
* this async completion still commit?"* — that is what the update generation is
|
|
414
|
+
* for, because `same route value !== same navigation generation`. See
|
|
415
|
+
* `docs/architecture/router.md`.
|
|
416
|
+
*
|
|
232
417
|
* @param options Optional: override the router-level keepAlive setting
|
|
233
418
|
*
|
|
234
419
|
* @example
|
|
@@ -259,7 +444,28 @@ declare function RouterLink(props: {
|
|
|
259
444
|
target?: string;
|
|
260
445
|
rel?: string;
|
|
261
446
|
[key: string]: unknown;
|
|
262
|
-
}, children?: string | Node | (string | Node)[]):
|
|
447
|
+
}, children?: string | Node | (string | Node)[]): HTMLAnchorElement;
|
|
448
|
+
/**
|
|
449
|
+
* Async boundary for code-split / deferred content.
|
|
450
|
+
*
|
|
451
|
+
* **Ownership contract.** The boundary owns every node it creates or installs.
|
|
452
|
+
* A node that leaves the boundary — replaced by resolved content, or dropped on
|
|
453
|
+
* teardown — is lifecycle-disposed exactly once. Native detachment alone is not
|
|
454
|
+
* cleanup: a detached subtree keeps its effects, listeners and registered
|
|
455
|
+
* disposers alive, firing against DOM nobody can see. (SUS-001)
|
|
456
|
+
*
|
|
457
|
+
* **Async completion grants no commit permission.** A resolution that arrives
|
|
458
|
+
* after the boundary was torn down, or after a newer generation superseded it,
|
|
459
|
+
* may never insert into the DOM. Because the promise typically resolves with an
|
|
460
|
+
* *already constructed* Element — whose effects and listeners were created
|
|
461
|
+
* before the boundary discovered it lost ownership — the stale result is
|
|
462
|
+
* disposed rather than merely dropped. (SUS-002)
|
|
463
|
+
*
|
|
464
|
+
* The boundary is **single-shot**: `props.nodes()` is invoked exactly once, so
|
|
465
|
+
* only one async generation is reachable in practice. The generation token is
|
|
466
|
+
* kept anyway because teardown must be able to invalidate the in-flight one, and
|
|
467
|
+
* because ownership is the correct primitive to express that with.
|
|
468
|
+
*/
|
|
263
469
|
declare function Suspense(props: {
|
|
264
470
|
fallback?: () => HTMLElement | HTMLElement;
|
|
265
471
|
nodes: () => HTMLElement | Promise<HTMLElement>;
|
|
@@ -279,6 +485,18 @@ declare function preloadRoute(to: NavigationTarget): Promise<void>;
|
|
|
279
485
|
/**
|
|
280
486
|
* Validates if a route exists
|
|
281
487
|
*/
|
|
488
|
+
/**
|
|
489
|
+
* Current navigation generation for the active router, or `-1` when no router
|
|
490
|
+
* exists (including after `destroyRouter()`).
|
|
491
|
+
*
|
|
492
|
+
* @internal Not part of the public API. Exists so asynchronous work that can
|
|
493
|
+
* acquire DOM ownership — notably `hydrateRouter()`'s bootstrap — can prove it
|
|
494
|
+
* has not been superseded. Capture before the async gap, re-check immediately
|
|
495
|
+
* before committing. A URL comparison cannot serve this purpose: an A→B→A
|
|
496
|
+
* navigation returns to the same URL under a *newer* generation, and stale work
|
|
497
|
+
* must stay superseded.
|
|
498
|
+
*/
|
|
499
|
+
declare function __getNavigationEpoch(): number;
|
|
282
500
|
declare function hasRoute(name: string): boolean;
|
|
283
501
|
/**
|
|
284
502
|
* Gets route information by name
|
|
@@ -464,4 +682,4 @@ declare function createSSRRouter(routes: SSRRouteDef[]): {
|
|
|
464
682
|
}) => string;
|
|
465
683
|
};
|
|
466
684
|
|
|
467
|
-
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 };
|
|
685
|
+
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 };
|