docs: 修复构建问题

This commit is contained in:
unanmed 2025-08-20 15:31:11 +08:00
parent 66ec8190c9
commit 2d1ede21cd
9 changed files with 104 additions and 107 deletions

1
.gitignore vendored
View File

@ -52,3 +52,4 @@ graph.svg
docs/.vitepress/cache docs/.vitepress/cache
docs/.vitepress/dist docs/.vitepress/dist
docs/.vitepress/apiSidebar.ts docs/.vitepress/apiSidebar.ts
_docs

View File

@ -1,6 +1,7 @@
import { defineConfig } from 'vitepress'; import { defineConfig } from 'vitepress';
import { MermaidMarkdown, MermaidPlugin } from 'vitepress-plugin-mermaid'; import { MermaidMarkdown, MermaidPlugin } from 'vitepress-plugin-mermaid';
import api from './apiSidebar'; import api from './apiSidebar';
import { join } from 'path';
// https://vitepress.dev/reference/site-config // https://vitepress.dev/reference/site-config
export default defineConfig({ export default defineConfig({
@ -13,6 +14,7 @@ export default defineConfig({
md.use(MermaidMarkdown); md.use(MermaidMarkdown);
} }
}, },
outDir: join(process.cwd(), 'public', '_docs'),
themeConfig: { themeConfig: {
// https://vitepress.dev/reference/default-theme-config // https://vitepress.dev/reference/default-theme-config
outline: [2, 3], outline: [2, 3],

View File

@ -4,29 +4,28 @@ lang: zh-CN
# API 列表 # API 列表
- [@motajs/client](./motajs-client) 渲染层代码 - [@motajs/client](./motajs-client/index.md) 渲染层代码
- [@motajs/client-base](./motajs-client-base) 渲染层底层代码 - [@motajs/client-base](./motajs-client-base/index.md) 渲染层底层代码
- [@motajs/common](./motajs-common) 渲染层和数据层通用代码 - [@motajs/common](./motajs-common/index.md) 渲染层和数据层通用代码
- [@motajs/legacy-client](./motajs-legacy-client) 遗留渲染层代码 - [@motajs/legacy-client](./motajs-legacy-client/index.md) 遗留渲染层代码
- [@motajs/legacy-common](./motajs-legacy-common) 遗留通用代码 - [@motajs/legacy-common](./motajs-legacy-common/index.md) 遗留通用代码
- [@motajs/legacy-data](./motajs-legacy-data) 遗留数据层代码 - [@motajs/legacy-system](./motajs-legacy-system/index.md) 遗留渲染层系统代码
- [@motajs/legacy-system](./motajs-legacy-system) 遗留渲染层系统代码 - [@motajs/legacy-ui](./motajs-legacy-ui/index.md) 遗留 UI 相关代码
- [@motajs/legacy-ui](./motajs-legacy-ui) 遗留 UI 相关代码 - [@motajs/render](./motajs-render/index.md) 渲染系统代码
- [@motajs/render](./motajs-render) 渲染系统代码 - [@motajs/render-core](./motajs-render-core/index.md) 渲染系统核心代码
- [@motajs/render-core](./motajs-render-core) 渲染系统核心代码 - [@motajs/render-elements](./motajs-render-elements/index.md) 渲染系统内置元素代码
- [@motajs/render-elements](./motajs-render-elements) 渲染系统内置元素代码 - [@motajs/render-style](./motajs-render-style/index.md) 渲染系统样式代码
- [@motajs/render-style](./motajs-render-style) 渲染系统样式代码 - [@motajs/render-vue](./motajs-render-vue/index.md) 渲染系统 vue 支持代码
- [@motajs/render-vue](./motajs-render-vue) 渲染系统 vue 支持代码 - [@motajs/system](./motajs-system/index.md) 渲染层系统代码
- [@motajs/system](./motajs-system) 渲染层系统代码 - [@motajs/system-action](./motajs-system-action/index.md) 渲染层交互系统代码
- [@motajs/system-action](./motajs-system-action) 渲染层交互系统代码 - [@motajs/system-ui](./motajs-system-ui/index.md) 渲染层 UI 系统代码
- [@motajs/system-ui](./motajs-system-ui) 渲染层 UI 系统代码 - [@motajs/types](./motajs-types/index.md) 渲染层类型代码
- [@motajs/types](./motajs-types) 渲染层类型代码 - [@user/client-modules](./user-client-modules/index.md) 用户渲染层主要代码
- [@user/client-modules](./user-client-modules) 用户渲染层主要代码 - [@user/data-base](./user-data-base/index.md) 用户数据层底层代码
- [@user/data-base](./user-data-base) 用户数据层底层代码 - [@user/data-fallback](./user-data-fallback/index.md) 用户数据层向后兼容代码
- [@user/data-fallback](./user-data-fallback) 用户数据层向后兼容代码 - [@user/data-state](./user-data-state/index.md) 用户数据层状态代码
- [@user/data-state](./user-data-state) 用户数据层状态代码 - [@user/data-utils](./user-data-utils/index.md) 用户数据层工具代码
- [@user/data-utils](./user-data-utils) 用户数据层工具代码 - [@user/entry-client](./user-entry-client/index.md) 用户渲染层入口
- [@user/entry-client](./user-entry-client) 用户渲染层入口 - [@user/entry-data](./user-entry-data/index.md) 用户数据层入口
- [@user/entry-data](./user-entry-data) 用户数据层入口 - [@user/legacy-plugin-client](./user-legacy-plugin-client/index.md) 用户遗留渲染层代码
- [@user/legacy-plugin-client](./user-legacy-plugin-client) 用户遗留渲染层代码 - [@user/legacy-plugin-data](./user-legacy-plugin-data/index.md) 用户遗留数据层代码
- [@user/legacy-plugin-data](./user-legacy-plugin-data) 用户遗留数据层代码

View File

@ -127,7 +127,7 @@ return () => (
### 大数据量处理方案 ### 大数据量处理方案
考虑使用[滚动条](../user-client-modules/Scroll.md)或[分页](../user-client-modules/Page.md)组件。 考虑使用[滚动条](../user-client-modules/组件 Scroll.md)或[分页](../user-client-modules/组件 Page.md)组件。
--- ---

View File

@ -156,5 +156,5 @@ import { Font } from '@motajs/render-style';
## 注意事项 ## 注意事项
1. 如果需要显示多行文本,考虑使用 [TextContent](../user-client-modules/TextContent.md) 1. 如果需要显示多行文本,考虑使用 [TextContent](../user-client-modules/组件 TextContent.md)
2. 考虑到浏览器兼容性,不建议在颜色中填写一些新标准的语法,例如 `rgb(0.3, 0.6, 0.8 / 0.6)` `#rgba` 2. 考虑到浏览器兼容性,不建议在颜色中填写一些新标准的语法,例如 `rgb(0.3, 0.6, 0.8 / 0.6)` `#rgba`

View File

@ -10,32 +10,31 @@ lang: zh-CN
2.B 样板现在已经迁移至了 monorepo将代码模块化共分为 20 余个模块,每个模块的具体内容可以参考 API 文档,模块列表如下: 2.B 样板现在已经迁移至了 monorepo将代码模块化共分为 20 余个模块,每个模块的具体内容可以参考 API 文档,模块列表如下:
- [@motajs/client](../api/motajs-client) 渲染层代码 - [@motajs/client](../api/motajs-client/index.md) 渲染层代码
- [@motajs/client-base](../api/motajs-client-base) 渲染层底层代码 - [@motajs/client-base](../api/motajs-client-base/index.md) 渲染层底层代码
- [@motajs/common](../api/motajs-common) 渲染层和数据层通用代码 - [@motajs/common](../api/motajs-common/index.md) 渲染层和数据层通用代码
- [@motajs/legacy-client](../api/motajs-legacy-client) 遗留渲染层代码 - [@motajs/legacy-client](../api/motajs-legacy-client/index.md) 遗留渲染层代码
- [@motajs/legacy-common](../api/motajs-legacy-common) 遗留通用代码 - [@motajs/legacy-common](../api/motajs-legacy-common/index.md) 遗留通用代码
- [@motajs/legacy-data](../api/motajs-legacy-data) 遗留数据层代码 - [@motajs/legacy-system](../api/motajs-legacy-system/index.md) 遗留渲染层系统代码
- [@motajs/legacy-system](../api/motajs-legacy-system) 遗留渲染层系统代码 - [@motajs/legacy-ui](../api/motajs-legacy-ui/index.md) 遗留 UI 相关代码
- [@motajs/legacy-ui](../api/motajs-legacy-ui) 遗留 UI 相关代码 - [@motajs/render](../api/motajs-render/index.md) 渲染系统代码
- [@motajs/render](../api/motajs-render) 渲染系统代码 - [@motajs/render-core](../api/motajs-render-core/index.md) 渲染系统核心代码
- [@motajs/render-core](../api/motajs-render-core) 渲染系统核心代码 - [@motajs/render-elements](../api/motajs-render-elements/index.md) 渲染系统内置元素代码
- [@motajs/render-elements](../api/motajs-render-elements) 渲染系统内置元素代码 - [@motajs/render-style](../api/motajs-render-style/index.md) 渲染系统样式代码
- [@motajs/render-style](../api/motajs-render-style) 渲染系统样式代码 - [@motajs/render-vue](../api/motajs-render-vue/index.md) 渲染系统 vue 支持代码
- [@motajs/render-vue](../api/motajs-render-vue) 渲染系统 vue 支持代码 - [@motajs/system](../api/motajs-system/index.md) 渲染层系统代码
- [@motajs/system](../api/motajs-system) 渲染层系统代码 - [@motajs/system-action](../api/motajs-system-action/index.md) 渲染层交互系统代码
- [@motajs/system-action](../api/motajs-system-action) 渲染层交互系统代码 - [@motajs/system-ui](../api/motajs-system-ui/index.md) 渲染层 UI 系统代码
- [@motajs/system-ui](../api/motajs-system-ui) 渲染层 UI 系统代码 - [@motajs/types](../api/motajs-types/index.md) 渲染层类型代码
- [@motajs/types](../api/motajs-types) 渲染层类型代码 - [@user/client-modules](../api/user-client-modules/index.md) 用户渲染层主要代码
- [@user/client-modules](../api/user-client-modules) 用户渲染层主要代码 - [@user/data-base](../api/user-data-base/index.md) 用户数据层底层代码
- [@user/data-base](../api/user-data-base) 用户数据层底层代码 - [@user/data-fallback](../api/user-data-fallback/index.md) 用户数据层向后兼容代码
- [@user/data-fallback](../api/user-data-fallback) 用户数据层向后兼容代码 - [@user/data-state](../api/user-data-state/index.md) 用户数据层状态代码
- [@user/data-state](../api/user-data-state) 用户数据层状态代码 - [@user/data-utils](../api/user-data-utils/index.md) 用户数据层工具代码
- [@user/data-utils](../api/user-data-utils) 用户数据层工具代码 - [@user/entry-client](../api/user-entry-client/index.md) 用户渲染层入口
- [@user/entry-client](../api/user-entry-client) 用户渲染层入口 - [@user/entry-data](../api/user-entry-data/index.md) 用户数据层入口
- [@user/entry-data](../api/user-entry-data) 用户数据层入口 - [@user/legacy-plugin-client](../api/user-legacy-plugin-client/index.md) 用户遗留渲染层代码
- [@user/legacy-plugin-client](../api/user-legacy-plugin-client) 用户遗留渲染层代码 - [@user/legacy-plugin-data](../api/user-legacy-plugin-data/index.md) 用户遗留数据层代码
- [@user/legacy-plugin-data](../api/user-legacy-plugin-data) 用户遗留数据层代码
## Mota 全局变量 ## Mota 全局变量
@ -94,7 +93,6 @@ hook.on('afterBattle', enemy => {
2. 加载 2.x 样板的第三方库 2. 加载 2.x 样板的第三方库
3. 如果是游戏中,加载 `src/main.ts` 3. 如果是游戏中,加载 `src/main.ts`
1. 加载渲染端入口 1. 加载渲染端入口
2. 加载数据端入口 2. 加载数据端入口
3. 并行初始化数据端与渲染端,在数据端写入 `Mota` 全局变量 3. 并行初始化数据端与渲染端,在数据端写入 `Mota` 全局变量
@ -104,7 +102,6 @@ hook.on('afterBattle', enemy => {
7. 执行渲染端各个模块的初始化函数 7. 执行渲染端各个模块的初始化函数
4. 如果是录像验证中: 4. 如果是录像验证中:
1. 加载数据端入口 1. 加载数据端入口
2. 初始化数据端,写入 `Mota` 全局变量 2. 初始化数据端,写入 `Mota` 全局变量
3. 初始化完毕后执行 `loading.emit('dataRegistered')``loading.emit('registered')` 钩子 3. 初始化完毕后执行 `loading.emit('dataRegistered')``loading.emit('registered')` 钩子

View File

@ -330,12 +330,10 @@ const finalTrans = trans.multiply(childTrans);
#### 常见问题排查 #### 常见问题排查
1. 变换不生效? 1. 变换不生效?
- 验证绑定的对象是否实现 `updateTransform` - 验证绑定的对象是否实现 `updateTransform`
- 检查有没有把 `trans` 对象赋值给元素的 `transform` 属性 - 检查有没有把 `trans` 对象赋值给元素的 `transform` 属性
2. 性能问题 2. 性能问题
- 避免高频调用 `setTransform` - 避免高频调用 `setTransform`
- 优先使用叠加方法代替矩阵直接操作 - 优先使用叠加方法代替矩阵直接操作
- 利用 `clone()` 复用已有变换 - 利用 `clone()` 复用已有变换
@ -351,7 +349,7 @@ type RenderFn = (canvas: MotaOffscreenCanvas2D, transform: Transform) => void;
- `canvas`: 要渲染至的画布,一般直接将内容渲染至这个画布上 - `canvas`: 要渲染至的画布,一般直接将内容渲染至这个画布上
- `transform`: 当前元素的变换矩阵,相对于父元素,不常用 - `transform`: 当前元素的变换矩阵,相对于父元素,不常用
多数情况下,我们只会使用到第一个参数,`MotaOffscreenCanvas2D` 接口请参考 [API 文档](../api/motajs-render-core)。下面是一个典型案例: 多数情况下,我们只会使用到第一个参数,`MotaOffscreenCanvas2D` 接口请参考 [API 文档](../api/motajs-render-core/index.md)。下面是一个典型案例:
```tsx ```tsx
const render = (canvas: MotaOffscreenCanvas2D) => { const render = (canvas: MotaOffscreenCanvas2D) => {

View File

@ -31,7 +31,7 @@ watch(data, () => mySprite.value?.update());
## 我的 UI 很卡 ## 我的 UI 很卡
可能使用了平铺式布局,建议使用 `Scroll` 组件或者 `Page` 组件来对平铺内容分割,从而提高渲染效率。可以参考对应的 [API 文档](../api/user-client-modules/Scroll)。 可能使用了平铺式布局,建议使用 `Scroll` 组件或者 `Page` 组件来对平铺内容分割,从而提高渲染效率。可以参考对应的 [API 文档](../api/user-client-modules/组件 Scroll)。
## 玩着玩着突然黑屏了一下,然后画面就不显示了 ## 玩着玩着突然黑屏了一下,然后画面就不显示了

View File

@ -820,7 +820,7 @@ watch(selected, () => {
## 修改 UI 参数 ## 修改 UI 参数
在打开 UI 时,我们可以传入参数,默认情况下,可以传入所有的 `BaseProps`,也就是所有元素通用属性,以及自己定义的 UI 参数。`BaseProps` 内容较多,可以参考 [API 文档](../api/motajs-render-vue/RenderItem.md)。除此之外,我们还为这个自定义怪物手册添加了 `floorId` 参数,它也可以在打开 UI 时传入。如果需要打开的 UI 参数具有响应式,例如可以动态修改楼层 id可以使用 `reactive` 方法。示例如下: 在打开 UI 时,我们可以传入参数,默认情况下,可以传入所有的 `BaseProps`,也就是所有元素通用属性,以及自己定义的 UI 参数。`BaseProps` 内容较多,可以参考 [API 文档](../api/motajs-render-core/RenderItem.md)。除此之外,我们还为这个自定义怪物手册添加了 `floorId` 参数,它也可以在打开 UI 时传入。如果需要打开的 UI 参数具有响应式,例如可以动态修改楼层 id可以使用 `reactive` 方法。示例如下:
```ts ```ts
import { MyBookProps, MyBookUI } from './myUI'; import { MyBookProps, MyBookUI } from './myUI';