@tmagic/editor 1.8.2 → 1.8.4-beta.1

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.
Files changed (110) hide show
  1. package/dist/es/Editor.vue_vue_type_script_setup_true_lang.js +23 -25
  2. package/dist/es/fields/CondOpSelect.vue_vue_type_script_setup_true_lang.js +2 -2
  3. package/dist/es/fields/DataSourceFieldSelect/FieldSelect.vue_vue_type_script_setup_true_lang.js +1 -1
  4. package/dist/es/fields/DataSourceFieldSelect/Index.vue_vue_type_script_setup_true_lang.js +1 -1
  5. package/dist/es/fields/DataSourceFields.vue_vue_type_script_setup_true_lang.js +1 -1
  6. package/dist/es/fields/DataSourceInput.vue_vue_type_script_setup_true_lang.js +1 -1
  7. package/dist/es/fields/DataSourceMethodSelect.vue_vue_type_script_setup_true_name_true_lang.js +1 -1
  8. package/dist/es/fields/StyleSetter/configs.js +1 -1
  9. package/dist/es/fields/configs/codeSelect.js +5 -7
  10. package/dist/es/fields/configs/displayConds.js +8 -9
  11. package/dist/es/fields/configs/eventSelect.js +30 -27
  12. package/dist/es/headless.js +1 -2
  13. package/dist/es/hooks/use-stage.js +19 -18
  14. package/dist/es/index.js +9 -16
  15. package/dist/es/initService.js +33 -106
  16. package/dist/es/layouts/Framework.vue_vue_type_script_setup_true_lang.js +1 -1
  17. package/dist/es/layouts/NavMenuColumn.vue_vue_type_script_setup_true_lang.js +12 -2
  18. package/dist/es/layouts/page-bar/AddButton.vue_vue_type_script_setup_true_lang.js +4 -6
  19. package/dist/es/layouts/props-panel/PropsPanel.vue_vue_type_script_setup_true_lang.js +2 -2
  20. package/dist/es/layouts/props-panel/use-style-panel.js +1 -1
  21. package/dist/es/layouts/sidebar/ComponentListPanel.vue_vue_type_script_setup_true_lang.js +5 -1
  22. package/dist/es/layouts/workspace/viewer/Stage.vue_vue_type_script_setup_true_lang.js +3 -0
  23. package/dist/es/sdk/index.js +151 -0
  24. package/dist/es/{services → sdk/services}/BaseService.js +1 -1
  25. package/dist/es/{services/codeBlock.js → sdk/services/CodeBlock.js} +37 -40
  26. package/dist/es/{services/componentList.js → sdk/services/ComponentList.js} +5 -6
  27. package/dist/es/{services/dataSource.js → sdk/services/DataSource.js} +38 -37
  28. package/dist/es/{services/dep.js → sdk/services/Dep.js} +27 -17
  29. package/dist/es/{services/editor.js → sdk/services/Editor.js} +124 -87
  30. package/dist/es/{services/events.js → sdk/services/Events.js} +13 -13
  31. package/dist/es/{services/history.js → sdk/services/History.js} +86 -33
  32. package/dist/es/{services/props.js → sdk/services/Props.js} +25 -26
  33. package/dist/es/{services/storage.js → sdk/services/WebStorage.js} +31 -8
  34. package/dist/es/sdk/utils/dep.js +100 -0
  35. package/dist/es/sdk/utils/operator.js +70 -0
  36. package/dist/es/sdk/utils/position.js +8 -0
  37. package/dist/es/sdk/utils/props.js +281 -0
  38. package/dist/es/sdk/validate/index.js +286 -0
  39. package/dist/es/sdk/wiring.js +163 -0
  40. package/dist/es/sdk.js +15 -0
  41. package/dist/es/services/keybinding.js +21 -21
  42. package/dist/es/services/sdk-instance.js +37 -0
  43. package/dist/es/services/stageOverlay.js +14 -14
  44. package/dist/es/services/ui.js +6 -6
  45. package/dist/es/style.css +31 -6
  46. package/dist/es/utils/data-source/formConfigs/base.js +1 -1
  47. package/dist/es/utils/data-source/formConfigs/http.js +1 -1
  48. package/dist/es/utils/dep/worker.js +1 -1
  49. package/dist/es/utils/editor.js +2 -2
  50. package/dist/es/utils/event.js +25 -21
  51. package/dist/es/utils/operator.js +11 -57
  52. package/dist/es/utils/props.js +12 -282
  53. package/dist/es/utils/type-match-rules.js +10 -12
  54. package/dist/style.css +31 -6
  55. package/dist/themes/magic-admin.css +31 -6
  56. package/dist/tmagic-editor-headless.umd.cjs +4690 -2891
  57. package/dist/tmagic-editor-sdk.umd.cjs +9911 -0
  58. package/dist/tmagic-editor.umd.cjs +14155 -13319
  59. package/package.json +13 -8
  60. package/src/Editor.vue +14 -9
  61. package/src/editorProps.ts +23 -0
  62. package/src/fields/configs/codeSelect.ts +6 -9
  63. package/src/fields/configs/displayConds.ts +10 -9
  64. package/src/fields/configs/eventSelect.ts +40 -25
  65. package/src/hooks/use-stage.ts +2 -1
  66. package/src/index.ts +11 -9
  67. package/src/initService.ts +59 -188
  68. package/src/layouts/Framework.vue +1 -1
  69. package/src/layouts/NavMenuColumn.vue +16 -4
  70. package/src/layouts/page-bar/AddButton.vue +5 -6
  71. package/src/layouts/props-panel/PropsPanel.vue +1 -1
  72. package/src/layouts/props-panel/use-style-panel.ts +1 -1
  73. package/src/layouts/sidebar/ComponentListPanel.vue +7 -1
  74. package/src/layouts/workspace/viewer/Stage.vue +5 -0
  75. package/src/sdk/index.ts +264 -0
  76. package/src/{services/codeBlock.ts → sdk/services/CodeBlock.ts} +43 -38
  77. package/src/{services/componentList.ts → sdk/services/ComponentList.ts} +8 -7
  78. package/src/{services/dataSource.ts → sdk/services/DataSource.ts} +38 -32
  79. package/src/{services/dep.ts → sdk/services/Dep.ts} +29 -12
  80. package/src/{services/editor.ts → sdk/services/Editor.ts} +175 -86
  81. package/src/{services/events.ts → sdk/services/Events.ts} +15 -12
  82. package/src/{services/history.ts → sdk/services/History.ts} +100 -28
  83. package/src/{services/props.ts → sdk/services/Props.ts} +25 -25
  84. package/src/{services/storage.ts → sdk/services/WebStorage.ts} +41 -7
  85. package/src/sdk/type.ts +191 -0
  86. package/src/sdk/utils/dep.ts +196 -0
  87. package/src/sdk/utils/operator.ts +114 -0
  88. package/src/sdk/utils/position.ts +23 -0
  89. package/src/sdk/utils/props.ts +368 -0
  90. package/src/sdk/validate/index.ts +501 -0
  91. package/src/sdk/wiring.ts +211 -0
  92. package/src/sdk.ts +19 -0
  93. package/src/services/keybinding.ts +2 -2
  94. package/src/services/sdk-instance.ts +66 -0
  95. package/src/services/stageOverlay.ts +2 -2
  96. package/src/services/ui.ts +3 -3
  97. package/src/theme/nav-menu.scss +29 -2
  98. package/src/type.ts +33 -9
  99. package/src/utils/data-source/formConfigs/base.ts +1 -1
  100. package/src/utils/data-source/formConfigs/http.ts +1 -1
  101. package/src/utils/dep/collect-worker-client.ts +9 -6
  102. package/src/utils/dep/worker.ts +5 -0
  103. package/src/utils/editor.ts +2 -1
  104. package/src/utils/event.ts +36 -18
  105. package/src/utils/operator.ts +21 -87
  106. package/src/utils/props.ts +17 -332
  107. package/src/utils/type-match-rules.ts +1 -3
  108. package/types/index.d.ts +797 -540
  109. package/types/sdk.d.ts +2594 -0
  110. /package/src/{services → sdk/services}/BaseService.ts +0 -0
package/types/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import tablePlugin from "@tmagic/table";
3
3
  import StageCore, { CanDropIn, ContainerHighlightType, CustomizeMoveableOptions, GuidesOptions, RenderType, UpdateDragEl, default as StageCore$1 } from "@tmagic/stage";
4
4
  import designPlugin, { ButtonProps, DesignPluginOptions, FieldSize } from "@tmagic/design";
5
5
  import Gesto, { OnDrag, OnDrag as OnDrag$1 } from "gesto";
6
- import { CodeBlockContent, CodeBlockDSL, DataSchema, DataSourceFieldType, DataSourceSchema, DepData, DepExtendedData, DepTargetType, DepTargetType as DepTargetType$1, DisplayCond, EventOption, Id, MApp, MContainer, MNode, MPage, MPageFragment, NodeType, Target, TargetOptions } from "@tmagic/core";
6
+ import { CodeBlockContent, CodeBlockDSL, DataSchema, DataSourceFieldType, DataSourceSchema, DepData, DepExtendedData, DepTargetType, DepTargetType as DepTargetType$1, DisplayCond, EventOption, Id, MApp, MContainer, MNode, MPage, MPageFragment, NodeType, Target, TargetDescriptor, TargetNode, TargetOptions } from "@tmagic/core";
7
7
  import { App, AppContext, CSSProperties, Component, ComputedRef, Ref, ShallowRef } from "vue";
8
8
  import EventEmitter$1, { EventEmitter } from "events";
9
9
  import * as Monaco from "monaco-editor";
@@ -17,7 +17,22 @@ export * from "@tmagic/table";
17
17
  export * from "@tmagic/stage";
18
18
  export * from "@tmagic/design";
19
19
  export * from "@tmagic/utils";
20
- //#region temp/packages/editor/src/services/BaseService.d.ts
20
+ //#region temp/packages/editor/src/utils/dep/worker.d.ts
21
+ type DepsData = Record<string, Record<Id, DepData>>;
22
+ interface CollectWorkerResult {
23
+ deps: DepsData;
24
+ nodeIds: Id[];
25
+ }
26
+ interface CollectWorkerPayload {
27
+ /** 待收集的节点 */
28
+ nodes: TargetNode[];
29
+ /** 参与本次收集的 target 描述,worker 中据此重建 target */
30
+ targets: TargetDescriptor[];
31
+ depExtendedData: DepExtendedData;
32
+ deep: boolean;
33
+ }
34
+ //#endregion
35
+ //#region temp/packages/editor/src/sdk/services/BaseService.d.ts
21
36
  /**
22
37
  * 对Class进行扩展
23
38
  * 给Class中的每个方法都添加before after两个钩子
@@ -61,239 +76,10 @@ declare class BaseService extends EventEmitter {
61
76
  private doTask;
62
77
  }
63
78
  //#endregion
64
- //#region temp/packages/editor/src/services/codeBlock.d.ts
65
- declare const canUsePluginMethods$8: {
66
- async: readonly ["setCodeDslById", "setEditStatus", "setCombineIds", "setUndeleteableList", "deleteCodeDslByIds"];
67
- sync: string[];
68
- };
69
- type AsyncMethodName$4 = Writable<(typeof canUsePluginMethods$8)['async']>;
70
- declare class CodeBlock extends BaseService {
71
- private state;
72
- /**
73
- * 最近一次写入历史栈的代码块历史记录 uuid(单条写入场景:新增 / 更新)。
74
- * 供 setCodeDslById(Sync)AndGetHistoryId 取回,普通方法不读取它。
75
- */
76
- private lastPushedHistoryId;
77
- /**
78
- * deleteCodeDslByIds 一次删除多个代码块时,按写入顺序收集的历史记录 uuid 列表。
79
- * 在 deleteCodeDslByIds 入口处重置,供 deleteCodeDslByIdsAndGetHistoryId 取回。
80
- */
81
- private lastDeletedHistoryIds;
82
- constructor();
83
- /**
84
- * 设置活动的代码块dsl数据源
85
- * @param {CodeBlockDSL} codeDsl 代码DSL
86
- * @returns {void}
87
- */
88
- setCodeDsl(codeDsl: CodeBlockDSL): Promise<void>;
89
- /**
90
- * 获取活动的代码块dsl数据源(默认从dsl中的codeBlocks字段读取)
91
- * 方法要支持钩子添加扩展,会被重写为异步方法,因此这里显示写为异步以提醒调用者需以异步形式调用
92
- * @param {boolean} forceRefresh 是否强制从活动dsl拉取刷新
93
- * @returns {CodeBlockDSL | null}
94
- */
95
- getCodeDsl(): CodeBlockDSL | null;
96
- /**
97
- * 根据代码块id获取代码块内容
98
- * @param {Id} id 代码块id
99
- * @returns {CodeBlockContent | null}
100
- */
101
- getCodeContentById(id: Id): CodeBlockContent | null;
102
- /**
103
- * 设置代码块ID和代码内容到源dsl
104
- * @param {Id} id 代码块id
105
- * @param {CodeBlockContent} codeConfig 代码块内容配置信息
106
- * @param options 可选配置
107
- * @param options.changeRecords form 端 propPath/value 列表,用于历史记录的精细化撤销/重做
108
- * @param options.doNotPushHistory 是否不写入历史记录(默认 false)
109
- * @returns {void}
110
- */
111
- setCodeDslById(id: Id, codeConfig: Partial<CodeBlockContent>, { changeRecords, doNotPushHistory, historyDescription, historySource }?: HistoryOpOptionsWithChangeRecords): Promise<void>;
112
- /**
113
- * 为了兼容历史原因
114
- * 设置代码块ID和代码内容到源dsl
115
- * @param {Id} id 代码块id
116
- * @param {CodeBlockContent} codeConfig 代码块内容配置信息
117
- * @param {boolean} force 是否强制写入,默认true
118
- * @param options 可选配置
119
- * @param options.changeRecords form 端 propPath/value 列表,用于历史记录的精细化撤销/重做
120
- * @param options.doNotPushHistory 是否不写入历史记录(默认 false)
121
- * @param options.historyDescription 入栈时附带的人类可读描述,用于历史面板展示
122
- * @returns {void}
123
- */
124
- setCodeDslByIdSync(id: Id, codeConfig: Partial<CodeBlockContent>, force?: boolean, { changeRecords, doNotPushHistory, historyDescription, historySource }?: HistoryOpOptionsWithChangeRecords): void;
125
- /**
126
- * 根据代码块id数组获取代码dsl
127
- * @param {string[]} ids 代码块id数组
128
- * @returns {CodeBlockDSL}
129
- */
130
- getCodeDslByIds(ids: string[]): CodeBlockDSL;
131
- /**
132
- * 获取编辑状态
133
- * @returns {boolean} 是否可编辑
134
- */
135
- getEditStatus(): boolean;
136
- /**
137
- * 设置编辑状态
138
- * @param {boolean} status 是否可编辑
139
- * @returns {void}
140
- */
141
- setEditStatus(status: boolean): Promise<void>;
142
- /**
143
- * 设置当前选中组件已关联绑定的代码块id数组
144
- * @param {string[]} ids 代码块id数组
145
- * @returns {void}
146
- */
147
- setCombineIds(ids: string[]): Promise<void>;
148
- /**
149
- * 获取当前选中组件已关联绑定的代码块id数组
150
- * @returns {string[]}
151
- */
152
- getCombineIds(): string[];
153
- /**
154
- * 获取不可删除列表
155
- * @returns {Id[]}
156
- */
157
- getUndeletableList(): Id[];
158
- /**
159
- * 设置不可删除列表:为业务逻辑预留的不可删除的代码块列表,由业务逻辑维护(如代码块上线后不可删除)
160
- * @param {Id[]} codeIds 代码块id数组
161
- * @returns {void}
162
- */
163
- setUndeleteableList(codeIds: Id[]): Promise<void>;
164
- /**
165
- * 设置代码草稿
166
- */
167
- setCodeDraft(codeId: Id, content: string): void;
168
- /**
169
- * 获取代码草稿
170
- */
171
- getCodeDraft(codeId: Id): string | null;
172
- /**
173
- * 删除代码草稿
174
- */
175
- removeCodeDraft(codeId: Id): void;
176
- /**
177
- * 在dsl数据源中删除指定id的代码块
178
- * @param {Id[]} codeIds 需要删除的代码块id数组
179
- * @param options 可选配置
180
- * @param options.doNotPushHistory 是否不写入历史记录(默认 false)
181
- */
182
- deleteCodeDslByIds(codeIds: Id[], { doNotPushHistory, historyDescription, historySource }?: HistoryOpOptions): Promise<void>;
183
- /**
184
- * 下列 *AndGetHistoryId 方法与对应的写入方法行为完全一致,
185
- * 返回值在 {@link DslOpWithHistoryIdsResult} 中同时包含原操作结果与本次写入的历史 uuid 列表,
186
- * 可用于精确引用 / 定位该条历史记录(埋点、revert、跨端同步等)。
187
- *
188
- * 当本次操作未写入历史(doNotPushHistory 为 true、或无对应记录)时 historyIds 为 `[]`。
189
- */
190
- /** 等价于 {@link setCodeDslById},并额外返回本次写入历史记录的 uuid 列表(未入栈时 historyIds 为 `[]`)。 */
191
- setCodeDslByIdAndGetHistoryId(id: Id, codeConfig: Partial<CodeBlockContent>, options?: HistoryOpOptionsWithChangeRecords): Promise<DslOpWithHistoryIdsResult<void>>;
192
- /** 等价于 {@link setCodeDslByIdSync},并额外返回本次写入历史记录的 uuid 列表(未入栈时 historyIds 为 `[]`)。 */
193
- setCodeDslByIdSyncAndGetHistoryId(id: Id, codeConfig: Partial<CodeBlockContent>, force?: boolean, options?: HistoryOpOptionsWithChangeRecords): DslOpWithHistoryIdsResult<void>;
194
- /**
195
- * 等价于 {@link deleteCodeDslByIds},并额外返回本次写入的全部历史记录 uuid(按删除顺序)。
196
- * 一次删除多个代码块会产生多条历史记录;未写入任何历史时 historyIds 为 `[]`。
197
- */
198
- deleteCodeDslByIdsAndGetHistoryId(codeIds: Id[], options?: HistoryOpOptions): Promise<DslOpWithHistoryIdsResult<void>>;
199
- setParamsColConfig(config: TableColumnConfig): void;
200
- getParamsColConfig(): TableColumnConfig | undefined;
201
- /**
202
- * 撤销指定代码块的最近一次变更。
203
- *
204
- * 内部走 setCodeDslByIdSync / deleteCodeDslByIds,因此会自动触发 codeBlockService 的
205
- * `addOrUpdate` / `remove` 事件,由 initService 中的 handler 重新维护 dep target
206
- * (DepTargetType.CODE_BLOCK 的 add / remove)。所有写回都带 `doNotPushHistory: true`,
207
- * 确保不会在历史栈里产生新的记录。
208
- *
209
- * @param id 代码块 id
210
- * @returns 撤销的 step;栈不存在或已无可撤销时返回 null
211
- */
212
- undo(id: Id): Promise<CodeBlockStepValue | null>;
213
- /**
214
- * 重做指定代码块的下一次变更。
215
- * @param id 代码块 id
216
- * @returns 重做的 step;栈不存在或已无可重做时返回 null
217
- */
218
- redo(id: Id): Promise<CodeBlockStepValue | null>;
219
- /** 是否可对指定代码块撤销。 */
220
- canUndo(id: Id): boolean;
221
- /** 是否可对指定代码块重做。 */
222
- canRedo(id: Id): boolean;
223
- /**
224
- * 跳转指定代码块的历史栈到目标游标。语义同 editor.gotoPageStep。
225
- *
226
- * @param id 代码块 id
227
- * @param targetCursor 目标游标位置(已应用步骤数量)
228
- * @returns 实际移动到的最终游标位置
229
- */
230
- goto(id: Id, targetCursor: number): Promise<number>;
231
- /**
232
- * 「回滚」指定代码块历史步骤(类 git revert 语义):
233
- * - 不动原始栈结构(不移动 cursor、不丢弃任何步骤);
234
- * - 把目标 step 的修改**反向应用**一次,并作为**新步骤**追加到栈顶;
235
- * - 仅对已应用的步骤生效。
236
- *
237
- * @param id 代码块 id
238
- * @param index 目标 step 在该栈中的索引(0 为最早),通常由历史面板传入
239
- * @returns 反向后产生的新 step;目标不存在 / 未应用时返回 null
240
- */
241
- revert(id: Id, index: number): Promise<CodeBlockStepValue | null>;
242
- /**
243
- * 通过历史记录 uuid 回滚代码块历史步骤,语义同 {@link revert},
244
- * 仅无需调用方再传 codeBlockId 与 index:内部会按 uuid 在全部代码块栈中定位对应步骤后再回滚。
245
- * 按数组顺序依次回滚,返回与入参同序的结果列表(某项失败时为 `null`)。
246
- *
247
- * @param uuids 目标历史记录的 uuid 列表,通常由 {@link setCodeDslByIdAndGetHistoryId} 等方法返回的 `historyIds`
248
- */
249
- revertById(uuids: string[]): Promise<(CodeBlockStepValue | null)[]>;
250
- /**
251
- * 生成代码块唯一id
252
- * @returns {Id} 代码块唯一id
253
- */
254
- getUniqueId(): Promise<string>;
255
- /**
256
- * 复制时会带上组件关联的代码块
257
- * @param config 组件节点配置
258
- * @returns
259
- */
260
- copyWithRelated(config: MNode | MNode[], collectorOptions?: TargetOptions): void;
261
- /**
262
- * 粘贴代码块
263
- * @returns
264
- */
265
- paste(): void;
266
- resetState(): void;
267
- destroy(): void;
268
- usePlugin(options: AsyncHookPlugin<AsyncMethodName$4, CodeBlock>): void;
269
- /**
270
- * 反向应用一个 step 并以新 step 入栈。逻辑与 applyHistoryStep(reverse=true) 同构,
271
- * 差异仅在于通过公开的 setCodeDslByIdSync / deleteCodeDslByIds 触发 push。
272
- */
273
- private applyRevertStep;
274
- /**
275
- * 把一条历史 step 应用到当前代码块服务上。
276
- *
277
- * 复用现有的 setCodeDslByIdSync / deleteCodeDslByIds,目的是借助它们发出的事件
278
- * 触发 initService 中的 dep target 维护(CODE_BLOCK 的 add / remove)。
279
- * 所有写回都带 `doNotPushHistory: true`,确保不会在历史栈里产生新的记录。
280
- *
281
- * - oldContent=null, newContent≠null:原始为新增 → undo 删除;redo 再次 setCodeDslByIdSync
282
- * - oldContent≠null, newContent=null:原始为删除 → undo 还原写入;redo 再次删除
283
- * - 两侧都有:原始为更新 → 按 changeRecords 局部 patch;缺省退化为整内容替换
284
- *
285
- * @param step 历史 step
286
- * @param reverse true=撤销,false=重做
287
- */
288
- private applyHistoryStep;
289
- }
290
- type CodeBlockService = CodeBlock;
291
- declare const _default$40: CodeBlock;
292
- //#endregion
293
- //#region temp/packages/editor/src/services/componentList.d.ts
79
+ //#region temp/packages/editor/src/sdk/services/ComponentList.d.ts
294
80
  declare class ComponentList extends BaseService {
295
81
  private state;
296
- constructor();
82
+ constructor(ctx: SdkContext);
297
83
  /**
298
84
  * @param componentGroupList 组件列表配置
299
85
  */
@@ -303,9 +89,8 @@ declare class ComponentList extends BaseService {
303
89
  destroy(): void;
304
90
  }
305
91
  type ComponentListService = ComponentList;
306
- declare const _default$41: ComponentList;
307
92
  //#endregion
308
- //#region temp/packages/editor/src/services/dataSource.d.ts
93
+ //#region temp/packages/editor/src/sdk/services/DataSource.d.ts
309
94
  interface State$2 {
310
95
  datasourceTypeList: DatasourceTypeOption[];
311
96
  dataSources: DataSourceSchema[];
@@ -316,12 +101,13 @@ interface State$2 {
316
101
  methods: Record<string, EventOption[]>;
317
102
  }
318
103
  type StateKey$1 = keyof State$2;
319
- declare const canUsePluginMethods$7: {
104
+ declare const canUsePluginMethods$8: {
320
105
  async: never[];
321
106
  sync: readonly ["getFormConfig", "setFormConfig", "getFormValue", "setFormValue", "getFormEvent", "setFormEvent", "getFormMethod", "setFormMethod", "add", "update", "remove", "createId"];
322
107
  };
323
- type SyncMethodName$5 = Writable<(typeof canUsePluginMethods$7)['sync']>;
108
+ type SyncMethodName$5 = Writable<(typeof canUsePluginMethods$8)['sync']>;
324
109
  declare class DataSource extends BaseService {
110
+ private ctx;
325
111
  private state;
326
112
  /**
327
113
  * 最近一次写入历史栈的数据源历史记录 uuid。
@@ -329,7 +115,7 @@ declare class DataSource extends BaseService {
329
115
  * 普通方法不读取它,调用前由 *AndGetHistoryId 重置为 null。
330
116
  */
331
117
  private lastPushedHistoryId;
332
- constructor();
118
+ constructor(ctx: SdkContext);
333
119
  set<K extends StateKey$1, T extends State$2[K]>(name: K, value: T): void;
334
120
  get<K extends StateKey$1>(name: K): State$2[K];
335
121
  getFormConfig(type?: string): FormConfig;
@@ -474,12 +260,8 @@ declare class DataSource extends BaseService {
474
260
  private applyHistoryStep;
475
261
  }
476
262
  type DataSourceService = DataSource;
477
- declare const _default$42: DataSource;
478
- //#endregion
479
- //#region temp/packages/editor/src/utils/dep/worker.d.ts
480
- type DepsData = Record<string, Record<Id, DepData>>;
481
263
  //#endregion
482
- //#region temp/packages/editor/src/services/dep.d.ts
264
+ //#region temp/packages/editor/src/sdk/services/Dep.d.ts
483
265
  interface DepEvents {
484
266
  'add-target': [target: Target];
485
267
  'remove-target': [id: string | number, type: string | DepTargetType$1];
@@ -492,6 +274,7 @@ interface State$1 {
492
274
  }
493
275
  type StateKey = keyof State$1;
494
276
  declare class Dep extends BaseService {
277
+ private ctx;
495
278
  private state;
496
279
  private idleTask;
497
280
  private collectWorker;
@@ -500,7 +283,7 @@ declare class Dep extends BaseService {
500
283
  private resolveWaitingWorker?;
501
284
  private workerGeneration;
502
285
  private activeBatches;
503
- constructor();
286
+ constructor(ctx: SdkContext);
504
287
  set<K extends StateKey, T extends State$1[K]>(name: K, value: T): void;
505
288
  get<K extends StateKey>(name: K): State$1[K];
506
289
  removeTargets(type?: string): void;
@@ -562,10 +345,14 @@ declare class Dep extends BaseService {
562
345
  private updateCollectingState;
563
346
  }
564
347
  type DepService = Dep;
565
- declare const _default$44: Dep;
566
348
  //#endregion
567
- //#region temp/packages/editor/src/services/editor.d.ts
349
+ //#region temp/packages/editor/src/sdk/services/Editor.d.ts
350
+ interface EditorServiceConfig {
351
+ disabledPageFragment?: boolean;
352
+ canDropIn?: CanDropInFunction;
353
+ }
568
354
  declare class Editor extends BaseService {
355
+ private ctx;
569
356
  state: StoreState;
570
357
  private selectionBeforeOp;
571
358
  /**
@@ -584,7 +371,9 @@ declare class Editor extends BaseService {
584
371
  * 仅在选中节点未变化时复用(连续 add / doNotSelect / 批量粘贴),选中变化后自动失效,无需手动清理。
585
372
  */
586
373
  private lastAdded;
587
- constructor();
374
+ /** 与编辑器 props 中 `disabledPageFragment` / `canDropIn` 对应,供结构合法性校验使用 */
375
+ private config;
376
+ constructor(ctx: SdkContext);
588
377
  /**
589
378
  * 设置当前指点节点配置
590
379
  * @param name 'root' | 'page' | 'parent' | 'node' | 'highlightNode' | 'nodes' | 'stage' | 'modifiedNodeIds' | 'invalidNodeIds' | 'pageLength' | 'pageFragmentLength
@@ -652,6 +441,9 @@ declare class Editor extends BaseService {
652
441
  */
653
442
  multiSelect(ids: Id[]): void;
654
443
  selectRoot(): void;
444
+ /** 设置结构合法性校验用到的配置,只覆盖传入的字段 */
445
+ setConfig(config: Partial<EditorServiceConfig>): void;
446
+ getConfig(): Readonly<EditorServiceConfig>;
655
447
  doAdd(node: MNode, parent: MContainer, _options?: DslOpOptions): Promise<MNode>;
656
448
  /**
657
449
  * 向指点容器添加组件节点
@@ -863,6 +655,11 @@ declare class Editor extends BaseService {
863
655
  * 供 `change` 事件携带「变更节点对应的 page」(而非编辑器当前选中页)。
864
656
  */
865
657
  private getPageOfNode;
658
+ /**
659
+ * 执行校验。校验不通过(strict 抛错)时操作不会继续,必须清掉 captureSelectionBeforeOp 留下的快照,
660
+ * 否则下一次成功的操作会沿用这份过期快照,写出错误的 selectedBefore / invalidNodeIdsBefore。
661
+ */
662
+ private runGuard;
866
663
  private captureSelectionBeforeOp;
867
664
  /**
868
665
  * 比较「上一次 root」与「新 root」的页面 / 页面片,按页面粒度把整体替换拆成历史记录:
@@ -904,19 +701,22 @@ declare class Editor extends BaseService {
904
701
  * 这里补齐与 this.add 等价的 add / change 事件,保证撤销/重做路径的事件行为与正向操作一致。
905
702
  */
906
703
  private emitHistoryInsertEvents;
704
+ /** 经由 reactivity 注入的 toRaw(默认是 Vue 的 toRaw) */
705
+ private toRaw;
907
706
  }
908
707
  type EditorService = Editor;
909
- declare const _default$45: Editor;
910
708
  //#endregion
911
- //#region temp/packages/editor/src/services/events.d.ts
912
- declare const canUsePluginMethods$6: {
709
+ //#region temp/packages/editor/src/sdk/services/Events.d.ts
710
+ declare const canUsePluginMethods$7: {
913
711
  async: readonly [];
914
712
  sync: readonly ["setEvent", "getEvent", "setMethod", "getMethod"];
915
713
  };
916
- type AsyncMethodName$3 = Writable<(typeof canUsePluginMethods$6)['async']>;
917
- type SyncMethodName$4 = Writable<(typeof canUsePluginMethods$6)['sync']>;
714
+ type AsyncMethodName$4 = Writable<(typeof canUsePluginMethods$7)['async']>;
715
+ type SyncMethodName$4 = Writable<(typeof canUsePluginMethods$7)['sync']>;
918
716
  declare class Events extends BaseService {
919
- constructor();
717
+ private eventMap;
718
+ private methodMap;
719
+ constructor(ctx: SdkContext);
920
720
  setEvents(events: Record<string, EventOption[]>): void;
921
721
  setEvent(type: string, events: EventOption[]): void;
922
722
  getEvent(type: string, _data?: {
@@ -930,96 +730,19 @@ declare class Events extends BaseService {
930
730
  }): EventOption[];
931
731
  resetState(): void;
932
732
  destroy(): void;
933
- usePlugin(options: AsyncHookPlugin<AsyncMethodName$3, Events> & SyncHookPlugin<SyncMethodName$4, Events>): void;
733
+ usePlugin(options: AsyncHookPlugin<AsyncMethodName$4, Events> & SyncHookPlugin<SyncMethodName$4, Events>): void;
934
734
  }
935
735
  type EventsService = Events;
936
- declare const _default$46: Events;
937
736
  //#endregion
938
- //#region temp/packages/editor/src/utils/undo-redo.d.ts
939
- /**
940
- * UndoRedo 栈的可序列化快照,用于持久化(如写入 IndexedDB)后再还原。
941
- */
942
- export interface SerializedUndoRedo<T = any> {
943
- /** 栈内全部元素(按时间正序,索引 0 为最早一步)。 */
944
- elementList: T[];
945
- /** 游标位置(已应用步骤数量)。 */
946
- listCursor: number;
947
- /** 栈容量上限。 */
948
- listMaxSize: number;
949
- }
950
- export declare class UndoRedo<T = any> {
951
- /**
952
- * 由 {@link UndoRedo.serialize} 产出的快照重建一个 UndoRedo 实例。
953
- * 游标会被夹紧到 [0, length] 区间,避免脏数据导致越界。
954
- *
955
- * @param options.isSavedStep 可选谓词:若提供,则把游标定位到「最近一条满足该谓词的记录」之后
956
- * (即恢复到最近一个已保存点);找不到匹配记录时退回快照中的原游标。
957
- */
958
- static fromSerialized<T = any>(data: SerializedUndoRedo<T>, options?: {
959
- isSavedStep?: (element: T) => boolean;
960
- }): UndoRedo<T>;
961
- private elementList;
962
- private listCursor;
963
- private listMaxSize;
964
- constructor(listMaxSize?: number);
965
- /**
966
- * 导出当前栈的可序列化快照(深克隆,避免外部改动污染内部状态)。
967
- * 配合 {@link UndoRedo.fromSerialized} 可在持久化后完整还原撤销/重做栈。
968
- */
969
- serialize(): SerializedUndoRedo<T>;
970
- pushElement(element: T): void;
971
- canUndo(): boolean;
972
- /** 返回被撤销的操作 */
973
- undo(): T | null;
974
- canRedo(): boolean;
975
- /** 返回被重做的操作 */
976
- redo(): T | null;
977
- getCurrentElement(): T | null;
978
- /**
979
- * 用 `element` 替换当前游标所在元素(cursor - 1),并丢弃其后的重做尾部(与 {@link pushElement} 的丢尾一致),
980
- * 游标位置保持不变(元素数量不增)。cursor 为 0(无已应用元素)时不做任何操作并返回 false。
981
- * 用于「连续同类记录合并」等就地替换最新一条的场景。
982
- */
983
- replaceCurrentElement(element: T): boolean;
984
- /**
985
- * 对当前游标所在元素(cursor - 1)做就地更新;cursor 为 0(全部已撤销)时不做任何操作。
986
- * 用于给「当前步骤」打标记(如标记为已保存)等元数据写入场景。
987
- */
988
- updateCurrentElement(updater: (element: T) => void): void;
989
- /** 对栈内全部元素做就地更新。用于批量清理元数据(如清空所有元素的已保存标记)。 */
990
- updateElements(updater: (element: T, index: number) => void): void;
991
- /**
992
- * 返回栈内全部元素的浅克隆数组(按时间顺序,索引 0 为最早一步)。
993
- * 仅用于历史面板等只读展示场景,不应直接修改返回值。
994
- */
995
- getElementList(): T[];
996
- /**
997
- * 当前游标位置:表示已应用的步骤数量。
998
- * - cursor === 0 表示全部已撤销
999
- * - cursor === length 表示已重做到末尾
1000
- * 历史面板用于区分"已应用 / 已撤销"两段。
1001
- */
1002
- getCursor(): number;
1003
- /** 栈内总步数。 */
1004
- getLength(): number;
1005
- }
1006
- //#endregion
1007
- //#region temp/packages/editor/src/services/history.d.ts
1008
- declare const canUsePluginMethods$5: {
737
+ //#region temp/packages/editor/src/sdk/services/History.d.ts
738
+ declare const canUsePluginMethods$6: {
1009
739
  sync: readonly ["push", "undo", "redo"];
1010
740
  };
1011
- type SyncMethodName$3 = Writable<(typeof canUsePluginMethods$5)['sync']>;
741
+ type SyncMethodName$3 = Writable<(typeof canUsePluginMethods$6)['sync']>;
1012
742
  declare class History extends BaseService {
1013
- state: {
1014
- steps: {
1015
- [x: string]: Record<Id, UndoRedo<any>>;
1016
- page: Record<Id, UndoRedo<StepValue>>;
1017
- codeBlock: Record<Id, UndoRedo<CodeBlockStepValue>>;
1018
- dataSource: Record<Id, UndoRedo<DataSourceStepValue>>;
1019
- };
1020
- stepNames: Record<string, string>;
1021
- };
1022
- constructor();
743
+ private ctx;
744
+ state: HistoryState;
745
+ constructor(ctx: SdkContext);
1023
746
  /**
1024
747
  * 注册一个扩展历史类型,使其可与内置 `page` / `codeBlock` / `dataSource` 一样走统一的
1025
748
  * {@link push} / {@link undo} / {@link redo}(按 id 分栈、独立 undo/redo)。
@@ -1175,6 +898,17 @@ declare class History extends BaseService {
1175
898
  * - 不支持 IndexedDB 的环境(如 SSR)会 reject。
1176
899
  */
1177
900
  saveToIndexedDB(options?: HistoryPersistOptions): Promise<PersistedHistoryState>;
901
+ /**
902
+ * 把当前内存中的全部历史栈导出成可持久化的快照(纯同步,不依赖 IndexedDB),
903
+ * 可用于无状态调用:下次通过 {@link restore} 或 `createDslSdk({ history })` 还原。
904
+ */
905
+ serialize({ jsonSafe }?: {
906
+ jsonSafe?: boolean;
907
+ }): PersistedHistoryState;
908
+ /**
909
+ * 用 {@link serialize} 导出的快照重建全部撤销/重做栈,会整体覆盖当前内存中的历史状态。
910
+ */
911
+ restore(snapshot: PersistedHistoryState): PersistedHistoryState;
1178
912
  /**
1179
913
  * 从本地 IndexedDB 读取此前保存的历史快照并重建全部撤销/重做栈。
1180
914
  *
@@ -1258,6 +992,7 @@ declare class History extends BaseService {
1258
992
  private isValidStackId;
1259
993
  /** 清空全部历史栈内容(保留已注册的类型键,使扩展类型在 reset 后仍可用)。 */
1260
994
  private clearAllSteps;
995
+ private getPersistence;
1261
996
  /**
1262
997
  * 把基础 dbName 与当前 DSL(root app)的 id 拼成最终库名,实现不同应用历史隔离。
1263
998
  * 取不到 app id(如尚未加载 DSL)时退回基础 dbName。
@@ -1265,62 +1000,24 @@ declare class History extends BaseService {
1265
1000
  private resolveDbName;
1266
1001
  }
1267
1002
  type HistoryService = History;
1268
- declare const _default$47: History;
1269
1003
  //#endregion
1270
- //#region temp/packages/editor/src/services/keybinding.d.ts
1271
- declare class Keybinding extends BaseService {
1272
- ctrlKey: string;
1273
- private controllers;
1274
- private bindingList;
1275
- private commands;
1276
- registerCommand(command: string, handler: (e: KeyboardEvent) => void | Promise<void>): void;
1277
- /**
1278
- * @deprecated
1279
- */
1280
- registeCommand(command: string, handler: (e: KeyboardEvent) => void | Promise<void>): void;
1281
- unregisterCommand(command: string): void;
1282
- /**
1283
- * @deprecated
1284
- */
1285
- unregisteCommand(command: string): void;
1286
- registerEl(name: string, el?: HTMLElement): void;
1287
- /**
1288
- * @deprecated
1289
- */
1290
- registeEl(name: string, el?: HTMLElement): void;
1291
- unregisterEl(name: string): void;
1292
- /**
1293
- * @deprecated
1294
- */
1295
- unregisteEl(name: string): void;
1296
- register(maps: KeyBindingItem[]): void;
1297
- /**
1298
- * @deprecated
1299
- */
1300
- registe(map: KeyBindingItem[]): void;
1301
- reset(): void;
1302
- destroy(): void;
1303
- private bind;
1304
- private getKeyconKeys;
1305
- }
1306
- type KeybindingService = Keybinding;
1307
- declare const _default$48: Keybinding;
1308
- //#endregion
1309
- //#region temp/packages/editor/src/services/props.d.ts
1310
- declare const canUsePluginMethods$4: {
1004
+ //#region temp/packages/editor/src/sdk/services/Props.d.ts
1005
+ declare const canUsePluginMethods$5: {
1311
1006
  async: readonly ["setPropsConfig", "getPropsConfig", "setPropsValue", "getPropsValue", "fillConfig", "getDefaultPropsValue"];
1312
1007
  sync: readonly ["createId", "setNewItemId"];
1313
1008
  };
1314
- type AsyncMethodName$2 = Writable<(typeof canUsePluginMethods$4)['async']>;
1315
- type SyncMethodName$2 = Writable<(typeof canUsePluginMethods$4)['sync']>;
1009
+ type AsyncMethodName$3 = Writable<(typeof canUsePluginMethods$5)['async']>;
1010
+ type SyncMethodName$2 = Writable<(typeof canUsePluginMethods$5)['sync']>;
1316
1011
  declare class Props extends BaseService {
1012
+ private ctx;
1317
1013
  private state;
1318
- constructor();
1014
+ constructor(ctx: SdkContext);
1319
1015
  setDisabledDataSource(disabled: boolean): void;
1320
1016
  setDisabledCodeBlock(disabled: boolean): void;
1321
1017
  getDisabledDataSource(): boolean;
1322
1018
  getDisabledCodeBlock(): boolean;
1323
- setPropsConfigs(configs: Record<string, FormConfig | PropsFormConfigFunction>): void;
1019
+ /** 批量设置组件属性表单配置,返回的 Promise 在全部配置处理完(含异步的)后 resolve */
1020
+ setPropsConfigs(configs: Record<string, FormConfig | PropsFormConfigFunction>): Promise<void>;
1324
1021
  getPropsConfigs(): Record<string, FormConfig>;
1325
1022
  fillConfig(config: FormConfig, labelWidth?: string): Promise<FormConfig>;
1326
1023
  setPropsConfig(type: string, config: FormConfig | PropsFormConfigFunction): Promise<void>;
@@ -1333,82 +1030,569 @@ declare class Props extends BaseService {
1333
1030
  node?: MNode | null;
1334
1031
  }): Promise<FormConfig>;
1335
1032
  hasPropsConfig(type: string): boolean;
1336
- setPropsValues(values: Record<string, Partial<MNode> | PropsFormValueFunction>): void;
1033
+ setPropsValues(values: Record<string, Partial<MNode> | PropsFormValueFunction>): Promise<void[]>;
1337
1034
  getPropsValues(): Record<string, Partial<MNode>>;
1338
1035
  /**
1339
1036
  * 为指点类型组件设置组件初始值
1340
1037
  * @param type 组件类型
1341
1038
  * @param value 组件初始值
1342
1039
  */
1343
- setPropsValue(type: string, value: Partial<MNode> | PropsFormValueFunction): Promise<void>;
1040
+ setPropsValue(type: string, value: Partial<MNode> | PropsFormValueFunction): Promise<void>;
1041
+ /**
1042
+ * 获取指定类型的组件初始值
1043
+ * @param type 组件类型
1044
+ * @returns 组件初始值
1045
+ */
1046
+ getPropsValue(componentType: string, { inputEvent, ...defaultValue }?: Record<string, any>): Promise<any>;
1047
+ hasPropsValue(type: string): boolean;
1048
+ createId(type: string | number): string;
1049
+ /**
1050
+ * 将组件与组件的子元素配置中的id都设置成一个新的ID
1051
+ * 如果没有相同ID并且force为false则保持不变
1052
+ * @param {Object} config 组件配置
1053
+ * @param {Boolean} force 是否强制设置新的ID
1054
+ */
1055
+ setNewItemId(config: MNode, force?: boolean): MNode;
1056
+ /**
1057
+ * 获取默认属性配置
1058
+ * @param type 组件类型
1059
+ * @returns Object
1060
+ */
1061
+ getDefaultPropsValue(type: string): {
1062
+ type: string;
1063
+ layout: string;
1064
+ style: {};
1065
+ name: string;
1066
+ items: never[];
1067
+ } | {
1068
+ type: string;
1069
+ style: {};
1070
+ name: string;
1071
+ layout?: undefined;
1072
+ items?: undefined;
1073
+ };
1074
+ resetState(): void;
1075
+ /**
1076
+ * 替换关联ID
1077
+ * @param originConfigs 原组件配置
1078
+ * @param targetConfigs 待替换的组件配置
1079
+ */
1080
+ replaceRelateId(originConfigs: MNode[], targetConfigs: MNode[], collectorOptions: TargetOptions): void;
1081
+ /**
1082
+ * 清除setNewItemId前后映射关系
1083
+ */
1084
+ clearRelateId(): void;
1085
+ destroy(): void;
1086
+ usePlugin(options: AsyncHookPlugin<AsyncMethodName$3, Props> & SyncHookPlugin<SyncMethodName$2, Props>): void;
1087
+ /**
1088
+ * 获取setNewItemId前后映射关系
1089
+ * @param oldId 原组件ID
1090
+ * @returns 新旧ID映射
1091
+ */
1092
+ private getRelateIdMap;
1093
+ /**
1094
+ * 记录setNewItemId前后映射关系
1095
+ * @param oldId 原组件ID
1096
+ * @param newId 分配的新ID
1097
+ */
1098
+ private setRelateId;
1099
+ }
1100
+ type PropsService = Props;
1101
+ //#endregion
1102
+ //#region temp/packages/editor/src/sdk/services/WebStorage.d.ts
1103
+ interface Options$1 {
1104
+ namespace?: string;
1105
+ protocol?: Protocol;
1106
+ }
1107
+ declare enum Protocol {
1108
+ OBJECT = "object",
1109
+ JSON = "json",
1110
+ STRING = "string",
1111
+ NUMBER = "number",
1112
+ BOOLEAN = "boolean"
1113
+ }
1114
+ declare const canUsePluginMethods$4: {
1115
+ async: never[];
1116
+ sync: readonly ["getStorage", "getNamespace", "clear", "getItem", "removeItem", "setItem"];
1117
+ };
1118
+ type SyncMethodName$1 = Writable<(typeof canUsePluginMethods$4)['sync']>;
1119
+ /**
1120
+ * 数据存储服务
1121
+ */
1122
+ declare class WebStorage extends BaseService {
1123
+ private ctx;
1124
+ private storage;
1125
+ private namespace;
1126
+ constructor(ctx: SdkContext, storage?: StorageLike);
1127
+ /**
1128
+ * 获取数据存储对象,可以通过
1129
+ * const storageService = new StorageService();
1130
+ * storageService.usePlugin({
1131
+ * // 替换存储对象为 sessionStorage
1132
+ * async afterGetStorage(): Promise<StorageLike> {
1133
+ * return window.sessionStorage;
1134
+ * },
1135
+ * });
1136
+ */
1137
+ getStorage(): StorageLike;
1138
+ getNamespace(): string;
1139
+ /**
1140
+ * 清理,支持storageService.usePlugin
1141
+ */
1142
+ clear(): void;
1143
+ /**
1144
+ * 获取存储项,支持storageService.usePlugin
1145
+ */
1146
+ getItem(key: string, options?: Options$1): any;
1147
+ /**
1148
+ * 获取指定索引位置的key
1149
+ */
1150
+ key(index: number): string | null;
1151
+ /**
1152
+ * 移除存储项,支持storageService.usePlugin
1153
+ */
1154
+ removeItem(key: string, options?: Options$1): void;
1155
+ /**
1156
+ * 设置存储项,支持storageService.usePlugin
1157
+ */
1158
+ setItem(key: string, value: any, options?: Options$1): void;
1159
+ destroy(): void;
1160
+ usePlugin(options: SyncHookPlugin<SyncMethodName$1, WebStorage>): void;
1161
+ private getValueAndProtocol;
1162
+ }
1163
+ type StorageService = WebStorage;
1164
+ //#endregion
1165
+ //#region temp/packages/editor/src/sdk/validate/index.d.ts
1166
+ /**
1167
+ * `record` 模式下,校验结果要等到修改落进 DSL 之后再写入 `invalidNodeIds`(修改过程中会先清掉旧记录),
1168
+ * 因此 guard 返回一个提交函数交给调用方在合适的时机调用;`strict` 抛错,`off` 返回空。
1169
+ */
1170
+ type GuardCommit = (() => void) | undefined;
1171
+ interface Validator {
1172
+ /** 校验 DSL 中已有节点:结构(类型 / 父子关系)+ 属性表单 */
1173
+ node(id: Id): Promise<DslValidationResult>;
1174
+ /** 校验 DSL 中已有的数据源 */
1175
+ dataSource(id: Id): Promise<DslValidationResult>;
1176
+ /** 校验整份 DSL */
1177
+ dsl(): Promise<DslValidationResult>;
1178
+ /** 校验一个节点配置的属性表单(不要求它已经在 DSL 中) */
1179
+ checkNodeProps(node: MNode): Promise<DslValidationIssue[]>;
1180
+ /** 同步的结构校验:新增 */
1181
+ checkAddStructure(node: MNode, parent: MContainer | null | undefined): DslValidationIssue[];
1182
+ /** 同步的结构校验:移动 */
1183
+ checkMoveStructure(sourceIds: Id[], target: MContainer, scene: CanDropInScene): DslValidationIssue[];
1184
+ /** 同步的结构校验:数据源配置 */
1185
+ checkDataSourceStructure(config: DataSourceSchema, isNew: boolean): DslValidationIssue[];
1186
+ /** 供 service 在修改前调用:按 `validateMode` 抛出 / 记录 / 忽略。 */
1187
+ guardAdd(items: {
1188
+ node: MNode;
1189
+ parentNode: MContainer;
1190
+ }[]): Promise<GuardCommit>;
1191
+ /** `replace` 与 `editor.update` 的同名选项一致:为 true 时整节点替换,否则与旧节点深合并 */
1192
+ guardUpdate(nodes: MNode[], options?: {
1193
+ replace?: boolean;
1194
+ }): Promise<GuardCommit>;
1195
+ guardMove(sourceIds: Id[], target: MContainer, scene: CanDropInScene): Promise<void>;
1196
+ guardDataSource(config: DataSourceSchema, isNew: boolean): void;
1197
+ }
1198
+ //#endregion
1199
+ //#region temp/packages/editor/src/sdk/type.d.ts
1200
+ /**
1201
+ * 响应式实现,默认直接使用 Vue 的 `reactive` / `shallowReactive` / `toRaw` / `nextTick`;
1202
+ * 可通过 `SdkOptions.reactivity` 覆盖。
1203
+ */
1204
+ interface Reactivity {
1205
+ reactive: <T extends object>(target: T) => T;
1206
+ shallowReactive: <T extends object>(target: T) => T;
1207
+ toRaw: <T>(value: T) => T;
1208
+ nextTick: () => Promise<void>;
1209
+ }
1210
+ /** 存储适配器接口,`localStorage` 天然满足 */
1211
+ interface StorageLike {
1212
+ readonly length: number;
1213
+ clear(): void;
1214
+ getItem(key: string): string | null;
1215
+ key(index: number): string | null;
1216
+ removeItem(key: string): void;
1217
+ setItem(key: string, value: string): void;
1218
+ }
1219
+ /** 历史快照的持久化适配器(浏览器端对应 IndexedDB)。不提供则 `saveToIndexedDB` / `restoreFromIndexedDB` 会 reject */
1220
+ interface HistoryPersistence {
1221
+ get<T = unknown>(dbName: string, storeName: string, key: IDBValidKey): Promise<T | undefined>;
1222
+ set(dbName: string, storeName: string, key: IDBValidKey, value: unknown): Promise<void>;
1223
+ }
1224
+ /**
1225
+ * 依赖收集 worker 适配器。浏览器端注入基于 Web Worker 的实现,Node 下不提供,
1226
+ * 依赖收集会退回主线程的空闲队列(`IdleTask`,Node 下由 setTimeout 驱动)。
1227
+ */
1228
+ interface CollectWorkerLike {
1229
+ readonly isSupported: boolean;
1230
+ collectDsl(dsl: MApp): Promise<DepsData | null>;
1231
+ collect(payload: CollectWorkerPayload): Promise<CollectWorkerResult | null>;
1232
+ terminate(): void;
1233
+ abort(): void;
1234
+ }
1235
+ /**
1236
+ * 校验模式
1237
+ * - `strict`:修改前校验,不通过抛出 {@link DslValidationError},DSL 不被修改
1238
+ * - `record`:只把校验结果写进 `invalidNodeIds`
1239
+ * - `off`:不做额外校验
1240
+ */
1241
+ type ValidateMode = 'strict' | 'record' | 'off';
1242
+ interface DslValidationIssue {
1243
+ /** 出错对象类型 */
1244
+ target: 'node' | 'data-source' | 'code-block' | 'dsl';
1245
+ /** 出错对象 id */
1246
+ id?: Id;
1247
+ /** 出错属性路径,结构性错误时为空 */
1248
+ path?: string;
1249
+ /** 错误分类:structure 为结构合法性,props 为属性表单校验 */
1250
+ kind: 'structure' | 'props';
1251
+ message: string;
1252
+ /** 可选的修正建议(如可选值列表) */
1253
+ suggestion?: string;
1254
+ }
1255
+ interface DslValidationResult {
1256
+ valid: boolean;
1257
+ errors: DslValidationIssue[];
1258
+ }
1259
+ interface SdkOptions {
1260
+ /** 初始 DSL,会被深拷贝,不会修改传入的对象 */
1261
+ dsl?: MApp | null;
1262
+ /** 此前通过 `history.serialize()` 导出的历史快照 */
1263
+ history?: PersistedHistoryState | null;
1264
+ reactivity?: Partial<Reactivity>;
1265
+ /** 存储适配器,默认内存实现 */
1266
+ storage?: StorageLike;
1267
+ /** 把序列化后的字符串还原成值(含函数),默认 `JSON.parse`;浏览器端传入 `eval` 实现 */
1268
+ parseDSL?: (code: string) => any;
1269
+ historyPersistence?: HistoryPersistence;
1270
+ collectWorker?: CollectWorkerLike;
1271
+ /** 提示信息,默认不做任何事 */
1272
+ notify?: (type: 'success' | 'error' | 'warning' | 'info', message: string) => void;
1273
+ /** 复制文本到剪贴板,默认不做任何事 */
1274
+ copyText?: (text: string) => Promise<void> | void;
1275
+ /** 校验模式,默认 `strict` */
1276
+ validateMode?: ValidateMode;
1277
+ /** 是否自动绑定依赖收集连线,默认 true;浏览器默认实例传 false,由 initService 挂载时绑定 */
1278
+ autoWiring?: boolean;
1279
+ componentGroupList?: ComponentGroup[];
1280
+ propsConfigs?: Record<string, FormConfig | PropsFormConfigFunction>;
1281
+ propsValues?: Record<string, Partial<MNode> | PropsFormValueFunction>;
1282
+ eventMethodList?: Record<string, {
1283
+ events: EventOption[];
1284
+ methods: EventOption[];
1285
+ }>;
1286
+ datasourceList?: DatasourceTypeOption[];
1287
+ datasourceConfigs?: Record<string, FormConfig>;
1288
+ datasourceValues?: Record<string, Partial<DataSourceSchema>>;
1289
+ datasourceEventMethodList?: Record<string, {
1290
+ events: EventOption[];
1291
+ methods: EventOption[];
1292
+ }>;
1293
+ disabledCodeBlock?: boolean;
1294
+ disabledDataSource?: boolean;
1295
+ disabledPageFragment?: boolean;
1296
+ disabledMultiSelect?: boolean;
1297
+ alwaysMultiSelect?: boolean;
1298
+ canDropIn?: CanDropInFunction;
1299
+ }
1300
+ /** service 之间互相访问的上下文,用懒 getter 解开循环依赖 */
1301
+ interface SdkContext {
1302
+ readonly reactivity: Reactivity;
1303
+ readonly storage: WebStorage;
1304
+ readonly editor: Editor;
1305
+ readonly props: Props;
1306
+ readonly history: History;
1307
+ readonly dataSource: DataSource;
1308
+ readonly codeBlock: CodeBlock;
1309
+ readonly dep: Dep;
1310
+ readonly events: Events;
1311
+ readonly componentList: ComponentList;
1312
+ readonly options: Readonly<SdkOptions>;
1313
+ /** 校验模式,可在运行时通过 `sdk.ctx.validateMode = ...` 切换 */
1314
+ validateMode: ValidateMode;
1315
+ /** 校验器,`createDslSdk` 之后可用 */
1316
+ validator: Validator;
1317
+ /** 登记表全部就绪后 resolve */
1318
+ ready: Promise<void>;
1319
+ parseDSL: (code: string) => any;
1320
+ }
1321
+ //#endregion
1322
+ //#region temp/packages/editor/src/sdk/services/CodeBlock.d.ts
1323
+ declare const canUsePluginMethods$3: {
1324
+ async: readonly ["setCodeDslById", "setEditStatus", "setCombineIds", "setUndeleteableList", "deleteCodeDslByIds"];
1325
+ sync: string[];
1326
+ };
1327
+ type AsyncMethodName$2 = Writable<(typeof canUsePluginMethods$3)['async']>;
1328
+ declare class CodeBlock extends BaseService {
1329
+ private ctx;
1330
+ private state;
1331
+ /**
1332
+ * 最近一次写入历史栈的代码块历史记录 uuid(单条写入场景:新增 / 更新)。
1333
+ * 供 setCodeDslById(Sync)AndGetHistoryId 取回,普通方法不读取它。
1334
+ */
1335
+ private lastPushedHistoryId;
1336
+ /**
1337
+ * deleteCodeDslByIds 一次删除多个代码块时,按写入顺序收集的历史记录 uuid 列表。
1338
+ * 在 deleteCodeDslByIds 入口处重置,供 deleteCodeDslByIdsAndGetHistoryId 取回。
1339
+ */
1340
+ private lastDeletedHistoryIds;
1341
+ constructor(ctx: SdkContext);
1342
+ /**
1343
+ * 设置活动的代码块dsl数据源
1344
+ * @param {CodeBlockDSL} codeDsl 代码DSL
1345
+ * @returns {void}
1346
+ */
1347
+ setCodeDsl(codeDsl: CodeBlockDSL): Promise<void>;
1348
+ /**
1349
+ * 获取活动的代码块dsl数据源(默认从dsl中的codeBlocks字段读取)
1350
+ * 方法要支持钩子添加扩展,会被重写为异步方法,因此这里显示写为异步以提醒调用者需以异步形式调用
1351
+ * @param {boolean} forceRefresh 是否强制从活动dsl拉取刷新
1352
+ * @returns {CodeBlockDSL | null}
1353
+ */
1354
+ getCodeDsl(): CodeBlockDSL | null;
1355
+ /**
1356
+ * 根据代码块id获取代码块内容
1357
+ * @param {Id} id 代码块id
1358
+ * @returns {CodeBlockContent | null}
1359
+ */
1360
+ getCodeContentById(id: Id): CodeBlockContent | null;
1361
+ /**
1362
+ * 设置代码块ID和代码内容到源dsl
1363
+ * @param {Id} id 代码块id
1364
+ * @param {CodeBlockContent} codeConfig 代码块内容配置信息
1365
+ * @param options 可选配置
1366
+ * @param options.changeRecords form 端 propPath/value 列表,用于历史记录的精细化撤销/重做
1367
+ * @param options.doNotPushHistory 是否不写入历史记录(默认 false)
1368
+ * @returns {void}
1369
+ */
1370
+ setCodeDslById(id: Id, codeConfig: Partial<CodeBlockContent>, { changeRecords, doNotPushHistory, historyDescription, historySource }?: HistoryOpOptionsWithChangeRecords): Promise<void>;
1371
+ /**
1372
+ * 为了兼容历史原因
1373
+ * 设置代码块ID和代码内容到源dsl
1374
+ * @param {Id} id 代码块id
1375
+ * @param {CodeBlockContent} codeConfig 代码块内容配置信息
1376
+ * @param {boolean} force 是否强制写入,默认true
1377
+ * @param options 可选配置
1378
+ * @param options.changeRecords form 端 propPath/value 列表,用于历史记录的精细化撤销/重做
1379
+ * @param options.doNotPushHistory 是否不写入历史记录(默认 false)
1380
+ * @param options.historyDescription 入栈时附带的人类可读描述,用于历史面板展示
1381
+ * @returns {void}
1382
+ */
1383
+ setCodeDslByIdSync(id: Id, codeConfig: Partial<CodeBlockContent>, force?: boolean, { changeRecords, doNotPushHistory, historyDescription, historySource }?: HistoryOpOptionsWithChangeRecords): void;
1384
+ /**
1385
+ * 根据代码块id数组获取代码dsl
1386
+ * @param {string[]} ids 代码块id数组
1387
+ * @returns {CodeBlockDSL}
1388
+ */
1389
+ getCodeDslByIds(ids: string[]): CodeBlockDSL;
1390
+ /**
1391
+ * 获取编辑状态
1392
+ * @returns {boolean} 是否可编辑
1393
+ */
1394
+ getEditStatus(): boolean;
1395
+ /**
1396
+ * 设置编辑状态
1397
+ * @param {boolean} status 是否可编辑
1398
+ * @returns {void}
1399
+ */
1400
+ setEditStatus(status: boolean): Promise<void>;
1401
+ /**
1402
+ * 设置当前选中组件已关联绑定的代码块id数组
1403
+ * @param {string[]} ids 代码块id数组
1404
+ * @returns {void}
1405
+ */
1406
+ setCombineIds(ids: string[]): Promise<void>;
1407
+ /**
1408
+ * 获取当前选中组件已关联绑定的代码块id数组
1409
+ * @returns {string[]}
1410
+ */
1411
+ getCombineIds(): string[];
1412
+ /**
1413
+ * 获取不可删除列表
1414
+ * @returns {Id[]}
1415
+ */
1416
+ getUndeletableList(): Id[];
1417
+ /**
1418
+ * 设置不可删除列表:为业务逻辑预留的不可删除的代码块列表,由业务逻辑维护(如代码块上线后不可删除)
1419
+ * @param {Id[]} codeIds 代码块id数组
1420
+ * @returns {void}
1421
+ */
1422
+ setUndeleteableList(codeIds: Id[]): Promise<void>;
1423
+ /**
1424
+ * 设置代码草稿
1425
+ */
1426
+ setCodeDraft(codeId: Id, content: string): void;
1427
+ /**
1428
+ * 获取代码草稿
1429
+ */
1430
+ getCodeDraft(codeId: Id): string | null;
1431
+ /**
1432
+ * 删除代码草稿
1433
+ */
1434
+ removeCodeDraft(codeId: Id): void;
1435
+ /**
1436
+ * 在dsl数据源中删除指定id的代码块
1437
+ * @param {Id[]} codeIds 需要删除的代码块id数组
1438
+ * @param options 可选配置
1439
+ * @param options.doNotPushHistory 是否不写入历史记录(默认 false)
1440
+ */
1441
+ deleteCodeDslByIds(codeIds: Id[], { doNotPushHistory, historyDescription, historySource }?: HistoryOpOptions): Promise<void>;
1442
+ /**
1443
+ * 下列 *AndGetHistoryId 方法与对应的写入方法行为完全一致,
1444
+ * 返回值在 {@link DslOpWithHistoryIdsResult} 中同时包含原操作结果与本次写入的历史 uuid 列表,
1445
+ * 可用于精确引用 / 定位该条历史记录(埋点、revert、跨端同步等)。
1446
+ *
1447
+ * 当本次操作未写入历史(doNotPushHistory 为 true、或无对应记录)时 historyIds 为 `[]`。
1448
+ */
1449
+ /** 等价于 {@link setCodeDslById},并额外返回本次写入历史记录的 uuid 列表(未入栈时 historyIds 为 `[]`)。 */
1450
+ setCodeDslByIdAndGetHistoryId(id: Id, codeConfig: Partial<CodeBlockContent>, options?: HistoryOpOptionsWithChangeRecords): Promise<DslOpWithHistoryIdsResult<void>>;
1451
+ /** 等价于 {@link setCodeDslByIdSync},并额外返回本次写入历史记录的 uuid 列表(未入栈时 historyIds 为 `[]`)。 */
1452
+ setCodeDslByIdSyncAndGetHistoryId(id: Id, codeConfig: Partial<CodeBlockContent>, force?: boolean, options?: HistoryOpOptionsWithChangeRecords): DslOpWithHistoryIdsResult<void>;
1453
+ /**
1454
+ * 等价于 {@link deleteCodeDslByIds},并额外返回本次写入的全部历史记录 uuid(按删除顺序)。
1455
+ * 一次删除多个代码块会产生多条历史记录;未写入任何历史时 historyIds 为 `[]`。
1456
+ */
1457
+ deleteCodeDslByIdsAndGetHistoryId(codeIds: Id[], options?: HistoryOpOptions): Promise<DslOpWithHistoryIdsResult<void>>;
1458
+ setParamsColConfig(config: TableColumnConfig): void;
1459
+ getParamsColConfig(): TableColumnConfig | undefined;
1460
+ /**
1461
+ * 撤销指定代码块的最近一次变更。
1462
+ *
1463
+ * 内部走 setCodeDslByIdSync / deleteCodeDslByIds,因此会自动触发 codeBlockService 的
1464
+ * `addOrUpdate` / `remove` 事件,由 initService 中的 handler 重新维护 dep target
1465
+ * (DepTargetType.CODE_BLOCK 的 add / remove)。所有写回都带 `doNotPushHistory: true`,
1466
+ * 确保不会在历史栈里产生新的记录。
1467
+ *
1468
+ * @param id 代码块 id
1469
+ * @returns 撤销的 step;栈不存在或已无可撤销时返回 null
1470
+ */
1471
+ undo(id: Id): Promise<CodeBlockStepValue | null>;
1472
+ /**
1473
+ * 重做指定代码块的下一次变更。
1474
+ * @param id 代码块 id
1475
+ * @returns 重做的 step;栈不存在或已无可重做时返回 null
1476
+ */
1477
+ redo(id: Id): Promise<CodeBlockStepValue | null>;
1478
+ /** 是否可对指定代码块撤销。 */
1479
+ canUndo(id: Id): boolean;
1480
+ /** 是否可对指定代码块重做。 */
1481
+ canRedo(id: Id): boolean;
1482
+ /**
1483
+ * 跳转指定代码块的历史栈到目标游标。语义同 editor.gotoPageStep。
1484
+ *
1485
+ * @param id 代码块 id
1486
+ * @param targetCursor 目标游标位置(已应用步骤数量)
1487
+ * @returns 实际移动到的最终游标位置
1488
+ */
1489
+ goto(id: Id, targetCursor: number): Promise<number>;
1490
+ /**
1491
+ * 「回滚」指定代码块历史步骤(类 git revert 语义):
1492
+ * - 不动原始栈结构(不移动 cursor、不丢弃任何步骤);
1493
+ * - 把目标 step 的修改**反向应用**一次,并作为**新步骤**追加到栈顶;
1494
+ * - 仅对已应用的步骤生效。
1495
+ *
1496
+ * @param id 代码块 id
1497
+ * @param index 目标 step 在该栈中的索引(0 为最早),通常由历史面板传入
1498
+ * @returns 反向后产生的新 step;目标不存在 / 未应用时返回 null
1499
+ */
1500
+ revert(id: Id, index: number): Promise<CodeBlockStepValue | null>;
1501
+ /**
1502
+ * 通过历史记录 uuid 回滚代码块历史步骤,语义同 {@link revert},
1503
+ * 仅无需调用方再传 codeBlockId 与 index:内部会按 uuid 在全部代码块栈中定位对应步骤后再回滚。
1504
+ * 按数组顺序依次回滚,返回与入参同序的结果列表(某项失败时为 `null`)。
1505
+ *
1506
+ * @param uuids 目标历史记录的 uuid 列表,通常由 {@link setCodeDslByIdAndGetHistoryId} 等方法返回的 `historyIds`
1507
+ */
1508
+ revertById(uuids: string[]): Promise<(CodeBlockStepValue | null)[]>;
1509
+ /**
1510
+ * 生成代码块唯一id
1511
+ * @returns {Id} 代码块唯一id
1512
+ */
1513
+ getUniqueId(): Promise<string>;
1514
+ /**
1515
+ * 复制时会带上组件关联的代码块
1516
+ * @param config 组件节点配置
1517
+ * @returns
1518
+ */
1519
+ copyWithRelated(config: MNode | MNode[], collectorOptions?: TargetOptions): void;
1520
+ /**
1521
+ * 粘贴代码块
1522
+ * @returns
1523
+ */
1524
+ paste(): void;
1525
+ resetState(): void;
1526
+ destroy(): void;
1527
+ usePlugin(options: AsyncHookPlugin<AsyncMethodName$2, CodeBlock>): void;
1528
+ /**
1529
+ * 反向应用一个 step 并以新 step 入栈。逻辑与 applyHistoryStep(reverse=true) 同构,
1530
+ * 差异仅在于通过公开的 setCodeDslByIdSync / deleteCodeDslByIds 触发 push。
1531
+ */
1532
+ private applyRevertStep;
1533
+ /**
1534
+ * 把一条历史 step 应用到当前代码块服务上。
1535
+ *
1536
+ * 复用现有的 setCodeDslByIdSync / deleteCodeDslByIds,目的是借助它们发出的事件
1537
+ * 触发 initService 中的 dep target 维护(CODE_BLOCK 的 add / remove)。
1538
+ * 所有写回都带 `doNotPushHistory: true`,确保不会在历史栈里产生新的记录。
1539
+ *
1540
+ * - oldContent=null, newContent≠null:原始为新增 → undo 删除;redo 再次 setCodeDslByIdSync
1541
+ * - oldContent≠null, newContent=null:原始为删除 → undo 还原写入;redo 再次删除
1542
+ * - 两侧都有:原始为更新 → 按 changeRecords 局部 patch;缺省退化为整内容替换
1543
+ *
1544
+ * @param step 历史 step
1545
+ * @param reverse true=撤销,false=重做
1546
+ */
1547
+ private applyHistoryStep;
1548
+ }
1549
+ type CodeBlockService = CodeBlock;
1550
+ //#endregion
1551
+ //#region temp/packages/editor/src/services/keybinding.d.ts
1552
+ declare class Keybinding extends BaseService {
1553
+ ctrlKey: string;
1554
+ private controllers;
1555
+ private bindingList;
1556
+ private commands;
1557
+ registerCommand(command: string, handler: (e: KeyboardEvent) => void | Promise<void>): void;
1344
1558
  /**
1345
- * 获取指定类型的组件初始值
1346
- * @param type 组件类型
1347
- * @returns 组件初始值
1559
+ * @deprecated
1348
1560
  */
1349
- getPropsValue(componentType: string, { inputEvent, ...defaultValue }?: Record<string, any>): Promise<any>;
1350
- hasPropsValue(type: string): boolean;
1351
- createId(type: string | number): string;
1561
+ registeCommand(command: string, handler: (e: KeyboardEvent) => void | Promise<void>): void;
1562
+ unregisterCommand(command: string): void;
1352
1563
  /**
1353
- * 将组件与组件的子元素配置中的id都设置成一个新的ID
1354
- * 如果没有相同ID并且force为false则保持不变
1355
- * @param {Object} config 组件配置
1356
- * @param {Boolean} force 是否强制设置新的ID
1564
+ * @deprecated
1357
1565
  */
1358
- setNewItemId(config: MNode, force?: boolean): MNode;
1566
+ unregisteCommand(command: string): void;
1567
+ registerEl(name: string, el?: HTMLElement): void;
1359
1568
  /**
1360
- * 获取默认属性配置
1361
- * @param type 组件类型
1362
- * @returns Object
1569
+ * @deprecated
1363
1570
  */
1364
- getDefaultPropsValue(type: string): {
1365
- type: string;
1366
- layout: string;
1367
- style: {};
1368
- name: string;
1369
- items: never[];
1370
- } | {
1371
- type: string;
1372
- style: {};
1373
- name: string;
1374
- layout?: undefined;
1375
- items?: undefined;
1376
- };
1377
- resetState(): void;
1571
+ registeEl(name: string, el?: HTMLElement): void;
1572
+ unregisterEl(name: string): void;
1378
1573
  /**
1379
- * 替换关联ID
1380
- * @param originConfigs 原组件配置
1381
- * @param targetConfigs 待替换的组件配置
1574
+ * @deprecated
1382
1575
  */
1383
- replaceRelateId(originConfigs: MNode[], targetConfigs: MNode[], collectorOptions: TargetOptions): void;
1576
+ unregisteEl(name: string): void;
1577
+ register(maps: KeyBindingItem[]): void;
1384
1578
  /**
1385
- * 清除setNewItemId前后映射关系
1579
+ * @deprecated
1386
1580
  */
1387
- clearRelateId(): void;
1581
+ registe(map: KeyBindingItem[]): void;
1582
+ reset(): void;
1388
1583
  destroy(): void;
1389
- usePlugin(options: AsyncHookPlugin<AsyncMethodName$2, Props> & SyncHookPlugin<SyncMethodName$2, Props>): void;
1390
- /**
1391
- * 获取setNewItemId前后映射关系
1392
- * @param oldId 原组件ID
1393
- * @returns 新旧ID映射
1394
- */
1395
- private getRelateIdMap;
1396
- /**
1397
- * 记录setNewItemId前后映射关系
1398
- * @param oldId 原组件ID
1399
- * @param newId 分配的新ID
1400
- */
1401
- private setRelateId;
1584
+ private bind;
1585
+ private getKeyconKeys;
1402
1586
  }
1403
- type PropsService = Props;
1404
- declare const _default$50: Props;
1587
+ type KeybindingService = Keybinding;
1588
+ declare const _default$41: Keybinding;
1405
1589
  //#endregion
1406
1590
  //#region temp/packages/editor/src/services/stageOverlay.d.ts
1407
- declare const canUsePluginMethods$3: {
1591
+ declare const canUsePluginMethods$2: {
1408
1592
  async: never[];
1409
1593
  sync: readonly ["openOverlay", "closeOverlay", "updateOverlay", "createStage"];
1410
1594
  };
1411
- type SyncMethodName$1 = Writable<(typeof canUsePluginMethods$3)['sync']>;
1595
+ type SyncMethodName = Writable<(typeof canUsePluginMethods$2)['sync']>;
1412
1596
  declare class StageOverlay extends BaseService {
1413
1597
  private state;
1414
1598
  constructor();
@@ -1418,7 +1602,7 @@ declare class StageOverlay extends BaseService {
1418
1602
  closeOverlay(): void;
1419
1603
  updateOverlay(): void;
1420
1604
  createStage(stageOptions?: StageOptions): StageCore$1;
1421
- usePlugin(options: SyncHookPlugin<SyncMethodName$1, StageOverlay>): void;
1605
+ usePlugin(options: SyncHookPlugin<SyncMethodName, StageOverlay>): void;
1422
1606
  private createContentEl;
1423
1607
  private copyDocumentElement;
1424
1608
  private render;
@@ -1428,70 +1612,7 @@ declare class StageOverlay extends BaseService {
1428
1612
  private updateSelectStatus;
1429
1613
  }
1430
1614
  type StageOverlayService = StageOverlay;
1431
- declare const _default$51: StageOverlay;
1432
- //#endregion
1433
- //#region temp/packages/editor/src/services/storage.d.ts
1434
- interface Options$1 {
1435
- namespace?: string;
1436
- protocol?: Protocol;
1437
- }
1438
- declare enum Protocol {
1439
- OBJECT = "object",
1440
- JSON = "json",
1441
- STRING = "string",
1442
- NUMBER = "number",
1443
- BOOLEAN = "boolean"
1444
- }
1445
- declare const canUsePluginMethods$2: {
1446
- async: never[];
1447
- sync: readonly ["getStorage", "getNamespace", "clear", "getItem", "removeItem", "setItem"];
1448
- };
1449
- type SyncMethodName = Writable<(typeof canUsePluginMethods$2)['sync']>;
1450
- /**
1451
- * 数据存储服务
1452
- */
1453
- declare class WebStorage extends BaseService {
1454
- private storage;
1455
- private namespace;
1456
- constructor();
1457
- /**
1458
- * 获取数据存储对象,可以通过
1459
- * const storageService = new StorageService();
1460
- * storageService.usePlugin({
1461
- * // 替换存储对象为 sessionStorage
1462
- * async afterGetStorage(): Promise<Storage> {
1463
- * return window.sessionStorage;
1464
- * },
1465
- * });
1466
- */
1467
- getStorage(): Storage;
1468
- getNamespace(): string;
1469
- /**
1470
- * 清理,支持storageService.usePlugin
1471
- */
1472
- clear(): void;
1473
- /**
1474
- * 获取存储项,支持storageService.usePlugin
1475
- */
1476
- getItem(key: string, options?: Options$1): any;
1477
- /**
1478
- * 获取指定索引位置的key
1479
- */
1480
- key(index: number): string | null;
1481
- /**
1482
- * 移除存储项,支持storageService.usePlugin
1483
- */
1484
- removeItem(key: string, options?: Options$1): void;
1485
- /**
1486
- * 设置存储项,支持storageService.usePlugin
1487
- */
1488
- setItem(key: string, value: any, options?: Options$1): void;
1489
- destroy(): void;
1490
- usePlugin(options: SyncHookPlugin<SyncMethodName, WebStorage>): void;
1491
- private getValueAndProtocol;
1492
- }
1493
- type StorageService = WebStorage;
1494
- declare const _default$52: WebStorage;
1615
+ declare const _default$43: StageOverlay;
1495
1616
  //#endregion
1496
1617
  //#region temp/packages/editor/src/services/ui.d.ts
1497
1618
  declare const canUsePluginMethods$1: {
@@ -1511,7 +1632,76 @@ declare class Ui extends BaseService {
1511
1632
  private setStageRect;
1512
1633
  }
1513
1634
  type UiService = Ui;
1514
- declare const _default$53: Ui;
1635
+ declare const _default$44: Ui;
1636
+ //#endregion
1637
+ //#region temp/packages/editor/src/utils/undo-redo.d.ts
1638
+ /**
1639
+ * UndoRedo 栈的可序列化快照,用于持久化(如写入 IndexedDB)后再还原。
1640
+ */
1641
+ export interface SerializedUndoRedo<T = any> {
1642
+ /** 栈内全部元素(按时间正序,索引 0 为最早一步)。 */
1643
+ elementList: T[];
1644
+ /** 游标位置(已应用步骤数量)。 */
1645
+ listCursor: number;
1646
+ /** 栈容量上限。 */
1647
+ listMaxSize: number;
1648
+ }
1649
+ export declare class UndoRedo<T = any> {
1650
+ /**
1651
+ * 由 {@link UndoRedo.serialize} 产出的快照重建一个 UndoRedo 实例。
1652
+ * 游标会被夹紧到 [0, length] 区间,避免脏数据导致越界。
1653
+ *
1654
+ * @param options.isSavedStep 可选谓词:若提供,则把游标定位到「最近一条满足该谓词的记录」之后
1655
+ * (即恢复到最近一个已保存点);找不到匹配记录时退回快照中的原游标。
1656
+ */
1657
+ static fromSerialized<T = any>(data: SerializedUndoRedo<T>, options?: {
1658
+ isSavedStep?: (element: T) => boolean;
1659
+ }): UndoRedo<T>;
1660
+ private elementList;
1661
+ private listCursor;
1662
+ private listMaxSize;
1663
+ constructor(listMaxSize?: number);
1664
+ /**
1665
+ * 导出当前栈的可序列化快照(深克隆,避免外部改动污染内部状态)。
1666
+ * 配合 {@link UndoRedo.fromSerialized} 可在持久化后完整还原撤销/重做栈。
1667
+ */
1668
+ serialize(): SerializedUndoRedo<T>;
1669
+ pushElement(element: T): void;
1670
+ canUndo(): boolean;
1671
+ /** 返回被撤销的操作 */
1672
+ undo(): T | null;
1673
+ canRedo(): boolean;
1674
+ /** 返回被重做的操作 */
1675
+ redo(): T | null;
1676
+ getCurrentElement(): T | null;
1677
+ /**
1678
+ * 用 `element` 替换当前游标所在元素(cursor - 1),并丢弃其后的重做尾部(与 {@link pushElement} 的丢尾一致),
1679
+ * 游标位置保持不变(元素数量不增)。cursor 为 0(无已应用元素)时不做任何操作并返回 false。
1680
+ * 用于「连续同类记录合并」等就地替换最新一条的场景。
1681
+ */
1682
+ replaceCurrentElement(element: T): boolean;
1683
+ /**
1684
+ * 对当前游标所在元素(cursor - 1)做就地更新;cursor 为 0(全部已撤销)时不做任何操作。
1685
+ * 用于给「当前步骤」打标记(如标记为已保存)等元数据写入场景。
1686
+ */
1687
+ updateCurrentElement(updater: (element: T) => void): void;
1688
+ /** 对栈内全部元素做就地更新。用于批量清理元数据(如清空所有元素的已保存标记)。 */
1689
+ updateElements(updater: (element: T, index: number) => void): void;
1690
+ /**
1691
+ * 返回栈内全部元素的浅克隆数组(按时间顺序,索引 0 为最早一步)。
1692
+ * 仅用于历史面板等只读展示场景,不应直接修改返回值。
1693
+ */
1694
+ getElementList(): T[];
1695
+ /**
1696
+ * 当前游标位置:表示已应用的步骤数量。
1697
+ * - cursor === 0 表示全部已撤销
1698
+ * - cursor === length 表示已重做到末尾
1699
+ * 历史面板用于区分"已应用 / 已撤销"两段。
1700
+ */
1701
+ getCursor(): number;
1702
+ /** 栈内总步数。 */
1703
+ getLength(): number;
1704
+ }
1515
1705
  //#endregion
1516
1706
  //#region temp/packages/editor/src/type.d.ts
1517
1707
  export type EditorSlots = FrameworkSlots & WorkspaceSlots & SidebarSlots & PropsPanelSlots & {
@@ -1675,8 +1865,20 @@ export interface StageOptions {
1675
1865
  */
1676
1866
  disabledFlashTip?: boolean;
1677
1867
  zoom?: number;
1868
+ /** 画布 iframe 的 sandbox 属性值,不传 / false 表示不设置,见 @tmagic/stage 的 StageRenderConfig.iframeSandbox */
1869
+ iframeSandbox?: string | false;
1678
1870
  /** 画布双击前的钩子函数,返回 false 则阻止默认的双击行为 */
1679
1871
  beforeDblclick?: (event: MouseEvent) => Promise<boolean | void> | boolean | void;
1872
+ /**
1873
+ * 点击组件列表新增组件前的钩子,详见 EditorProps.beforeAppendComponent。
1874
+ * 仅点击新增时调用;返回 false 取消新增,支持异步。
1875
+ */
1876
+ beforeAppendComponent?: BeforeAppendComponent;
1877
+ /**
1878
+ * 组件列表拖入画布、写入节点前的钩子,详见 EditorProps.beforeDropComponent。
1879
+ * 仅 dragType 为组件列表时调用;返回 false 取消本次拖入,支持异步。
1880
+ */
1881
+ beforeDropComponent?: BeforeDropComponent;
1680
1882
  }
1681
1883
  /**
1682
1884
  * 节点校验错误信息,按来源(属性表单 / 样式表单)分别保存错误文案。
@@ -2048,6 +2250,16 @@ export interface ComponentItem {
2048
2250
  [key: string]: any;
2049
2251
  };
2050
2252
  }
2253
+ /**
2254
+ * 点击组件列表新增组件前的钩子。
2255
+ * 入参为当前组件列表项,允许异步;返回 false 时取消本次新增。
2256
+ */
2257
+ export type BeforeAppendComponent = (item: ComponentItem) => boolean | void | Promise<boolean | void>;
2258
+ /**
2259
+ * 组件列表拖入画布、写入节点前的钩子。
2260
+ * 入参为即将新增的节点和父节点,允许异步;返回 false 时取消本次拖入。
2261
+ */
2262
+ export type BeforeDropComponent = (dragData: AddMNode, parent: MContainer) => boolean | void | Promise<boolean | void>;
2051
2263
  export interface ComponentGroup {
2052
2264
  /** 显示文案 */
2053
2265
  title: string;
@@ -3010,7 +3222,7 @@ declare const isGlobalFlat: import("@vue/reactivity").Ref<boolean, boolean>;
3010
3222
  declare const setEditorConfig: (option: EditorInstallOptions) => void;
3011
3223
  declare const getEditorConfig: <K extends keyof EditorInstallOptions>(key: K) => EditorInstallOptions[K];
3012
3224
  //#endregion
3013
- //#region temp/packages/editor/src/utils/props.d.ts
3225
+ //#region temp/packages/editor/src/sdk/utils/props.d.ts
3014
3226
  export declare const arrayOptions: {
3015
3227
  text: string;
3016
3228
  value: string;
@@ -3041,11 +3253,22 @@ export declare const displayTabConfig: TabPaneConfig<DisplayCondsConfig>;
3041
3253
  * @param config 组件属性配置
3042
3254
  * @returns Object
3043
3255
  */
3044
- export declare const fillConfig: (config?: FormConfig, { labelWidth, disabledDataSource, disabledCodeBlock }?: {
3256
+ export interface FillConfigOptions {
3045
3257
  labelWidth?: string;
3046
3258
  disabledDataSource?: boolean;
3047
3259
  disabledCodeBlock?: boolean;
3048
- }) => FormConfig;
3260
+ /** 点击 ID 后面的复制按钮时调用,Node 下不提供则按钮不做任何事 */
3261
+ copyText?: (text: string) => Promise<void> | void;
3262
+ /** 复制结果提示 */
3263
+ notify?: (type: 'success' | 'error', message: string) => void;
3264
+ }
3265
+ //#endregion
3266
+ //#region temp/packages/editor/src/utils/props.d.ts
3267
+ /** 浏览器端默认用 `navigator.clipboard` 复制,并用 `tMagicMessage` 提示 */
3268
+ export declare const copyTextToClipboard: (text: string) => Promise<void>;
3269
+ export declare const notifyByDesign: (type: "success" | "error" | "warning" | "info", message: string) => void;
3270
+ /** 与 SDK 的 `fillConfig` 一致,区别是默认接入浏览器的剪贴板与消息提示 */
3271
+ export declare const fillConfig: (config?: FormConfig, options?: FillConfigOptions) => FormConfig;
3049
3272
  //#endregion
3050
3273
  //#region temp/packages/editor/src/utils/code-block.d.ts
3051
3274
  /**
@@ -3491,6 +3714,8 @@ export declare const validateDataSourceFieldSelect: (value: any, context: TypeMa
3491
3714
  export declare const editorTypeMatchRules: Record<string, TypeMatchValidator>;
3492
3715
  //#endregion
3493
3716
  //#region temp/packages/editor/src/utils/event.d.ts
3717
+ /** 事件相关工具函数依赖的服务,可由表单上下文(`mForm.services`)注入 */
3718
+ export type EventUtilServices = Pick<Services, 'editorService' | 'eventsService' | 'dataSourceService'>;
3494
3719
  export declare const EVENT_NAME_VALUE_SEPARATOR = ".";
3495
3720
  export type EventNameSelectOption = {
3496
3721
  text: string;
@@ -3504,7 +3729,7 @@ export declare const normalizeCompActionValue: (value: unknown) => string;
3504
3729
  /**
3505
3730
  * 组装事件名称下拉/级联 options,与 EventSelect 默认 eventNameConfig.options 逻辑一致。
3506
3731
  */
3507
- export declare const getEventNameOptions: (src: string | undefined, formValue?: Record<string, any>) => EventNameOption[];
3732
+ export declare const getEventNameOptions: (src: string | undefined, formValue?: Record<string, any>, services?: EventUtilServices) => EventNameOption[];
3508
3733
  /** 将 select / cascader options 展平为最终写入 name 的字符串集合(cascader 用 `.` 拼接) */
3509
3734
  export declare const collectEventNameOptionValues: (options: EventNameOption[], checkStrictly: boolean, prefix?: any[], result?: Set<string>) => Set<string>;
3510
3735
  /**
@@ -3516,11 +3741,11 @@ export declare const getEventNameAllowedValues: (config?: {
3516
3741
  eventNameConfig?: {
3517
3742
  options?: unknown;
3518
3743
  };
3519
- }, formValue?: Record<string, any>) => Set<string> | null;
3744
+ }, formValue?: Record<string, any>, services?: EventUtilServices) => Set<string> | null;
3520
3745
  /**
3521
3746
  * 组装联动组件动作下拉/级联 options,与 EventSelect 默认 compActionConfig.options 逻辑一致。
3522
3747
  */
3523
- export declare const getCompActionOptions: (toId?: Id) => EventNameOption[];
3748
+ export declare const getCompActionOptions: (toId?: Id, services?: EventUtilServices) => EventNameOption[];
3524
3749
  /**
3525
3750
  * 解析 event-select 联动组件动作允许的 method 集合。
3526
3751
  * 自定义 compActionConfig.options 时返回 null(跳过枚举校验)。
@@ -3532,10 +3757,10 @@ export declare const getCompActionAllowedValues: (config?: {
3532
3757
  };
3533
3758
  }, model?: {
3534
3759
  to?: Id;
3535
- }) => Set<string> | null;
3760
+ }, services?: EventUtilServices) => Set<string> | null;
3536
3761
  //#endregion
3537
3762
  //#region temp/packages/editor/src/utils/monaco-editor.d.ts
3538
- declare const _default$49: () => Promise<typeof import("monaco-editor")>;
3763
+ declare const _default$42: () => Promise<typeof import("monaco-editor")>;
3539
3764
  //#endregion
3540
3765
  //#region temp/packages/form/src/schema.d.ts
3541
3766
  interface ChangeRecord$1 {
@@ -3589,6 +3814,16 @@ interface EditorProps {
3589
3814
  runtimeUrl?: string;
3590
3815
  /** 是用iframe渲染还是直接渲染 */
3591
3816
  renderType?: RenderType;
3817
+ /**
3818
+ * 画布 iframe 的 sandbox 属性值(仅 iframe 渲染时生效)
3819
+ *
3820
+ * - 不传 / `false`:不设置 sandbox 属性(默认)
3821
+ * - 字符串:原样写入,token 空格分隔,如 `'allow-scripts allow-same-origin allow-downloads'`
3822
+ *
3823
+ * 需要注意编辑器自身依赖 `allow-scripts` + `allow-same-origin`(读写 iframe 内 DOM),
3824
+ * 其余 token(`allow-downloads`、`allow-popups`、`allow-forms` 等)按业务需要放开。
3825
+ */
3826
+ iframeSandbox?: string | false;
3592
3827
  /** 选中时是否自动滚动到可视区域 */
3593
3828
  autoScrollIntoView?: boolean;
3594
3829
  /** 组件的属性配置表单的dsl */
@@ -3685,6 +3920,17 @@ interface EditorProps {
3685
3920
  canDropIn?: CanDropInFunction;
3686
3921
  /** 画布双击前的钩子函数,返回 false 则阻止默认的双击行为 */
3687
3922
  beforeDblclick?: (event: MouseEvent) => Promise<boolean | void> | boolean | void;
3923
+ /**
3924
+ * 点击组件列表新增组件前的钩子,入参为当前组件列表项,允许异步函数。
3925
+ * 仅点击新增时调用,拖入画布不走该钩子;返回 false 取消本次新增。
3926
+ * 可直接修改入参(例如补全 data),修改会反映到最终新增的节点上。
3927
+ */
3928
+ beforeAppendComponent?: BeforeAppendComponent;
3929
+ /**
3930
+ * 组件列表拖入画布、写入节点前的钩子,入参为即将新增的节点和父节点,允许异步函数。
3931
+ * 仅当拖拽类型为组件列表时,在位置计算完成之后调用;返回 false 取消本次拖入。
3932
+ */
3933
+ beforeDropComponent?: BeforeDropComponent;
3688
3934
  /** 组件树节点双击前的钩子函数,返回 false 则阻止默认的双击行为 */
3689
3935
  beforeLayerNodeDblclick?: (event: MouseEvent, data: TreeNodeData) => Promise<boolean | void> | boolean | void;
3690
3936
  /** 历史记录面板的自定义扩展 tab,追加在内置的页面/数据源/代码块 tab 之后 */
@@ -3923,7 +4169,7 @@ declare const __VLS_base$12: import("@vue/runtime-core").DefineComponent<EditorP
3923
4169
  "onField-input"?: ((...args: any[]) => any) | undefined;
3924
4170
  "onField-change"?: ((...args: any[]) => any) | undefined;
3925
4171
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
3926
- }>, "values" | "changeHandler" | "validate" | "lastValuesProcessed" | "submitForm" | "changeRecords" | "initialized" | "formState" | "resetForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "useFieldTextInError" | "stepActive" | "validateOnInit")> & {
4172
+ }>, "values" | "validate" | "lastValuesProcessed" | "submitForm" | "changeRecords" | "formState" | "initialized" | "changeHandler" | "resetForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "useFieldTextInError" | "stepActive" | "validateOnInit")> & {
3927
4173
  values: import("@tmagic/form-schema").FormValue;
3928
4174
  lastValuesProcessed: import("@tmagic/form-schema").FormValue;
3929
4175
  formState: import("@tmagic/form-schema").FormState;
@@ -4159,7 +4405,7 @@ declare const __VLS_base$12: import("@vue/runtime-core").DefineComponent<EditorP
4159
4405
  "onField-input"?: ((...args: any[]) => any) | undefined;
4160
4406
  "onField-change"?: ((...args: any[]) => any) | undefined;
4161
4407
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
4162
- }>, "values" | "changeHandler" | "validate" | "lastValuesProcessed" | "submitForm" | "changeRecords" | "initialized" | "formState" | "resetForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "useFieldTextInError" | "stepActive" | "validateOnInit")> & {
4408
+ }>, "values" | "validate" | "lastValuesProcessed" | "submitForm" | "changeRecords" | "formState" | "initialized" | "changeHandler" | "resetForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "useFieldTextInError" | "stepActive" | "validateOnInit")> & {
4163
4409
  values: import("@tmagic/form-schema").FormValue;
4164
4410
  lastValuesProcessed: import("@tmagic/form-schema").FormValue;
4165
4411
  formState: import("@tmagic/form-schema").FormState;
@@ -4408,7 +4654,7 @@ declare const __VLS_base$12: import("@vue/runtime-core").DefineComponent<EditorP
4408
4654
  "onField-input"?: ((...args: any[]) => any) | undefined;
4409
4655
  "onField-change"?: ((...args: any[]) => any) | undefined;
4410
4656
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
4411
- }>, "values" | "changeHandler" | "validate" | "lastValuesProcessed" | "submitForm" | "changeRecords" | "initialized" | "formState" | "resetForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "useFieldTextInError" | "stepActive" | "validateOnInit")> & {
4657
+ }>, "values" | "validate" | "lastValuesProcessed" | "submitForm" | "changeRecords" | "formState" | "initialized" | "changeHandler" | "resetForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "useFieldTextInError" | "stepActive" | "validateOnInit")> & {
4412
4658
  values: import("@tmagic/form-schema").FormValue;
4413
4659
  lastValuesProcessed: import("@tmagic/form-schema").FormValue;
4414
4660
  formState: import("@tmagic/form-schema").FormState;
@@ -4644,7 +4890,7 @@ declare const __VLS_base$12: import("@vue/runtime-core").DefineComponent<EditorP
4644
4890
  "onField-input"?: ((...args: any[]) => any) | undefined;
4645
4891
  "onField-change"?: ((...args: any[]) => any) | undefined;
4646
4892
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
4647
- }>, "values" | "changeHandler" | "validate" | "lastValuesProcessed" | "submitForm" | "changeRecords" | "initialized" | "formState" | "resetForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "useFieldTextInError" | "stepActive" | "validateOnInit")> & {
4893
+ }>, "values" | "validate" | "lastValuesProcessed" | "submitForm" | "changeRecords" | "formState" | "initialized" | "changeHandler" | "resetForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "useFieldTextInError" | "stepActive" | "validateOnInit")> & {
4648
4894
  values: import("@tmagic/form-schema").FormValue;
4649
4895
  lastValuesProcessed: import("@tmagic/form-schema").FormValue;
4650
4896
  formState: import("@tmagic/form-schema").FormState;
@@ -4673,30 +4919,30 @@ declare const __VLS_base$12: import("@vue/runtime-core").DefineComponent<EditorP
4673
4919
  [key: string]: any;
4674
4920
  };
4675
4921
  renderType: import("@tmagic/stage").RenderType;
4676
- disabledDataSource: boolean;
4922
+ componentGroupList: ComponentGroup[];
4923
+ propsConfigs: Record<string, import("@tmagic/form-schema").FormConfig>;
4924
+ propsValues: Record<string, Partial<import("@tmagic/schema").MNode>>;
4925
+ eventMethodList: Record<string, {
4926
+ events: import("@tmagic/core").EventOption[];
4927
+ methods: import("@tmagic/core").EventOption[];
4928
+ }>;
4929
+ datasourceList: DatasourceTypeOption[];
4930
+ datasourceConfigs: Record<string, import("@tmagic/form-schema").FormConfig>;
4931
+ datasourceValues: Record<string, Partial<import("@tmagic/schema").DataSourceSchema>>;
4677
4932
  disabledCodeBlock: boolean;
4933
+ disabledDataSource: boolean;
4934
+ disabledPageFragment: boolean;
4678
4935
  disabledMultiSelect: boolean;
4679
4936
  alwaysMultiSelect: boolean;
4680
4937
  disabledFlashTip: boolean;
4681
- disabledPageFragment: boolean;
4682
4938
  historyListExtraTabs: HistoryListExtraTab[];
4683
4939
  disabledShowSrc: boolean;
4684
4940
  customContentMenu: CustomContentMenuFunction;
4685
- layerContentMenu: (MenuButton | MenuComponent)[];
4941
+ layerContentMenu: (MenuComponent | MenuButton)[];
4686
4942
  isContainer: (el: HTMLElement) => boolean | Promise<boolean>;
4687
4943
  containerHighlightClassName: string;
4688
- componentGroupList: ComponentGroup[];
4689
- stageContentMenu: (MenuButton | MenuComponent)[];
4944
+ stageContentMenu: (MenuComponent | MenuButton)[];
4690
4945
  disabledStageOverlay: boolean;
4691
- datasourceList: DatasourceTypeOption[];
4692
- propsConfigs: Record<string, import("@tmagic/form-schema").FormConfig>;
4693
- propsValues: Record<string, Partial<import("@tmagic/schema").MNode>>;
4694
- eventMethodList: Record<string, {
4695
- events: import("@tmagic/core").EventOption[];
4696
- methods: import("@tmagic/core").EventOption[];
4697
- }>;
4698
- datasourceValues: Record<string, Partial<import("@tmagic/schema").DataSourceSchema>>;
4699
- datasourceConfigs: Record<string, import("@tmagic/form-schema").FormConfig>;
4700
4946
  containerHighlightDuration: number;
4701
4947
  containerHighlightType: import("@tmagic/stage").ContainerHighlightType;
4702
4948
  containerHighlightAddOnly: boolean;
@@ -4751,6 +4997,17 @@ declare const __VLS_export$38: import("@vue/runtime-core").DefineComponent<__VLS
4751
4997
  }, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
4752
4998
  declare const _default$34: typeof __VLS_export$38;
4753
4999
  //#endregion
5000
+ //#region temp/packages/editor/src/services/sdk-instance.d.ts
5001
+ export declare const editorService: Editor;
5002
+ export declare const historyService: History;
5003
+ export declare const propsService: Props;
5004
+ export declare const dataSourceService: DataSource;
5005
+ export declare const codeBlockService: CodeBlock;
5006
+ export declare const depService: Dep;
5007
+ export declare const eventsService: Events;
5008
+ export declare const storageService: WebStorage;
5009
+ export declare const componentListService: ComponentList;
5010
+ //#endregion
4754
5011
  //#region temp/packages/editor/src/layouts/sidebar/ComponentListPanel.vue.d.ts
4755
5012
  type __VLS_Slots$11 = ComponentListPanelSlots;
4756
5013
  declare const __VLS_base$11: import("@vue/runtime-core").DefineComponent<{}, {}, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {}, string, import("@vue/runtime-core").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, true, {}, any>;
@@ -5274,7 +5531,7 @@ declare const __VLS_base$7: import("@vue/runtime-core").DefineComponent<__VLS_Pr
5274
5531
  "onField-input"?: ((...args: any[]) => any) | undefined;
5275
5532
  "onField-change"?: ((...args: any[]) => any) | undefined;
5276
5533
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
5277
- }>, "values" | "changeHandler" | "validate" | "lastValuesProcessed" | "submitForm" | "changeRecords" | "initialized" | "formState" | "resetForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "useFieldTextInError" | "stepActive" | "validateOnInit")> & {
5534
+ }>, "values" | "validate" | "lastValuesProcessed" | "submitForm" | "changeRecords" | "formState" | "initialized" | "changeHandler" | "resetForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "useFieldTextInError" | "stepActive" | "validateOnInit")> & {
5278
5535
  values: FormValue;
5279
5536
  lastValuesProcessed: FormValue;
5280
5537
  formState: import("@tmagic/form-schema").FormState;
@@ -5510,7 +5767,7 @@ declare const __VLS_base$7: import("@vue/runtime-core").DefineComponent<__VLS_Pr
5510
5767
  "onField-input"?: ((...args: any[]) => any) | undefined;
5511
5768
  "onField-change"?: ((...args: any[]) => any) | undefined;
5512
5769
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
5513
- }>, "values" | "changeHandler" | "validate" | "lastValuesProcessed" | "submitForm" | "changeRecords" | "initialized" | "formState" | "resetForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "useFieldTextInError" | "stepActive" | "validateOnInit")> & {
5770
+ }>, "values" | "validate" | "lastValuesProcessed" | "submitForm" | "changeRecords" | "formState" | "initialized" | "changeHandler" | "resetForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "useFieldTextInError" | "stepActive" | "validateOnInit")> & {
5514
5771
  values: FormValue;
5515
5772
  lastValuesProcessed: FormValue;
5516
5773
  formState: import("@tmagic/form-schema").FormState;
@@ -5757,7 +6014,7 @@ declare const __VLS_base$7: import("@vue/runtime-core").DefineComponent<__VLS_Pr
5757
6014
  "onField-input"?: ((...args: any[]) => any) | undefined;
5758
6015
  "onField-change"?: ((...args: any[]) => any) | undefined;
5759
6016
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
5760
- }>, "values" | "changeHandler" | "validate" | "lastValuesProcessed" | "submitForm" | "changeRecords" | "initialized" | "formState" | "resetForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "useFieldTextInError" | "stepActive" | "validateOnInit")> & {
6017
+ }>, "values" | "validate" | "lastValuesProcessed" | "submitForm" | "changeRecords" | "formState" | "initialized" | "changeHandler" | "resetForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "useFieldTextInError" | "stepActive" | "validateOnInit")> & {
5761
6018
  values: FormValue;
5762
6019
  lastValuesProcessed: FormValue;
5763
6020
  formState: import("@tmagic/form-schema").FormState;
@@ -5993,7 +6250,7 @@ declare const __VLS_base$7: import("@vue/runtime-core").DefineComponent<__VLS_Pr
5993
6250
  "onField-input"?: ((...args: any[]) => any) | undefined;
5994
6251
  "onField-change"?: ((...args: any[]) => any) | undefined;
5995
6252
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
5996
- }>, "values" | "changeHandler" | "validate" | "lastValuesProcessed" | "submitForm" | "changeRecords" | "initialized" | "formState" | "resetForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "useFieldTextInError" | "stepActive" | "validateOnInit")> & {
6253
+ }>, "values" | "validate" | "lastValuesProcessed" | "submitForm" | "changeRecords" | "formState" | "initialized" | "changeHandler" | "resetForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "useFieldTextInError" | "stepActive" | "validateOnInit")> & {
5997
6254
  values: FormValue;
5998
6255
  lastValuesProcessed: FormValue;
5999
6256
  formState: import("@tmagic/form-schema").FormState;
@@ -6219,7 +6476,7 @@ declare const __VLS_base$6: import("@vue/runtime-core").DefineComponent<__VLS_Pr
6219
6476
  "onField-input"?: ((...args: any[]) => any) | undefined;
6220
6477
  "onField-change"?: ((...args: any[]) => any) | undefined;
6221
6478
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
6222
- }>, "values" | "changeHandler" | "validate" | "lastValuesProcessed" | "submitForm" | "changeRecords" | "initialized" | "formState" | "resetForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "useFieldTextInError" | "stepActive" | "validateOnInit")> & {
6479
+ }>, "values" | "validate" | "lastValuesProcessed" | "submitForm" | "changeRecords" | "formState" | "initialized" | "changeHandler" | "resetForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "useFieldTextInError" | "stepActive" | "validateOnInit")> & {
6223
6480
  values: FormValue;
6224
6481
  lastValuesProcessed: FormValue;
6225
6482
  formState: import("@tmagic/form-schema").FormState;
@@ -6263,8 +6520,8 @@ type __VLS_Props$14 = {
6263
6520
  declare const __VLS_export$17: import("@vue/runtime-core").DefineComponent<__VLS_Props$14, {
6264
6521
  getElRef: () => Readonly<import("@vue/reactivity").ShallowRef<HTMLDivElement | null>>;
6265
6522
  }, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {}, string, import("@vue/runtime-core").PublicProps, Readonly<__VLS_Props$14> & Readonly<{}>, {
6266
- data: MenuButton | MenuComponent;
6267
- eventType: "mousedown" | "mouseup" | "click";
6523
+ data: MenuComponent | MenuButton;
6524
+ eventType: "click" | "mousedown" | "mouseup";
6268
6525
  }, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
6269
6526
  declare const _default$36: typeof __VLS_export$17;
6270
6527
  //#endregion
@@ -6310,7 +6567,7 @@ declare const __VLS_base$5: import("@vue/runtime-core").DefineComponent<__VLS_Pr
6310
6567
  onShow?: (() => any) | undefined;
6311
6568
  onHide?: (() => any) | undefined;
6312
6569
  }>, {
6313
- menuData: (MenuButton | MenuComponent)[];
6570
+ menuData: (MenuComponent | MenuButton)[];
6314
6571
  isSubMenu: boolean;
6315
6572
  autoHide: boolean;
6316
6573
  }, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
@@ -6435,7 +6692,7 @@ declare const __VLS_export$11: import("@vue/runtime-core").DefineComponent<__VLS
6435
6692
  reload: () => Promise<void>;
6436
6693
  }, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {}, string, import("@vue/runtime-core").PublicProps, Readonly<__VLS_Props$9> & Readonly<{}>, {
6437
6694
  labelWidth: string;
6438
- category: CompareCategory;
6695
+ category: string;
6439
6696
  }, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
6440
6697
  declare const _default$5: typeof __VLS_export$11;
6441
6698
  //#endregion
@@ -6451,7 +6708,7 @@ declare const __VLS_export$10: import("@vue/runtime-core").DefineComponent<__VLS
6451
6708
  }, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {}, string, import("@vue/runtime-core").PublicProps, Readonly<__VLS_Props$8> & Readonly<{}>, {
6452
6709
  disabled: boolean;
6453
6710
  labelWidth: string;
6454
- category: CompareCategory;
6711
+ category: string;
6455
6712
  }, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
6456
6713
  declare const _default$39: typeof __VLS_export$10;
6457
6714
  //#endregion
@@ -6859,8 +7116,8 @@ declare const _default$33: typeof __VLS_export;
6859
7116
  export declare const editorFields: Record<string, HeadlessFieldOptions>;
6860
7117
  //#endregion
6861
7118
  //#region temp/packages/editor/src/plugin.d.ts
6862
- declare const _default$43: {
7119
+ declare const _default$40: {
6863
7120
  install: (app: App, opt?: Partial<EditorInstallOptions | DesignPluginOptions | FormInstallOptions>) => void;
6864
7121
  };
6865
7122
  //#endregion
6866
- export { _default as CodeBlockEditor, _default$1 as CodeBlockList, _default$2 as CodeBlockListPanel, _default$3 as CodeSelect, _default$4 as CodeSelectCol, _default$5 as CompareForm, _default$6 as ComponentListPanel, _default$7 as CondOpSelect, _default$8 as ContentMenu, _default$9 as DataSourceAddButton, _default$10 as DataSourceConfigPanel, _default$11 as DataSourceFieldSelect, _default$12 as DataSourceFields, _default$13 as DataSourceInput, _default$14 as DataSourceMethodSelect, _default$15 as DataSourceMethods, _default$16 as DataSourceMocks, _default$17 as DataSourceSelect, DepTargetType, _default$18 as DisplayConds, _default$19 as EventSelect, _default$20 as FloatingBox, _default$21 as HistoryDiffDialog, _default$22 as HistoryListBucket, _default$23 as HistoryListBucketTab, _default$24 as Icon, _default$25 as KeyValue, _default$26 as LayerNodeContent, _default$27 as LayerPanel, _default$28 as LayoutContainer, _default$28 as SplitView, type OnDrag, _default$29 as PageFragmentSelect, _default$30 as PropsFormPanel, _default$31 as PropsPanel, _default$32 as Resizer, StageCore, _default$33 as StyleSetter, _default$34 as TMagicCodeEditor, _default$35 as TMagicEditor, _default$36 as ToolButton, _default$37 as Tree, _default$38 as TreeNode, type TypeMatchValidateContext, _default$39 as ViewForm, _default$40 as codeBlockService, _default$41 as componentListService, _default$42 as dataSourceService, _default$43 as default, _default$44 as depService, designPlugin, _default$45 as editorService, _default$46 as eventsService, formPlugin, getEditorConfig, _default$47 as historyService, isGlobalFlat, _default$48 as keybindingService, _default$49 as loadMonaco, _default$50 as propsService, setEditorConfig, _default$51 as stageOverlayService, _default$52 as storageService, tablePlugin, _default$53 as uiService };
7123
+ export { _default as CodeBlockEditor, _default$1 as CodeBlockList, _default$2 as CodeBlockListPanel, _default$3 as CodeSelect, _default$4 as CodeSelectCol, _default$5 as CompareForm, _default$6 as ComponentListPanel, _default$7 as CondOpSelect, _default$8 as ContentMenu, _default$9 as DataSourceAddButton, _default$10 as DataSourceConfigPanel, _default$11 as DataSourceFieldSelect, _default$12 as DataSourceFields, _default$13 as DataSourceInput, _default$14 as DataSourceMethodSelect, _default$15 as DataSourceMethods, _default$16 as DataSourceMocks, _default$17 as DataSourceSelect, DepTargetType, _default$18 as DisplayConds, _default$19 as EventSelect, _default$20 as FloatingBox, _default$21 as HistoryDiffDialog, _default$22 as HistoryListBucket, _default$23 as HistoryListBucketTab, _default$24 as Icon, _default$25 as KeyValue, _default$26 as LayerNodeContent, _default$27 as LayerPanel, _default$28 as LayoutContainer, _default$28 as SplitView, type OnDrag, _default$29 as PageFragmentSelect, _default$30 as PropsFormPanel, _default$31 as PropsPanel, _default$32 as Resizer, StageCore, _default$33 as StyleSetter, _default$34 as TMagicCodeEditor, _default$35 as TMagicEditor, _default$36 as ToolButton, _default$37 as Tree, _default$38 as TreeNode, type TypeMatchValidateContext, _default$39 as ViewForm, _default$40 as default, designPlugin, formPlugin, getEditorConfig, isGlobalFlat, _default$41 as keybindingService, _default$42 as loadMonaco, setEditorConfig, _default$43 as stageOverlayService, tablePlugin, _default$44 as uiService };