@inditextech/weave-sdk 0.76.0 → 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.js CHANGED
@@ -16939,7 +16939,8 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
16939
16939
  const tr = new Konva.Transformer({
16940
16940
  id: "selectionTransformer",
16941
16941
  ...this.config.selection,
16942
- listening: true
16942
+ listening: true,
16943
+ shouldOverdrawWholeArea: true
16943
16944
  });
16944
16945
  selectionLayer?.add(tr);
16945
16946
  const trHover = new Konva.Transformer({
@@ -16986,15 +16987,29 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
16986
16987
  this.enable();
16987
16988
  if (shape) {
16988
16989
  const targetNode = this.instance.getInstanceRecursive(shape);
16990
+ if (targetNode && targetNode !== nodeHovered) {
16991
+ this.instance.getStage().handleMouseover();
16992
+ nodeHovered?.handleMouseout();
16993
+ targetNode?.handleMouseover();
16994
+ nodeHovered = targetNode;
16995
+ }
16989
16996
  targetNode?.handleMouseover();
16990
- if (targetNode) nodeHovered = targetNode;
16991
16997
  }
16992
16998
  });
16999
+ tr.on("mouseover", () => {
17000
+ stage.container().style.cursor = "grab";
17001
+ });
16993
17002
  tr.on("mouseout", () => {
16994
17003
  this.instance.getStage().handleMouseover();
16995
- nodeHovered?.handleMouseout();
16996
17004
  nodeHovered = void 0;
16997
17005
  });
17006
+ window.addEventListener("mouseout", () => {
17007
+ if (nodeHovered) {
17008
+ nodeHovered.handleMouseout();
17009
+ nodeHovered = void 0;
17010
+ }
17011
+ this.instance.getStage().handleMouseover();
17012
+ });
16998
17013
  const handleTransform = (e) => {
16999
17014
  const moved = this.checkMoved(e);
17000
17015
  if (moved) this.getContextMenuPlugin()?.cancelLongPressTimer();
@@ -17327,7 +17342,6 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
17327
17342
  this.selecting = false;
17328
17343
  this.stopPanLoop();
17329
17344
  this.hideSelectorArea();
17330
- this.handleClickOrTap(e);
17331
17345
  return;
17332
17346
  }
17333
17347
  const isStage = e.target instanceof Konva.Stage;
@@ -17430,6 +17444,14 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
17430
17444
  return;
17431
17445
  }
17432
17446
  if (contextMenuPlugin?.isContextMenuVisible()) this.stopPanLoop();
17447
+ const selectedGroup = getTargetedNode(this.instance);
17448
+ if (!moved && selectedGroup?.getParent() instanceof Konva.Transformer) {
17449
+ this.selecting = false;
17450
+ this.stopPanLoop();
17451
+ this.hideSelectorArea();
17452
+ this.handleClickOrTap(e);
17453
+ return;
17454
+ }
17433
17455
  if (!this.selectionRectangle.visible()) {
17434
17456
  this.hideSelectorArea();
17435
17457
  return;
@@ -17781,12 +17803,12 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
17781
17803
  this.createPasteCatcher();
17782
17804
  const catcher = this.getCatcherElement();
17783
17805
  window.addEventListener("keydown", async (e) => {
17784
- if (stage.isFocused() && e.key === "c" && (e.ctrlKey || e.metaKey)) {
17806
+ if (stage.isFocused() && e.code === "KeyC" && (e.ctrlKey || e.metaKey)) {
17785
17807
  e.preventDefault();
17786
17808
  await this.performCopy();
17787
17809
  return;
17788
17810
  }
17789
- if (stage.isFocused() && e.key === "v" && (e.ctrlKey || e.metaKey)) {
17811
+ if (stage.isFocused() && e.code === "KeyV" && (e.ctrlKey || e.metaKey)) {
17790
17812
  this.focusPasteCatcher();
17791
17813
  if (!this.enabled) return;
17792
17814
  }
@@ -18359,6 +18381,9 @@ var WeaveNode = class {
18359
18381
  node.handleMouseover = () => {
18360
18382
  this.handleMouseOver(node);
18361
18383
  };
18384
+ node.handleMouseout = () => {
18385
+ this.handleMouseout(node);
18386
+ };
18362
18387
  node.on("pointerover", (e) => {
18363
18388
  const doCancelBubble = this.handleMouseOver(e.target);
18364
18389
  if (doCancelBubble) e.cancelBubble = true;
@@ -18373,34 +18398,39 @@ var WeaveNode = class {
18373
18398
  const isTargetable = node.getAttrs().isTargetable !== false;
18374
18399
  const isLocked = node.getAttrs().locked ?? false;
18375
18400
  if ([MOVE_TOOL_ACTION_NAME].includes(activeAction ?? "")) return false;
18401
+ let showHover = false;
18376
18402
  let cancelBubble = false;
18377
- if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(node) && !this.isPasting() && isLocked) {
18403
+ if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(realNode) && !this.isPasting() && isLocked) {
18378
18404
  const stage$1 = this.instance.getStage();
18379
18405
  stage$1.container().style.cursor = "default";
18380
18406
  cancelBubble = true;
18381
18407
  }
18382
- if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(node) && !this.isPasting() && isTargetable && !isLocked && stage.mode() === WEAVE_STAGE_DEFAULT_MODE) {
18408
+ if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(realNode) && !this.isPasting() && isTargetable && !isLocked && stage.mode() === WEAVE_STAGE_DEFAULT_MODE) {
18383
18409
  const stage$1 = this.instance.getStage();
18384
- this.setHoverState(realNode);
18410
+ showHover = true;
18385
18411
  stage$1.container().style.cursor = "pointer";
18386
18412
  cancelBubble = true;
18387
18413
  }
18388
- if (isNodeSelectionEnabled && this.isSelecting() && this.isNodeSelected(node) && !this.isPasting() && isTargetable && !isLocked && stage.mode() === WEAVE_STAGE_DEFAULT_MODE) {
18414
+ if (isNodeSelectionEnabled && this.isSelecting() && this.isNodeSelected(realNode) && !this.isPasting() && isTargetable && !isLocked && stage.mode() === WEAVE_STAGE_DEFAULT_MODE) {
18389
18415
  const stage$1 = this.instance.getStage();
18416
+ showHover = true;
18390
18417
  stage$1.container().style.cursor = "grab";
18391
18418
  cancelBubble = true;
18392
18419
  }
18393
- if (!isTargetable) {
18394
- this.hideHoverState();
18395
- cancelBubble = true;
18396
- }
18420
+ if (!isTargetable) cancelBubble = true;
18397
18421
  if (this.isPasting()) {
18398
18422
  const stage$1 = this.instance.getStage();
18399
18423
  stage$1.container().style.cursor = "crosshair";
18400
18424
  cancelBubble = true;
18401
18425
  }
18426
+ if (showHover) this.setHoverState(realNode);
18427
+ else this.hideHoverState();
18402
18428
  return cancelBubble;
18403
18429
  }
18430
+ handleMouseout(node) {
18431
+ const realNode = this.instance.getInstanceRecursive(node);
18432
+ if (realNode) this.hideHoverState();
18433
+ }
18404
18434
  create(key, props) {
18405
18435
  return {
18406
18436
  key,
@@ -19964,7 +19994,7 @@ var WeaveRegisterManager = class {
19964
19994
 
19965
19995
  //#endregion
19966
19996
  //#region package.json
19967
- var version = "0.76.0";
19997
+ var version = "0.76.2";
19968
19998
 
19969
19999
  //#endregion
19970
20000
  //#region src/managers/setup.ts
@@ -20280,6 +20310,17 @@ var WeaveExportManager = class {
20280
20310
  }
20281
20311
  });
20282
20312
  }
20313
+ unpremultiply(data) {
20314
+ for (let i = 0; i < data.length; i += 4) {
20315
+ const a = data[i + 3];
20316
+ if (a && a < 255) {
20317
+ const alpha = a / 255;
20318
+ data[i] = Math.min(255, Math.round(data[i] / alpha));
20319
+ data[i + 1] = Math.min(255, Math.round(data[i + 1] / alpha));
20320
+ data[i + 2] = Math.min(255, Math.round(data[i + 2] / alpha));
20321
+ }
20322
+ }
20323
+ }
20283
20324
  async exportNodesAsBuffer(nodes, boundingNodes, options) {
20284
20325
  const { format: format$2 = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
20285
20326
  this.getNodesSelectionPlugin()?.disable();
@@ -20338,7 +20379,6 @@ var WeaveExportManager = class {
20338
20379
  }
20339
20380
  mainLayer.add(exportGroup);
20340
20381
  const backgroundRect = background.getClientRect();
20341
- stage.batchDraw();
20342
20382
  const composites = [];
20343
20383
  const imageWidth = Math.round(backgroundRect.width);
20344
20384
  const imageHeight = Math.round(backgroundRect.height);
@@ -21444,7 +21484,7 @@ var WeaveTextNode = class extends WeaveNode {
21444
21484
  this.instance.emitEvent("onTransform", null);
21445
21485
  });
21446
21486
  if (!this.instance.getConfiguration().serverSide) window.addEventListener("keypress", (e) => {
21447
- if (e.key === "Enter" && this.instance.getActiveAction() === SELECTION_TOOL_ACTION_NAME && !this.editing && e.target !== this.textArea) {
21487
+ if (e.code === "Enter" && this.instance.getActiveAction() === SELECTION_TOOL_ACTION_NAME && !this.editing && e.target !== this.textArea) {
21448
21488
  e.preventDefault();
21449
21489
  if (this.isSelecting() && this.isNodeSelected(text)) {
21450
21490
  const nodesSelectionPlugin = this.instance.getPlugin("nodesSelection");
@@ -21715,7 +21755,7 @@ var WeaveTextNode = class extends WeaveNode {
21715
21755
  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));
21716
21756
  };
21717
21757
  const handleKeyDown = (e) => {
21718
- if (this.textArea && textNode && e.key === "Escape") {
21758
+ if (this.textArea && textNode && e.code === "Escape") {
21719
21759
  e.stopPropagation();
21720
21760
  updateTextNodeSize();
21721
21761
  textNode.text(this.textArea.value);
@@ -22027,7 +22067,7 @@ var WeaveImageCrop = class WeaveImageCrop {
22027
22067
  if (!["Enter", "Escape"].includes(e.key)) return;
22028
22068
  this.cropping = false;
22029
22069
  this.image.setAttrs({ cropping: false });
22030
- if (e.key === "Enter") this.handleClipEnd();
22070
+ if (e.code === "Enter") this.handleClipEnd();
22031
22071
  const stage = this.instance.getStage();
22032
22072
  this.onClose();
22033
22073
  const utilityLayer = this.instance.getUtilityLayer();
@@ -22219,7 +22259,6 @@ var WeaveImageNode = class extends WeaveNode {
22219
22259
  this.lastTapTime = 0;
22220
22260
  this.config = mergeExceptArrays(WEAVE_IMAGE_DEFAULT_CONFIG, config);
22221
22261
  this.imageCrop = null;
22222
- this.cachedCropInfo = {};
22223
22262
  this.imageLoaded = false;
22224
22263
  }
22225
22264
  triggerCrop(imageNode) {
@@ -22258,7 +22297,6 @@ var WeaveImageNode = class extends WeaveNode {
22258
22297
  if (!internalImage || !cropGroup) return;
22259
22298
  const imageCrop = new WeaveImageCrop(this.instance, this, imageNode, internalImage, cropGroup);
22260
22299
  imageCrop.unCrop();
22261
- this.cachedCropInfo[imageNode.getAttrs().id ?? ""] = void 0;
22262
22300
  };
22263
22301
  loadAsyncElement(nodeId) {
22264
22302
  this.instance.loadAsyncElement(nodeId, "image");
@@ -22289,7 +22327,6 @@ var WeaveImageNode = class extends WeaveNode {
22289
22327
  const stage = this.instance.getStage();
22290
22328
  const image$1 = stage.findOne(`#${id}`);
22291
22329
  if (!image$1) return;
22292
- this.cachedCropInfo[image$1.getAttrs().id ?? ""] = void 0;
22293
22330
  };
22294
22331
  image.triggerCrop = () => {
22295
22332
  this.triggerCrop(image);
@@ -22303,7 +22340,6 @@ var WeaveImageNode = class extends WeaveNode {
22303
22340
  if (!image$1) return;
22304
22341
  const imageCrop = new WeaveImageCrop(this.instance, this, image$1, internalImage, cropGroup);
22305
22342
  imageCrop.unCrop();
22306
- this.cachedCropInfo[image$1.getAttrs().id ?? ""] = void 0;
22307
22343
  };
22308
22344
  const defaultTransformerProperties = this.defaultGetTransformerProperties(this.config.transform);
22309
22345
  image.getTransformerProperties = function() {
@@ -22366,31 +22402,30 @@ var WeaveImageNode = class extends WeaveNode {
22366
22402
  this.config.onDblClick?.(this, image);
22367
22403
  };
22368
22404
  if (this.imageSource[id]) {
22369
- imagePlaceholder?.setAttrs({
22370
- width: imageProps.width ? imageProps.width : this.imageSource[id].width,
22371
- height: imageProps.height ? imageProps.height : this.imageSource[id].height,
22372
- visible: false
22373
- });
22374
- internalImage?.setAttrs({
22375
- width: imageProps.width ? imageProps.width : this.imageSource[id].width,
22376
- height: imageProps.height ? imageProps.height : this.imageSource[id].height,
22405
+ imagePlaceholder.destroy();
22406
+ internalImage.setAttrs({
22407
+ width: this.imageSource[id].width,
22408
+ height: this.imageSource[id].height,
22377
22409
  image: this.imageSource[id],
22378
22410
  visible: true
22379
22411
  });
22380
22412
  this.imageLoaded = true;
22381
- image.setAttr("width", image.width() ? image.width() : this.imageSource[id].width);
22382
- image.setAttr("height", image.height() ? image.height() : this.imageSource[id].height);
22383
- image.setAttr("cropInfo", void 0);
22384
- image.setAttr("uncroppedImage", {
22385
- width: image.width() ? image.width() : this.imageSource[id].width,
22386
- height: image.height() ? image.height() : this.imageSource[id].height
22413
+ image.setAttr("width", this.imageSource[id].width);
22414
+ image.setAttr("height", this.imageSource[id].height);
22415
+ image.setAttr("cropInfo", props.cropInfo ?? void 0);
22416
+ image.setAttr("uncroppedImage", props.uncroppedImage ?? {
22417
+ width: this.imageSource[id].width,
22418
+ height: this.imageSource[id].height
22387
22419
  });
22388
22420
  image.setAttr("imageInfo", {
22389
22421
  width: this.imageSource[id].width,
22390
22422
  height: this.imageSource[id].height
22391
22423
  });
22392
22424
  this.instance.updateNode(this.serialize(image));
22393
- } else this.loadImage(imageProps, image);
22425
+ } else {
22426
+ this.updatePlaceholderSize(image, imagePlaceholder);
22427
+ this.loadImage(imageProps, image);
22428
+ }
22394
22429
  image.setAttr("imageURL", imageProps.imageURL);
22395
22430
  return image;
22396
22431
  }
@@ -22550,12 +22585,25 @@ var WeaveImageNode = class extends WeaveNode {
22550
22585
  }
22551
22586
  });
22552
22587
  }
22588
+ updatePlaceholderSize(image, imagePlaceholder) {
22589
+ const imageAttrs = image.getAttrs();
22590
+ if (!imageAttrs.adding && imageAttrs.cropInfo) {
22591
+ const actualScale = imageAttrs.uncroppedImage.width / imageAttrs.imageInfo.width;
22592
+ const cropScale = imageAttrs.cropInfo ? imageAttrs.cropInfo.scaleX : actualScale;
22593
+ imagePlaceholder.width(imageAttrs.cropSize.width * (actualScale / cropScale));
22594
+ imagePlaceholder.height(imageAttrs.cropSize.height * (actualScale / cropScale));
22595
+ }
22596
+ if (!imageAttrs.adding && !imageAttrs.cropInfo) {
22597
+ imagePlaceholder.width(imageAttrs.uncroppedImage.width);
22598
+ imagePlaceholder.height(imageAttrs.uncroppedImage.height);
22599
+ }
22600
+ }
22553
22601
  updateImageCrop(nextProps) {
22554
22602
  const imageAttrs = nextProps;
22555
22603
  const stage = this.instance.getStage();
22556
22604
  const image = stage.findOne(`#${imageAttrs.id}`);
22557
22605
  const internalImage = image?.findOne(`#${imageAttrs.id}-image`);
22558
- if (image && internalImage && !imageAttrs.adding && imageAttrs.cropInfo && !(0, import_lodash.isEqual)(imageAttrs.cropInfo, this.cachedCropInfo[imageAttrs.id ?? ""])) {
22606
+ if (image && internalImage && !imageAttrs.adding && imageAttrs.cropInfo) {
22559
22607
  const actualScale = imageAttrs.uncroppedImage.width / imageAttrs.imageInfo.width;
22560
22608
  const cropScale = imageAttrs.cropInfo ? imageAttrs.cropInfo.scaleX : actualScale;
22561
22609
  internalImage.width(imageAttrs.uncroppedImage.width);
@@ -22571,9 +22619,8 @@ var WeaveImageNode = class extends WeaveNode {
22571
22619
  });
22572
22620
  internalImage.width(imageAttrs.cropSize.width * (actualScale / cropScale));
22573
22621
  internalImage.height(imageAttrs.cropSize.height * (actualScale / cropScale));
22574
- this.cachedCropInfo[imageAttrs.id ?? ""] = imageAttrs.cropInfo;
22575
22622
  }
22576
- if (image && internalImage && !imageAttrs.adding && !imageAttrs.cropInfo && !(0, import_lodash.isEqual)(imageAttrs.cropInfo, this.cachedCropInfo[imageAttrs.id ?? ""])) {
22623
+ if (image && internalImage && !imageAttrs.adding && !imageAttrs.cropInfo) {
22577
22624
  internalImage.width(imageAttrs.uncroppedImage.width);
22578
22625
  internalImage.height(imageAttrs.uncroppedImage.height);
22579
22626
  internalImage.rotation(0);
@@ -22582,7 +22629,6 @@ var WeaveImageNode = class extends WeaveNode {
22582
22629
  internalImage.crop(void 0);
22583
22630
  internalImage.width(imageAttrs.uncroppedImage.width);
22584
22631
  internalImage.height(imageAttrs.uncroppedImage.height);
22585
- this.cachedCropInfo[imageAttrs.id ?? ""] = void 0;
22586
22632
  }
22587
22633
  }
22588
22634
  getImageSource(imageId) {
@@ -23115,7 +23161,7 @@ var WeaveFrameNode = class extends WeaveNode {
23115
23161
  });
23116
23162
  }
23117
23163
  const nodesSelectionPlugin = this.instance.getPlugin("nodesSelection");
23118
- if (nodesSelectionPlugin) nodesSelectionPlugin.getTransformer().forceUpdate();
23164
+ if (nodesSelectionPlugin) nodesSelectionPlugin.getTransformer()?.forceUpdate();
23119
23165
  }
23120
23166
  serialize(instance) {
23121
23167
  const stage = this.instance.getStage();
@@ -24433,12 +24479,6 @@ var WeaveVideoNode = class extends WeaveNode {
24433
24479
  videoProgress?.hide();
24434
24480
  }
24435
24481
  };
24436
- videoGroup.on("mouseover", () => {
24437
- videoGroup.handleMouseover();
24438
- });
24439
- videoGroup.on("mouseout", () => {
24440
- videoGroup.handleMouseout();
24441
- });
24442
24482
  videoGroup.dblClick = () => {
24443
24483
  if (this.config.style.playPauseOnDblClick && this.videoState[id].loaded && !this.videoState[id].playing) {
24444
24484
  this.play(id);
@@ -25232,7 +25272,7 @@ var WeaveMoveToolAction = class extends WeaveAction {
25232
25272
  setupEvents() {
25233
25273
  const stage = this.instance.getStage();
25234
25274
  window.addEventListener("keydown", (e) => {
25235
- if (e.key === "Escape" && this.instance.getActiveAction() === MOVE_TOOL_ACTION_NAME) {
25275
+ if (e.code === "Escape" && this.instance.getActiveAction() === MOVE_TOOL_ACTION_NAME) {
25236
25276
  this.cancelAction();
25237
25277
  return;
25238
25278
  }
@@ -25387,7 +25427,7 @@ var WeaveEraserToolAction = class extends WeaveAction {
25387
25427
  }
25388
25428
  });
25389
25429
  window.addEventListener("keydown", (e) => {
25390
- if (e.key === "Escape" && this.instance.getActiveAction() === ERASER_TOOL_ACTION_NAME) {
25430
+ if (e.code === "Escape" && this.instance.getActiveAction() === ERASER_TOOL_ACTION_NAME) {
25391
25431
  this.cancelAction();
25392
25432
  return;
25393
25433
  }
@@ -25485,11 +25525,11 @@ var WeaveRectangleToolAction = class extends WeaveAction {
25485
25525
  setupEvents() {
25486
25526
  const stage = this.instance.getStage();
25487
25527
  window.addEventListener("keydown", (e) => {
25488
- if (e.key === "Enter" && this.instance.getActiveAction() === RECTANGLE_TOOL_ACTION_NAME) {
25528
+ if (e.code === "Enter" && this.instance.getActiveAction() === RECTANGLE_TOOL_ACTION_NAME) {
25489
25529
  this.cancelAction();
25490
25530
  return;
25491
25531
  }
25492
- if (e.key === "Escape" && this.instance.getActiveAction() === RECTANGLE_TOOL_ACTION_NAME) {
25532
+ if (e.code === "Escape" && this.instance.getActiveAction() === RECTANGLE_TOOL_ACTION_NAME) {
25493
25533
  this.cancelAction();
25494
25534
  return;
25495
25535
  }
@@ -25694,11 +25734,11 @@ var WeaveEllipseToolAction = class extends WeaveAction {
25694
25734
  setupEvents() {
25695
25735
  const stage = this.instance.getStage();
25696
25736
  window.addEventListener("keydown", (e) => {
25697
- if (e.key === "Enter" && this.instance.getActiveAction() === ELLIPSE_TOOL_ACTION_NAME) {
25737
+ if (e.code === "Enter" && this.instance.getActiveAction() === ELLIPSE_TOOL_ACTION_NAME) {
25698
25738
  this.cancelAction();
25699
25739
  return;
25700
25740
  }
25701
- if (e.key === "Escape" && this.instance.getActiveAction() === ELLIPSE_TOOL_ACTION_NAME) {
25741
+ if (e.code === "Escape" && this.instance.getActiveAction() === ELLIPSE_TOOL_ACTION_NAME) {
25702
25742
  this.cancelAction();
25703
25743
  return;
25704
25744
  }
@@ -25910,11 +25950,11 @@ var WeavePenToolAction = class extends WeaveAction {
25910
25950
  setupEvents() {
25911
25951
  const stage = this.instance.getStage();
25912
25952
  window.addEventListener("keydown", (e) => {
25913
- if (e.key === "Enter" && this.instance.getActiveAction() === PEN_TOOL_ACTION_NAME) {
25953
+ if (e.code === "Enter" && this.instance.getActiveAction() === PEN_TOOL_ACTION_NAME) {
25914
25954
  this.cancelAction();
25915
25955
  return;
25916
25956
  }
25917
- if (e.key === "Escape" && this.instance.getActiveAction() === PEN_TOOL_ACTION_NAME) {
25957
+ if (e.code === "Escape" && this.instance.getActiveAction() === PEN_TOOL_ACTION_NAME) {
25918
25958
  this.cancelAction();
25919
25959
  return;
25920
25960
  }
@@ -26162,11 +26202,11 @@ var WeaveBrushToolAction = class extends WeaveAction {
26162
26202
  setupEvents() {
26163
26203
  const stage = this.instance.getStage();
26164
26204
  window.addEventListener("keydown", (e) => {
26165
- if (e.key === "Enter" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) {
26205
+ if (e.code === "Enter" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) {
26166
26206
  this.cancelAction();
26167
26207
  return;
26168
26208
  }
26169
- if (e.key === "Escape" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) {
26209
+ if (e.code === "Escape" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) {
26170
26210
  this.cancelAction();
26171
26211
  return;
26172
26212
  }
@@ -26391,7 +26431,7 @@ var WeaveTextToolAction = class extends WeaveAction {
26391
26431
  setupEvents() {
26392
26432
  const stage = this.instance.getStage();
26393
26433
  window.addEventListener("keydown", (e) => {
26394
- if (e.key === "Escape" && this.instance.getActiveAction() === TEXT_TOOL_ACTION_NAME) {
26434
+ if (e.code === "Escape" && this.instance.getActiveAction() === TEXT_TOOL_ACTION_NAME) {
26395
26435
  this.cancelAction();
26396
26436
  return;
26397
26437
  }
@@ -26543,7 +26583,7 @@ var WeaveImageToolAction = class extends WeaveAction {
26543
26583
  setupEvents() {
26544
26584
  const stage = this.instance.getStage();
26545
26585
  window.addEventListener("keydown", (e) => {
26546
- if (e.key === "Escape" && this.instance.getActiveAction() === IMAGE_TOOL_ACTION_NAME) {
26586
+ if (e.code === "Escape" && this.instance.getActiveAction() === IMAGE_TOOL_ACTION_NAME) {
26547
26587
  this.cancelAction();
26548
26588
  return;
26549
26589
  }
@@ -26805,11 +26845,11 @@ var WeaveStarToolAction = class extends WeaveAction {
26805
26845
  setupEvents() {
26806
26846
  const stage = this.instance.getStage();
26807
26847
  window.addEventListener("keydown", (e) => {
26808
- if (e.key === "Enter" && this.instance.getActiveAction() === STAR_TOOL_ACTION_NAME) {
26848
+ if (e.code === "Enter" && this.instance.getActiveAction() === STAR_TOOL_ACTION_NAME) {
26809
26849
  this.cancelAction();
26810
26850
  return;
26811
26851
  }
26812
- if (e.key === "Escape" && this.instance.getActiveAction() === STAR_TOOL_ACTION_NAME) {
26852
+ if (e.code === "Escape" && this.instance.getActiveAction() === STAR_TOOL_ACTION_NAME) {
26813
26853
  this.cancelAction();
26814
26854
  return;
26815
26855
  }
@@ -27027,11 +27067,11 @@ var WeaveArrowToolAction = class extends WeaveAction {
27027
27067
  setupEvents() {
27028
27068
  const stage = this.instance.getStage();
27029
27069
  window.addEventListener("keydown", (e) => {
27030
- if (e.key === "Enter" && this.instance.getActiveAction() === ARROW_TOOL_ACTION_NAME) {
27070
+ if (e.code === "Enter" && this.instance.getActiveAction() === ARROW_TOOL_ACTION_NAME) {
27031
27071
  this.cancelAction();
27032
27072
  return;
27033
27073
  }
27034
- if (e.key === "Escape" && this.instance.getActiveAction() === ARROW_TOOL_ACTION_NAME) {
27074
+ if (e.code === "Escape" && this.instance.getActiveAction() === ARROW_TOOL_ACTION_NAME) {
27035
27075
  this.cancelAction();
27036
27076
  return;
27037
27077
  }
@@ -27278,11 +27318,11 @@ var WeaveRegularPolygonToolAction = class extends WeaveAction {
27278
27318
  setupEvents() {
27279
27319
  const stage = this.instance.getStage();
27280
27320
  window.addEventListener("keydown", (e) => {
27281
- if (e.key === "Enter" && this.instance.getActiveAction() === REGULAR_POLYGON_TOOL_ACTION_NAME) {
27321
+ if (e.code === "Enter" && this.instance.getActiveAction() === REGULAR_POLYGON_TOOL_ACTION_NAME) {
27282
27322
  this.cancelAction();
27283
27323
  return;
27284
27324
  }
27285
- if (e.key === "Escape" && this.instance.getActiveAction() === REGULAR_POLYGON_TOOL_ACTION_NAME) {
27325
+ if (e.code === "Escape" && this.instance.getActiveAction() === REGULAR_POLYGON_TOOL_ACTION_NAME) {
27286
27326
  this.cancelAction();
27287
27327
  return;
27288
27328
  }
@@ -27479,7 +27519,7 @@ var WeaveFrameToolAction = class extends WeaveAction {
27479
27519
  setupEvents() {
27480
27520
  const stage = this.instance.getStage();
27481
27521
  window.addEventListener("keydown", (e) => {
27482
- if (e.key === "Escape" && this.instance.getActiveAction() === FRAME_TOOL_ACTION_NAME) {
27522
+ if (e.code === "Escape" && this.instance.getActiveAction() === FRAME_TOOL_ACTION_NAME) {
27483
27523
  this.cancelAction();
27484
27524
  return;
27485
27525
  }
@@ -28036,11 +28076,11 @@ var WeaveCommentToolAction = class extends WeaveAction {
28036
28076
  window.addEventListener("keydown", (e) => {
28037
28077
  if (this.instance.getActiveAction() !== WEAVE_COMMENT_TOOL_ACTION_NAME) return;
28038
28078
  if (commentNodeHandler?.isCommentViewing()) return;
28039
- if (e.key === "Escape" && this.state == WEAVE_COMMENT_TOOL_STATE.ADDING) {
28079
+ if (e.code === "Escape" && this.state == WEAVE_COMMENT_TOOL_STATE.ADDING) {
28040
28080
  this.cancelAction();
28041
28081
  return;
28042
28082
  }
28043
- if (e.key === "Escape" && this.state === WEAVE_COMMENT_TOOL_STATE.CREATING_COMMENT) this.setState(WEAVE_COMMENT_TOOL_STATE.ADDING);
28083
+ if (e.code === "Escape" && this.state === WEAVE_COMMENT_TOOL_STATE.CREATING_COMMENT) this.setState(WEAVE_COMMENT_TOOL_STATE.ADDING);
28044
28084
  });
28045
28085
  stage.on("pointermove", (e) => {
28046
28086
  if (this.state === WEAVE_COMMENT_TOOL_STATE.IDLE) return;
@@ -28234,7 +28274,7 @@ var WeaveVideoToolAction = class extends WeaveAction {
28234
28274
  setupEvents() {
28235
28275
  const stage = this.instance.getStage();
28236
28276
  window.addEventListener("keydown", (e) => {
28237
- if (e.key === "Escape" && this.instance.getActiveAction() === VIDEO_TOOL_ACTION_NAME) {
28277
+ if (e.code === "Escape" && this.instance.getActiveAction() === VIDEO_TOOL_ACTION_NAME) {
28238
28278
  this.cancelAction();
28239
28279
  return;
28240
28280
  }
@@ -30602,10 +30642,10 @@ var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
30602
30642
  }
30603
30643
  onInit() {
30604
30644
  window.addEventListener("keydown", (e) => {
30605
- if (e.key === "ArrowUp" && e.shiftKey) this.handleNodesMovement("up");
30606
- if (e.key === "ArrowLeft" && e.shiftKey) this.handleNodesMovement("left");
30607
- if (e.key === "ArrowRight" && e.shiftKey) this.handleNodesMovement("right");
30608
- if (e.key === "ArrowDown" && e.shiftKey) this.handleNodesMovement("down");
30645
+ if (e.code === "ArrowUp" && e.shiftKey) this.handleNodesMovement("up");
30646
+ if (e.code === "ArrowLeft" && e.shiftKey) this.handleNodesMovement("left");
30647
+ if (e.code === "ArrowRight" && e.shiftKey) this.handleNodesMovement("right");
30648
+ if (e.code === "ArrowDown" && e.shiftKey) this.handleNodesMovement("down");
30609
30649
  });
30610
30650
  }
30611
30651
  enable() {