@inditextech/weave-sdk 3.4.0-SNAPSHOT.38.1 → 3.4.0-SNAPSHOT.85.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
@@ -18625,7 +18625,10 @@ const DEFAULT_ADD_NODE_OPTIONS = { emitUserChangeEvent: false };
18625
18625
  const DEFAULT_UPDATE_NODE_OPTIONS = { emitUserChangeEvent: false };
18626
18626
  const DEFAULT_REMOVE_NODE_OPTIONS = { emitUserChangeEvent: false };
18627
18627
  const DEFAULT_MOVE_NODE_OPTIONS = { emitUserChangeEvent: false };
18628
- const WEAVE_DEFAULT_CONFIG = { behaviors: { axisLockThreshold: 5 } };
18628
+ const WEAVE_DEFAULT_CONFIG = {
18629
+ behaviors: { axisLockThreshold: 5 },
18630
+ performance: { upscale: { enabled: false } }
18631
+ };
18629
18632
 
18630
18633
  //#endregion
18631
18634
  //#region src/plugins/users-presence/constants.ts
@@ -18820,7 +18823,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
18820
18823
  nodeHovered = void 0;
18821
18824
  }
18822
18825
  this.instance.getStage().handleMouseover?.();
18823
- });
18826
+ }, { signal: this.instance.getEventsController()?.signal });
18824
18827
  const handleTransform = (e) => {
18825
18828
  const moved = this.checkMoved(e);
18826
18829
  if (moved) this.getContextMenuPlugin()?.cancelLongPressTimer();
@@ -19235,11 +19238,11 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
19235
19238
  });
19236
19239
  return;
19237
19240
  }
19238
- });
19241
+ }, { signal: this.instance.getEventsController()?.signal });
19239
19242
  stage.container().addEventListener("keyup", (e) => {
19240
19243
  if (!(e.ctrlKey || e.metaKey)) this.isCtrlMetaPressed = false;
19241
19244
  if (e.code === "Space") this.isSpaceKeyPressed = false;
19242
- });
19245
+ }, { signal: this.instance.getEventsController()?.signal });
19243
19246
  stage.on("pointerdown", (e) => {
19244
19247
  this.setTapStart(e);
19245
19248
  this.handledClickOrTap = false;
@@ -19807,7 +19810,7 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
19807
19810
  this.focusPasteCatcher();
19808
19811
  if (!this.enabled) return;
19809
19812
  }
19810
- });
19813
+ }, { signal: this.instance.getEventsController()?.signal });
19811
19814
  if (catcher) catcher.addEventListener("paste", async (e) => {
19812
19815
  e.preventDefault();
19813
19816
  let items = void 0;
@@ -19826,7 +19829,7 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
19826
19829
  return;
19827
19830
  }
19828
19831
  this.sendExternalPasteEvent(void 0, items);
19829
- });
19832
+ }, { signal: this.instance.getEventsController()?.signal });
19830
19833
  }
19831
19834
  sendExternalPasteEvent(dataList, items) {
19832
19835
  const stage = this.instance.getStage();
@@ -22008,7 +22011,7 @@ var WeaveRegisterManager = class {
22008
22011
 
22009
22012
  //#endregion
22010
22013
  //#region package.json
22011
- var version = "3.4.0-SNAPSHOT.38.1";
22014
+ var version = "3.4.0-SNAPSHOT.85.1";
22012
22015
 
22013
22016
  //#endregion
22014
22017
  //#region src/managers/setup.ts
@@ -22125,9 +22128,11 @@ var WeaveStageManager = class {
22125
22128
  initialZIndex: void 0
22126
22129
  };
22127
22130
  const stage = new Konva.Stage({ ...props });
22128
- const containerParent = stage.container().parentNode;
22129
- stage.width(containerParent.clientWidth);
22130
- stage.height(containerParent.clientHeight);
22131
+ if (!this.instance.isServerSide()) {
22132
+ const containerParent = stage.container().parentNode;
22133
+ stage.width(containerParent.clientWidth);
22134
+ stage.height(containerParent.clientHeight);
22135
+ }
22131
22136
  const realContainer = stage.container();
22132
22137
  if (realContainer !== void 0 && realContainer.style?.position !== "relative") realContainer.style.position = "relative";
22133
22138
  this.setStage(stage);
@@ -22476,7 +22481,7 @@ var WeaveExportManager = class {
22476
22481
  });
22477
22482
  mainLayer.add(background);
22478
22483
  background.moveToBottom();
22479
- const backgroundRect = background.getClientRect();
22484
+ const backgroundRect = background.getClientRect({ relativeTo: stage });
22480
22485
  const composites = [];
22481
22486
  const imageWidth = Math.round(backgroundRect.width);
22482
22487
  const imageHeight = Math.round(backgroundRect.height);
@@ -23000,6 +23005,7 @@ var Weave = class {
23000
23005
  constructor(weaveConfig, stageConfig) {
23001
23006
  globalThis._weave_isServerSide = false;
23002
23007
  if (typeof window === "undefined") globalThis._weave_isServerSide = true;
23008
+ this.eventsController = void 0;
23003
23009
  this.emitter = new Emittery();
23004
23010
  Konva.showWarnings = false;
23005
23011
  this.id = v4_default();
@@ -23045,6 +23051,7 @@ var Weave = class {
23045
23051
  this.initialized = true;
23046
23052
  this.status = WEAVE_INSTANCE_STATUS.RUNNING;
23047
23053
  this.emitEvent("onInstanceStatus", this.status);
23054
+ this.emitEvent("onRender");
23048
23055
  });
23049
23056
  }
23050
23057
  setStatus(status) {
@@ -23069,6 +23076,7 @@ var Weave = class {
23069
23076
  async start() {
23070
23077
  this.moduleLogger.info("Start instance");
23071
23078
  if (!this.isServerSide()) {
23079
+ this.eventsController = new AbortController();
23072
23080
  if (!window.weave) window.weave = this;
23073
23081
  }
23074
23082
  this.emitEvent("onRoomLoaded", false);
@@ -23101,6 +23109,8 @@ var Weave = class {
23101
23109
  }
23102
23110
  const stage = this.getStage();
23103
23111
  if (stage) stage.destroy();
23112
+ if (this.eventsController) this.eventsController.abort();
23113
+ if (!this.isServerSide()) this.eventsController = new AbortController();
23104
23114
  this.registerManager.reset();
23105
23115
  this.asyncManager.reset();
23106
23116
  this.moduleLogger.info("Switching room instance");
@@ -23122,6 +23132,7 @@ var Weave = class {
23122
23132
  }
23123
23133
  destroy() {
23124
23134
  this.moduleLogger.info(`Destroying the instance`);
23135
+ if (this.eventsController) this.eventsController.abort();
23125
23136
  this.emitter.clearListeners();
23126
23137
  this.status = WEAVE_INSTANCE_STATUS.IDLE;
23127
23138
  this.emitEvent("onInstanceStatus", this.status);
@@ -23759,6 +23770,9 @@ var Weave = class {
23759
23770
  getDragProperties() {
23760
23771
  return this.dragAndDropManager.getDragProperties();
23761
23772
  }
23773
+ getEventsController() {
23774
+ return this.eventsController;
23775
+ }
23762
23776
  };
23763
23777
 
23764
23778
  //#endregion
@@ -23850,6 +23864,7 @@ const downscaleImageFromURL = (url, options) => {
23850
23864
  //#endregion
23851
23865
  //#region src/internal-utils/upscale.ts
23852
23866
  const setupUpscaleStage = (instance, stage) => {
23867
+ if (instance.isServerSide()) return;
23853
23868
  const config = instance.getConfiguration();
23854
23869
  const doUpscale = config.performance?.upscale?.enabled ?? false;
23855
23870
  if (doUpscale) {
@@ -23918,10 +23933,10 @@ var WeaveStageNode = class extends WeaveNode {
23918
23933
  container.setAttribute("tabindex", "0");
23919
23934
  stage.container().addEventListener("focus", () => {
23920
23935
  this.stageFocused = true;
23921
- });
23936
+ }, { signal: this.instance.getEventsController()?.signal });
23922
23937
  stage.container().addEventListener("blur", () => {
23923
23938
  this.stageFocused = false;
23924
- });
23939
+ }, { signal: this.instance.getEventsController()?.signal });
23925
23940
  }
23926
23941
  Konva.Stage.prototype.mode = function(mode) {
23927
23942
  if (typeof mode !== "undefined") this._mode = mode;
@@ -23991,7 +24006,7 @@ var WeaveStageNode = class extends WeaveNode {
23991
24006
  const selectedNode = transformer.nodes()[0];
23992
24007
  selectedNode.fire("onCmdCtrlPressed");
23993
24008
  }
23994
- });
24009
+ }, { signal: this.instance.getEventsController()?.signal });
23995
24010
  window.addEventListener("keyup", (e) => {
23996
24011
  if (!(e.ctrlKey || e.metaKey)) {
23997
24012
  this.isCmdCtrlPressed = false;
@@ -24002,7 +24017,7 @@ var WeaveStageNode = class extends WeaveNode {
24002
24017
  const selectedNode = transformer.nodes()[0];
24003
24018
  selectedNode.fire("onCmdCtrlReleased");
24004
24019
  }
24005
- });
24020
+ }, { signal: this.instance.getEventsController()?.signal });
24006
24021
  this.globalEventsInitialized = true;
24007
24022
  }
24008
24023
  isOnlyCtrlOrMeta(event) {
@@ -24687,10 +24702,10 @@ var WeaveTextNode = class extends WeaveNode {
24687
24702
  if (!this.eventsInitialized && !globalThis._weave_isServerSide) {
24688
24703
  window.addEventListener("keydown", (e) => {
24689
24704
  if (e.ctrlKey || e.metaKey) this.isCtrlMetaPressed = true;
24690
- });
24705
+ }, { signal: this.instance.getEventsController()?.signal });
24691
24706
  window.addEventListener("keyup", (e) => {
24692
24707
  if (!(e.ctrlKey || e.metaKey)) this.isCtrlMetaPressed = false;
24693
- });
24708
+ }, { signal: this.instance.getEventsController()?.signal });
24694
24709
  this.eventsInitialized = true;
24695
24710
  }
24696
24711
  }
@@ -24718,7 +24733,7 @@ var WeaveTextNode = class extends WeaveNode {
24718
24733
  onAdd() {
24719
24734
  if (!this.instance.isServerSide() && !this.keyPressHandler) {
24720
24735
  this.keyPressHandler = this.handleKeyPress.bind(this);
24721
- window.addEventListener("keypress", this.keyPressHandler);
24736
+ window.addEventListener("keypress", this.keyPressHandler, { signal: this.instance.getEventsController()?.signal });
24722
24737
  }
24723
24738
  }
24724
24739
  onRender(props) {
@@ -24872,7 +24887,7 @@ var WeaveTextNode = class extends WeaveNode {
24872
24887
  });
24873
24888
  if (!this.instance.isServerSide() && !this.keyPressHandler) {
24874
24889
  this.keyPressHandler = this.handleKeyPress.bind(this);
24875
- window.addEventListener("keypress", this.keyPressHandler);
24890
+ window.addEventListener("keypress", this.keyPressHandler, { signal: this.instance.getEventsController()?.signal });
24876
24891
  }
24877
24892
  return text;
24878
24893
  }
@@ -25131,17 +25146,17 @@ var WeaveTextNode = class extends WeaveNode {
25131
25146
  this.textAreaSuperContainer.scrollTop = 0;
25132
25147
  this.textAreaSuperContainer.scrollLeft = 0;
25133
25148
  }
25134
- });
25149
+ }, { signal: this.instance.getEventsController()?.signal });
25135
25150
  this.textAreaContainer.addEventListener("scroll", () => {
25136
25151
  if (!this.textAreaContainer) return;
25137
25152
  this.textAreaContainer.scrollTop = 0;
25138
25153
  this.textAreaContainer.scrollLeft = 0;
25139
- });
25154
+ }, { signal: this.instance.getEventsController()?.signal });
25140
25155
  this.textArea.addEventListener("scroll", () => {
25141
25156
  if (!this.textArea) return;
25142
25157
  this.textArea.scrollTop = 0;
25143
25158
  this.textArea.scrollLeft = 0;
25144
- });
25159
+ }, { signal: this.instance.getEventsController()?.signal });
25145
25160
  const rotation = textNode.getAbsoluteRotation();
25146
25161
  if (rotation) {
25147
25162
  const transform = "rotate(" + rotation + "deg)";
@@ -25190,8 +25205,8 @@ var WeaveTextNode = class extends WeaveNode {
25190
25205
  this.textAreaDomResize(textNode);
25191
25206
  }
25192
25207
  };
25193
- this.textArea.addEventListener("keydown", handleKeyDown);
25194
- this.textArea.addEventListener("keyup", handleKeyUp);
25208
+ this.textArea.addEventListener("keydown", handleKeyDown, { signal: this.instance.getEventsController()?.signal });
25209
+ this.textArea.addEventListener("keyup", handleKeyUp, { signal: this.instance.getEventsController()?.signal });
25195
25210
  this.textArea.tabIndex = 1;
25196
25211
  this.textArea.focus();
25197
25212
  const handleOutsideClick = (e) => {
@@ -25217,7 +25232,7 @@ var WeaveTextNode = class extends WeaveNode {
25217
25232
  }
25218
25233
  };
25219
25234
  setTimeout(() => {
25220
- window.addEventListener("pointerup", handleOutsideClick);
25235
+ window.addEventListener("pointerup", handleOutsideClick, { signal: this.instance.getEventsController()?.signal });
25221
25236
  }, 0);
25222
25237
  this.instance.getStage().mode(WEAVE_STAGE_TEXT_EDITION_MODE);
25223
25238
  this.editing = true;
@@ -25551,7 +25566,7 @@ var WeaveImageCrop = class WeaveImageCrop {
25551
25566
  utilityLayer?.add(this.transformer);
25552
25567
  this.transformer?.forceUpdate();
25553
25568
  this.cropGroup.show();
25554
- window.addEventListener("keydown", this.handleHide);
25569
+ window.addEventListener("keydown", this.handleHide, { signal: this.instance.getEventsController()?.signal });
25555
25570
  if (options.cmdCtrl.triggered) {
25556
25571
  utilityLayer?.hide();
25557
25572
  const stage = this.instance.getStage();
@@ -26234,7 +26249,7 @@ var WeaveImageNode = class extends WeaveNode {
26234
26249
  };
26235
26250
  this.updateImageCrop(image);
26236
26251
  } else {
26237
- this.updatePlaceholderSize(image, imagePlaceholder);
26252
+ this.updatePlaceholderSize(image);
26238
26253
  this.loadImage(imageProps, image, true);
26239
26254
  }
26240
26255
  if (this.config.performance.cache.enabled) image.on("transformend", () => {
@@ -26672,7 +26687,7 @@ var WeaveImageNode = class extends WeaveNode {
26672
26687
  error: false
26673
26688
  };
26674
26689
  this.updateImageCrop(image);
26675
- this.resolveAsyncElement(id);
26690
+ if (!useFallback) this.resolveAsyncElement(id);
26676
26691
  this.cacheNode(image);
26677
26692
  }
26678
26693
  },
@@ -26713,13 +26728,9 @@ var WeaveImageNode = class extends WeaveNode {
26713
26728
  }
26714
26729
  }, loadTryout);
26715
26730
  }
26716
- updatePlaceholderSize(image, imagePlaceholder) {
26731
+ updatePlaceholderSize(image) {
26717
26732
  const imageAttrs = image.getAttrs();
26718
26733
  if (!this.imageState[imageAttrs.id ?? ""]?.loaded) return;
26719
- if (!imageAttrs.adding && !imageAttrs.cropInfo) {
26720
- imagePlaceholder.width(imageAttrs.uncroppedImage.width);
26721
- imagePlaceholder.height(imageAttrs.uncroppedImage.height);
26722
- }
26723
26734
  }
26724
26735
  updateImageCrop(image) {
26725
26736
  const imageAttrs = image.getAttrs();
@@ -28017,10 +28028,10 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
28017
28028
  if (this.eventsInitialized) return;
28018
28029
  window.addEventListener("keydown", (e) => {
28019
28030
  if (e.key === "Shift") this.shiftPressed = true;
28020
- });
28031
+ }, { signal: this.instance.getEventsController()?.signal });
28021
28032
  window.addEventListener("keyup", (e) => {
28022
28033
  if (e.key === "Shift") this.shiftPressed = false;
28023
- });
28034
+ }, { signal: this.instance.getEventsController()?.signal });
28024
28035
  this.eventsInitialized = true;
28025
28036
  }
28026
28037
  onRender(props) {
@@ -32020,10 +32031,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
32020
32031
  initEvents() {
32021
32032
  window.addEventListener("keydown", (e) => {
32022
32033
  if (e.ctrlKey || e.metaKey) this.isCtrlOrMetaPressed = true;
32023
- });
32034
+ }, { signal: this.instance.getEventsController()?.signal });
32024
32035
  window.addEventListener("keyup", (e) => {
32025
32036
  if (!(e.ctrlKey || e.metaKey)) this.isCtrlOrMetaPressed = false;
32026
- });
32037
+ }, { signal: this.instance.getEventsController()?.signal });
32027
32038
  const stage = this.instance.getStage();
32028
32039
  let lastCenter = null;
32029
32040
  let lastDist = 0;
@@ -32048,7 +32059,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
32048
32059
  return;
32049
32060
  }
32050
32061
  }
32051
- }, { passive: false });
32062
+ }, {
32063
+ passive: false,
32064
+ signal: this.instance.getEventsController()?.signal
32065
+ });
32052
32066
  stage.getContent().addEventListener("touchmove", (e) => {
32053
32067
  e.preventDefault();
32054
32068
  if (e.touches.length === 2) {
@@ -32088,12 +32102,18 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
32088
32102
  lastDist = dist;
32089
32103
  lastCenter = newCenter;
32090
32104
  }
32091
- }, { passive: false });
32105
+ }, {
32106
+ passive: false,
32107
+ signal: this.instance.getEventsController()?.signal
32108
+ });
32092
32109
  stage.getContent().addEventListener("touchend", () => {
32093
32110
  this.pinching = false;
32094
32111
  lastDist = 0;
32095
32112
  lastCenter = null;
32096
- }, { passive: false });
32113
+ }, {
32114
+ passive: false,
32115
+ signal: this.instance.getEventsController()?.signal
32116
+ });
32097
32117
  let doZoom = false;
32098
32118
  const handleWheelImmediate = (e) => {
32099
32119
  const performZoom = this.isCtrlOrMetaPressed || !this.isCtrlOrMetaPressed && e.ctrlKey && e.deltaMode === 0;
@@ -32111,7 +32131,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
32111
32131
  e.preventDefault();
32112
32132
  doZoom = true;
32113
32133
  };
32114
- window.addEventListener("wheel", handleWheelImmediate, { passive: false });
32134
+ window.addEventListener("wheel", handleWheelImmediate, {
32135
+ signal: this.instance.getEventsController()?.signal,
32136
+ passive: false
32137
+ });
32115
32138
  const handleWheel = (e) => {
32116
32139
  if (!doZoom) return;
32117
32140
  const delta = e.deltaY > 0 ? 1 : -1;
@@ -32124,7 +32147,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
32124
32147
  }
32125
32148
  };
32126
32149
  const throttledHandleWheel = (0, import_lodash.throttle)(handleWheel, DEFAULT_THROTTLE_MS);
32127
- window.addEventListener("wheel", throttledHandleWheel, { passive: true });
32150
+ window.addEventListener("wheel", throttledHandleWheel, {
32151
+ signal: this.instance.getEventsController()?.signal,
32152
+ passive: true
32153
+ });
32128
32154
  }
32129
32155
  getInertiaScale() {
32130
32156
  const stage = this.instance.getStage();
@@ -32354,7 +32380,7 @@ var WeaveMoveToolAction = class extends WeaveAction {
32354
32380
  this.cancelAction();
32355
32381
  return;
32356
32382
  }
32357
- });
32383
+ }, { signal: this.instance.getEventsController()?.signal });
32358
32384
  stage.on("pointerdown", () => {
32359
32385
  if ([MOVE_TOOL_ACTION_NAME].includes(this.instance.getActiveAction() ?? "")) stage.container().style.cursor = "grabbing";
32360
32386
  });
@@ -32515,7 +32541,7 @@ var WeaveEraserToolAction = class extends WeaveAction {
32515
32541
  this.cancelAction();
32516
32542
  return;
32517
32543
  }
32518
- });
32544
+ }, { signal: this.instance.getEventsController()?.signal });
32519
32545
  this.initialized = true;
32520
32546
  }
32521
32547
  setState(state) {
@@ -32620,7 +32646,7 @@ var WeaveRectangleToolAction = class extends WeaveAction {
32620
32646
  this.cancelAction();
32621
32647
  return;
32622
32648
  }
32623
- });
32649
+ }, { signal: this.instance.getEventsController()?.signal });
32624
32650
  stage.on("pointermove", () => {
32625
32651
  if (this.state === RECTANGLE_TOOL_STATE.IDLE) return;
32626
32652
  this.setCursor();
@@ -32832,7 +32858,7 @@ var WeaveEllipseToolAction = class extends WeaveAction {
32832
32858
  this.cancelAction();
32833
32859
  return;
32834
32860
  }
32835
- });
32861
+ }, { signal: this.instance.getEventsController()?.signal });
32836
32862
  stage.on("pointerdown", (e) => {
32837
32863
  this.setTapStart(e);
32838
32864
  this.pointers.set(e.evt.pointerId, {
@@ -33051,7 +33077,7 @@ var WeavePenToolAction = class extends WeaveAction {
33051
33077
  this.cancelAction();
33052
33078
  return;
33053
33079
  }
33054
- });
33080
+ }, { signal: this.instance.getEventsController()?.signal });
33055
33081
  stage.on("pointerdown", (e) => {
33056
33082
  this.setTapStart(e);
33057
33083
  this.pointers.set(e.evt.pointerId, {
@@ -33335,13 +33361,13 @@ var WeaveLineToolAction = class extends WeaveAction {
33335
33361
  this.snappedAngle = null;
33336
33362
  this.shiftPressed = true;
33337
33363
  }
33338
- });
33364
+ }, { signal: this.instance.getEventsController()?.signal });
33339
33365
  window.addEventListener("keyup", (e) => {
33340
33366
  if (e.key === "Shift" && this.instance.getActiveAction() === LINE_TOOL_ACTION_NAME) {
33341
33367
  this.snappedAngle = null;
33342
33368
  this.shiftPressed = false;
33343
33369
  }
33344
- });
33370
+ }, { signal: this.instance.getEventsController()?.signal });
33345
33371
  stage.on("pointerdown", (e) => {
33346
33372
  this.setTapStart(e);
33347
33373
  this.pointers.set(e.evt.pointerId, {
@@ -33587,7 +33613,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
33587
33613
  const stage = this.instance.getStage();
33588
33614
  window.addEventListener("keyup", (e) => {
33589
33615
  if (e.code === "Space" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) this.isSpacePressed = false;
33590
- });
33616
+ }, { signal: this.instance.getEventsController()?.signal });
33591
33617
  window.addEventListener("keydown", (e) => {
33592
33618
  if (e.code === "Enter" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) {
33593
33619
  e.stopPropagation();
@@ -33603,7 +33629,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
33603
33629
  e.stopPropagation();
33604
33630
  this.cancelAction();
33605
33631
  }
33606
- });
33632
+ }, { signal: this.instance.getEventsController()?.signal });
33607
33633
  const handlePointerDown = (e) => {
33608
33634
  if (this.state === BRUSH_TOOL_STATE.INACTIVE) return;
33609
33635
  if (this.state !== BRUSH_TOOL_STATE.IDLE) return;
@@ -33844,7 +33870,7 @@ var WeaveTextToolAction = class extends WeaveAction {
33844
33870
  this.cancelAction();
33845
33871
  return;
33846
33872
  }
33847
- });
33873
+ }, { signal: this.instance.getEventsController()?.signal });
33848
33874
  stage.on("pointermove", () => {
33849
33875
  if (this.state === TEXT_TOOL_STATE.IDLE) return;
33850
33876
  this.setCursor();
@@ -34018,7 +34044,7 @@ var WeaveImageToolAction = class extends WeaveAction {
34018
34044
  this.cancelAction();
34019
34045
  return;
34020
34046
  }
34021
- });
34047
+ }, { signal: this.instance.getEventsController()?.signal });
34022
34048
  stage.on("pointerdown", (e) => {
34023
34049
  this.setTapStart(e);
34024
34050
  if (this.ignorePointerEvents) return;
@@ -34464,7 +34490,7 @@ var WeaveImagesToolAction = class extends WeaveAction {
34464
34490
  const stage = this.instance.getStage();
34465
34491
  stage.container().addEventListener("keydown", (e) => {
34466
34492
  if (e.key === "Escape" && this.instance.getActiveAction() === WEAVE_IMAGES_TOOL_ACTION_NAME) this.cancelAction();
34467
- });
34493
+ }, { signal: this.instance.getEventsController()?.signal });
34468
34494
  stage.on("pointerdown", (e) => {
34469
34495
  this.setTapStart(e);
34470
34496
  this.pointers.set(e.evt.pointerId, {
@@ -34885,7 +34911,7 @@ var WeaveStarToolAction = class extends WeaveAction {
34885
34911
  this.cancelAction();
34886
34912
  return;
34887
34913
  }
34888
- });
34914
+ }, { signal: this.instance.getEventsController()?.signal });
34889
34915
  stage.on("pointerdown", (e) => {
34890
34916
  this.setTapStart(e);
34891
34917
  this.pointers.set(e.evt.pointerId, {
@@ -35107,7 +35133,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
35107
35133
  return;
35108
35134
  }
35109
35135
  if (e.code === "Escape" && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) this.cancelAction();
35110
- });
35136
+ }, { signal: this.instance.getEventsController()?.signal });
35111
35137
  stage.on("pointerdown", (e) => {
35112
35138
  this.setTapStart(e);
35113
35139
  this.pointers.set(e.evt.pointerId, {
@@ -35398,10 +35424,10 @@ var WeaveStrokeToolAction = class extends WeaveAction {
35398
35424
  return;
35399
35425
  }
35400
35426
  if (e.key === "Shift" && this.getNames().includes(this.instance.getActiveAction() ?? "")) this.shiftPressed = true;
35401
- });
35427
+ }, { signal: this.instance.getEventsController()?.signal });
35402
35428
  window.addEventListener("keyup", (e) => {
35403
35429
  if (e.key === "Shift" && this.getNames().includes(this.instance.getActiveAction() ?? "")) this.shiftPressed = false;
35404
- });
35430
+ }, { signal: this.instance.getEventsController()?.signal });
35405
35431
  stage.on("pointerdown", (e) => {
35406
35432
  this.setTapStart(e);
35407
35433
  this.pointers.set(e.evt.pointerId, {
@@ -35631,7 +35657,7 @@ var WeaveRegularPolygonToolAction = class extends WeaveAction {
35631
35657
  this.cancelAction();
35632
35658
  return;
35633
35659
  }
35634
- });
35660
+ }, { signal: this.instance.getEventsController()?.signal });
35635
35661
  stage.on("pointerdown", (e) => {
35636
35662
  this.setTapStart(e);
35637
35663
  this.pointers.set(e.evt.pointerId, {
@@ -35835,7 +35861,7 @@ var WeaveFrameToolAction = class extends WeaveAction {
35835
35861
  this.cancelAction();
35836
35862
  return;
35837
35863
  }
35838
- });
35864
+ }, { signal: this.instance.getEventsController()?.signal });
35839
35865
  stage.on("pointermove", () => {
35840
35866
  if (this.state === FRAME_TOOL_STATE.IDLE) return;
35841
35867
  this.setCursor();
@@ -36376,7 +36402,7 @@ var WeaveCommentToolAction = class extends WeaveAction {
36376
36402
  return;
36377
36403
  }
36378
36404
  if (e.code === "Escape" && this.state === WEAVE_COMMENT_TOOL_STATE.CREATING_COMMENT) this.setState(WEAVE_COMMENT_TOOL_STATE.ADDING);
36379
- });
36405
+ }, { signal: this.instance.getEventsController()?.signal });
36380
36406
  stage.on("pointermove", (e) => {
36381
36407
  if (this.state === WEAVE_COMMENT_TOOL_STATE.IDLE) return;
36382
36408
  if (commentNodeHandler?.isCommentViewing()) {
@@ -36576,7 +36602,7 @@ var WeaveVideoToolAction = class extends WeaveAction {
36576
36602
  this.cancelAction();
36577
36603
  return;
36578
36604
  }
36579
- });
36605
+ }, { signal: this.instance.getEventsController()?.signal });
36580
36606
  stage.on("pointerdown", (e) => {
36581
36607
  this.setTapStart(e);
36582
36608
  this.pointers.set(e.evt.pointerId, {
@@ -36738,7 +36764,7 @@ var WeaveMeasureToolAction = class extends WeaveAction {
36738
36764
  const stage = this.instance.getStage();
36739
36765
  window.addEventListener("keydown", (e) => {
36740
36766
  if (e.code === "Escape" && this.instance.getActiveAction() === MEASURE_TOOL_ACTION_NAME) this.cancelAction();
36741
- });
36767
+ }, { signal: this.instance.getEventsController()?.signal });
36742
36768
  stage.on("pointermove", () => {
36743
36769
  if (this.state === MEASURE_TOOL_STATE.IDLE) return;
36744
36770
  if (this.state === MEASURE_TOOL_STATE.SET_TO) {
@@ -37049,7 +37075,7 @@ var WeaveConnectorToolAction = class extends WeaveAction {
37049
37075
  return;
37050
37076
  }
37051
37077
  if (e.code === "Escape" && this.instance.getActiveAction() === CONNECTOR_TOOL_ACTION_NAME) this.cancelAction();
37052
- });
37078
+ }, { signal: this.instance.getEventsController()?.signal });
37053
37079
  let nodeHovered = void 0;
37054
37080
  stage.on("pointermove", () => {
37055
37081
  if (!(this.state === CONNECTOR_TOOL_STATE.SELECTING_INITIAL || this.state === CONNECTOR_TOOL_STATE.SELECTING_FINAL)) return;
@@ -37410,10 +37436,10 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
37410
37436
  const stage = this.instance.getStage();
37411
37437
  window.addEventListener("keydown", (e) => {
37412
37438
  if (e.code === "Space") this.isSpaceKeyPressed = true;
37413
- });
37439
+ }, { signal: this.instance.getEventsController()?.signal });
37414
37440
  window.addEventListener("keyup", (e) => {
37415
37441
  if (e.code === "Space") this.isSpaceKeyPressed = false;
37416
- });
37442
+ }, { signal: this.instance.getEventsController()?.signal });
37417
37443
  this.instance.addEventListener("onStageMove", () => {
37418
37444
  this.onRender();
37419
37445
  });
@@ -37702,7 +37728,7 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
37702
37728
  this.isSpaceKeyPressed = true;
37703
37729
  this.setCursor();
37704
37730
  }
37705
- });
37731
+ }, { signal: this.instance.getEventsController()?.signal });
37706
37732
  window.addEventListener("keyup", (e) => {
37707
37733
  if (e.key === "Meta" || e.key === "Control") this.isCtrlOrMetaPressed = false;
37708
37734
  if (e.code === "Space") {
@@ -37713,7 +37739,7 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
37713
37739
  this.isSpaceKeyPressed = false;
37714
37740
  this.disableMove();
37715
37741
  }
37716
- });
37742
+ }, { signal: this.instance.getEventsController()?.signal });
37717
37743
  let lastPos = null;
37718
37744
  stage.on("pointerdown", (e) => {
37719
37745
  this.pointers.set(e.evt.pointerId, {
@@ -37786,7 +37812,10 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
37786
37812
  this.instance.emitEvent("onStageMove");
37787
37813
  };
37788
37814
  const handleWheelThrottled = (0, import_lodash.throttle)(handleWheel, WEAVE_STAGE_PANNING_THROTTLE_MS);
37789
- window.addEventListener("wheel", handleWheelThrottled, { passive: true });
37815
+ window.addEventListener("wheel", handleWheelThrottled, {
37816
+ passive: true,
37817
+ signal: this.instance.getEventsController()?.signal
37818
+ });
37790
37819
  stage.on("dragstart", (e) => {
37791
37820
  const duration = 1e3 / 60;
37792
37821
  if (this.panEdgeTargets[e.target.getAttrs().id ?? ""] !== void 0) return;
@@ -37844,7 +37873,10 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
37844
37873
  stage.container().style.setProperty("-webkit-user-drag", "none");
37845
37874
  stage.getContent().addEventListener("touchmove", function(e) {
37846
37875
  e.preventDefault();
37847
- }, { passive: false });
37876
+ }, {
37877
+ passive: false,
37878
+ signal: this.instance.getEventsController()?.signal
37879
+ });
37848
37880
  }
37849
37881
  isPanning() {
37850
37882
  return this.panning;
@@ -38134,7 +38166,7 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
38134
38166
  }, DEFAULT_THROTTLE_MS);
38135
38167
  window.addEventListener("resize", () => {
38136
38168
  throttledResize();
38137
- });
38169
+ }, { signal: this.instance.getEventsController()?.signal });
38138
38170
  const resizeObserver = new ResizeObserver(() => {
38139
38171
  throttledResize();
38140
38172
  });
@@ -38879,14 +38911,20 @@ var WeaveStageDropAreaPlugin = class extends WeavePlugin {
38879
38911
  stage.container().addEventListener("dragover", (e) => {
38880
38912
  e.preventDefault();
38881
38913
  e.stopPropagation();
38882
- });
38914
+ }, { signal: this.instance.getEventsController()?.signal });
38883
38915
  stage.container().addEventListener("drop", (e) => {
38884
38916
  e.preventDefault();
38885
38917
  e.stopPropagation();
38886
38918
  this.instance.emitEvent("onStageDrop", e);
38919
+ }, { signal: this.instance.getEventsController()?.signal });
38920
+ window.addEventListener("dragover", (e) => e.preventDefault(), {
38921
+ signal: this.instance.getEventsController()?.signal,
38922
+ passive: false
38923
+ });
38924
+ window.addEventListener("drop", (e) => e.preventDefault(), {
38925
+ signal: this.instance.getEventsController()?.signal,
38926
+ passive: false
38887
38927
  });
38888
- window.addEventListener("dragover", (e) => e.preventDefault(), { passive: false });
38889
- window.addEventListener("drop", (e) => e.preventDefault(), { passive: false });
38890
38928
  }
38891
38929
  enable() {
38892
38930
  this.enabled = true;
@@ -40070,7 +40108,7 @@ var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
40070
40108
  if (e.code === "ArrowLeft" && e.shiftKey) this.handleNodesMovement("left");
40071
40109
  if (e.code === "ArrowRight" && e.shiftKey) this.handleNodesMovement("right");
40072
40110
  if (e.code === "ArrowDown" && e.shiftKey) this.handleNodesMovement("down");
40073
- });
40111
+ }, { signal: this.instance.getEventsController()?.signal });
40074
40112
  }
40075
40113
  enable() {
40076
40114
  this.enabled = true;