@lingfan-engine/create 0.3.2 → 0.3.4
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/bin/create.mjs +2 -2
- package/package.json +1 -1
- package/src/cli/cli.ts +135 -55
- package/src/cli/index.ts +21 -0
- package/src/cli/install.ts +60 -0
- package/src/cli/prompts.ts +51 -4
- package/src/generate/index.ts +7 -2
- package/src/generate/project.ts +67 -20
- package/src/overlay/index.ts +1 -0
- package/src/overlay/merge.ts +27 -1
- package/src/shared/index.ts +8 -1
- package/src/shared/package-manager.ts +87 -0
- package/src/shared/texts.ts +21 -11
- package/template/README.md +34 -23
- package/template/__PROJECT__/package.json +6 -1
- package/template/__PROJECT__/package.patch.json +5 -0
- package/template/__PROJECT__/src/host/index.ts +1 -0
- package/template/__PROJECT__/src/host/native-ports.ts +56 -0
- package/template/__PROJECT__/src/main.ts +5 -2
- package/template/{overlays/ts → __PROJECT__}/tsconfig.stories.json +4 -1
- package/template/overlays/README.md +27 -13
- package/template/overlays/react/src/main.tsx +3 -0
- package/template/{__PROJECT__ → overlays/story}/Resources/Stories/title/title_main.story +1 -1
- package/template/overlays/story/package.patch.json +17 -0
- package/template/overlays/tauri/README.md +6 -5
- package/template/overlays/tauri/package.patch.json +1 -4
- package/template/overlays/vue/src/main.ts +3 -0
- package/template/template-meta.json +5 -5
- package/template/overlays/tauri/src/main.ts +0 -101
- package/template/overlays/ts/Resources/project.json +0 -8
- package/template/overlays/ts/package.patch.json +0 -13
- /package/template/{overlays/ts → __PROJECT__}/Resources/Stories/title/look_around.json +0 -0
- /package/template/{overlays/ts → __PROJECT__}/Resources/Stories/title/title_main.json +0 -0
- /package/template/{overlays/ts → __PROJECT__}/src/Stories.src/config.ts +0 -0
- /package/template/{overlays/ts → __PROJECT__}/src/Stories.src/title/look_around.ts +0 -0
- /package/template/{overlays/ts → __PROJECT__}/src/Stories.src/title/title_main.ts +0 -0
- /package/template/{overlays/ts → __PROJECT__}/src/gen/font.gen.d.ts +0 -0
- /package/template/{overlays/ts → __PROJECT__}/src/gen/script.gen.d.ts +0 -0
- /package/template/{overlays/ts → __PROJECT__}/src/gen/state.gen.d.ts +0 -0
- /package/template/{overlays/ts → __PROJECT__}/src/gen/stories.gen.d.ts +0 -0
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 本宿主**不依赖任何 UI 框架**——这是「引擎框架无关」的活证明:渲染直接操作 DOM,
|
|
5
5
|
* 换成 Vue / React / 其他只改本文件与 index.html,引擎与适配器零改动。
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* 页面结构与这里的节点解析始终成对:桌面壳只补 `src-tauri/`,不自带组合根,
|
|
7
|
+
* 故 `-f` 选什么框架都不影响「`must` 与 index.html 同源」这条前提。
|
|
8
8
|
*
|
|
9
9
|
* 本文件只做三件事,实现都在 `host/` 里:
|
|
10
10
|
* 1. 解析页面节点(`must` 调用点集中在此,与 index.html 的 id 互锁一眼可见);
|
|
@@ -23,6 +23,7 @@ import { MANIFEST_FILE } from "@lingfan-engine/core";
|
|
|
23
23
|
import { DEFAULT_TEXT_CPS, DEFAULT_TOAST_MS } from "@lingfan-engine/ui";
|
|
24
24
|
import {
|
|
25
25
|
bootHost,
|
|
26
|
+
createNativePorts,
|
|
26
27
|
must,
|
|
27
28
|
optional,
|
|
28
29
|
reportBootFailure,
|
|
@@ -69,6 +70,8 @@ void bootHost({
|
|
|
69
70
|
stories: STORIES,
|
|
70
71
|
defaultCps: DEFAULT_TEXT_CPS,
|
|
71
72
|
toastDurationMs: DEFAULT_TOAST_MS,
|
|
73
|
+
// 桌面壳里换成原生存档端口;浏览器里返回 undefined,端口走 Web 缺省实现
|
|
74
|
+
ports: createNativePorts(),
|
|
72
75
|
// 偏好面板槽位:页面给了就装(`optional` 已消化「这层不给」的情况)
|
|
73
76
|
prefsContainer: dom.prefs,
|
|
74
77
|
// 历史面板槽位:给了就有「历史」按钮与回溯(点一条即回到那个检查点)
|
|
@@ -21,5 +21,8 @@
|
|
|
21
21
|
"noUnusedParameters": true,
|
|
22
22
|
"noFallthroughCasesInSwitch": true
|
|
23
23
|
},
|
|
24
|
-
|
|
24
|
+
/* 两份都要进本工程:故事源 + 生成物类型面(state / script / font / stories 四份
|
|
25
|
+
gen 声明)。它们是 ambient 全局,不进程序就等于不存在——章节里裸写
|
|
26
|
+
script.bgm / state.player 会报未定义。 */
|
|
27
|
+
"include": ["src/Stories.src/**/*.ts", "src/gen/**/*.ts"]
|
|
25
28
|
}
|
|
@@ -2,25 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
每个子目录是一层可选的工程内容,目录名就是 `template-meta.json` 里 `frameworks[]` / `sources[]` / `shells[]` 的 `id`。
|
|
4
4
|
生成器按「骨架 → 框架层 → 故事源层 → 壳层」的顺序合并,同路径文件由后一层覆盖前一层。
|
|
5
|
+
故事源层的两个 id 不对称:缺省 `ts` 没有目录(链在骨架里),可选 `story` 有目录(要摘掉那条链)。
|
|
5
6
|
|
|
6
7
|
## 缺省项没有目录
|
|
7
8
|
|
|
8
|
-
`none`(框架无关)、`
|
|
9
|
-
|
|
9
|
+
`none`(框架无关)、`ts`(TypeScript 源)与 `browser`(浏览器)表示「这一层什么都不加」,所以这里看不到它们。
|
|
10
|
+
缺目录不是错误,只是没有内容可叠:缺省故事源形态的整条创作链(`src/Stories.src/`、`src/gen/*.gen.d.ts`、
|
|
11
|
+
`tsconfig.stories.json`、三条 `stories:*` 脚本)都在骨架里,生成时不需要再叠任何东西。
|
|
10
12
|
|
|
11
13
|
## 现有层
|
|
12
14
|
|
|
13
|
-
- `
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
`
|
|
21
|
-
并用 `create.remove` 删掉骨架那份手写故事(产物目录由构建全量管理,两套并存会把 `.story` 当陈旧列清掉)。
|
|
22
|
-
故事清单不归本层管:骨架的 `vite.plugins.ts` 扫 `Resources/Stories/`,产物 `.json` 落在同一棵树里,
|
|
23
|
-
自动进清单——层不需要也不应该覆盖 `src/stories/index.ts`。
|
|
15
|
+
- `story/` —— 故事源层,与缺省形态反向:只换故事素材、不碰页面。骨架缺省是 TS 创作链,这一层用
|
|
16
|
+
`create.remove` 把它整条摘掉(`src/Stories.src`、`src/gen/{font,script,state,stories}.gen.d.ts`、
|
|
17
|
+
`tsconfig.stories.json`),换上一份手写的 `Resources/Stories/title/title_main.story`,改完保存即生效。
|
|
18
|
+
`create.remove` 只认精确路径与目录子树,没有通配符,所以四份 `.gen.d.ts` 要逐个点名。
|
|
19
|
+
骨架那三条 `stories:*` 脚本与 `@lingfan-engine/editor` 依赖由 `create.unset` 一并摘掉
|
|
20
|
+
(`mergeManifest` 对依赖表是「新增或覆盖」,删键要靠 `unset` 显式点名)。
|
|
21
|
+
故事清单不归本层管:骨架的 `vite.plugins.ts` 扫 `Resources/Stories/`,`.story` 与 `.json` 都进清单,
|
|
22
|
+
层不需要也不应该覆盖 `src/stories/index.ts`。
|
|
24
23
|
- `vue/` —— 页面结构换成单文件组件:`index.html` 变成挂载点,新增 `src/App.vue` 与 Vue 版组合根,
|
|
25
24
|
`package.patch.json` 补 `vue` / `@vitejs/plugin-vue` / `vue-tsc`,并把 `typecheck` 换成
|
|
26
25
|
`vue-tsc --noEmit && tsc --noEmit -p tsconfig.node.json`。`src/host/**` 一行不改,
|
|
@@ -69,11 +68,26 @@
|
|
|
69
68
|
数组与标量整体取代——数组拼接会得到既非骨架也非叠加层的第三种值。
|
|
70
69
|
- `create.remove`(写在同一份 `package.patch.json` 里):字符串数组,点在它之前各层里的路径
|
|
71
70
|
(文件或目录,目录写不带尾斜杠也行),本层写入前先删掉它们。用来清掉换形态后不再需要的骨架文件。
|
|
71
|
+
- `create.unset`(写在同一份 `package.patch.json` 里):对象,外层是 `package.json` 的字段名
|
|
72
|
+
(`scripts`、`devDependencies` 等),内层是要去掉的键名数组。`create.remove` 只能删文件,
|
|
73
|
+
清单里的键要靠它——比如反向叠加层摘掉 TS 创作链之后,配套的 `stories:*` 命令与创作期依赖
|
|
74
|
+
也应当一起消失,否则产物里留着一个指向已删除目录、必然失败的命令。
|
|
72
75
|
|
|
73
76
|
```json
|
|
74
77
|
{ "create": { "remove": ["src/host", "src/styles"] } }
|
|
75
78
|
```
|
|
76
79
|
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"create": {
|
|
83
|
+
"unset": {
|
|
84
|
+
"scripts": ["stories:build"],
|
|
85
|
+
"devDependencies": ["@lingfan-engine/editor"]
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
77
91
|
新增依赖只写进 `package.patch.json`,不要复制整份 `package.json`:整份复制会让骨架后来加的字段
|
|
78
92
|
在这一层永久丢失。生成器会在合并之后统一查一次 registry,把依赖写成当下最新的 `^x.y.z`。
|
|
79
93
|
|
|
@@ -15,6 +15,7 @@ import { MANIFEST_FILE } from "@lingfan-engine/core";
|
|
|
15
15
|
import { DEFAULT_TEXT_CPS, DEFAULT_TOAST_MS } from "@lingfan-engine/ui";
|
|
16
16
|
import {
|
|
17
17
|
bootHost,
|
|
18
|
+
createNativePorts,
|
|
18
19
|
must,
|
|
19
20
|
optional,
|
|
20
21
|
reportBootFailure,
|
|
@@ -92,6 +93,8 @@ if (dom !== undefined) {
|
|
|
92
93
|
stories: STORIES,
|
|
93
94
|
defaultCps: DEFAULT_TEXT_CPS,
|
|
94
95
|
toastDurationMs: DEFAULT_TOAST_MS,
|
|
96
|
+
// 桌面壳里换成原生存档端口;浏览器里返回 undefined,端口走 Web 缺省实现
|
|
97
|
+
ports: createNativePorts(),
|
|
95
98
|
historyContainer: dom.history,
|
|
96
99
|
prefsContainer: dom.prefs,
|
|
97
100
|
// UI 挂载落法由 React 接管:`#mounts` 的子节点归 `UiHost` 渲染,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// __PROJECT__ 示例工程(文本形态 = JSON v1 的投影)
|
|
2
2
|
// 资源路径相对项目资源根 Resources/:如 bgm "Audio/main.mp3"
|
|
3
|
-
// 一个文件里可以写多列(label / scene
|
|
3
|
+
// 一个文件里可以写多列(label / scene);拆文件直接放进 Resources/Stories/ 下,构建期扫描自动收录。
|
|
4
4
|
|
|
5
5
|
// 标题界面:`type=ui` 的列不进历史、不进存档、不建检查点——它是界面,不是剧情。
|
|
6
6
|
// 引擎对这类列只管一件事:按 op 渲染(say 出一句、menu 出一组选项),所以下面几条开箱即跑,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"create": {
|
|
3
|
+
"remove": [
|
|
4
|
+
"Resources/Stories",
|
|
5
|
+
"src/Stories.src",
|
|
6
|
+
"src/gen/font.gen.d.ts",
|
|
7
|
+
"src/gen/script.gen.d.ts",
|
|
8
|
+
"src/gen/state.gen.d.ts",
|
|
9
|
+
"src/gen/stories.gen.d.ts",
|
|
10
|
+
"tsconfig.stories.json"
|
|
11
|
+
],
|
|
12
|
+
"unset": {
|
|
13
|
+
"scripts": ["stories:build", "stories:watch", "stories-typecheck"],
|
|
14
|
+
"devDependencies": ["@lingfan-engine/editor"]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# 桌面壳层(Tauri 2)
|
|
2
2
|
|
|
3
3
|
这一层是**壳**,不是框架层:页面结构沿用骨架那一份,`index.html` 与 `vite.config.ts` 原样保留。
|
|
4
|
-
加进来的只有工程根下的 `src-tauri
|
|
5
|
-
|
|
4
|
+
加进来的只有工程根下的 `src-tauri/` 和一份清单补丁——**不带组合根**:入口与页面结构
|
|
5
|
+
永远归属框架层,否则 `-f vue` / `-f react` 时壳层的节点解析会与框架层渲染的页面错配。
|
|
6
|
+
桥的装配在骨架 `src/host/native-ports.ts`,由各形态的组合根统一调用。
|
|
6
7
|
|
|
7
8
|
## 内容
|
|
8
9
|
|
|
9
10
|
- `src-tauri/Cargo.toml`、`build.rs`、`tauri.conf.json`、`capabilities/default.json`
|
|
10
11
|
- `src-tauri/src/`:`main.rs`(转发到库入口)、`lib.rs`(装配与命令注册)、`save.rs`、`preferences.rs`
|
|
11
|
-
- `
|
|
12
|
-
- `package.patch.json`:补 `@tauri-apps/api`(运行时)与 `@tauri-apps/cli`(命令行),加 `tauri` 脚本
|
|
12
|
+
- `package.patch.json`:补 `@tauri-apps/cli`(命令行)与 `tauri` 脚本
|
|
13
13
|
|
|
14
14
|
窗口 1280×720,标题取工程名;`frontendDist` 指向 `../dist`,开发期 `devUrl` 指向
|
|
15
15
|
`http://localhost:1420`(与骨架 `vite.config.ts` 的 `server.port` 一致),所以 `beforeDevCommand`
|
|
@@ -45,7 +45,8 @@
|
|
|
45
45
|
|
|
46
46
|
资源加密、媒体 HTTP 服务、zip 索引、工程写回、开发期 WS——这些在参考宿主里有实现,
|
|
47
47
|
本层不带。要加密或媒体服务的工程自己加:能力以端口 + 适配器成对出现,
|
|
48
|
-
|
|
48
|
+
壳层只负责把端口接到原生侧(插口是 `bootHost` 的 `ports` 选项,
|
|
49
|
+
现有的原生存档端口见骨架 `src/host/native-ports.ts`)。
|
|
49
50
|
|
|
50
51
|
## 怎么用
|
|
51
52
|
|
|
@@ -2,13 +2,10 @@
|
|
|
2
2
|
"scripts": {
|
|
3
3
|
"tauri": "tauri"
|
|
4
4
|
},
|
|
5
|
-
"dependencies": {
|
|
6
|
-
"@tauri-apps/api": "^2"
|
|
7
|
-
},
|
|
8
5
|
"devDependencies": {
|
|
9
6
|
"@tauri-apps/cli": "^2"
|
|
10
7
|
},
|
|
11
8
|
"create": {
|
|
12
|
-
"pinned": ["@tauri-apps/cli"
|
|
9
|
+
"pinned": ["@tauri-apps/cli"]
|
|
13
10
|
}
|
|
14
11
|
}
|
|
@@ -13,6 +13,7 @@ import { MANIFEST_FILE } from "@lingfan-engine/core";
|
|
|
13
13
|
import { DEFAULT_TEXT_CPS, DEFAULT_TOAST_MS } from "@lingfan-engine/ui";
|
|
14
14
|
import {
|
|
15
15
|
bootHost,
|
|
16
|
+
createNativePorts,
|
|
16
17
|
must,
|
|
17
18
|
optional,
|
|
18
19
|
reportBootFailure,
|
|
@@ -76,6 +77,8 @@ if (dom !== undefined) {
|
|
|
76
77
|
stories: STORIES,
|
|
77
78
|
defaultCps: DEFAULT_TEXT_CPS,
|
|
78
79
|
toastDurationMs: DEFAULT_TOAST_MS,
|
|
80
|
+
// 桌面壳里换成原生存档端口;浏览器里返回 undefined,端口走 Web 缺省实现
|
|
81
|
+
ports: createNativePorts(),
|
|
79
82
|
prefsContainer: dom.prefs,
|
|
80
83
|
// 历史面板槽位:给了就有「历史」按钮与回溯
|
|
81
84
|
historyContainer: dom.history,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.10.0",
|
|
3
3
|
"minEngineVersion": "0.3.2",
|
|
4
4
|
"placeholder": "__PROJECT__",
|
|
5
5
|
"frameworks": [
|
|
@@ -33,20 +33,20 @@
|
|
|
33
33
|
{
|
|
34
34
|
"id": "tauri",
|
|
35
35
|
"label": "桌面(Tauri 2)",
|
|
36
|
-
"hint": "
|
|
36
|
+
"hint": "给同一份工程再加一个桌面壳:存档落到应用数据目录,页面结构不变"
|
|
37
37
|
}
|
|
38
38
|
],
|
|
39
39
|
"sources": [
|
|
40
40
|
{
|
|
41
41
|
"id": "ts",
|
|
42
42
|
"label": "TypeScript 源(Stories.src)",
|
|
43
|
-
"hint": "
|
|
43
|
+
"hint": "骨架自带:用 TS 写故事列,有类型补全与重构,构建时编译成故事文件"
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
46
|
"id": "story",
|
|
47
47
|
"label": "故事文件(.story)",
|
|
48
|
-
"hint": "
|
|
48
|
+
"hint": "直接写引擎自带的文本故事格式:叠在骨架上,摘掉 TS 创作链,改完保存即生效"
|
|
49
49
|
}
|
|
50
50
|
],
|
|
51
|
-
"_comment": "模板版本唯一来源,独立于引擎版本:仅当 template/v1 内容真正变化时才手动 bump。placeholder 是目录/文件内的工程名占位符,生成时整体替换为工程名(对齐 _LingFanEngineTemplateTitle_ 占位符语义)。minEngineVersion 表示此模板要求的最低引擎版本——生成期会拿它跟 registry 上的实际版本比对,不达标即失败(离线查不到版本时跳过判定)。frameworks / shells / sources 决定生成器会问什么、能叠哪些层,各自首项为缺省值;每一项的 id 对应 template/v1/overlays/<id>
|
|
51
|
+
"_comment": "模板版本唯一来源,独立于引擎版本:仅当 template/v1 内容真正变化时才手动 bump。placeholder 是目录/文件内的工程名占位符,生成时整体替换为工程名(对齐 _LingFanEngineTemplateTitle_ 占位符语义)。minEngineVersion 表示此模板要求的最低引擎版本——生成期会拿它跟 registry 上的实际版本比对,不达标即失败(离线查不到版本时跳过判定)。frameworks / shells / sources 决定生成器会问什么、能叠哪些层,各自首项为缺省值;每一项的 id 对应 template/v1/overlays/<id> 目录(缺省层可以没有目录——缺省故事源 `ts` 就是这样:整条创作链在骨架里,不需要叠加层)。合并顺序为「骨架 → 框架 → 故事源 → 壳」,同路径文件由后一层覆盖前一层。"
|
|
52
52
|
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 组合根(桌面壳形态):与骨架只差两处——先装宿主桥,再把存档端口换成 Rust 实现。
|
|
3
|
-
*
|
|
4
|
-
* 为什么先装桥:`@lingfan-engine/adapters` 是给外部工程消费的源码包,包内不写
|
|
5
|
-
* `@tauri-apps/api` 的模块名(写了会让纯 Web 形态在构建期解析失败,写成变量说明符又会在
|
|
6
|
-
* 产物里残留裸模块名、WebView 执行时抛错)。模块名留在本文件这一层——本工程有这个依赖,
|
|
7
|
-
* 且只在壳里跑到这里;`installTauriBridge` 把两个函数交给适配器,之后各端口工厂的
|
|
8
|
-
* 缺省实现才可用。
|
|
9
|
-
*
|
|
10
|
-
* 为什么换存档:WebView 的 `localStorage` 落在系统给这个应用分配的 WebView 数据目录里,
|
|
11
|
-
* 清缓存、换系统账户、重装都会带走存档;桌面工程的存档应当是可指路径上的文件。
|
|
12
|
-
* 换法是把端口交给 `bootHost` 的 `ports.saves`,装配顺序与其余接线一行不改。
|
|
13
|
-
*
|
|
14
|
-
* 工程文件与资源**不换**:骨架的 `vite.config.ts` 把 `Resources/` 当静态根,
|
|
15
|
-
* 打包时这些文件被复制进 `dist/`,所以打包后 `/project.json`、`/Stories/**`、
|
|
16
|
-
* `/Audio/x.mp3` 仍按同一套路径取得到——桌面壳不需要为此多造一组 Rust 命令。
|
|
17
|
-
*
|
|
18
|
-
* 页面结构沿用骨架的 `index.html`(本层不带自己的),故节点解析与骨架同源。
|
|
19
|
-
*/
|
|
20
|
-
import { MANIFEST_FILE } from "@lingfan-engine/core";
|
|
21
|
-
import { DEFAULT_TEXT_CPS, DEFAULT_TOAST_MS } from "@lingfan-engine/ui";
|
|
22
|
-
import {
|
|
23
|
-
createTauriSavePort,
|
|
24
|
-
installTauriBridge,
|
|
25
|
-
} from "@lingfan-engine/adapters";
|
|
26
|
-
import {
|
|
27
|
-
bootHost,
|
|
28
|
-
must,
|
|
29
|
-
optional,
|
|
30
|
-
reportBootFailure,
|
|
31
|
-
type StageDom,
|
|
32
|
-
} from "./host";
|
|
33
|
-
import { STORIES } from "./stories";
|
|
34
|
-
import { uis } from "./mounts";
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* 工程清单与故事文件:**都在应用资源根 `Resources/` 内**。
|
|
38
|
-
* 打包后它们位于 `dist/` 顶层,路径与开发期一致。
|
|
39
|
-
* 清单名取引擎契约里的 `MANIFEST_FILE`(组装、写回、定位资源根共用同一个声明);
|
|
40
|
-
* 故事表在 `./stories`(唯一出口,各形态共用),内容由构建期扫描资源根得出。
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
/** 页面节点句柄表:每个 id 都必须存在于 index.html(缺一个 `must` 当场抛) */
|
|
44
|
-
const dom: StageDom = {
|
|
45
|
-
root: must("#stage-root"),
|
|
46
|
-
stage: must("#stage"),
|
|
47
|
-
dialogue: must("#dialogue"),
|
|
48
|
-
speaker: must("#speaker"),
|
|
49
|
-
text: must("#text"),
|
|
50
|
-
hint: must("#hint"),
|
|
51
|
-
nvl: must("#nvl"),
|
|
52
|
-
choices: must("#choices"),
|
|
53
|
-
notifications: must("#notifications"),
|
|
54
|
-
toolbar: must("#toolbar"),
|
|
55
|
-
slot: must<HTMLSelectElement>("#slot"),
|
|
56
|
-
save: must<HTMLButtonElement>("#save"),
|
|
57
|
-
load: must<HTMLButtonElement>("#load"),
|
|
58
|
-
transition: must("#transition"),
|
|
59
|
-
error: must("#error"),
|
|
60
|
-
// 历史面板槽位(可选):骨架 index.html 里有,缺了也不影响启动
|
|
61
|
-
history: optional("#history"),
|
|
62
|
-
// 偏好面板槽位(可选):骨架 index.html 里有,缺了也不影响启动
|
|
63
|
-
prefs: optional("#prefs"),
|
|
64
|
-
// UI 挂载层槽位(可选):本层不给就 null,`mount` 命令只改状态、没有组件出现
|
|
65
|
-
mounts: optional("#mounts"),
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* 装配宿主桥并启动宿主。
|
|
70
|
-
*
|
|
71
|
-
* 静态说明符(不带 `@vite-ignore`)是刻意的:打包器据此把这两个模块打进产物,
|
|
72
|
-
* 运行期不再需要解析裸模块名。
|
|
73
|
-
*/
|
|
74
|
-
async function boot(): Promise<void> {
|
|
75
|
-
const [{ invoke }, { listen }] = await Promise.all([
|
|
76
|
-
import("@tauri-apps/api/core"),
|
|
77
|
-
import("@tauri-apps/api/event"),
|
|
78
|
-
]);
|
|
79
|
-
installTauriBridge({ invoke, listen });
|
|
80
|
-
|
|
81
|
-
await bootHost({
|
|
82
|
-
dom,
|
|
83
|
-
manifestFile: MANIFEST_FILE,
|
|
84
|
-
stories: STORIES,
|
|
85
|
-
defaultCps: DEFAULT_TEXT_CPS,
|
|
86
|
-
toastDurationMs: DEFAULT_TOAST_MS,
|
|
87
|
-
historyContainer: dom.history,
|
|
88
|
-
prefsContainer: dom.prefs,
|
|
89
|
-
// UI 挂载槽位:壳层用骨架的原生渲染器(本层不引框架,`#mounts` 的子节点由宿主写)
|
|
90
|
-
mountsContainer: dom.mounts,
|
|
91
|
-
mountsTable: uis,
|
|
92
|
-
ports: {
|
|
93
|
-
// 存档落到应用数据目录的 saves/ 下,一槽一文件(加密与回档保护在 Rust 侧扩展)
|
|
94
|
-
saves: createTauriSavePort(),
|
|
95
|
-
},
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
boot().catch((error: unknown) => {
|
|
100
|
-
reportBootFailure(dom, error);
|
|
101
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"devDependencies": {
|
|
3
|
-
"@lingfan-engine/editor": "^0.3.2"
|
|
4
|
-
},
|
|
5
|
-
"scripts": {
|
|
6
|
-
"stories:build": "lingfan-stories-build .",
|
|
7
|
-
"stories:watch": "lingfan-stories-watch .",
|
|
8
|
-
"stories-typecheck": "tsc --noEmit -p tsconfig.stories.json"
|
|
9
|
-
},
|
|
10
|
-
"create": {
|
|
11
|
-
"remove": ["Resources/Stories"]
|
|
12
|
-
}
|
|
13
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|