@tmagic/editor 1.8.0-beta.5 → 1.8.0-beta.6

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 (42) hide show
  1. package/dist/es/fields/CodeSelectCol.vue_vue_type_script_setup_true_lang.js +4 -1
  2. package/dist/es/fields/DataSourceFieldSelect/FieldSelect.vue_vue_type_script_setup_true_lang.js +8 -2
  3. package/dist/es/fields/DataSourceFields.vue_vue_type_script_setup_true_lang.js +25 -8
  4. package/dist/es/fields/DataSourceMethodSelect.vue_vue_type_script_setup_true_name_true_lang.js +6 -4
  5. package/dist/es/fields/DataSourceMethods.vue_vue_type_script_setup_true_lang.js +25 -12
  6. package/dist/es/fields/StyleSetter/components/Border.vue_vue_type_script_setup_true_lang.js +27 -5
  7. package/dist/es/index.js +2 -2
  8. package/dist/es/layouts/history-list/HistoryListPanel.vue_vue_type_script_setup_true_lang.js +2 -2
  9. package/dist/es/layouts/history-list/InitialRow.vue_vue_type_script_setup_true_lang.js +12 -4
  10. package/dist/es/layouts/sidebar/data-source/DataSourceConfigPanel.vue_vue_type_script_setup_true_lang.js +16 -3
  11. package/dist/es/layouts/sidebar/data-source/DataSourceListPanel.vue_vue_type_script_setup_true_lang.js +23 -1
  12. package/dist/es/services/codeBlock.js +30 -19
  13. package/dist/es/services/dataSource.js +29 -21
  14. package/dist/es/services/editor.js +52 -33
  15. package/dist/es/services/history.js +10 -15
  16. package/dist/es/style.css +4 -1
  17. package/dist/es/utils/data-source/index.js +2 -0
  18. package/dist/es/utils/editor.js +68 -48
  19. package/dist/es/utils/history.js +42 -33
  20. package/dist/style.css +4 -1
  21. package/dist/tmagic-editor.umd.cjs +376 -206
  22. package/package.json +7 -7
  23. package/src/fields/CodeSelectCol.vue +7 -1
  24. package/src/fields/DataSourceFieldSelect/FieldSelect.vue +16 -2
  25. package/src/fields/DataSourceFields.vue +37 -8
  26. package/src/fields/DataSourceMethodSelect.vue +9 -4
  27. package/src/fields/DataSourceMethods.vue +42 -21
  28. package/src/fields/StyleSetter/components/Border.vue +15 -6
  29. package/src/layouts/history-list/HistoryListPanel.vue +2 -2
  30. package/src/layouts/history-list/InitialRow.vue +3 -0
  31. package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +30 -2
  32. package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +26 -1
  33. package/src/services/codeBlock.ts +28 -22
  34. package/src/services/dataSource.ts +29 -24
  35. package/src/services/editor.ts +41 -37
  36. package/src/services/history.ts +14 -19
  37. package/src/theme/style-setter/border.scss +4 -1
  38. package/src/type.ts +16 -1
  39. package/src/utils/data-source/index.ts +2 -0
  40. package/src/utils/editor.ts +125 -59
  41. package/src/utils/history.ts +46 -36
  42. package/types/index.d.ts +87 -68
package/types/index.d.ts CHANGED
@@ -196,20 +196,20 @@ declare class CodeBlock extends BaseService {
196
196
  }?: HistoryOpOptions): Promise<void>;
197
197
  /**
198
198
  * 下列 *AndGetHistoryId 方法与对应的写入方法行为完全一致,
199
- * 唯一区别是返回值为本次写入历史栈的历史记录 uuid({@link CodeBlockStepValue.uuid}),
199
+ * 返回值在 {@link DslOpWithHistoryIdsResult} 中同时包含原操作结果与本次写入的历史 uuid 列表,
200
200
  * 可用于精确引用 / 定位该条历史记录(埋点、revert、跨端同步等)。
201
201
  *
202
- * 当本次操作未写入历史(doNotPushHistory 为 true、或无对应记录)时:单条写入返回 null,批量删除返回空数组。
202
+ * 当本次操作未写入历史(doNotPushHistory 为 true、或无对应记录)时 historyIds 为 `[]`。
203
203
  */
204
- /** 等价于 {@link setCodeDslById},但返回本次写入历史记录的 uuid(未入栈时返回 null)。 */
205
- setCodeDslByIdAndGetHistoryId(id: Id, codeConfig: Partial<CodeBlockContent>, options?: HistoryOpOptionsWithChangeRecords): Promise<string | null>;
206
- /** 等价于 {@link setCodeDslByIdSync},但返回本次写入历史记录的 uuid(未入栈时返回 null)。 */
207
- setCodeDslByIdSyncAndGetHistoryId(id: Id, codeConfig: Partial<CodeBlockContent>, force?: boolean, options?: HistoryOpOptionsWithChangeRecords): string | null;
204
+ /** 等价于 {@link setCodeDslById},并额外返回本次写入历史记录的 uuid 列表(未入栈时 historyIds 为 `[]`)。 */
205
+ setCodeDslByIdAndGetHistoryId(id: Id, codeConfig: Partial<CodeBlockContent>, options?: HistoryOpOptionsWithChangeRecords): Promise<DslOpWithHistoryIdsResult<void>>;
206
+ /** 等价于 {@link setCodeDslByIdSync},并额外返回本次写入历史记录的 uuid 列表(未入栈时 historyIds 为 `[]`)。 */
207
+ setCodeDslByIdSyncAndGetHistoryId(id: Id, codeConfig: Partial<CodeBlockContent>, force?: boolean, options?: HistoryOpOptionsWithChangeRecords): DslOpWithHistoryIdsResult<void>;
208
208
  /**
209
- * 等价于 {@link deleteCodeDslByIds},但返回本次写入的全部历史记录 uuid(按删除顺序)。
210
- * 一次删除多个代码块会产生多条历史记录,因此返回数组;未写入任何历史时返回空数组。
209
+ * 等价于 {@link deleteCodeDslByIds},并额外返回本次写入的全部历史记录 uuid(按删除顺序)。
210
+ * 一次删除多个代码块会产生多条历史记录;未写入任何历史时 historyIds 为 `[]`。
211
211
  */
212
- deleteCodeDslByIdsAndGetHistoryId(codeIds: Id[], options?: HistoryOpOptions): Promise<string[]>;
212
+ deleteCodeDslByIdsAndGetHistoryId(codeIds: Id[], options?: HistoryOpOptions): Promise<DslOpWithHistoryIdsResult<void>>;
213
213
  setParamsColConfig(config: TableColumnConfig): void;
214
214
  getParamsColConfig(): TableColumnConfig | undefined;
215
215
  /**
@@ -254,14 +254,13 @@ declare class CodeBlock extends BaseService {
254
254
  */
255
255
  revert(id: Id, index: number): Promise<CodeBlockStepValue | null>;
256
256
  /**
257
- * 通过历史记录 uuid 回滚某条代码块历史步骤,语义同 {@link revert},
258
- * 仅无需调用方再传 codeBlockId 与 index:内部会按 uuid({@link CodeBlockStepValue.uuid})
259
- * 在全部代码块栈中定位对应步骤后再回滚。
257
+ * 通过历史记录 uuid 回滚代码块历史步骤,语义同 {@link revert},
258
+ * 仅无需调用方再传 codeBlockId 与 index:内部会按 uuid 在全部代码块栈中定位对应步骤后再回滚。
259
+ * 按数组顺序依次回滚,返回与入参同序的结果列表(某项失败时为 `null`)。
260
260
  *
261
- * @param uuid 目标历史记录的 uuid,通常由 {@link setCodeDslByIdAndGetHistoryId} 等方法返回
262
- * @returns 反向后产生的新 step;找不到对应 uuid / 未应用时返回 null
261
+ * @param uuids 目标历史记录的 uuid 列表,通常由 {@link setCodeDslByIdAndGetHistoryId} 等方法返回的 `historyIds`
263
262
  */
264
- revertById(uuid: string): Promise<CodeBlockStepValue | null>;
263
+ revertById(uuids: string[]): Promise<(CodeBlockStepValue | null)[]>;
265
264
  /**
266
265
  * 生成代码块唯一id
267
266
  * @returns {Id} 代码块唯一id
@@ -404,17 +403,17 @@ declare class DataSource extends BaseService {
404
403
  }?: HistoryOpOptions): void;
405
404
  /**
406
405
  * 下列 *AndGetHistoryId 方法与对应的 add / update / remove 行为完全一致,
407
- * 唯一区别是返回值为本次写入历史栈的历史记录 uuid{@link DataSourceStepValue.uuid}),
408
- * 而非数据源配置。可用于精确引用 / 定位该条历史记录(埋点、revert、跨端同步等)。
406
+ * 返回值在 {@link DslOpWithHistoryIdsResult} 中同时包含原操作结果与本次写入历史栈的 uuid 列表({@link DataSourceStepValue.uuid}),
407
+ * 可用于精确引用 / 定位该条历史记录(埋点、revert、跨端同步等)。
409
408
  *
410
- * 当本次操作未写入历史(doNotPushHistory 为 true、或无对应记录)时返回 null。
409
+ * 当本次操作未写入历史(doNotPushHistory 为 true、或无对应记录)时 historyIds 为 `[]`。
411
410
  */
412
- /** 等价于 {@link add},但返回本次写入历史记录的 uuid(未入栈时返回 null)。 */
413
- addAndGetHistoryId(config: DataSourceSchema, options?: HistoryOpOptions): string | null;
414
- /** 等价于 {@link update},但返回本次写入历史记录的 uuid(未入栈时返回 null)。 */
415
- updateAndGetHistoryId(config: DataSourceSchema, options?: HistoryOpOptionsWithChangeRecords): string | null;
416
- /** 等价于 {@link remove},但返回本次写入历史记录的 uuid(未入栈时返回 null)。 */
417
- removeAndGetHistoryId(id: string, options?: HistoryOpOptions): string | null;
411
+ /** 等价于 {@link add},并额外返回本次写入历史记录的 uuid 列表(未入栈时 historyIds 为 `[]`)。 */
412
+ addAndGetHistoryId(config: DataSourceSchema, options?: HistoryOpOptions): DslOpWithHistoryIdsResult<DataSourceSchema>;
413
+ /** 等价于 {@link update},并额外返回本次写入历史记录的 uuid 列表(未入栈时 historyIds 为 `[]`)。 */
414
+ updateAndGetHistoryId(config: DataSourceSchema, options?: HistoryOpOptionsWithChangeRecords): DslOpWithHistoryIdsResult<DataSourceSchema>;
415
+ /** 等价于 {@link remove},并额外返回本次写入历史记录的 uuid 列表(未入栈时 historyIds 为 `[]`)。 */
416
+ removeAndGetHistoryId(id: string, options?: HistoryOpOptions): DslOpWithHistoryIdsResult<void>;
418
417
  /**
419
418
  * 撤销指定数据源的最近一次变更。
420
419
  *
@@ -456,14 +455,13 @@ declare class DataSource extends BaseService {
456
455
  */
457
456
  revert(id: Id, index: number): DataSourceStepValue | null;
458
457
  /**
459
- * 通过历史记录 uuid 回滚某条数据源历史步骤,语义同 {@link revert},
460
- * 仅无需调用方再传 dataSourceId 与 index:内部会按 uuid({@link DataSourceStepValue.uuid})
461
- * 在全部数据源栈中定位对应步骤后再回滚。
458
+ * 通过历史记录 uuid 回滚数据源历史步骤,语义同 {@link revert},
459
+ * 仅无需调用方再传 dataSourceId 与 index:内部会按 uuid 在全部数据源栈中定位对应步骤后再回滚。
460
+ * 按数组顺序依次回滚,返回与入参同序的结果列表(某项失败时为 `null`)。
462
461
  *
463
- * @param uuid 目标历史记录的 uuid,通常由 {@link addAndGetHistoryId} 等方法返回
464
- * @returns 反向后产生的新 step;找不到对应 uuid / 未应用时返回 null
462
+ * @param uuids 目标历史记录的 uuid 列表,通常由 {@link addAndGetHistoryId} 等方法返回的 `historyIds`
465
463
  */
466
- revertById(uuid: string): DataSourceStepValue | null;
464
+ revertById(uuids: string[]): (DataSourceStepValue | null)[];
467
465
  createId(): string;
468
466
  getDataSourceById(id: string): DataSourceSchema | undefined;
469
467
  resetState(): void;
@@ -801,29 +799,29 @@ declare class Editor extends BaseService {
801
799
  }?: DslOpOptions): Promise<void>;
802
800
  /**
803
801
  * 下列 *AndGetHistoryId 方法与对应的普通操作(add / remove / update ...)行为完全一致,
804
- * 唯一区别是返回值为本次写入历史栈的历史记录 uuid{@link StepValue.uuid}),
805
- * 而非节点 / 节点数组。可用于精确引用 / 定位该条历史记录(埋点、revert、跨端同步等)。
802
+ * 返回值在 {@link DslOpWithHistoryIdsResult} 中同时包含原操作结果与本次写入历史栈的 uuid 列表({@link StepValue.uuid}),
803
+ * 可用于精确引用 / 定位该条历史记录(埋点、revert、跨端同步等)。
806
804
  *
807
- * 当本次操作未写入历史(doNotPushHistory 为 true、或操作无实际变更 / 提前返回)时返回 null。
805
+ * 当本次操作未写入历史(doNotPushHistory 为 true、或操作无实际变更 / 提前返回)时 historyIds 为 `[]`。
808
806
  */
809
- /** 等价于 {@link add},但返回本次写入历史记录的 uuid(未入栈时返回 null)。 */
810
- addAndGetHistoryId(addNode: AddMNode | MNode[], parent?: MContainer | null, options?: DslOpOptions): Promise<string | null>;
811
- /** 等价于 {@link remove},但返回本次写入历史记录的 uuid(未入栈时返回 null)。 */
812
- removeAndGetHistoryId(nodeOrNodeList: MNode | MNode[], options?: DslOpOptions): Promise<string | null>;
813
- /** 等价于 {@link update},但返回本次写入历史记录的 uuid(未入栈时返回 null)。 */
807
+ /** 等价于 {@link add},并额外返回本次写入历史记录的 uuid 列表(未入栈时 historyIds 为 `[]`)。 */
808
+ addAndGetHistoryId(addNode: AddMNode | MNode[], parent?: MContainer | null, options?: DslOpOptions): Promise<DslOpWithHistoryIdsResult<MNode | MNode[]>>;
809
+ /** 等价于 {@link remove},并额外返回本次写入历史记录的 uuid 列表(未入栈时 historyIds 为 `[]`)。 */
810
+ removeAndGetHistoryId(nodeOrNodeList: MNode | MNode[], options?: DslOpOptions): Promise<DslOpWithHistoryIdsResult<void>>;
811
+ /** 等价于 {@link update},并额外返回本次写入历史记录的 uuid 列表(未入栈时 historyIds 为 `[]`)。 */
814
812
  updateAndGetHistoryId(config: MNode | MNode[], data?: {
815
813
  changeRecords?: ChangeRecord[];
816
814
  changeRecordList?: ChangeRecord[][];
817
815
  doNotPushHistory?: boolean;
818
816
  historyDescription?: string;
819
817
  historySource?: HistoryOpSource;
820
- }): Promise<string | null>;
821
- /** 等价于 {@link moveLayer},但返回本次写入历史记录的 uuid(未入栈时返回 null)。 */
822
- moveLayerAndGetHistoryId(offset: number | LayerOffset, options?: DslOpOptions): Promise<string | null>;
823
- /** 等价于 {@link moveToContainer},但返回本次写入历史记录的 uuid(未入栈时返回 null)。 */
824
- moveToContainerAndGetHistoryId(config: MNode | MNode[], targetId: Id, options?: DslOpOptions): Promise<string | null>;
825
- /** 等价于 {@link dragTo},但返回本次写入历史记录的 uuid(未入栈时返回 null)。 */
826
- dragToAndGetHistoryId(config: MNode | MNode[], targetParent: MContainer, targetIndex: number, options?: DslOpOptions): Promise<string | null>;
818
+ }): Promise<DslOpWithHistoryIdsResult<MNode | MNode[]>>;
819
+ /** 等价于 {@link moveLayer},并额外返回本次写入历史记录的 uuid 列表(未入栈时 historyIds 为 `[]`)。 */
820
+ moveLayerAndGetHistoryId(offset: number | LayerOffset, options?: DslOpOptions): Promise<DslOpWithHistoryIdsResult<void>>;
821
+ /** 等价于 {@link moveToContainer},并额外返回本次写入历史记录的 uuid 列表(未入栈时 historyIds 为 `[]`)。 */
822
+ moveToContainerAndGetHistoryId(config: MNode | MNode[], targetId: Id, options?: DslOpOptions): Promise<DslOpWithHistoryIdsResult<MNode | MNode[]>>;
823
+ /** 等价于 {@link dragTo},并额外返回本次写入历史记录的 uuid 列表(未入栈时 historyIds 为 `[]`)。 */
824
+ dragToAndGetHistoryId(config: MNode | MNode[], targetParent: MContainer, targetIndex: number, options?: DslOpOptions): Promise<DslOpWithHistoryIdsResult<void>>;
827
825
  /**
828
826
  * 撤销当前操作
829
827
  * @returns 被撤销的操作
@@ -852,14 +850,13 @@ declare class Editor extends BaseService {
852
850
  */
853
851
  revertPageStep(index: number): Promise<StepValue | null>;
854
852
  /**
855
- * 通过历史记录 uuid 回滚当前页面的某条历史步骤,语义与 {@link revertPageStep} 完全一致,
856
- * 仅入参从 index 改为 uuid{@link StepValue.uuid})。uuid 不随栈内步骤增删而变化,
857
- * 更适合业务侧持有引用后再回滚(埋点、跨端同步等场景)。
853
+ * 通过历史记录 uuid 回滚当前页面的历史步骤,语义与 {@link revertPageStep} 完全一致,
854
+ * 仅入参从 index 改为 uuid 列表({@link StepValue.uuid})。按数组顺序依次回滚,
855
+ * 返回与入参同序的结果列表(某项失败时为 `null`)。
858
856
  *
859
- * @param uuid 目标历史记录的 uuid,通常由 *AndGetHistoryId 方法返回
860
- * @returns 反向后产生的新 step;找不到对应 uuid / 未应用 / 反向失败时返回 null
857
+ * @param uuids 目标历史记录的 uuid 列表,通常由 *AndGetHistoryId 方法返回的 `historyIds`
861
858
  */
862
- revertPageStepById(uuid: string): Promise<StepValue | null>;
859
+ revertPageStepById(uuids: string[]): Promise<(StepValue | null)[]>;
863
860
  /**
864
861
  * 跳转当前页面历史栈到指定游标位置。
865
862
  *
@@ -1170,11 +1167,8 @@ declare class History extends BaseService {
1170
1167
  */
1171
1168
  getPageHistoryGroups(pageId?: Id): PageHistoryGroup[];
1172
1169
  /**
1173
- * 取出全部代码块的历史栈,按 codeBlockId 分组。
1174
- * 同一栈内相邻、同 opType 且作用于同一 id 的多步会被合并为一个 group:
1175
- * - 这正是"代码块/数据源各自按 id 分栈"的天然表现,再叠加"连续修改同目标的相邻步骤合并展示"。
1176
- * - 合并后 group 暴露子步骤数组,UI 可展开查看每一步的 changeRecords。
1177
- * - applied 字段:组内最后一步是否处于已应用段。
1170
+ * 取出全部代码块的历史栈,按 codeBlockId 分桶展示。
1171
+ * 同一栈内每条操作记录独立成组,不做相邻 update 合并。
1178
1172
  */
1179
1173
  getCodeBlockHistoryGroups(): CodeBlockHistoryGroup[];
1180
1174
  /**
@@ -1224,7 +1218,7 @@ declare class History extends BaseService {
1224
1218
  index: number;
1225
1219
  } | null;
1226
1220
  /**
1227
- * 取出全部数据源的历史栈,按 dataSourceId 分组。同上。
1221
+ * 取出全部数据源的历史栈,按 dataSourceId 分桶展示。同上,每条操作独立成组。
1228
1222
  */
1229
1223
  getDataSourceHistoryGroups(): DataSourceHistoryGroup[];
1230
1224
  /**
@@ -1754,6 +1748,7 @@ interface EditorNodeInfo {
1754
1748
  node: MNode | null;
1755
1749
  parent: MContainer | null;
1756
1750
  page: MPage | MPageFragment | null;
1751
+ path: MNode[];
1757
1752
  }
1758
1753
  interface AddMNode {
1759
1754
  type: string;
@@ -2049,6 +2044,11 @@ type HistoryOpType = 'add' | 'remove' | 'update' | 'initial';
2049
2044
  * 通过 `(string & {})` 允许业务侧扩展自定义途径字符串,同时保留内置值的自动补全。
2050
2045
  */
2051
2046
  type HistoryOpSource = 'initial' | 'stage' | 'tree' | 'component-panel' | 'props' | 'code' | 'root-code' | 'stage-contextmenu' | 'tree-contextmenu' | 'toolbar' | 'shortcut' | 'rollback' | 'api' | 'ai' | 'sync' | 'unknown' | (string & {});
2047
+ /** *AndGetHistoryId 系列方法返回值:原操作结果 + 本次写入历史记录的 uuid 列表(未入栈时为 `[]`)。 */
2048
+ type DslOpWithHistoryIdsResult<T> = {
2049
+ result: T;
2050
+ historyIds: string[];
2051
+ };
2052
2052
  /**
2053
2053
  * 单条变更的 diff 描述,统一表达「页面节点 / 代码块 / 数据源」的变化内容,
2054
2054
  * 被 {@link StepValue} / {@link CodeBlockStepValue} / {@link DataSourceStepValue} 的 `diff` 复用。
@@ -2397,6 +2397,8 @@ type AsyncHookPlugin<T extends Array<string>, C extends Record<T[number], (...ar
2397
2397
  type SyncHookPlugin<T extends Array<string>, C extends Record<T[number], (...args: any) => any>> = AddPrefixToObject<PascalCasedProperties<SyncBeforeHook<T, C>>, 'before'> & AddPrefixToObject<PascalCasedProperties<SyncAfterHook<T, C>>, 'after'>;
2398
2398
  interface EventBusEvent {
2399
2399
  'edit-data-source': [id: string];
2400
+ 'edit-data-source-method': [id: string, methodName: string];
2401
+ 'edit-data-source-field': [id: string, fieldPath: string[]];
2400
2402
  'remove-data-source': [id: string];
2401
2403
  'edit-code': [id: string];
2402
2404
  }
@@ -2419,7 +2421,9 @@ interface PageBarSortOptions extends PartSortableOptions {
2419
2421
  }
2420
2422
  type CustomContentMenuFunction = (menus: (MenuButton | MenuComponent)[], type: 'layer' | 'data-source' | 'viewer' | 'code-block') => (MenuButton | MenuComponent)[];
2421
2423
  interface EditorEvents {
2422
- 'root-change': [value: StoreState['root'], preValue?: StoreState['root']];
2424
+ 'root-change': [value: StoreState['root'], preValue?: StoreState['root'], options?: {
2425
+ historySource?: HistoryOpSource;
2426
+ }];
2423
2427
  select: [node: MNode | null];
2424
2428
  add: [nodes: MNode[]];
2425
2429
  remove: [nodes: MNode[]];
@@ -2784,10 +2788,10 @@ declare const getRelativeStyle: (style?: Record<string, any>) => Record<string,
2784
2788
  declare const getInitPositionStyle: (style: Record<string, any> | undefined, layout: Layout) => Record<string, any>;
2785
2789
  declare const setChildrenLayout: (node: MContainer, layout: Layout) => MContainer;
2786
2790
  declare const setLayout: (node: MNode, layout: Layout) => import("@tmagic/schema").MComponent | undefined;
2787
- declare const change2Fixed: (node: MNode, root: MApp) => {
2791
+ declare const change2Fixed: (node: MNode, path: MNode[]) => {
2788
2792
  [key: string]: any;
2789
2793
  };
2790
- declare const Fixed2Other: (node: MNode, root: MApp, getLayout: (parent: MNode, node?: MNode) => Promise<Layout>) => Promise<Record<string, any>>;
2794
+ declare const Fixed2Other: (node: MNode, path: MNode[], getLayout: (parent: MNode, node?: MNode) => Promise<Layout>) => Promise<Record<string, any>>;
2791
2795
  declare const getGuideLineFromCache: (key: string) => number[];
2792
2796
  declare const fixNodeLeft: (config: MNode, parent: MContainer, doc?: Document) => any;
2793
2797
  declare const fixNodePosition: (config: MNode, parent: MContainer, stage: StageCore$1 | null) => import("@tmagic/schema").StyleSchema | undefined;
@@ -2815,7 +2819,7 @@ declare const resolveSelectedNode: (config: MNode | Id, getNodeInfoFn: (id: Id)
2815
2819
  * @param getLayoutFn 获取父节点布局方式的回调函数
2816
2820
  * @returns 处理后的节点配置(深拷贝)
2817
2821
  */
2818
- declare const toggleFixedPosition: (dist: MNode, src: MNode, root: MApp, getLayoutFn: (parent: MNode, node?: MNode | null) => Promise<Layout>) => Promise<MNode>;
2822
+ declare const toggleFixedPosition: (dist: MNode, src: MNode, path: MNode[], getLayoutFn: (parent: MNode, node?: MNode | null) => Promise<Layout>) => Promise<MNode>;
2819
2823
  /**
2820
2824
  * 根据键盘移动的偏移量计算节点的新样式
2821
2825
  * 仅对 absolute 或 fixed 定位的节点生效;优先修改 top/left,若未设置则修改 bottom/right
@@ -3042,8 +3046,7 @@ declare const markStackSaved: <S extends {
3042
3046
  }>(undoRedo?: UndoRedo<S>) => void;
3043
3047
  /**
3044
3048
  * 把单个「按 id 分栈」的历史栈(代码块 / 数据源)拆成若干 group:
3045
- * - 把"新增/删除"独立成组(语义上属于一次性事件,不应与 update 合并);
3046
- * - 连续 'update' 合并到同一组,组内 steps 顺序就是发生顺序。
3049
+ * 每条操作记录独立成组,不做相邻 update 合并(与页面历史的合并策略不同)。
3047
3050
  *
3048
3051
  * 代码块与数据源除 `kind` 外结构完全一致,统一由本方法处理;`kind` 决定返回的具体分组类型。
3049
3052
  */
@@ -3075,15 +3078,27 @@ declare const mergePageSteps: (pageId: Id, list: StepValue[], cursor: number) =>
3075
3078
  declare const detectPageTargetId: (step: StepValue) => Id | undefined;
3076
3079
  /** 解析 StepValue 中的目标节点可读名(用于 UI 展示)。 */
3077
3080
  declare const detectPageTargetName: (step: StepValue) => string | undefined;
3078
- /** 把 `Record<Id, UndoRedo>` 整体序列化为 `Record<Id, SerializedUndoRedo>`。 */
3079
- declare const serializeStacks: <T>(stacks: Record<Id, UndoRedo<T>>) => Record<Id, SerializedUndoRedo<T>>;
3081
+ /**
3082
+ * `Record<Id, UndoRedo>` 整体序列化为 `Record<Id, SerializedUndoRedo>`。
3083
+ *
3084
+ * 序列化(深克隆)的同一趟里,只把每条 step 中可能含函数的 `diff` 用 serialize-javascript 序列化成字符串,
3085
+ * 其余字段(uuid / opType / timestamp / `modifiedNodeIds` Map 等)原样保留,交给 IndexedDB 结构化克隆。
3086
+ * 这样既能写入函数,又避免序列化整份快照的开销;读取时再由 {@link parseStacksStepDiff} 还原 diff。
3087
+ * 不含 `diff` 的元素(如通用栈)原样透传。
3088
+ */
3089
+ declare const serializeStacks: <T extends {
3090
+ diff?: unknown;
3091
+ }>(stacks: Record<Id, UndoRedo<T>>) => Record<Id, SerializedUndoRedo<T>>;
3080
3092
  /**
3081
3093
  * 把 `Record<Id, SerializedUndoRedo>` 整体还原为 `Record<Id, UndoRedo>`。
3082
3094
  * 还原时把每个栈的游标定位到最近一条已保存(`saved === true`)记录之后。
3095
+ *
3096
+ * 与 {@link serializeStacks} 相反:当传入 `parse`(parseDSL)时,把每条 step 中以字符串形式存储的 `diff`
3097
+ * 解析回真实对象(含函数);不含 `diff` 的元素(如通用栈)原样透传。
3083
3098
  */
3084
3099
  declare const deserializeStacks: <T extends {
3085
3100
  saved?: boolean;
3086
- }>(stacks?: Record<Id, ReturnType<UndoRedo<T>["serialize"]>>) => Record<Id, UndoRedo<T>>;
3101
+ }>(stacks?: Record<Id, ReturnType<UndoRedo<T>["serialize"]>>, parse?: (serialized: string) => unknown) => Record<Id, UndoRedo<T>>;
3087
3102
  /**
3088
3103
  * 按 id 从「按 id 分栈」的记录表(代码块 / 数据源)中获取(或创建)对应的 UndoRedo 栈。
3089
3104
  */
@@ -3093,6 +3108,8 @@ declare const getOrCreateStack: <T>(stacks: Record<Id, UndoRedo<T>>, id: Id) =>
3093
3108
  * 用于把 cursor 钉在基线之上,保证 undo / canUndo / goto 都不会越过初始基线。
3094
3109
  */
3095
3110
  declare const undoFloor: (undoRedo: UndoRedo<StepValue>) => number;
3111
+ /** 将单次 push 产生的 history uuid(或 null)转为 *AndGetHistoryId 返回用的 uuid 列表。 */
3112
+ declare const getLastPushedHistoryIds: (historyId: string | null) => string[];
3096
3113
  //#endregion
3097
3114
  //#region temp/packages/editor/src/utils/const.d.ts
3098
3115
  /** 当uiService.get('uiSelectMode')为true,点击组件(包括任何形式,组件树/画布)时触发的事件名 */
@@ -4486,7 +4503,9 @@ type __VLS_WithSlots$8<T, S> = T & {
4486
4503
  type __VLS_Props$17 = {
4487
4504
  title?: string;
4488
4505
  values: any;
4489
- disabled: boolean;
4506
+ disabled: boolean; /** 打开后需要直接定位并打开的方法名,传入时默认激活「方法定义」tab */
4507
+ editMethodName?: string; /** 打开后需要直接定位并打开的字段路径,传入时默认激活「数据定义」tab */
4508
+ editFieldPath?: string[];
4490
4509
  };
4491
4510
  type __VLS_ModelProps$2 = {
4492
4511
  'visible'?: boolean;
@@ -6199,4 +6218,4 @@ declare const _default$40: {
6199
6218
  install: (app: App, opt?: Partial<EditorInstallOptions | DesignPluginOptions | FormInstallOptions>) => void;
6200
6219
  };
6201
6220
  //#endregion
6202
- export { AddMNode, AddPrefixToObject, AsyncAfterHook, AsyncBeforeHook, AsyncHookPlugin, AsyncMethodName, BaseStepValue, BeforeAdd, CODE_DRAFT_STORAGE_KEY, COPY_CODE_STORAGE_KEY, COPY_DS_STORAGE_KEY, COPY_STORAGE_KEY, CanDropInFunction, CanDropInScene, _default as CodeBlockEditor, CodeBlockHistoryGroup, _default$1 as CodeBlockList, _default$2 as CodeBlockListPanel, CodeBlockListPanelSlots, CodeBlockListSlots, CodeBlockStepValue, CodeDeleteErrorType, CodeDslItem, CodeParamStatement, CodeRelation, _default$3 as CodeSelect, _default$4 as CodeSelectCol, CodeState, ColumnLayout, CombineInfo, CompareCategory, _default$5 as CompareForm, CompareFormLoadConfig, CompareFormLoadConfigContext, ComponentGroup, ComponentGroupState, ComponentItem, _default$6 as ComponentListPanel, ComponentListPanelSlots, _default$7 as CondOpSelect, _default$8 as ContentMenu, CustomContentMenuFunction, DEFAULT_LEFT_COLUMN_WIDTH, DEFAULT_RIGHT_COLUMN_WIDTH, _default$9 as DataSourceAddButton, _default$10 as DataSourceConfigPanel, _default$11 as DataSourceFieldSelect, _default$12 as DataSourceFields, DataSourceHistoryGroup, _default$13 as DataSourceInput, DataSourceListSlots, _default$14 as DataSourceMethodSelect, _default$15 as DataSourceMethods, _default$16 as DataSourceMocks, _default$17 as DataSourceSelect, DataSourceStepValue, DatasourceTypeOption, DepTargetType, DiffDialogPayload, _default$18 as DisplayConds, DragClassification, DragType, DslOpOptions, EditorEvents, EditorInstallOptions, EditorNodeInfo, EditorSlots, EventBus, EventBusEvent, _default$19 as EventSelect, Fixed2Other, _default$20 as FloatingBox, FrameworkSlots, GetCodeBlockFormConfigOptions, GetColumnWidth, GetConfig, H_GUIDE_LINE_STORAGE_KEY, HistoryBucketConfig, _default$21 as HistoryDiffDialog, _default$22 as HistoryListBucket, _default$23 as HistoryListBucketTab, HistoryListExtraTab, HistoryOpOptions, HistoryOpOptionsWithChangeRecords, HistoryOpSource, HistoryOpType, HistoryPersistOptions, HistoryRowDescriptor, HistoryState, _default$24 as Icon, IdleTask, IdleTaskEvents, IsExpandableFunction, KeyBindingCacheItem, KeyBindingCommand, KeyBindingItem, _default$25 as KeyValue, Keys, LEFT_COLUMN_WIDTH_STORAGE_KEY, LayerNodeSlots, LayerNodeStatus, LayerOffset, _default$26 as LayerPanel, LayerPanelSlots, Layout, _default$27 as LayoutContainer, _default$27 as SplitView, ListState, MIN_CENTER_COLUMN_WIDTH, MIN_LEFT_COLUMN_WIDTH, MIN_RIGHT_COLUMN_WIDTH, MenuBarData, MenuButton, MenuComponent, MenuItem, type OnDrag, PROPS_PANEL_WIDTH_STORAGE_KEY, PageBarSortOptions, _default$28 as PageFragmentSelect, PageHistoryGroup, PageHistoryStepEntry, PartSortableOptions, PastePosition, PersistedHistoryState, PropsFormConfigFunction, _default$29 as PropsFormPanel, PropsFormValueFunction, _default$30 as PropsPanel, PropsPanelSlots, PropsState, RIGHT_COLUMN_WIDTH_STORAGE_KEY, _default$31 as Resizer, ScrollViewer, ScrollViewerEvent, ScrollViewerSlots, SerializedUndoRedo, Services, SetColumnWidth, SideBarData, SideComponent, SideItem, SideItemKey, SidebarSlots, StageCore, StageOptions, StageOverlayState, StageRect, StageSlots, StepDiffItem, StepValue, StoreState, StoreStateKey, _default$32 as StyleSetter, SyncAfterHook, SyncBeforeHook, SyncHookPlugin, _default$33 as TMagicCodeEditor, _default$34 as TMagicEditor, _default$35 as ToolButton, _default$36 as Tree, _default$37 as TreeNode, TreeNodeData, UI_SELECT_MODE_EVENT_NAME, UiState, UndoRedo, V_GUIDE_LINE_STORAGE_KEY, WorkspaceSlots, advancedTabConfig, arrayOptions, beforePaste, buildChangeRecords, calcAlignCenterStyle, calcLayerTargetIndex, calcMoveStyle, canUsePluginMethods, change2Fixed, classifyDragSources, _default$38 as codeBlockService, collectRelatedNodes, createStackStep, _default$39 as dataSourceService, debug, _default$40 as default, defaultIsExpandable, _default$41 as depService, describeRevertStep, describeStepForRevert, deserializeStacks, designPlugin, detectPageTargetId, detectPageTargetName, detectStackOpType, displayTabConfig, editorNodeMergeCustomizer, _default$42 as editorService, eqOptions, error, eventTabConfig, _default$43 as eventsService, fillConfig, fixNodeLeft, fixNodePosition, formPlugin, generatePageName, generatePageNameByApp, getAddParent, getCascaderOptionsFromFields, getCodeBlockFormConfig, getDefaultConfig, getDisplayField, getEditorConfig, getFieldType, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getOrCreateStack, getPageFragmentList, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, _default$44 as historyService, idbDelete, idbGet, idbSet, info, isIncludeDataSource, isIndexedDBSupported, _default$45 as loadMonaco, log, markStackSaved, mergePageSteps, mergeStackSteps, moveItemsInContainer, numberOptions, openIndexedDB, _default$46 as propsService, resolveSelectedNode, serializeConfig, serializeStacks, setChildrenLayout, setEditorConfig, setLayout, _default$47 as stageOverlayService, _default$48 as storageService, styleTabConfig, tablePlugin, toggleFixedPosition, _default$49 as uiService, undoFloor, updateStatus, useCodeBlockEdit, useEditorContentHeight, useFilter, useFloatBox, useGetSo, useNextFloatBoxPosition, useNodeStatus, useServices, useStage, useWindowRect, warn };
6221
+ export { AddMNode, AddPrefixToObject, AsyncAfterHook, AsyncBeforeHook, AsyncHookPlugin, AsyncMethodName, BaseStepValue, BeforeAdd, CODE_DRAFT_STORAGE_KEY, COPY_CODE_STORAGE_KEY, COPY_DS_STORAGE_KEY, COPY_STORAGE_KEY, CanDropInFunction, CanDropInScene, _default as CodeBlockEditor, CodeBlockHistoryGroup, _default$1 as CodeBlockList, _default$2 as CodeBlockListPanel, CodeBlockListPanelSlots, CodeBlockListSlots, CodeBlockStepValue, CodeDeleteErrorType, CodeDslItem, CodeParamStatement, CodeRelation, _default$3 as CodeSelect, _default$4 as CodeSelectCol, CodeState, ColumnLayout, CombineInfo, CompareCategory, _default$5 as CompareForm, CompareFormLoadConfig, CompareFormLoadConfigContext, ComponentGroup, ComponentGroupState, ComponentItem, _default$6 as ComponentListPanel, ComponentListPanelSlots, _default$7 as CondOpSelect, _default$8 as ContentMenu, CustomContentMenuFunction, DEFAULT_LEFT_COLUMN_WIDTH, DEFAULT_RIGHT_COLUMN_WIDTH, _default$9 as DataSourceAddButton, _default$10 as DataSourceConfigPanel, _default$11 as DataSourceFieldSelect, _default$12 as DataSourceFields, DataSourceHistoryGroup, _default$13 as DataSourceInput, DataSourceListSlots, _default$14 as DataSourceMethodSelect, _default$15 as DataSourceMethods, _default$16 as DataSourceMocks, _default$17 as DataSourceSelect, DataSourceStepValue, DatasourceTypeOption, DepTargetType, DiffDialogPayload, _default$18 as DisplayConds, DragClassification, DragType, DslOpOptions, DslOpWithHistoryIdsResult, EditorEvents, EditorInstallOptions, EditorNodeInfo, EditorSlots, EventBus, EventBusEvent, _default$19 as EventSelect, Fixed2Other, _default$20 as FloatingBox, FrameworkSlots, GetCodeBlockFormConfigOptions, GetColumnWidth, GetConfig, H_GUIDE_LINE_STORAGE_KEY, HistoryBucketConfig, _default$21 as HistoryDiffDialog, _default$22 as HistoryListBucket, _default$23 as HistoryListBucketTab, HistoryListExtraTab, HistoryOpOptions, HistoryOpOptionsWithChangeRecords, HistoryOpSource, HistoryOpType, HistoryPersistOptions, HistoryRowDescriptor, HistoryState, _default$24 as Icon, IdleTask, IdleTaskEvents, IsExpandableFunction, KeyBindingCacheItem, KeyBindingCommand, KeyBindingItem, _default$25 as KeyValue, Keys, LEFT_COLUMN_WIDTH_STORAGE_KEY, LayerNodeSlots, LayerNodeStatus, LayerOffset, _default$26 as LayerPanel, LayerPanelSlots, Layout, _default$27 as LayoutContainer, _default$27 as SplitView, ListState, MIN_CENTER_COLUMN_WIDTH, MIN_LEFT_COLUMN_WIDTH, MIN_RIGHT_COLUMN_WIDTH, MenuBarData, MenuButton, MenuComponent, MenuItem, type OnDrag, PROPS_PANEL_WIDTH_STORAGE_KEY, PageBarSortOptions, _default$28 as PageFragmentSelect, PageHistoryGroup, PageHistoryStepEntry, PartSortableOptions, PastePosition, PersistedHistoryState, PropsFormConfigFunction, _default$29 as PropsFormPanel, PropsFormValueFunction, _default$30 as PropsPanel, PropsPanelSlots, PropsState, RIGHT_COLUMN_WIDTH_STORAGE_KEY, _default$31 as Resizer, ScrollViewer, ScrollViewerEvent, ScrollViewerSlots, SerializedUndoRedo, Services, SetColumnWidth, SideBarData, SideComponent, SideItem, SideItemKey, SidebarSlots, StageCore, StageOptions, StageOverlayState, StageRect, StageSlots, StepDiffItem, StepValue, StoreState, StoreStateKey, _default$32 as StyleSetter, SyncAfterHook, SyncBeforeHook, SyncHookPlugin, _default$33 as TMagicCodeEditor, _default$34 as TMagicEditor, _default$35 as ToolButton, _default$36 as Tree, _default$37 as TreeNode, TreeNodeData, UI_SELECT_MODE_EVENT_NAME, UiState, UndoRedo, V_GUIDE_LINE_STORAGE_KEY, WorkspaceSlots, advancedTabConfig, arrayOptions, beforePaste, buildChangeRecords, calcAlignCenterStyle, calcLayerTargetIndex, calcMoveStyle, canUsePluginMethods, change2Fixed, classifyDragSources, _default$38 as codeBlockService, collectRelatedNodes, createStackStep, _default$39 as dataSourceService, debug, _default$40 as default, defaultIsExpandable, _default$41 as depService, describeRevertStep, describeStepForRevert, deserializeStacks, designPlugin, detectPageTargetId, detectPageTargetName, detectStackOpType, displayTabConfig, editorNodeMergeCustomizer, _default$42 as editorService, eqOptions, error, eventTabConfig, _default$43 as eventsService, fillConfig, fixNodeLeft, fixNodePosition, formPlugin, generatePageName, generatePageNameByApp, getAddParent, getCascaderOptionsFromFields, getCodeBlockFormConfig, getDefaultConfig, getDisplayField, getEditorConfig, getFieldType, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getLastPushedHistoryIds, getNodeIndex, getOrCreateStack, getPageFragmentList, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, _default$44 as historyService, idbDelete, idbGet, idbSet, info, isIncludeDataSource, isIndexedDBSupported, _default$45 as loadMonaco, log, markStackSaved, mergePageSteps, mergeStackSteps, moveItemsInContainer, numberOptions, openIndexedDB, _default$46 as propsService, resolveSelectedNode, serializeConfig, serializeStacks, setChildrenLayout, setEditorConfig, setLayout, _default$47 as stageOverlayService, _default$48 as storageService, styleTabConfig, tablePlugin, toggleFixedPosition, _default$49 as uiService, undoFloor, updateStatus, useCodeBlockEdit, useEditorContentHeight, useFilter, useFloatBox, useGetSo, useNextFloatBoxPosition, useNodeStatus, useServices, useStage, useWindowRect, warn };