@ubean/client 0.3.7 → 0.4.1
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-CsoTBXV5.d.ts → app-BQgi-8Qp.d.ts} +14 -2
- package/dist/{app-BU6ZpitN.js → app-DiXW_14_.js} +11 -7
- package/dist/app.d.ts +2 -2
- package/dist/app.js +2 -2
- package/dist/define-app.d.ts +30 -0
- package/dist/define-app.js +2 -0
- package/dist/{i18n-t0G3VyBs.js → i18n-CAeXKTpy.js} +5 -12
- package/dist/index.d.ts +4 -7
- package/dist/index.js +7 -8
- package/dist/server.d.ts +2 -2
- package/dist/server.js +2 -2
- package/dist/ssr.d.ts +1 -2
- package/dist/ssr.js +6 -5
- package/package.json +9 -9
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { App, Component } from "vue";
|
|
2
|
-
import { RouteRecordRaw, Router
|
|
2
|
+
import { RouteRecordRaw, Router } from "vue-router";
|
|
3
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";
|
|
4
4
|
import { VueHeadClient, useHead as useUnheadHead, useSeoMeta } from "@unhead/vue";
|
|
5
5
|
import { PageObject } from "@ubean/pages";
|
|
@@ -84,6 +84,18 @@ interface UbeanAppOptions {
|
|
|
84
84
|
* 通过 Vue 的 `errorCaptured` 生命周期实现错误边界。
|
|
85
85
|
*/
|
|
86
86
|
errorComponent?: Component | (() => Component);
|
|
87
|
+
/**
|
|
88
|
+
* 应用根组件(包装组件,可选)—— 经典 Vue `App.vue` / Nuxt `app.vue` 的
|
|
89
|
+
* 编程式等价物。
|
|
90
|
+
*
|
|
91
|
+
* 组件包裹在框架根组件(`UbeanAppRoot`)之上,框架出口(布局链 + 页面)
|
|
92
|
+
* 通过**默认 slot** 注入,组件内用 `<slot />` 声明渲染位置。适合放置
|
|
93
|
+
* 必须在布局之上的全局内容(ConfigProvider/主题上下文/全局错误边界)。
|
|
94
|
+
*
|
|
95
|
+
* 优先级:`defineApp({ appRoot })` > `src/app.vue`(小写优先)> `src/App.vue`
|
|
96
|
+
* (后两者在 `virtual:ubean-app` 中 resolve 成 loader 传入)。
|
|
97
|
+
*/
|
|
98
|
+
appRoot?: Component | (() => Component);
|
|
87
99
|
/**
|
|
88
100
|
* vue-i18n instance (`legacy: false`). Created by `createUbeanI18n`.
|
|
89
101
|
* Installed with `app.use(i18n)` before the router.
|
|
@@ -112,4 +124,4 @@ declare function createUbeanSSRApp(initialPage: PageObject, options: Omit<UbeanA
|
|
|
112
124
|
};
|
|
113
125
|
declare const Head: import("vue").DefineComponent;
|
|
114
126
|
//#endregion
|
|
115
|
-
export {
|
|
127
|
+
export { defineMeta as C, usePage as D, UbeanVuePage as E, CreateUbeanRouterOptions as O, useViewTransition as S, definePage as T, createUbeanClientApp as _, LOCALIZE_PATH_KEY$1 as a, useSeoMeta as b, Link as c, SSR_KEY$1 as d, SlotView as f, UbeanVueOptions as g, UbeanAppOptions as h, LOADING_KEY$1 as i, createUbeanRouter as k, PAGE_KEY$1 as l, UbeanAppInstance as m, Head as n, LayoutChainContext as o, TRANSITION_KEY$1 as p, LAYOUT_CHAIN_KEY as r, LayoutChainRenderer$1 as s, ERROR_KEY$1 as t, PageView as u, createUbeanSSRApp as v, defineMiddleware as w, useUnheadHead as x, ubeanVue as y };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as getI18nRuntimeConfig, l as localizePath, r as createUbeanI18n, s as initClientI18n, t as bindI18nRuntime } from "./i18n-
|
|
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
|
-
import { createMemoryHistory, createRouter, createWebHistory, useRoute
|
|
3
|
+
import { createMemoryHistory, createRouter, createWebHistory, useRoute } from "vue-router";
|
|
4
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";
|
|
5
5
|
import { useHead as useUnheadHead, useSeoMeta } from "@unhead/vue";
|
|
6
6
|
import { vClient } from "@ubean/islands/directive";
|
|
@@ -152,7 +152,7 @@ function resolveComp(comp) {
|
|
|
152
152
|
}
|
|
153
153
|
return markRaw(comp);
|
|
154
154
|
}
|
|
155
|
-
function createRootComponent(LayoutWrapper, page, transitionOpts, isSSR, loadingComponent, errorComponent) {
|
|
155
|
+
function createRootComponent(LayoutWrapper, page, transitionOpts, isSSR, loadingComponent, errorComponent, appRootComponent) {
|
|
156
156
|
return defineComponent({
|
|
157
157
|
name: isSSR ? "UbeanSSRApp" : "UbeanAppRoot",
|
|
158
158
|
setup() {
|
|
@@ -162,7 +162,11 @@ function createRootComponent(LayoutWrapper, page, transitionOpts, isSSR, loading
|
|
|
162
162
|
provide(LOADING_KEY, loadingComponent ?? null);
|
|
163
163
|
provide(ERROR_KEY, errorComponent ?? null);
|
|
164
164
|
provide(LOCALIZE_PATH_KEY, (path, locale) => localizePath(path, locale));
|
|
165
|
-
return () =>
|
|
165
|
+
return () => {
|
|
166
|
+
const outlet = h(LayoutWrapper);
|
|
167
|
+
if (!appRootComponent) return outlet;
|
|
168
|
+
return h(appRootComponent, null, { default: () => outlet });
|
|
169
|
+
};
|
|
166
170
|
}
|
|
167
171
|
});
|
|
168
172
|
}
|
|
@@ -185,7 +189,7 @@ function createUbeanClientApp(options) {
|
|
|
185
189
|
});
|
|
186
190
|
const { LayoutView: ClientLayoutWrapper, loadLayoutsForRoute: loadClientLayouts } = createLayoutWrapper(options.resolveLayoutComponent, options.defaultLayout || null);
|
|
187
191
|
initCachedViewsFromRoutes(options.routes);
|
|
188
|
-
const RootComponent = createRootComponent(ClientLayoutWrapper, page, transitionOpts, false, resolveComp(options.loadingComponent), resolveComp(options.errorComponent));
|
|
192
|
+
const RootComponent = createRootComponent(ClientLayoutWrapper, page, transitionOpts, false, resolveComp(options.loadingComponent), resolveComp(options.errorComponent), resolveComp(options.appRoot));
|
|
189
193
|
const app = options.hydrate ? createSSRApp(RootComponent) : createApp(RootComponent);
|
|
190
194
|
const i18n = options.i18n ?? createUbeanI18n();
|
|
191
195
|
app.use(i18n);
|
|
@@ -223,7 +227,7 @@ function createUbeanSSRApp(initialPage, options) {
|
|
|
223
227
|
});
|
|
224
228
|
const { LayoutView: SsrLayoutWrapper, loadLayoutsForRoute: loadSsrLayouts } = createLayoutWrapper(options.resolveLayoutComponent, options.defaultLayout || null);
|
|
225
229
|
initCachedViewsFromRoutes(options.routes);
|
|
226
|
-
const RootComponent = createRootComponent(SsrLayoutWrapper, page, { enabled: false }, true, resolveComp(options.loadingComponent), resolveComp(options.errorComponent));
|
|
230
|
+
const RootComponent = createRootComponent(SsrLayoutWrapper, page, { enabled: false }, true, resolveComp(options.loadingComponent), resolveComp(options.errorComponent), resolveComp(options.appRoot));
|
|
227
231
|
const app = createSSRApp(RootComponent);
|
|
228
232
|
const i18n = options.i18n ?? createUbeanI18n();
|
|
229
233
|
app.use(i18n);
|
|
@@ -249,4 +253,4 @@ function createUbeanSSRApp(initialPage, options) {
|
|
|
249
253
|
}
|
|
250
254
|
const Head$1 = Head;
|
|
251
255
|
//#endregion
|
|
252
|
-
export {
|
|
256
|
+
export { usePage as C, createUbeanRouter as S, useUnheadHead as _, LOCALIZE_PATH_KEY$1 as a, defineMiddleware as b, PAGE_KEY$1 as c, SlotView as d, TRANSITION_KEY$1 as f, useSeoMeta as g, ubeanVue as h, LOADING_KEY$1 as i, PageView as l, createUbeanSSRApp as m, Head$1 as n, LayoutChainRenderer$1 as o, createUbeanClientApp as p, LAYOUT_CHAIN_KEY as r, Link as s, ERROR_KEY$1 as t, SSR_KEY$1 as u, useViewTransition as v, definePage as x, defineMeta as y };
|
package/dist/app.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
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,
|
|
1
|
+
import { C as defineMeta, D as usePage, E as UbeanVuePage, O as CreateUbeanRouterOptions, S as useViewTransition, T as definePage, _ as createUbeanClientApp, a as LOCALIZE_PATH_KEY, b as useSeoMeta, c as Link, d as SSR_KEY, f as SlotView, g as UbeanVueOptions, h as UbeanAppOptions, i as LOADING_KEY, k as createUbeanRouter, l as PAGE_KEY, m as UbeanAppInstance, n as Head, o as LayoutChainContext, p as TRANSITION_KEY, r as LAYOUT_CHAIN_KEY, s as LayoutChainRenderer, t as ERROR_KEY, u as PageView, v as createUbeanSSRApp, w as defineMiddleware, x as useUnheadHead, y as ubeanVue } from "./app-BQgi-8Qp.js";
|
|
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 };
|
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,
|
|
1
|
+
import { C as usePage, S as createUbeanRouter, _ as useUnheadHead, a as LOCALIZE_PATH_KEY, b as defineMiddleware, c as PAGE_KEY, d as SlotView, f as TRANSITION_KEY, g as useSeoMeta, h as ubeanVue, i as LOADING_KEY, l as PageView, m as createUbeanSSRApp, n as Head, o as LayoutChainRenderer, p as createUbeanClientApp, r as LAYOUT_CHAIN_KEY, s as Link, t as ERROR_KEY, u as SSR_KEY, v as useViewTransition, x as definePage, y as defineMeta } from "./app-DiXW_14_.js";
|
|
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 };
|
package/dist/define-app.d.ts
CHANGED
|
@@ -50,6 +50,32 @@ interface DefineAppOptions {
|
|
|
50
50
|
head?: PageHead;
|
|
51
51
|
rootId?: string;
|
|
52
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;
|
|
53
79
|
/**
|
|
54
80
|
* 路由钩子配置,用于注册 vue-router 的导航守卫。
|
|
55
81
|
* 在 Client 和 SSR 都会执行。
|
|
@@ -112,6 +138,10 @@ interface ResolvedAppConfig {
|
|
|
112
138
|
head?: PageHead;
|
|
113
139
|
rootId: string;
|
|
114
140
|
rootAttrs: Record<string, string>;
|
|
141
|
+
/**
|
|
142
|
+
* 应用根组件(包装组件,可选)。语义见 `DefineAppOptions.appRoot`。
|
|
143
|
+
*/
|
|
144
|
+
appRoot?: Component;
|
|
115
145
|
router?: RouterConfig;
|
|
116
146
|
onAppCreated?: (app: App) => void | Promise<void>;
|
|
117
147
|
onClientReady?: (app: App) => void | Promise<void>;
|
package/dist/define-app.js
CHANGED
|
@@ -17,6 +17,7 @@ function defineApp(options) {
|
|
|
17
17
|
head: options.head,
|
|
18
18
|
rootId: options.rootId || "app",
|
|
19
19
|
rootAttrs: options.rootAttrs || {},
|
|
20
|
+
appRoot: options.appRoot,
|
|
20
21
|
router: options.router,
|
|
21
22
|
onAppCreated: options.onAppCreated,
|
|
22
23
|
onClientReady: options.onClientReady,
|
|
@@ -79,6 +80,7 @@ function mergeAppConfig(base, ...configs) {
|
|
|
79
80
|
if (cfg.onClientReady) result.onClientReady = cfg.onClientReady;
|
|
80
81
|
if (cfg.errorComponent) result.errorComponent = cfg.errorComponent;
|
|
81
82
|
if (cfg.loadingComponent) result.loadingComponent = cfg.loadingComponent;
|
|
83
|
+
if (cfg.appRoot) result.appRoot = cfg.appRoot;
|
|
82
84
|
if (cfg.viewTransitions !== void 0) result.viewTransitions = cfg.viewTransitions;
|
|
83
85
|
if (cfg.serializeState) result.serializeState = cfg.serializeState;
|
|
84
86
|
if (cfg.hydrateState) result.hydrateState = cfg.hydrateState;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { computed } from "vue";
|
|
2
2
|
import { useRoute } from "vue-router";
|
|
3
3
|
import { LOCALE_DATA_ID } from "@ubean/pages";
|
|
4
|
-
import { createI18n, useI18n
|
|
4
|
+
import { createI18n, useI18n } from "vue-i18n";
|
|
5
5
|
import { buildLocaleHead, extractLocaleFromPath, localizePath, switchLocalePath } from "@ubean/i18n/browser";
|
|
6
6
|
//#region src/i18n.ts
|
|
7
7
|
const RUNTIME_KEY = "__UBEAN_I18N_RUNTIME__";
|
|
@@ -133,7 +133,7 @@ async function setLocale(code) {
|
|
|
133
133
|
}
|
|
134
134
|
function getLocale() {
|
|
135
135
|
try {
|
|
136
|
-
return String(
|
|
136
|
+
return String(useI18n().locale.value);
|
|
137
137
|
} catch {
|
|
138
138
|
return getRuntimeConfigState()?.defaultLocale || "en";
|
|
139
139
|
}
|
|
@@ -153,15 +153,8 @@ function extractLocaleFromPath$1(path) {
|
|
|
153
153
|
const codes = getRuntimeConfigState()?.locales || [];
|
|
154
154
|
return extractLocaleFromPath(path, codes);
|
|
155
155
|
}
|
|
156
|
-
function useI18n() {
|
|
157
|
-
return useVueI18n();
|
|
158
|
-
}
|
|
159
|
-
function t(key, ...args) {
|
|
160
|
-
const translate = useVueI18n().t;
|
|
161
|
-
return String(translate(key, ...args));
|
|
162
|
-
}
|
|
163
156
|
function useLocalePath() {
|
|
164
|
-
const i18n =
|
|
157
|
+
const i18n = useI18n();
|
|
165
158
|
return (path, locale) => localizePath$1(path, locale ?? String(i18n.locale.value));
|
|
166
159
|
}
|
|
167
160
|
function useSwitchLocalePath() {
|
|
@@ -172,7 +165,7 @@ function useLocaleRoute() {
|
|
|
172
165
|
return useLocalePath();
|
|
173
166
|
}
|
|
174
167
|
function useLocaleHead() {
|
|
175
|
-
const i18n =
|
|
168
|
+
const i18n = useI18n();
|
|
176
169
|
const route = useRoute();
|
|
177
170
|
return computed(() => {
|
|
178
171
|
const cfg = getRuntimeConfigState();
|
|
@@ -203,4 +196,4 @@ function initClientI18n() {
|
|
|
203
196
|
applyHydratedPayload(hydrated);
|
|
204
197
|
}
|
|
205
198
|
//#endregion
|
|
206
|
-
export {
|
|
199
|
+
export { getI18nRuntimeConfig as a, installUbeanI18n as c, switchLocalePath$1 as d, useLocaleHead as f, useSwitchLocalePath as h, extractLocaleFromPath$1 as i, localizePath$1 as l, useLocaleRoute as m, configureI18nRuntime as n, getLocale as o, useLocalePath as p, createUbeanI18n as r, initClientI18n as s, bindI18nRuntime as t, setLocale as u };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as defineMeta, D as usePage, E as UbeanVuePage, O as CreateUbeanRouterOptions, T as definePage, _ as createUbeanClientApp, b as useSeoMeta, h as UbeanAppOptions, k as createUbeanRouter, m as UbeanAppInstance, n as Head, v as createUbeanSSRApp, w as defineMiddleware, x as useUnheadHead } from "./app-BQgi-8Qp.js";
|
|
2
2
|
import { AppPluginConfig, DefineAppOptions, ResolvedAppConfig, applyAppConfig, createDefaultAppConfig, defineApp, mergeAppConfig } from "./define-app.js";
|
|
3
3
|
import { App, ComputedRef, Ref, ShallowRef } from "vue";
|
|
4
|
-
import
|
|
4
|
+
import "vue-router";
|
|
5
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";
|
|
6
|
-
import { VueHeadClient, injectHead } from "@unhead/vue";
|
|
7
6
|
import { createHead as createClientHead } from "@unhead/vue/client";
|
|
8
7
|
import { DataResult, PageObject, UseAsyncDataOptions, UseFetchOptions, invalidateData, setDefaultFetch, useAsyncData, useData, useFetch } from "@ubean/pages";
|
|
9
|
-
import {
|
|
8
|
+
import { I18n } from "vue-i18n";
|
|
10
9
|
import { LocaleRoutingConfig, buildLocaleHead } from "@ubean/i18n/browser";
|
|
11
10
|
import { HydrateIslandsOptions, IslandHydrateOptions, IslandHydrationScheduler, IslandRecord, collectIslands, hasPendingIslands, hydrateIsland, hydrateIslands, scheduleIslandHydration } from "@ubean/islands/runtime";
|
|
12
11
|
import { LinkTag, MetaTag, SeoMetadata } from "@ubean/seo";
|
|
@@ -149,8 +148,6 @@ declare function extractLocaleFromPath(path: string): {
|
|
|
149
148
|
locale: string | null;
|
|
150
149
|
pathWithoutLocale: string;
|
|
151
150
|
};
|
|
152
|
-
declare function useI18n(): Composer;
|
|
153
|
-
declare function t(key: string, ...args: unknown[]): string;
|
|
154
151
|
declare function useLocalePath(): (path: string, locale?: string) => string;
|
|
155
152
|
declare function useSwitchLocalePath(): (locale: string) => string;
|
|
156
153
|
declare function useLocaleRoute(): (path: string, locale?: string) => string;
|
|
@@ -509,4 +506,4 @@ declare function _resetSearch(): void;
|
|
|
509
506
|
*/
|
|
510
507
|
declare function _setPagefindMock(mock: any): void;
|
|
511
508
|
//#endregion
|
|
512
|
-
export { type AppPluginConfig, type ColorMode, type ColorModeConfig, type CreateUbeanRouterOptions, type DataCacheStore, type DataResult, type DefineAppOptions, ERROR_KEY, ErrorBoundary, Head, type
|
|
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, _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/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
import {
|
|
1
|
+
import { C as usePage, S as createUbeanRouter, _ as useUnheadHead, b as defineMiddleware, g as useSeoMeta, m as createUbeanSSRApp, n as Head, p as createUbeanClientApp, x as definePage, y as defineMeta } from "./app-DiXW_14_.js";
|
|
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 { useRouter } from "vue-router";
|
|
6
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";
|
|
7
|
-
import { injectHead
|
|
6
|
+
import { injectHead } from "@unhead/vue";
|
|
8
7
|
import { createHead as createClientHead } from "@unhead/vue/client";
|
|
9
8
|
import { defineDataKey as defineDataKey$1, invalidateData, setDefaultFetch, useAsyncData, useData, useFetch } from "@ubean/pages";
|
|
10
9
|
import { collectIslands, hasPendingIslands, hydrateIsland, hydrateIslands, scheduleIslandHydration } from "@ubean/islands/runtime";
|
|
@@ -45,7 +44,7 @@ function getInitialState() {
|
|
|
45
44
|
//#endregion
|
|
46
45
|
//#region src/head.ts
|
|
47
46
|
function useHeadInstance() {
|
|
48
|
-
return injectHead
|
|
47
|
+
return injectHead();
|
|
49
48
|
}
|
|
50
49
|
//#endregion
|
|
51
50
|
//#region src/composables.ts
|
|
@@ -247,7 +246,7 @@ function getInvalidatedKeysForAction(actionName, invalidationMap, store) {
|
|
|
247
246
|
*
|
|
248
247
|
* Usage (composable):
|
|
249
248
|
* ```typescript
|
|
250
|
-
* import { useColorMode } from 'ubean/
|
|
249
|
+
* import { useColorMode } from 'ubean/client';
|
|
251
250
|
*
|
|
252
251
|
* const colorMode = useColorMode();
|
|
253
252
|
* colorMode.value; // 'light' | 'dark' | ...
|
|
@@ -548,7 +547,7 @@ function _resetColorMode() {
|
|
|
548
547
|
*
|
|
549
548
|
* Usage (composable):
|
|
550
549
|
* ```typescript
|
|
551
|
-
* import { useScript } from 'ubean/
|
|
550
|
+
* import { useScript } from 'ubean/client';
|
|
552
551
|
*
|
|
553
552
|
* // Load Google Analytics via Partytown when browser is idle
|
|
554
553
|
* const { load, remove } = useScript('https://www.googletagmanager.com/gtag/js?id=GA_ID', {
|
|
@@ -1022,4 +1021,4 @@ function _setPagefindMock(mock) {
|
|
|
1022
1021
|
pagefindPromise = Promise.resolve(mock);
|
|
1023
1022
|
}
|
|
1024
1023
|
//#endregion
|
|
1025
|
-
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,
|
|
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 };
|
package/dist/server.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as defineMeta, D as usePage, E as UbeanVuePage, O as CreateUbeanRouterOptions, S as useViewTransition, T as definePage, _ as createUbeanClientApp, a as LOCALIZE_PATH_KEY, b as useSeoMeta, c as Link, d as SSR_KEY, f as SlotView, g as UbeanVueOptions, h as UbeanAppOptions, i as LOADING_KEY, k as createUbeanRouter, l as PAGE_KEY, m as UbeanAppInstance, n as Head, o as LayoutChainContext, p as TRANSITION_KEY, r as LAYOUT_CHAIN_KEY, s as LayoutChainRenderer, t as ERROR_KEY, u as PageView, v as createUbeanSSRApp, w as defineMiddleware, x as useUnheadHead, y as ubeanVue } from "./app-BQgi-8Qp.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,
|
|
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 };
|
package/dist/server.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as usePage, S as createUbeanRouter, _ as useUnheadHead, a as LOCALIZE_PATH_KEY, b as defineMiddleware, c as PAGE_KEY, d as SlotView, f as TRANSITION_KEY, g as useSeoMeta, h as ubeanVue, i as LOADING_KEY, l as PageView, m as createUbeanSSRApp, n as Head, o as LayoutChainRenderer, p as createUbeanClientApp, r as LAYOUT_CHAIN_KEY, s as Link, t as ERROR_KEY, u as SSR_KEY, v as useViewTransition, x as definePage, y as defineMeta } from "./app-DiXW_14_.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,
|
|
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 };
|
package/dist/ssr.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { ResolvedAppConfig } from "./define-app.js";
|
|
|
2
2
|
import { Component } from "vue";
|
|
3
3
|
import { RouteRecordRaw } from "vue-router";
|
|
4
4
|
import { PageRenderer } from "@ubean/pages";
|
|
5
|
-
import { renderToString } from "@vue/server-renderer";
|
|
6
5
|
//#region src/ssr.d.ts
|
|
7
6
|
interface VueRendererSimpleOptions {
|
|
8
7
|
resolvePageComponent: (path: string) => Promise<Component | null>;
|
|
@@ -29,4 +28,4 @@ interface VueRendererRouterOptions {
|
|
|
29
28
|
type VueRendererOptions = VueRendererSimpleOptions | VueRendererRouterOptions;
|
|
30
29
|
declare function createVueRenderer(options: VueRendererOptions): PageRenderer;
|
|
31
30
|
//#endregion
|
|
32
|
-
export { VueRendererOptions, VueRendererRouterOptions, VueRendererSimpleOptions, createVueRenderer
|
|
31
|
+
export { VueRendererOptions, VueRendererRouterOptions, VueRendererSimpleOptions, createVueRenderer };
|
package/dist/ssr.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { n as configureI18nRuntime, r as createUbeanI18n } from "./i18n-
|
|
1
|
+
import { n as configureI18nRuntime, r as createUbeanI18n } from "./i18n-CAeXKTpy.js";
|
|
2
2
|
import { applyAppConfig } from "./define-app.js";
|
|
3
3
|
import { createSSRApp, defineComponent, h, provide, reactive } from "vue";
|
|
4
4
|
import { SSR_CONTENT_MARKER, STATE_DATA_ID, STATE_MARKER, __clearDataPayload, __clearDeferred, __resolveDataPayload, __resolveDeferred, __serializeDataPayload, __serializeDeferred, safeJsonStringify } from "@ubean/pages";
|
|
5
5
|
import { buildLocaleHead } from "@ubean/i18n/browser";
|
|
6
6
|
import { createHead, transformHtmlTemplate } from "@unhead/vue/server";
|
|
7
|
-
import { renderToNodeStream, renderToString
|
|
7
|
+
import { renderToNodeStream, renderToString } from "@vue/server-renderer";
|
|
8
8
|
import { getIslandsBootstrapScript } from "@ubean/islands";
|
|
9
9
|
//#region src/ssr.ts
|
|
10
10
|
/**
|
|
@@ -123,7 +123,8 @@ async function prepareRender(options, pageObj, renderContext) {
|
|
|
123
123
|
resolveLayoutComponent: options.resolveLayoutComponent,
|
|
124
124
|
defaultLayout: options.defaultLayout,
|
|
125
125
|
head,
|
|
126
|
-
i18n
|
|
126
|
+
i18n,
|
|
127
|
+
appRoot: appConfig?.appRoot
|
|
127
128
|
});
|
|
128
129
|
if (appConfig) await applyServerAppConfig(createdApp, appConfig);
|
|
129
130
|
await router.isReady();
|
|
@@ -176,7 +177,7 @@ function createVueRenderer(options) {
|
|
|
176
177
|
__clearDeferred();
|
|
177
178
|
__clearDataPayload();
|
|
178
179
|
const { app, head, appConfig } = await prepareRender(options, pageObj, renderContext);
|
|
179
|
-
const appHtml = await renderToString
|
|
180
|
+
const appHtml = await renderToString(app);
|
|
180
181
|
const state = await resolveState(app, appConfig);
|
|
181
182
|
const deferredData = await __resolveDeferred();
|
|
182
183
|
const deferredScript = __serializeDeferred(deferredData);
|
|
@@ -274,4 +275,4 @@ function createVueRenderer(options) {
|
|
|
274
275
|
};
|
|
275
276
|
}
|
|
276
277
|
//#endregion
|
|
277
|
-
export { createVueRenderer
|
|
278
|
+
export { createVueRenderer };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ubean/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
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,24 +32,24 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@ubean/i18n": "0.
|
|
36
|
-
"@ubean/islands": "0.
|
|
37
|
-
"@ubean/pages": "0.
|
|
38
|
-
"@ubean/shared": "0.
|
|
39
|
-
"@ubean/vue": "0.
|
|
35
|
+
"@ubean/i18n": "0.4.1",
|
|
36
|
+
"@ubean/islands": "0.4.1",
|
|
37
|
+
"@ubean/pages": "0.4.1",
|
|
38
|
+
"@ubean/shared": "0.4.1",
|
|
39
|
+
"@ubean/vue": "0.4.1",
|
|
40
40
|
"@unhead/vue": "^3.4.0",
|
|
41
41
|
"@vue/server-renderer": "^3.5.42",
|
|
42
42
|
"vue": "^3.5.42",
|
|
43
43
|
"vue-i18n": "11.4.10",
|
|
44
|
-
"vue-router": "^5.3.
|
|
44
|
+
"vue-router": "^5.3.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@types/node": "^26.4.
|
|
47
|
+
"@types/node": "^26.4.1",
|
|
48
48
|
"typescript": "7.0.2",
|
|
49
49
|
"vite-plus": "0.3.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@ubean/seo": "0.
|
|
52
|
+
"@ubean/seo": "0.4.1"
|
|
53
53
|
},
|
|
54
54
|
"peerDependenciesMeta": {
|
|
55
55
|
"@ubean/seo": {
|