cabloy 5.1.51 → 5.1.53
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/.claude/skills/cabloy-contract-loop/SKILL.md +1 -1
- package/.claude/skills/cabloy-frontend-scaffold/SKILL.md +11 -1
- package/.claude/skills/cabloy-workflow/SKILL.md +8 -4
- package/.claude/skills/cabloy-workflow/references/edition-detection.md +3 -2
- package/.github/workflows/docs-pages.yml +2 -0
- package/CHANGELOG.md +42 -0
- package/CLAUDE.md +7 -4
- package/README.md +36 -21
- package/cabloy-docs/.vitepress/config.mjs +171 -44
- package/cabloy-docs/ai/class-placement-rule.md +1 -0
- package/cabloy-docs/ai/cli-for-agents.md +1 -1
- package/cabloy-docs/ai/docs-skills-rules-mapping.md +1 -0
- package/cabloy-docs/ai/edition-consistency-checklist.md +150 -0
- package/cabloy-docs/ai/edition-detection.md +3 -3
- package/cabloy-docs/ai/global-bean-lookup.md +1 -0
- package/cabloy-docs/ai/introduction.md +47 -3
- package/cabloy-docs/ai/repo-guidance.md +2 -2
- package/cabloy-docs/ai/rules-and-config.md +1 -1
- package/cabloy-docs/ai/skills.md +2 -0
- package/cabloy-docs/ai/verification.md +1 -0
- package/cabloy-docs/ai/virtual-decorator-guidance.md +206 -0
- package/cabloy-docs/backend/introduction.md +2 -2
- package/cabloy-docs/backend/logger-guide.md +1 -1
- package/cabloy-docs/backend/quickstart.md +3 -3
- package/cabloy-docs/editions/cabloy-basic.md +4 -3
- package/cabloy-docs/editions/cabloy-start.md +34 -3
- package/cabloy-docs/editions/choosing-between-basic-and-start.md +84 -0
- package/cabloy-docs/editions/overview.md +114 -20
- package/cabloy-docs/frontend/css-in-js-guide.md +1 -1
- package/cabloy-docs/frontend/environment-config-guide.md +28 -0
- package/cabloy-docs/frontend/foundation.md +3 -2
- package/cabloy-docs/frontend/introduction.md +73 -4
- package/cabloy-docs/frontend/navigation-guards-guide.md +1 -1
- package/cabloy-docs/frontend/quickstart.md +4 -2
- package/cabloy-docs/frontend/scripts.md +2 -2
- package/cabloy-docs/frontend/ssr-env.md +23 -0
- package/cabloy-docs/frontend/theme-guide.md +140 -7
- package/cabloy-docs/fullstack/cli.md +118 -0
- package/cabloy-docs/fullstack/comparison-with-other-frameworks.md +117 -0
- package/cabloy-docs/fullstack/edition-collaboration-differences.md +3 -2
- package/cabloy-docs/fullstack/introduction.md +84 -34
- package/cabloy-docs/fullstack/quickstart.md +7 -4
- package/cabloy-docs/fullstack/vona-zova-integration.md +2 -2
- package/cabloy-docs/fullstack/vscode-extensions.md +126 -0
- package/cabloy-docs/index.md +39 -40
- package/cabloy-docs/reference/frontend-directory-structure.md +125 -0
- package/cabloy-docs/reference/glossary.md +2 -2
- package/cabloy-docs/reference/introduction.md +47 -0
- package/cabloy-docs/reference/package-map.md +2 -0
- package/cabloy-docs/reference/repo-scripts.md +5 -3
- package/package.json +1 -1
- package/vona/README.md +1 -1
- package/vona/pnpm-lock.yaml +383 -38
- package/vona/src/suite-vendor/a-cabloy/modules/a-ssr/package.json +1 -1
- package/vona/src/suite-vendor/a-cabloy/modules/a-ssr/src/.metadata/index.ts +49 -1
- package/vona/src/suite-vendor/a-cabloy/modules/a-ssr/src/controller/memoryDiag.ts +97 -0
- package/vona/src/suite-vendor/a-cabloy/package.json +1 -1
- package/zova/README.md +1 -1
- package/zova/package.original.json +4 -4
- package/zova/packages-cli/cli/package.json +2 -2
- package/zova/packages-cli/cli-set-front/package.json +2 -2
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.tools.metadata.ts +1 -1
- package/zova/packages-cli/cli-set-front/src/lib/bean/toolsMetadata/generateConfig.ts +2 -12
- package/zova/packages-utils/zova-jsx/package.json +2 -2
- package/zova/packages-utils/zova-vite/package.json +2 -2
- package/zova/packages-utils/zova-vite/templates/app/controller.tsx_ +3 -3
- package/zova/packages-zova/zova/package.json +3 -3
- package/zova/packages-zova/zova-core/package.json +2 -2
- package/zova/packages-zova/zova-core/src/bean/beanContainer.ts +3 -3
- package/zova/packages-zova/zova-core/src/bean/beanControllerPageBase.ts +1 -0
- package/zova/packages-zova/zova-core/src/core/component/module.ts +16 -16
- package/zova/packages-zova/zova-core/src/core/context/component.ts +35 -3
- package/zova/packages-zova/zova-core/src/core/context/util.ts +15 -11
- package/zova/packages-zova/zova-core/src/core/sys/config.ts +1 -1
- package/zova/pnpm-lock.yaml +1607 -1690
- package/zova/src/front/config/config/config.ts +1 -1
- package/zova/src/suite/a-demo/modules/demo-basic/src/.metadata/index.ts +11 -0
- package/zova/src/suite/a-demo/modules/demo-basic/src/.metadata/locales.ts +0 -15
- package/zova/src/suite/a-demo/modules/demo-basic/src/.metadata/page/toolMinimal.ts +9 -0
- package/zova/src/suite/a-demo/modules/demo-basic/src/page/toolMinimal/controller.tsx +11 -0
- package/zova/src/suite/a-demo/modules/demo-basic/src/routes.ts +10 -0
- package/zova/src/suite/a-devui/modules/devui-adapter/src/bean/meta.themeHandler.ts +1 -0
- package/zova/src/suite/a-home/modules/home-base/src/.metadata/locales.ts +0 -15
- package/zova/src/suite/a-home/modules/home-base/src/service/routerGuards.ts +1 -1
- package/zova/src/suite/a-home/modules/home-base/src/service/ssrLayout.ts +1 -0
- package/zova/src/suite/a-home/modules/home-layoutadmin/src/.metadata/locales.ts +0 -15
- package/zova/src/suite/a-home/modules/home-layoutweb/src/.metadata/locales.ts +0 -15
- package/zova/src/suite/a-home/modules/home-layoutweb/src/component/layoutWeb/controller.tsx +2 -2
- package/zova/src/suite/a-home/modules/home-login/src/.metadata/locales.ts +0 -15
- package/zova/src/suite/a-home/modules/home-passport/src/model/passport.ts +2 -2
- package/zova/src/suite/cabloy-basic/modules/basic-captcha/src/.metadata/locales.ts +0 -15
- package/zova/src/suite/cabloy-basic/modules/basic-form/src/.metadata/locales.ts +0 -15
- package/zova/src/suite/cabloy-basic/modules/basic-page/src/.metadata/locales.ts +0 -15
- package/zova/src/suite/cabloy-basic/modules/basic-pageentry/src/.metadata/locales.ts +0 -15
- package/zova/src/suite/cabloy-basic/modules/basic-table/src/.metadata/locales.ts +0 -15
- package/zova/src/suite-vendor/a-zova/modules/a-interceptor/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-interceptor/src/bean/interceptor.jwt.ts +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-model/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-model/src/service/storage.ts +4 -5
- package/zova/src/suite-vendor/a-zova/modules/a-openapi/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-openapi/src/monkey.ts +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-ssr/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-ssr/src/lib/ssr.ts +36 -1
- package/zova/src/suite-vendor/a-zova/modules/a-ssr/src/lib/ssrMetaStore.ts +8 -2
- package/zova/src/suite-vendor/a-zova/modules/a-ssr/src/monkey.ts +3 -0
- package/zova/src/suite-vendor/a-zova/modules/a-ssrserver/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-ssrserver/src/service/ssrHandler.ts +70 -29
- package/zova/src/suite-vendor/a-zova/modules/a-style/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-style/src/bean/bean.theme.ts +6 -3
- package/zova/src/suite-vendor/a-zova/modules/a-zod/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-zod/src/.metadata/locales.ts +0 -15
- package/zova/src/suite-vendor/a-zova/modules/a-zova/package.json +2 -2
- package/zova/src/suite-vendor/a-zova/package.json +9 -9
|
@@ -39,7 +39,7 @@ export default function (sys: ZovaSys) {
|
|
|
39
39
|
config.ssr = {
|
|
40
40
|
cookie: env.SSR_COOKIE === 'true',
|
|
41
41
|
withVona: env.SSR_WITH_VONA === 'true',
|
|
42
|
-
|
|
42
|
+
cookieDisabledOnServer: process.env.SERVER && env.SSR_COOKIE === 'false',
|
|
43
43
|
hmr: env.SSR_WITH_VONA === 'true' && env.META_MODE === 'development',
|
|
44
44
|
};
|
|
45
45
|
|
|
@@ -46,6 +46,7 @@ export * from '../page/routeQuery/controller.jsx';
|
|
|
46
46
|
export * from '../page/routeQueryB/controller.jsx';
|
|
47
47
|
export * from '../page/state/controller.jsx';
|
|
48
48
|
export * from '../page/style/controller.jsx';
|
|
49
|
+
export * from '../page/toolMinimal/controller.jsx';
|
|
49
50
|
export * from '../page/toolOne/controller.jsx';
|
|
50
51
|
export * from '../page/toolTwo/controller.jsx';
|
|
51
52
|
|
|
@@ -111,6 +112,11 @@ declare module 'zova-module-demo-basic' {
|
|
|
111
112
|
get scope(): ScopeModuleDemoBasic;
|
|
112
113
|
}
|
|
113
114
|
|
|
115
|
+
export interface ControllerPageToolMinimal {
|
|
116
|
+
/** @internal */
|
|
117
|
+
get scope(): ScopeModuleDemoBasic;
|
|
118
|
+
}
|
|
119
|
+
|
|
114
120
|
export interface ControllerPageToolOne {
|
|
115
121
|
/** @internal */
|
|
116
122
|
get scope(): ScopeModuleDemoBasic;
|
|
@@ -134,6 +140,7 @@ import { ControllerPageRouteQuery } from '../page/routeQuery/controller.jsx';
|
|
|
134
140
|
import { ControllerPageRouteQueryB } from '../page/routeQueryB/controller.jsx';
|
|
135
141
|
import { ControllerPageState } from '../page/state/controller.jsx';
|
|
136
142
|
import { ControllerPageStyle } from '../page/style/controller.jsx';
|
|
143
|
+
import { ControllerPageToolMinimal } from '../page/toolMinimal/controller.jsx';
|
|
137
144
|
import { ControllerPageToolOne } from '../page/toolOne/controller.jsx';
|
|
138
145
|
import { ControllerPageToolTwo } from '../page/toolTwo/controller.jsx';
|
|
139
146
|
import 'zova';
|
|
@@ -150,6 +157,7 @@ declare module 'zova' {
|
|
|
150
157
|
'demo-basic.controller.pageRouteQueryB': ControllerPageRouteQueryB;
|
|
151
158
|
'demo-basic.controller.pageState': ControllerPageState;
|
|
152
159
|
'demo-basic.controller.pageStyle': ControllerPageStyle;
|
|
160
|
+
'demo-basic.controller.pageToolMinimal': ControllerPageToolMinimal;
|
|
153
161
|
'demo-basic.controller.pageToolOne': ControllerPageToolOne;
|
|
154
162
|
'demo-basic.controller.pageToolTwo': ControllerPageToolTwo;
|
|
155
163
|
}
|
|
@@ -166,6 +174,7 @@ export * from './page/routeQueryB.js';
|
|
|
166
174
|
import { NSControllerPageRouteQueryB } from './page/routeQueryB.js';
|
|
167
175
|
export * from './page/state.js';
|
|
168
176
|
export * from './page/style.js';
|
|
177
|
+
export * from './page/toolMinimal.js';
|
|
169
178
|
export * from './page/toolOne.js';
|
|
170
179
|
import { NSControllerPageToolOne } from './page/toolOne.js';
|
|
171
180
|
export * from './page/toolTwo.js';
|
|
@@ -182,11 +191,13 @@ export interface IPagePathRecord {
|
|
|
182
191
|
'/demo/basic/routeQueryB': TypePagePathSchema<NSControllerPageRouteQueryB.ParamsInput,NSControllerPageRouteQueryB.QueryInput>;
|
|
183
192
|
'/demo/basic/state': TypePagePathSchema<undefined,undefined>;
|
|
184
193
|
'/demo/basic/style': TypePagePathSchema<undefined,undefined>;
|
|
194
|
+
'/demo/basic/toolMinimal': TypePagePathSchema<undefined,undefined>;
|
|
185
195
|
'/demo/basic/toolOne/:id?': TypePagePathSchema<NSControllerPageToolOne.ParamsInput,NSControllerPageToolOne.QueryInput>;
|
|
186
196
|
'/demo/basic/toolTwo/:id?': TypePagePathSchema<NSControllerPageToolTwo.ParamsInput,NSControllerPageToolTwo.QueryInput>;
|
|
187
197
|
}
|
|
188
198
|
export interface IPageNameRecord {
|
|
189
199
|
'demo-basic:routeParams': undefined;
|
|
200
|
+
'demo-basic:toolMinimal': undefined;
|
|
190
201
|
'demo-basic:toolOne': undefined;
|
|
191
202
|
'demo-basic:toolTwo': undefined;
|
|
192
203
|
}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import type { TypeLocaleBase } from 'zova';
|
|
2
|
-
|
|
3
|
-
import { useApp, useComputed } from 'zova';
|
|
4
|
-
|
|
5
1
|
import locale_en_us from '../config/locale/en-us.js';
|
|
6
2
|
import locale_zh_cn from '../config/locale/zh-cn.js';
|
|
7
3
|
|
|
@@ -9,14 +5,3 @@ export const locales = {
|
|
|
9
5
|
'en-us': locale_en_us,
|
|
10
6
|
'zh-cn': locale_zh_cn,
|
|
11
7
|
};
|
|
12
|
-
|
|
13
|
-
export function $useLocale<K extends keyof (typeof locales)[TypeLocaleBase]>(
|
|
14
|
-
key: K,
|
|
15
|
-
...args: any[]
|
|
16
|
-
) {
|
|
17
|
-
const app = useApp();
|
|
18
|
-
const str = `demo-basic::${key}`;
|
|
19
|
-
return useComputed(() => {
|
|
20
|
-
return app.meta.text(str, ...args);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BeanControllerPageBase } from 'zova';
|
|
2
|
+
import { Controller } from 'zova-module-a-bean';
|
|
3
|
+
|
|
4
|
+
@Controller()
|
|
5
|
+
export class ControllerPageToolMinimal extends BeanControllerPageBase {
|
|
6
|
+
protected async __init__() {}
|
|
7
|
+
|
|
8
|
+
protected render() {
|
|
9
|
+
return <div>minimal</div>;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -7,6 +7,7 @@ import { ZPageRouteQuery } from './.metadata/page/routeQuery.js';
|
|
|
7
7
|
import { ZPageRouteQueryB } from './.metadata/page/routeQueryB.js';
|
|
8
8
|
import { ZPageState } from './.metadata/page/state.js';
|
|
9
9
|
import { ZPageStyle } from './.metadata/page/style.js';
|
|
10
|
+
import { ZPageToolMinimal } from './.metadata/page/toolMinimal.js';
|
|
10
11
|
import { ZPageToolOne } from './.metadata/page/toolOne.js';
|
|
11
12
|
import { ZPageToolTwo } from './.metadata/page/toolTwo.js';
|
|
12
13
|
|
|
@@ -26,6 +27,15 @@ export const routes: IModuleRoute[] = [
|
|
|
26
27
|
},
|
|
27
28
|
},
|
|
28
29
|
{ path: 'routeQueryB', component: ZPageRouteQueryB, meta: { requiresAuth: false } },
|
|
30
|
+
{
|
|
31
|
+
name: 'toolMinimal',
|
|
32
|
+
path: 'toolMinimal',
|
|
33
|
+
component: ZPageToolMinimal,
|
|
34
|
+
meta: {
|
|
35
|
+
layout: 'empty',
|
|
36
|
+
requiresAuth: false,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
29
39
|
{
|
|
30
40
|
name: 'toolOne',
|
|
31
41
|
path: 'toolOne/:id?',
|
|
@@ -26,6 +26,7 @@ export class MetaThemeHandler extends BeanBase implements IThemeHandler {
|
|
|
26
26
|
} else {
|
|
27
27
|
// server
|
|
28
28
|
if (!this.sys.config.ssr.cookie) {
|
|
29
|
+
// BeanTheme applies twice in SSR Web mode so both dark/light markers are available here.
|
|
29
30
|
this.$useMeta({ bodyAttr: { [`data-ssr-theme-dark-${dark}`]: themeName } });
|
|
30
31
|
} else {
|
|
31
32
|
this.$useMeta({
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import type { TypeLocaleBase } from 'zova';
|
|
2
|
-
|
|
3
|
-
import { useApp, useComputed } from 'zova';
|
|
4
|
-
|
|
5
1
|
import locale_en_us from '../config/locale/en-us.js';
|
|
6
2
|
import locale_zh_cn from '../config/locale/zh-cn.js';
|
|
7
3
|
|
|
@@ -9,14 +5,3 @@ export const locales = {
|
|
|
9
5
|
'en-us': locale_en_us,
|
|
10
6
|
'zh-cn': locale_zh_cn,
|
|
11
7
|
};
|
|
12
|
-
|
|
13
|
-
export function $useLocale<K extends keyof (typeof locales)[TypeLocaleBase]>(
|
|
14
|
-
key: K,
|
|
15
|
-
...args: any[]
|
|
16
|
-
) {
|
|
17
|
-
const app = useApp();
|
|
18
|
-
const str = `home-base::${key}`;
|
|
19
|
-
return useComputed(() => {
|
|
20
|
-
return app.meta.text(str, ...args);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
@@ -15,7 +15,7 @@ export class ServiceRouterGuards extends BeanRouterGuardsBase {
|
|
|
15
15
|
protected onRouterGuards(router: BeanRouter) {
|
|
16
16
|
router.beforeEach(async to => {
|
|
17
17
|
if (
|
|
18
|
-
!this.sys.config.ssr.
|
|
18
|
+
!this.sys.config.ssr.cookieDisabledOnServer &&
|
|
19
19
|
to.meta.requiresAuth !== false &&
|
|
20
20
|
!this.$passport.isAuthenticated
|
|
21
21
|
) {
|
|
@@ -20,6 +20,7 @@ export class ServiceSsrLayout extends BeanBase {
|
|
|
20
20
|
this.ctx.meta.$ssr.context.onRendered((err?: Error) => {
|
|
21
21
|
if (err) return;
|
|
22
22
|
if (!this.sys.config.ssr.cookie) {
|
|
23
|
+
// Apply the final browser-selected theme from the SSR dual markers as early as possible.
|
|
23
24
|
this.ctx.meta.$ssr.context._meta.bodyTags += `<script id="__prefersColorSchemeDarkJS">
|
|
24
25
|
document.body.setAttribute('data-theme', window.ssr_themedark_data);
|
|
25
26
|
if(window.ssr_local_themename==='home-theme:orange'){
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import type { TypeLocaleBase } from 'zova';
|
|
2
|
-
|
|
3
|
-
import { useApp, useComputed } from 'zova';
|
|
4
|
-
|
|
5
1
|
import locale_en_us from '../config/locale/en-us.js';
|
|
6
2
|
import locale_zh_cn from '../config/locale/zh-cn.js';
|
|
7
3
|
|
|
@@ -9,14 +5,3 @@ export const locales = {
|
|
|
9
5
|
'en-us': locale_en_us,
|
|
10
6
|
'zh-cn': locale_zh_cn,
|
|
11
7
|
};
|
|
12
|
-
|
|
13
|
-
export function $useLocale<K extends keyof (typeof locales)[TypeLocaleBase]>(
|
|
14
|
-
key: K,
|
|
15
|
-
...args: any[]
|
|
16
|
-
) {
|
|
17
|
-
const app = useApp();
|
|
18
|
-
const str = `home-layoutadmin::${key}`;
|
|
19
|
-
return useComputed(() => {
|
|
20
|
-
return app.meta.text(str, ...args);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import type { TypeLocaleBase } from 'zova';
|
|
2
|
-
|
|
3
|
-
import { useApp, useComputed } from 'zova';
|
|
4
|
-
|
|
5
1
|
import locale_en_us from '../config/locale/en-us.js';
|
|
6
2
|
import locale_zh_cn from '../config/locale/zh-cn.js';
|
|
7
3
|
|
|
@@ -9,14 +5,3 @@ export const locales = {
|
|
|
9
5
|
'en-us': locale_en_us,
|
|
10
6
|
'zh-cn': locale_zh_cn,
|
|
11
7
|
};
|
|
12
|
-
|
|
13
|
-
export function $useLocale<K extends keyof (typeof locales)[TypeLocaleBase]>(
|
|
14
|
-
key: K,
|
|
15
|
-
...args: any[]
|
|
16
|
-
) {
|
|
17
|
-
const app = useApp();
|
|
18
|
-
const str = `home-layoutweb::${key}`;
|
|
19
|
-
return useComputed(() => {
|
|
20
|
-
return app.meta.text(str, ...args);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BeanControllerBase, Use,
|
|
1
|
+
import { BeanControllerBase, Use, UseScope } from 'zova';
|
|
2
2
|
import { Controller } from 'zova-module-a-bean';
|
|
3
3
|
import { $QueryAutoLoad } from 'zova-module-a-model';
|
|
4
4
|
import { ModelTabs, ModelTabsOptions, RouteTabInitial } from 'zova-module-a-routertabs';
|
|
@@ -37,7 +37,7 @@ export class ControllerLayoutWeb extends BeanControllerBase {
|
|
|
37
37
|
|
|
38
38
|
protected async __init__() {
|
|
39
39
|
// belowBreakpoint
|
|
40
|
-
this.belowBreakpoint =
|
|
40
|
+
this.belowBreakpoint = this.$computed(() => {
|
|
41
41
|
let width;
|
|
42
42
|
if (process.env.SERVER) {
|
|
43
43
|
width = 0;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import type { TypeLocaleBase } from 'zova';
|
|
2
|
-
|
|
3
|
-
import { useApp, useComputed } from 'zova';
|
|
4
|
-
|
|
5
1
|
import locale_en_us from '../config/locale/en-us.js';
|
|
6
2
|
import locale_zh_cn from '../config/locale/zh-cn.js';
|
|
7
3
|
|
|
@@ -9,14 +5,3 @@ export const locales = {
|
|
|
9
5
|
'en-us': locale_en_us,
|
|
10
6
|
'zh-cn': locale_zh_cn,
|
|
11
7
|
};
|
|
12
|
-
|
|
13
|
-
export function $useLocale<K extends keyof (typeof locales)[TypeLocaleBase]>(
|
|
14
|
-
key: K,
|
|
15
|
-
...args: any[]
|
|
16
|
-
) {
|
|
17
|
-
const app = useApp();
|
|
18
|
-
const str = `home-login::${key}`;
|
|
19
|
-
return useComputed(() => {
|
|
20
|
-
return app.meta.text(str, ...args);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
@@ -37,7 +37,7 @@ export class ModelPassport extends BeanModelBase {
|
|
|
37
37
|
: this.$useStateMem({ queryKey: ['passport'] });
|
|
38
38
|
this.jwt = this.$useStateLocal({ queryKey: ['jwt'] });
|
|
39
39
|
this.expireTime = this.$useStateLocal({ queryKey: ['expireTime'] });
|
|
40
|
-
this.accessToken = this.sys.config.ssr.
|
|
40
|
+
this.accessToken = this.sys.config.ssr.cookieDisabledOnServer
|
|
41
41
|
? undefined
|
|
42
42
|
: this.$useStateCookie({ queryKey: ['token'] });
|
|
43
43
|
if (process.env.CLIENT) {
|
|
@@ -153,7 +153,7 @@ export class ModelPassport extends BeanModelBase {
|
|
|
153
153
|
|
|
154
154
|
async ensurePassport() {
|
|
155
155
|
if (process.env.CLIENT) return this.passport;
|
|
156
|
-
if (!this.sys.config.ssr.
|
|
156
|
+
if (!this.sys.config.ssr.cookieDisabledOnServer && !this.isAuthenticated && this.accessToken) {
|
|
157
157
|
this.passport = await this.$api.homeUserPassport.current();
|
|
158
158
|
this._setLocaleTz();
|
|
159
159
|
}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import type { TypeLocaleBase } from 'zova';
|
|
2
|
-
|
|
3
|
-
import { useApp, useComputed } from 'zova';
|
|
4
|
-
|
|
5
1
|
import locale_en_us from '../config/locale/en-us.js';
|
|
6
2
|
import locale_zh_cn from '../config/locale/zh-cn.js';
|
|
7
3
|
|
|
@@ -9,14 +5,3 @@ export const locales = {
|
|
|
9
5
|
'en-us': locale_en_us,
|
|
10
6
|
'zh-cn': locale_zh_cn,
|
|
11
7
|
};
|
|
12
|
-
|
|
13
|
-
export function $useLocale<K extends keyof (typeof locales)[TypeLocaleBase]>(
|
|
14
|
-
key: K,
|
|
15
|
-
...args: any[]
|
|
16
|
-
) {
|
|
17
|
-
const app = useApp();
|
|
18
|
-
const str = `basic-captcha::${key}`;
|
|
19
|
-
return useComputed(() => {
|
|
20
|
-
return app.meta.text(str, ...args);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import type { TypeLocaleBase } from 'zova';
|
|
2
|
-
|
|
3
|
-
import { useApp, useComputed } from 'zova';
|
|
4
|
-
|
|
5
1
|
import locale_en_us from '../config/locale/en-us.js';
|
|
6
2
|
import locale_zh_cn from '../config/locale/zh-cn.js';
|
|
7
3
|
|
|
@@ -9,14 +5,3 @@ export const locales = {
|
|
|
9
5
|
'en-us': locale_en_us,
|
|
10
6
|
'zh-cn': locale_zh_cn,
|
|
11
7
|
};
|
|
12
|
-
|
|
13
|
-
export function $useLocale<K extends keyof (typeof locales)[TypeLocaleBase]>(
|
|
14
|
-
key: K,
|
|
15
|
-
...args: any[]
|
|
16
|
-
) {
|
|
17
|
-
const app = useApp();
|
|
18
|
-
const str = `basic-form::${key}`;
|
|
19
|
-
return useComputed(() => {
|
|
20
|
-
return app.meta.text(str, ...args);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import type { TypeLocaleBase } from 'zova';
|
|
2
|
-
|
|
3
|
-
import { useApp, useComputed } from 'zova';
|
|
4
|
-
|
|
5
1
|
import locale_en_us from '../config/locale/en-us.js';
|
|
6
2
|
import locale_zh_cn from '../config/locale/zh-cn.js';
|
|
7
3
|
|
|
@@ -9,14 +5,3 @@ export const locales = {
|
|
|
9
5
|
'en-us': locale_en_us,
|
|
10
6
|
'zh-cn': locale_zh_cn,
|
|
11
7
|
};
|
|
12
|
-
|
|
13
|
-
export function $useLocale<K extends keyof (typeof locales)[TypeLocaleBase]>(
|
|
14
|
-
key: K,
|
|
15
|
-
...args: any[]
|
|
16
|
-
) {
|
|
17
|
-
const app = useApp();
|
|
18
|
-
const str = `basic-page::${key}`;
|
|
19
|
-
return useComputed(() => {
|
|
20
|
-
return app.meta.text(str, ...args);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import type { TypeLocaleBase } from 'zova';
|
|
2
|
-
|
|
3
|
-
import { useApp, useComputed } from 'zova';
|
|
4
|
-
|
|
5
1
|
import locale_en_us from '../config/locale/en-us.js';
|
|
6
2
|
import locale_zh_cn from '../config/locale/zh-cn.js';
|
|
7
3
|
|
|
@@ -9,14 +5,3 @@ export const locales = {
|
|
|
9
5
|
'en-us': locale_en_us,
|
|
10
6
|
'zh-cn': locale_zh_cn,
|
|
11
7
|
};
|
|
12
|
-
|
|
13
|
-
export function $useLocale<K extends keyof (typeof locales)[TypeLocaleBase]>(
|
|
14
|
-
key: K,
|
|
15
|
-
...args: any[]
|
|
16
|
-
) {
|
|
17
|
-
const app = useApp();
|
|
18
|
-
const str = `basic-pageentry::${key}`;
|
|
19
|
-
return useComputed(() => {
|
|
20
|
-
return app.meta.text(str, ...args);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import type { TypeLocaleBase } from 'zova';
|
|
2
|
-
|
|
3
|
-
import { useApp, useComputed } from 'zova';
|
|
4
|
-
|
|
5
1
|
import locale_en_us from '../config/locale/en-us.js';
|
|
6
2
|
import locale_zh_cn from '../config/locale/zh-cn.js';
|
|
7
3
|
|
|
@@ -9,14 +5,3 @@ export const locales = {
|
|
|
9
5
|
'en-us': locale_en_us,
|
|
10
6
|
'zh-cn': locale_zh_cn,
|
|
11
7
|
};
|
|
12
|
-
|
|
13
|
-
export function $useLocale<K extends keyof (typeof locales)[TypeLocaleBase]>(
|
|
14
|
-
key: K,
|
|
15
|
-
...args: any[]
|
|
16
|
-
) {
|
|
17
|
-
const app = useApp();
|
|
18
|
-
const str = `basic-table::${key}`;
|
|
19
|
-
return useComputed(() => {
|
|
20
|
-
return app.meta.text(str, ...args);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
@@ -55,7 +55,7 @@ export class InterceptorJwt
|
|
|
55
55
|
authToken: string | boolean | undefined,
|
|
56
56
|
): Promise<string | undefined> {
|
|
57
57
|
if (!this.sys.config.api.jwt) return;
|
|
58
|
-
if (this.sys.config.ssr.
|
|
58
|
+
if (this.sys.config.ssr.cookieDisabledOnServer) return;
|
|
59
59
|
// use default in scope.config rather than IInterceptorOptionsJwt.options
|
|
60
60
|
const authTokenCurrent = authToken ?? this.scope.config.authToken.default;
|
|
61
61
|
// authToken = authToken ?? this.scope.config.authToken.default;
|
|
@@ -10,11 +10,10 @@ export class ServiceStorage extends BeanBase {
|
|
|
10
10
|
|
|
11
11
|
async moduleLoaded() {
|
|
12
12
|
// options
|
|
13
|
-
|
|
13
|
+
const options = deepExtend({}, this.scope.config.queryClientConfig.defaultOptions);
|
|
14
14
|
if (process.env.SERVER) {
|
|
15
|
-
options
|
|
16
|
-
|
|
17
|
-
});
|
|
15
|
+
options.queries ??= {};
|
|
16
|
+
options.queries.gcTime = Infinity;
|
|
18
17
|
}
|
|
19
18
|
// queryCache
|
|
20
19
|
const queryCache = new QueryCache();
|
|
@@ -39,7 +38,7 @@ export class ServiceStorage extends BeanBase {
|
|
|
39
38
|
},
|
|
40
39
|
});
|
|
41
40
|
}
|
|
42
|
-
this._queryClient
|
|
41
|
+
this._queryClient?.clear();
|
|
43
42
|
});
|
|
44
43
|
}
|
|
45
44
|
// client
|
|
@@ -22,7 +22,7 @@ export class Monkey extends BeanSimple implements IMonkeyModule, IMonkeyBeanInit
|
|
|
22
22
|
if (this._moduleSelf === module) {
|
|
23
23
|
await this._loadSdk();
|
|
24
24
|
this.ctx.util.instanceScope(() => {
|
|
25
|
-
|
|
25
|
+
watch(
|
|
26
26
|
() => {
|
|
27
27
|
return this.app.meta.locale.current;
|
|
28
28
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentInternalInstance, Ref, VNode } from 'vue';
|
|
2
|
-
import type { Functionable } from 'zova';
|
|
2
|
+
import type { Functionable, ZovaContext } from 'zova';
|
|
3
3
|
|
|
4
4
|
import { includeBooleanAttr, isBooleanAttr, isString, stringifyStyle } from '@vue/shared';
|
|
5
5
|
import { defu } from 'defu';
|
|
@@ -23,6 +23,7 @@ const SymbolOnHydrateds = Symbol('SymbolOnHydrateds');
|
|
|
23
23
|
const SymbolOnHydratePropHasMismatches = Symbol('SymbolOnHydratePropHasMismatches');
|
|
24
24
|
const SymbolInstanceUpdates = Symbol('SymbolInstanceUpdates');
|
|
25
25
|
const SymbolHydratingCounter = Symbol('SymbolHydratingCounter');
|
|
26
|
+
const SymbolServerContexts = Symbol('SymbolServerContexts');
|
|
26
27
|
|
|
27
28
|
export class CtxSSR extends BeanSimple {
|
|
28
29
|
private [SymbolIsRuntimeSsrPreHydration]: Ref<boolean> = ref(false);
|
|
@@ -33,11 +34,15 @@ export class CtxSSR extends BeanSimple {
|
|
|
33
34
|
private [SymbolInstanceUpdates]: ComponentInternalInstance[] = [];
|
|
34
35
|
|
|
35
36
|
private [SymbolHydratingCounter]: number = 0;
|
|
37
|
+
private [SymbolServerContexts]: Set<ZovaContext> = new Set();
|
|
36
38
|
|
|
37
39
|
public metaStore: CtxSSRMetaStore;
|
|
38
40
|
|
|
39
41
|
/** @internal */
|
|
40
42
|
public initialize() {
|
|
43
|
+
if (process.env.SERVER) {
|
|
44
|
+
this._serverContextRegister();
|
|
45
|
+
}
|
|
41
46
|
// ssr state
|
|
42
47
|
this[SymbolSSRState] = this.sys.bean._getBeanSyncOnly('a-ssr.sys.ssrState');
|
|
43
48
|
// SymbolIsRuntimeSsrPreHydration
|
|
@@ -63,6 +68,26 @@ export class CtxSSR extends BeanSimple {
|
|
|
63
68
|
}
|
|
64
69
|
}
|
|
65
70
|
|
|
71
|
+
private _serverContextRegister(currentContext: ZovaContext = this.ctx) {
|
|
72
|
+
const serverContexts = this[SymbolServerContexts];
|
|
73
|
+
serverContexts.add(currentContext);
|
|
74
|
+
this.context.onRendered(() => {
|
|
75
|
+
serverContexts.delete(currentContext);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
private _serverContextsDispose() {
|
|
80
|
+
const serverContexts = this[SymbolServerContexts];
|
|
81
|
+
for (const serverContext of serverContexts) {
|
|
82
|
+
if (serverContext.disposed) continue;
|
|
83
|
+
if (serverContext.bean && serverContext.bean !== serverContext.app?.bean) {
|
|
84
|
+
serverContext.bean.dispose();
|
|
85
|
+
}
|
|
86
|
+
serverContext.dispose();
|
|
87
|
+
}
|
|
88
|
+
serverContexts.clear();
|
|
89
|
+
}
|
|
90
|
+
|
|
66
91
|
get isRuntimeSsrPreHydration() {
|
|
67
92
|
return this[SymbolIsRuntimeSsrPreHydration].value;
|
|
68
93
|
}
|
|
@@ -265,4 +290,14 @@ export class CtxSSR extends BeanSimple {
|
|
|
265
290
|
}
|
|
266
291
|
return false;
|
|
267
292
|
}
|
|
293
|
+
|
|
294
|
+
/** @internal */
|
|
295
|
+
public _registerServerContext(currentContext: ZovaContext) {
|
|
296
|
+
this._serverContextRegister(currentContext);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/** @internal */
|
|
300
|
+
public _disposeServerContexts() {
|
|
301
|
+
this._serverContextsDispose();
|
|
302
|
+
}
|
|
268
303
|
}
|
|
@@ -32,13 +32,18 @@ export class CtxSSRMetaStore extends BeanSimple {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
private _onRenderedLast(err?: Error) {
|
|
35
|
-
|
|
35
|
+
const app = this.app;
|
|
36
|
+
try {
|
|
37
|
+
if (err) return;
|
|
38
|
+
|
|
36
39
|
const ssrContext = this.ctx.meta.$ssr.context;
|
|
37
40
|
this._injectContextState(ssrContext);
|
|
38
41
|
this._injectContextStateDefer(ssrContext);
|
|
39
42
|
this._injectServerMeta(ssrContext);
|
|
43
|
+
} finally {
|
|
44
|
+
this.ctx.meta.$ssr._disposeServerContexts();
|
|
45
|
+
app?.close();
|
|
40
46
|
}
|
|
41
|
-
this.app.close();
|
|
42
47
|
}
|
|
43
48
|
|
|
44
49
|
addMetaOptions(metaOptionsWrapper: SSRMetaOptionsWrapper) {
|
|
@@ -159,6 +164,7 @@ export class CtxSSRMetaStore extends BeanSimple {
|
|
|
159
164
|
ssr_local_themedark=window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
160
165
|
}
|
|
161
166
|
window.ssr_themedark=window.ssr_local_themedark=ssr_local_themedark;`;
|
|
167
|
+
// Resolve the final browser theme from the SSR dual markers emitted before page render.
|
|
162
168
|
ssr_local_themedark += `Object.defineProperty(window, 'ssr_themedark_data', {
|
|
163
169
|
get: () => {
|
|
164
170
|
let _data=document.body.getAttribute('data-ssr-theme-dark-'+window.ssr_themedark);
|