@flowgram-vue/free-history-plugin 0.2.0

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 (36) hide show
  1. package/LICENSE +22 -0
  2. package/dist/index.cjs +681 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.ts +194 -0
  5. package/dist/index.js +672 -0
  6. package/dist/index.js.map +1 -0
  7. package/package.json +64 -0
  8. package/src/changes/add-line-change.ts +36 -0
  9. package/src/changes/add-node-change.ts +35 -0
  10. package/src/changes/change-line-data.ts +33 -0
  11. package/src/changes/delete-line-change.ts +36 -0
  12. package/src/changes/delete-node-change.ts +33 -0
  13. package/src/changes/index.ts +12 -0
  14. package/src/composables/index.ts +6 -0
  15. package/src/composables/use-undo-redo.ts +38 -0
  16. package/src/create-free-history-plugin.ts +38 -0
  17. package/src/env.d.ts +10 -0
  18. package/src/free-history-config.ts +73 -0
  19. package/src/free-history-manager.ts +127 -0
  20. package/src/free-history-registers.ts +18 -0
  21. package/src/handlers/change-content-handler.ts +48 -0
  22. package/src/handlers/drag-nodes-handler.ts +44 -0
  23. package/src/history-entity-manager.ts +44 -0
  24. package/src/hooks/index.ts +6 -0
  25. package/src/index.ts +11 -0
  26. package/src/operation-metas/add-line.ts +44 -0
  27. package/src/operation-metas/add-node.ts +46 -0
  28. package/src/operation-metas/base.ts +23 -0
  29. package/src/operation-metas/change-line-data.ts +58 -0
  30. package/src/operation-metas/delete-line.ts +41 -0
  31. package/src/operation-metas/delete-node.ts +44 -0
  32. package/src/operation-metas/drag-nodes.ts +43 -0
  33. package/src/operation-metas/index.ts +24 -0
  34. package/src/operation-metas/move-child-nodes.ts +42 -0
  35. package/src/operation-metas/reset-layout.ts +33 -0
  36. package/src/types.ts +173 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/history-entity-manager.ts","../src/types.ts","../src/handlers/drag-nodes-handler.ts","../src/free-history-config.ts","../src/changes/delete-node-change.ts","../src/changes/delete-line-change.ts","../src/changes/change-line-data.ts","../src/changes/add-node-change.ts","../src/changes/add-line-change.ts","../src/changes/index.ts","../src/handlers/change-content-handler.ts","../src/operation-metas/base.ts","../src/operation-metas/reset-layout.ts","../src/operation-metas/move-child-nodes.ts","../src/operation-metas/drag-nodes.ts","../src/operation-metas/delete-node.ts","../src/operation-metas/delete-line.ts","../src/operation-metas/change-line-data.ts","../src/operation-metas/add-node.ts","../src/operation-metas/add-line.ts","../src/operation-metas/index.ts","../src/free-history-registers.ts","../src/free-history-manager.ts","../src/create-free-history-plugin.ts","../src/composables/use-undo-redo.ts"],"names":["DisposableCollection","cloneDeep","isEqual","injectable","FreeOperationType","TransformData","inject","HistoryService","FreeHistoryConfig","WorkflowContentChangeType","WorkflowDocument","WorkflowResetLayoutService","OperationType","document","FlowNodeBaseType","WorkflowLinesManager","FreeHistoryRegisters","WorkflowDragService","PositionData","WorkflowOperationBaseService","definePluginCreator","bindContributions","OperationContribution","HistoryContainerModule","useService","ref","onBeforeUnmount"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAYO,IAAM,uBAAN,MAAiD;AAAA,EAAjD,WAAA,GAAA;AACL,IAAA,IAAA,CAAQ,iBAAA,uBAAkD,GAAA,EAAI;AAE9D,IAAA,IAAA,CAAQ,UAAA,GAAmC,IAAIA,0BAAA,EAAqB;AAAA,EAAA;AAAA,EAEpE,cAAc,UAAA,EAAwB;AACpC,IAAA,IAAA,CAAK,kBAAkB,GAAA,CAAI,UAAA,EAAYC,mBAAU,UAAA,CAAW,MAAA,EAAQ,CAAC,CAAA;AACrE,IAAA,IAAA,CAAK,UAAA,CAAW,IAAA;AAAA,MACd,UAAA,CAAW,YAAA,CAAa,CAAC,KAAA,KAAU;AACjC,QAAA,MAAM,KAAA,GAAQ,MAAM,MAAA,EAAO;AAC3B,QAAA,MAAM,QAAA,GAAW,IAAA,CAAK,iBAAA,CAAkB,GAAA,CAAI,UAAU,CAAA;AACtD,QAAA,IAAIC,gBAAA,CAAQ,K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A,CAA0B,oBAAoB,CAAA,CAAE,OAAA,EAAQ;AAAA,EAC9D,CAAA;AAAA,EACA,gBAAA,EAAkB,CAACe,8BAAsB;AAC3C,CAAC;ACpBM,SAAS,WAAA,GAAwB;AACtC,EAAA,MAAM,cAAA,GAAiBC,gBAA2BjB,sBAAc,CAAA;AAChE,EAAA,MAAM,OAAA,GAAUkB,QAAI,KAAK,CAAA;AACzB,EAAA,MAAM,OAAA,GAAUA,QAAI,KAAK,CAAA;AAEzB,EAAA,MAAM,SAAA,GAAY,cAAA,CAAe,eAAA,CAAgB,QAAA,CAAS,MAAM;AAC9D,IAAA,OAAA,CAAQ,KAAA,GAAQ,eAAe,OAAA,EAAQ;AACvC,IAAA,OAAA,CAAQ,KAAA,GAAQ,eAAe,OAAA,EAAQ;AAAA,EACzC,CAAC,CAAA;AAED,EAAAC,mBAAA,CAAgB,MAAM;AACpB,IAAA,SAAA,CAAU,OAAA,EAAQ;AAAA,EACpB,CAAC,CAAA;AAED,EAAA,OAAO;AAAA,IACL,OAAA;AAAA,IACA,OAAA;AAAA,IACA,IAAA,EAAM,MAAM,cAAA,CAAe,IAAA,EAAK;AAAA,IAChC,IAAA,EAAM,MAAM,cAAA,CAAe,IAAA;AAAK,GAClC;AACF","file":"index.cjs","sourcesContent":["/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\n/* eslint-disable @typescript-eslint/naming-convention */\nimport { cloneDeep, isEqual } from 'lodash-es';\nimport { injectable } from 'inversify';\nimport { type Disposable, DisposableCollection } from '@flowgram-vue/utils';\nimport { type EntityData } from '@flowgram-vue/core';\n\n@injectable()\nexport class HistoryEntityManager implements Disposable {\n private _entityDataValues: Map<EntityData, unknown> = new Map();\n\n private _toDispose: DisposableCollection = new DisposableCollection();\n\n addEntityData(entityData: EntityData) {\n this._entityDataValues.set(entityData, cloneDeep(entityData.toJSON()));\n this._toDispose.push(\n entityData.onWillChange((event) => {\n const value = event.toJSON();\n const oldValue = this._entityDataValues.get(entityData);\n if (isEqual(value, oldValue)) {\n return;\n }\n this._entityDataValues.set(entityData, cloneDeep(value));\n })\n );\n }\n\n getValue(entityData: EntityData) {\n return this._entityDataValues.get(entityData);\n }\n\n setValue(entityData: EntityData, value: unknown) {\n return this._entityDataValues.set(entityData, value);\n }\n\n dispose() {\n this._entityDataValues.clear();\n this._toDispose.dispose();\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\n/* eslint-disable @typescript-eslint/naming-convention */\nimport { type IPoint } from '@flowgram-vue/utils';\nimport { type Operation, type OperationMeta } from '@flowgram-vue/history';\nimport {\n type WorkflowContentChangeType,\n type WorkflowContentChangeEvent,\n type WorkflowLineEntity,\n type WorkflowLinePortInfo,\n type WorkflowNodeJSON,\n type PositionMap,\n} from '@flowgram-vue/free-layout-core';\nimport { type FlowNodeEntity, type FlowNodeJSON } from '@flowgram-vue/document';\nimport { type EntityData, type PluginContext } from '@flowgram-vue/core';\n\nexport enum FreeOperationType {\n addLine = 'addLine',\n deleteLine = 'deleteLine',\n changeLineData = 'changeLineData',\n moveNode = 'moveNode',\n addNode = 'addNode',\n deleteNode = 'deleteNode',\n changeNodeData = 'changeNodeData',\n resetLayout = 'resetLayout',\n dragNodes = 'dragNodes',\n moveChildNodes = 'moveChildNodes',\n}\n\nexport interface AddOrDeleteLineOperationValue extends WorkflowLinePortInfo {\n id: string;\n}\n\nexport interface ChangeLineDataValue {\n id: string;\n oldValue: unknown;\n newValue: unknown;\n}\nexport interface AddOrDeleteWorkflowNodeOperationValue {\n node: WorkflowNodeJSON;\n parentID?: string;\n}\n\nexport interface AddLineOperation extends Operation {\n type: FreeOperationType.addLine;\n value: AddOrDeleteLineOperationValue;\n}\n\nexport interface ChangeLineDataOperation extends Operation {\n type: FreeOperationType.changeLineData;\n value: ChangeLineDataValue;\n}\n\nexport interface DeleteLineOperation extends Operation {\n type: FreeOperationType.deleteLine;\n value: AddOrDeleteLineOperationValue;\n}\n\nexport interface MoveNodeOperation extends Operation {\n type: FreeOperationType.moveNode;\n value: MoveNodeOperationValue;\n}\n\nexport interface AddWorkflowNodeOperation extends Operation {\n type: FreeOperationType.addNode;\n value: AddOrDeleteWorkflowNodeOperationValue;\n}\n\nexport interface DeleteWorkflowNodeOperation extends Operation {\n type: FreeOperationType.deleteNode;\n value: AddOrDeleteWorkflowNodeOperationValue;\n}\n\nexport interface MoveNodeOperationValue {\n id: string;\n value: {\n x: number;\n y: number;\n };\n oldValue: {\n x: number;\n y: number;\n };\n}\n\nexport interface DragNodeOperationValue {\n ids: string[];\n value: IPoint[];\n oldValue: IPoint[];\n}\n\nexport interface ResetLayoutOperationValue {\n ids: string[];\n value: PositionMap;\n oldValue: PositionMap;\n}\n\nexport interface ContentChangeTypeToOperation<T extends Operation> {\n type: WorkflowContentChangeType;\n toOperation: (event: WorkflowContentChangeEvent, ctx: PluginContext) => T | undefined;\n}\n\nexport interface EntityDataType {\n type: FreeOperationType;\n toEntityData: (node: FlowNodeEntity, ctx: PluginContext) => EntityData;\n}\n\nexport interface ChangeNodeDataValue {\n id: string;\n value: unknown;\n oldValue: unknown;\n path: string;\n}\n\nexport interface ChangeLineDataValue {\n id: string;\n newValue: unknown;\n oldValue: unknown;\n}\n\n/**\n * 将node转成json\n */\nexport type NodeToJson = (node: FlowNodeEntity) => FlowNodeJSON;\n/**\n * 将line转成json\n */\nexport type LineToJson = (node: WorkflowLineEntity) => FlowNodeJSON;\n/**\n * 根据节点id获取label\n */\nexport type GetNodeLabelById = (id: string) => string;\n/**\n * 根据节点获取label\n */\nexport type GetNodeLabel = (node: FlowNodeJSON) => string;\n/**\n * 根据分支获取label\n */\nexport type GetBlockLabel = (node: FlowNodeJSON) => string;\n/**\n * 根据节点获取URI\n */\nexport type GetNodeURI = (id: string) => string | any;\n/**\n * 根据连线获取URI\n */\nexport type GetLineURI = (id: string) => string | any;\n\n/**\n * 插件配置\n */\nexport interface FreeHistoryPluginOptions<CTX extends PluginContext = PluginContext> {\n enable?: boolean;\n limit?: number;\n nodeToJSON?: (ctx: CTX) => NodeToJson;\n getNodeLabelById?: (ctx: CTX) => GetNodeLabelById;\n getNodeLabel?: (ctx: CTX) => GetNodeLabel;\n getBlockLabel?: (ctx: CTX) => GetBlockLabel;\n getNodeURI?: (ctx: CTX) => GetNodeURI;\n getLineURI?: (ctx: CTX) => GetLineURI;\n operationMetas?: OperationMeta[];\n enableChangeNode?: boolean; // default true\n enableChangeLineData?: boolean; // default true\n uri?: string | any;\n}\n\nexport interface IHandler<E> {\n handle: (event: E, ctx: PluginContext) => void | Promise<void>;\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\n/* eslint-disable @typescript-eslint/naming-convention */\nimport { injectable, inject } from 'inversify';\nimport { HistoryService } from '@flowgram-vue/history';\nimport { type NodesDragEndEvent } from '@flowgram-vue/free-layout-core';\nimport { TransformData } from '@flowgram-vue/core';\n\nimport { FreeOperationType, type IHandler } from '../types';\n\n@injectable()\nexport class DragNodesHandler implements IHandler<NodesDragEndEvent> {\n @inject(HistoryService)\n private _historyService: HistoryService;\n\n handle(event: NodesDragEndEvent) {\n if (event.type === 'onDragEnd') {\n this._dragNode(event);\n }\n }\n\n private _dragNode(event: NodesDragEndEvent) {\n this._historyService.pushOperation(\n {\n type: FreeOperationType.dragNodes,\n value: {\n ids: event.nodes.map((node) => node.id),\n value: event.nodes.map((node) => {\n const { x, y } = node.getData(TransformData).position;\n return {\n x,\n y,\n };\n }),\n oldValue: event.startPositions,\n },\n },\n { noApply: true }\n );\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { injectable } from 'inversify';\nimport { type FlowNodeEntity, type FlowNodeJSON } from '@flowgram-vue/document';\nimport { type PluginContext } from '@flowgram-vue/core';\n\nimport {\n type FreeHistoryPluginOptions,\n type GetBlockLabel,\n type GetLineURI,\n type GetNodeLabel,\n type GetNodeLabelById,\n type GetNodeURI,\n type NodeToJson,\n} from './types';\n\n@injectable()\nexport class FreeHistoryConfig {\n init(ctx: PluginContext, options: FreeHistoryPluginOptions) {\n this.enable = !!options?.enable;\n\n if (options.nodeToJSON) {\n this.nodeToJSON = options.nodeToJSON(ctx);\n }\n\n if (options.getNodeLabelById) {\n this.getNodeLabelById = options.getNodeLabelById(ctx);\n }\n\n if (options.getNodeLabel) {\n this.getNodeLabel = options.getNodeLabel(ctx);\n }\n\n if (options.getBlockLabel) {\n this.getBlockLabel = options.getBlockLabel(ctx);\n }\n\n if (options.getNodeURI) {\n this.getNodeURI = options.getNodeURI(ctx);\n }\n\n if (options.getLineURI) {\n this.getLineURI = options.getLineURI(ctx);\n }\n if (options.enableChangeNode !== undefined) {\n this.enableChangeNode = options.enableChangeNode;\n }\n if (options.enableChangeLineData !== undefined) {\n this.enableChangeLineData = options.enableChangeLineData;\n }\n }\n\n enableChangeNode = true;\n\n enableChangeLineData = true;\n\n enable = false;\n\n nodeToJSON: NodeToJson = (node: FlowNodeEntity) => node.toJSON();\n\n getNodeLabelById: GetNodeLabelById = (id: string) => id;\n\n getNodeLabel: GetNodeLabel = (node: FlowNodeJSON) => node.id;\n\n getBlockLabel: GetBlockLabel = (node: FlowNodeJSON) => node.id;\n\n getNodeURI: GetNodeURI = (id: string) => `node:${id}`;\n\n getLineURI: GetLineURI = (id: string) => `line:${id}`;\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { WorkflowContentChangeType } from '@flowgram-vue/free-layout-core';\nimport { type FlowNodeEntity } from '@flowgram-vue/document';\n\nimport {\n type ContentChangeTypeToOperation,\n FreeOperationType,\n type DeleteWorkflowNodeOperation,\n} from '../types';\nimport { FreeHistoryConfig } from '../free-history-config';\n\nexport const deleteNodeChange: ContentChangeTypeToOperation<DeleteWorkflowNodeOperation> = {\n type: WorkflowContentChangeType.DELETE_NODE,\n toOperation: (event, ctx) => {\n const config = ctx.get<FreeHistoryConfig>(FreeHistoryConfig);\n const node = event.entity as FlowNodeEntity;\n const json = event.toJSON();\n const parentID = node.parent?.id;\n\n return {\n type: FreeOperationType.deleteNode,\n value: {\n node: json,\n parentID,\n },\n uri: config.getNodeURI(node.id),\n };\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { type WorkflowLineEntity } from '@flowgram-vue/free-layout-core';\nimport { WorkflowContentChangeType } from '@flowgram-vue/free-layout-core';\n\nimport {\n type AddOrDeleteLineOperationValue,\n type ContentChangeTypeToOperation,\n type DeleteLineOperation,\n FreeOperationType,\n} from '../types';\nimport { FreeHistoryConfig } from '../free-history-config';\n\nexport const deleteLineChange: ContentChangeTypeToOperation<DeleteLineOperation> = {\n type: WorkflowContentChangeType.DELETE_LINE,\n toOperation: (event, ctx) => {\n const config = ctx.get<FreeHistoryConfig>(FreeHistoryConfig);\n const line = event.entity as WorkflowLineEntity;\n const value: AddOrDeleteLineOperationValue = {\n from: line.info.from,\n to: line.info.to || '',\n fromPort: line.info.fromPort || '',\n toPort: line.info.toPort || '',\n data: line.info.data,\n id: line.id,\n };\n return {\n type: FreeOperationType.deleteLine,\n value,\n uri: config.getNodeURI(line.id),\n };\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { type WorkflowLineEntity } from '@flowgram-vue/free-layout-core';\nimport { WorkflowContentChangeType } from '@flowgram-vue/free-layout-core';\n\nimport {\n type ChangeLineDataOperation,\n type ChangeLineDataValue,\n type ContentChangeTypeToOperation,\n FreeOperationType,\n} from '../types';\nimport { FreeHistoryConfig } from '../free-history-config';\n\nexport const changeLineData: ContentChangeTypeToOperation<ChangeLineDataOperation> = {\n type: WorkflowContentChangeType.LINE_DATA_CHANGE,\n toOperation: (event, ctx) => {\n const config = ctx.get<FreeHistoryConfig>(FreeHistoryConfig);\n const line = event.entity as WorkflowLineEntity;\n const value: ChangeLineDataValue = {\n id: line.id,\n oldValue: event.oldValue,\n newValue: line.lineData,\n };\n return {\n type: FreeOperationType.changeLineData,\n value,\n uri: config.getLineURI(line.id),\n };\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { WorkflowDocument, type WorkflowNodeJSON } from '@flowgram-vue/free-layout-core';\nimport { WorkflowContentChangeType } from '@flowgram-vue/free-layout-core';\nimport { type FlowNodeEntity } from '@flowgram-vue/document';\n\nimport {\n type AddWorkflowNodeOperation,\n type ContentChangeTypeToOperation,\n FreeOperationType,\n} from '../types';\nimport { FreeHistoryConfig } from '../free-history-config';\n\nexport const addNodeChange: ContentChangeTypeToOperation<AddWorkflowNodeOperation> = {\n type: WorkflowContentChangeType.ADD_NODE,\n toOperation: (event, ctx) => {\n const config = ctx.get<FreeHistoryConfig>(FreeHistoryConfig);\n const document = ctx.get<WorkflowDocument>(WorkflowDocument);\n const node = event.entity as FlowNodeEntity;\n const parentID = node.parent?.id;\n const json: WorkflowNodeJSON = document.toNodeJSON(node);\n\n return {\n type: FreeOperationType.addNode,\n value: {\n node: json,\n parentID,\n },\n uri: config.getNodeURI(node.id),\n };\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { type WorkflowLineEntity } from '@flowgram-vue/free-layout-core';\nimport { WorkflowContentChangeType } from '@flowgram-vue/free-layout-core';\n\nimport {\n type AddLineOperation,\n type AddOrDeleteLineOperationValue,\n type ContentChangeTypeToOperation,\n FreeOperationType,\n} from '../types';\nimport { FreeHistoryConfig } from '../free-history-config';\n\nexport const addLineChange: ContentChangeTypeToOperation<AddLineOperation> = {\n type: WorkflowContentChangeType.ADD_LINE,\n toOperation: (event, ctx) => {\n const config = ctx.get<FreeHistoryConfig>(FreeHistoryConfig);\n const line = event.entity as WorkflowLineEntity;\n const value: AddOrDeleteLineOperationValue = {\n from: line.info.from,\n to: line.info.to || '',\n fromPort: line.info.fromPort || '',\n toPort: line.info.toPort || '',\n data: line.info.data,\n id: line.id,\n };\n return {\n type: FreeOperationType.addLine,\n value,\n uri: config.getLineURI(line.id),\n };\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { deleteNodeChange } from './delete-node-change';\nimport { deleteLineChange } from './delete-line-change';\nimport { changeLineData } from './change-line-data';\nimport { addNodeChange } from './add-node-change';\nimport { addLineChange } from './add-line-change';\n\nexport default [addLineChange, deleteLineChange, addNodeChange, deleteNodeChange, changeLineData];\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\n/* eslint-disable @typescript-eslint/naming-convention */\nimport { injectable, inject } from 'inversify';\nimport { HistoryService, Operation } from '@flowgram-vue/history';\nimport {\n type WorkflowContentChangeEvent,\n WorkflowContentChangeType,\n} from '@flowgram-vue/free-layout-core';\nimport { type PluginContext } from '@flowgram-vue/core';\n\nimport { type IHandler } from '../types';\nimport { FreeHistoryConfig } from '../free-history-config';\nimport changes from '../changes';\n\n@injectable()\nexport class ChangeContentHandler implements IHandler<WorkflowContentChangeEvent> {\n @inject(HistoryService)\n private _historyService: HistoryService;\n\n @inject(FreeHistoryConfig) private _historyConfig: FreeHistoryConfig;\n\n handle(event: WorkflowContentChangeEvent, ctx: PluginContext) {\n if (!this._historyService.undoRedoService.canPush()) {\n return;\n }\n if (\n !this._historyConfig.enableChangeLineData &&\n event.type === WorkflowContentChangeType.LINE_DATA_CHANGE\n ) {\n return;\n }\n\n const change = changes.find((c) => c.type === event.type);\n if (!change) {\n return;\n }\n const operation: Operation | undefined = change.toOperation(event, ctx);\n if (!operation) {\n return;\n }\n\n this._historyService.pushOperation(operation, { noApply: true });\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { type OperationMeta } from '@flowgram-vue/history';\n\nexport const baseOperationMeta: Partial<OperationMeta> = {\n shouldMerge: (_op, prev, element) => {\n if (!prev) {\n return false;\n }\n\n if (\n // 合并500ms内的操作, 如删除节点会联动删除线条\n Date.now() - element.getTimestamp() <\n 500\n ) {\n return true;\n }\n return false;\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { type PluginContext } from '@flowgram-vue/core';\nimport { WorkflowResetLayoutService } from '@flowgram-vue/free-layout-core';\nimport { type OperationMeta } from '@flowgram-vue/history';\n\nimport { FreeOperationType, type ResetLayoutOperationValue } from '../types';\nimport { baseOperationMeta } from './base';\n\nexport const resetLayoutOperationMeta: OperationMeta<\n ResetLayoutOperationValue,\n PluginContext,\n void\n> = {\n ...baseOperationMeta,\n type: FreeOperationType.resetLayout,\n inverse: op => ({\n ...op,\n value: {\n ...op.value,\n value: op.value.oldValue,\n oldValue: op.value.value,\n },\n }),\n apply: async (operation, ctx: PluginContext) => {\n const reset = ctx.get<WorkflowResetLayoutService>(WorkflowResetLayoutService);\n await reset.layoutToPositions(operation.value.ids, operation.value.value);\n },\n shouldMerge: () => false,\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { OperationMeta } from '@flowgram-vue/history';\nimport { WorkflowDocument } from '@flowgram-vue/free-layout-core';\nimport { MoveChildNodesOperationValue, OperationType } from '@flowgram-vue/document';\nimport { FlowNodeBaseType } from '@flowgram-vue/document';\nimport { PluginContext, TransformData } from '@flowgram-vue/core';\n\nimport { baseOperationMeta } from './base';\n\nexport const moveChildNodesOperationMeta: OperationMeta<\n MoveChildNodesOperationValue,\n PluginContext,\n void\n> = {\n ...baseOperationMeta,\n type: OperationType.moveChildNodes,\n inverse: (op) => ({\n ...op,\n value: {\n ...op.value,\n fromIndex: op.value.toIndex,\n toIndex: op.value.fromIndex,\n fromParentId: op.value.toParentId,\n toParentId: op.value.fromParentId,\n },\n }),\n apply: (operation, ctx: PluginContext) => {\n const document = ctx.get<WorkflowDocument>(WorkflowDocument);\n document.moveChildNodes(operation.value);\n const fromContainer = document.getNode(operation.value.fromParentId);\n requestAnimationFrame(() => {\n if (fromContainer && fromContainer.flowNodeType !== FlowNodeBaseType.ROOT) {\n const fromContainerTransformData = fromContainer.getData(TransformData);\n fromContainerTransformData.fireChange();\n }\n });\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { type OperationMeta } from '@flowgram-vue/history';\nimport { WorkflowDocument } from '@flowgram-vue/free-layout-core';\nimport { type PluginContext, TransformData } from '@flowgram-vue/core';\n\nimport { type DragNodeOperationValue, FreeOperationType } from '../types';\nimport { baseOperationMeta } from './base';\n\nexport const dragNodesOperationMeta: OperationMeta<DragNodeOperationValue, PluginContext, void> = {\n ...baseOperationMeta,\n type: FreeOperationType.dragNodes,\n inverse: (op) => ({\n ...op,\n value: {\n ...op.value,\n value: op.value.oldValue,\n oldValue: op.value.value,\n },\n }),\n apply: (operation, ctx) => {\n operation.value.ids.forEach((id, index) => {\n const document = ctx.get<WorkflowDocument>(WorkflowDocument);\n const node = document.getNode(id);\n if (!node) {\n return;\n }\n\n const transform = node.getData(TransformData);\n const point = operation.value.value[index];\n transform.update({\n position: {\n x: point.x,\n y: point.y,\n },\n });\n document.layout.updateAffectedTransform(node);\n });\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { type PluginContext } from '@flowgram-vue/core';\nimport { WorkflowDocument } from '@flowgram-vue/free-layout-core';\nimport { type OperationMeta } from '@flowgram-vue/history';\n\nimport { type AddOrDeleteWorkflowNodeOperationValue, FreeOperationType } from '../types';\nimport { FreeHistoryConfig } from '../free-history-config';\nimport { baseOperationMeta } from './base';\n\nexport const deleteNodeOperationMeta: OperationMeta<\n AddOrDeleteWorkflowNodeOperationValue,\n PluginContext,\n void\n> = {\n ...baseOperationMeta,\n type: FreeOperationType.deleteNode,\n inverse: op => ({\n ...op,\n type: FreeOperationType.addNode,\n }),\n apply: (operation, ctx: PluginContext) => {\n const document = ctx.get<WorkflowDocument>(WorkflowDocument);\n const node = document.getNode(operation.value.node.id);\n if (node) {\n node.dispose();\n }\n },\n getLabel: (op, ctx) => {\n const config = ctx.get<FreeHistoryConfig>(FreeHistoryConfig);\n return `Delete Node ${config.getNodeLabel(op.value.node)}`;\n },\n getDescription: (op, ctx) => {\n const config = ctx.get<FreeHistoryConfig>(FreeHistoryConfig);\n let desc = `Delete Node ${config.getNodeLabel(op.value.node)}`;\n if (op.value.node.meta?.position) {\n desc += ` at ${op.value.node.meta.position.x},${op.value.node.meta.position.y}`;\n }\n return desc;\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { type OperationMeta } from '@flowgram-vue/history';\nimport { WorkflowDocument } from '@flowgram-vue/free-layout-core';\nimport { type PluginContext } from '@flowgram-vue/core';\n\nimport { type AddOrDeleteLineOperationValue, FreeOperationType } from '../types';\nimport { FreeHistoryConfig } from '../free-history-config';\nimport { baseOperationMeta } from './base';\n\nexport const deleteLineOperationMeta: OperationMeta<\n AddOrDeleteLineOperationValue,\n PluginContext,\n void\n> = {\n ...baseOperationMeta,\n type: FreeOperationType.deleteLine,\n inverse: (op) => ({\n ...op,\n type: FreeOperationType.addLine,\n }),\n apply: (operation, ctx: PluginContext) => {\n const document = ctx.get<WorkflowDocument>(WorkflowDocument);\n document.removeNode(operation.value.id);\n },\n getLabel: (op, ctx) => 'Delete Line',\n getDescription: (op, ctx) => {\n const config = ctx.get<FreeHistoryConfig>(FreeHistoryConfig);\n const { value } = op;\n if (!value.from || !value.to) {\n return 'Delete Line';\n }\n\n const fromName = config.getNodeLabelById(value.from);\n const toName = config.getNodeLabelById(value.to);\n return `Delete Line from ${fromName} to ${toName}`;\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { type OperationMeta } from '@flowgram-vue/history';\nimport { WorkflowLinesManager } from '@flowgram-vue/free-layout-core';\nimport { type PluginContext } from '@flowgram-vue/core';\n\nimport { FreeOperationType, type ChangeLineDataValue } from '../types';\nimport { baseOperationMeta } from './base';\n\nexport const changeLineDataOperationMeta: OperationMeta<ChangeLineDataValue, PluginContext, void> =\n {\n ...baseOperationMeta,\n type: FreeOperationType.changeLineData,\n inverse: (op) => ({\n ...op,\n value: {\n ...op.value,\n newValue: op.value.oldValue,\n oldValue: op.value.newValue,\n },\n }),\n apply: (op, ctx: PluginContext) => {\n const linesManager = ctx.get<WorkflowLinesManager>(WorkflowLinesManager);\n const line = linesManager.getLineById(op.value.id);\n\n if (!line) {\n return;\n }\n\n line.lineData = op.value.newValue;\n },\n shouldMerge: (op, prev, element) => {\n if (!prev) {\n return false;\n }\n\n if (Date.now() - element.getTimestamp() < 500) {\n if (\n op.type === prev.type && // 相同类型\n op.value.id === prev.value.id // 相同节点\n ) {\n return {\n type: op.type,\n value: {\n ...op.value,\n newValue: op.value.newValue,\n oldValue: prev.value.oldValue,\n },\n };\n }\n return true;\n }\n return false;\n },\n };\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { cloneDeep } from 'lodash-es';\nimport { type OperationMeta } from '@flowgram-vue/history';\nimport { WorkflowDocument, type WorkflowNodeJSON } from '@flowgram-vue/free-layout-core';\nimport { type PluginContext } from '@flowgram-vue/core';\n\nimport { type AddOrDeleteWorkflowNodeOperationValue, FreeOperationType } from '../types';\nimport { FreeHistoryConfig } from '../free-history-config';\nimport { baseOperationMeta } from './base';\n\nexport const addNodeOperationMeta: OperationMeta<\n AddOrDeleteWorkflowNodeOperationValue,\n PluginContext,\n void\n> = {\n ...baseOperationMeta,\n type: FreeOperationType.addNode,\n inverse: (op) => ({\n ...op,\n type: FreeOperationType.deleteNode,\n }),\n apply: async (operation, ctx: PluginContext) => {\n const document = ctx.get<WorkflowDocument>(WorkflowDocument);\n await document.createWorkflowNode(\n cloneDeep(operation.value.node) as WorkflowNodeJSON,\n false,\n operation.value.parentID\n );\n },\n getLabel: (op, ctx) => {\n const config = ctx.get<FreeHistoryConfig>(FreeHistoryConfig);\n return `Create Node ${config.getNodeLabel(op.value.node)}`;\n },\n getDescription: (op, ctx) => {\n const config = ctx.get<FreeHistoryConfig>(FreeHistoryConfig);\n let desc = `Create Node ${config.getNodeLabel(op.value.node)}`;\n if (op.value.node.meta?.position) {\n desc += ` at ${op.value.node.meta.position.x},${op.value.node.meta.position.y}`;\n }\n return desc;\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { type PluginContext } from '@flowgram-vue/core';\nimport { WorkflowLinesManager } from '@flowgram-vue/free-layout-core';\nimport { type OperationMeta } from '@flowgram-vue/history';\n\nimport { type AddOrDeleteLineOperationValue, FreeOperationType } from '../types';\nimport { FreeHistoryConfig } from '../free-history-config';\nimport { baseOperationMeta } from './base';\n\nexport const addLineOperationMeta: OperationMeta<\n AddOrDeleteLineOperationValue,\n PluginContext,\n void\n> = {\n ...baseOperationMeta,\n type: FreeOperationType.addLine,\n inverse: op => ({\n ...op,\n type: FreeOperationType.deleteLine,\n }),\n apply: (operation, ctx: PluginContext) => {\n const linesManager = ctx.get<WorkflowLinesManager>(WorkflowLinesManager);\n linesManager.createLine({\n ...operation.value,\n key: operation.value.id,\n });\n },\n getLabel: (op, ctx) => 'Create Line',\n getDescription: (op, ctx) => {\n const config = ctx.get<FreeHistoryConfig>(FreeHistoryConfig);\n const { value } = op;\n if (!value.from || !value.to) {\n return 'Create Line';\n }\n\n const fromName = config.getNodeLabelById(value.from);\n const toName = config.getNodeLabelById(value.to);\n return `Create Line from ${fromName} to ${toName}`;\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { resetLayoutOperationMeta } from './reset-layout';\nimport { moveChildNodesOperationMeta } from './move-child-nodes';\nimport { dragNodesOperationMeta } from './drag-nodes';\nimport { deleteNodeOperationMeta } from './delete-node';\nimport { deleteLineOperationMeta } from './delete-line';\nimport { changeLineDataOperationMeta } from './change-line-data';\nimport { addNodeOperationMeta } from './add-node';\nimport { addLineOperationMeta } from './add-line';\n\nexport const operationMetas = [\n addLineOperationMeta,\n deleteLineOperationMeta,\n addNodeOperationMeta,\n deleteNodeOperationMeta,\n resetLayoutOperationMeta,\n dragNodesOperationMeta,\n moveChildNodesOperationMeta,\n changeLineDataOperationMeta,\n];\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { injectable } from 'inversify';\nimport { type OperationContribution, type OperationRegistry } from '@flowgram-vue/history';\n\nimport { operationMetas } from './operation-metas';\n\n@injectable()\nexport class FreeHistoryRegisters implements OperationContribution {\n registerOperationMeta(operationRegistry: OperationRegistry): void {\n operationMetas.forEach(operationMeta => {\n operationRegistry.registerOperationMeta(operationMeta);\n });\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\n/* eslint-disable @typescript-eslint/naming-convention */\nimport { injectable, inject } from 'inversify';\nimport { DisposableCollection } from '@flowgram-vue/utils';\nimport { HistoryService } from '@flowgram-vue/history';\nimport {\n WorkflowDocument,\n WorkflowResetLayoutService,\n WorkflowDragService,\n WorkflowOperationBaseService,\n} from '@flowgram-vue/free-layout-core';\nimport { OperationType } from '@flowgram-vue/document';\nimport { type PluginContext, PositionData } from '@flowgram-vue/core';\n\nimport { DragNodeOperationValue, type FreeHistoryPluginOptions, FreeOperationType } from './types';\nimport { HistoryEntityManager } from './history-entity-manager';\nimport { DragNodesHandler } from './handlers/drag-nodes-handler';\nimport { ChangeContentHandler } from './handlers/change-content-handler';\n\n/**\n * 历史管理\n */\n@injectable()\nexport class FreeHistoryManager {\n @inject(DragNodesHandler)\n private _dragNodesHandler: DragNodesHandler;\n\n @inject(ChangeContentHandler)\n private _changeContentHandler: ChangeContentHandler;\n\n @inject(HistoryEntityManager)\n private _entityManager: HistoryEntityManager;\n\n private _toDispose: DisposableCollection = new DisposableCollection();\n\n @inject(WorkflowOperationBaseService)\n private _operationService: WorkflowOperationBaseService;\n\n onInit(ctx: PluginContext, opts: FreeHistoryPluginOptions) {\n const document = ctx.get<WorkflowDocument>(WorkflowDocument);\n const historyService = ctx.get<HistoryService>(HistoryService);\n const dragService = ctx.get<WorkflowDragService>(WorkflowDragService);\n\n const resetLayoutService = ctx.get<WorkflowResetLayoutService>(WorkflowResetLayoutService);\n\n if (opts?.limit) {\n historyService.limit(opts.limit);\n }\n historyService.context.source = ctx;\n\n this._toDispose.pushAll([\n dragService.onNodesDrag(async (event) => {\n if (event.type !== 'onDragEnd') {\n return;\n }\n this._dragNodesHandler.handle(event);\n }),\n document.onNodeCreate(({ node, data }) => {\n const positionData = node.getData(PositionData);\n if (positionData) {\n this._entityManager.addEntityData(positionData);\n }\n }),\n document.onContentChange((event) => {\n this._changeContentHandler.handle(event, ctx);\n }),\n document.onReload((_event) => {\n historyService.clear();\n }),\n resetLayoutService.onResetLayout((event) => {\n historyService.pushOperation(\n {\n type: FreeOperationType.resetLayout,\n value: {\n ids: event.nodeIds,\n value: event.positionMap,\n oldValue: event.oldPositionMap,\n },\n },\n { noApply: true }\n );\n }),\n this._operationService.onNodeMove(({ node, fromParent, fromIndex, toParent, toIndex }) => {\n historyService.pushOperation(\n {\n type: OperationType.moveChildNodes,\n value: {\n fromParentId: fromParent.id,\n fromIndex,\n nodeIds: [node.id],\n toParentId: toParent.id,\n toIndex,\n },\n },\n {\n noApply: true,\n }\n );\n }),\n this._operationService.onNodePostionUpdate((event) => {\n const value: DragNodeOperationValue = {\n ids: [event.node.id],\n value: [event.newPosition],\n oldValue: [event.oldPosition],\n };\n historyService.pushOperation(\n {\n type: FreeOperationType.dragNodes,\n value,\n },\n {\n noApply: true,\n }\n );\n }),\n ]);\n }\n\n dispose() {\n this._entityManager.dispose();\n this._toDispose.dispose();\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { HistoryContainerModule, OperationContribution } from '@flowgram-vue/history';\nimport { bindContributions, definePluginCreator } from '@flowgram-vue/core';\n\nimport { type FreeHistoryPluginOptions } from './types';\nimport { HistoryEntityManager } from './history-entity-manager';\nimport { DragNodesHandler } from './handlers/drag-nodes-handler';\nimport { ChangeContentHandler } from './handlers/change-content-handler';\nimport { FreeHistoryRegisters } from './free-history-registers';\nimport { FreeHistoryManager } from './free-history-manager';\nimport { FreeHistoryConfig } from './free-history-config';\n\nexport const createFreeHistoryPlugin = definePluginCreator<FreeHistoryPluginOptions>({\n onBind: ({ bind }) => {\n bindContributions(bind, FreeHistoryRegisters, [OperationContribution]);\n bind(FreeHistoryConfig).toSelf().inSingletonScope();\n bind(FreeHistoryManager).toSelf().inSingletonScope();\n bind(HistoryEntityManager).toSelf().inSingletonScope();\n bind(DragNodesHandler).toSelf().inSingletonScope();\n bind(ChangeContentHandler).toSelf().inSingletonScope();\n },\n onInit(ctx, opts): void {\n ctx.get<FreeHistoryConfig>(FreeHistoryConfig).init(ctx, opts);\n\n if (!opts.enable) {\n return;\n }\n ctx.get<FreeHistoryManager>(FreeHistoryManager).onInit(ctx, opts);\n },\n onDispose(ctx) {\n ctx.get<HistoryEntityManager>(HistoryEntityManager).dispose();\n },\n containerModules: [HistoryContainerModule],\n});\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { onBeforeUnmount, ref, type Ref } from 'vue';\n\nimport { useService } from '@flowgram-vue/core';\nimport { HistoryService } from '@flowgram-vue/history';\n\ninterface UndoRedo {\n canUndo: Ref<boolean>;\n canRedo: Ref<boolean>;\n undo: () => Promise<void>;\n redo: () => Promise<void>;\n}\n\nexport function useUndoRedo(): UndoRedo {\n const historyService = useService<HistoryService>(HistoryService);\n const canUndo = ref(false);\n const canRedo = ref(false);\n\n const toDispose = historyService.undoRedoService.onChange(() => {\n canUndo.value = historyService.canUndo();\n canRedo.value = historyService.canRedo();\n });\n\n onBeforeUnmount(() => {\n toDispose.dispose();\n });\n\n return {\n canUndo,\n canRedo,\n undo: () => historyService.undo(),\n redo: () => historyService.redo(),\n };\n}\n"]}
@@ -0,0 +1,194 @@
1
+ import * as _flowgram_vue_core from '@flowgram-vue/core';
2
+ import { PluginContext, EntityData } from '@flowgram-vue/core';
3
+ import { IPoint } from '@flowgram-vue/utils';
4
+ import { Operation, OperationMeta, OperationContribution, OperationRegistry } from '@flowgram-vue/history';
5
+ export * from '@flowgram-vue/history';
6
+ import { WorkflowLinePortInfo, WorkflowNodeJSON, WorkflowContentChangeType, WorkflowContentChangeEvent, WorkflowLineEntity, PositionMap } from '@flowgram-vue/free-layout-core';
7
+ import { FlowNodeEntity, FlowNodeJSON } from '@flowgram-vue/document';
8
+ import { Ref } from 'vue';
9
+
10
+ /**
11
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
12
+ * SPDX-License-Identifier: MIT
13
+ */
14
+
15
+ declare enum FreeOperationType {
16
+ addLine = "addLine",
17
+ deleteLine = "deleteLine",
18
+ changeLineData = "changeLineData",
19
+ moveNode = "moveNode",
20
+ addNode = "addNode",
21
+ deleteNode = "deleteNode",
22
+ changeNodeData = "changeNodeData",
23
+ resetLayout = "resetLayout",
24
+ dragNodes = "dragNodes",
25
+ moveChildNodes = "moveChildNodes"
26
+ }
27
+ interface AddOrDeleteLineOperationValue extends WorkflowLinePortInfo {
28
+ id: string;
29
+ }
30
+ interface AddOrDeleteWorkflowNodeOperationValue {
31
+ node: WorkflowNodeJSON;
32
+ parentID?: string;
33
+ }
34
+ interface AddLineOperation extends Operation {
35
+ type: FreeOperationType.addLine;
36
+ value: AddOrDeleteLineOperationValue;
37
+ }
38
+ interface ChangeLineDataOperation extends Operation {
39
+ type: FreeOperationType.changeLineData;
40
+ value: ChangeLineDataValue;
41
+ }
42
+ interface DeleteLineOperation extends Operation {
43
+ type: FreeOperationType.deleteLine;
44
+ value: AddOrDeleteLineOperationValue;
45
+ }
46
+ interface MoveNodeOperation extends Operation {
47
+ type: FreeOperationType.moveNode;
48
+ value: MoveNodeOperationValue;
49
+ }
50
+ interface AddWorkflowNodeOperation extends Operation {
51
+ type: FreeOperationType.addNode;
52
+ value: AddOrDeleteWorkflowNodeOperationValue;
53
+ }
54
+ interface DeleteWorkflowNodeOperation extends Operation {
55
+ type: FreeOperationType.deleteNode;
56
+ value: AddOrDeleteWorkflowNodeOperationValue;
57
+ }
58
+ interface MoveNodeOperationValue {
59
+ id: string;
60
+ value: {
61
+ x: number;
62
+ y: number;
63
+ };
64
+ oldValue: {
65
+ x: number;
66
+ y: number;
67
+ };
68
+ }
69
+ interface DragNodeOperationValue {
70
+ ids: string[];
71
+ value: IPoint[];
72
+ oldValue: IPoint[];
73
+ }
74
+ interface ResetLayoutOperationValue {
75
+ ids: string[];
76
+ value: PositionMap;
77
+ oldValue: PositionMap;
78
+ }
79
+ interface ContentChangeTypeToOperation<T extends Operation> {
80
+ type: WorkflowContentChangeType;
81
+ toOperation: (event: WorkflowContentChangeEvent, ctx: PluginContext) => T | undefined;
82
+ }
83
+ interface EntityDataType {
84
+ type: FreeOperationType;
85
+ toEntityData: (node: FlowNodeEntity, ctx: PluginContext) => EntityData;
86
+ }
87
+ interface ChangeNodeDataValue {
88
+ id: string;
89
+ value: unknown;
90
+ oldValue: unknown;
91
+ path: string;
92
+ }
93
+ interface ChangeLineDataValue {
94
+ id: string;
95
+ oldValue: unknown;
96
+ newValue: unknown;
97
+ }
98
+ interface ChangeLineDataValue {
99
+ id: string;
100
+ newValue: unknown;
101
+ oldValue: unknown;
102
+ }
103
+ /**
104
+ * 将node转成json
105
+ */
106
+ type NodeToJson = (node: FlowNodeEntity) => FlowNodeJSON;
107
+ /**
108
+ * 将line转成json
109
+ */
110
+ type LineToJson = (node: WorkflowLineEntity) => FlowNodeJSON;
111
+ /**
112
+ * 根据节点id获取label
113
+ */
114
+ type GetNodeLabelById = (id: string) => string;
115
+ /**
116
+ * 根据节点获取label
117
+ */
118
+ type GetNodeLabel = (node: FlowNodeJSON) => string;
119
+ /**
120
+ * 根据分支获取label
121
+ */
122
+ type GetBlockLabel = (node: FlowNodeJSON) => string;
123
+ /**
124
+ * 根据节点获取URI
125
+ */
126
+ type GetNodeURI = (id: string) => string | any;
127
+ /**
128
+ * 根据连线获取URI
129
+ */
130
+ type GetLineURI = (id: string) => string | any;
131
+ /**
132
+ * 插件配置
133
+ */
134
+ interface FreeHistoryPluginOptions<CTX extends PluginContext = PluginContext> {
135
+ enable?: boolean;
136
+ limit?: number;
137
+ nodeToJSON?: (ctx: CTX) => NodeToJson;
138
+ getNodeLabelById?: (ctx: CTX) => GetNodeLabelById;
139
+ getNodeLabel?: (ctx: CTX) => GetNodeLabel;
140
+ getBlockLabel?: (ctx: CTX) => GetBlockLabel;
141
+ getNodeURI?: (ctx: CTX) => GetNodeURI;
142
+ getLineURI?: (ctx: CTX) => GetLineURI;
143
+ operationMetas?: OperationMeta[];
144
+ enableChangeNode?: boolean;
145
+ enableChangeLineData?: boolean;
146
+ uri?: string | any;
147
+ }
148
+ interface IHandler<E> {
149
+ handle: (event: E, ctx: PluginContext) => void | Promise<void>;
150
+ }
151
+
152
+ declare const createFreeHistoryPlugin: _flowgram_vue_core.PluginCreator<FreeHistoryPluginOptions<_flowgram_vue_core.PluginContext>>;
153
+
154
+ /**
155
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
156
+ * SPDX-License-Identifier: MIT
157
+ */
158
+
159
+ declare class FreeHistoryConfig {
160
+ init(ctx: PluginContext, options: FreeHistoryPluginOptions): void;
161
+ enableChangeNode: boolean;
162
+ enableChangeLineData: boolean;
163
+ enable: boolean;
164
+ nodeToJSON: NodeToJson;
165
+ getNodeLabelById: GetNodeLabelById;
166
+ getNodeLabel: GetNodeLabel;
167
+ getBlockLabel: GetBlockLabel;
168
+ getNodeURI: GetNodeURI;
169
+ getLineURI: GetLineURI;
170
+ }
171
+
172
+ /**
173
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
174
+ * SPDX-License-Identifier: MIT
175
+ */
176
+
177
+ interface UndoRedo {
178
+ canUndo: Ref<boolean>;
179
+ canRedo: Ref<boolean>;
180
+ undo: () => Promise<void>;
181
+ redo: () => Promise<void>;
182
+ }
183
+ declare function useUndoRedo(): UndoRedo;
184
+
185
+ /**
186
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
187
+ * SPDX-License-Identifier: MIT
188
+ */
189
+
190
+ declare class FreeHistoryRegisters implements OperationContribution {
191
+ registerOperationMeta(operationRegistry: OperationRegistry): void;
192
+ }
193
+
194
+ export { type AddLineOperation, type AddOrDeleteLineOperationValue, type AddOrDeleteWorkflowNodeOperationValue, type AddWorkflowNodeOperation, type ChangeLineDataOperation, type ChangeLineDataValue, type ChangeNodeDataValue, type ContentChangeTypeToOperation, type DeleteLineOperation, type DeleteWorkflowNodeOperation, type DragNodeOperationValue, type EntityDataType, FreeHistoryConfig, type FreeHistoryPluginOptions, FreeHistoryRegisters, FreeOperationType, type GetBlockLabel, type GetLineURI, type GetNodeLabel, type GetNodeLabelById, type GetNodeURI, type IHandler, type LineToJson, type MoveNodeOperation, type MoveNodeOperationValue, type NodeToJson, type ResetLayoutOperationValue, createFreeHistoryPlugin, useUndoRedo };