@inditextech/weave-sdk 5.0.0-SNAPSHOT.336.1 → 5.0.0-SNAPSHOT.338.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.
package/dist/sdk.js CHANGED
@@ -9442,7 +9442,7 @@ var WeaveRegisterManager = class {
9442
9442
 
9443
9443
  //#endregion
9444
9444
  //#region package.json
9445
- var version = "5.0.0-SNAPSHOT.336.1";
9445
+ var version = "5.0.0-SNAPSHOT.338.1";
9446
9446
 
9447
9447
  //#endregion
9448
9448
  //#region src/managers/setup.ts
@@ -9805,28 +9805,22 @@ var WeaveExportManager = class {
9805
9805
  exportNodesAsImage(nodes, boundingNodes, options) {
9806
9806
  return new Promise((resolve) => {
9807
9807
  const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
9808
- const nodesSelectionPluginPrev = this.getNodesSelectionPlugin()?.isEnabled();
9809
- const nodesStageGridPluginPrev = this.getStageGridPlugin()?.isEnabled();
9810
- this.getNodesSelectionPlugin()?.disable();
9811
- this.getStageGridPlugin()?.disable();
9812
- const stage = this.instance.getStage();
9813
- const mainLayer = this.instance.getMainLayer();
9814
- const originalPosition = {
9815
- x: stage.x(),
9816
- y: stage.y()
9817
- };
9818
- const originalScale = {
9819
- x: stage.scaleX(),
9820
- y: stage.scaleY()
9821
- };
9808
+ const originalStage = this.instance.getStage();
9809
+ const stage = originalStage.clone();
9810
+ const mainLayer = stage.findOne("#mainLayer");
9811
+ if (!mainLayer) throw new Error("Main layer not found");
9812
+ const selectionLayer = stage.findOne(`#${WEAVE_NODES_SELECTION_LAYER_ID}`);
9813
+ selectionLayer?.destroy();
9814
+ const gridLayer = stage.findOne(`#${WEAVE_GRID_LAYER_ID}`);
9815
+ gridLayer?.destroy();
9822
9816
  stage.scale({
9823
9817
  x: 1,
9824
9818
  y: 1
9825
9819
  });
9826
9820
  if (mainLayer) {
9827
9821
  const bounds = getExportBoundingBox(boundingNodes(nodes));
9828
- const scaleX = stage.scaleX();
9829
- const scaleY = stage.scaleY();
9822
+ const scaleX = originalStage.scaleX();
9823
+ const scaleY = originalStage.scaleY();
9830
9824
  const unscaledBounds = {
9831
9825
  x: bounds.x / scaleX,
9832
9826
  y: bounds.y / scaleY,
@@ -9866,11 +9860,7 @@ var WeaveExportManager = class {
9866
9860
  quality: options.quality ?? 1,
9867
9861
  callback: (img) => {
9868
9862
  exportGroup.destroy();
9869
- stage.position(originalPosition);
9870
- stage.scale(originalScale);
9871
- stage.batchDraw();
9872
- if (nodesSelectionPluginPrev) this.getNodesSelectionPlugin()?.enable();
9873
- if (nodesStageGridPluginPrev) this.getStageGridPlugin()?.enable();
9863
+ stage.destroy();
9874
9864
  resolve(img);
9875
9865
  }
9876
9866
  });
@@ -9880,28 +9870,18 @@ var WeaveExportManager = class {
9880
9870
  exportNodesAsBlob(nodes, boundingNodes, options) {
9881
9871
  return new Promise((resolve) => {
9882
9872
  const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
9883
- const nodesSelectionPluginPrev = this.getNodesSelectionPlugin()?.isEnabled();
9884
- const nodesStageGridPluginPrev = this.getStageGridPlugin()?.isEnabled();
9885
- this.getNodesSelectionPlugin()?.disable();
9886
- this.getStageGridPlugin()?.disable();
9887
- const stage = this.instance.getStage();
9888
- const mainLayer = this.instance.getMainLayer();
9889
- const originalPosition = {
9890
- x: stage.x(),
9891
- y: stage.y()
9892
- };
9893
- const originalScale = {
9894
- x: stage.scaleX(),
9895
- y: stage.scaleY()
9896
- };
9897
- stage.scale({
9898
- x: 1,
9899
- y: 1
9900
- });
9873
+ const originalStage = this.instance.getStage();
9874
+ const stage = originalStage.clone();
9875
+ const mainLayer = stage.findOne("#mainLayer");
9876
+ if (!mainLayer) throw new Error("Main layer not found");
9877
+ const selectionLayer = stage.findOne(`#${WEAVE_NODES_SELECTION_LAYER_ID}`);
9878
+ selectionLayer?.destroy();
9879
+ const gridLayer = stage.findOne(`#${WEAVE_GRID_LAYER_ID}`);
9880
+ gridLayer?.destroy();
9901
9881
  if (mainLayer) {
9902
9882
  const bounds = getExportBoundingBox(boundingNodes(nodes));
9903
- const scaleX = stage.scaleX();
9904
- const scaleY = stage.scaleY();
9883
+ const scaleX = originalStage.scaleX();
9884
+ const scaleY = originalStage.scaleY();
9905
9885
  const unscaledBounds = {
9906
9886
  x: bounds.x / scaleX,
9907
9887
  y: bounds.y / scaleY,
@@ -9941,11 +9921,7 @@ var WeaveExportManager = class {
9941
9921
  quality: options.quality ?? 1,
9942
9922
  callback: (blob) => {
9943
9923
  exportGroup.destroy();
9944
- stage.position(originalPosition);
9945
- stage.scale(originalScale);
9946
- stage.batchDraw();
9947
- if (nodesSelectionPluginPrev) this.getNodesSelectionPlugin()?.enable();
9948
- if (nodesStageGridPluginPrev) this.getStageGridPlugin()?.enable();
9924
+ stage.destroy();
9949
9925
  if (!blob) {
9950
9926
  (0, import_reject.default)(new Error("Failed to generate image blob"));
9951
9927
  return;
@@ -9959,28 +9935,22 @@ var WeaveExportManager = class {
9959
9935
  exportNodesAsCanvas(nodes, boundingNodes, options) {
9960
9936
  return new Promise((resolve) => {
9961
9937
  const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
9962
- const nodesSelectionPluginPrev = this.getNodesSelectionPlugin()?.isEnabled();
9963
- const nodesStageGridPluginPrev = this.getStageGridPlugin()?.isEnabled();
9964
- this.getNodesSelectionPlugin()?.disable();
9965
- this.getStageGridPlugin()?.disable();
9966
- const stage = this.instance.getStage();
9967
- const mainLayer = this.instance.getMainLayer();
9968
- const originalPosition = {
9969
- x: stage.x(),
9970
- y: stage.y()
9971
- };
9972
- const originalScale = {
9973
- x: stage.scaleX(),
9974
- y: stage.scaleY()
9975
- };
9938
+ const originalStage = this.instance.getStage();
9939
+ const stage = originalStage.clone();
9940
+ const mainLayer = stage.findOne("#mainLayer");
9941
+ if (!mainLayer) throw new Error("Main layer not found");
9942
+ const selectionLayer = stage.findOne(`#${WEAVE_NODES_SELECTION_LAYER_ID}`);
9943
+ selectionLayer?.destroy();
9944
+ const gridLayer = stage.findOne(`#${WEAVE_GRID_LAYER_ID}`);
9945
+ gridLayer?.destroy();
9976
9946
  stage.scale({
9977
9947
  x: 1,
9978
9948
  y: 1
9979
9949
  });
9980
9950
  if (mainLayer) {
9981
9951
  const bounds = getExportBoundingBox(boundingNodes(nodes));
9982
- const scaleX = stage.scaleX();
9983
- const scaleY = stage.scaleY();
9952
+ const scaleX = originalStage.scaleX();
9953
+ const scaleY = originalStage.scaleY();
9984
9954
  const unscaledBounds = {
9985
9955
  x: bounds.x / scaleX,
9986
9956
  y: bounds.y / scaleY,
@@ -10020,11 +9990,7 @@ var WeaveExportManager = class {
10020
9990
  quality: options.quality ?? 1,
10021
9991
  callback: (canvas) => {
10022
9992
  exportGroup.destroy();
10023
- stage.position(originalPosition);
10024
- stage.scale(originalScale);
10025
- stage.batchDraw();
10026
- if (nodesSelectionPluginPrev) this.getNodesSelectionPlugin()?.enable();
10027
- if (nodesStageGridPluginPrev) this.getStageGridPlugin()?.enable();
9993
+ stage.destroy();
10028
9994
  resolve(canvas);
10029
9995
  }
10030
9996
  });
package/dist/sdk.node.js CHANGED
@@ -9441,7 +9441,7 @@ var WeaveRegisterManager = class {
9441
9441
 
9442
9442
  //#endregion
9443
9443
  //#region package.json
9444
- var version = "5.0.0-SNAPSHOT.336.1";
9444
+ var version = "5.0.0-SNAPSHOT.338.1";
9445
9445
 
9446
9446
  //#endregion
9447
9447
  //#region src/managers/setup.ts
@@ -9804,28 +9804,22 @@ var WeaveExportManager = class {
9804
9804
  exportNodesAsImage(nodes, boundingNodes, options) {
9805
9805
  return new Promise((resolve) => {
9806
9806
  const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
9807
- const nodesSelectionPluginPrev = this.getNodesSelectionPlugin()?.isEnabled();
9808
- const nodesStageGridPluginPrev = this.getStageGridPlugin()?.isEnabled();
9809
- this.getNodesSelectionPlugin()?.disable();
9810
- this.getStageGridPlugin()?.disable();
9811
- const stage = this.instance.getStage();
9812
- const mainLayer = this.instance.getMainLayer();
9813
- const originalPosition = {
9814
- x: stage.x(),
9815
- y: stage.y()
9816
- };
9817
- const originalScale = {
9818
- x: stage.scaleX(),
9819
- y: stage.scaleY()
9820
- };
9807
+ const originalStage = this.instance.getStage();
9808
+ const stage = originalStage.clone();
9809
+ const mainLayer = stage.findOne("#mainLayer");
9810
+ if (!mainLayer) throw new Error("Main layer not found");
9811
+ const selectionLayer = stage.findOne(`#${WEAVE_NODES_SELECTION_LAYER_ID}`);
9812
+ selectionLayer?.destroy();
9813
+ const gridLayer = stage.findOne(`#${WEAVE_GRID_LAYER_ID}`);
9814
+ gridLayer?.destroy();
9821
9815
  stage.scale({
9822
9816
  x: 1,
9823
9817
  y: 1
9824
9818
  });
9825
9819
  if (mainLayer) {
9826
9820
  const bounds = getExportBoundingBox(boundingNodes(nodes));
9827
- const scaleX = stage.scaleX();
9828
- const scaleY = stage.scaleY();
9821
+ const scaleX = originalStage.scaleX();
9822
+ const scaleY = originalStage.scaleY();
9829
9823
  const unscaledBounds = {
9830
9824
  x: bounds.x / scaleX,
9831
9825
  y: bounds.y / scaleY,
@@ -9865,11 +9859,7 @@ var WeaveExportManager = class {
9865
9859
  quality: options.quality ?? 1,
9866
9860
  callback: (img) => {
9867
9861
  exportGroup.destroy();
9868
- stage.position(originalPosition);
9869
- stage.scale(originalScale);
9870
- stage.batchDraw();
9871
- if (nodesSelectionPluginPrev) this.getNodesSelectionPlugin()?.enable();
9872
- if (nodesStageGridPluginPrev) this.getStageGridPlugin()?.enable();
9862
+ stage.destroy();
9873
9863
  resolve(img);
9874
9864
  }
9875
9865
  });
@@ -9879,28 +9869,18 @@ var WeaveExportManager = class {
9879
9869
  exportNodesAsBlob(nodes, boundingNodes, options) {
9880
9870
  return new Promise((resolve) => {
9881
9871
  const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
9882
- const nodesSelectionPluginPrev = this.getNodesSelectionPlugin()?.isEnabled();
9883
- const nodesStageGridPluginPrev = this.getStageGridPlugin()?.isEnabled();
9884
- this.getNodesSelectionPlugin()?.disable();
9885
- this.getStageGridPlugin()?.disable();
9886
- const stage = this.instance.getStage();
9887
- const mainLayer = this.instance.getMainLayer();
9888
- const originalPosition = {
9889
- x: stage.x(),
9890
- y: stage.y()
9891
- };
9892
- const originalScale = {
9893
- x: stage.scaleX(),
9894
- y: stage.scaleY()
9895
- };
9896
- stage.scale({
9897
- x: 1,
9898
- y: 1
9899
- });
9872
+ const originalStage = this.instance.getStage();
9873
+ const stage = originalStage.clone();
9874
+ const mainLayer = stage.findOne("#mainLayer");
9875
+ if (!mainLayer) throw new Error("Main layer not found");
9876
+ const selectionLayer = stage.findOne(`#${WEAVE_NODES_SELECTION_LAYER_ID}`);
9877
+ selectionLayer?.destroy();
9878
+ const gridLayer = stage.findOne(`#${WEAVE_GRID_LAYER_ID}`);
9879
+ gridLayer?.destroy();
9900
9880
  if (mainLayer) {
9901
9881
  const bounds = getExportBoundingBox(boundingNodes(nodes));
9902
- const scaleX = stage.scaleX();
9903
- const scaleY = stage.scaleY();
9882
+ const scaleX = originalStage.scaleX();
9883
+ const scaleY = originalStage.scaleY();
9904
9884
  const unscaledBounds = {
9905
9885
  x: bounds.x / scaleX,
9906
9886
  y: bounds.y / scaleY,
@@ -9940,11 +9920,7 @@ var WeaveExportManager = class {
9940
9920
  quality: options.quality ?? 1,
9941
9921
  callback: (blob) => {
9942
9922
  exportGroup.destroy();
9943
- stage.position(originalPosition);
9944
- stage.scale(originalScale);
9945
- stage.batchDraw();
9946
- if (nodesSelectionPluginPrev) this.getNodesSelectionPlugin()?.enable();
9947
- if (nodesStageGridPluginPrev) this.getStageGridPlugin()?.enable();
9923
+ stage.destroy();
9948
9924
  if (!blob) {
9949
9925
  (0, import_reject.default)(new Error("Failed to generate image blob"));
9950
9926
  return;
@@ -9958,28 +9934,22 @@ var WeaveExportManager = class {
9958
9934
  exportNodesAsCanvas(nodes, boundingNodes, options) {
9959
9935
  return new Promise((resolve) => {
9960
9936
  const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
9961
- const nodesSelectionPluginPrev = this.getNodesSelectionPlugin()?.isEnabled();
9962
- const nodesStageGridPluginPrev = this.getStageGridPlugin()?.isEnabled();
9963
- this.getNodesSelectionPlugin()?.disable();
9964
- this.getStageGridPlugin()?.disable();
9965
- const stage = this.instance.getStage();
9966
- const mainLayer = this.instance.getMainLayer();
9967
- const originalPosition = {
9968
- x: stage.x(),
9969
- y: stage.y()
9970
- };
9971
- const originalScale = {
9972
- x: stage.scaleX(),
9973
- y: stage.scaleY()
9974
- };
9937
+ const originalStage = this.instance.getStage();
9938
+ const stage = originalStage.clone();
9939
+ const mainLayer = stage.findOne("#mainLayer");
9940
+ if (!mainLayer) throw new Error("Main layer not found");
9941
+ const selectionLayer = stage.findOne(`#${WEAVE_NODES_SELECTION_LAYER_ID}`);
9942
+ selectionLayer?.destroy();
9943
+ const gridLayer = stage.findOne(`#${WEAVE_GRID_LAYER_ID}`);
9944
+ gridLayer?.destroy();
9975
9945
  stage.scale({
9976
9946
  x: 1,
9977
9947
  y: 1
9978
9948
  });
9979
9949
  if (mainLayer) {
9980
9950
  const bounds = getExportBoundingBox(boundingNodes(nodes));
9981
- const scaleX = stage.scaleX();
9982
- const scaleY = stage.scaleY();
9951
+ const scaleX = originalStage.scaleX();
9952
+ const scaleY = originalStage.scaleY();
9983
9953
  const unscaledBounds = {
9984
9954
  x: bounds.x / scaleX,
9985
9955
  y: bounds.y / scaleY,
@@ -10019,11 +9989,7 @@ var WeaveExportManager = class {
10019
9989
  quality: options.quality ?? 1,
10020
9990
  callback: (canvas) => {
10021
9991
  exportGroup.destroy();
10022
- stage.position(originalPosition);
10023
- stage.scale(originalScale);
10024
- stage.batchDraw();
10025
- if (nodesSelectionPluginPrev) this.getNodesSelectionPlugin()?.enable();
10026
- if (nodesStageGridPluginPrev) this.getStageGridPlugin()?.enable();
9992
+ stage.destroy();
10027
9993
  resolve(canvas);
10028
9994
  }
10029
9995
  });