@ubean/client 0.4.4 → 0.4.6
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/dist/{app-BQgi-8Qp.d.ts → app-Busq_M7n.d.ts} +18 -8
- package/dist/{app-DiXW_14_.js → app-COSjPzyK.js} +21 -12
- package/dist/app.d.ts +2 -2
- package/dist/app.js +2 -2
- package/dist/define-app-RzHOZlYB.d.ts +179 -0
- package/dist/define-app.d.ts +1 -167
- package/dist/define-app.js +10 -6
- package/dist/index.d.ts +55 -55
- package/dist/index.js +3 -3
- package/dist/server.d.ts +2 -2
- package/dist/server.js +2 -2
- package/dist/ssr.d.ts +6 -7
- package/dist/ssr.js +1 -0
- package/package.json +9 -9
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { i as RouterConfig } from "./define-app-RzHOZlYB.js";
|
|
1
2
|
import { App, Component } from "vue";
|
|
2
|
-
import { RouteRecordRaw, Router } from "vue-router";
|
|
3
|
-
import { ERROR_KEY as ERROR_KEY$1, LAYOUT_CHAIN_KEY, LOADING_KEY as LOADING_KEY$1, LOCALIZE_PATH_KEY as LOCALIZE_PATH_KEY$1, LayoutChainContext, LayoutChainRenderer as LayoutChainRenderer$1, Link, PAGE_KEY as PAGE_KEY$1, PageMeta, PageView, SSR_KEY as SSR_KEY$1, SlotView, TRANSITION_KEY as TRANSITION_KEY$1, UbeanVueOptions, ViewTransitionOptions, ubeanVue, useViewTransition } from "@ubean/vue";
|
|
3
|
+
import { RouteRecordRaw, Router, RouterOptions } from "vue-router";
|
|
4
|
+
import { ClientOnly, ERROR_KEY as ERROR_KEY$1, LAYOUT_CHAIN_KEY, LOADING_KEY as LOADING_KEY$1, LOCALIZE_PATH_KEY as LOCALIZE_PATH_KEY$1, LayoutChainContext, LayoutChainRenderer as LayoutChainRenderer$1, Link, PAGE_KEY as PAGE_KEY$1, PageMeta, PageView, SSR_KEY as SSR_KEY$1, SlotView, TRANSITION_KEY as TRANSITION_KEY$1, UbeanVueOptions, ViewTransitionOptions, ubeanVue, useViewTransition } from "@ubean/vue";
|
|
4
5
|
import { VueHeadClient, useHead as useUnheadHead, useSeoMeta } from "@unhead/vue";
|
|
5
6
|
import { PageObject } from "@ubean/pages";
|
|
6
7
|
import { I18n } from "vue-i18n";
|
|
@@ -21,6 +22,15 @@ interface CreateUbeanRouterOptions {
|
|
|
21
22
|
* 该回调在 Client 和 SSR 环境都会执行。
|
|
22
23
|
*/
|
|
23
24
|
setup?: (router: Router) => void;
|
|
25
|
+
/**
|
|
26
|
+
* vue-router `scrollBehavior`,覆盖默认滚动策略。
|
|
27
|
+
*
|
|
28
|
+
* 默认行为:返回顶部;带 hash 时仅当目标元素已存在才平滑滚动。
|
|
29
|
+
* 客户端延迟生成的锚点(如 SSR 后由客户端渲染的标题 id)在首次导航时
|
|
30
|
+
* 可能尚不存在,直接返回 `{ el }` 会触发 VUE_ROUTER_R0042,因此默认
|
|
31
|
+
* 先探测元素存在性。
|
|
32
|
+
*/
|
|
33
|
+
scrollBehavior?: RouterOptions['scrollBehavior'];
|
|
24
34
|
}
|
|
25
35
|
declare function createUbeanRouter(options: CreateUbeanRouterOptions): Router;
|
|
26
36
|
//#endregion
|
|
@@ -65,12 +75,12 @@ interface UbeanAppOptions {
|
|
|
65
75
|
viewTransitions?: boolean | ViewTransitionOptions;
|
|
66
76
|
hydrate?: boolean;
|
|
67
77
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
78
|
+
* router 配置(setup 守卫 + scrollBehavior 等初始化选项)。
|
|
79
|
+
* Client 和 SSR 都会执行;setup 注册守卫必须同步完成。
|
|
80
|
+
* 来自 `defineApp({ router })`,由 `virtual:ubean-app` / `virtual:ubean-server`
|
|
81
|
+
* 在调用本工厂前通过 `resolveAppConfig()` 合并注入。
|
|
72
82
|
*/
|
|
73
|
-
|
|
83
|
+
router?: RouterConfig;
|
|
74
84
|
/**
|
|
75
85
|
* 页面加载时的 fallback 组件,在 SPA 导航懒加载页面组件期间显示。
|
|
76
86
|
* 来源:`pages/loading.vue` 自动检测 或 `defineApp({ loadingComponent })` 显式配置。
|
|
@@ -124,4 +134,4 @@ declare function createUbeanSSRApp(initialPage: PageObject, options: Omit<UbeanA
|
|
|
124
134
|
};
|
|
125
135
|
declare const Head: import("vue").DefineComponent;
|
|
126
136
|
//#endregion
|
|
127
|
-
export {
|
|
137
|
+
export { createUbeanRouter as A, useViewTransition as C, UbeanVuePage as D, definePage as E, usePage as O, useUnheadHead as S, defineMiddleware as T, UbeanVueOptions as _, LOADING_KEY$1 as a, ubeanVue as b, LayoutChainRenderer$1 as c, PageView as d, SSR_KEY$1 as f, UbeanAppOptions as g, UbeanAppInstance as h, LAYOUT_CHAIN_KEY as i, CreateUbeanRouterOptions as k, Link as l, TRANSITION_KEY$1 as m, ERROR_KEY$1 as n, LOCALIZE_PATH_KEY$1 as o, SlotView as p, Head as r, LayoutChainContext as s, ClientOnly as t, PAGE_KEY$1 as u, createUbeanClientApp as v, defineMeta as w, useSeoMeta as x, createUbeanSSRApp as y };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as getI18nRuntimeConfig, l as localizePath, r as createUbeanI18n, s as initClientI18n, t as bindI18nRuntime } from "./i18n-CAeXKTpy.js";
|
|
2
2
|
import { computed, createApp, createSSRApp, defineComponent, h, inject, markRaw, provide, reactive, shallowRef, watchEffect } from "vue";
|
|
3
3
|
import { createMemoryHistory, createRouter, createWebHistory, useRoute } from "vue-router";
|
|
4
|
-
import { ERROR_KEY, ERROR_KEY as ERROR_KEY$1, LAYOUT_CHAIN_KEY, LOADING_KEY, LOADING_KEY as LOADING_KEY$1, LOCALIZE_PATH_KEY, LOCALIZE_PATH_KEY as LOCALIZE_PATH_KEY$1, LayoutChainRenderer, LayoutChainRenderer as LayoutChainRenderer$1, Link, PAGE_KEY, PAGE_KEY as PAGE_KEY$1, PageView, SSR_KEY, SSR_KEY as SSR_KEY$1, SlotView, TRANSITION_KEY, TRANSITION_KEY as TRANSITION_KEY$1, initCachedViewsFromRoutes, ubeanVue, useViewTransition } from "@ubean/vue";
|
|
4
|
+
import { ClientOnly, ERROR_KEY, ERROR_KEY as ERROR_KEY$1, LAYOUT_CHAIN_KEY, LOADING_KEY, LOADING_KEY as LOADING_KEY$1, LOCALIZE_PATH_KEY, LOCALIZE_PATH_KEY as LOCALIZE_PATH_KEY$1, LayoutChainRenderer, LayoutChainRenderer as LayoutChainRenderer$1, Link, PAGE_KEY, PAGE_KEY as PAGE_KEY$1, PageView, SSR_KEY, SSR_KEY as SSR_KEY$1, SlotView, TRANSITION_KEY, TRANSITION_KEY as TRANSITION_KEY$1, initCachedViewsFromRoutes, ubeanVue, useViewTransition } from "@ubean/vue";
|
|
5
5
|
import { useHead as useUnheadHead, useSeoMeta } from "@unhead/vue";
|
|
6
6
|
import { vClient } from "@ubean/islands/directive";
|
|
7
7
|
import { Head } from "@unhead/vue/components";
|
|
@@ -48,19 +48,24 @@ function createUbeanRouter(options) {
|
|
|
48
48
|
const router = createRouter({
|
|
49
49
|
history,
|
|
50
50
|
routes: options.routes,
|
|
51
|
-
scrollBehavior
|
|
52
|
-
if (savedPosition) return savedPosition;
|
|
53
|
-
if (_to.hash) return {
|
|
54
|
-
el: _to.hash,
|
|
55
|
-
behavior: "smooth"
|
|
56
|
-
};
|
|
57
|
-
return { top: 0 };
|
|
58
|
-
}
|
|
51
|
+
scrollBehavior: options.scrollBehavior ?? defaultScrollBehavior
|
|
59
52
|
});
|
|
60
53
|
if (options.setup) options.setup(router);
|
|
61
54
|
if (options.ssr && options.initialUrl) router.push(options.initialUrl);
|
|
62
55
|
return router;
|
|
63
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* 默认滚动策略:返回顶部;带 hash 时仅在目标元素已存在时平滑滚动,
|
|
59
|
+
* 否则返回 `false`(跳过滚动,避免 VUE_ROUTER_R0042 告警)。
|
|
60
|
+
*/
|
|
61
|
+
function defaultScrollBehavior(to, _from, savedPosition) {
|
|
62
|
+
if (savedPosition) return savedPosition;
|
|
63
|
+
if (to.hash) return typeof document !== "undefined" && document.querySelector(to.hash) ? {
|
|
64
|
+
el: to.hash,
|
|
65
|
+
behavior: "smooth"
|
|
66
|
+
} : false;
|
|
67
|
+
return { top: 0 };
|
|
68
|
+
}
|
|
64
69
|
//#endregion
|
|
65
70
|
//#region src/page-macro.ts
|
|
66
71
|
function definePage(_meta) {}
|
|
@@ -185,7 +190,8 @@ function createUbeanClientApp(options) {
|
|
|
185
190
|
const router = createUbeanRouter({
|
|
186
191
|
routes: options.routes,
|
|
187
192
|
ssr: false,
|
|
188
|
-
setup: options.
|
|
193
|
+
setup: options.router?.setup,
|
|
194
|
+
scrollBehavior: options.router?.scrollBehavior
|
|
189
195
|
});
|
|
190
196
|
const { LayoutView: ClientLayoutWrapper, loadLayoutsForRoute: loadClientLayouts } = createLayoutWrapper(options.resolveLayoutComponent, options.defaultLayout || null);
|
|
191
197
|
initCachedViewsFromRoutes(options.routes);
|
|
@@ -200,6 +206,7 @@ function createUbeanClientApp(options) {
|
|
|
200
206
|
app.component("Link", Link);
|
|
201
207
|
app.component("PageView", PageView);
|
|
202
208
|
app.component("SlotView", SlotView);
|
|
209
|
+
app.component("ClientOnly", ClientOnly);
|
|
203
210
|
app.directive("client", vClient);
|
|
204
211
|
app.config.globalProperties.$ubean = {
|
|
205
212
|
page,
|
|
@@ -223,7 +230,8 @@ function createUbeanSSRApp(initialPage, options) {
|
|
|
223
230
|
routes: options.routes,
|
|
224
231
|
ssr: true,
|
|
225
232
|
initialUrl: initialPage.url,
|
|
226
|
-
setup: options.
|
|
233
|
+
setup: options.router?.setup,
|
|
234
|
+
scrollBehavior: options.router?.scrollBehavior
|
|
227
235
|
});
|
|
228
236
|
const { LayoutView: SsrLayoutWrapper, loadLayoutsForRoute: loadSsrLayouts } = createLayoutWrapper(options.resolveLayoutComponent, options.defaultLayout || null);
|
|
229
237
|
initCachedViewsFromRoutes(options.routes);
|
|
@@ -238,6 +246,7 @@ function createUbeanSSRApp(initialPage, options) {
|
|
|
238
246
|
app.component("Link", Link);
|
|
239
247
|
app.component("PageView", PageView);
|
|
240
248
|
app.component("SlotView", SlotView);
|
|
249
|
+
app.component("ClientOnly", ClientOnly);
|
|
241
250
|
app.directive("client", vClient);
|
|
242
251
|
app.config.globalProperties.$ubean = {
|
|
243
252
|
page,
|
|
@@ -253,4 +262,4 @@ function createUbeanSSRApp(initialPage, options) {
|
|
|
253
262
|
}
|
|
254
263
|
const Head$1 = Head;
|
|
255
264
|
//#endregion
|
|
256
|
-
export {
|
|
265
|
+
export { createUbeanRouter as C, definePage as S, useSeoMeta as _, LOADING_KEY$1 as a, defineMeta as b, Link as c, SSR_KEY$1 as d, SlotView as f, ubeanVue as g, createUbeanSSRApp as h, LAYOUT_CHAIN_KEY as i, PAGE_KEY$1 as l, createUbeanClientApp as m, ERROR_KEY$1 as n, LOCALIZE_PATH_KEY$1 as o, TRANSITION_KEY$1 as p, Head$1 as r, LayoutChainRenderer$1 as s, ClientOnly as t, PageView as u, useUnheadHead as v, usePage as w, defineMiddleware as x, useViewTransition as y };
|
package/dist/app.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
export { type CreateUbeanRouterOptions, ERROR_KEY, Head, LAYOUT_CHAIN_KEY, LOADING_KEY, LOCALIZE_PATH_KEY, type LayoutChainContext, LayoutChainRenderer, Link, PAGE_KEY, PageView, SSR_KEY, SlotView, TRANSITION_KEY, UbeanAppInstance, UbeanAppOptions, type UbeanVueOptions, type UbeanVuePage, createUbeanClientApp, createUbeanRouter, createUbeanSSRApp, defineMeta, defineMiddleware, definePage, ubeanVue, useUnheadHead as useHead, usePage, useSeoMeta, useViewTransition };
|
|
1
|
+
import { A as createUbeanRouter, C as useViewTransition, D as UbeanVuePage, E as definePage, O as usePage, S as useUnheadHead, T as defineMiddleware, _ as UbeanVueOptions, a as LOADING_KEY, b as ubeanVue, c as LayoutChainRenderer, d as PageView, f as SSR_KEY, g as UbeanAppOptions, h as UbeanAppInstance, i as LAYOUT_CHAIN_KEY, k as CreateUbeanRouterOptions, l as Link, m as TRANSITION_KEY, n as ERROR_KEY, o as LOCALIZE_PATH_KEY, p as SlotView, r as Head, s as LayoutChainContext, t as ClientOnly, u as PAGE_KEY, v as createUbeanClientApp, w as defineMeta, x as useSeoMeta, y as createUbeanSSRApp } from "./app-Busq_M7n.js";
|
|
2
|
+
export { ClientOnly, type CreateUbeanRouterOptions, ERROR_KEY, Head, LAYOUT_CHAIN_KEY, LOADING_KEY, LOCALIZE_PATH_KEY, type LayoutChainContext, LayoutChainRenderer, Link, PAGE_KEY, PageView, SSR_KEY, SlotView, TRANSITION_KEY, UbeanAppInstance, UbeanAppOptions, type UbeanVueOptions, type UbeanVuePage, createUbeanClientApp, createUbeanRouter, createUbeanSSRApp, defineMeta, defineMiddleware, definePage, ubeanVue, useUnheadHead as useHead, usePage, useSeoMeta, useViewTransition };
|
package/dist/app.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
export { ERROR_KEY, Head, LAYOUT_CHAIN_KEY, LOADING_KEY, LOCALIZE_PATH_KEY, LayoutChainRenderer, Link, PAGE_KEY, PageView, SSR_KEY, SlotView, TRANSITION_KEY, createUbeanClientApp, createUbeanRouter, createUbeanSSRApp, defineMeta, defineMiddleware, definePage, ubeanVue, useUnheadHead as useHead, usePage, useSeoMeta, useViewTransition };
|
|
1
|
+
import { C as createUbeanRouter, S as definePage, _ as useSeoMeta, a as LOADING_KEY, b as defineMeta, c as Link, d as SSR_KEY, f as SlotView, g as ubeanVue, h as createUbeanSSRApp, i as LAYOUT_CHAIN_KEY, l as PAGE_KEY, m as createUbeanClientApp, n as ERROR_KEY, o as LOCALIZE_PATH_KEY, p as TRANSITION_KEY, r as Head, s as LayoutChainRenderer, t as ClientOnly, u as PageView, v as useUnheadHead, w as usePage, x as defineMiddleware, y as useViewTransition } from "./app-COSjPzyK.js";
|
|
2
|
+
export { ClientOnly, ERROR_KEY, Head, LAYOUT_CHAIN_KEY, LOADING_KEY, LOCALIZE_PATH_KEY, LayoutChainRenderer, Link, PAGE_KEY, PageView, SSR_KEY, SlotView, TRANSITION_KEY, createUbeanClientApp, createUbeanRouter, createUbeanSSRApp, defineMeta, defineMiddleware, definePage, ubeanVue, useUnheadHead as useHead, usePage, useSeoMeta, useViewTransition };
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { App, Component, Plugin } from "vue";
|
|
2
|
+
import { Router, RouterOptions } from "vue-router";
|
|
3
|
+
import { ViewTransitionOptions } from "@ubean/vue";
|
|
4
|
+
import { PageHead } from "@ubean/shared";
|
|
5
|
+
//#region src/define-app.d.ts
|
|
6
|
+
interface AppPluginConfig {
|
|
7
|
+
plugin: Plugin | [Plugin, ...any[]];
|
|
8
|
+
mode?: 'all' | 'client' | 'server';
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Router 钩子配置 — 暴露 vue-router 的导航守卫注册入口 + 初始化选项。
|
|
12
|
+
*
|
|
13
|
+
* `setup(router)` 在 router 实例创建后、`app.use(router)` 之前调用,
|
|
14
|
+
* 因此守卫能拦截首次导航(包括 SSR 的初始 URL push)。
|
|
15
|
+
*
|
|
16
|
+
* Client 和 SSR 都会执行,适合做鉴权、埋点、进度条等逻辑。
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* defineApp({
|
|
21
|
+
* router: {
|
|
22
|
+
* setup(router) {
|
|
23
|
+
* router.beforeEach((to, from) => {
|
|
24
|
+
* if (to.meta.requiresAuth && !isAuthenticated()) {
|
|
25
|
+
* return '/login';
|
|
26
|
+
* }
|
|
27
|
+
* });
|
|
28
|
+
* router.afterEach((to) => {
|
|
29
|
+
* analytics.track('page_view', { path: to.fullPath });
|
|
30
|
+
* });
|
|
31
|
+
* },
|
|
32
|
+
* scrollBehavior(to, from, savedPosition) {
|
|
33
|
+
* // 覆盖默认滚动策略(默认已守卫 hash 目标元素不存在时的 R0042)
|
|
34
|
+
* if (savedPosition) return savedPosition;
|
|
35
|
+
* if (to.hash) return { el: to.hash, behavior: 'smooth' };
|
|
36
|
+
* return { top: 0 };
|
|
37
|
+
* }
|
|
38
|
+
* }
|
|
39
|
+
* });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
interface RouterConfig {
|
|
43
|
+
/**
|
|
44
|
+
* 在 router 创建后、初始导航前调用。
|
|
45
|
+
* 用于注册 `beforeEach` / `beforeResolve` / `afterEach` 等守卫。
|
|
46
|
+
*
|
|
47
|
+
* 注意:setup 必须同步注册守卫(虽然守卫本身可以返回 Promise)。
|
|
48
|
+
* 不要在 setup 中执行异步操作(如请求 API),因为这会延迟首次导航。
|
|
49
|
+
*/
|
|
50
|
+
setup?: (router: Router) => void;
|
|
51
|
+
/**
|
|
52
|
+
* vue-router `scrollBehavior`,覆盖 `createUbeanRouter` 的默认滚动策略。
|
|
53
|
+
* 未配置时使用框架默认:回到顶部;带 hash 且目标元素存在时平滑滚动。
|
|
54
|
+
*/
|
|
55
|
+
scrollBehavior?: RouterOptions['scrollBehavior'];
|
|
56
|
+
}
|
|
57
|
+
interface DefineAppOptions {
|
|
58
|
+
plugins?: Array<Plugin | [Plugin, ...any[]] | AppPluginConfig>;
|
|
59
|
+
globalComponents?: Record<string, Component>;
|
|
60
|
+
provides?: Record<string | symbol, unknown>;
|
|
61
|
+
head?: PageHead;
|
|
62
|
+
rootId?: string;
|
|
63
|
+
rootAttrs?: Record<string, string>;
|
|
64
|
+
/**
|
|
65
|
+
* 应用根组件(包装组件,可选)—— 经典 Vue `App.vue` 的编程式等价物。
|
|
66
|
+
*
|
|
67
|
+
* 组件包裹在框架根组件(`UbeanAppRoot`)之上,框架出口(布局链 + 页面)
|
|
68
|
+
* 通过**默认 slot** 注入,组件内用 `<slot />` 声明渲染位置:
|
|
69
|
+
*
|
|
70
|
+
* ```vue
|
|
71
|
+
* <!-- src/app.ts 对应的 AppRoot.vue -->
|
|
72
|
+
* <template>
|
|
73
|
+
* <SConfigProvider>
|
|
74
|
+
* <AppHeader />
|
|
75
|
+
* <slot /> <!-- 布局链 + 页面在这里渲染 -->
|
|
76
|
+
* </SConfigProvider>
|
|
77
|
+
* </template>
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* 适合放置"必须在布局之上"的全局内容:全局 ConfigProvider/主题上下文、
|
|
81
|
+
* 覆盖布局自身的错误边界、全局过渡/动效容器等。不要用它渲染
|
|
82
|
+
* `<PageView />` / `<RouterView />` —— 那会绕过布局链;出口是 `<slot />`。
|
|
83
|
+
*
|
|
84
|
+
* 自动检测:`src/app.vue`(小写,Nuxt 风格,优先)/ `src/App.vue`
|
|
85
|
+
* (大写,经典 Vue 约定)文件约定(与 loading/error 特殊页同模式),
|
|
86
|
+
* 两者都存在时取小写;无该文件时忽略。优先级:
|
|
87
|
+
* `defineApp({ appRoot })` > `src/app.vue` > `src/App.vue`。
|
|
88
|
+
*/
|
|
89
|
+
appRoot?: Component;
|
|
90
|
+
/**
|
|
91
|
+
* 路由钩子配置,用于注册 vue-router 的导航守卫。
|
|
92
|
+
* 在 Client 和 SSR 都会执行。
|
|
93
|
+
*/
|
|
94
|
+
router?: RouterConfig;
|
|
95
|
+
onAppCreated?: (app: App) => void | Promise<void>;
|
|
96
|
+
onClientReady?: (app: App) => void | Promise<void>;
|
|
97
|
+
errorComponent?: Component;
|
|
98
|
+
loadingComponent?: Component;
|
|
99
|
+
viewTransitions?: boolean | ViewTransitionOptions;
|
|
100
|
+
/**
|
|
101
|
+
* SSR 专用:在 `renderToString(app)` 完成后调用,从 app 实例提取需要
|
|
102
|
+
* 序列化到客户端的状态(如 Pinia 的 `pinia.state.value`)。
|
|
103
|
+
*
|
|
104
|
+
* 返回的对象会被 `safeJsonStringify` 序列化并注入到 HTML 的
|
|
105
|
+
* `__UBEAN_STATE__` script 标签中。
|
|
106
|
+
*
|
|
107
|
+
* 仅在 server mode 下生效;client mode 下被忽略。
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```ts
|
|
111
|
+
* import { createPinia } from 'pinia';
|
|
112
|
+
* defineApp({
|
|
113
|
+
* plugins: [createPinia()],
|
|
114
|
+
* serializeState: (app) => ({
|
|
115
|
+
* pinia: app.config.globalProperties.$pinia.state.value
|
|
116
|
+
* })
|
|
117
|
+
* });
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
serializeState?: (app: App) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
121
|
+
/**
|
|
122
|
+
* Client 专用:在 `applyAppConfig`(注册插件/provide)之后、`app.mount()` 之前调用,
|
|
123
|
+
* 用于从 `__UBEAN_STATE__` 反序列化的状态回填到 app(如 Pinia 的水合)。
|
|
124
|
+
*
|
|
125
|
+
* `state` 即 `serializeState` 在服务端返回的对象;若服务端未配置 `serializeState`
|
|
126
|
+
* 或返回空,`state` 为 `null`。
|
|
127
|
+
*
|
|
128
|
+
* 仅在 client mode 下生效;server mode 下被忽略。
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```ts
|
|
132
|
+
* import { createPinia } from 'pinia';
|
|
133
|
+
* defineApp({
|
|
134
|
+
* plugins: [createPinia()],
|
|
135
|
+
* hydrateState: (app, state) => {
|
|
136
|
+
* if (state?.pinia) {
|
|
137
|
+
* app.config.globalProperties.$pinia.state.value = state.pinia;
|
|
138
|
+
* }
|
|
139
|
+
* }
|
|
140
|
+
* });
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
hydrateState?: (app: App, state: Record<string, unknown> | null) => void;
|
|
144
|
+
}
|
|
145
|
+
interface ResolvedAppConfig {
|
|
146
|
+
plugins: AppPluginConfig[];
|
|
147
|
+
globalComponents: Record<string, Component>;
|
|
148
|
+
provides: Record<string | symbol, unknown>;
|
|
149
|
+
head?: PageHead;
|
|
150
|
+
rootId: string;
|
|
151
|
+
rootAttrs: Record<string, string>;
|
|
152
|
+
/**
|
|
153
|
+
* 应用根组件(包装组件,可选)。语义见 `DefineAppOptions.appRoot`。
|
|
154
|
+
*/
|
|
155
|
+
appRoot?: Component;
|
|
156
|
+
router?: RouterConfig;
|
|
157
|
+
onAppCreated?: (app: App) => void | Promise<void>;
|
|
158
|
+
onClientReady?: (app: App) => void | Promise<void>;
|
|
159
|
+
errorComponent?: Component;
|
|
160
|
+
loadingComponent?: Component;
|
|
161
|
+
viewTransitions?: boolean | ViewTransitionOptions;
|
|
162
|
+
serializeState?: (app: App) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
163
|
+
hydrateState?: (app: App, state: Record<string, unknown> | null) => void;
|
|
164
|
+
}
|
|
165
|
+
declare function defineApp(options: DefineAppOptions): ResolvedAppConfig;
|
|
166
|
+
declare function applyAppConfig(app: App, config: ResolvedAppConfig, mode: 'client' | 'server'): void;
|
|
167
|
+
declare function createDefaultAppConfig(): ResolvedAppConfig;
|
|
168
|
+
/**
|
|
169
|
+
* 从多个 `ResolvedAppConfig` 合并出一个最终配置(shared + client/server)。
|
|
170
|
+
*
|
|
171
|
+
* `serializeState` 与 `hydrateState` 的合并语义:server 配置的 `serializeState` 优先,
|
|
172
|
+
* client 配置的 `hydrateState` 优先;shared 配置作为默认值。
|
|
173
|
+
*
|
|
174
|
+
* 这个函数在 `virtual:ubean-app` 虚拟模块中以 JS 字符串形式重新实现
|
|
175
|
+
* (`_mergeAppConfig`),保持两者语义一致。
|
|
176
|
+
*/
|
|
177
|
+
declare function mergeAppConfig(base: ResolvedAppConfig, ...configs: (ResolvedAppConfig | null | undefined)[]): ResolvedAppConfig;
|
|
178
|
+
//#endregion
|
|
179
|
+
export { applyAppConfig as a, mergeAppConfig as c, RouterConfig as i, DefineAppOptions as n, createDefaultAppConfig as o, ResolvedAppConfig as r, defineApp as s, AppPluginConfig as t };
|
package/dist/define-app.d.ts
CHANGED
|
@@ -1,168 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Router } from "vue-router";
|
|
3
|
-
import { ViewTransitionOptions } from "@ubean/vue";
|
|
4
|
-
import { PageHead } from "@ubean/shared";
|
|
5
|
-
//#region src/define-app.d.ts
|
|
6
|
-
interface AppPluginConfig {
|
|
7
|
-
plugin: Plugin | [Plugin, ...any[]];
|
|
8
|
-
mode?: 'all' | 'client' | 'server';
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Router 钩子配置 — 暴露 vue-router 的导航守卫注册入口。
|
|
12
|
-
*
|
|
13
|
-
* `setup(router)` 在 router 实例创建后、`app.use(router)` 之前调用,
|
|
14
|
-
* 因此守卫能拦截首次导航(包括 SSR 的初始 URL push)。
|
|
15
|
-
*
|
|
16
|
-
* Client 和 SSR 都会执行,适合做鉴权、埋点、进度条等逻辑。
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```ts
|
|
20
|
-
* defineApp({
|
|
21
|
-
* router: {
|
|
22
|
-
* setup(router) {
|
|
23
|
-
* router.beforeEach((to, from) => {
|
|
24
|
-
* if (to.meta.requiresAuth && !isAuthenticated()) {
|
|
25
|
-
* return '/login';
|
|
26
|
-
* }
|
|
27
|
-
* });
|
|
28
|
-
* router.afterEach((to) => {
|
|
29
|
-
* analytics.track('page_view', { path: to.fullPath });
|
|
30
|
-
* });
|
|
31
|
-
* }
|
|
32
|
-
* }
|
|
33
|
-
* });
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
interface RouterConfig {
|
|
37
|
-
/**
|
|
38
|
-
* 在 router 创建后、初始导航前调用。
|
|
39
|
-
* 用于注册 `beforeEach` / `beforeResolve` / `afterEach` 等守卫。
|
|
40
|
-
*
|
|
41
|
-
* 注意:setup 必须同步注册守卫(虽然守卫本身可以返回 Promise)。
|
|
42
|
-
* 不要在 setup 中执行异步操作(如请求 API),因为这会延迟首次导航。
|
|
43
|
-
*/
|
|
44
|
-
setup?: (router: Router) => void;
|
|
45
|
-
}
|
|
46
|
-
interface DefineAppOptions {
|
|
47
|
-
plugins?: Array<Plugin | [Plugin, ...any[]] | AppPluginConfig>;
|
|
48
|
-
globalComponents?: Record<string, Component>;
|
|
49
|
-
provides?: Record<string | symbol, unknown>;
|
|
50
|
-
head?: PageHead;
|
|
51
|
-
rootId?: string;
|
|
52
|
-
rootAttrs?: Record<string, string>;
|
|
53
|
-
/**
|
|
54
|
-
* 应用根组件(包装组件,可选)—— 经典 Vue `App.vue` 的编程式等价物。
|
|
55
|
-
*
|
|
56
|
-
* 组件包裹在框架根组件(`UbeanAppRoot`)之上,框架出口(布局链 + 页面)
|
|
57
|
-
* 通过**默认 slot** 注入,组件内用 `<slot />` 声明渲染位置:
|
|
58
|
-
*
|
|
59
|
-
* ```vue
|
|
60
|
-
* <!-- src/app.ts 对应的 AppRoot.vue -->
|
|
61
|
-
* <template>
|
|
62
|
-
* <SConfigProvider>
|
|
63
|
-
* <AppHeader />
|
|
64
|
-
* <slot /> <!-- 布局链 + 页面在这里渲染 -->
|
|
65
|
-
* </SConfigProvider>
|
|
66
|
-
* </template>
|
|
67
|
-
* ```
|
|
68
|
-
*
|
|
69
|
-
* 适合放置"必须在布局之上"的全局内容:全局 ConfigProvider/主题上下文、
|
|
70
|
-
* 覆盖布局自身的错误边界、全局过渡/动效容器等。不要用它渲染
|
|
71
|
-
* `<PageView />` / `<RouterView />` —— 那会绕过布局链;出口是 `<slot />`。
|
|
72
|
-
*
|
|
73
|
-
* 自动检测:`src/app.vue`(小写,Nuxt 风格,优先)/ `src/App.vue`
|
|
74
|
-
* (大写,经典 Vue 约定)文件约定(与 loading/error 特殊页同模式),
|
|
75
|
-
* 两者都存在时取小写;无该文件时忽略。优先级:
|
|
76
|
-
* `defineApp({ appRoot })` > `src/app.vue` > `src/App.vue`。
|
|
77
|
-
*/
|
|
78
|
-
appRoot?: Component;
|
|
79
|
-
/**
|
|
80
|
-
* 路由钩子配置,用于注册 vue-router 的导航守卫。
|
|
81
|
-
* 在 Client 和 SSR 都会执行。
|
|
82
|
-
*/
|
|
83
|
-
router?: RouterConfig;
|
|
84
|
-
onAppCreated?: (app: App) => void | Promise<void>;
|
|
85
|
-
onClientReady?: (app: App) => void | Promise<void>;
|
|
86
|
-
errorComponent?: Component;
|
|
87
|
-
loadingComponent?: Component;
|
|
88
|
-
viewTransitions?: boolean | ViewTransitionOptions;
|
|
89
|
-
/**
|
|
90
|
-
* SSR 专用:在 `renderToString(app)` 完成后调用,从 app 实例提取需要
|
|
91
|
-
* 序列化到客户端的状态(如 Pinia 的 `pinia.state.value`)。
|
|
92
|
-
*
|
|
93
|
-
* 返回的对象会被 `safeJsonStringify` 序列化并注入到 HTML 的
|
|
94
|
-
* `__UBEAN_STATE__` script 标签中。
|
|
95
|
-
*
|
|
96
|
-
* 仅在 server mode 下生效;client mode 下被忽略。
|
|
97
|
-
*
|
|
98
|
-
* @example
|
|
99
|
-
* ```ts
|
|
100
|
-
* import { createPinia } from 'pinia';
|
|
101
|
-
* defineApp({
|
|
102
|
-
* plugins: [createPinia()],
|
|
103
|
-
* serializeState: (app) => ({
|
|
104
|
-
* pinia: app.config.globalProperties.$pinia.state.value
|
|
105
|
-
* })
|
|
106
|
-
* });
|
|
107
|
-
* ```
|
|
108
|
-
*/
|
|
109
|
-
serializeState?: (app: App) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
110
|
-
/**
|
|
111
|
-
* Client 专用:在 `applyAppConfig`(注册插件/provide)之后、`app.mount()` 之前调用,
|
|
112
|
-
* 用于从 `__UBEAN_STATE__` 反序列化的状态回填到 app(如 Pinia 的水合)。
|
|
113
|
-
*
|
|
114
|
-
* `state` 即 `serializeState` 在服务端返回的对象;若服务端未配置 `serializeState`
|
|
115
|
-
* 或返回空,`state` 为 `null`。
|
|
116
|
-
*
|
|
117
|
-
* 仅在 client mode 下生效;server mode 下被忽略。
|
|
118
|
-
*
|
|
119
|
-
* @example
|
|
120
|
-
* ```ts
|
|
121
|
-
* import { createPinia } from 'pinia';
|
|
122
|
-
* defineApp({
|
|
123
|
-
* plugins: [createPinia()],
|
|
124
|
-
* hydrateState: (app, state) => {
|
|
125
|
-
* if (state?.pinia) {
|
|
126
|
-
* app.config.globalProperties.$pinia.state.value = state.pinia;
|
|
127
|
-
* }
|
|
128
|
-
* }
|
|
129
|
-
* });
|
|
130
|
-
* ```
|
|
131
|
-
*/
|
|
132
|
-
hydrateState?: (app: App, state: Record<string, unknown> | null) => void;
|
|
133
|
-
}
|
|
134
|
-
interface ResolvedAppConfig {
|
|
135
|
-
plugins: AppPluginConfig[];
|
|
136
|
-
globalComponents: Record<string, Component>;
|
|
137
|
-
provides: Record<string | symbol, unknown>;
|
|
138
|
-
head?: PageHead;
|
|
139
|
-
rootId: string;
|
|
140
|
-
rootAttrs: Record<string, string>;
|
|
141
|
-
/**
|
|
142
|
-
* 应用根组件(包装组件,可选)。语义见 `DefineAppOptions.appRoot`。
|
|
143
|
-
*/
|
|
144
|
-
appRoot?: Component;
|
|
145
|
-
router?: RouterConfig;
|
|
146
|
-
onAppCreated?: (app: App) => void | Promise<void>;
|
|
147
|
-
onClientReady?: (app: App) => void | Promise<void>;
|
|
148
|
-
errorComponent?: Component;
|
|
149
|
-
loadingComponent?: Component;
|
|
150
|
-
viewTransitions?: boolean | ViewTransitionOptions;
|
|
151
|
-
serializeState?: (app: App) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
152
|
-
hydrateState?: (app: App, state: Record<string, unknown> | null) => void;
|
|
153
|
-
}
|
|
154
|
-
declare function defineApp(options: DefineAppOptions): ResolvedAppConfig;
|
|
155
|
-
declare function applyAppConfig(app: App, config: ResolvedAppConfig, mode: 'client' | 'server'): void;
|
|
156
|
-
declare function createDefaultAppConfig(): ResolvedAppConfig;
|
|
157
|
-
/**
|
|
158
|
-
* 从多个 `ResolvedAppConfig` 合并出一个最终配置(shared + client/server)。
|
|
159
|
-
*
|
|
160
|
-
* `serializeState` 与 `hydrateState` 的合并语义:server 配置的 `serializeState` 优先,
|
|
161
|
-
* client 配置的 `hydrateState` 优先;shared 配置作为默认值。
|
|
162
|
-
*
|
|
163
|
-
* 这个函数在 `virtual:ubean-app` 虚拟模块中以 JS 字符串形式重新实现
|
|
164
|
-
* (`_mergeAppConfig`),保持两者语义一致。
|
|
165
|
-
*/
|
|
166
|
-
declare function mergeAppConfig(base: ResolvedAppConfig, ...configs: (ResolvedAppConfig | null | undefined)[]): ResolvedAppConfig;
|
|
167
|
-
//#endregion
|
|
1
|
+
import { a as applyAppConfig, c as mergeAppConfig, i as RouterConfig, n as DefineAppOptions, o as createDefaultAppConfig, r as ResolvedAppConfig, s as defineApp, t as AppPluginConfig } from "./define-app-RzHOZlYB.js";
|
|
168
2
|
export { AppPluginConfig, DefineAppOptions, ResolvedAppConfig, RouterConfig, applyAppConfig, createDefaultAppConfig, defineApp, mergeAppConfig };
|
package/dist/define-app.js
CHANGED
|
@@ -84,13 +84,17 @@ function mergeAppConfig(base, ...configs) {
|
|
|
84
84
|
if (cfg.viewTransitions !== void 0) result.viewTransitions = cfg.viewTransitions;
|
|
85
85
|
if (cfg.serializeState) result.serializeState = cfg.serializeState;
|
|
86
86
|
if (cfg.hydrateState) result.hydrateState = cfg.hydrateState;
|
|
87
|
-
if (cfg.router
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
if (cfg.router) {
|
|
88
|
+
const prev = result.router;
|
|
89
|
+
const setup = cfg.router.setup ? prev?.setup ? (router) => {
|
|
90
|
+
prev.setup(router);
|
|
91
91
|
cfg.router.setup(router);
|
|
92
|
-
}
|
|
93
|
-
|
|
92
|
+
} : cfg.router.setup : prev?.setup;
|
|
93
|
+
const scrollBehavior = cfg.router.scrollBehavior !== void 0 ? cfg.router.scrollBehavior : prev?.scrollBehavior;
|
|
94
|
+
result.router = {
|
|
95
|
+
setup,
|
|
96
|
+
...scrollBehavior !== void 0 ? { scrollBehavior } : {}
|
|
97
|
+
};
|
|
94
98
|
}
|
|
95
99
|
}
|
|
96
100
|
return result;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { A as createUbeanRouter, D as UbeanVuePage, E as definePage, O as usePage, S as useUnheadHead, T as defineMiddleware, g as UbeanAppOptions, h as UbeanAppInstance, k as CreateUbeanRouterOptions, r as Head, v as createUbeanClientApp, w as defineMeta, x as useSeoMeta, y as createUbeanSSRApp } from "./app-Busq_M7n.js";
|
|
2
|
+
import { a as applyAppConfig, c as mergeAppConfig, n as DefineAppOptions, o as createDefaultAppConfig, r as ResolvedAppConfig, s as defineApp, t as AppPluginConfig } from "./define-app-RzHOZlYB.js";
|
|
3
3
|
import { App, ComputedRef, Ref, ShallowRef } from "vue";
|
|
4
4
|
import "vue-router";
|
|
5
|
-
import { ERROR_KEY, ErrorBoundary, LAYOUT_CHAIN_KEY, LOADING_KEY, LOCALIZE_PATH_KEY, LayoutChainContext, LayoutChainRenderer, Link, PAGE_KEY, PageView, RouteLocation, RouteLocationRaw, SSR_KEY, SlotView, TRANSITION_KEY, TypedLinkProps, UbeanVueOptions, UbeanVuePageData, UseCacheViewsReturn, UsePageTransitionReturn, UseReloadSignalReturn, ViewTransitionOptions, clearPageTransition, disablePageCache, enablePageCache, excludePageCache, getCacheEnabled, getCachedViewNames, getExcludedViewNames, getNamedPageWrapper, getNavigationType, getPageTransitionName, getReloadCounter, includePageCache, initCachedViewsFromRoutes, invalidatePageCache, isActiveRoute, isCacheEnabled, isPageCached, isPageExcluded, isReloading, reloadPage, resetNamedPageWrappers, resetRouteCache, resolveRoute, setPageTransition, supportsViewTransitions, ubeanVue, useCacheViews, usePageTransition, useReloadSignal, useViewTransition, useViewTransitionState, withViewTransition } from "@ubean/vue";
|
|
5
|
+
import { ClientOnly, ClientOnlyProps, ClientOnlySlots, ERROR_KEY, ErrorBoundary, LAYOUT_CHAIN_KEY, LOADING_KEY, LOCALIZE_PATH_KEY, LayoutChainContext, LayoutChainRenderer, Link, PAGE_KEY, PageView, RouteLocation, RouteLocationRaw, SSR_KEY, SlotView, TRANSITION_KEY, TypedLinkProps, UbeanVueOptions, UbeanVuePageData, UseCacheViewsReturn, UsePageTransitionReturn, UseReloadSignalReturn, ViewTransitionOptions, clearPageTransition, disablePageCache, enablePageCache, excludePageCache, getCacheEnabled, getCachedViewNames, getExcludedViewNames, getNamedPageWrapper, getNavigationType, getPageTransitionName, getReloadCounter, includePageCache, initCachedViewsFromRoutes, invalidatePageCache, isActiveRoute, isCacheEnabled, isPageCached, isPageExcluded, isReloading, reloadPage, resetNamedPageWrappers, resetRouteCache, resolveRoute, setPageTransition, supportsViewTransitions, ubeanVue, useCacheViews, usePageTransition, useReloadSignal, useViewTransition, useViewTransitionState, withViewTransition } from "@ubean/vue";
|
|
6
6
|
import { createHead as createClientHead } from "@unhead/vue/client";
|
|
7
7
|
import { DataResult, PageObject, UseAsyncDataOptions, UseFetchOptions, invalidateData, setDefaultFetch, useAsyncData, useData, useFetch } from "@ubean/pages";
|
|
8
8
|
import { I18n } from "vue-i18n";
|
|
@@ -10,7 +10,7 @@ import { LocaleRoutingConfig, buildLocaleHead } from "@ubean/i18n/browser";
|
|
|
10
10
|
import { HydrateIslandsOptions, IslandHydrateOptions, IslandHydrationScheduler, IslandRecord, collectIslands, hasPendingIslands, hydrateIsland, hydrateIslands, scheduleIslandHydration } from "@ubean/islands/runtime";
|
|
11
11
|
import { LinkTag, MetaTag, SeoMetadata } from "@ubean/seo";
|
|
12
12
|
//#region src/client.d.ts
|
|
13
|
-
declare function getInitialPageData<T = Record<string, unknown>>(): PageObject<T> | null;
|
|
13
|
+
export declare function getInitialPageData<T = Record<string, unknown>>(): PageObject<T> | null;
|
|
14
14
|
/**
|
|
15
15
|
* 从 DOM 中的 `<script id="__UBEAN_STATE__">` 读取 SSR 序列化的状态。
|
|
16
16
|
*
|
|
@@ -21,10 +21,10 @@ declare function getInitialPageData<T = Record<string, unknown>>(): PageObject<T
|
|
|
21
21
|
*
|
|
22
22
|
* @returns 解析后的状态对象,或 `null`(无状态 / 解析失败 / 非 DOM 环境)
|
|
23
23
|
*/
|
|
24
|
-
declare function getInitialState(): Record<string, unknown> | null;
|
|
24
|
+
export declare function getInitialState(): Record<string, unknown> | null;
|
|
25
25
|
//#endregion
|
|
26
26
|
//#region src/head.d.ts
|
|
27
|
-
declare function useHeadInstance(): import("@unhead/vue").VueHeadClient;
|
|
27
|
+
export declare function useHeadInstance(): import("@unhead/vue").VueHeadClient;
|
|
28
28
|
//#endregion
|
|
29
29
|
//#region src/composables.d.ts
|
|
30
30
|
interface UbeanVueContext {
|
|
@@ -45,7 +45,7 @@ interface DataCacheStore {
|
|
|
45
45
|
subscribe: (fn: () => void) => () => void;
|
|
46
46
|
getTimestamp: (key: string | symbol) => number | undefined;
|
|
47
47
|
}
|
|
48
|
-
declare function createDataCacheStore(): DataCacheStore;
|
|
48
|
+
export declare function createDataCacheStore(): DataCacheStore;
|
|
49
49
|
interface UseAsyncDataOptions$1<T> {
|
|
50
50
|
key?: string;
|
|
51
51
|
tags?: string[];
|
|
@@ -67,20 +67,20 @@ interface UseAsyncDataReturn<T> {
|
|
|
67
67
|
refresh: () => Promise<void>;
|
|
68
68
|
invalidate: () => void;
|
|
69
69
|
}
|
|
70
|
-
declare function createUseAsyncData(store: DataCacheStore): <T = unknown>(keyOrFetcher: string | (() => Promise<T>), fetcherOrOptions?: (() => Promise<T>) | UseAsyncDataOptions$1<T>, options?: UseAsyncDataOptions$1<T>) => UseAsyncDataReturn<T>;
|
|
71
|
-
declare function invalidateCache(store: DataCacheStore, keyOrTag: string): number;
|
|
72
|
-
declare function clearCache(store: DataCacheStore): void;
|
|
73
|
-
declare function defineDataKey(key: string): symbol;
|
|
74
|
-
declare function createLinkHandler(ctx: UbeanVueContext): {
|
|
70
|
+
export declare function createUseAsyncData(store: DataCacheStore): <T = unknown>(keyOrFetcher: string | (() => Promise<T>), fetcherOrOptions?: (() => Promise<T>) | UseAsyncDataOptions$1<T>, options?: UseAsyncDataOptions$1<T>) => UseAsyncDataReturn<T>;
|
|
71
|
+
export declare function invalidateCache(store: DataCacheStore, keyOrTag: string): number;
|
|
72
|
+
export declare function clearCache(store: DataCacheStore): void;
|
|
73
|
+
export declare function defineDataKey(key: string): symbol;
|
|
74
|
+
export declare function createLinkHandler(ctx: UbeanVueContext): {
|
|
75
75
|
getProps: () => {};
|
|
76
76
|
navigate(href: string, opts?: {
|
|
77
77
|
replace?: boolean;
|
|
78
78
|
}): Promise<void>;
|
|
79
79
|
prefetch(_href: string): Promise<void>;
|
|
80
80
|
};
|
|
81
|
-
declare function extractPageData<T = Record<string, unknown>>(): PageObject<T> | null;
|
|
82
|
-
declare function useServerData<T>(fetcher: () => Promise<T>): Promise<T>;
|
|
83
|
-
declare function getInvalidatedKeysForAction(actionName: string, invalidationMap: Record<string, Array<string | symbol>>, store: DataCacheStore): number;
|
|
81
|
+
export declare function extractPageData<T = Record<string, unknown>>(): PageObject<T> | null;
|
|
82
|
+
export declare function useServerData<T>(fetcher: () => Promise<T>): Promise<T>;
|
|
83
|
+
export declare function getInvalidatedKeysForAction(actionName: string, invalidationMap: Record<string, Array<string | symbol>>, store: DataCacheStore): number;
|
|
84
84
|
//#endregion
|
|
85
85
|
//#region src/i18n.d.ts
|
|
86
86
|
type LocaleMessages = Record<string, unknown>;
|
|
@@ -120,19 +120,19 @@ interface HydratedLocalePayload {
|
|
|
120
120
|
isDefault?: boolean;
|
|
121
121
|
}>;
|
|
122
122
|
}
|
|
123
|
-
declare function configureI18nRuntime(options: {
|
|
123
|
+
export declare function configureI18nRuntime(options: {
|
|
124
124
|
config: I18nRuntimeConfig;
|
|
125
125
|
loadLocale?: LocaleLoader;
|
|
126
126
|
locales?: HydratedLocalePayload['locales'];
|
|
127
127
|
}): void;
|
|
128
|
-
declare function getI18nRuntimeConfig(): I18nRuntimeConfig | null;
|
|
129
|
-
declare function createUbeanI18n(options?: {
|
|
128
|
+
export declare function getI18nRuntimeConfig(): I18nRuntimeConfig | null;
|
|
129
|
+
export declare function createUbeanI18n(options?: {
|
|
130
130
|
locale?: string;
|
|
131
131
|
fallbackLocale?: string;
|
|
132
132
|
messages?: Record<string, LocaleMessages>;
|
|
133
133
|
vueI18n?: Record<string, unknown>;
|
|
134
134
|
}): I18n;
|
|
135
|
-
declare function installUbeanI18n(app: App, i18n: I18n): void;
|
|
135
|
+
export declare function installUbeanI18n(app: App, i18n: I18n): void;
|
|
136
136
|
/**
|
|
137
137
|
* Framework setLocale: load messages, switch composer locale, write cookie,
|
|
138
138
|
* navigate to the localized path (`no_prefix` skips navigation).
|
|
@@ -140,20 +140,20 @@ declare function installUbeanI18n(app: App, i18n: I18n): void;
|
|
|
140
140
|
* Uses the runtime bound by `bindI18nRuntime` (not Vue composables) so it is
|
|
141
141
|
* safe to call from click handlers.
|
|
142
142
|
*/
|
|
143
|
-
declare function setLocale(code: string): Promise<void>;
|
|
144
|
-
declare function getLocale(): string;
|
|
145
|
-
declare function localizePath(path: string, locale?: string): string;
|
|
146
|
-
declare function switchLocalePath(locale: string, path?: string): string;
|
|
147
|
-
declare function extractLocaleFromPath(path: string): {
|
|
143
|
+
export declare function setLocale(code: string): Promise<void>;
|
|
144
|
+
export declare function getLocale(): string;
|
|
145
|
+
export declare function localizePath(path: string, locale?: string): string;
|
|
146
|
+
export declare function switchLocalePath(locale: string, path?: string): string;
|
|
147
|
+
export declare function extractLocaleFromPath(path: string): {
|
|
148
148
|
locale: string | null;
|
|
149
149
|
pathWithoutLocale: string;
|
|
150
150
|
};
|
|
151
|
-
declare function useLocalePath(): (path: string, locale?: string) => string;
|
|
152
|
-
declare function useSwitchLocalePath(): (locale: string) => string;
|
|
153
|
-
declare function useLocaleRoute(): (path: string, locale?: string) => string;
|
|
154
|
-
declare function useLocaleHead(): ComputedRef<ReturnType<typeof buildLocaleHead>>;
|
|
151
|
+
export declare function useLocalePath(): (path: string, locale?: string) => string;
|
|
152
|
+
export declare function useSwitchLocalePath(): (locale: string) => string;
|
|
153
|
+
export declare function useLocaleRoute(): (path: string, locale?: string) => string;
|
|
154
|
+
export declare function useLocaleHead(): ComputedRef<ReturnType<typeof buildLocaleHead>>;
|
|
155
155
|
/** Hydrate routing config from SSR payload before the first render. */
|
|
156
|
-
declare function initClientI18n(): void;
|
|
156
|
+
export declare function initClientI18n(): void;
|
|
157
157
|
//#endregion
|
|
158
158
|
//#region src/color-mode.d.ts
|
|
159
159
|
interface ColorModeConfig {
|
|
@@ -193,7 +193,7 @@ interface ColorMode {
|
|
|
193
193
|
toggle: () => void;
|
|
194
194
|
}
|
|
195
195
|
/** Merge user config with defaults. */
|
|
196
|
-
declare function resolveColorModeConfig(config?: Partial<ColorModeConfig>): ColorModeConfig;
|
|
196
|
+
export declare function resolveColorModeConfig(config?: Partial<ColorModeConfig>): ColorModeConfig;
|
|
197
197
|
/**
|
|
198
198
|
* Generate the no-FOUC inline script that resolves the color mode and sets
|
|
199
199
|
* the `<html>` class/attribute **before** the page renders.
|
|
@@ -206,11 +206,11 @@ declare function resolveColorModeConfig(config?: Partial<ColorModeConfig>): Colo
|
|
|
206
206
|
*
|
|
207
207
|
* This script is injected into `<head>` and runs synchronously.
|
|
208
208
|
*/
|
|
209
|
-
declare function getColorModeScript(config: ColorModeConfig): string;
|
|
209
|
+
export declare function getColorModeScript(config: ColorModeConfig): string;
|
|
210
210
|
/** Configure the color mode module (called once during app initialization). */
|
|
211
|
-
declare function configureColorMode(config?: Partial<ColorModeConfig>): ColorModeConfig;
|
|
211
|
+
export declare function configureColorMode(config?: Partial<ColorModeConfig>): ColorModeConfig;
|
|
212
212
|
/** Get the current color mode config. */
|
|
213
|
-
declare function getColorModeConfig(): ColorModeConfig;
|
|
213
|
+
export declare function getColorModeConfig(): ColorModeConfig;
|
|
214
214
|
/**
|
|
215
215
|
* Reactively access and control the color mode.
|
|
216
216
|
*
|
|
@@ -230,21 +230,21 @@ declare function getColorModeConfig(): ColorModeConfig;
|
|
|
230
230
|
* colorMode.toggle(); // cycles: light → dark → light
|
|
231
231
|
* ```
|
|
232
232
|
*/
|
|
233
|
-
declare function useColorMode(): ColorMode;
|
|
233
|
+
export declare function useColorMode(): ColorMode;
|
|
234
234
|
/**
|
|
235
235
|
* Force a color mode (e.g. from route meta `colorMode: 'dark'`).
|
|
236
236
|
* When forced, user changes are ignored until `unforceColorMode()` is called.
|
|
237
237
|
*/
|
|
238
|
-
declare function forceColorMode(mode: string): void;
|
|
238
|
+
export declare function forceColorMode(mode: string): void;
|
|
239
239
|
/**
|
|
240
240
|
* Remove the forced color mode, returning to user preference.
|
|
241
241
|
*/
|
|
242
|
-
declare function unforceColorMode(): void;
|
|
242
|
+
export declare function unforceColorMode(): void;
|
|
243
243
|
/**
|
|
244
244
|
* Reset the color mode module state (for testing).
|
|
245
245
|
* @internal
|
|
246
246
|
*/
|
|
247
|
-
declare function _resetColorMode(): void;
|
|
247
|
+
export declare function _resetColorMode(): void;
|
|
248
248
|
//#endregion
|
|
249
249
|
//#region src/party-town.d.ts
|
|
250
250
|
interface PartyTownConfig {
|
|
@@ -271,7 +271,7 @@ interface PartyTownConfig {
|
|
|
271
271
|
nonBlocking: boolean;
|
|
272
272
|
}
|
|
273
273
|
/** Merge user config with defaults. */
|
|
274
|
-
declare function resolvePartyTownConfig(config?: Partial<PartyTownConfig>): PartyTownConfig;
|
|
274
|
+
export declare function resolvePartyTownConfig(config?: Partial<PartyTownConfig>): PartyTownConfig;
|
|
275
275
|
/**
|
|
276
276
|
* Generate the inline Partytown config script for `<head>`.
|
|
277
277
|
*
|
|
@@ -281,12 +281,12 @@ declare function resolvePartyTownConfig(config?: Partial<PartyTownConfig>): Part
|
|
|
281
281
|
*
|
|
282
282
|
* Returns an empty string if Partytown is not enabled.
|
|
283
283
|
*/
|
|
284
|
-
declare function getPartyTownScript(config: PartyTownConfig): string;
|
|
284
|
+
export declare function getPartyTownScript(config: PartyTownConfig): string;
|
|
285
285
|
/**
|
|
286
286
|
* Generate the full HTML for Partytown initialization.
|
|
287
287
|
* Used by the Vite plugin to inject into `<head>`.
|
|
288
288
|
*/
|
|
289
|
-
declare function getPartyTownHeadContent(config: PartyTownConfig): string;
|
|
289
|
+
export declare function getPartyTownHeadContent(config: PartyTownConfig): string;
|
|
290
290
|
type ScriptTrigger = 'load' | 'idle' | 'visible' | 'manual';
|
|
291
291
|
interface UseScriptOptions {
|
|
292
292
|
/** When to load the script (default: 'load'). */
|
|
@@ -355,15 +355,15 @@ interface UseScriptReturn {
|
|
|
355
355
|
* useScript('/analytics.js', { trigger: 'visible', target: targetRef });
|
|
356
356
|
* ```
|
|
357
357
|
*/
|
|
358
|
-
declare function useScript(src: string, options?: UseScriptOptions): UseScriptReturn;
|
|
358
|
+
export declare function useScript(src: string, options?: UseScriptOptions): UseScriptReturn;
|
|
359
359
|
/** Configure the Partytown module globally. */
|
|
360
|
-
declare function configurePartyTown(config?: Partial<PartyTownConfig>): PartyTownConfig;
|
|
360
|
+
export declare function configurePartyTown(config?: Partial<PartyTownConfig>): PartyTownConfig;
|
|
361
361
|
/** Get the current Partytown config. */
|
|
362
|
-
declare function getPartyTownConfig(): PartyTownConfig;
|
|
362
|
+
export declare function getPartyTownConfig(): PartyTownConfig;
|
|
363
363
|
/** Check if Partytown is enabled. */
|
|
364
|
-
declare function isPartyTownEnabled(): boolean;
|
|
364
|
+
export declare function isPartyTownEnabled(): boolean;
|
|
365
365
|
/** Reset Partytown module state (for testing). @internal */
|
|
366
|
-
declare function _resetPartyTown(): void;
|
|
366
|
+
export declare function _resetPartyTown(): void;
|
|
367
367
|
//#endregion
|
|
368
368
|
//#region src/search.d.ts
|
|
369
369
|
/** A single search result from Pagefind. */
|
|
@@ -435,11 +435,11 @@ interface SearchRuntimeConfig {
|
|
|
435
435
|
* Configure the search runtime globally. Call this in `app.ts` (client-side)
|
|
436
436
|
* to override defaults before any `useSearch()` call.
|
|
437
437
|
*/
|
|
438
|
-
declare function configureSearch(config: Partial<SearchRuntimeConfig>): void;
|
|
438
|
+
export declare function configureSearch(config: Partial<SearchRuntimeConfig>): void;
|
|
439
439
|
/** Get the current runtime search config. */
|
|
440
|
-
declare function getSearchConfig(): SearchRuntimeConfig;
|
|
440
|
+
export declare function getSearchConfig(): SearchRuntimeConfig;
|
|
441
441
|
/** Resolve a user-provided config object into a full SearchRuntimeConfig. */
|
|
442
|
-
declare function resolveSearchConfig(config?: Partial<SearchRuntimeConfig> | true): SearchRuntimeConfig;
|
|
442
|
+
export declare function resolveSearchConfig(config?: Partial<SearchRuntimeConfig> | true): SearchRuntimeConfig;
|
|
443
443
|
/** The loaded Pagefind browser module (cached after first load). */
|
|
444
444
|
type PagefindModule = any;
|
|
445
445
|
/**
|
|
@@ -449,18 +449,18 @@ type PagefindModule = any;
|
|
|
449
449
|
* served at `/pagefind/pagefind-modern.js`. In dev mode or when Pagefind is
|
|
450
450
|
* not enabled, the import will fail — callers should catch and show a message.
|
|
451
451
|
*/
|
|
452
|
-
declare function initPagefind(options?: {
|
|
452
|
+
export declare function initPagefind(options?: {
|
|
453
453
|
pagefindPath?: string;
|
|
454
454
|
}): Promise<PagefindModule>;
|
|
455
455
|
/** Check whether the Pagefind browser library has been loaded. */
|
|
456
|
-
declare function isPagefindLoaded(): boolean;
|
|
456
|
+
export declare function isPagefindLoaded(): boolean;
|
|
457
457
|
/**
|
|
458
458
|
* Execute a raw Pagefind search. Returns normalized `SearchResult[]`.
|
|
459
459
|
*
|
|
460
460
|
* Exposed for advanced use cases where the reactive composable is not needed
|
|
461
461
|
* (e.g. server-side API routes that proxy search requests).
|
|
462
462
|
*/
|
|
463
|
-
declare function executeSearch(query: string, options?: {
|
|
463
|
+
export declare function executeSearch(query: string, options?: {
|
|
464
464
|
filters?: SearchFilters;
|
|
465
465
|
limit?: number;
|
|
466
466
|
pagefindPath?: string;
|
|
@@ -494,9 +494,9 @@ declare function executeSearch(query: string, options?: {
|
|
|
494
494
|
* </template>
|
|
495
495
|
* ```
|
|
496
496
|
*/
|
|
497
|
-
declare function useSearch(options?: UseSearchOptions): UseSearchReturn;
|
|
497
|
+
export declare function useSearch(options?: UseSearchOptions): UseSearchReturn;
|
|
498
498
|
/** Reset all internal state (for unit tests only). */
|
|
499
|
-
declare function _resetSearch(): void;
|
|
499
|
+
export declare function _resetSearch(): void;
|
|
500
500
|
/**
|
|
501
501
|
* Inject a mock Pagefind module for testing.
|
|
502
502
|
*
|
|
@@ -504,6 +504,6 @@ declare function _resetSearch(): void;
|
|
|
504
504
|
* results without a real Pagefind build. Also calls `mock.init()` to mimic
|
|
505
505
|
* the real library's initialization.
|
|
506
506
|
*/
|
|
507
|
-
declare function _setPagefindMock(mock: any): void;
|
|
507
|
+
export declare function _setPagefindMock(mock: any): void;
|
|
508
508
|
//#endregion
|
|
509
|
-
export { type AppPluginConfig, type ColorMode, type ColorModeConfig, type CreateUbeanRouterOptions, type DataCacheStore, type DataResult, type DefineAppOptions, ERROR_KEY, ErrorBoundary, Head, type HydrateIslandsOptions, type I18nRuntimeConfig, type IslandHydrateOptions, type IslandHydrationScheduler, type IslandRecord, LAYOUT_CHAIN_KEY, LOADING_KEY, LOCALIZE_PATH_KEY, type LayoutChainContext, LayoutChainRenderer, Link, type LinkProps, type LinkTag, type LocaleLoader, type LocaleMessages, type MetaTag, PAGE_KEY, PageView, type PartyTownConfig, type ResolvedAppConfig, type RouteLocation, type RouteLocationRaw, SSR_KEY, type ScriptTrigger, type SearchFilters, type SearchResult, type SearchRuntimeConfig, type SeoMetadata, SlotView, TRANSITION_KEY, type TypedLinkProps, type UbeanAppInstance, type UbeanAppOptions, type UbeanVueContext, type UbeanVueOptions, type UbeanVuePage, type UbeanVuePageData, type UseAsyncDataOptions, type UseAsyncDataReturn, type UseCacheViewsReturn, type UseFetchOptions, type UsePageTransitionReturn, type UseReloadSignalReturn, type UseScriptOptions, type UseScriptReturn, type UseSearchOptions, type UseSearchReturn, type ViewTransitionOptions,
|
|
509
|
+
export { type AppPluginConfig, ClientOnly, type ClientOnlyProps, type ClientOnlySlots, type ColorMode, type ColorModeConfig, type CreateUbeanRouterOptions, type DataCacheStore, type DataResult, type DefineAppOptions, ERROR_KEY, ErrorBoundary, Head, type HydrateIslandsOptions, type I18nRuntimeConfig, type IslandHydrateOptions, type IslandHydrationScheduler, type IslandRecord, LAYOUT_CHAIN_KEY, LOADING_KEY, LOCALIZE_PATH_KEY, type LayoutChainContext, LayoutChainRenderer, Link, type LinkProps, type LinkTag, type LocaleLoader, type LocaleMessages, type MetaTag, PAGE_KEY, PageView, type PartyTownConfig, type ResolvedAppConfig, type RouteLocation, type RouteLocationRaw, SSR_KEY, type ScriptTrigger, type SearchFilters, type SearchResult, type SearchRuntimeConfig, type SeoMetadata, SlotView, TRANSITION_KEY, type TypedLinkProps, type UbeanAppInstance, type UbeanAppOptions, type UbeanVueContext, type UbeanVueOptions, type UbeanVuePage, type UbeanVuePageData, type UseAsyncDataOptions, type UseAsyncDataReturn, type UseCacheViewsReturn, type UseFetchOptions, type UsePageTransitionReturn, type UseReloadSignalReturn, type UseScriptOptions, type UseScriptReturn, type UseSearchOptions, type UseSearchReturn, type ViewTransitionOptions, applyAppConfig, clearPageTransition, collectIslands, createClientHead, createDefaultAppConfig, createUbeanClientApp, createUbeanRouter, createUbeanSSRApp, defineApp, defineMeta, defineMiddleware, definePage, disablePageCache, enablePageCache, excludePageCache, getCacheEnabled, getCachedViewNames, getExcludedViewNames, getNamedPageWrapper, getNavigationType, getPageTransitionName, getReloadCounter, hasPendingIslands, hydrateIsland, hydrateIslands, includePageCache, initCachedViewsFromRoutes, invalidateData, invalidatePageCache, isActiveRoute, isCacheEnabled, isPageCached, isPageExcluded, isReloading, mergeAppConfig, reloadPage, resetNamedPageWrappers, resetRouteCache, resolveRoute, scheduleIslandHydration, setDefaultFetch, setPageTransition, supportsViewTransitions, ubeanVue, useAsyncData, useCacheViews, useData, useFetch, useUnheadHead as useHead, usePage, usePageTransition, useReloadSignal, useSeoMeta, useViewTransition, useViewTransitionState, withViewTransition };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as createUbeanRouter, S as definePage, _ as useSeoMeta, b as defineMeta, h as createUbeanSSRApp, m as createUbeanClientApp, r as Head, v as useUnheadHead, w as usePage, x as defineMiddleware } from "./app-COSjPzyK.js";
|
|
2
2
|
import { a as getI18nRuntimeConfig, c as installUbeanI18n, d as switchLocalePath, f as useLocaleHead, h as useSwitchLocalePath, i as extractLocaleFromPath, l as localizePath, m as useLocaleRoute, n as configureI18nRuntime, o as getLocale, p as useLocalePath, r as createUbeanI18n, s as initClientI18n, u as setLocale } from "./i18n-CAeXKTpy.js";
|
|
3
3
|
import { applyAppConfig, createDefaultAppConfig, defineApp, mergeAppConfig } from "./define-app.js";
|
|
4
4
|
import { computed, getCurrentInstance, markRaw, onMounted, onScopeDispose, onUnmounted, ref, shallowRef, watch } from "vue";
|
|
5
|
-
import { ERROR_KEY, ErrorBoundary, LAYOUT_CHAIN_KEY, LOADING_KEY, LOCALIZE_PATH_KEY, LayoutChainRenderer, Link, PAGE_KEY, PageView, SSR_KEY, SlotView, TRANSITION_KEY, clearPageTransition, disablePageCache, enablePageCache, excludePageCache, getCacheEnabled, getCachedViewNames, getExcludedViewNames, getNamedPageWrapper, getNavigationType, getPageTransitionName, getReloadCounter, includePageCache, initCachedViewsFromRoutes, invalidatePageCache, isActiveRoute, isCacheEnabled, isPageCached, isPageExcluded, isReloading, reloadPage, resetNamedPageWrappers, resetRouteCache, resolveRoute, setPageTransition, supportsViewTransitions, ubeanVue, useCacheViews, usePageTransition, useReloadSignal, useViewTransition, useViewTransitionState, withViewTransition } from "@ubean/vue";
|
|
5
|
+
import { ClientOnly, ERROR_KEY, ErrorBoundary, LAYOUT_CHAIN_KEY, LOADING_KEY, LOCALIZE_PATH_KEY, LayoutChainRenderer, Link, PAGE_KEY, PageView, SSR_KEY, SlotView, TRANSITION_KEY, clearPageTransition, disablePageCache, enablePageCache, excludePageCache, getCacheEnabled, getCachedViewNames, getExcludedViewNames, getNamedPageWrapper, getNavigationType, getPageTransitionName, getReloadCounter, includePageCache, initCachedViewsFromRoutes, invalidatePageCache, isActiveRoute, isCacheEnabled, isPageCached, isPageExcluded, isReloading, reloadPage, resetNamedPageWrappers, resetRouteCache, resolveRoute, setPageTransition, supportsViewTransitions, ubeanVue, useCacheViews, usePageTransition, useReloadSignal, useViewTransition, useViewTransitionState, withViewTransition } from "@ubean/vue";
|
|
6
6
|
import { injectHead } from "@unhead/vue";
|
|
7
7
|
import { createHead as createClientHead } from "@unhead/vue/client";
|
|
8
8
|
import { defineDataKey as defineDataKey$1, invalidateData, setDefaultFetch, useAsyncData, useData, useFetch } from "@ubean/pages";
|
|
@@ -1021,4 +1021,4 @@ function _setPagefindMock(mock) {
|
|
|
1021
1021
|
pagefindPromise = Promise.resolve(mock);
|
|
1022
1022
|
}
|
|
1023
1023
|
//#endregion
|
|
1024
|
-
export { ERROR_KEY, ErrorBoundary, Head, LAYOUT_CHAIN_KEY, LOADING_KEY, LOCALIZE_PATH_KEY, LayoutChainRenderer, Link, PAGE_KEY, PageView, SSR_KEY, SlotView, TRANSITION_KEY, _resetColorMode, _resetPartyTown, _resetSearch, _setPagefindMock, applyAppConfig, clearCache, clearPageTransition, collectIslands, configureColorMode, configureI18nRuntime, configurePartyTown, configureSearch, createClientHead, createDataCacheStore, createDefaultAppConfig, createLinkHandler, createUbeanClientApp, createUbeanI18n, createUbeanRouter, createUbeanSSRApp, createUseAsyncData, defineApp, defineDataKey, defineMeta, defineMiddleware, definePage, disablePageCache, enablePageCache, excludePageCache, executeSearch, extractLocaleFromPath, extractPageData, forceColorMode, getCacheEnabled, getCachedViewNames, getColorModeConfig, getColorModeScript, getExcludedViewNames, getI18nRuntimeConfig, getInitialPageData, getInitialState, getInvalidatedKeysForAction, getLocale, getNamedPageWrapper, getNavigationType, getPageTransitionName, getPartyTownConfig, getPartyTownHeadContent, getPartyTownScript, getReloadCounter, getSearchConfig, hasPendingIslands, hydrateIsland, hydrateIslands, includePageCache, initCachedViewsFromRoutes, initClientI18n, initPagefind, installUbeanI18n, invalidateCache, invalidateData, invalidatePageCache, isActiveRoute, isCacheEnabled, isPageCached, isPageExcluded, isPagefindLoaded, isPartyTownEnabled, isReloading, localizePath, mergeAppConfig, reloadPage, resetNamedPageWrappers, resetRouteCache, resolveColorModeConfig, resolvePartyTownConfig, resolveRoute, resolveSearchConfig, scheduleIslandHydration, setDefaultFetch, setLocale, setPageTransition, supportsViewTransitions, switchLocalePath, ubeanVue, unforceColorMode, useAsyncData, useCacheViews, useColorMode, useData, useFetch, useUnheadHead as useHead, useHeadInstance, useLocaleHead, useLocalePath, useLocaleRoute, usePage, usePageTransition, useReloadSignal, useScript, useSearch, useSeoMeta, useServerData, useSwitchLocalePath, useViewTransition, useViewTransitionState, withViewTransition };
|
|
1024
|
+
export { ClientOnly, ERROR_KEY, ErrorBoundary, Head, LAYOUT_CHAIN_KEY, LOADING_KEY, LOCALIZE_PATH_KEY, LayoutChainRenderer, Link, PAGE_KEY, PageView, SSR_KEY, SlotView, TRANSITION_KEY, _resetColorMode, _resetPartyTown, _resetSearch, _setPagefindMock, applyAppConfig, clearCache, clearPageTransition, collectIslands, configureColorMode, configureI18nRuntime, configurePartyTown, configureSearch, createClientHead, createDataCacheStore, createDefaultAppConfig, createLinkHandler, createUbeanClientApp, createUbeanI18n, createUbeanRouter, createUbeanSSRApp, createUseAsyncData, defineApp, defineDataKey, defineMeta, defineMiddleware, definePage, disablePageCache, enablePageCache, excludePageCache, executeSearch, extractLocaleFromPath, extractPageData, forceColorMode, getCacheEnabled, getCachedViewNames, getColorModeConfig, getColorModeScript, getExcludedViewNames, getI18nRuntimeConfig, getInitialPageData, getInitialState, getInvalidatedKeysForAction, getLocale, getNamedPageWrapper, getNavigationType, getPageTransitionName, getPartyTownConfig, getPartyTownHeadContent, getPartyTownScript, getReloadCounter, getSearchConfig, hasPendingIslands, hydrateIsland, hydrateIslands, includePageCache, initCachedViewsFromRoutes, initClientI18n, initPagefind, installUbeanI18n, invalidateCache, invalidateData, invalidatePageCache, isActiveRoute, isCacheEnabled, isPageCached, isPageExcluded, isPagefindLoaded, isPartyTownEnabled, isReloading, localizePath, mergeAppConfig, reloadPage, resetNamedPageWrappers, resetRouteCache, resolveColorModeConfig, resolvePartyTownConfig, resolveRoute, resolveSearchConfig, scheduleIslandHydration, setDefaultFetch, setLocale, setPageTransition, supportsViewTransitions, switchLocalePath, ubeanVue, unforceColorMode, useAsyncData, useCacheViews, useColorMode, useData, useFetch, useUnheadHead as useHead, useHeadInstance, useLocaleHead, useLocalePath, useLocaleRoute, usePage, usePageTransition, useReloadSignal, useScript, useSearch, useSeoMeta, useServerData, useSwitchLocalePath, useViewTransition, useViewTransitionState, withViewTransition };
|
package/dist/server.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { A as createUbeanRouter, C as useViewTransition, D as UbeanVuePage, E as definePage, O as usePage, S as useUnheadHead, T as defineMiddleware, _ as UbeanVueOptions, a as LOADING_KEY, b as ubeanVue, c as LayoutChainRenderer, d as PageView, f as SSR_KEY, g as UbeanAppOptions, h as UbeanAppInstance, i as LAYOUT_CHAIN_KEY, k as CreateUbeanRouterOptions, l as Link, m as TRANSITION_KEY, n as ERROR_KEY, o as LOCALIZE_PATH_KEY, p as SlotView, r as Head, s as LayoutChainContext, t as ClientOnly, u as PAGE_KEY, v as createUbeanClientApp, w as defineMeta, x as useSeoMeta, y as createUbeanSSRApp } from "./app-Busq_M7n.js";
|
|
2
2
|
import { createHead as createServerHead } from "@unhead/vue/server";
|
|
3
|
-
export { type CreateUbeanRouterOptions, ERROR_KEY, Head, LAYOUT_CHAIN_KEY, LOADING_KEY, LOCALIZE_PATH_KEY, type LayoutChainContext, LayoutChainRenderer, Link, PAGE_KEY, PageView, SSR_KEY, SlotView, TRANSITION_KEY, UbeanAppInstance, UbeanAppOptions, type UbeanVueOptions, type UbeanVuePage, createServerHead, createUbeanClientApp, createUbeanRouter, createUbeanSSRApp, defineMeta, defineMiddleware, definePage, ubeanVue, useUnheadHead as useHead, usePage, useSeoMeta, useViewTransition };
|
|
3
|
+
export { ClientOnly, type CreateUbeanRouterOptions, ERROR_KEY, Head, LAYOUT_CHAIN_KEY, LOADING_KEY, LOCALIZE_PATH_KEY, type LayoutChainContext, LayoutChainRenderer, Link, PAGE_KEY, PageView, SSR_KEY, SlotView, TRANSITION_KEY, UbeanAppInstance, UbeanAppOptions, type UbeanVueOptions, type UbeanVuePage, createServerHead, createUbeanClientApp, createUbeanRouter, createUbeanSSRApp, defineMeta, defineMiddleware, definePage, ubeanVue, useUnheadHead as useHead, usePage, useSeoMeta, useViewTransition };
|
package/dist/server.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as createUbeanRouter, S as definePage, _ as useSeoMeta, a as LOADING_KEY, b as defineMeta, c as Link, d as SSR_KEY, f as SlotView, g as ubeanVue, h as createUbeanSSRApp, i as LAYOUT_CHAIN_KEY, l as PAGE_KEY, m as createUbeanClientApp, n as ERROR_KEY, o as LOCALIZE_PATH_KEY, p as TRANSITION_KEY, r as Head, s as LayoutChainRenderer, t as ClientOnly, u as PageView, v as useUnheadHead, w as usePage, x as defineMiddleware, y as useViewTransition } from "./app-COSjPzyK.js";
|
|
2
2
|
import { createHead as createServerHead } from "@unhead/vue/server";
|
|
3
|
-
export { ERROR_KEY, Head, LAYOUT_CHAIN_KEY, LOADING_KEY, LOCALIZE_PATH_KEY, LayoutChainRenderer, Link, PAGE_KEY, PageView, SSR_KEY, SlotView, TRANSITION_KEY, createServerHead, createUbeanClientApp, createUbeanRouter, createUbeanSSRApp, defineMeta, defineMiddleware, definePage, ubeanVue, useUnheadHead as useHead, usePage, useSeoMeta, useViewTransition };
|
|
3
|
+
export { ClientOnly, ERROR_KEY, Head, LAYOUT_CHAIN_KEY, LOADING_KEY, LOCALIZE_PATH_KEY, LayoutChainRenderer, Link, PAGE_KEY, PageView, SSR_KEY, SlotView, TRANSITION_KEY, createServerHead, createUbeanClientApp, createUbeanRouter, createUbeanSSRApp, defineMeta, defineMiddleware, definePage, ubeanVue, useUnheadHead as useHead, usePage, useSeoMeta, useViewTransition };
|
package/dist/ssr.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ResolvedAppConfig } from "./define-app.js";
|
|
1
|
+
import { r as ResolvedAppConfig } from "./define-app-RzHOZlYB.js";
|
|
2
2
|
import { Component } from "vue";
|
|
3
3
|
import { RouteRecordRaw } from "vue-router";
|
|
4
4
|
import { PageRenderer } from "@ubean/pages";
|
|
5
5
|
//#region src/ssr.d.ts
|
|
6
|
-
interface VueRendererSimpleOptions {
|
|
6
|
+
export interface VueRendererSimpleOptions {
|
|
7
7
|
resolvePageComponent: (path: string) => Promise<Component | null>;
|
|
8
8
|
resolveLayoutComponent: (name: string | false | null | undefined) => Promise<Component | null>;
|
|
9
9
|
defaultLayout?: string | null;
|
|
@@ -14,7 +14,7 @@ interface VueRendererSimpleOptions {
|
|
|
14
14
|
*/
|
|
15
15
|
resolveAppConfig?: () => ResolvedAppConfig | Promise<ResolvedAppConfig>;
|
|
16
16
|
}
|
|
17
|
-
interface VueRendererRouterOptions {
|
|
17
|
+
export interface VueRendererRouterOptions {
|
|
18
18
|
routes: RouteRecordRaw[];
|
|
19
19
|
resolveLayoutComponent: (name: string | false | null | undefined) => Promise<Component | null>;
|
|
20
20
|
defaultLayout?: string | null;
|
|
@@ -25,7 +25,6 @@ interface VueRendererRouterOptions {
|
|
|
25
25
|
*/
|
|
26
26
|
resolveAppConfig?: () => ResolvedAppConfig | Promise<ResolvedAppConfig>;
|
|
27
27
|
}
|
|
28
|
-
type VueRendererOptions = VueRendererSimpleOptions | VueRendererRouterOptions;
|
|
29
|
-
declare function createVueRenderer(options: VueRendererOptions): PageRenderer;
|
|
30
|
-
//#endregion
|
|
31
|
-
export { VueRendererOptions, VueRendererRouterOptions, VueRendererSimpleOptions, createVueRenderer };
|
|
28
|
+
export type VueRendererOptions = VueRendererSimpleOptions | VueRendererRouterOptions;
|
|
29
|
+
export declare function createVueRenderer(options: VueRendererOptions): PageRenderer;
|
|
30
|
+
//#endregion
|
package/dist/ssr.js
CHANGED
|
@@ -124,6 +124,7 @@ async function prepareRender(options, pageObj, renderContext) {
|
|
|
124
124
|
defaultLayout: options.defaultLayout,
|
|
125
125
|
head,
|
|
126
126
|
i18n,
|
|
127
|
+
router: appConfig?.router,
|
|
127
128
|
appRoot: appConfig?.appRoot
|
|
128
129
|
});
|
|
129
130
|
if (appConfig) await applyServerAppConfig(createdApp, appConfig);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ubean/client",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "Framework client runtime for ubean — layered over the lean @ubean/vue kernel, adding app factories, unhead, i18n, data layer, islands hydration and SSR state helpers",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@ubean/i18n": "0.4.
|
|
36
|
-
"@ubean/islands": "0.4.
|
|
37
|
-
"@ubean/pages": "0.4.
|
|
38
|
-
"@ubean/shared": "0.4.
|
|
39
|
-
"@ubean/vue": "0.4.
|
|
35
|
+
"@ubean/i18n": "0.4.6",
|
|
36
|
+
"@ubean/islands": "0.4.6",
|
|
37
|
+
"@ubean/pages": "0.4.6",
|
|
38
|
+
"@ubean/shared": "0.4.6",
|
|
39
|
+
"@ubean/vue": "0.4.6",
|
|
40
40
|
"@unhead/vue": "^3.4.0",
|
|
41
41
|
"@vue/server-renderer": "^3.5.42",
|
|
42
42
|
"vue": "^3.5.42",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/node": "^26.5.0",
|
|
48
|
-
"typescript": "
|
|
49
|
-
"vite-plus": "0.3.
|
|
48
|
+
"typescript": "npm:typescript-native-bridge@latest",
|
|
49
|
+
"vite-plus": "0.3.1"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@ubean/seo": "0.4.
|
|
52
|
+
"@ubean/seo": "0.4.6"
|
|
53
53
|
},
|
|
54
54
|
"peerDependenciesMeta": {
|
|
55
55
|
"@ubean/seo": {
|