@inditextech/weave-sdk 0.76.1 → 0.76.2

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.cjs CHANGED
@@ -20278,7 +20278,6 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
20278
20278
  this.selecting = false;
20279
20279
  this.stopPanLoop();
20280
20280
  this.hideSelectorArea();
20281
- this.handleClickOrTap(e);
20282
20281
  return;
20283
20282
  }
20284
20283
  const isStage = e.target instanceof konva.default.Stage;
@@ -20381,6 +20380,14 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
20381
20380
  return;
20382
20381
  }
20383
20382
  if (contextMenuPlugin?.isContextMenuVisible()) this.stopPanLoop();
20383
+ const selectedGroup = getTargetedNode(this.instance);
20384
+ if (!moved && selectedGroup?.getParent() instanceof konva.default.Transformer) {
20385
+ this.selecting = false;
20386
+ this.stopPanLoop();
20387
+ this.hideSelectorArea();
20388
+ this.handleClickOrTap(e);
20389
+ return;
20390
+ }
20384
20391
  if (!this.selectionRectangle.visible()) {
20385
20392
  this.hideSelectorArea();
20386
20393
  return;
@@ -20732,12 +20739,12 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
20732
20739
  this.createPasteCatcher();
20733
20740
  const catcher = this.getCatcherElement();
20734
20741
  window.addEventListener("keydown", async (e) => {
20735
- if (stage.isFocused() && e.key === "c" && (e.ctrlKey || e.metaKey)) {
20742
+ if (stage.isFocused() && e.code === "KeyC" && (e.ctrlKey || e.metaKey)) {
20736
20743
  e.preventDefault();
20737
20744
  await this.performCopy();
20738
20745
  return;
20739
20746
  }
20740
- if (stage.isFocused() && e.key === "v" && (e.ctrlKey || e.metaKey)) {
20747
+ if (stage.isFocused() && e.code === "KeyV" && (e.ctrlKey || e.metaKey)) {
20741
20748
  this.focusPasteCatcher();
20742
20749
  if (!this.enabled) return;
20743
20750
  }
@@ -21323,24 +21330,26 @@ var WeaveNode = class {
21323
21330
  const stage = this.instance.getStage();
21324
21331
  const activeAction = this.instance.getActiveAction();
21325
21332
  const isNodeSelectionEnabled = this.getSelectionPlugin()?.isEnabled();
21333
+ const realNode = this.instance.getInstanceRecursive(node);
21326
21334
  const isTargetable = node.getAttrs().isTargetable !== false;
21327
21335
  const isLocked = node.getAttrs().locked ?? false;
21328
21336
  if ([MOVE_TOOL_ACTION_NAME].includes(activeAction ?? "")) return false;
21329
21337
  let showHover = false;
21330
21338
  let cancelBubble = false;
21331
- if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(node) && !this.isPasting() && isLocked) {
21339
+ if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(realNode) && !this.isPasting() && isLocked) {
21332
21340
  const stage$1 = this.instance.getStage();
21333
21341
  stage$1.container().style.cursor = "default";
21334
21342
  cancelBubble = true;
21335
21343
  }
21336
- if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(node) && !this.isPasting() && isTargetable && !isLocked && stage.mode() === WEAVE_STAGE_DEFAULT_MODE) {
21344
+ if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(realNode) && !this.isPasting() && isTargetable && !isLocked && stage.mode() === WEAVE_STAGE_DEFAULT_MODE) {
21337
21345
  const stage$1 = this.instance.getStage();
21338
21346
  showHover = true;
21339
21347
  stage$1.container().style.cursor = "pointer";
21340
21348
  cancelBubble = true;
21341
21349
  }
21342
- if (isNodeSelectionEnabled && this.isSelecting() && this.isNodeSelected(node) && !this.isPasting() && isTargetable && !isLocked && stage.mode() === WEAVE_STAGE_DEFAULT_MODE) {
21350
+ if (isNodeSelectionEnabled && this.isSelecting() && this.isNodeSelected(realNode) && !this.isPasting() && isTargetable && !isLocked && stage.mode() === WEAVE_STAGE_DEFAULT_MODE) {
21343
21351
  const stage$1 = this.instance.getStage();
21352
+ showHover = true;
21344
21353
  stage$1.container().style.cursor = "grab";
21345
21354
  cancelBubble = true;
21346
21355
  }
@@ -21350,7 +21359,7 @@ var WeaveNode = class {
21350
21359
  stage$1.container().style.cursor = "crosshair";
21351
21360
  cancelBubble = true;
21352
21361
  }
21353
- if (showHover) this.setHoverState(node);
21362
+ if (showHover) this.setHoverState(realNode);
21354
21363
  else this.hideHoverState();
21355
21364
  return cancelBubble;
21356
21365
  }
@@ -22921,7 +22930,7 @@ var WeaveRegisterManager = class {
22921
22930
 
22922
22931
  //#endregion
22923
22932
  //#region package.json
22924
- var version = "0.76.1";
22933
+ var version = "0.76.2";
22925
22934
 
22926
22935
  //#endregion
22927
22936
  //#region src/managers/setup.ts
@@ -23237,6 +23246,17 @@ var WeaveExportManager = class {
23237
23246
  }
23238
23247
  });
23239
23248
  }
23249
+ unpremultiply(data) {
23250
+ for (let i = 0; i < data.length; i += 4) {
23251
+ const a = data[i + 3];
23252
+ if (a && a < 255) {
23253
+ const alpha = a / 255;
23254
+ data[i] = Math.min(255, Math.round(data[i] / alpha));
23255
+ data[i + 1] = Math.min(255, Math.round(data[i + 1] / alpha));
23256
+ data[i + 2] = Math.min(255, Math.round(data[i + 2] / alpha));
23257
+ }
23258
+ }
23259
+ }
23240
23260
  async exportNodesAsBuffer(nodes, boundingNodes, options) {
23241
23261
  const { format: format$2 = __inditextech_weave_types.WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = __inditextech_weave_types.WEAVE_EXPORT_BACKGROUND_COLOR } = options;
23242
23262
  this.getNodesSelectionPlugin()?.disable();
@@ -23295,7 +23315,6 @@ var WeaveExportManager = class {
23295
23315
  }
23296
23316
  mainLayer.add(exportGroup);
23297
23317
  const backgroundRect = background.getClientRect();
23298
- stage.batchDraw();
23299
23318
  const composites = [];
23300
23319
  const imageWidth = Math.round(backgroundRect.width);
23301
23320
  const imageHeight = Math.round(backgroundRect.height);
@@ -24401,7 +24420,7 @@ var WeaveTextNode = class extends WeaveNode {
24401
24420
  this.instance.emitEvent("onTransform", null);
24402
24421
  });
24403
24422
  if (!this.instance.getConfiguration().serverSide) window.addEventListener("keypress", (e) => {
24404
- if (e.key === "Enter" && this.instance.getActiveAction() === SELECTION_TOOL_ACTION_NAME && !this.editing && e.target !== this.textArea) {
24423
+ if (e.code === "Enter" && this.instance.getActiveAction() === SELECTION_TOOL_ACTION_NAME && !this.editing && e.target !== this.textArea) {
24405
24424
  e.preventDefault();
24406
24425
  if (this.isSelecting() && this.isNodeSelected(text)) {
24407
24426
  const nodesSelectionPlugin = this.instance.getPlugin("nodesSelection");
@@ -24672,7 +24691,7 @@ var WeaveTextNode = class extends WeaveNode {
24672
24691
  if (!textNode.getAttrs().layout || textNode.getAttrs().layout === TEXT_LAYOUT.AUTO_HEIGHT || textNode.getAttrs().layout === TEXT_LAYOUT.AUTO_ALL) textNode.height(this.textArea.scrollHeight * (1 / textNode.getAbsoluteScale().x));
24673
24692
  };
24674
24693
  const handleKeyDown = (e) => {
24675
- if (this.textArea && textNode && e.key === "Escape") {
24694
+ if (this.textArea && textNode && e.code === "Escape") {
24676
24695
  e.stopPropagation();
24677
24696
  updateTextNodeSize();
24678
24697
  textNode.text(this.textArea.value);
@@ -24984,7 +25003,7 @@ var WeaveImageCrop = class WeaveImageCrop {
24984
25003
  if (!["Enter", "Escape"].includes(e.key)) return;
24985
25004
  this.cropping = false;
24986
25005
  this.image.setAttrs({ cropping: false });
24987
- if (e.key === "Enter") this.handleClipEnd();
25006
+ if (e.code === "Enter") this.handleClipEnd();
24988
25007
  const stage = this.instance.getStage();
24989
25008
  this.onClose();
24990
25009
  const utilityLayer = this.instance.getUtilityLayer();
@@ -25176,7 +25195,6 @@ var WeaveImageNode = class extends WeaveNode {
25176
25195
  this.lastTapTime = 0;
25177
25196
  this.config = mergeExceptArrays(WEAVE_IMAGE_DEFAULT_CONFIG, config);
25178
25197
  this.imageCrop = null;
25179
- this.cachedCropInfo = {};
25180
25198
  this.imageLoaded = false;
25181
25199
  }
25182
25200
  triggerCrop(imageNode) {
@@ -25215,7 +25233,6 @@ var WeaveImageNode = class extends WeaveNode {
25215
25233
  if (!internalImage || !cropGroup) return;
25216
25234
  const imageCrop = new WeaveImageCrop(this.instance, this, imageNode, internalImage, cropGroup);
25217
25235
  imageCrop.unCrop();
25218
- this.cachedCropInfo[imageNode.getAttrs().id ?? ""] = void 0;
25219
25236
  };
25220
25237
  loadAsyncElement(nodeId) {
25221
25238
  this.instance.loadAsyncElement(nodeId, "image");
@@ -25246,7 +25263,6 @@ var WeaveImageNode = class extends WeaveNode {
25246
25263
  const stage = this.instance.getStage();
25247
25264
  const image$1 = stage.findOne(`#${id}`);
25248
25265
  if (!image$1) return;
25249
- this.cachedCropInfo[image$1.getAttrs().id ?? ""] = void 0;
25250
25266
  };
25251
25267
  image.triggerCrop = () => {
25252
25268
  this.triggerCrop(image);
@@ -25260,7 +25276,6 @@ var WeaveImageNode = class extends WeaveNode {
25260
25276
  if (!image$1) return;
25261
25277
  const imageCrop = new WeaveImageCrop(this.instance, this, image$1, internalImage, cropGroup);
25262
25278
  imageCrop.unCrop();
25263
- this.cachedCropInfo[image$1.getAttrs().id ?? ""] = void 0;
25264
25279
  };
25265
25280
  const defaultTransformerProperties = this.defaultGetTransformerProperties(this.config.transform);
25266
25281
  image.getTransformerProperties = function() {
@@ -25323,31 +25338,30 @@ var WeaveImageNode = class extends WeaveNode {
25323
25338
  this.config.onDblClick?.(this, image);
25324
25339
  };
25325
25340
  if (this.imageSource[id]) {
25326
- imagePlaceholder?.setAttrs({
25327
- width: imageProps.width ? imageProps.width : this.imageSource[id].width,
25328
- height: imageProps.height ? imageProps.height : this.imageSource[id].height,
25329
- visible: false
25330
- });
25331
- internalImage?.setAttrs({
25332
- width: imageProps.width ? imageProps.width : this.imageSource[id].width,
25333
- height: imageProps.height ? imageProps.height : this.imageSource[id].height,
25341
+ imagePlaceholder.destroy();
25342
+ internalImage.setAttrs({
25343
+ width: this.imageSource[id].width,
25344
+ height: this.imageSource[id].height,
25334
25345
  image: this.imageSource[id],
25335
25346
  visible: true
25336
25347
  });
25337
25348
  this.imageLoaded = true;
25338
- image.setAttr("width", image.width() ? image.width() : this.imageSource[id].width);
25339
- image.setAttr("height", image.height() ? image.height() : this.imageSource[id].height);
25340
- image.setAttr("cropInfo", void 0);
25341
- image.setAttr("uncroppedImage", {
25342
- width: image.width() ? image.width() : this.imageSource[id].width,
25343
- height: image.height() ? image.height() : this.imageSource[id].height
25349
+ image.setAttr("width", this.imageSource[id].width);
25350
+ image.setAttr("height", this.imageSource[id].height);
25351
+ image.setAttr("cropInfo", props.cropInfo ?? void 0);
25352
+ image.setAttr("uncroppedImage", props.uncroppedImage ?? {
25353
+ width: this.imageSource[id].width,
25354
+ height: this.imageSource[id].height
25344
25355
  });
25345
25356
  image.setAttr("imageInfo", {
25346
25357
  width: this.imageSource[id].width,
25347
25358
  height: this.imageSource[id].height
25348
25359
  });
25349
25360
  this.instance.updateNode(this.serialize(image));
25350
- } else this.loadImage(imageProps, image);
25361
+ } else {
25362
+ this.updatePlaceholderSize(image, imagePlaceholder);
25363
+ this.loadImage(imageProps, image);
25364
+ }
25351
25365
  image.setAttr("imageURL", imageProps.imageURL);
25352
25366
  return image;
25353
25367
  }
@@ -25507,12 +25521,25 @@ var WeaveImageNode = class extends WeaveNode {
25507
25521
  }
25508
25522
  });
25509
25523
  }
25524
+ updatePlaceholderSize(image, imagePlaceholder) {
25525
+ const imageAttrs = image.getAttrs();
25526
+ if (!imageAttrs.adding && imageAttrs.cropInfo) {
25527
+ const actualScale = imageAttrs.uncroppedImage.width / imageAttrs.imageInfo.width;
25528
+ const cropScale = imageAttrs.cropInfo ? imageAttrs.cropInfo.scaleX : actualScale;
25529
+ imagePlaceholder.width(imageAttrs.cropSize.width * (actualScale / cropScale));
25530
+ imagePlaceholder.height(imageAttrs.cropSize.height * (actualScale / cropScale));
25531
+ }
25532
+ if (!imageAttrs.adding && !imageAttrs.cropInfo) {
25533
+ imagePlaceholder.width(imageAttrs.uncroppedImage.width);
25534
+ imagePlaceholder.height(imageAttrs.uncroppedImage.height);
25535
+ }
25536
+ }
25510
25537
  updateImageCrop(nextProps) {
25511
25538
  const imageAttrs = nextProps;
25512
25539
  const stage = this.instance.getStage();
25513
25540
  const image = stage.findOne(`#${imageAttrs.id}`);
25514
25541
  const internalImage = image?.findOne(`#${imageAttrs.id}-image`);
25515
- if (image && internalImage && !imageAttrs.adding && imageAttrs.cropInfo && !(0, import_lodash.isEqual)(imageAttrs.cropInfo, this.cachedCropInfo[imageAttrs.id ?? ""])) {
25542
+ if (image && internalImage && !imageAttrs.adding && imageAttrs.cropInfo) {
25516
25543
  const actualScale = imageAttrs.uncroppedImage.width / imageAttrs.imageInfo.width;
25517
25544
  const cropScale = imageAttrs.cropInfo ? imageAttrs.cropInfo.scaleX : actualScale;
25518
25545
  internalImage.width(imageAttrs.uncroppedImage.width);
@@ -25528,9 +25555,8 @@ var WeaveImageNode = class extends WeaveNode {
25528
25555
  });
25529
25556
  internalImage.width(imageAttrs.cropSize.width * (actualScale / cropScale));
25530
25557
  internalImage.height(imageAttrs.cropSize.height * (actualScale / cropScale));
25531
- this.cachedCropInfo[imageAttrs.id ?? ""] = imageAttrs.cropInfo;
25532
25558
  }
25533
- if (image && internalImage && !imageAttrs.adding && !imageAttrs.cropInfo && !(0, import_lodash.isEqual)(imageAttrs.cropInfo, this.cachedCropInfo[imageAttrs.id ?? ""])) {
25559
+ if (image && internalImage && !imageAttrs.adding && !imageAttrs.cropInfo) {
25534
25560
  internalImage.width(imageAttrs.uncroppedImage.width);
25535
25561
  internalImage.height(imageAttrs.uncroppedImage.height);
25536
25562
  internalImage.rotation(0);
@@ -25539,7 +25565,6 @@ var WeaveImageNode = class extends WeaveNode {
25539
25565
  internalImage.crop(void 0);
25540
25566
  internalImage.width(imageAttrs.uncroppedImage.width);
25541
25567
  internalImage.height(imageAttrs.uncroppedImage.height);
25542
- this.cachedCropInfo[imageAttrs.id ?? ""] = void 0;
25543
25568
  }
25544
25569
  }
25545
25570
  getImageSource(imageId) {
@@ -26072,7 +26097,7 @@ var WeaveFrameNode = class extends WeaveNode {
26072
26097
  });
26073
26098
  }
26074
26099
  const nodesSelectionPlugin = this.instance.getPlugin("nodesSelection");
26075
- if (nodesSelectionPlugin) nodesSelectionPlugin.getTransformer().forceUpdate();
26100
+ if (nodesSelectionPlugin) nodesSelectionPlugin.getTransformer()?.forceUpdate();
26076
26101
  }
26077
26102
  serialize(instance) {
26078
26103
  const stage = this.instance.getStage();
@@ -28183,7 +28208,7 @@ var WeaveMoveToolAction = class extends WeaveAction {
28183
28208
  setupEvents() {
28184
28209
  const stage = this.instance.getStage();
28185
28210
  window.addEventListener("keydown", (e) => {
28186
- if (e.key === "Escape" && this.instance.getActiveAction() === MOVE_TOOL_ACTION_NAME) {
28211
+ if (e.code === "Escape" && this.instance.getActiveAction() === MOVE_TOOL_ACTION_NAME) {
28187
28212
  this.cancelAction();
28188
28213
  return;
28189
28214
  }
@@ -28338,7 +28363,7 @@ var WeaveEraserToolAction = class extends WeaveAction {
28338
28363
  }
28339
28364
  });
28340
28365
  window.addEventListener("keydown", (e) => {
28341
- if (e.key === "Escape" && this.instance.getActiveAction() === ERASER_TOOL_ACTION_NAME) {
28366
+ if (e.code === "Escape" && this.instance.getActiveAction() === ERASER_TOOL_ACTION_NAME) {
28342
28367
  this.cancelAction();
28343
28368
  return;
28344
28369
  }
@@ -28436,11 +28461,11 @@ var WeaveRectangleToolAction = class extends WeaveAction {
28436
28461
  setupEvents() {
28437
28462
  const stage = this.instance.getStage();
28438
28463
  window.addEventListener("keydown", (e) => {
28439
- if (e.key === "Enter" && this.instance.getActiveAction() === RECTANGLE_TOOL_ACTION_NAME) {
28464
+ if (e.code === "Enter" && this.instance.getActiveAction() === RECTANGLE_TOOL_ACTION_NAME) {
28440
28465
  this.cancelAction();
28441
28466
  return;
28442
28467
  }
28443
- if (e.key === "Escape" && this.instance.getActiveAction() === RECTANGLE_TOOL_ACTION_NAME) {
28468
+ if (e.code === "Escape" && this.instance.getActiveAction() === RECTANGLE_TOOL_ACTION_NAME) {
28444
28469
  this.cancelAction();
28445
28470
  return;
28446
28471
  }
@@ -28645,11 +28670,11 @@ var WeaveEllipseToolAction = class extends WeaveAction {
28645
28670
  setupEvents() {
28646
28671
  const stage = this.instance.getStage();
28647
28672
  window.addEventListener("keydown", (e) => {
28648
- if (e.key === "Enter" && this.instance.getActiveAction() === ELLIPSE_TOOL_ACTION_NAME) {
28673
+ if (e.code === "Enter" && this.instance.getActiveAction() === ELLIPSE_TOOL_ACTION_NAME) {
28649
28674
  this.cancelAction();
28650
28675
  return;
28651
28676
  }
28652
- if (e.key === "Escape" && this.instance.getActiveAction() === ELLIPSE_TOOL_ACTION_NAME) {
28677
+ if (e.code === "Escape" && this.instance.getActiveAction() === ELLIPSE_TOOL_ACTION_NAME) {
28653
28678
  this.cancelAction();
28654
28679
  return;
28655
28680
  }
@@ -28861,11 +28886,11 @@ var WeavePenToolAction = class extends WeaveAction {
28861
28886
  setupEvents() {
28862
28887
  const stage = this.instance.getStage();
28863
28888
  window.addEventListener("keydown", (e) => {
28864
- if (e.key === "Enter" && this.instance.getActiveAction() === PEN_TOOL_ACTION_NAME) {
28889
+ if (e.code === "Enter" && this.instance.getActiveAction() === PEN_TOOL_ACTION_NAME) {
28865
28890
  this.cancelAction();
28866
28891
  return;
28867
28892
  }
28868
- if (e.key === "Escape" && this.instance.getActiveAction() === PEN_TOOL_ACTION_NAME) {
28893
+ if (e.code === "Escape" && this.instance.getActiveAction() === PEN_TOOL_ACTION_NAME) {
28869
28894
  this.cancelAction();
28870
28895
  return;
28871
28896
  }
@@ -29113,11 +29138,11 @@ var WeaveBrushToolAction = class extends WeaveAction {
29113
29138
  setupEvents() {
29114
29139
  const stage = this.instance.getStage();
29115
29140
  window.addEventListener("keydown", (e) => {
29116
- if (e.key === "Enter" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) {
29141
+ if (e.code === "Enter" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) {
29117
29142
  this.cancelAction();
29118
29143
  return;
29119
29144
  }
29120
- if (e.key === "Escape" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) {
29145
+ if (e.code === "Escape" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) {
29121
29146
  this.cancelAction();
29122
29147
  return;
29123
29148
  }
@@ -29342,7 +29367,7 @@ var WeaveTextToolAction = class extends WeaveAction {
29342
29367
  setupEvents() {
29343
29368
  const stage = this.instance.getStage();
29344
29369
  window.addEventListener("keydown", (e) => {
29345
- if (e.key === "Escape" && this.instance.getActiveAction() === TEXT_TOOL_ACTION_NAME) {
29370
+ if (e.code === "Escape" && this.instance.getActiveAction() === TEXT_TOOL_ACTION_NAME) {
29346
29371
  this.cancelAction();
29347
29372
  return;
29348
29373
  }
@@ -29494,7 +29519,7 @@ var WeaveImageToolAction = class extends WeaveAction {
29494
29519
  setupEvents() {
29495
29520
  const stage = this.instance.getStage();
29496
29521
  window.addEventListener("keydown", (e) => {
29497
- if (e.key === "Escape" && this.instance.getActiveAction() === IMAGE_TOOL_ACTION_NAME) {
29522
+ if (e.code === "Escape" && this.instance.getActiveAction() === IMAGE_TOOL_ACTION_NAME) {
29498
29523
  this.cancelAction();
29499
29524
  return;
29500
29525
  }
@@ -29756,11 +29781,11 @@ var WeaveStarToolAction = class extends WeaveAction {
29756
29781
  setupEvents() {
29757
29782
  const stage = this.instance.getStage();
29758
29783
  window.addEventListener("keydown", (e) => {
29759
- if (e.key === "Enter" && this.instance.getActiveAction() === STAR_TOOL_ACTION_NAME) {
29784
+ if (e.code === "Enter" && this.instance.getActiveAction() === STAR_TOOL_ACTION_NAME) {
29760
29785
  this.cancelAction();
29761
29786
  return;
29762
29787
  }
29763
- if (e.key === "Escape" && this.instance.getActiveAction() === STAR_TOOL_ACTION_NAME) {
29788
+ if (e.code === "Escape" && this.instance.getActiveAction() === STAR_TOOL_ACTION_NAME) {
29764
29789
  this.cancelAction();
29765
29790
  return;
29766
29791
  }
@@ -29978,11 +30003,11 @@ var WeaveArrowToolAction = class extends WeaveAction {
29978
30003
  setupEvents() {
29979
30004
  const stage = this.instance.getStage();
29980
30005
  window.addEventListener("keydown", (e) => {
29981
- if (e.key === "Enter" && this.instance.getActiveAction() === ARROW_TOOL_ACTION_NAME) {
30006
+ if (e.code === "Enter" && this.instance.getActiveAction() === ARROW_TOOL_ACTION_NAME) {
29982
30007
  this.cancelAction();
29983
30008
  return;
29984
30009
  }
29985
- if (e.key === "Escape" && this.instance.getActiveAction() === ARROW_TOOL_ACTION_NAME) {
30010
+ if (e.code === "Escape" && this.instance.getActiveAction() === ARROW_TOOL_ACTION_NAME) {
29986
30011
  this.cancelAction();
29987
30012
  return;
29988
30013
  }
@@ -30229,11 +30254,11 @@ var WeaveRegularPolygonToolAction = class extends WeaveAction {
30229
30254
  setupEvents() {
30230
30255
  const stage = this.instance.getStage();
30231
30256
  window.addEventListener("keydown", (e) => {
30232
- if (e.key === "Enter" && this.instance.getActiveAction() === REGULAR_POLYGON_TOOL_ACTION_NAME) {
30257
+ if (e.code === "Enter" && this.instance.getActiveAction() === REGULAR_POLYGON_TOOL_ACTION_NAME) {
30233
30258
  this.cancelAction();
30234
30259
  return;
30235
30260
  }
30236
- if (e.key === "Escape" && this.instance.getActiveAction() === REGULAR_POLYGON_TOOL_ACTION_NAME) {
30261
+ if (e.code === "Escape" && this.instance.getActiveAction() === REGULAR_POLYGON_TOOL_ACTION_NAME) {
30237
30262
  this.cancelAction();
30238
30263
  return;
30239
30264
  }
@@ -30430,7 +30455,7 @@ var WeaveFrameToolAction = class extends WeaveAction {
30430
30455
  setupEvents() {
30431
30456
  const stage = this.instance.getStage();
30432
30457
  window.addEventListener("keydown", (e) => {
30433
- if (e.key === "Escape" && this.instance.getActiveAction() === FRAME_TOOL_ACTION_NAME) {
30458
+ if (e.code === "Escape" && this.instance.getActiveAction() === FRAME_TOOL_ACTION_NAME) {
30434
30459
  this.cancelAction();
30435
30460
  return;
30436
30461
  }
@@ -30987,11 +31012,11 @@ var WeaveCommentToolAction = class extends WeaveAction {
30987
31012
  window.addEventListener("keydown", (e) => {
30988
31013
  if (this.instance.getActiveAction() !== WEAVE_COMMENT_TOOL_ACTION_NAME) return;
30989
31014
  if (commentNodeHandler?.isCommentViewing()) return;
30990
- if (e.key === "Escape" && this.state == WEAVE_COMMENT_TOOL_STATE.ADDING) {
31015
+ if (e.code === "Escape" && this.state == WEAVE_COMMENT_TOOL_STATE.ADDING) {
30991
31016
  this.cancelAction();
30992
31017
  return;
30993
31018
  }
30994
- if (e.key === "Escape" && this.state === WEAVE_COMMENT_TOOL_STATE.CREATING_COMMENT) this.setState(WEAVE_COMMENT_TOOL_STATE.ADDING);
31019
+ if (e.code === "Escape" && this.state === WEAVE_COMMENT_TOOL_STATE.CREATING_COMMENT) this.setState(WEAVE_COMMENT_TOOL_STATE.ADDING);
30995
31020
  });
30996
31021
  stage.on("pointermove", (e) => {
30997
31022
  if (this.state === WEAVE_COMMENT_TOOL_STATE.IDLE) return;
@@ -31185,7 +31210,7 @@ var WeaveVideoToolAction = class extends WeaveAction {
31185
31210
  setupEvents() {
31186
31211
  const stage = this.instance.getStage();
31187
31212
  window.addEventListener("keydown", (e) => {
31188
- if (e.key === "Escape" && this.instance.getActiveAction() === VIDEO_TOOL_ACTION_NAME) {
31213
+ if (e.code === "Escape" && this.instance.getActiveAction() === VIDEO_TOOL_ACTION_NAME) {
31189
31214
  this.cancelAction();
31190
31215
  return;
31191
31216
  }
@@ -33553,10 +33578,10 @@ var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
33553
33578
  }
33554
33579
  onInit() {
33555
33580
  window.addEventListener("keydown", (e) => {
33556
- if (e.key === "ArrowUp" && e.shiftKey) this.handleNodesMovement("up");
33557
- if (e.key === "ArrowLeft" && e.shiftKey) this.handleNodesMovement("left");
33558
- if (e.key === "ArrowRight" && e.shiftKey) this.handleNodesMovement("right");
33559
- if (e.key === "ArrowDown" && e.shiftKey) this.handleNodesMovement("down");
33581
+ if (e.code === "ArrowUp" && e.shiftKey) this.handleNodesMovement("up");
33582
+ if (e.code === "ArrowLeft" && e.shiftKey) this.handleNodesMovement("left");
33583
+ if (e.code === "ArrowRight" && e.shiftKey) this.handleNodesMovement("right");
33584
+ if (e.code === "ArrowDown" && e.shiftKey) this.handleNodesMovement("down");
33560
33585
  });
33561
33586
  }
33562
33587
  enable() {
package/dist/sdk.d.cts CHANGED
@@ -1478,7 +1478,6 @@ declare class WeaveImageNode extends WeaveNode {
1478
1478
  protected lastTapTime: number;
1479
1479
  protected nodeType: string;
1480
1480
  private imageCrop;
1481
- private cachedCropInfo;
1482
1481
  private imageLoaded;
1483
1482
  constructor(params?: WeaveImageNodeParams);
1484
1483
  triggerCrop(imageNode: Konva.Group): void;
@@ -1496,6 +1495,7 @@ declare class WeaveImageNode extends WeaveNode {
1496
1495
  onError: (error: string | Event) => void;
1497
1496
  }): void;
1498
1497
  private loadImage;
1498
+ updatePlaceholderSize(image: Konva.Group, imagePlaceholder: Konva.Rect): void;
1499
1499
  updateImageCrop(nextProps: WeaveElementAttributes): void;
1500
1500
  getImageSource(imageId: string): HTMLImageElement | undefined;
1501
1501
  scaleReset(node: Konva.Group): void;