@inditextech/weave-sdk 5.0.0-SNAPSHOT.413.1 → 5.0.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.
package/dist/sdk.js CHANGED
@@ -6608,7 +6608,12 @@ var WeaveNode = class {
6608
6608
  this.instance.emitEvent("onDrag", null);
6609
6609
  const realNodeTarget = this.getRealSelectedNode(nodeTarget);
6610
6610
  const isInGroupContext = (this.getSelectionPlugin()?.getActiveGroupContext() ?? null) !== null;
6611
- if (!isInGroupContext && this.isSelecting() && this.getSelectionPlugin()?.getSelectedNodes().length === 1 && (realNodeTarget.getAttrs().lockToContainer === void 0 || !realNodeTarget.getAttrs().lockToContainer)) this.instance.stateTransactional(() => {
6611
+ const shouldUpdateMove = this.isSelecting() && this.getSelectionPlugin()?.getSelectedNodes().length === 1 && (realNodeTarget.getAttrs().lockToContainer === void 0 || !realNodeTarget.getAttrs().lockToContainer);
6612
+ if (isInGroupContext && shouldUpdateMove) {
6613
+ if (realNodeTarget.getAttrs().isCloned) this.instance.getCloningManager().removeClone(realNodeTarget);
6614
+ this.instance.updateNodeNT(this.serialize(realNodeTarget));
6615
+ }
6616
+ if (!isInGroupContext && shouldUpdateMove) this.instance.stateTransactional(() => {
6612
6617
  clearContainerTargets(this.instance);
6613
6618
  const layerToMove = containerOverCursor(this.instance, [realNodeTarget]);
6614
6619
  let containerToMove = this.instance.getMainLayer();
@@ -9688,7 +9693,7 @@ var WeaveRegisterManager = class {
9688
9693
 
9689
9694
  //#endregion
9690
9695
  //#region package.json
9691
- var version = "5.0.0-SNAPSHOT.413.1";
9696
+ var version = "5.0.0";
9692
9697
 
9693
9698
  //#endregion
9694
9699
  //#region src/managers/setup.ts
@@ -10130,7 +10135,8 @@ var WeaveExportManager = class {
10130
10135
  fill: backgroundColor
10131
10136
  });
10132
10137
  const exportGroup = new Konva.Group();
10133
- if (!exportArea) {
10138
+ if (exportArea) mainLayer.add(background);
10139
+ else {
10134
10140
  exportGroup.add(background);
10135
10141
  for (const node of nodes) {
10136
10142
  const clonedNode = node.clone({ id: v4_default() });
@@ -10142,7 +10148,7 @@ var WeaveExportManager = class {
10142
10148
  exportGroup.add(clonedNode);
10143
10149
  }
10144
10150
  mainLayer.add(exportGroup);
10145
- } else mainLayer.add(background);
10151
+ }
10146
10152
  const backgroundRect = background.getClientRect();
10147
10153
  stage.batchDraw();
10148
10154
  const { pixelRatio: finalPixelRatio } = this.fitKonvaPixelRatio(Math.round(backgroundRect.width), Math.round(backgroundRect.height), pixelRatio);
@@ -15219,8 +15225,8 @@ var WeaveImageNode = class extends WeaveNode {
15219
15225
  if (this.config.imageFallback.enabled) {
15220
15226
  const imageFallbackId = this.config.imageFallback.getId(params);
15221
15227
  let finalDataURL = "";
15222
- if (!dataURL) finalDataURL = this.config.imageFallback.getDataURL(imageFallbackId);
15223
- else finalDataURL = dataURL;
15228
+ if (dataURL) finalDataURL = dataURL;
15229
+ else finalDataURL = this.config.imageFallback.getDataURL(imageFallbackId);
15224
15230
  this.imageFallbackURL[imageFallbackId] = finalDataURL;
15225
15231
  }
15226
15232
  }
@@ -15241,7 +15247,7 @@ var WeaveImageNode = class extends WeaveNode {
15241
15247
  this.setupNotUsedImagesCleanup();
15242
15248
  };
15243
15249
  const bindedCleanupHandler = cleanupHandler.bind(this);
15244
- if (!this.notUsedImagesCleanup) this.notUsedImagesCleanup = setTimeout(bindedCleanupHandler, this.config.cleanup.intervalMs);
15250
+ this.notUsedImagesCleanup ??= setTimeout(bindedCleanupHandler, this.config.cleanup.intervalMs);
15245
15251
  }
15246
15252
  preloadCursors() {
15247
15253
  return new Promise((resolve) => {
package/dist/sdk.node.js CHANGED
@@ -6607,7 +6607,12 @@ var WeaveNode = class {
6607
6607
  this.instance.emitEvent("onDrag", null);
6608
6608
  const realNodeTarget = this.getRealSelectedNode(nodeTarget);
6609
6609
  const isInGroupContext = (this.getSelectionPlugin()?.getActiveGroupContext() ?? null) !== null;
6610
- if (!isInGroupContext && this.isSelecting() && this.getSelectionPlugin()?.getSelectedNodes().length === 1 && (realNodeTarget.getAttrs().lockToContainer === void 0 || !realNodeTarget.getAttrs().lockToContainer)) this.instance.stateTransactional(() => {
6610
+ const shouldUpdateMove = this.isSelecting() && this.getSelectionPlugin()?.getSelectedNodes().length === 1 && (realNodeTarget.getAttrs().lockToContainer === void 0 || !realNodeTarget.getAttrs().lockToContainer);
6611
+ if (isInGroupContext && shouldUpdateMove) {
6612
+ if (realNodeTarget.getAttrs().isCloned) this.instance.getCloningManager().removeClone(realNodeTarget);
6613
+ this.instance.updateNodeNT(this.serialize(realNodeTarget));
6614
+ }
6615
+ if (!isInGroupContext && shouldUpdateMove) this.instance.stateTransactional(() => {
6611
6616
  clearContainerTargets(this.instance);
6612
6617
  const layerToMove = containerOverCursor(this.instance, [realNodeTarget]);
6613
6618
  let containerToMove = this.instance.getMainLayer();
@@ -9687,7 +9692,7 @@ var WeaveRegisterManager = class {
9687
9692
 
9688
9693
  //#endregion
9689
9694
  //#region package.json
9690
- var version = "5.0.0-SNAPSHOT.413.1";
9695
+ var version = "5.0.0";
9691
9696
 
9692
9697
  //#endregion
9693
9698
  //#region src/managers/setup.ts
@@ -10129,7 +10134,8 @@ var WeaveExportManager = class {
10129
10134
  fill: backgroundColor
10130
10135
  });
10131
10136
  const exportGroup = new Konva.Group();
10132
- if (!exportArea) {
10137
+ if (exportArea) mainLayer.add(background);
10138
+ else {
10133
10139
  exportGroup.add(background);
10134
10140
  for (const node of nodes) {
10135
10141
  const clonedNode = node.clone({ id: v4_default() });
@@ -10141,7 +10147,7 @@ var WeaveExportManager = class {
10141
10147
  exportGroup.add(clonedNode);
10142
10148
  }
10143
10149
  mainLayer.add(exportGroup);
10144
- } else mainLayer.add(background);
10150
+ }
10145
10151
  const backgroundRect = background.getClientRect();
10146
10152
  stage.batchDraw();
10147
10153
  const { pixelRatio: finalPixelRatio } = this.fitKonvaPixelRatio(Math.round(backgroundRect.width), Math.round(backgroundRect.height), pixelRatio);
@@ -15218,8 +15224,8 @@ var WeaveImageNode = class extends WeaveNode {
15218
15224
  if (this.config.imageFallback.enabled) {
15219
15225
  const imageFallbackId = this.config.imageFallback.getId(params);
15220
15226
  let finalDataURL = "";
15221
- if (!dataURL) finalDataURL = this.config.imageFallback.getDataURL(imageFallbackId);
15222
- else finalDataURL = dataURL;
15227
+ if (dataURL) finalDataURL = dataURL;
15228
+ else finalDataURL = this.config.imageFallback.getDataURL(imageFallbackId);
15223
15229
  this.imageFallbackURL[imageFallbackId] = finalDataURL;
15224
15230
  }
15225
15231
  }
@@ -15240,7 +15246,7 @@ var WeaveImageNode = class extends WeaveNode {
15240
15246
  this.setupNotUsedImagesCleanup();
15241
15247
  };
15242
15248
  const bindedCleanupHandler = cleanupHandler.bind(this);
15243
- if (!this.notUsedImagesCleanup) this.notUsedImagesCleanup = setTimeout(bindedCleanupHandler, this.config.cleanup.intervalMs);
15249
+ this.notUsedImagesCleanup ??= setTimeout(bindedCleanupHandler, this.config.cleanup.intervalMs);
15244
15250
  }
15245
15251
  preloadCursors() {
15246
15252
  return new Promise((resolve) => {