@inditextech/weave-sdk 3.10.0 → 3.10.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
@@ -17698,7 +17698,8 @@ function moveNodeToContainerNT(instance, node, containerToMove, originalNode, or
17698
17698
  const actualContainerAttrs = nodeActualContainer.getAttrs();
17699
17699
  let layerToMove = void 0;
17700
17700
  if (actualContainerAttrs.id !== containerToMove.getAttrs().id && !invalidOriginsTypes.includes(node.getAttrs().nodeType)) layerToMove = containerToMove;
17701
- if (layerToMove && actualContainerAttrs.id !== layerToMove.getAttrs().id && actualContainerAttrs.id !== layerToMove.getAttrs().containerId) {
17701
+ const nodeHandler = instance.getNodeHandler(node.getAttrs().nodeType);
17702
+ if (layerToMove && actualContainerAttrs.id !== layerToMove.getAttrs().id && actualContainerAttrs.id !== layerToMove.getAttrs().containerId && nodeHandler) {
17702
17703
  const layerToMoveAttrs = layerToMove.getAttrs();
17703
17704
  const nodePos = node.getAbsolutePosition();
17704
17705
  const nodeRotation = node.getAbsoluteRotation();
@@ -17707,7 +17708,6 @@ function moveNodeToContainerNT(instance, node, containerToMove, originalNode, or
17707
17708
  node.rotation(nodeRotation);
17708
17709
  node.x(node.x() - (layerToMoveAttrs.containerOffsetX ?? 0));
17709
17710
  node.y(node.y() - (layerToMoveAttrs.containerOffsetY ?? 0));
17710
- node.destroy();
17711
17711
  const newNode = node.clone();
17712
17712
  instance.emitEvent("onNodeMovedToContainer", {
17713
17713
  node: newNode,
@@ -17715,17 +17715,15 @@ function moveNodeToContainerNT(instance, node, containerToMove, originalNode, or
17715
17715
  originalNode,
17716
17716
  originalContainer
17717
17717
  });
17718
- const nodeHandler = instance.getNodeHandler(node.getAttrs().nodeType);
17719
- if (nodeHandler) {
17720
- const actualNodeState = nodeHandler.serialize(node);
17721
- const newNodeState = nodeHandler.serialize(newNode);
17722
- instance.removeNodeNT(actualNodeState, { emitUserChangeEvent: false });
17723
- instance.addNodeNT(newNodeState, layerToMoveAttrs.id, {
17724
- emitUserChangeEvent: false,
17725
- overrideUserChangeType: WEAVE_NODE_CHANGE_TYPE.UPDATE
17726
- });
17727
- return true;
17728
- }
17718
+ const actualNodeState = nodeHandler.serialize(node);
17719
+ const newNodeState = nodeHandler.serialize(newNode);
17720
+ node.destroy();
17721
+ instance.removeNodeNT(actualNodeState, { emitUserChangeEvent: false });
17722
+ instance.addNodeNT(newNodeState, layerToMoveAttrs.id, {
17723
+ emitUserChangeEvent: false,
17724
+ overrideUserChangeType: WEAVE_NODE_CHANGE_TYPE.UPDATE
17725
+ });
17726
+ return true;
17729
17727
  }
17730
17728
  return false;
17731
17729
  }
@@ -19288,10 +19286,10 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
19288
19286
  }
19289
19287
  const isStage = e.target instanceof Konva.Stage;
19290
19288
  const isTransformer = e.target?.getParent() instanceof Konva.Transformer;
19291
- const isTargetable = e.target.getAttrs().isTargetable !== false;
19289
+ const canBeTargeted = e.target.getAttrs().canBeTargeted !== false;
19292
19290
  const isContainerEmptyArea = e.target.getAttrs().isContainerPrincipal !== void 0 && !e.target.getAttrs().isContainerPrincipal;
19293
19291
  if (isTransformer) return;
19294
- if (!isStage && !isContainerEmptyArea && isTargetable) {
19292
+ if (!isStage && !isContainerEmptyArea && canBeTargeted) {
19295
19293
  this.selecting = false;
19296
19294
  this.stopPanLoop();
19297
19295
  this.hideSelectorArea();
@@ -20403,6 +20401,9 @@ var WeaveNode = class {
20403
20401
  mutexUserId: void 0
20404
20402
  });
20405
20403
  };
20404
+ const isLocked = node.getAttrs().locked ?? false;
20405
+ if (isLocked) node.listening(false);
20406
+ else node.listening(true);
20406
20407
  }
20407
20408
  isNodeSelected(ele) {
20408
20409
  const selectionPlugin = this.instance.getPlugin("nodesSelection");
@@ -20787,27 +20788,27 @@ var WeaveNode = class {
20787
20788
  const activeAction = this.instance.getActiveAction();
20788
20789
  const isNodeSelectionEnabled = this.getSelectionPlugin()?.isEnabled();
20789
20790
  const realNode = this.instance.getInstanceRecursive(node);
20790
- const isTargetable = node.getAttrs().isTargetable !== false;
20791
- const isLocked = node.getAttrs().locked ?? false;
20791
+ const canBeTargeted = realNode.getAttrs().canBeTargeted !== false;
20792
+ const isLocked = realNode.getAttrs().locked ?? false;
20792
20793
  const isMutexLocked = realNode.getAttrs().mutexLocked && realNode.getAttrs().mutexUserId !== user.id;
20793
20794
  if ([MOVE_TOOL_ACTION_NAME].includes(activeAction ?? "")) return false;
20794
20795
  let showHover = false;
20795
20796
  let cancelBubble = false;
20796
- if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(realNode) && !this.isPasting() && (isLocked || isMutexLocked)) {
20797
+ if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(realNode) && !this.isPasting() && realNode.hasName("node") && (isLocked || isMutexLocked)) {
20797
20798
  stage.container().style.cursor = "default";
20798
20799
  cancelBubble = true;
20799
20800
  }
20800
- if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(realNode) && !this.isPasting() && isTargetable && !(isLocked || isMutexLocked) && stage.mode() === WEAVE_STAGE_DEFAULT_MODE) {
20801
+ if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(realNode) && !this.isPasting() && canBeTargeted && realNode.hasName("node") && !(isLocked || isMutexLocked) && stage.mode() === WEAVE_STAGE_DEFAULT_MODE) {
20801
20802
  showHover = true;
20802
- stage.container().style.cursor = (typeof node?.defineMousePointer === "function" ? node.defineMousePointer() : null) ?? "pointer";
20803
+ stage.container().style.cursor = (typeof realNode?.defineMousePointer === "function" ? realNode.defineMousePointer() : null) ?? "pointer";
20803
20804
  cancelBubble = true;
20804
20805
  }
20805
- if (isNodeSelectionEnabled && this.isSelecting() && this.isNodeSelected(realNode) && !this.isPasting() && isTargetable && !(isLocked || isMutexLocked) && stage.mode() === WEAVE_STAGE_DEFAULT_MODE) {
20806
+ if (isNodeSelectionEnabled && this.isSelecting() && this.isNodeSelected(realNode) && !this.isPasting() && realNode.hasName("node") && canBeTargeted && !(isLocked || isMutexLocked) && stage.mode() === WEAVE_STAGE_DEFAULT_MODE) {
20806
20807
  showHover = true;
20807
- stage.container().style.cursor = (typeof node?.defineMousePointer === "function" ? node.defineMousePointer() : null) ?? "grab";
20808
+ stage.container().style.cursor = (typeof realNode?.defineMousePointer === "function" ? realNode.defineMousePointer() : null) ?? "grab";
20808
20809
  cancelBubble = true;
20809
20810
  }
20810
- if (!isTargetable) cancelBubble = true;
20811
+ if (!canBeTargeted) cancelBubble = true;
20811
20812
  if (this.isPasting()) {
20812
20813
  stage.container().style.cursor = "crosshair";
20813
20814
  cancelBubble = true;
@@ -20895,7 +20896,12 @@ var WeaveNode = class {
20895
20896
  }
20896
20897
  lock(instance) {
20897
20898
  if (instance.getAttrs().nodeType !== this.getNodeType()) return;
20898
- instance.setAttrs({ locked: true });
20899
+ const isListening = instance.listening();
20900
+ instance.setAttrs({
20901
+ locked: true,
20902
+ listening: false,
20903
+ previousListening: isListening
20904
+ });
20899
20905
  this.instance.updateNode(this.serialize(instance));
20900
20906
  const selectionPlugin = this.getSelectionPlugin();
20901
20907
  if (selectionPlugin) {
@@ -20913,7 +20919,12 @@ var WeaveNode = class {
20913
20919
  let realInstance = instance;
20914
20920
  if (instance.getAttrs().nodeId) realInstance = this.instance.getStage().findOne(`#${instance.getAttrs().nodeId}`);
20915
20921
  if (!realInstance) return;
20916
- realInstance.setAttrs({ locked: false });
20922
+ const previousListening = realInstance.getAttrs().previousListening ?? true;
20923
+ realInstance.setAttrs({
20924
+ locked: false,
20925
+ listening: previousListening,
20926
+ previousListening: void 0
20927
+ });
20917
20928
  this.instance.updateNode(this.serialize(realInstance));
20918
20929
  this.setupDefaultNodeEvents(realInstance);
20919
20930
  const stage = this.instance.getStage();
@@ -22076,7 +22087,7 @@ var WeaveRegisterManager = class {
22076
22087
 
22077
22088
  //#endregion
22078
22089
  //#region package.json
22079
- var version = "3.10.0";
22090
+ var version = "3.10.1";
22080
22091
 
22081
22092
  //#endregion
22082
22093
  //#region src/managers/setup.ts
@@ -24264,6 +24275,7 @@ async function downscaleImageFile(file, ratio) {
24264
24275
  ctx.drawImage(bitmap, 0, 0, width, height);
24265
24276
  return new Promise((resolve) => {
24266
24277
  canvas.toBlob((blob) => resolve(blob), file.type, .9);
24278
+ canvas.remove();
24267
24279
  });
24268
24280
  }
24269
24281
  function getImageSizeFromFile(file) {
@@ -24319,7 +24331,9 @@ const downscaleImageFromURL = (url, options) => {
24319
24331
  canvas.height = height;
24320
24332
  const ctx = canvas.getContext("2d");
24321
24333
  ctx.drawImage(img, 0, 0, width, height);
24322
- resolve(canvas.toDataURL(type));
24334
+ const dataURL = canvas.toDataURL(type);
24335
+ canvas.remove();
24336
+ resolve(dataURL);
24323
24337
  };
24324
24338
  img.onerror = () => {
24325
24339
  reject(new Error("Invalid image", { cause: "InvalidImage" }));
@@ -24381,7 +24395,8 @@ var WeaveStageNode = class extends WeaveNode {
24381
24395
  globalEventsInitialized = false;
24382
24396
  initialize = void 0;
24383
24397
  onRender(props) {
24384
- const stage = new Konva.Stage({
24398
+ let stage = this.instance.getStage();
24399
+ if (!stage) stage = new Konva.Stage({
24385
24400
  ...props,
24386
24401
  mode: "default"
24387
24402
  });
@@ -26431,6 +26446,7 @@ const doPreloadCursors = async (cursorsToPreload, setCursor, getFallbackCursor,
26431
26446
  const ctx = canvas.getContext("2d");
26432
26447
  ctx?.drawImage(img, 0, 0);
26433
26448
  const dataURL = canvas.toDataURL("image/png");
26449
+ canvas.remove();
26434
26450
  const tokens = value.split(" ");
26435
26451
  tokens[0] = `url(${dataURL})`;
26436
26452
  setCursor(state, tokens.join(" "));
@@ -27791,7 +27807,7 @@ var WeaveFrameNode = class extends WeaveNode {
27791
27807
  strokeScaleEnabled: true,
27792
27808
  listening: true,
27793
27809
  draggable: false,
27794
- isTargetable: false
27810
+ canBeTargeted: false
27795
27811
  });
27796
27812
  frameInternal.clip({
27797
27813
  x: -(borderWidth / 2) * frameInternal.scaleX(),
@@ -29121,7 +29137,7 @@ var WeaveCommentNode = class extends WeaveNode {
29121
29137
  const commentNode = new Konva.Group({
29122
29138
  ...commentParams,
29123
29139
  name: "comment",
29124
- isTargetable: false,
29140
+ canBeTargeted: false,
29125
29141
  isExpanded: false,
29126
29142
  commentAction: null,
29127
29143
  listening: true,
@@ -29132,7 +29148,7 @@ var WeaveCommentNode = class extends WeaveNode {
29132
29148
  id: `${id}-bg`,
29133
29149
  x: 0,
29134
29150
  y: -heightContracted,
29135
- isTargetable: false,
29151
+ canBeTargeted: false,
29136
29152
  fill: commentParams.userBackgroundColor ?? "#0000FF",
29137
29153
  stroke: this.config.style.stroke,
29138
29154
  strokeWidth: this.config.style.strokeWidth,
@@ -38672,7 +38688,9 @@ var WeaveStageMinimapPlugin = class extends WeavePlugin {
38672
38688
  skipStroke: true
38673
38689
  });
38674
38690
  if (box.width === 0 || box.height === 0) return;
38675
- const fitScale = Math.min(this.minimapStage.width() / box.width, this.minimapStage.height() / box.height);
38691
+ const width = this.minimapStage?.width();
38692
+ const height = this.minimapStage?.height();
38693
+ const fitScale = Math.min(width / box.width, height / box.height);
38676
38694
  const centerOffset = {
38677
38695
  x: (this.minimapStage.width() - box.width * fitScale) / 2,
38678
38696
  y: (this.minimapStage.height() - box.height * fitScale) / 2
package/dist/sdk.node.js CHANGED
@@ -17697,7 +17697,8 @@ function moveNodeToContainerNT(instance, node, containerToMove, originalNode, or
17697
17697
  const actualContainerAttrs = nodeActualContainer.getAttrs();
17698
17698
  let layerToMove = void 0;
17699
17699
  if (actualContainerAttrs.id !== containerToMove.getAttrs().id && !invalidOriginsTypes.includes(node.getAttrs().nodeType)) layerToMove = containerToMove;
17700
- if (layerToMove && actualContainerAttrs.id !== layerToMove.getAttrs().id && actualContainerAttrs.id !== layerToMove.getAttrs().containerId) {
17700
+ const nodeHandler = instance.getNodeHandler(node.getAttrs().nodeType);
17701
+ if (layerToMove && actualContainerAttrs.id !== layerToMove.getAttrs().id && actualContainerAttrs.id !== layerToMove.getAttrs().containerId && nodeHandler) {
17701
17702
  const layerToMoveAttrs = layerToMove.getAttrs();
17702
17703
  const nodePos = node.getAbsolutePosition();
17703
17704
  const nodeRotation = node.getAbsoluteRotation();
@@ -17706,7 +17707,6 @@ function moveNodeToContainerNT(instance, node, containerToMove, originalNode, or
17706
17707
  node.rotation(nodeRotation);
17707
17708
  node.x(node.x() - (layerToMoveAttrs.containerOffsetX ?? 0));
17708
17709
  node.y(node.y() - (layerToMoveAttrs.containerOffsetY ?? 0));
17709
- node.destroy();
17710
17710
  const newNode = node.clone();
17711
17711
  instance.emitEvent("onNodeMovedToContainer", {
17712
17712
  node: newNode,
@@ -17714,17 +17714,15 @@ function moveNodeToContainerNT(instance, node, containerToMove, originalNode, or
17714
17714
  originalNode,
17715
17715
  originalContainer
17716
17716
  });
17717
- const nodeHandler = instance.getNodeHandler(node.getAttrs().nodeType);
17718
- if (nodeHandler) {
17719
- const actualNodeState = nodeHandler.serialize(node);
17720
- const newNodeState = nodeHandler.serialize(newNode);
17721
- instance.removeNodeNT(actualNodeState, { emitUserChangeEvent: false });
17722
- instance.addNodeNT(newNodeState, layerToMoveAttrs.id, {
17723
- emitUserChangeEvent: false,
17724
- overrideUserChangeType: WEAVE_NODE_CHANGE_TYPE.UPDATE
17725
- });
17726
- return true;
17727
- }
17717
+ const actualNodeState = nodeHandler.serialize(node);
17718
+ const newNodeState = nodeHandler.serialize(newNode);
17719
+ node.destroy();
17720
+ instance.removeNodeNT(actualNodeState, { emitUserChangeEvent: false });
17721
+ instance.addNodeNT(newNodeState, layerToMoveAttrs.id, {
17722
+ emitUserChangeEvent: false,
17723
+ overrideUserChangeType: WEAVE_NODE_CHANGE_TYPE.UPDATE
17724
+ });
17725
+ return true;
17728
17726
  }
17729
17727
  return false;
17730
17728
  }
@@ -19287,10 +19285,10 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
19287
19285
  }
19288
19286
  const isStage = e.target instanceof Konva.Stage;
19289
19287
  const isTransformer = e.target?.getParent() instanceof Konva.Transformer;
19290
- const isTargetable = e.target.getAttrs().isTargetable !== false;
19288
+ const canBeTargeted = e.target.getAttrs().canBeTargeted !== false;
19291
19289
  const isContainerEmptyArea = e.target.getAttrs().isContainerPrincipal !== void 0 && !e.target.getAttrs().isContainerPrincipal;
19292
19290
  if (isTransformer) return;
19293
- if (!isStage && !isContainerEmptyArea && isTargetable) {
19291
+ if (!isStage && !isContainerEmptyArea && canBeTargeted) {
19294
19292
  this.selecting = false;
19295
19293
  this.stopPanLoop();
19296
19294
  this.hideSelectorArea();
@@ -20402,6 +20400,9 @@ var WeaveNode = class {
20402
20400
  mutexUserId: void 0
20403
20401
  });
20404
20402
  };
20403
+ const isLocked = node.getAttrs().locked ?? false;
20404
+ if (isLocked) node.listening(false);
20405
+ else node.listening(true);
20405
20406
  }
20406
20407
  isNodeSelected(ele) {
20407
20408
  const selectionPlugin = this.instance.getPlugin("nodesSelection");
@@ -20786,27 +20787,27 @@ var WeaveNode = class {
20786
20787
  const activeAction = this.instance.getActiveAction();
20787
20788
  const isNodeSelectionEnabled = this.getSelectionPlugin()?.isEnabled();
20788
20789
  const realNode = this.instance.getInstanceRecursive(node);
20789
- const isTargetable = node.getAttrs().isTargetable !== false;
20790
- const isLocked = node.getAttrs().locked ?? false;
20790
+ const canBeTargeted = realNode.getAttrs().canBeTargeted !== false;
20791
+ const isLocked = realNode.getAttrs().locked ?? false;
20791
20792
  const isMutexLocked = realNode.getAttrs().mutexLocked && realNode.getAttrs().mutexUserId !== user.id;
20792
20793
  if ([MOVE_TOOL_ACTION_NAME].includes(activeAction ?? "")) return false;
20793
20794
  let showHover = false;
20794
20795
  let cancelBubble = false;
20795
- if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(realNode) && !this.isPasting() && (isLocked || isMutexLocked)) {
20796
+ if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(realNode) && !this.isPasting() && realNode.hasName("node") && (isLocked || isMutexLocked)) {
20796
20797
  stage.container().style.cursor = "default";
20797
20798
  cancelBubble = true;
20798
20799
  }
20799
- if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(realNode) && !this.isPasting() && isTargetable && !(isLocked || isMutexLocked) && stage.mode() === WEAVE_STAGE_DEFAULT_MODE) {
20800
+ if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(realNode) && !this.isPasting() && canBeTargeted && realNode.hasName("node") && !(isLocked || isMutexLocked) && stage.mode() === WEAVE_STAGE_DEFAULT_MODE) {
20800
20801
  showHover = true;
20801
- stage.container().style.cursor = (typeof node?.defineMousePointer === "function" ? node.defineMousePointer() : null) ?? "pointer";
20802
+ stage.container().style.cursor = (typeof realNode?.defineMousePointer === "function" ? realNode.defineMousePointer() : null) ?? "pointer";
20802
20803
  cancelBubble = true;
20803
20804
  }
20804
- if (isNodeSelectionEnabled && this.isSelecting() && this.isNodeSelected(realNode) && !this.isPasting() && isTargetable && !(isLocked || isMutexLocked) && stage.mode() === WEAVE_STAGE_DEFAULT_MODE) {
20805
+ if (isNodeSelectionEnabled && this.isSelecting() && this.isNodeSelected(realNode) && !this.isPasting() && realNode.hasName("node") && canBeTargeted && !(isLocked || isMutexLocked) && stage.mode() === WEAVE_STAGE_DEFAULT_MODE) {
20805
20806
  showHover = true;
20806
- stage.container().style.cursor = (typeof node?.defineMousePointer === "function" ? node.defineMousePointer() : null) ?? "grab";
20807
+ stage.container().style.cursor = (typeof realNode?.defineMousePointer === "function" ? realNode.defineMousePointer() : null) ?? "grab";
20807
20808
  cancelBubble = true;
20808
20809
  }
20809
- if (!isTargetable) cancelBubble = true;
20810
+ if (!canBeTargeted) cancelBubble = true;
20810
20811
  if (this.isPasting()) {
20811
20812
  stage.container().style.cursor = "crosshair";
20812
20813
  cancelBubble = true;
@@ -20894,7 +20895,12 @@ var WeaveNode = class {
20894
20895
  }
20895
20896
  lock(instance) {
20896
20897
  if (instance.getAttrs().nodeType !== this.getNodeType()) return;
20897
- instance.setAttrs({ locked: true });
20898
+ const isListening = instance.listening();
20899
+ instance.setAttrs({
20900
+ locked: true,
20901
+ listening: false,
20902
+ previousListening: isListening
20903
+ });
20898
20904
  this.instance.updateNode(this.serialize(instance));
20899
20905
  const selectionPlugin = this.getSelectionPlugin();
20900
20906
  if (selectionPlugin) {
@@ -20912,7 +20918,12 @@ var WeaveNode = class {
20912
20918
  let realInstance = instance;
20913
20919
  if (instance.getAttrs().nodeId) realInstance = this.instance.getStage().findOne(`#${instance.getAttrs().nodeId}`);
20914
20920
  if (!realInstance) return;
20915
- realInstance.setAttrs({ locked: false });
20921
+ const previousListening = realInstance.getAttrs().previousListening ?? true;
20922
+ realInstance.setAttrs({
20923
+ locked: false,
20924
+ listening: previousListening,
20925
+ previousListening: void 0
20926
+ });
20916
20927
  this.instance.updateNode(this.serialize(realInstance));
20917
20928
  this.setupDefaultNodeEvents(realInstance);
20918
20929
  const stage = this.instance.getStage();
@@ -22075,7 +22086,7 @@ var WeaveRegisterManager = class {
22075
22086
 
22076
22087
  //#endregion
22077
22088
  //#region package.json
22078
- var version = "3.10.0";
22089
+ var version = "3.10.1";
22079
22090
 
22080
22091
  //#endregion
22081
22092
  //#region src/managers/setup.ts
@@ -24263,6 +24274,7 @@ async function downscaleImageFile(file, ratio) {
24263
24274
  ctx.drawImage(bitmap, 0, 0, width, height);
24264
24275
  return new Promise((resolve) => {
24265
24276
  canvas.toBlob((blob) => resolve(blob), file.type, .9);
24277
+ canvas.remove();
24266
24278
  });
24267
24279
  }
24268
24280
  function getImageSizeFromFile(file) {
@@ -24318,7 +24330,9 @@ const downscaleImageFromURL = (url, options) => {
24318
24330
  canvas.height = height;
24319
24331
  const ctx = canvas.getContext("2d");
24320
24332
  ctx.drawImage(img, 0, 0, width, height);
24321
- resolve(canvas.toDataURL(type));
24333
+ const dataURL = canvas.toDataURL(type);
24334
+ canvas.remove();
24335
+ resolve(dataURL);
24322
24336
  };
24323
24337
  img.onerror = () => {
24324
24338
  reject(new Error("Invalid image", { cause: "InvalidImage" }));
@@ -24380,7 +24394,8 @@ var WeaveStageNode = class extends WeaveNode {
24380
24394
  globalEventsInitialized = false;
24381
24395
  initialize = void 0;
24382
24396
  onRender(props) {
24383
- const stage = new Konva.Stage({
24397
+ let stage = this.instance.getStage();
24398
+ if (!stage) stage = new Konva.Stage({
24384
24399
  ...props,
24385
24400
  mode: "default"
24386
24401
  });
@@ -26430,6 +26445,7 @@ const doPreloadCursors = async (cursorsToPreload, setCursor, getFallbackCursor,
26430
26445
  const ctx = canvas.getContext("2d");
26431
26446
  ctx?.drawImage(img, 0, 0);
26432
26447
  const dataURL = canvas.toDataURL("image/png");
26448
+ canvas.remove();
26433
26449
  const tokens = value.split(" ");
26434
26450
  tokens[0] = `url(${dataURL})`;
26435
26451
  setCursor(state, tokens.join(" "));
@@ -27790,7 +27806,7 @@ var WeaveFrameNode = class extends WeaveNode {
27790
27806
  strokeScaleEnabled: true,
27791
27807
  listening: true,
27792
27808
  draggable: false,
27793
- isTargetable: false
27809
+ canBeTargeted: false
27794
27810
  });
27795
27811
  frameInternal.clip({
27796
27812
  x: -(borderWidth / 2) * frameInternal.scaleX(),
@@ -29120,7 +29136,7 @@ var WeaveCommentNode = class extends WeaveNode {
29120
29136
  const commentNode = new Konva.Group({
29121
29137
  ...commentParams,
29122
29138
  name: "comment",
29123
- isTargetable: false,
29139
+ canBeTargeted: false,
29124
29140
  isExpanded: false,
29125
29141
  commentAction: null,
29126
29142
  listening: true,
@@ -29131,7 +29147,7 @@ var WeaveCommentNode = class extends WeaveNode {
29131
29147
  id: `${id}-bg`,
29132
29148
  x: 0,
29133
29149
  y: -heightContracted,
29134
- isTargetable: false,
29150
+ canBeTargeted: false,
29135
29151
  fill: commentParams.userBackgroundColor ?? "#0000FF",
29136
29152
  stroke: this.config.style.stroke,
29137
29153
  strokeWidth: this.config.style.strokeWidth,
@@ -38671,7 +38687,9 @@ var WeaveStageMinimapPlugin = class extends WeavePlugin {
38671
38687
  skipStroke: true
38672
38688
  });
38673
38689
  if (box.width === 0 || box.height === 0) return;
38674
- const fitScale = Math.min(this.minimapStage.width() / box.width, this.minimapStage.height() / box.height);
38690
+ const width = this.minimapStage?.width();
38691
+ const height = this.minimapStage?.height();
38692
+ const fitScale = Math.min(width / box.width, height / box.height);
38675
38693
  const centerOffset = {
38676
38694
  x: (this.minimapStage.width() - box.width * fitScale) / 2,
38677
38695
  y: (this.minimapStage.height() - box.height * fitScale) / 2