@ubean/vue 0.2.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 -0
- package/README.md +493 -0
- package/README.zh-CN.md +500 -0
- package/dist/generator/index.d.ts +125 -0
- package/dist/generator/index.js +369 -0
- package/dist/index.d.ts +782 -0
- package/dist/index.js +1073 -0
- package/dist/types-VHF1RJu2.d.ts +132 -0
- package/dist/vite.d.ts +164 -0
- package/dist/vite.js +1189 -0
- package/package.json +67 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,782 @@
|
|
|
1
|
+
import { a as ScannedLayout, i as ScanPagesResult, n as PageMeta, o as ScannedPage, r as ScanPagesOptions, t as PageHead } from "./types-VHF1RJu2.js";
|
|
2
|
+
import { Component, ComputedRef, InjectionKey, Plugin, PropType, Ref, VNode } from "vue";
|
|
3
|
+
import { NavigationGuard, RouteMeta, Router } from "vue-router";
|
|
4
|
+
//#region src/view-transitions.d.ts
|
|
5
|
+
interface ViewTransitionOptions {
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
fallback?: 'none' | 'crossfade';
|
|
8
|
+
types?: string[];
|
|
9
|
+
}
|
|
10
|
+
declare function supportsViewTransitions(): boolean;
|
|
11
|
+
declare function withViewTransition<T>(callback: () => Promise<T> | T, options?: ViewTransitionOptions): Promise<T>;
|
|
12
|
+
declare function getNavigationType(): 'traverse' | 'push' | 'replace' | 'reload';
|
|
13
|
+
declare function useViewTransitionState(name: string): Record<string, string>;
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/components.d.ts
|
|
16
|
+
/**
|
|
17
|
+
* Injection keys (exported for advanced use cases — e.g. testing utilities
|
|
18
|
+
* that need to provide the page/transition context outside the plugin).
|
|
19
|
+
*/
|
|
20
|
+
declare const PAGE_KEY: unique symbol;
|
|
21
|
+
declare const TRANSITION_KEY: unique symbol;
|
|
22
|
+
declare const SSR_KEY: InjectionKey<boolean>;
|
|
23
|
+
declare const LOADING_KEY: InjectionKey<Component | null>;
|
|
24
|
+
declare const ERROR_KEY: InjectionKey<Component | null>;
|
|
25
|
+
/**
|
|
26
|
+
* Injectable path localizer (optional i18n bridge). The framework runtime
|
|
27
|
+
* (`@ubean/client`) provides the reactive `localizePath`; when absent,
|
|
28
|
+
* `Link` renders paths verbatim — this package never imports i18n itself.
|
|
29
|
+
*/
|
|
30
|
+
declare const LOCALIZE_PATH_KEY: InjectionKey<(path: string) => string>;
|
|
31
|
+
/**
|
|
32
|
+
* Layout chain context — provided by `LayoutChainRenderer` so that `<PageView />`
|
|
33
|
+
* inside a layout knows whether to render the next nested layout or the actual
|
|
34
|
+
* page. When `depth < components.length - 1`, `PageView` renders the next
|
|
35
|
+
* `LayoutChainRenderer`; otherwise it renders the matched page via `<RouterView>`.
|
|
36
|
+
*/
|
|
37
|
+
interface LayoutChainContext {
|
|
38
|
+
components: Array<Component | null>;
|
|
39
|
+
depth: number;
|
|
40
|
+
}
|
|
41
|
+
declare const LAYOUT_CHAIN_KEY: InjectionKey<LayoutChainContext | null>;
|
|
42
|
+
/**
|
|
43
|
+
* LayoutChainRenderer — recursively renders a chain of nested layout
|
|
44
|
+
* components (framework factories build the chain; lean SPAs may use it
|
|
45
|
+
* directly for nested layouts via render functions).
|
|
46
|
+
*/
|
|
47
|
+
declare const LayoutChainRenderer: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
48
|
+
components: {
|
|
49
|
+
type: PropType<Array<Component | null>>;
|
|
50
|
+
required: true;
|
|
51
|
+
};
|
|
52
|
+
depth: {
|
|
53
|
+
type: NumberConstructor;
|
|
54
|
+
default: number;
|
|
55
|
+
};
|
|
56
|
+
}>, () => VNode, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
57
|
+
components: {
|
|
58
|
+
type: PropType<Array<Component | null>>;
|
|
59
|
+
required: true;
|
|
60
|
+
};
|
|
61
|
+
depth: {
|
|
62
|
+
type: NumberConstructor;
|
|
63
|
+
default: number;
|
|
64
|
+
};
|
|
65
|
+
}>> & Readonly<{}>, {
|
|
66
|
+
depth: number;
|
|
67
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
68
|
+
/**
|
|
69
|
+
* ErrorBoundary — catches rendering, async resolution, and setup errors
|
|
70
|
+
* from descendant components. When an error is caught, renders the
|
|
71
|
+
* configured `errorComponent` instead of the slot content. The error state
|
|
72
|
+
* resets automatically on route change.
|
|
73
|
+
*/
|
|
74
|
+
declare const ErrorBoundary: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
75
|
+
component: {
|
|
76
|
+
type: PropType<Component | null>;
|
|
77
|
+
default: null;
|
|
78
|
+
};
|
|
79
|
+
}>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
80
|
+
[key: string]: any;
|
|
81
|
+
}> | VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
82
|
+
[key: string]: any;
|
|
83
|
+
}>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
84
|
+
component: {
|
|
85
|
+
type: PropType<Component | null>;
|
|
86
|
+
default: null;
|
|
87
|
+
};
|
|
88
|
+
}>> & Readonly<{}>, {
|
|
89
|
+
component: Component | null;
|
|
90
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
91
|
+
/**
|
|
92
|
+
* PageView — renders the matched route page wrapped with `<Transition>` and
|
|
93
|
+
* `<KeepAlive>`. Layouts use `<PageView />` (instead of `<slot />`) as the
|
|
94
|
+
* page outlet.
|
|
95
|
+
*
|
|
96
|
+
* Equivalents of soybean-unify's layout-content pattern:
|
|
97
|
+
* - `pageAnimateMode` → `transition` prop + `route.meta.transition` + global `usePageTransition()`
|
|
98
|
+
* - `cachedRoutes` / `excludeCachedRoutes` → `useCacheViews().cachedViews` / `excludedViews`
|
|
99
|
+
* - `reloadSignal` → `useReloadSignal().counter` (incremented by `reloadPage()`)
|
|
100
|
+
*
|
|
101
|
+
* Props:
|
|
102
|
+
* - `transition`: transition name (string) or `false` to disable.
|
|
103
|
+
* Priority: prop > `route.meta.transition` > global `usePageTransition()`.
|
|
104
|
+
* - `reloadKey`: a reactive key — changing it forces remount (reload).
|
|
105
|
+
* When omitted, falls back to `route.fullPath` + per-page reload count.
|
|
106
|
+
* - `mode`: Vue `<Transition>` mode. Defaults to `'default'` (cross-fade —
|
|
107
|
+
* old page plays its leave while the new one enters, both driven through
|
|
108
|
+
* KeepAlive's delayLeave). `'out-in'` is DEGRADED to `'default'` with a
|
|
109
|
+
* dev warning: vue@3.5.41's `out-in` renders an `emptyPlaceholder` hollow
|
|
110
|
+
* KeepAlive on page swaps, which crashes hand-written render chains
|
|
111
|
+
* (`updateSlots` reading `children._`) and corrupts keep-alive cache
|
|
112
|
+
* state on compiled chains (vuejs/core#10771 family). Revisit when the
|
|
113
|
+
* upstream fix lands.
|
|
114
|
+
*
|
|
115
|
+
* On SSR (via `SSR_KEY`), KeepAlive/Transition/Suspense/ErrorBoundary are
|
|
116
|
+
* skipped (client-only concepts).
|
|
117
|
+
*/
|
|
118
|
+
declare const PageView: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
119
|
+
transition: {
|
|
120
|
+
type: (BooleanConstructor | StringConstructor)[];
|
|
121
|
+
default: undefined;
|
|
122
|
+
};
|
|
123
|
+
reloadKey: {
|
|
124
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
125
|
+
default: undefined;
|
|
126
|
+
};
|
|
127
|
+
mode: {
|
|
128
|
+
type: PropType<"out-in" | "in-out" | "default">;
|
|
129
|
+
default: string;
|
|
130
|
+
};
|
|
131
|
+
}>, () => VNode, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
132
|
+
transition: {
|
|
133
|
+
type: (BooleanConstructor | StringConstructor)[];
|
|
134
|
+
default: undefined;
|
|
135
|
+
};
|
|
136
|
+
reloadKey: {
|
|
137
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
138
|
+
default: undefined;
|
|
139
|
+
};
|
|
140
|
+
mode: {
|
|
141
|
+
type: PropType<"out-in" | "in-out" | "default">;
|
|
142
|
+
default: string;
|
|
143
|
+
};
|
|
144
|
+
}>> & Readonly<{}>, {
|
|
145
|
+
mode: "default" | "in-out" | "out-in";
|
|
146
|
+
transition: string | boolean;
|
|
147
|
+
reloadKey: string | number;
|
|
148
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
149
|
+
/**
|
|
150
|
+
* SlotView — renders a named parallel route slot. Parallel routes are
|
|
151
|
+
* registered as Vue Router named views on the matched route record;
|
|
152
|
+
* `<SlotView name="analytics" />` resolves the slot component from the
|
|
153
|
+
* current route (deepest matched record exposing the slot wins).
|
|
154
|
+
*
|
|
155
|
+
* Resolution is independent of RouterView depth chaining, so SlotView works
|
|
156
|
+
* both as a sibling of `<PageView />` and inside the default view page
|
|
157
|
+
* component (a nested `<RouterView>` there would look at depth + 1 and
|
|
158
|
+
* never find the named view).
|
|
159
|
+
*/
|
|
160
|
+
declare const SlotView: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
161
|
+
name: {
|
|
162
|
+
type: StringConstructor;
|
|
163
|
+
required: true;
|
|
164
|
+
};
|
|
165
|
+
}>, () => VNode, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
166
|
+
name: {
|
|
167
|
+
type: StringConstructor;
|
|
168
|
+
required: true;
|
|
169
|
+
};
|
|
170
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
171
|
+
/**
|
|
172
|
+
* Link — internal links render via RouterLink; external links (`http*`,
|
|
173
|
+
* `//`, `#`) render as native `<a target="_blank" rel="noopener noreferrer">`.
|
|
174
|
+
*
|
|
175
|
+
* Path localization is opt-in via `LOCALIZE_PATH_KEY` (provided by the
|
|
176
|
+
* framework runtime); lean SPAs render paths verbatim.
|
|
177
|
+
*/
|
|
178
|
+
declare const Link: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
179
|
+
to: {
|
|
180
|
+
type: PropType<string | Record<string, unknown>>;
|
|
181
|
+
default: undefined;
|
|
182
|
+
};
|
|
183
|
+
href: {
|
|
184
|
+
type: StringConstructor;
|
|
185
|
+
default: undefined;
|
|
186
|
+
};
|
|
187
|
+
replace: {
|
|
188
|
+
type: BooleanConstructor;
|
|
189
|
+
default: boolean;
|
|
190
|
+
};
|
|
191
|
+
prefetch: {
|
|
192
|
+
type: BooleanConstructor;
|
|
193
|
+
default: boolean;
|
|
194
|
+
};
|
|
195
|
+
activeClass: {
|
|
196
|
+
type: StringConstructor;
|
|
197
|
+
default: string;
|
|
198
|
+
};
|
|
199
|
+
exactActiveClass: {
|
|
200
|
+
type: StringConstructor;
|
|
201
|
+
default: string;
|
|
202
|
+
};
|
|
203
|
+
noActiveClass: {
|
|
204
|
+
type: BooleanConstructor;
|
|
205
|
+
default: boolean;
|
|
206
|
+
};
|
|
207
|
+
}>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
208
|
+
[key: string]: any;
|
|
209
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
210
|
+
to: {
|
|
211
|
+
type: PropType<string | Record<string, unknown>>;
|
|
212
|
+
default: undefined;
|
|
213
|
+
};
|
|
214
|
+
href: {
|
|
215
|
+
type: StringConstructor;
|
|
216
|
+
default: undefined;
|
|
217
|
+
};
|
|
218
|
+
replace: {
|
|
219
|
+
type: BooleanConstructor;
|
|
220
|
+
default: boolean;
|
|
221
|
+
};
|
|
222
|
+
prefetch: {
|
|
223
|
+
type: BooleanConstructor;
|
|
224
|
+
default: boolean;
|
|
225
|
+
};
|
|
226
|
+
activeClass: {
|
|
227
|
+
type: StringConstructor;
|
|
228
|
+
default: string;
|
|
229
|
+
};
|
|
230
|
+
exactActiveClass: {
|
|
231
|
+
type: StringConstructor;
|
|
232
|
+
default: string;
|
|
233
|
+
};
|
|
234
|
+
noActiveClass: {
|
|
235
|
+
type: BooleanConstructor;
|
|
236
|
+
default: boolean;
|
|
237
|
+
};
|
|
238
|
+
}>> & Readonly<{}>, {
|
|
239
|
+
to: string | Record<string, unknown>;
|
|
240
|
+
href: string;
|
|
241
|
+
replace: boolean;
|
|
242
|
+
prefetch: boolean;
|
|
243
|
+
activeClass: string;
|
|
244
|
+
exactActiveClass: string;
|
|
245
|
+
noActiveClass: boolean;
|
|
246
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
247
|
+
/**
|
|
248
|
+
* `PAGE_KEY` 注入的页面数据形状(框架工厂 / SSR 链路提供;精简 SPA
|
|
249
|
+
* 通常不提供,`usePage()` 返回空对象)。
|
|
250
|
+
*
|
|
251
|
+
* 路由态(url/params/query/meta)不在此处 —— 直接用 vue-router 的
|
|
252
|
+
* `useRoute()`;导航(push/replace 带类型推导)直接用 vue-router 的
|
|
253
|
+
* `useRouter()`。本包不再包装二者,避免丢失 vue-router 的泛型能力。
|
|
254
|
+
*/
|
|
255
|
+
interface UbeanVuePageData<TProps = Record<string, unknown>> {
|
|
256
|
+
/** 工厂/SSR 注入的页面 props(框架数据协议)。 */
|
|
257
|
+
props?: Record<string, TProps>;
|
|
258
|
+
/** 页面组件标识(框架 SSR 数据)。 */
|
|
259
|
+
component?: string;
|
|
260
|
+
/** 校验错误映射(表单/服务端校验协议)。 */
|
|
261
|
+
errors?: Record<string, string> | null;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* `usePage()` — 读取 `PAGE_KEY` 注入的页面数据(精简版:仅 pageData)。
|
|
265
|
+
*
|
|
266
|
+
* 路由驱动的 url/params/query 请使用 vue-router 的 `useRoute()`;
|
|
267
|
+
* 导航请使用 vue-router 的 `useRouter()`(push/replace 自带
|
|
268
|
+
* RouteNamedMap 泛型推导)。
|
|
269
|
+
*
|
|
270
|
+
* 未提供 `PAGE_KEY` 时返回共享的空对象(字段均为 undefined)。
|
|
271
|
+
*/
|
|
272
|
+
declare function usePage<TProps = Record<string, unknown>>(): UbeanVuePageData<TProps>;
|
|
273
|
+
/** `useViewTransition()` — whether native View Transitions are available/enabled. */
|
|
274
|
+
declare function useViewTransition(): {
|
|
275
|
+
enabled: boolean;
|
|
276
|
+
supports: boolean;
|
|
277
|
+
options: ViewTransitionOptions;
|
|
278
|
+
};
|
|
279
|
+
/**
|
|
280
|
+
* `ubeanVue` — the plugin exposing the lean kernel. This is the ONLY wiring
|
|
281
|
+
* entry of `@ubean/vue` (no app factory, no router factory):
|
|
282
|
+
*
|
|
283
|
+
* ```ts
|
|
284
|
+
* import { createApp } from 'vue';
|
|
285
|
+
* import { createRouter, createWebHistory } from 'vue-router';
|
|
286
|
+
* import { ubeanVue } from '@ubean/vue';
|
|
287
|
+
* import { routes } from 'virtual:ubean-vue-routes'; // @ubean/vue/vite
|
|
288
|
+
*
|
|
289
|
+
* const router = createRouter({ history: createWebHistory(), routes });
|
|
290
|
+
* const app = createApp(App);
|
|
291
|
+
* app.use(router);
|
|
292
|
+
* app.use(ubeanVue, { routes }); // Link/PageView/SlotView + cache seeding
|
|
293
|
+
* app.mount('#app');
|
|
294
|
+
* ```
|
|
295
|
+
*/
|
|
296
|
+
interface UbeanVueOptions {
|
|
297
|
+
/**
|
|
298
|
+
* Route records — seeds the keep-alive include list from `meta.cache: true`
|
|
299
|
+
* declarations (the lean equivalent of the framework's
|
|
300
|
+
* `definePage({ cache: true })` macro).
|
|
301
|
+
*/
|
|
302
|
+
routes?: Array<{
|
|
303
|
+
name?: string | symbol;
|
|
304
|
+
meta?: {
|
|
305
|
+
cache?: boolean;
|
|
306
|
+
};
|
|
307
|
+
}>;
|
|
308
|
+
}
|
|
309
|
+
declare const ubeanVue: Plugin<UbeanVueOptions>;
|
|
310
|
+
//#endregion
|
|
311
|
+
//#region src/cache-views.d.ts
|
|
312
|
+
interface UseCacheViewsReturn {
|
|
313
|
+
/** Reactive list of cached route names — pass to `<keep-alive :include>`. */
|
|
314
|
+
cachedViews: ComputedRef<string[]>;
|
|
315
|
+
/** Reactive list of route names explicitly added to the cache. */
|
|
316
|
+
cachedViewNames: ComputedRef<string[]>;
|
|
317
|
+
/** Reactive list of route names excluded from cache — pass to `<keep-alive :exclude>`. */
|
|
318
|
+
excludedViews: ComputedRef<string[]>;
|
|
319
|
+
/** Whether page caching is globally enabled. */
|
|
320
|
+
enabled: ComputedRef<boolean>;
|
|
321
|
+
/** Enable page caching globally. */
|
|
322
|
+
enable: () => void;
|
|
323
|
+
/** Disable page caching globally (purges keep-alive immediately). */
|
|
324
|
+
disable: () => void;
|
|
325
|
+
/** Add a route name to the cache include list. */
|
|
326
|
+
add: (name: string) => void;
|
|
327
|
+
/** Remove a route name from the cache include list (prunes its instance). */
|
|
328
|
+
remove: (name: string) => void;
|
|
329
|
+
/** Whether a route name is currently in the cache include list. */
|
|
330
|
+
has: (name: string) => boolean;
|
|
331
|
+
/** Remove all route names from the cache include list. */
|
|
332
|
+
clear: () => void;
|
|
333
|
+
/** Add a route name to the cache exclude list (forces prune on next render). */
|
|
334
|
+
addExclude: (name: string) => void;
|
|
335
|
+
/** Remove a route name from the cache exclude list. */
|
|
336
|
+
removeExclude: (name: string) => void;
|
|
337
|
+
/** Whether a route name is currently in the cache exclude list. */
|
|
338
|
+
hasExclude: (name: string) => boolean;
|
|
339
|
+
/** Clear the cache exclude list. */
|
|
340
|
+
clearExclude: () => void;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Composable for reactive access to the page cache store.
|
|
344
|
+
*
|
|
345
|
+
* Safe to call inside any component `setup()`; the returned computeds are
|
|
346
|
+
* tracked by the rendering effect so `<keep-alive :include>` stays in sync.
|
|
347
|
+
*/
|
|
348
|
+
declare function useCacheViews(): UseCacheViewsReturn;
|
|
349
|
+
/** Enable keep-alive caching for a specific page (by route name). */
|
|
350
|
+
declare function enablePageCache(name: string): void;
|
|
351
|
+
/** Disable keep-alive caching for a specific page (by route name). */
|
|
352
|
+
declare function disablePageCache(name: string): void;
|
|
353
|
+
/**
|
|
354
|
+
* Temporarily exclude a page from keep-alive (forces its cached instance
|
|
355
|
+
* to be pruned on next render). Pair with `includePageCache()` to restore.
|
|
356
|
+
*
|
|
357
|
+
* Useful for the "reload current page" pattern: push the route name into
|
|
358
|
+
* the exclude list, wait a tick, then remove it — the cached instance is
|
|
359
|
+
* pruned and the page remounts fresh on next render.
|
|
360
|
+
*/
|
|
361
|
+
declare function excludePageCache(name: string): void;
|
|
362
|
+
/** Remove a route name from the cache exclude list (restores caching). */
|
|
363
|
+
declare function includePageCache(name: string): void;
|
|
364
|
+
/** Whether a specific page is currently excluded from cache. */
|
|
365
|
+
declare function isPageExcluded(name: string): boolean;
|
|
366
|
+
/**
|
|
367
|
+
* Reload a cached page by pruning its keep-alive instance.
|
|
368
|
+
*
|
|
369
|
+
* Semantics (mirrors `routeStore.resetRouteCache` in soybean-unify):
|
|
370
|
+
* 1. Remove the route name from the include list — the cached instance is
|
|
371
|
+
* pruned immediately, and when the user navigates away the instance is
|
|
372
|
+
* destroyed instead of being re-cached.
|
|
373
|
+
* 2. The original `meta.cache` declaration is restored automatically on the
|
|
374
|
+
* next navigation away from the page (hooked by `createUbeanRouter`'s
|
|
375
|
+
* `afterEach`), so the NEXT visit mounts a fresh instance which is
|
|
376
|
+
* cached again as declared.
|
|
377
|
+
*
|
|
378
|
+
* Note: pruning cannot take effect while the user stays on the page —
|
|
379
|
+
* `<KeepAlive>` re-caches the active instance on every render while its name
|
|
380
|
+
* is in the include list. To force an in-place remount of the current page,
|
|
381
|
+
* use `reloadPage(name)` instead (bumps the render key).
|
|
382
|
+
*
|
|
383
|
+
* @param name Route name. If omitted, this is a no-op.
|
|
384
|
+
* @param delay Ignored — kept for signature compatibility with the previous
|
|
385
|
+
* exclude→include implementation.
|
|
386
|
+
*/
|
|
387
|
+
declare function resetRouteCache(name?: string, _delay?: number): Promise<void>;
|
|
388
|
+
/**
|
|
389
|
+
* Invalidate cached page instance(s).
|
|
390
|
+
*
|
|
391
|
+
* - With a `name`: removes that page from the cache (its instance is pruned
|
|
392
|
+
* on next navigation).
|
|
393
|
+
* - Without a `name`: clears all cached pages.
|
|
394
|
+
*
|
|
395
|
+
* Note: the page will be re-cached on next visit if its `definePage({ cache: true })`
|
|
396
|
+
* is still in effect or `enablePageCache(name)` is called again.
|
|
397
|
+
*/
|
|
398
|
+
declare function invalidatePageCache(name?: string): void;
|
|
399
|
+
/** Whether a specific page is currently cached. */
|
|
400
|
+
declare function isPageCached(name: string): boolean;
|
|
401
|
+
/** Whether page caching is globally enabled. */
|
|
402
|
+
declare function isCacheEnabled(): boolean;
|
|
403
|
+
/** Reactive ref of cached route names — for advanced use cases. */
|
|
404
|
+
declare function getCachedViewNames(): Ref<string[]>;
|
|
405
|
+
/** Reactive ref of excluded route names — for advanced use cases. */
|
|
406
|
+
declare function getExcludedViewNames(): Ref<string[]>;
|
|
407
|
+
/** Reactive ref of the global cache-enabled flag. */
|
|
408
|
+
declare function getCacheEnabled(): Ref<boolean>;
|
|
409
|
+
/**
|
|
410
|
+
* Seed the cache include list from route metadata.
|
|
411
|
+
*
|
|
412
|
+
* Called once during app bootstrap (`createUbeanClientApp`) to honor pages that
|
|
413
|
+
* declared `definePage({ cache: true })`. Routes without `meta.cache` are
|
|
414
|
+
* left untouched so runtime toggling remains possible.
|
|
415
|
+
*/
|
|
416
|
+
declare function initCachedViewsFromRoutes(routes: Array<{
|
|
417
|
+
name?: string | symbol;
|
|
418
|
+
meta?: {
|
|
419
|
+
cache?: boolean;
|
|
420
|
+
};
|
|
421
|
+
}>): void;
|
|
422
|
+
/**
|
|
423
|
+
* Get or create a named wrapper component for a page.
|
|
424
|
+
*
|
|
425
|
+
* The wrapper carries the route name as its component `name`, which is what
|
|
426
|
+
* `<keep-alive :include>` matches against. The original page component is
|
|
427
|
+
* rendered inside the wrapper. When the original changes (HMR in dev), the
|
|
428
|
+
* wrapper is rebuilt so the new component takes effect.
|
|
429
|
+
*
|
|
430
|
+
* @internal — used by `createLayoutWrapper` in `app.ts`.
|
|
431
|
+
*/
|
|
432
|
+
declare function getNamedPageWrapper(routeName: string, original: Component): Component;
|
|
433
|
+
/**
|
|
434
|
+
* Clear the wrapper registry. Mainly useful in tests or when the entire
|
|
435
|
+
* route table is rebuilt.
|
|
436
|
+
*
|
|
437
|
+
* @internal
|
|
438
|
+
*/
|
|
439
|
+
declare function resetNamedPageWrappers(): void;
|
|
440
|
+
//#endregion
|
|
441
|
+
//#region src/page-runtime.d.ts
|
|
442
|
+
interface UsePageTransitionReturn {
|
|
443
|
+
/** Reactive transition name. Empty string means "no transition". */
|
|
444
|
+
name: ComputedRef<string>;
|
|
445
|
+
/** Set the global transition name. Use '' or 'none' to disable. */
|
|
446
|
+
set: (name: string) => void;
|
|
447
|
+
/** Clear the global transition name (disables transitions). */
|
|
448
|
+
clear: () => void;
|
|
449
|
+
/** Whether a transition is currently configured. */
|
|
450
|
+
enabled: ComputedRef<boolean>;
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Composable for reactive access to the global page transition name.
|
|
454
|
+
*
|
|
455
|
+
* Used by `<PageView />` as the fallback transition name when neither the
|
|
456
|
+
* `transition` prop nor `route.meta.transition` is set.
|
|
457
|
+
*
|
|
458
|
+
* Layout components can also read this to display a settings UI:
|
|
459
|
+
*
|
|
460
|
+
* ```ts
|
|
461
|
+
* const transition = usePageTransition();
|
|
462
|
+
* // transition.name.value === 'fade-slide'
|
|
463
|
+
* transition.set('zoom-fadein');
|
|
464
|
+
* transition.clear();
|
|
465
|
+
* ```
|
|
466
|
+
*/
|
|
467
|
+
declare function usePageTransition(): UsePageTransitionReturn;
|
|
468
|
+
/** Imperatively set the global page transition name. */
|
|
469
|
+
declare function setPageTransition(name: string): void;
|
|
470
|
+
/** Imperatively clear the global page transition name (disables transitions). */
|
|
471
|
+
declare function clearPageTransition(): void;
|
|
472
|
+
/** Reactive ref of the global transition name — for advanced use cases. */
|
|
473
|
+
declare function getPageTransitionName(): Ref<string>;
|
|
474
|
+
interface UseReloadSignalReturn {
|
|
475
|
+
/** Reactive counter that increments on each `reloadPage()` call. */
|
|
476
|
+
counter: ComputedRef<number>;
|
|
477
|
+
/** Whether a reload is currently in progress. */
|
|
478
|
+
reloading: ComputedRef<boolean>;
|
|
479
|
+
/** Trigger a reload of the current page. */
|
|
480
|
+
reload: (routeName?: string, duration?: number) => Promise<void>;
|
|
481
|
+
}
|
|
482
|
+
declare function useReloadSignal(routeNameGetter?: () => string | undefined | null): UseReloadSignalReturn;
|
|
483
|
+
/**
|
|
484
|
+
* Imperatively trigger a page reload.
|
|
485
|
+
*
|
|
486
|
+
* - `name`: route name to reload (REQUIRED for an actual remount). The page
|
|
487
|
+
* is blanked, its stale keep-alive entry pruned, and a fresh instance
|
|
488
|
+
* mounts under a new key — while its cache declaration stays in effect.
|
|
489
|
+
* Only THIS page's key changes: other pages' keep-alive entries survive.
|
|
490
|
+
* If omitted, the call is signal-only (the global counter bumps for
|
|
491
|
+
* `useReloadSignal().counter` consumers; nothing remounts).
|
|
492
|
+
* - `duration`: milliseconds to wait for transition/cleanup. Defaults to 300.
|
|
493
|
+
*/
|
|
494
|
+
declare function reloadPage(name?: string, duration?: number): Promise<void>;
|
|
495
|
+
/** Reactive ref of the reload counter — for advanced use cases. */
|
|
496
|
+
declare function getReloadCounter(): Ref<number>;
|
|
497
|
+
/** Whether a reload is currently in progress. */
|
|
498
|
+
declare function isReloading(): boolean;
|
|
499
|
+
//#endregion
|
|
500
|
+
//#region src/define-page.d.ts
|
|
501
|
+
/**
|
|
502
|
+
* `definePage` —— 客户端页面声明宏(纯客户端能力子集)。
|
|
503
|
+
*
|
|
504
|
+
* 在 SFC 的 `<script setup>` 顶层调用,声明本页的路由元信息:
|
|
505
|
+
*
|
|
506
|
+
* ```vue
|
|
507
|
+
* <script setup lang="ts">
|
|
508
|
+
* import { definePage } from '@ubean/vue';
|
|
509
|
+
*
|
|
510
|
+
* definePage({
|
|
511
|
+
* name: 'UserProfile', // 覆盖文件派生的路由名
|
|
512
|
+
* path: '/u/:id', // 覆盖文件派生的路径
|
|
513
|
+
* cache: true, // keep-alive 页面缓存
|
|
514
|
+
* transition: 'fade', // 页面级过渡名(PageView)
|
|
515
|
+
* layout: 'admin', // 布局标记(由宿主布局层消费)
|
|
516
|
+
* requiresAuth: true, // 鉴权标记(由导航守卫消费)
|
|
517
|
+
* head: { title: '用户主页' }, // 页面级 head(需 /vite 插件 head: true)
|
|
518
|
+
* meta: { custom: 'any' } // 任意扩展 meta(RouteMeta)
|
|
519
|
+
* });
|
|
520
|
+
* </script>
|
|
521
|
+
* ```
|
|
522
|
+
*
|
|
523
|
+
* 双重语义:
|
|
524
|
+
* - **构建期**(推荐):`@ubean/vue/vite` 插件在编译时提取参数对象,合并进
|
|
525
|
+
* `virtual:ubean-vue-routes` 生成的路由表,并把调用从产物中剥除
|
|
526
|
+
* (零运行时开销)。
|
|
527
|
+
* - **运行时兜底**:无插件环境下本函数是 no-op —— 不报错、不产生副作用,
|
|
528
|
+
* 页面仍以文件派生的路径/名称注册。`cache` 等声明可通过
|
|
529
|
+
* `enablePageCache(name)` 运行时补齐。
|
|
530
|
+
*
|
|
531
|
+
* 与全栈版 `definePage`(`@ubean/pages` 协议)的差异:此处保留客户端字段
|
|
532
|
+
* (`head` 为 opt-in,需 `/vite` 插件开启);`middleware` 已移除 —— 此前
|
|
533
|
+
* 该字段从未被任何运行时消费,按路由声明守卫请用 `meta` 透传。
|
|
534
|
+
*/
|
|
535
|
+
interface DefineClientPageOptions {
|
|
536
|
+
/** 覆盖文件派生的路由名(同时作为 keep-alive 匹配的 pageName)。 */
|
|
537
|
+
name?: string;
|
|
538
|
+
/** 覆盖文件派生的路由路径(需以 `/` 开头,支持 `:param` 动态段)。 */
|
|
539
|
+
path?: string;
|
|
540
|
+
/**
|
|
541
|
+
* 布局标记:布局名、外→内嵌套布局名数组,或 `false` 禁用。
|
|
542
|
+
* 精简内核只把该值写入 `route.meta.layout`,渲染由宿主的布局层
|
|
543
|
+
* (`LayoutChainRenderer` / 框架运行时)消费。
|
|
544
|
+
*/
|
|
545
|
+
layout?: string | string[] | false;
|
|
546
|
+
/** 声明式开启 keep-alive 页面缓存(等价于运行时 `enablePageCache(name)`)。 */
|
|
547
|
+
cache?: boolean;
|
|
548
|
+
/** 页面级过渡名,`<PageView>` 渲染 `<Transition :name>`;空串禁用本页过渡。 */
|
|
549
|
+
transition?: string;
|
|
550
|
+
/** 鉴权标记,写入 `route.meta.requiresAuth`,由用户导航守卫消费。 */
|
|
551
|
+
requiresAuth?: boolean;
|
|
552
|
+
/**
|
|
553
|
+
* reuse 路由目标页名(仅 `.reuse.ts` / `.reuse.js` 元数据文件使用):
|
|
554
|
+
* 本路由复用目标页的组件实现,仅注入独立的路由元数据(路径/名称等)。
|
|
555
|
+
*/
|
|
556
|
+
reuse?: string;
|
|
557
|
+
/**
|
|
558
|
+
* 页面级静态 head(SEO title/meta 等)。仅当 `/vite` 插件 `head: true`
|
|
559
|
+
* (默认 false)时写入 `route.meta.head`;SPA 端配合
|
|
560
|
+
* `setupPageHeadGuard()` 应用,SSR 链路经服务端扫描结果消费。
|
|
561
|
+
*/
|
|
562
|
+
head?: PageHead;
|
|
563
|
+
/** 任意扩展 meta,浅合并进 `route.meta`(类型上扩展 vue-router RouteMeta)。 */
|
|
564
|
+
meta?: RouteMeta;
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Macro to declare a client page.
|
|
568
|
+
*
|
|
569
|
+
* used in `<script setup>` of SFC.
|
|
570
|
+
*
|
|
571
|
+
* @param options Page options.
|
|
572
|
+
*
|
|
573
|
+
* @example
|
|
574
|
+
* ```ts
|
|
575
|
+
* definePage({
|
|
576
|
+
* name: 'UserProfile',
|
|
577
|
+
* path: '/u/:id',
|
|
578
|
+
* cache: true,
|
|
579
|
+
* transition: 'fade',
|
|
580
|
+
* layout: 'admin',
|
|
581
|
+
* requiresAuth: true,
|
|
582
|
+
* meta: { custom: 'any' }
|
|
583
|
+
* });
|
|
584
|
+
* ```
|
|
585
|
+
*/
|
|
586
|
+
declare function definePage(options?: DefineClientPageOptions): void;
|
|
587
|
+
//#endregion
|
|
588
|
+
//#region src/router-location.d.ts
|
|
589
|
+
interface RouteLocationRaw {
|
|
590
|
+
name?: string;
|
|
591
|
+
path?: string;
|
|
592
|
+
params?: Record<string, string | number>;
|
|
593
|
+
query?: Record<string, string | number | boolean | undefined | null>;
|
|
594
|
+
hash?: string;
|
|
595
|
+
}
|
|
596
|
+
type RouteLocation = string | RouteLocationRaw;
|
|
597
|
+
declare function resolveRoute(to: RouteLocation, routeMap?: Record<string, {
|
|
598
|
+
path: string;
|
|
599
|
+
route: string;
|
|
600
|
+
}>): string;
|
|
601
|
+
type TypedLinkProps = {
|
|
602
|
+
to?: RouteLocation;
|
|
603
|
+
href?: string;
|
|
604
|
+
replace?: boolean;
|
|
605
|
+
prefetch?: boolean;
|
|
606
|
+
as?: string;
|
|
607
|
+
activeClass?: string;
|
|
608
|
+
exactActiveClass?: string;
|
|
609
|
+
};
|
|
610
|
+
declare function isActiveRoute(currentPath: string, targetHref: string, exact?: boolean): boolean;
|
|
611
|
+
//#endregion
|
|
612
|
+
//#region src/matchers.d.ts
|
|
613
|
+
/**
|
|
614
|
+
* Matcher 函数签名。接收 URL 中的原始字符串参数,返回 falsy 表示不匹配。
|
|
615
|
+
*
|
|
616
|
+
* @example
|
|
617
|
+
* defineMatcher('numeric', (value) => /^\d+$/.test(value));
|
|
618
|
+
* defineMatcher('slug', (value) => /^[a-z0-9-]+$/.test(value));
|
|
619
|
+
*/
|
|
620
|
+
type MatcherFunction = (value: string) => boolean | null | undefined;
|
|
621
|
+
/**
|
|
622
|
+
* 定义并注册一个命名 route matcher。
|
|
623
|
+
*
|
|
624
|
+
* @param name matcher 名称,对应 `[paramName=name]` 中的 `name`
|
|
625
|
+
* @param fn matcher 函数,接收参数字符串值,返回 falsy 表示不匹配
|
|
626
|
+
* @returns 传入的 `fn`,便于链式/导出使用
|
|
627
|
+
*
|
|
628
|
+
* @example
|
|
629
|
+
* ```ts
|
|
630
|
+
* // src/matchers/numeric.ts
|
|
631
|
+
* import { defineMatcher } from '@ubean/vue';
|
|
632
|
+
* export default defineMatcher('numeric', (value) => /^\d+$/.test(value));
|
|
633
|
+
* ```
|
|
634
|
+
*/
|
|
635
|
+
declare function defineMatcher(name: string, fn: MatcherFunction): MatcherFunction;
|
|
636
|
+
/**
|
|
637
|
+
* 按名称获取已注册的 matcher。未注册时返回 `undefined`。
|
|
638
|
+
*/
|
|
639
|
+
declare function getMatcher(name: string): MatcherFunction | undefined;
|
|
640
|
+
/**
|
|
641
|
+
* 判断指定名称的 matcher 是否已注册。
|
|
642
|
+
*/
|
|
643
|
+
declare function hasMatcher(name: string): boolean;
|
|
644
|
+
/**
|
|
645
|
+
* 获取所有已注册 matcher 的名称列表(主要用于调试 / DevTools)。
|
|
646
|
+
*/
|
|
647
|
+
declare function listMatcherNames(): string[];
|
|
648
|
+
/**
|
|
649
|
+
* 清空所有已注册的 matcher。
|
|
650
|
+
*
|
|
651
|
+
* **仅供测试使用** —— 应用代码不应调用,避免误删其他模块注册的 matcher。
|
|
652
|
+
*/
|
|
653
|
+
declare function clearMatchers(): void;
|
|
654
|
+
/**
|
|
655
|
+
* 校验一组路由参数是否通过对应的 matcher。
|
|
656
|
+
*
|
|
657
|
+
* @param matchers `ScannedPage.matchers` —— `{ paramName: matcherName }` 映射
|
|
658
|
+
* @param params 当前请求解析出的 `{ paramName: value }`
|
|
659
|
+
* @returns `true` 表示所有 matcher 通过(或无 matcher 需要校验);
|
|
660
|
+
* `false` 表示至少一个 matcher 拒绝,该路由不应匹配
|
|
661
|
+
*
|
|
662
|
+
* 行为细节:
|
|
663
|
+
* - 若 `matchers` 为空 / undefined,直接返回 `true`(无校验需求)
|
|
664
|
+
* - 若 matcher 名对应的函数未注册,**返回 `false`**(保守策略)
|
|
665
|
+
* - 若参数不存在于 `params` 中,视为校验失败返回 `false`
|
|
666
|
+
* - matcher 函数抛异常时,捕获并视为不匹配
|
|
667
|
+
*/
|
|
668
|
+
declare function validateParams(matchers: Record<string, string> | undefined, params: Record<string, string | string[] | undefined>): boolean;
|
|
669
|
+
interface MatcherGuardOptions {
|
|
670
|
+
/**
|
|
671
|
+
* matcher 校验失败时跳转的路由名。默认 `'NotFound'`。
|
|
672
|
+
*
|
|
673
|
+
* 若该路由不存在,守卫返回 `false`(取消导航),用户停留在当前页面。
|
|
674
|
+
*/
|
|
675
|
+
notFoundRouteName?: string;
|
|
676
|
+
/**
|
|
677
|
+
* 自定义拒绝回调,在跳转 404 之前调用。可用于日志、监控、自定义错误页等。
|
|
678
|
+
*/
|
|
679
|
+
onReject?: (to: {
|
|
680
|
+
path: string;
|
|
681
|
+
params: Record<string, unknown>;
|
|
682
|
+
matchers: Record<string, string>;
|
|
683
|
+
}) => void;
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* 创建 Vue Router `beforeEach` 导航守卫,用于客户端校验动态路由 matchers。
|
|
687
|
+
*
|
|
688
|
+
* 路由记录的 `meta.matchers` 字段(由 route generator 自动注入)记录了
|
|
689
|
+
* `{ paramName: matcherName }` 映射。守卫读取该字段,调用 `validateParams`
|
|
690
|
+
* 校验 `to.params`;失败时跳转到 404 路由(若存在)或取消导航。
|
|
691
|
+
*
|
|
692
|
+
* **用法**:
|
|
693
|
+
*
|
|
694
|
+
* ```ts
|
|
695
|
+
* import { createMatcherGuard } from '@ubean/vue';
|
|
696
|
+
*
|
|
697
|
+
* const router = createRouter({ history: createWebHistory(), routes });
|
|
698
|
+
* router.beforeEach(createMatcherGuard());
|
|
699
|
+
* ```
|
|
700
|
+
*
|
|
701
|
+
* **设计说明**:
|
|
702
|
+
* - 守卫是**可选的**:不调用 `createMatcherGuard()` 时,客户端不做 matcher
|
|
703
|
+
* 校验,完全依赖服务端 Hono 中间件拦截(适用于 SSR 应用)。
|
|
704
|
+
* - 对于纯 SPA 应用(`ssr: false`),强烈建议注册此守卫,否则客户端导航到
|
|
705
|
+
* `/users/abc`(应当被 `[id=numeric]` 拒绝)会渲染页面而非 404。
|
|
706
|
+
*/
|
|
707
|
+
declare function createMatcherGuard(options?: MatcherGuardOptions): NavigationGuard;
|
|
708
|
+
//#endregion
|
|
709
|
+
//#region src/head.d.ts
|
|
710
|
+
/**
|
|
711
|
+
* 页面级 head 的客户端接通(零依赖核心 + 按需加载)。
|
|
712
|
+
*
|
|
713
|
+
* 设计:
|
|
714
|
+
* - 核心路径零第三方依赖:`PageHeadClient` 是结构化类型(`{ push }`),
|
|
715
|
+
* 任何 unhead 实例(或测试替身)都可直接传入。
|
|
716
|
+
* - 无实例时通过 `createPageHead()` 按需加载 `@unhead/vue`(optional peer),
|
|
717
|
+
* 未安装时报清晰错误。
|
|
718
|
+
* - 构建期 `/vite` 插件 `head: true`(默认 false)时,`definePage({ head })`
|
|
719
|
+
* 与 markdown frontmatter `head` 才写入 `route.meta.head`;SSR 链路不受
|
|
720
|
+
* 影响(服务端从扫描结果的 `pageMeta.head` 读取)。
|
|
721
|
+
*/
|
|
722
|
+
/** 结构化 head 客户端 —— 与 `@unhead/vue` 的 head 实例兼容。 */
|
|
723
|
+
interface PageHeadClient {
|
|
724
|
+
push(input: unknown): unknown;
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* 将静态 `PageHead` push 进 head 实例(falsy 字段自动跳过)。
|
|
728
|
+
* 与 SSR 侧 `pushPageHead`(@ubean/ssr)语义一致,保证双端同构。
|
|
729
|
+
*/
|
|
730
|
+
declare function pushPageHead(head: PageHeadClient, pageHead: PageHead): void;
|
|
731
|
+
/**
|
|
732
|
+
* SPA 页面级 head 守卫:导航完成后读取 `route.meta.head` 并 push 进 head 实例。
|
|
733
|
+
*
|
|
734
|
+
* ```ts
|
|
735
|
+
* import { createRouter, createWebHistory } from 'vue-router';
|
|
736
|
+
* import { setupPageHeadGuard, createPageHead } from '@ubean/vue';
|
|
737
|
+
*
|
|
738
|
+
* const head = await createPageHead(); // 按需加载 @unhead/vue
|
|
739
|
+
* const router = createRouter({ history: createWebHistory(), routes });
|
|
740
|
+
* setupPageHeadGuard(router, head); // 也可传任何已有 unhead 实例
|
|
741
|
+
* ```
|
|
742
|
+
*
|
|
743
|
+
* 初始导航同样触发(vue-router 首次导航完成后 afterEach 执行)。
|
|
744
|
+
*/
|
|
745
|
+
declare function setupPageHeadGuard(router: Router, head: PageHeadClient): void;
|
|
746
|
+
/**
|
|
747
|
+
* 按需创建 head 实例(懒加载 `@unhead/vue`,optional peer dependency)。
|
|
748
|
+
*
|
|
749
|
+
* 项目已自带 unhead 实例时无需调用 —— 直接把实例传给
|
|
750
|
+
* `setupPageHeadGuard` 即可,零额外加载。
|
|
751
|
+
*/
|
|
752
|
+
declare function createPageHead(): Promise<PageHeadClient>;
|
|
753
|
+
//#endregion
|
|
754
|
+
//#region src/index.d.ts
|
|
755
|
+
declare module 'vue-router' {
|
|
756
|
+
interface RouteMeta {
|
|
757
|
+
/** Whether this page is kept-alive (lean: route `meta: { cache: true }`). */
|
|
758
|
+
cache?: boolean;
|
|
759
|
+
/** The page route name (used by KeepAlive include matching). */
|
|
760
|
+
pageName?: string;
|
|
761
|
+
/** Layout name(s) or `false` to disable (consumed by framework factories). */
|
|
762
|
+
layout?: string | string[] | false;
|
|
763
|
+
/** Whether authentication is required for this route. */
|
|
764
|
+
requiresAuth?: boolean;
|
|
765
|
+
/**
|
|
766
|
+
* Page transition name (used by `<PageView>`). Falls back to the global
|
|
767
|
+
* `usePageTransition()` ref when not set. Empty string disables
|
|
768
|
+
* transitions for this specific page.
|
|
769
|
+
*/
|
|
770
|
+
transition?: string;
|
|
771
|
+
/**
|
|
772
|
+
* Static page-level head (`definePage({ head })` / markdown frontmatter).
|
|
773
|
+
* Only populated when the `/vite` plugin runs with `head: true`; apply
|
|
774
|
+
* via `setupPageHeadGuard()` (SPA) or the SSR pipeline.
|
|
775
|
+
*/
|
|
776
|
+
head?: PageHead;
|
|
777
|
+
/** `[param=matcher]` mapping consumed by `createMatcherGuard()`. */
|
|
778
|
+
matchers?: Record<string, string>;
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
//#endregion
|
|
782
|
+
export { type DefineClientPageOptions, ERROR_KEY, ErrorBoundary, LAYOUT_CHAIN_KEY, LOADING_KEY, LOCALIZE_PATH_KEY, type LayoutChainContext, LayoutChainRenderer, Link, type MatcherFunction, type MatcherGuardOptions, PAGE_KEY, type PageHead, type PageHeadClient, type PageMeta, PageView, type RouteLocation, type RouteLocationRaw, SSR_KEY, type ScanPagesOptions, type ScanPagesResult, type ScannedLayout, type ScannedPage, SlotView, TRANSITION_KEY, type TypedLinkProps, type UbeanVueOptions, type UbeanVuePageData, type UseCacheViewsReturn, type UsePageTransitionReturn, type UseReloadSignalReturn, type ViewTransitionOptions, clearMatchers, clearPageTransition, createMatcherGuard, createPageHead, ubeanVue as default, ubeanVue, defineMatcher, definePage, disablePageCache, enablePageCache, excludePageCache, getCacheEnabled, getCachedViewNames, getExcludedViewNames, getMatcher, getNamedPageWrapper, getNavigationType, getPageTransitionName, getReloadCounter, hasMatcher, includePageCache, initCachedViewsFromRoutes, invalidatePageCache, isActiveRoute, isCacheEnabled, isPageCached, isPageExcluded, isReloading, listMatcherNames, pushPageHead, reloadPage, resetNamedPageWrappers, resetRouteCache, resolveRoute, setPageTransition, setupPageHeadGuard, supportsViewTransitions, useCacheViews, usePage, usePageTransition, useReloadSignal, useViewTransition, useViewTransitionState, validateParams, withViewTransition };
|