@flowgram.ai/free-layout-core 0.2.1 → 0.2.3

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.
package/dist/esm/index.js CHANGED
@@ -1125,7 +1125,7 @@ import {
1125
1125
  // src/workflow-lines-manager.ts
1126
1126
  import { last } from "lodash-es";
1127
1127
  import { inject as inject3, injectable as injectable3 } from "inversify";
1128
- import { Disposable as Disposable2, DisposableCollection, Emitter as Emitter3 } from "@flowgram.ai/utils";
1128
+ import { DisposableCollection, Emitter as Emitter3 } from "@flowgram.ai/utils";
1129
1129
  import { FlowNodeRenderData as FlowNodeRenderData2, FlowNodeTransformData as FlowNodeTransformData3 } from "@flowgram.ai/document";
1130
1130
  import { EntityManager as EntityManager2, PlaygroundConfigEntity as PlaygroundConfigEntity2, TransformData as TransformData6 } from "@flowgram.ai/core";
1131
1131
 
@@ -1324,17 +1324,15 @@ var WorkflowLinesManager = class {
1324
1324
  toNode?.removeLine(line);
1325
1325
  line.validate();
1326
1326
  });
1327
- line.toDispose.push(
1328
- Disposable2.create(() => {
1329
- if (available) {
1330
- this.onAvailableLinesChangeEmitter.fire({
1331
- type: "DELETE_LINE" /* DELETE_LINE */,
1332
- toJSON: () => line.toJSON(),
1333
- entity: line
1334
- });
1335
- }
1336
- })
1337
- );
1327
+ line.onDispose(() => {
1328
+ if (available) {
1329
+ this.onAvailableLinesChangeEmitter.fire({
1330
+ type: "DELETE_LINE" /* DELETE_LINE */,
1331
+ toJSON: () => line.toJSON(),
1332
+ entity: line
1333
+ });
1334
+ }
1335
+ });
1338
1336
  if (available) {
1339
1337
  this.onAvailableLinesChangeEmitter.fire({
1340
1338
  type: "ADD_LINE" /* ADD_LINE */,
@@ -1535,7 +1533,7 @@ WorkflowLinesManager = __decorateClass([
1535
1533
  // src/workflow-document.ts
1536
1534
  import { customAlphabet } from "nanoid";
1537
1535
  import { inject as inject5, injectable as injectable5, optional, postConstruct } from "inversify";
1538
- import { Disposable as Disposable3, Emitter as Emitter4 } from "@flowgram.ai/utils";
1536
+ import { Emitter as Emitter4 } from "@flowgram.ai/utils";
1539
1537
  import { NodeEngineContext } from "@flowgram.ai/form-core";
1540
1538
  import { FlowDocument, FlowNodeBaseType, FlowNodeTransformData as FlowNodeTransformData5 } from "@flowgram.ai/document";
1541
1539
  import {
@@ -1780,6 +1778,7 @@ var WorkflowDocument = class extends FlowDocument {
1780
1778
  parent
1781
1779
  },
1782
1780
  void 0,
1781
+ true,
1783
1782
  true
1784
1783
  );
1785
1784
  const registry = node.getNodeRegistry();
@@ -1827,26 +1826,24 @@ var WorkflowDocument = class extends FlowDocument {
1827
1826
  entity: node,
1828
1827
  toJSON: () => this.toNodeJSON(node)
1829
1828
  });
1830
- node.toDispose.push(
1831
- Disposable3.create(() => {
1832
- this.fireContentChange({
1833
- type: "DELETE_NODE" /* DELETE_NODE */,
1834
- entity: node,
1835
- toJSON: () => this.toNodeJSON(node)
1836
- });
1837
- })
1838
- );
1839
- node.toDispose.push(
1840
- Disposable3.create(() => {
1841
- if (!node.parent || node.parent.flowNodeType === FlowNodeBaseType.ROOT) {
1842
- return;
1843
- }
1844
- const parentTransform = node.parent.getData(FlowNodeTransformData5);
1845
- setTimeout(() => {
1846
- parentTransform.fireChange();
1847
- }, 0);
1848
- })
1849
- );
1829
+ node.onDispose(() => {
1830
+ if (!node.parent || node.parent.flowNodeType === FlowNodeBaseType.ROOT) {
1831
+ return;
1832
+ }
1833
+ const parentTransform = node.parent.getData(FlowNodeTransformData5);
1834
+ parentTransform.fireChange();
1835
+ });
1836
+ let lastDeleteNodeData;
1837
+ node.preDispose.onDispose(() => {
1838
+ lastDeleteNodeData = this.toNodeJSON(node);
1839
+ });
1840
+ node.onDispose(() => {
1841
+ this.fireContentChange({
1842
+ type: "DELETE_NODE" /* DELETE_NODE */,
1843
+ entity: node,
1844
+ toJSON: () => lastDeleteNodeData
1845
+ });
1846
+ });
1850
1847
  }
1851
1848
  if (json.blocks) {
1852
1849
  this.renderJSON(