GeezerVison is showing github.com — docs: api文档基础优化 · hwswin/lowcode-engine@33ed67a
File treeExpand file treeCollapse file tree Open diff view settings Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: docs/config/navbar.js +6-16Lines changed: 6 additions & 16 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -33,12 +33,6 @@ module.exports = { | 33 | 33 | position: 'left', | 34 | 34 | label: 'FAQ', | 35 | 35 | }, | 36 | | - { | 37 | | - type: 'doc', | 38 | | - docId: 'participate/index', | 39 | | - position: 'left', | 40 | | - label: '参与贡献', | 41 | | - }, | 42 | 36 | { | 43 | 37 | type: 'doc', | 44 | 38 | docId: 'article/index', | @@ -51,16 +45,6 @@ module.exports = { | 51 | 45 | position: 'left', | 52 | 46 | label: 'Demo 使用文档', | 53 | 47 | }, | 54 | | - { | 55 | | - position: 'left', | 56 | | - href: 'https://developer.aliyun.com/ebook/7507', | 57 | | - label: '技术白皮书', | 58 | | - }, | 59 | | - { | 60 | | - position: 'left', | 61 | | - href: 'https://github.com/alibaba/lowcode-engine/releases', | 62 | | - label: '更新日志', | 63 | | - }, | 64 | 48 | { | 65 | 49 | to: '/community/issue', | 66 | 50 | position: 'left', | @@ -80,6 +64,12 @@ module.exports = { | 80 | 64 | className: 'header-github-link', | 81 | 65 | 'aria-label': 'GitHub repository', | 82 | 66 | }, | | 67 | + { | | 68 | + type: 'doc', | | 69 | + docId: 'participate/index', | | 70 | + position: 'right', | | 71 | + label: '参与贡献', | | 72 | + }, | 83 | 73 | { | 84 | 74 | type: 'search', | 85 | 75 | position: 'right', | |
Collapse file Copy file name to clipboardExpand all lines: docs/config/sidebars.js +50-5Lines changed: 50 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -22,10 +22,56 @@ module.exports = { | 22 | 22 | * 根据当前目录自动生成导航配置 | 23 | 23 | */ | 24 | 24 | guide: [ | 25 | | - { | 26 | | - type: 'autogenerated', | 27 | | - dirName: 'guide', // '.' 即当前的文档文件夹 | 28 | | - }, | | 25 | + [ | | 26 | + { | | 27 | + type: 'category', | | 28 | + label: '入门', | | 29 | + collapsed: false, | | 30 | + items: getDocsFromDir('guide/quickStart'), | | 31 | + }, | | 32 | + { | | 33 | + type: 'category', | | 34 | + label: '创建编辑器', | | 35 | + collapsed: false, | | 36 | + items: getDocsFromDir('guide/create'), | | 37 | + }, | | 38 | + { | | 39 | + type: 'category', | | 40 | + label: '扩展编辑器', | | 41 | + collapsed: false, | | 42 | + items: getDocsFromDir('guide/expand/editor'), | | 43 | + }, | | 44 | + { | | 45 | + type: 'category', | | 46 | + label: '扩展运行时', | | 47 | + collapsed: false, | | 48 | + items: getDocsFromDir('guide/expand/runtime'), | | 49 | + }, | | 50 | + { | | 51 | + type: 'category', | | 52 | + label: '设计原理', | | 53 | + collapsed: false, | | 54 | + items: getDocsFromDir('guide/design'), | | 55 | + }, | | 56 | + { | | 57 | + type: 'category', | | 58 | + label: '附录', | | 59 | + collapsed: false, | | 60 | + items: [ | | 61 | + { | | 62 | + type: 'link', | | 63 | + label: '更新日志', | | 64 | + href: 'https://github.com/alibaba/lowcode-engine/releases', | | 65 | + }, | | 66 | + ...getDocsFromDir('guide/appendix'), | | 67 | + ], | | 68 | + }, | | 69 | + { | | 70 | + type: 'link', | | 71 | + label: '技术白皮书', | | 72 | + href: 'https://developer.aliyun.com/ebook/7507', | | 73 | + }, | | 74 | + ], | 29 | 75 | ], | 30 | 76 | api: [ | 31 | 77 | { | @@ -57,5 +103,4 @@ module.exports = { | 57 | 103 | dirName: 'demoUsage', | 58 | 104 | }, | 59 | 105 | ], | 60 | | - // api: getDocsFromDir('api'), | 61 | 106 | }; |
Collapse file Copy file name to clipboard +86Lines changed: 86 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +--- | | 2 | +title: cavas - 画布 API | | 3 | +sidebar_position: 12 | | 4 | +--- | | 5 | + | | 6 | +> **@types** [IPublicApiCanvas](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/canvas.ts)<br/> | | 7 | +> **@since** v1.1.0 | | 8 | +
| | 9 | + | | 10 | +## 模块简介 | | 11 | + | | 12 | +通过该模块可以触达对画布拖拽相关的一些能力。 | | 13 | + | | 14 | +## 变量 | | 15 | + | | 16 | +### dragon | | 17 | + | | 18 | +获取拖拽操作对象的实例 | | 19 | + | | 20 | +```typescript | | 21 | +/** | | 22 | + * 获取拖拽操作对象的实例 | | 23 | + * get dragon instance, you can use this to obtain draging related abilities and lifecycle hooks | | 24 | + * @since v1.1.0 | | 25 | + */ | | 26 | +get dragon(): IPublicModelDragon | null; | | 27 | +``` | | 28 | +关联模型 [IPublicModelDragon](./model/dragon) | | 29 | + | | 30 | +### activeTracker | | 31 | + | | 32 | +获取活动追踪器实例 | | 33 | + | | 34 | +```typescript | | 35 | +/** | | 36 | + * 获取活动追踪器实例 | | 37 | + * get activeTracker instance, which is a singleton running in engine. | | 38 | + * it tracks document`s current focusing node/node[], and notify it`s subscribers that when | | 39 | + * focusing node/node[] changed. | | 40 | + * @since v1.1.0 | | 41 | + */ | | 42 | +get activeTracker(): IPublicModelActiveTracker | null; | | 43 | +``` | | 44 | + | | 45 | +## 方法签名 | | 46 | + | | 47 | +### createLocation | | 48 | +创建一个文档插入位置对象,该对象用来描述一个即将插入的节点在文档中的位置 | | 49 | + | | 50 | +```typescript | | 51 | +/** | | 52 | + * 创建一个文档插入位置对象,该对象用来描述一个即将插入的节点在文档中的位置 | | 53 | + * create a drop location for document, drop location describes a location in document | | 54 | + * @since v1.1.0 | | 55 | + */ | | 56 | +createLocation(locationData: IPublicTypeLocationData): IPublicModelDropLocation; | | 57 | +``` | | 58 | + | | 59 | +### createScroller | | 60 | +创建一个滚动控制器 Scroller,赋予一个视图滚动的基本能力, | | 61 | +```typescript | | 62 | +/** | | 63 | + * 创建一个滚动控制器 Scroller,赋予一个视图滚动的基本能力, | | 64 | + * a Scroller is a controller that gives a view (IPublicModelScrollable) the ability scrolling | | 65 | + * to some cordination by api scrollTo. | | 66 | + * | | 67 | + * when a scroller is inited, will need to pass is a scrollable, which has a scrollTarget. | | 68 | + * and when scrollTo(options: { left?: number; top?: number }) is called, scroller will | | 69 | + * move scrollTarget`s top-left corner to (options.left, options.top) that passed in. | | 70 | + * @since v1.1.0 | | 71 | + */ | | 72 | +createScroller(scrollable: IPublicModelScrollable): IPublicModelScroller; | | 73 | + | | 74 | +``` | | 75 | + | | 76 | +### createScrollTarget | | 77 | +创建一个 ScrollTarget,与 Scroller 一起发挥作用,详见 [createScroller](#createscroller) 中的描述 | | 78 | + | | 79 | +```typescript | | 80 | +/** | | 81 | + * 创建一个 ScrollTarget,与 Scroller 一起发挥作用,详见 createScroller 中的描述 | | 82 | + * this works with Scroller, refer to createScroller`s description | | 83 | + * @since v1.1.0 | | 84 | + */ | | 85 | +createScrollTarget(shell: HTMLDivElement): IPublicModelScrollTarget; | | 86 | +``` |
Collapse file Copy file name to clipboardExpand all lines: docs/docs/api/common.md +103-27Lines changed: 103 additions & 27 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 2 | 2 | title: common - 通用 API | 3 | 3 | sidebar_position: 11 | 4 | 4 | --- | 5 | | -# 模块简介 | 6 | | -通用模块里包含除了 9 大核心模块 API 之外的所有 API,比如通用 utils、面板扩展相关 等。 | | 5 | + | | 6 | +> **@types** [IPublicApiCommon](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/common.ts)<br/> | | 7 | +> **@since** v1.0.0 | | 8 | +
| | 9 | + | | 10 | +## 模块简介 | | 11 | +通用模块里包含除了几大核心模块 API 之外的所有 API,比如通用 utils、面板扩展相关 等。 | 7 | 12 | > 高能预警:之所以叫 skeletonCabin / designerCabin 跟兼容上一个版本的引擎有关系。若有必要,后面将用更有意义的命名空间来组织这些 API。 | 8 | 13 |
| 9 | | -# 变量(variables) | 10 | | -### utils | | 14 | +## 变量 | | 15 | +#### utils | 11 | 16 | 通用 utils,详见下方方法签名 | 12 | 17 |
| 13 | | -### designerCabin | 14 | | -设计器扩展相关,详见下方方法签名 | | 18 | +相关类型:[IPublicApiCommonUtils](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/common.ts) | 15 | 19 |
| 16 | | -### skeletonCabin | | 20 | +#### skeletonCabin | 17 | 21 | 面板扩展相关,详见下方方法签名 | 18 | 22 |
| 19 | | -# 方法签名(functions) | 20 | | -## utils | 21 | | -### isNodeSchema | | 23 | +## 方法签名 | | 24 | +### utils | | 25 | +#### isNodeSchema | 22 | 26 | 是否为合法的 schema 结构 | 23 | 27 |
| 24 | | -### isFormEvent | | 28 | +```typscript | | 29 | +/** | | 30 | + * 是否为合法的 schema 结构 | | 31 | + * check if data is valid NodeSchema | | 32 | + * | | 33 | + * @param {*} data | | 34 | + * @returns {boolean} | | 35 | + */ | | 36 | +isNodeSchema(data: any): boolean; | | 37 | +``` | | 38 | + | | 39 | +#### isFormEvent | 25 | 40 | 是否为表单事件类型 | 26 | 41 |
| 27 | | -### getNodeSchemaById | | 42 | +```typescript | | 43 | +/** | | 44 | + * 是否为表单事件类型 | | 45 | + * check if e is a form event | | 46 | + * @param {(KeyboardEvent | MouseEvent)} e | | 47 | + * @returns {boolean} | | 48 | + */ | | 49 | +isFormEvent(e: KeyboardEvent | MouseEvent): boolean; | | 50 | +``` | | 51 | + | | 52 | +#### getNodeSchemaById | 28 | 53 | 从 schema 结构中查找指定 id 节点 | | 54 | +```typescript | | 55 | +/** | | 56 | + * 从 schema 结构中查找指定 id 节点 | | 57 | + * get node schema from a larger schema with node id | | 58 | + * @param {IPublicTypeNodeSchema} schema | | 59 | + * @param {string} nodeId | | 60 | + * @returns {(IPublicTypeNodeSchema | undefined)} | | 61 | + */ | | 62 | +getNodeSchemaById( | | 63 | + schema: IPublicTypeNodeSchema, | | 64 | + nodeId: string, | | 65 | + ): IPublicTypeNodeSchema | undefined; | | 66 | +``` | | 67 | +相关类型:[IPublicTypeNodeSchema](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/node-schema.ts) | 29 | 68 |
| 30 | | -### executeTransaction | | 69 | +#### executeTransaction | 31 | 70 | 批处理事务,用于优化特定场景的性能 | 32 | | -*引擎版本 >= 1.0.16 | | 71 | + | | 72 | +```typescript | | 73 | +/** | | 74 | + * 批处理事务,用于优化特定场景的性能 | | 75 | + * excute something in a transaction for performence | | 76 | + * | | 77 | + * @param {() => void} fn | | 78 | + * @param {IPublicEnumTransitionType} type | | 79 | + * @since v1.0.16 | | 80 | + */ | | 81 | +executeTransaction(fn: () => void, type: IPublicEnumTransitionType): void; | | 82 | +``` | | 83 | +**@since v1.0.16** | | 84 | + | | 85 | +##### 示例 | 33 | 86 | ```typescript | 34 | 87 | import { common } from '@alilc/lowcode-engine'; | 35 | 88 | import { IPublicEnumTransitionType } from '@alilc/lowcode-types'; | @@ -42,9 +95,33 @@ common.utils.startTransaction(() => { | 42 | 95 | }, IPublicEnumTransitionType.repaint); | 43 | 96 | ``` | 44 | 97 |
| 45 | | -### createIntl | | 98 | +#### createIntl | 46 | 99 | i18n 相关工具 | 47 | | -*引擎版本 >= 1.0.17 | | 100 | +```typescript | | 101 | +/** | | 102 | + * i18n 相关工具 | | 103 | + * i18n tools | | 104 | + * | | 105 | + * @param {(string | object)} instance | | 106 | + * @returns {{ | | 107 | + * intlNode(id: string, params?: object): ReactNode; | | 108 | + * intl(id: string, params?: object): string; | | 109 | + * getLocale(): string; | | 110 | + * setLocale(locale: string): void; | | 111 | + * }} | | 112 | + * @since v1.0.17 | | 113 | + */ | | 114 | +createIntl(instance: string | object): { | | 115 | + intlNode(id: string, params?: object): ReactNode; | | 116 | + intl(id: string, params?: object): string; | | 117 | + getLocale(): string; | | 118 | + setLocale(locale: string): void; | | 119 | +}; | | 120 | +``` | | 121 | + | | 122 | +**@since v1.0.17** | | 123 | + | | 124 | +##### 示例 | 48 | 125 | ```typescript | 49 | 126 | import { common } from '@alilc/lowcode-engine'; | 50 | 127 | import enUS from './en-US.json'; | @@ -56,16 +133,15 @@ const { intl, getLocale, setLocale } = common.utils.createIntl({ | 56 | 133 | }); | 57 | 134 |
| 58 | 135 | ``` | 59 | | -## designerCabin | 60 | | -### isSettingField | 61 | | -是否是 SettingField 实例 | 62 | | - | 63 | | -### TransformStage | 64 | | -转换类型枚举对象,包含 init / upgrade / render 等类型,参考 [TransformStage](https://github.com/alibaba/lowcode-engine/blob/4f4ac5115d18357a7399632860808f6cffc33fad/packages/types/src/transform-stage.ts#L1) | 65 | | -## | 66 | | -## skeletonCabin | 67 | | -### Workbench | | 136 | + | | 137 | +### skeletonCabin | | 138 | +#### Workbench | 68 | 139 | 编辑器框架 View | 69 | 140 |
| 70 | | -# 事件(events) | 71 | | -无 | | 141 | +```typescript | | 142 | +/** | | 143 | + * 编辑器框架 View | | 144 | + * get Workbench Component | | 145 | + */ | | 146 | +get Workbench(): Component; | | 147 | +``` |
|