create-secra 0.1.11 → 1.0.2
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/README.md +15 -5
- package/README.zh-CN.md +15 -4
- package/antd-adapter-template/README.md +24 -0
- package/antd-adapter-template/index.html +16 -0
- package/antd-adapter-template/package-lock.json +3420 -0
- package/antd-adapter-template/package.json +20 -47
- package/antd-adapter-template/src/app/App.tsx +7 -0
- package/antd-adapter-template/src/app/layouts/AppLayout.tsx +163 -0
- package/antd-adapter-template/src/app/router.ts +26 -0
- package/antd-adapter-template/src/app/routes/RouteTitleSync.tsx +26 -0
- package/antd-adapter-template/src/app/routes/dynamic-routes.ts +52 -0
- package/antd-adapter-template/src/app/routes/route-modules.ts +4 -0
- package/antd-adapter-template/src/app/routes/static-routes.tsx +110 -0
- package/antd-adapter-template/src/app/routes/types.ts +9 -0
- package/antd-adapter-template/src/features/auth/api/auth-api.ts +61 -0
- package/antd-adapter-template/src/features/auth/auth-store.ts +125 -0
- package/antd-adapter-template/src/features/auth/auth-types.ts +29 -0
- package/antd-adapter-template/src/features/auth/authorization.ts +46 -0
- package/antd-adapter-template/src/features/auth/use-auth.ts +10 -0
- package/antd-adapter-template/src/main.tsx +79 -0
- package/antd-adapter-template/src/pages/dashboard/DashboardPage.tsx +105 -0
- package/antd-adapter-template/src/pages/errors/ForbiddenPage.tsx +36 -0
- package/antd-adapter-template/src/pages/errors/NotFoundPage.tsx +36 -0
- package/antd-adapter-template/src/pages/home/HomePage.tsx +129 -0
- package/antd-adapter-template/src/pages/login/LoginPage.tsx +128 -0
- package/antd-adapter-template/src/pages/permission-test/PermissionTestPage.tsx +55 -0
- package/antd-adapter-template/src/pages/restricted/RestrictedDemoPage.tsx +17 -0
- package/antd-adapter-template/src/shared/kernel/app-kernel.ts +10 -0
- package/antd-adapter-template/src/shared/request/client.ts +46 -0
- package/antd-adapter-template/src/shared/request/contracts.ts +6 -0
- package/antd-adapter-template/src/shared/request/kv-adapter.ts +14 -0
- package/antd-adapter-template/src/shared/request/kv-backend.ts +244 -0
- package/antd-adapter-template/src/shared/request/ky-browser-stub.ts +6 -0
- package/antd-adapter-template/src/shared/request/undici-browser-stub.ts +4 -0
- package/antd-adapter-template/src/styles/global.css +185 -0
- package/antd-adapter-template/src/vite-env.d.ts +2 -0
- package/antd-adapter-template/tsconfig.app.json +10 -13
- package/antd-adapter-template/tsconfig.json +7 -2
- package/antd-adapter-template/tsconfig.node.json +6 -16
- package/antd-adapter-template/vite.config.ts +24 -0
- package/bin/index.mjs +32 -14
- package/package.json +2 -2
- package/{antd-adapter-template/apps/core → template}/index.html +2 -3
- package/template/package.json +14 -46
- package/template/src/App.tsx +48 -0
- package/template/src/main.tsx +36 -0
- package/template/src/styles.css +163 -0
- package/template/src/vite-env.d.ts +1 -0
- package/template/tsconfig.app.json +0 -5
- package/template/tsconfig.node.json +0 -5
- package/template/vite.config.ts +6 -0
- package/antd-adapter-template/apps/core/package.json +0 -18
- package/antd-adapter-template/apps/core/public/favicon.ico +0 -1
- package/antd-adapter-template/apps/core/public/favicon.svg +0 -1
- package/antd-adapter-template/apps/core/public/logo.svg +0 -1
- package/antd-adapter-template/apps/core/src/api/auth.ts +0 -49
- package/antd-adapter-template/apps/core/src/assets/react.svg +0 -1
- package/antd-adapter-template/apps/core/src/components/AntdGlobalProvider.tsx +0 -87
- package/antd-adapter-template/apps/core/src/components/AntdRootLayout.tsx +0 -10
- package/antd-adapter-template/apps/core/src/components/layout.tsx +0 -387
- package/antd-adapter-template/apps/core/src/guards/auth-route-guard.ts +0 -45
- package/antd-adapter-template/apps/core/src/main.tsx +0 -65
- package/antd-adapter-template/apps/core/src/pages/auth/components/account-login-fields.tsx +0 -60
- package/antd-adapter-template/apps/core/src/pages/auth/components/phone-login-fields.tsx +0 -60
- package/antd-adapter-template/apps/core/src/pages/auth/login.tsx +0 -169
- package/antd-adapter-template/apps/core/src/pages/index.tsx +0 -156
- package/antd-adapter-template/apps/core/src/router.ts +0 -42
- package/antd-adapter-template/apps/core/src/shims/use-sync-external-store-shim.ts +0 -3
- package/antd-adapter-template/apps/core/src/theme/theme.css +0 -48
- package/antd-adapter-template/apps/core/src/types/crypto-js.d.ts +0 -5
- package/antd-adapter-template/apps/core/src/utils/index.ts +0 -12
- package/antd-adapter-template/apps/core/src/utils/md5.ts +0 -6
- package/antd-adapter-template/apps/core/tsconfig.app.json +0 -11
- package/antd-adapter-template/apps/core/tsconfig.json +0 -13
- package/antd-adapter-template/apps/core/tsconfig.node.json +0 -7
- package/antd-adapter-template/apps/core/vite.config.ts +0 -118
- package/antd-adapter-template/eslint.config.js +0 -23
- package/antd-adapter-template/packages/sdk/.swcrc +0 -18
- package/antd-adapter-template/packages/sdk/package.json +0 -52
- package/antd-adapter-template/packages/sdk/src/build/index.ts +0 -28
- package/antd-adapter-template/packages/sdk/src/build/plugins/auto-import.ts +0 -46
- package/antd-adapter-template/packages/sdk/src/build/plugins/bundle-analyzer.ts +0 -33
- package/antd-adapter-template/packages/sdk/src/build/plugins/remove-console.ts +0 -23
- package/antd-adapter-template/packages/sdk/src/build/plugins/unocss.ts +0 -202
- package/antd-adapter-template/packages/sdk/src/build/plugins/unplugin-icon.ts +0 -43
- package/antd-adapter-template/packages/sdk/src/components/i18n-switch-dropdown.tsx +0 -139
- package/antd-adapter-template/packages/sdk/src/components/index.ts +0 -2
- package/antd-adapter-template/packages/sdk/src/components/theme-switch-dropdown.tsx +0 -131
- package/antd-adapter-template/packages/sdk/src/hooks/auth/core.ts +0 -101
- package/antd-adapter-template/packages/sdk/src/hooks/auth/index.ts +0 -139
- package/antd-adapter-template/packages/sdk/src/hooks/auth/with-auth.tsx +0 -41
- package/antd-adapter-template/packages/sdk/src/hooks/index.ts +0 -1
- package/antd-adapter-template/packages/sdk/src/i18n/index.ts +0 -150
- package/antd-adapter-template/packages/sdk/src/index.ts +0 -11
- package/antd-adapter-template/packages/sdk/src/request/index.ts +0 -436
- package/antd-adapter-template/packages/sdk/src/storage/README.md +0 -30
- package/antd-adapter-template/packages/sdk/src/storage/index.ts +0 -57
- package/antd-adapter-template/packages/sdk/src/styles/reset.css +0 -111
- package/antd-adapter-template/packages/sdk/src/theme/index.ts +0 -466
- package/antd-adapter-template/packages/sdk/tsconfig.json +0 -16
- package/antd-adapter-template/pnpm-workspace.yaml +0 -3
- package/antd-adapter-template/turbo.json +0 -17
- package/template/apps/core/index.html +0 -13
- package/template/apps/core/package.json +0 -18
- package/template/apps/core/public/favicon.ico +0 -1
- package/template/apps/core/public/favicon.svg +0 -1
- package/template/apps/core/public/logo.svg +0 -1
- package/template/apps/core/src/assets/react.svg +0 -1
- package/template/apps/core/src/main.tsx +0 -14
- package/template/apps/core/src/pages/index.tsx +0 -84
- package/template/apps/core/src/router.ts +0 -19
- package/template/apps/core/src/types/auto-imports.d.ts +0 -130
- package/template/apps/core/tsconfig.app.json +0 -7
- package/template/apps/core/tsconfig.json +0 -7
- package/template/apps/core/tsconfig.node.json +0 -7
- package/template/apps/core/vite.config.ts +0 -86
- package/template/eslint.config.js +0 -23
- package/template/packages/sdk/.swcrc +0 -18
- package/template/packages/sdk/package-lock.json +0 -1621
- package/template/packages/sdk/package.json +0 -32
- package/template/packages/sdk/src/build/index.ts +0 -33
- package/template/packages/sdk/src/build/plugins/auto-import.ts +0 -47
- package/template/packages/sdk/src/build/plugins/bundle-analyzer.ts +0 -35
- package/template/packages/sdk/src/build/plugins/remove-console.ts +0 -21
- package/template/packages/sdk/src/build/plugins/unocss.ts +0 -113
- package/template/packages/sdk/src/build/plugins/unplugin-icon.ts +0 -43
- package/template/packages/sdk/src/index.ts +0 -1
- package/template/packages/sdk/src/request/index.ts +0 -341
- package/template/packages/sdk/src/styles/reset.css +0 -111
- package/template/packages/sdk/tsconfig.json +0 -16
- package/template/pnpm-lock.yaml +0 -8055
- package/template/pnpm-workspace.yaml +0 -3
- package/template/turbo.json +0 -17
package/bin/index.mjs
CHANGED
|
@@ -12,15 +12,25 @@ const ANT_DESIGN_ADAPTER_TEMPLATE = path.resolve(__dirname, "../antd-adapter-tem
|
|
|
12
12
|
const TEMPLATE_OPTIONS = [
|
|
13
13
|
{
|
|
14
14
|
key: "1",
|
|
15
|
-
label: "
|
|
15
|
+
label: "纯净版",
|
|
16
16
|
templatePath: DEFAULT_TEMPLATE,
|
|
17
17
|
templateName: "template",
|
|
18
|
+
nextSteps: (manager, cwd) => [
|
|
19
|
+
` cd ${cwd}`,
|
|
20
|
+
` ${manager === "yarn" ? "yarn" : `${manager} install`}`,
|
|
21
|
+
` ${manager} dev`,
|
|
22
|
+
],
|
|
18
23
|
},
|
|
19
24
|
{
|
|
20
25
|
key: "2",
|
|
21
|
-
label: "
|
|
26
|
+
label: "Ant Design 版",
|
|
22
27
|
templatePath: ANT_DESIGN_ADAPTER_TEMPLATE,
|
|
23
28
|
templateName: "antd-adapter-template",
|
|
29
|
+
nextSteps: (manager, cwd) => [
|
|
30
|
+
` cd ${cwd}`,
|
|
31
|
+
` ${manager === "yarn" ? "yarn" : `${manager} install`}`,
|
|
32
|
+
` ${manager} dev`,
|
|
33
|
+
],
|
|
24
34
|
},
|
|
25
35
|
];
|
|
26
36
|
const EXCLUDED_DIRS = new Set(["node_modules", "dist", ".turbo", ".git"]);
|
|
@@ -86,7 +96,7 @@ function detectPackageManager(projectRoot) {
|
|
|
86
96
|
|
|
87
97
|
async function promptTemplateSelection() {
|
|
88
98
|
const renderMenu = (selectedIndex) => {
|
|
89
|
-
const lines = ["[create-secra]
|
|
99
|
+
const lines = ["[create-secra] 请选择初始化模板(↑/↓ 切换,Enter 确认):"];
|
|
90
100
|
for (let i = 0; i < TEMPLATE_OPTIONS.length; i += 1) {
|
|
91
101
|
const option = TEMPLATE_OPTIONS[i];
|
|
92
102
|
const prefix = i === selectedIndex ? "❯" : " ";
|
|
@@ -127,7 +137,7 @@ async function promptTemplateSelection() {
|
|
|
127
137
|
cleanup();
|
|
128
138
|
clearRenderedMenu();
|
|
129
139
|
const selected = TEMPLATE_OPTIONS[selectedIndex] ?? TEMPLATE_OPTIONS[0];
|
|
130
|
-
stdout.write(`[create-secra]
|
|
140
|
+
stdout.write(`[create-secra] 已选择模板:${selected.label}\n`);
|
|
131
141
|
resolve(selected);
|
|
132
142
|
};
|
|
133
143
|
|
|
@@ -170,8 +180,8 @@ async function resolveTemplate() {
|
|
|
170
180
|
if (templateFromEnv) {
|
|
171
181
|
return {
|
|
172
182
|
template: templateFromEnv,
|
|
173
|
-
selectedName: templateName || "custom",
|
|
174
183
|
selectedLabel: templateName || "自定义模板",
|
|
184
|
+
nextSteps: null,
|
|
175
185
|
};
|
|
176
186
|
}
|
|
177
187
|
|
|
@@ -180,8 +190,8 @@ async function resolveTemplate() {
|
|
|
180
190
|
if (matchedByName) {
|
|
181
191
|
return {
|
|
182
192
|
template: matchedByName.templatePath,
|
|
183
|
-
selectedName: matchedByName.templateName,
|
|
184
193
|
selectedLabel: matchedByName.label,
|
|
194
|
+
nextSteps: matchedByName.nextSteps,
|
|
185
195
|
};
|
|
186
196
|
}
|
|
187
197
|
}
|
|
@@ -190,8 +200,8 @@ async function resolveTemplate() {
|
|
|
190
200
|
if (matchedByArg) {
|
|
191
201
|
return {
|
|
192
202
|
template: matchedByArg.templatePath,
|
|
193
|
-
selectedName: matchedByArg.templateName,
|
|
194
203
|
selectedLabel: matchedByArg.label,
|
|
204
|
+
nextSteps: matchedByArg.nextSteps,
|
|
195
205
|
};
|
|
196
206
|
}
|
|
197
207
|
|
|
@@ -199,21 +209,21 @@ async function resolveTemplate() {
|
|
|
199
209
|
const fallback = TEMPLATE_OPTIONS[0];
|
|
200
210
|
return {
|
|
201
211
|
template: fallback.templatePath,
|
|
202
|
-
selectedName: fallback.templateName,
|
|
203
212
|
selectedLabel: fallback.label,
|
|
213
|
+
nextSteps: fallback.nextSteps,
|
|
204
214
|
};
|
|
205
215
|
}
|
|
206
216
|
|
|
207
217
|
const selected = await promptTemplateSelection();
|
|
208
218
|
return {
|
|
209
219
|
template: selected.templatePath,
|
|
210
|
-
selectedName: selected.templateName,
|
|
211
220
|
selectedLabel: selected.label,
|
|
221
|
+
nextSteps: selected.nextSteps,
|
|
212
222
|
};
|
|
213
223
|
}
|
|
214
224
|
|
|
215
225
|
async function main() {
|
|
216
|
-
const { template, selectedLabel } = await resolveTemplate();
|
|
226
|
+
const { template, selectedLabel, nextSteps } = await resolveTemplate();
|
|
217
227
|
|
|
218
228
|
if (existsSync(targetPath)) {
|
|
219
229
|
const files = readdirSync(targetPath);
|
|
@@ -242,10 +252,18 @@ async function main() {
|
|
|
242
252
|
const manager = detectPackageManager(targetPath);
|
|
243
253
|
|
|
244
254
|
console.log(`[create-secra] Done. Next steps:`);
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
255
|
+
const renderedNextSteps =
|
|
256
|
+
typeof nextSteps === "function"
|
|
257
|
+
? nextSteps(manager, targetDir)
|
|
258
|
+
: [
|
|
259
|
+
` cd ${targetDir}`,
|
|
260
|
+
` ${manager === "yarn" ? "yarn" : `${manager} install`}`,
|
|
261
|
+
` ${manager} dev`,
|
|
262
|
+
];
|
|
263
|
+
|
|
264
|
+
renderedNextSteps.forEach((step) => {
|
|
265
|
+
console.log(step);
|
|
266
|
+
});
|
|
249
267
|
}
|
|
250
268
|
|
|
251
269
|
main();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-secra",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Create a Secra project from the official template.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"scaffold"
|
|
18
18
|
],
|
|
19
19
|
"scripts": {
|
|
20
|
-
"prepublishOnly": "npm version patch"
|
|
20
|
+
"prepublishOnly": "npm version patch --no-git-tag-version"
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT"
|
|
23
23
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
|
-
<html lang="
|
|
2
|
+
<html lang="zh-CN">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
|
-
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
6
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>
|
|
6
|
+
<title>Secra App</title>
|
|
8
7
|
</head>
|
|
9
8
|
<body>
|
|
10
9
|
<div id="root"></div>
|
package/template/package.json
CHANGED
|
@@ -1,60 +1,28 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "secra-
|
|
2
|
+
"name": "secra-app",
|
|
3
3
|
"private": true,
|
|
4
4
|
"version": "0.0.1",
|
|
5
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"packageManager": "pnpm@10.27.0",
|
|
6
7
|
"scripts": {
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"clean:node_modules": "find . -type d -name 'node_modules' -prune -exec rm -rf '{}' +"
|
|
8
|
+
"dev": "vite",
|
|
9
|
+
"build": "tsc -b && vite build",
|
|
10
|
+
"preview": "vite preview",
|
|
11
|
+
"typecheck": "tsc -b --pretty false"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@
|
|
15
|
-
"@vlian/
|
|
16
|
-
"@vlian/
|
|
17
|
-
"@vlian/sdk": "workspace:*",
|
|
18
|
-
"ahooks": "^3.8.5",
|
|
19
|
-
"antd": "^5.29.3",
|
|
20
|
-
"i18next": "^25.7.4",
|
|
21
|
-
"immer": "^10.1.3",
|
|
22
|
-
"ky": "^1.14.2",
|
|
23
|
-
"lodash": "^4.17.21",
|
|
14
|
+
"@vlian/framework": "^2.0.3",
|
|
15
|
+
"@vlian/logger": "^0.1.1",
|
|
16
|
+
"@vlian/utils": "^2.0.1",
|
|
24
17
|
"react": "^19.2.0",
|
|
25
|
-
"react-dom": "^19.2.0"
|
|
26
|
-
"react-i18next": "^15.7.4",
|
|
27
|
-
"react-router-dom": "^7.8.2"
|
|
18
|
+
"react-dom": "^19.2.0"
|
|
28
19
|
},
|
|
29
20
|
"devDependencies": {
|
|
30
|
-
"@eslint/js": "^9.39.1",
|
|
31
|
-
"@iconify/utils": "^3.1.0",
|
|
32
|
-
"@types/lodash": "^4.17.21",
|
|
33
21
|
"@types/node": "^24.10.1",
|
|
34
|
-
"@types/react": "^19.2.
|
|
22
|
+
"@types/react": "^19.2.7",
|
|
35
23
|
"@types/react-dom": "^19.2.3",
|
|
36
|
-
"@unocss/core": "^66.6.0",
|
|
37
|
-
"@unocss/preset-attributify": "^66.6.0",
|
|
38
|
-
"@unocss/preset-icons": "^66.6.0",
|
|
39
|
-
"@unocss/preset-uno": "^66.6.0",
|
|
40
|
-
"@unocss/transformer-directives": "^66.6.0",
|
|
41
|
-
"@unocss/transformer-variant-group": "^66.6.0",
|
|
42
|
-
"@unocss/vite": "^66.6.0",
|
|
43
24
|
"@vitejs/plugin-react": "^5.1.1",
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"eslint-plugin-react-refresh": "^0.4.24",
|
|
47
|
-
"globals": "^16.5.0",
|
|
48
|
-
"gogocode": "^1.0.53",
|
|
49
|
-
"rollup-plugin-visualizer": "^5.14.0",
|
|
50
|
-
"turbo": "^2.7.5",
|
|
51
|
-
"typescript": "~5.9.3",
|
|
52
|
-
"typescript-eslint": "^8.46.4",
|
|
53
|
-
"unplugin-auto-import": "^0.17.8",
|
|
54
|
-
"unplugin-icons": "^0.20.1",
|
|
55
|
-
"vite": "npm:rolldown-vite@7.2.5",
|
|
56
|
-
"vite-plugin-inspect": "^11.3.3",
|
|
57
|
-
"vite-plugin-remove-console": "^1.3.0",
|
|
58
|
-
"vite-plugin-svg-icons": "^2.0.1"
|
|
25
|
+
"typescript": "^5.9.3",
|
|
26
|
+
"vite": "npm:rolldown-vite@7.2.5"
|
|
59
27
|
}
|
|
60
28
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const featureCards = [
|
|
2
|
+
{
|
|
3
|
+
title: "Vite",
|
|
4
|
+
description: "保持开发体验足够轻,默认就是本地启动、热更新和生产构建。",
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
title: "React 19",
|
|
8
|
+
description: "欢迎页只保留一个根组件,后续你可以按业务模块继续拆分页面和组件。",
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
title: "@vlian/framework",
|
|
12
|
+
description: "模板通过 kernel 启动应用,只保留最基础的运行时入口,不预置路由、请求和 UI 框架。",
|
|
13
|
+
},
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
export function App() {
|
|
17
|
+
return (
|
|
18
|
+
<main className="page-shell">
|
|
19
|
+
<section className="hero-panel">
|
|
20
|
+
<p className="eyebrow">Secra Minimal Starter</p>
|
|
21
|
+
<h1>Vite + React + @vlian/framework</h1>
|
|
22
|
+
<p className="hero-copy">
|
|
23
|
+
这是一个最简欢迎页模板,适合从零开始搭建 Secra 应用。当前只保留 kernel 启动、React 渲染和一层基础样式。
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
<div className="hero-actions">
|
|
27
|
+
<a className="primary-link" href="https://vite.dev/" target="_blank" rel="noreferrer">
|
|
28
|
+
查看 Vite
|
|
29
|
+
</a>
|
|
30
|
+
<a className="secondary-link" href="https://react.dev/" target="_blank" rel="noreferrer">
|
|
31
|
+
查看 React
|
|
32
|
+
</a>
|
|
33
|
+
</div>
|
|
34
|
+
</section>
|
|
35
|
+
|
|
36
|
+
<section className="content-grid" aria-label="Template introduction">
|
|
37
|
+
{featureCards.map((item) => (
|
|
38
|
+
<article key={item.title} className="feature-card">
|
|
39
|
+
<p className="feature-title">{item.title}</p>
|
|
40
|
+
<p className="feature-description">{item.description}</p>
|
|
41
|
+
</article>
|
|
42
|
+
))}
|
|
43
|
+
</section>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
</main>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { StrictMode } from "react";
|
|
2
|
+
import { createRoot } from "react-dom/client";
|
|
3
|
+
import { kernelStartApp, type KernelRenderContext } from "@vlian/framework/kernel";
|
|
4
|
+
import { LogLevel } from "@vlian/logger";
|
|
5
|
+
import { App } from "./App";
|
|
6
|
+
import "./styles.css";
|
|
7
|
+
|
|
8
|
+
const container = document.getElementById("root");
|
|
9
|
+
|
|
10
|
+
if (!container) {
|
|
11
|
+
throw new Error("Root container #root was not found.");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const root = createRoot(container);
|
|
15
|
+
|
|
16
|
+
async function startApp() {
|
|
17
|
+
await kernelStartApp(
|
|
18
|
+
{
|
|
19
|
+
config: {
|
|
20
|
+
logger: {
|
|
21
|
+
level: import.meta.env.PROD ? LogLevel.INFO : LogLevel.DEBUG,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
render: (_context: KernelRenderContext) => {
|
|
25
|
+
root.render(
|
|
26
|
+
<StrictMode>
|
|
27
|
+
<App />
|
|
28
|
+
</StrictMode>,
|
|
29
|
+
);
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
"secra-starter",
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
void startApp();
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
color-scheme: light;
|
|
3
|
+
font-family: "IBM Plex Sans", "PingFang SC", "Hiragino Sans GB", sans-serif;
|
|
4
|
+
line-height: 1.5;
|
|
5
|
+
font-weight: 400;
|
|
6
|
+
color: #152033;
|
|
7
|
+
background:
|
|
8
|
+
radial-gradient(circle at top left, rgba(52, 211, 153, 0.18), transparent 32%),
|
|
9
|
+
radial-gradient(circle at right 20%, rgba(20, 184, 166, 0.14), transparent 28%),
|
|
10
|
+
linear-gradient(180deg, #f3fbf8 0%, #ffffff 100%);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
* {
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
html,
|
|
18
|
+
body,
|
|
19
|
+
#root {
|
|
20
|
+
min-height: 100%;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
body {
|
|
24
|
+
margin: 0;
|
|
25
|
+
min-width: 320px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
a {
|
|
29
|
+
color: inherit;
|
|
30
|
+
text-decoration: none;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.page-shell {
|
|
34
|
+
width: min(1080px, calc(100vw - 32px));
|
|
35
|
+
margin: 0 auto;
|
|
36
|
+
padding: 40px 0 72px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.hero-panel,
|
|
40
|
+
.feature-card,
|
|
41
|
+
.note-panel {
|
|
42
|
+
border: 1px solid rgba(21, 32, 51, 0.08);
|
|
43
|
+
background: rgba(255, 255, 255, 0.86);
|
|
44
|
+
box-shadow: 0 24px 60px rgba(21, 32, 51, 0.1);
|
|
45
|
+
backdrop-filter: blur(16px);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.hero-panel {
|
|
49
|
+
padding: 36px;
|
|
50
|
+
border-radius: 28px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.eyebrow,
|
|
54
|
+
.feature-title,
|
|
55
|
+
.note-title {
|
|
56
|
+
margin: 0;
|
|
57
|
+
text-transform: uppercase;
|
|
58
|
+
letter-spacing: 0.14em;
|
|
59
|
+
font-size: 0.78rem;
|
|
60
|
+
color: #4b6a67;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.hero-panel h1 {
|
|
64
|
+
margin: 12px 0 14px;
|
|
65
|
+
font-size: clamp(2.4rem, 1.8rem + 2vw, 4.6rem);
|
|
66
|
+
line-height: 0.96;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.hero-copy,
|
|
70
|
+
.feature-description,
|
|
71
|
+
.note-copy {
|
|
72
|
+
margin: 0;
|
|
73
|
+
color: #425466;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.hero-copy {
|
|
77
|
+
max-width: 58ch;
|
|
78
|
+
font-size: 1.05rem;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.hero-actions {
|
|
82
|
+
display: flex;
|
|
83
|
+
flex-wrap: wrap;
|
|
84
|
+
gap: 12px;
|
|
85
|
+
margin-top: 26px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.primary-link,
|
|
89
|
+
.secondary-link {
|
|
90
|
+
display: inline-flex;
|
|
91
|
+
align-items: center;
|
|
92
|
+
justify-content: center;
|
|
93
|
+
min-height: 44px;
|
|
94
|
+
padding: 0 18px;
|
|
95
|
+
border-radius: 999px;
|
|
96
|
+
transition: transform 140ms ease, background-color 140ms ease, border-color 140ms ease;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.primary-link {
|
|
100
|
+
background: #0f766e;
|
|
101
|
+
color: #ffffff;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.secondary-link {
|
|
105
|
+
border: 1px solid rgba(15, 118, 110, 0.22);
|
|
106
|
+
background: rgba(15, 118, 110, 0.08);
|
|
107
|
+
color: #0f4b4a;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.primary-link:hover,
|
|
111
|
+
.secondary-link:hover {
|
|
112
|
+
transform: translateY(-1px);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.content-grid {
|
|
116
|
+
display: grid;
|
|
117
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
118
|
+
gap: 18px;
|
|
119
|
+
margin-top: 20px;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.feature-card,
|
|
123
|
+
.note-panel {
|
|
124
|
+
padding: 24px;
|
|
125
|
+
border-radius: 22px;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.feature-description,
|
|
129
|
+
.note-copy {
|
|
130
|
+
margin-top: 12px;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.note-panel {
|
|
134
|
+
margin-top: 20px;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
code {
|
|
138
|
+
padding: 0.12rem 0.36rem;
|
|
139
|
+
border-radius: 8px;
|
|
140
|
+
background: rgba(15, 118, 110, 0.1);
|
|
141
|
+
color: #0f4b4a;
|
|
142
|
+
font-family: "SFMono-Regular", "SFMono", "Menlo", monospace;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@media (max-width: 900px) {
|
|
146
|
+
.content-grid {
|
|
147
|
+
grid-template-columns: 1fr;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
@media (max-width: 640px) {
|
|
152
|
+
.page-shell {
|
|
153
|
+
width: min(100vw - 20px, 1080px);
|
|
154
|
+
padding-top: 20px;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.hero-panel,
|
|
158
|
+
.feature-card,
|
|
159
|
+
.note-panel {
|
|
160
|
+
padding: 20px;
|
|
161
|
+
border-radius: 20px;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
4
|
-
"composite": true,
|
|
5
4
|
"target": "ES2022",
|
|
6
5
|
"useDefineForClassFields": true,
|
|
7
6
|
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
8
7
|
"module": "ESNext",
|
|
9
8
|
"types": ["vite/client"],
|
|
10
9
|
"skipLibCheck": true,
|
|
11
|
-
|
|
12
|
-
/* Bundler mode */
|
|
13
10
|
"moduleResolution": "bundler",
|
|
14
11
|
"allowImportingTsExtensions": true,
|
|
15
12
|
"verbatimModuleSyntax": true,
|
|
16
13
|
"moduleDetection": "force",
|
|
17
14
|
"noEmit": true,
|
|
18
15
|
"jsx": "react-jsx",
|
|
19
|
-
|
|
20
|
-
/* Linting */
|
|
21
16
|
"strict": true,
|
|
22
17
|
"noUnusedLocals": true,
|
|
23
18
|
"noUnusedParameters": true,
|
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
4
|
-
"composite": true,
|
|
5
4
|
"target": "ES2023",
|
|
6
5
|
"lib": ["ES2023"],
|
|
7
6
|
"module": "ESNext",
|
|
8
7
|
"types": ["node"],
|
|
9
8
|
"skipLibCheck": true,
|
|
10
|
-
|
|
11
|
-
/* Bundler mode */
|
|
12
9
|
"moduleResolution": "bundler",
|
|
13
10
|
"allowImportingTsExtensions": true,
|
|
14
11
|
"verbatimModuleSyntax": true,
|
|
15
12
|
"moduleDetection": "force",
|
|
16
13
|
"noEmit": true,
|
|
17
|
-
|
|
18
|
-
/* Linting */
|
|
19
14
|
"strict": true,
|
|
20
15
|
"noUnusedLocals": true,
|
|
21
16
|
"noUnusedParameters": true,
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "core",
|
|
3
|
-
"private": true,
|
|
4
|
-
"version": "0.0.15",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"dev": "vite",
|
|
8
|
-
"build": "tsc -b && vite build",
|
|
9
|
-
"lint": "eslint .",
|
|
10
|
-
"preview": "vite preview"
|
|
11
|
-
},
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"@reduxjs/toolkit": "^2.11.0",
|
|
14
|
-
"@vlian/sdk": "workspace:*",
|
|
15
|
-
"crypto-js": "^4.2.0",
|
|
16
|
-
"lucide-react": "^0.575.0"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 109.07 100"><path fill="#24d6fe" d="M54.65 100l18.21-25.37H36.22L54.65 100z"/><path fill="#24d6fe" d="M72.86 24.94l-.07-.09L54.54 0 36.28 24.85l18.26 24.84 18.32 24.94 18.18 24.75 18.03-25.14-36.21-49.3z"/><path fill="#9e5df9" opacity=".5" d="M72.79 24.85L54.54 0 36.28 24.85l18.26 24.84 18.25-24.84z"/><path fill="#9e5df9" d="M36.22 49.69H18.03L0 74.24 18.09 99.3l18.13-24.67 18.32-24.94H36.22z"/></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 109.07 100"><path fill="#24d6fe" d="M54.65 100l18.21-25.37H36.22L54.65 100z"/><path fill="#24d6fe" d="M72.86 24.94l-.07-.09L54.54 0 36.28 24.85l18.26 24.84 18.32 24.94 18.18 24.75 18.03-25.14-36.21-49.3z"/><path fill="#9e5df9" opacity=".5" d="M72.79 24.85L54.54 0 36.28 24.85l18.26 24.84 18.25-24.84z"/><path fill="#9e5df9" d="M36.22 49.69H18.03L0 74.24 18.09 99.3l18.13-24.67 18.32-24.94H36.22z"/></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 109.07 100"><path fill="#24d6fe" d="M54.65 100l18.21-25.37H36.22L54.65 100z"/><path fill="#24d6fe" d="M72.86 24.94l-.07-.09L54.54 0 36.28 24.85l18.26 24.84 18.32 24.94 18.18 24.75 18.03-25.14-36.21-49.3z"/><path fill="#9e5df9" opacity=".5" d="M72.79 24.85L54.54 0 36.28 24.85l18.26 24.84 18.25-24.84z"/><path fill="#9e5df9" d="M36.22 49.69H18.03L0 74.24 18.09 99.3l18.13-24.67 18.32-24.94H36.22z"/></svg>
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
export interface LoginRequest extends Record<string, unknown> {
|
|
2
|
-
identifier: string;
|
|
3
|
-
password: string;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export interface LoginUser {
|
|
7
|
-
id: string;
|
|
8
|
-
tenant_id: string;
|
|
9
|
-
display_name: string;
|
|
10
|
-
email: string | null;
|
|
11
|
-
phone: string | null;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface LoginResponse {
|
|
15
|
-
access_token: string;
|
|
16
|
-
refresh_token: string;
|
|
17
|
-
token_type: string;
|
|
18
|
-
expires_in: number;
|
|
19
|
-
refresh_expires_in: number;
|
|
20
|
-
user: LoginUser;
|
|
21
|
-
require_password_change: boolean;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const MOCK_PASSWORD_MD5 = "0192023a7bbd73250516f069df18b500";
|
|
25
|
-
|
|
26
|
-
export const login = async (payload: LoginRequest): Promise<LoginResponse> => {
|
|
27
|
-
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
28
|
-
const identifier = payload.identifier.trim();
|
|
29
|
-
if (!identifier || payload.password !== MOCK_PASSWORD_MD5) {
|
|
30
|
-
throw new Error("用户名或密码错误");
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const now = Date.now();
|
|
34
|
-
return {
|
|
35
|
-
access_token: `mock-access-token-${now}`,
|
|
36
|
-
refresh_token: `mock-refresh-token-${now}`,
|
|
37
|
-
token_type: "Bearer",
|
|
38
|
-
expires_in: 7200,
|
|
39
|
-
refresh_expires_in: 2592000,
|
|
40
|
-
user: {
|
|
41
|
-
id: "mock-user-1",
|
|
42
|
-
tenant_id: "mock-tenant-1",
|
|
43
|
-
display_name: identifier,
|
|
44
|
-
email: `${identifier}@example.com`,
|
|
45
|
-
phone: null,
|
|
46
|
-
},
|
|
47
|
-
require_password_change: false,
|
|
48
|
-
};
|
|
49
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
|