@lingfan-engine/create 0.3.5 → 0.3.7
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/package.json +1 -1
- package/template/overlays/miniprogram/tsconfig.json +5 -0
- package/template/overlays/react/src/Stories.src/title/look_around.ts +23 -0
- package/template/overlays/react/src/ui/hint/hint.tsx +30 -0
- package/template/overlays/react/tsconfig.json +5 -0
- package/template/overlays/vue/src/Stories.src/title/look_around.ts +23 -0
- package/template/overlays/vue/src/ui/hint/hint.vue +29 -0
- package/template/overlays/vue/tsconfig.json +5 -0
- package/template/template-meta.json +1 -1
package/package.json
CHANGED
|
@@ -15,5 +15,10 @@
|
|
|
15
15
|
"noUnusedParameters": true,
|
|
16
16
|
"noFallthroughCasesInSwitch": true
|
|
17
17
|
},
|
|
18
|
+
/* 故事源不吃本工程:它是独立的 TS 工程,由 tsconfig.stories.json 的纯 tsc 检查。
|
|
19
|
+
本文件要么是 vue-tsc(Vue 要 SFC 类型),要么带 jsx(React 要 .tsx)——
|
|
20
|
+
两者都会把故事源 import 的 *.vue / *.tsx 解析成真实组件,
|
|
21
|
+
盖过 authoring 声明的 UiHandle 通配,把 mount(句柄) 判成型不匹配。 */
|
|
22
|
+
"exclude": ["src/Stories.src/**"],
|
|
18
23
|
"include": ["src/**/*.ts", "src/**/*.vue", "vite.config.ts"]
|
|
19
24
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 这一列演示挂载界面:`mount(句柄, 显隐, props)`。
|
|
3
|
+
*
|
|
4
|
+
* 界面本体在 `src/ui/hint/hint.tsx`——目录名就是 UI 名,故事源默认导入它,
|
|
5
|
+
* 绑定名必须与目录名一致,构建期逐条校验。`props` 整份替换而不是逐字段合并,
|
|
6
|
+
* 值必须 JSON 安全(随快照存档),要操作引擎就走运行期注入的 `controls`。
|
|
7
|
+
*/
|
|
8
|
+
import { mount, script } from "@lingfan-engine/editor";
|
|
9
|
+
|
|
10
|
+
import hint from "../../ui/hint/hint.tsx";
|
|
11
|
+
|
|
12
|
+
const { say } = script;
|
|
13
|
+
|
|
14
|
+
export const columnType = "ui";
|
|
15
|
+
|
|
16
|
+
export default function look_around(): void {
|
|
17
|
+
mount(hint, true, { text: "提示条从这一列的 mount 调用挂上来" });
|
|
18
|
+
say("你绕着走了一圈,什么也没发生。", "旁白");
|
|
19
|
+
say(
|
|
20
|
+
"提示条是 src/ui/hint/hint.tsx,挂载语句在 src/Stories.src/title/look_around.ts。",
|
|
21
|
+
"旁白",
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 常驻提示条:一块贴在舞台上沿的只读小牌子。
|
|
3
|
+
*
|
|
4
|
+
* 三条约定与宿主形态无关——样式内联、不依赖 stage.css;只读部分设
|
|
5
|
+
* `pointerEvents: "none"`,不吃舞台上的点击;不读引擎状态(显隐由 `mount` 决定,
|
|
6
|
+
* 文案由 `props` 给,操作走 `controls`)。
|
|
7
|
+
*/
|
|
8
|
+
export default function Hint(props: { text?: string }) {
|
|
9
|
+
const text = props.text ?? "";
|
|
10
|
+
if (text === "") return null;
|
|
11
|
+
return (
|
|
12
|
+
<div
|
|
13
|
+
role="status"
|
|
14
|
+
style={{
|
|
15
|
+
position: "absolute",
|
|
16
|
+
top: "1rem",
|
|
17
|
+
left: "50%",
|
|
18
|
+
transform: "translateX(-50%)",
|
|
19
|
+
padding: "0.25rem 0.75rem",
|
|
20
|
+
borderRadius: "999px",
|
|
21
|
+
background: "rgba(0, 0, 0, 0.55)",
|
|
22
|
+
color: "#f4f1e8",
|
|
23
|
+
fontSize: "0.875rem",
|
|
24
|
+
pointerEvents: "none",
|
|
25
|
+
}}
|
|
26
|
+
>
|
|
27
|
+
{text}
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -16,5 +16,10 @@
|
|
|
16
16
|
"noUnusedParameters": true,
|
|
17
17
|
"noFallthroughCasesInSwitch": true
|
|
18
18
|
},
|
|
19
|
+
/* 故事源不吃本工程:它是独立的 TS 工程,由 tsconfig.stories.json 的纯 tsc 检查。
|
|
20
|
+
本文件要么是 vue-tsc(Vue 要 SFC 类型),要么带 jsx(React 要 .tsx)——
|
|
21
|
+
两者都会把故事源 import 的 *.vue / *.tsx 解析成真实组件,
|
|
22
|
+
盖过 authoring 声明的 UiHandle 通配,把 mount(句柄) 判成型不匹配。 */
|
|
23
|
+
"exclude": ["src/Stories.src/**"],
|
|
19
24
|
"include": ["src/**/*.ts", "src/**/*.tsx"]
|
|
20
25
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 这一列演示挂载界面:`mount(句柄, 显隐, props)`。
|
|
3
|
+
*
|
|
4
|
+
* 界面本体在 `src/ui/hint/hint.vue`——目录名就是 UI 名,故事源默认导入它,
|
|
5
|
+
* 绑定名必须与目录名一致,构建期逐条校验。`props` 整份替换而不是逐字段合并,
|
|
6
|
+
* 值必须 JSON 安全(随快照存档),要操作引擎就走运行期注入的 `controls`。
|
|
7
|
+
*/
|
|
8
|
+
import { mount, script } from "@lingfan-engine/editor";
|
|
9
|
+
|
|
10
|
+
import hint from "../../ui/hint/hint.vue";
|
|
11
|
+
|
|
12
|
+
const { say } = script;
|
|
13
|
+
|
|
14
|
+
export const columnType = "ui";
|
|
15
|
+
|
|
16
|
+
export default function look_around(): void {
|
|
17
|
+
mount(hint, true, { text: "提示条从这一列的 mount 调用挂上来" });
|
|
18
|
+
say("你绕着走了一圈,什么也没发生。", "旁白");
|
|
19
|
+
say(
|
|
20
|
+
"提示条是 src/ui/hint/hint.vue,挂载语句在 src/Stories.src/title/look_around.ts。",
|
|
21
|
+
"旁白",
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
常驻提示条:一块贴在舞台上沿的只读小牌子。
|
|
3
|
+
|
|
4
|
+
三条约定与宿主形态无关——自带 scoped 样式、不依赖 stage.css;只读部分设
|
|
5
|
+
`pointer-events: none`,不吃舞台上的点击;不读引擎状态(显隐由 `mount` 决定,
|
|
6
|
+
文案由 `props` 给,操作走 `controls`)。
|
|
7
|
+
-->
|
|
8
|
+
<script setup lang="ts">
|
|
9
|
+
withDefaults(defineProps<{ text?: string }>(), { text: "" });
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<div v-if="text !== ''" class="hint" role="status">{{ text }}</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<style scoped>
|
|
17
|
+
.hint {
|
|
18
|
+
position: absolute;
|
|
19
|
+
top: 1rem;
|
|
20
|
+
left: 50%;
|
|
21
|
+
transform: translateX(-50%);
|
|
22
|
+
padding: 0.25rem 0.75rem;
|
|
23
|
+
border-radius: 999px;
|
|
24
|
+
background: rgb(0 0 0 / 55%);
|
|
25
|
+
color: #f4f1e8;
|
|
26
|
+
font-size: 0.875rem;
|
|
27
|
+
pointer-events: none;
|
|
28
|
+
}
|
|
29
|
+
</style>
|
|
@@ -15,5 +15,10 @@
|
|
|
15
15
|
"noUnusedParameters": true,
|
|
16
16
|
"noFallthroughCasesInSwitch": true
|
|
17
17
|
},
|
|
18
|
+
/* 故事源不吃本工程:它是独立的 TS 工程,由 tsconfig.stories.json 的纯 tsc 检查。
|
|
19
|
+
本文件要么是 vue-tsc(Vue 要 SFC 类型),要么带 jsx(React 要 .tsx)——
|
|
20
|
+
两者都会把故事源 import 的 *.vue / *.tsx 解析成真实组件,
|
|
21
|
+
盖过 authoring 声明的 UiHandle 通配,把 mount(句柄) 判成型不匹配。 */
|
|
22
|
+
"exclude": ["src/Stories.src/**"],
|
|
18
23
|
"include": ["src/**/*.ts", "src/**/*.vue"]
|
|
19
24
|
}
|