@inditextech/weave-sdk 3.5.0 → 3.6.0-SNAPSHOT.112.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.node.js CHANGED
@@ -15083,6 +15083,11 @@ var WeaveStore = class {
15083
15083
  getDocument() {
15084
15084
  return this.document;
15085
15085
  }
15086
+ restartDocument() {
15087
+ this.latestState = { weave: {} };
15088
+ this.state = syncedStore({ weave: {} });
15089
+ this.document = getYjsDoc(this.state);
15090
+ }
15086
15091
  loadDocument(roomData) {
15087
15092
  yjs_default.applyUpdate(this.document, roomData);
15088
15093
  }
@@ -17958,6 +17963,15 @@ var WeaveContextMenuPlugin = class extends WeavePlugin {
17958
17963
  initLayer = void 0;
17959
17964
  constructor(params) {
17960
17965
  super();
17966
+ const { config } = params ?? {};
17967
+ this.config = {
17968
+ xOffset: WEAVE_CONTEXT_MENU_X_OFFSET_DEFAULT,
17969
+ yOffset: WEAVE_CONTEXT_MENU_Y_OFFSET_DEFAULT,
17970
+ ...config
17971
+ };
17972
+ this.initialize();
17973
+ }
17974
+ initialize() {
17961
17975
  this.timer = null;
17962
17976
  this.tapHold = false;
17963
17977
  this.contextMenuVisible = false;
@@ -17967,12 +17981,6 @@ var WeaveContextMenuPlugin = class extends WeavePlugin {
17967
17981
  time: 0
17968
17982
  };
17969
17983
  this.tapHoldTimeout = WEAVE_CONTEXT_MENU_TAP_HOLD_TIMEOUT;
17970
- const { config } = params ?? {};
17971
- this.config = {
17972
- xOffset: WEAVE_CONTEXT_MENU_X_OFFSET_DEFAULT,
17973
- yOffset: WEAVE_CONTEXT_MENU_Y_OFFSET_DEFAULT,
17974
- ...config
17975
- };
17976
17984
  this.pointers = {};
17977
17985
  }
17978
17986
  getName() {
@@ -18623,7 +18631,10 @@ const DEFAULT_ADD_NODE_OPTIONS = { emitUserChangeEvent: false };
18623
18631
  const DEFAULT_UPDATE_NODE_OPTIONS = { emitUserChangeEvent: false };
18624
18632
  const DEFAULT_REMOVE_NODE_OPTIONS = { emitUserChangeEvent: false };
18625
18633
  const DEFAULT_MOVE_NODE_OPTIONS = { emitUserChangeEvent: false };
18626
- const WEAVE_DEFAULT_CONFIG = { behaviors: { axisLockThreshold: 5 } };
18634
+ const WEAVE_DEFAULT_CONFIG = {
18635
+ behaviors: { axisLockThreshold: 5 },
18636
+ performance: { upscale: { enabled: false } }
18637
+ };
18627
18638
 
18628
18639
  //#endregion
18629
18640
  //#region src/plugins/users-presence/constants.ts
@@ -18652,6 +18663,9 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
18652
18663
  constructor(params) {
18653
18664
  super();
18654
18665
  this.config = mergeExceptArrays(WEAVE_NODES_SELECTION_DEFAULT_CONFIG, params?.config ?? {});
18666
+ this.initialize();
18667
+ }
18668
+ initialize() {
18655
18669
  this.defaultEnabledAnchors = this.config.selection?.enabledAnchors ?? [
18656
18670
  "top-left",
18657
18671
  "top-center",
@@ -18815,7 +18829,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
18815
18829
  nodeHovered = void 0;
18816
18830
  }
18817
18831
  this.instance.getStage().handleMouseover?.();
18818
- });
18832
+ }, { signal: this.instance.getEventsController()?.signal });
18819
18833
  const handleTransform = (e) => {
18820
18834
  const moved = this.checkMoved(e);
18821
18835
  if (moved) this.getContextMenuPlugin()?.cancelLongPressTimer();
@@ -19230,11 +19244,11 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
19230
19244
  });
19231
19245
  return;
19232
19246
  }
19233
- });
19247
+ }, { signal: this.instance.getEventsController()?.signal });
19234
19248
  stage.container().addEventListener("keyup", (e) => {
19235
19249
  if (!(e.ctrlKey || e.metaKey)) this.isCtrlMetaPressed = false;
19236
19250
  if (e.code === "Space") this.isSpaceKeyPressed = false;
19237
- });
19251
+ }, { signal: this.instance.getEventsController()?.signal });
19238
19252
  stage.on("pointerdown", (e) => {
19239
19253
  this.setTapStart(e);
19240
19254
  this.handledClickOrTap = false;
@@ -19441,7 +19455,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
19441
19455
  if (existNode) newSelectedNodes.push(existNode);
19442
19456
  }
19443
19457
  this.tr.nodes([...newSelectedNodes]);
19444
- this.tr.forceUpdate();
19458
+ if (newSelectedNodes.length > 0) this.tr.forceUpdate();
19445
19459
  this.triggerSelectedNodesEvent();
19446
19460
  }
19447
19461
  getSelectionPlugin() {
@@ -19694,6 +19708,9 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
19694
19708
  super();
19695
19709
  this.getImageBase64 = params.getImageBase64;
19696
19710
  this.config = mergeExceptArrays(WEAVE_COPY_PASTE_CONFIG_DEFAULT, params?.config);
19711
+ this.initialize();
19712
+ }
19713
+ initialize() {
19697
19714
  this.actualInternalPaddingX = 0;
19698
19715
  this.actualInternalPaddingY = 0;
19699
19716
  this.lastInternalPasteSnapshot = "";
@@ -19799,7 +19816,7 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
19799
19816
  this.focusPasteCatcher();
19800
19817
  if (!this.enabled) return;
19801
19818
  }
19802
- });
19819
+ }, { signal: this.instance.getEventsController()?.signal });
19803
19820
  if (catcher) catcher.addEventListener("paste", async (e) => {
19804
19821
  e.preventDefault();
19805
19822
  let items = void 0;
@@ -19818,7 +19835,7 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
19818
19835
  return;
19819
19836
  }
19820
19837
  this.sendExternalPasteEvent(void 0, items);
19821
- });
19838
+ }, { signal: this.instance.getEventsController()?.signal });
19822
19839
  }
19823
19840
  sendExternalPasteEvent(dataList, items) {
19824
19841
  const stage = this.instance.getStage();
@@ -21973,11 +21990,34 @@ var WeaveRegisterManager = class {
21973
21990
  }
21974
21991
  }
21975
21992
  }
21993
+ resetNodesHandlers() {
21994
+ for (const nodeHandlerId of Object.keys(this.nodesHandlers)) {
21995
+ const nodeHandler = this.nodesHandlers[nodeHandlerId];
21996
+ nodeHandler.initialize?.();
21997
+ }
21998
+ }
21999
+ resetActionsHandlers() {
22000
+ for (const actionHandlerId of Object.keys(this.actionsHandlers)) {
22001
+ const actionHandler = this.actionsHandlers[actionHandlerId];
22002
+ actionHandler.initialize?.();
22003
+ }
22004
+ }
22005
+ resetPlugins() {
22006
+ for (const pluginId of Object.keys(this.plugins)) {
22007
+ const plugin = this.plugins[pluginId];
22008
+ plugin.initialize?.();
22009
+ }
22010
+ }
22011
+ reset() {
22012
+ this.resetNodesHandlers();
22013
+ this.resetActionsHandlers();
22014
+ this.resetPlugins();
22015
+ }
21976
22016
  };
21977
22017
 
21978
22018
  //#endregion
21979
22019
  //#region package.json
21980
- var version = "3.5.0";
22020
+ var version = "3.6.0-SNAPSHOT.112.1";
21981
22021
 
21982
22022
  //#endregion
21983
22023
  //#region src/managers/setup.ts
@@ -22094,6 +22134,11 @@ var WeaveStageManager = class {
22094
22134
  initialZIndex: void 0
22095
22135
  };
22096
22136
  const stage = new Konva.Stage({ ...props });
22137
+ if (!this.instance.isServerSide()) {
22138
+ const containerParent = stage.container().parentNode;
22139
+ stage.width(containerParent.clientWidth);
22140
+ stage.height(containerParent.clientHeight);
22141
+ }
22097
22142
  const realContainer = stage.container();
22098
22143
  if (realContainer !== void 0 && realContainer.style?.position !== "relative") realContainer.style.position = "relative";
22099
22144
  this.setStage(stage);
@@ -22226,6 +22271,10 @@ var WeaveExportManager = class {
22226
22271
  exportNodesAsImage(nodes, boundingNodes, options) {
22227
22272
  return new Promise((resolve) => {
22228
22273
  const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
22274
+ const nodesSelectionPluginPrev = this.getNodesSelectionPlugin()?.isEnabled();
22275
+ const nodesDistanceSnappingPluginPrev = this.getNodesDistanceSnappingPlugin()?.isEnabled();
22276
+ const nodesEdgeSnappingPluginPrev = this.getNodesDistanceSnappingPlugin()?.isEnabled();
22277
+ const nodesStageGridPluginPrev = this.getStageGridPlugin()?.isEnabled();
22229
22278
  this.getNodesSelectionPlugin()?.disable();
22230
22279
  this.getNodesDistanceSnappingPlugin()?.disable();
22231
22280
  this.getNodesEdgeSnappingPlugin()?.disable();
@@ -22290,16 +22339,80 @@ var WeaveExportManager = class {
22290
22339
  stage.position(originalPosition);
22291
22340
  stage.scale(originalScale);
22292
22341
  stage.batchDraw();
22293
- this.getNodesSelectionPlugin()?.enable();
22294
- this.getNodesDistanceSnappingPlugin()?.enable();
22295
- this.getNodesEdgeSnappingPlugin()?.enable();
22296
- this.getStageGridPlugin()?.enable();
22342
+ if (nodesSelectionPluginPrev) this.getNodesSelectionPlugin()?.enable();
22343
+ if (nodesDistanceSnappingPluginPrev) this.getNodesDistanceSnappingPlugin()?.enable();
22344
+ if (nodesEdgeSnappingPluginPrev) this.getNodesEdgeSnappingPlugin()?.enable();
22345
+ if (nodesStageGridPluginPrev) this.getStageGridPlugin()?.enable();
22297
22346
  resolve(img);
22298
22347
  }
22299
22348
  });
22300
22349
  }
22301
22350
  });
22302
22351
  }
22352
+ exportAreaAsImage(area, options) {
22353
+ return new Promise((resolve) => {
22354
+ const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
22355
+ const nodesSelectionPluginPrev = this.getNodesSelectionPlugin()?.isEnabled();
22356
+ const nodesDistanceSnappingPluginPrev = this.getNodesDistanceSnappingPlugin()?.isEnabled();
22357
+ const nodesEdgeSnappingPluginPrev = this.getNodesDistanceSnappingPlugin()?.isEnabled();
22358
+ const nodesStageGridPluginPrev = this.getStageGridPlugin()?.isEnabled();
22359
+ this.getNodesSelectionPlugin()?.disable();
22360
+ this.getNodesDistanceSnappingPlugin()?.disable();
22361
+ this.getNodesEdgeSnappingPlugin()?.disable();
22362
+ this.getStageGridPlugin()?.disable();
22363
+ const stage = this.instance.getStage();
22364
+ const mainLayer = this.instance.getMainLayer();
22365
+ if (!mainLayer) throw new Error("Main layer not found");
22366
+ const originalPosition = {
22367
+ x: stage.x(),
22368
+ y: stage.y()
22369
+ };
22370
+ const originalScale = {
22371
+ x: stage.scaleX(),
22372
+ y: stage.scaleY()
22373
+ };
22374
+ stage.scale({
22375
+ x: 1,
22376
+ y: 1
22377
+ });
22378
+ stage.position({
22379
+ x: 0,
22380
+ y: 0
22381
+ });
22382
+ const bounds = area;
22383
+ const background = new Konva.Rect({
22384
+ x: bounds.x - padding,
22385
+ y: bounds.y - padding,
22386
+ width: bounds.width + 2 * padding,
22387
+ height: bounds.height + 2 * padding,
22388
+ strokeWidth: 0,
22389
+ fill: backgroundColor
22390
+ });
22391
+ mainLayer.add(background);
22392
+ background.moveToBottom();
22393
+ stage.batchDraw();
22394
+ stage.toImage({
22395
+ x: area.x,
22396
+ y: area.y,
22397
+ width: area.width,
22398
+ height: area.height,
22399
+ mimeType: format,
22400
+ pixelRatio,
22401
+ quality: options.quality ?? 1,
22402
+ callback: (img) => {
22403
+ background.destroy();
22404
+ stage.position(originalPosition);
22405
+ stage.scale(originalScale);
22406
+ stage.batchDraw();
22407
+ if (nodesSelectionPluginPrev) this.getNodesSelectionPlugin()?.enable();
22408
+ if (nodesDistanceSnappingPluginPrev) this.getNodesDistanceSnappingPlugin()?.enable();
22409
+ if (nodesEdgeSnappingPluginPrev) this.getNodesEdgeSnappingPlugin()?.enable();
22410
+ if (nodesStageGridPluginPrev) this.getStageGridPlugin()?.enable();
22411
+ resolve(img);
22412
+ }
22413
+ });
22414
+ });
22415
+ }
22303
22416
  async exportNodesServerSide(nodes, boundingNodes, options) {
22304
22417
  const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
22305
22418
  this.getNodesSelectionPlugin()?.disable();
@@ -22402,6 +22515,91 @@ var WeaveExportManager = class {
22402
22515
  height: imageHeight * pixelRatio
22403
22516
  };
22404
22517
  }
22518
+ async exportAreaServerSide(area, options) {
22519
+ const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
22520
+ this.getNodesSelectionPlugin()?.disable();
22521
+ this.getNodesDistanceSnappingPlugin()?.disable();
22522
+ this.getNodesEdgeSnappingPlugin()?.disable();
22523
+ this.getStageGridPlugin()?.disable();
22524
+ const stage = this.instance.getStage();
22525
+ const mainLayer = this.instance.getMainLayer();
22526
+ if (!mainLayer) throw new Error("Main layer not found");
22527
+ const originalPosition = {
22528
+ x: stage.x(),
22529
+ y: stage.y()
22530
+ };
22531
+ const originalScale = {
22532
+ x: stage.scaleX(),
22533
+ y: stage.scaleY()
22534
+ };
22535
+ stage.scale({
22536
+ x: 1,
22537
+ y: 1
22538
+ });
22539
+ const bounds = area;
22540
+ const scaleX = stage.scaleX();
22541
+ const scaleY = stage.scaleY();
22542
+ const unscaledBounds = {
22543
+ x: bounds.x / scaleX,
22544
+ y: bounds.y / scaleY,
22545
+ width: bounds.width / scaleX,
22546
+ height: bounds.height / scaleY
22547
+ };
22548
+ const background = new Konva.Rect({
22549
+ x: unscaledBounds.x - padding,
22550
+ y: unscaledBounds.y - padding,
22551
+ width: unscaledBounds.width + 2 * padding,
22552
+ height: unscaledBounds.height + 2 * padding,
22553
+ strokeWidth: 0,
22554
+ fill: backgroundColor
22555
+ });
22556
+ mainLayer.add(background);
22557
+ background.moveToBottom();
22558
+ const backgroundRect = background.getClientRect({ relativeTo: stage });
22559
+ const composites = [];
22560
+ const imageWidth = Math.round(backgroundRect.width);
22561
+ const imageHeight = Math.round(backgroundRect.height);
22562
+ const maxRenderSize = 1920;
22563
+ const cols = Math.ceil(imageWidth / maxRenderSize);
22564
+ const rows = Math.ceil(imageHeight / maxRenderSize);
22565
+ const tileWidth = Math.floor(imageWidth / cols);
22566
+ const tileHeight = Math.floor(imageHeight / rows);
22567
+ for (let y = 0; y < imageHeight; y += tileHeight) for (let x = 0; x < imageWidth; x += tileWidth) {
22568
+ const width = Math.min(tileWidth, imageWidth - x);
22569
+ const height = Math.min(tileHeight, imageHeight - y);
22570
+ const canvas = await mainLayer.toCanvas({
22571
+ x: Math.round(backgroundRect.x) + x,
22572
+ y: Math.round(backgroundRect.y) + y,
22573
+ width,
22574
+ height,
22575
+ mimeType: format,
22576
+ pixelRatio,
22577
+ quality: options.quality ?? 1
22578
+ });
22579
+ let buffer = null;
22580
+ if (globalThis._weave_serverSideBackend === WEAVE_KONVA_BACKEND.CANVAS) buffer = canvas.toBuffer();
22581
+ if (globalThis._weave_serverSideBackend === WEAVE_KONVA_BACKEND.SKIA) buffer = await canvas.toBuffer();
22582
+ if (!buffer) throw new Error("Failed to generate image buffer");
22583
+ composites.push({
22584
+ top: y * pixelRatio,
22585
+ left: x * pixelRatio,
22586
+ input: buffer
22587
+ });
22588
+ }
22589
+ background.destroy();
22590
+ stage.position(originalPosition);
22591
+ stage.scale(originalScale);
22592
+ stage.batchDraw();
22593
+ this.getNodesSelectionPlugin()?.enable();
22594
+ this.getNodesDistanceSnappingPlugin()?.enable();
22595
+ this.getNodesEdgeSnappingPlugin()?.enable();
22596
+ this.getStageGridPlugin()?.enable();
22597
+ return {
22598
+ composites,
22599
+ width: imageWidth * pixelRatio,
22600
+ height: imageHeight * pixelRatio
22601
+ };
22602
+ }
22405
22603
  imageToBase64(img, mimeType) {
22406
22604
  if (img.naturalWidth === 0 && img.naturalHeight === 0) throw new Error("Image has no content");
22407
22605
  const canvas = document.createElement("canvas");
@@ -22681,7 +22879,12 @@ var WeaveAsyncManager = class {
22681
22879
  this.instance.emitEvent("onAsyncElementChange");
22682
22880
  }, new Map());
22683
22881
  }
22882
+ reset() {
22883
+ this.asyncElements.clear();
22884
+ this.asyncElementsLoadedEventEmitted = false;
22885
+ }
22684
22886
  checkForAsyncElements(elements) {
22887
+ this.instance.emitEvent("onAsyncElementsIdle");
22685
22888
  const amountAsyncResourcesExtracted = this.extractAsyncResources(elements);
22686
22889
  if (amountAsyncResourcesExtracted === 0 && !this.asyncElementsLoadedEventEmitted) {
22687
22890
  this.instance.emitEvent("onAsyncElementsLoaded");
@@ -22734,7 +22937,7 @@ var WeaveAsyncManager = class {
22734
22937
  status: WEAVE_ASYNC_STATUS.LOADING
22735
22938
  };
22736
22939
  this.asyncElements.set(nodeId, element);
22737
- this.instance.emitEvent("onAsyncElementsLoading", {
22940
+ if (!this.asyncElementsLoadedEventEmitted) this.instance.emitEvent("onAsyncElementsLoading", {
22738
22941
  loaded: this.getAmountAsyncElementsLoaded(),
22739
22942
  total: this.getAmountAsyncElements()
22740
22943
  });
@@ -22747,11 +22950,11 @@ var WeaveAsyncManager = class {
22747
22950
  status: WEAVE_ASYNC_STATUS.LOADED
22748
22951
  };
22749
22952
  this.asyncElements.set(nodeId, element);
22750
- this.instance.emitEvent("onAsyncElementsLoading", {
22751
- loaded: this.getAmountAsyncElementsLoaded(),
22752
- total: this.getAmountAsyncElements()
22753
- });
22754
22953
  if (!this.asyncElementsLoadedEventEmitted) {
22954
+ this.instance.emitEvent("onAsyncElementsLoading", {
22955
+ loaded: this.getAmountAsyncElementsLoaded(),
22956
+ total: this.getAmountAsyncElements()
22957
+ });
22755
22958
  const allLoaded = this.asyncElementsLoaded();
22756
22959
  if (allLoaded) {
22757
22960
  this.instance.emitEvent("onAsyncElementsLoaded");
@@ -22876,6 +23079,7 @@ var Weave = class {
22876
23079
  constructor(weaveConfig, stageConfig) {
22877
23080
  globalThis._weave_isServerSide = false;
22878
23081
  if (typeof window === "undefined") globalThis._weave_isServerSide = true;
23082
+ this.eventsController = void 0;
22879
23083
  this.emitter = new Emittery();
22880
23084
  Konva.showWarnings = false;
22881
23085
  this.id = v4_default();
@@ -22921,6 +23125,7 @@ var Weave = class {
22921
23125
  this.initialized = true;
22922
23126
  this.status = WEAVE_INSTANCE_STATUS.RUNNING;
22923
23127
  this.emitEvent("onInstanceStatus", this.status);
23128
+ this.emitEvent("onRender");
22924
23129
  });
22925
23130
  }
22926
23131
  setStatus(status) {
@@ -22945,6 +23150,7 @@ var Weave = class {
22945
23150
  async start() {
22946
23151
  this.moduleLogger.info("Start instance");
22947
23152
  if (!this.isServerSide()) {
23153
+ this.eventsController = new AbortController();
22948
23154
  if (!window.weave) window.weave = this;
22949
23155
  }
22950
23156
  this.emitEvent("onRoomLoaded", false);
@@ -22968,8 +23174,39 @@ var Weave = class {
22968
23174
  store.setup();
22969
23175
  store.connect();
22970
23176
  }
23177
+ async switchRoom() {
23178
+ this.moduleLogger.info(`Switching room`);
23179
+ const nodeHandlers = this.registerManager.getNodesHandlers();
23180
+ for (const nodeHandlerKey of Object.keys(nodeHandlers)) {
23181
+ const nodeHandler = nodeHandlers[nodeHandlerKey];
23182
+ nodeHandler?.onDestroyInstance();
23183
+ }
23184
+ const stage = this.getStage();
23185
+ if (stage) stage.destroy();
23186
+ if (this.eventsController) this.eventsController.abort();
23187
+ if (!this.isServerSide()) this.eventsController = new AbortController();
23188
+ this.registerManager.reset();
23189
+ this.asyncManager.reset();
23190
+ this.moduleLogger.info("Switching room instance");
23191
+ if (!this.isServerSide()) {
23192
+ if (!window.weave) window.weave = this;
23193
+ }
23194
+ this.emitEvent("onRoomLoaded", false);
23195
+ this.status = WEAVE_INSTANCE_STATUS.STARTING;
23196
+ this.emitEvent("onInstanceStatus", this.status);
23197
+ this.registerManager.reset();
23198
+ this.status = WEAVE_INSTANCE_STATUS.LOADING_FONTS;
23199
+ this.emitEvent("onInstanceStatus", this.status);
23200
+ await this.fontsManager.loadFonts();
23201
+ this.setupManager.setupLog();
23202
+ this.stageManager.initStage();
23203
+ this.status = WEAVE_INSTANCE_STATUS.CONNECTING_TO_ROOM;
23204
+ this.emitEvent("onInstanceStatus", this.status);
23205
+ this.addEventListener("onStoreConnectionStatusChange", this.handleStoreConnectionStatusChange.bind(this));
23206
+ }
22971
23207
  destroy() {
22972
23208
  this.moduleLogger.info(`Destroying the instance`);
23209
+ if (this.eventsController) this.eventsController.abort();
22973
23210
  this.emitter.clearListeners();
22974
23211
  this.status = WEAVE_INSTANCE_STATUS.IDLE;
22975
23212
  this.emitEvent("onInstanceStatus", this.status);
@@ -23439,9 +23676,15 @@ var Weave = class {
23439
23676
  async exportNodesServerSide(nodes, boundingNodes, options) {
23440
23677
  return await this.exportManager.exportNodesServerSide(nodes, boundingNodes, options);
23441
23678
  }
23679
+ async exportAreaServerSide(area, options) {
23680
+ return await this.exportManager.exportAreaServerSide(area, options);
23681
+ }
23442
23682
  async exportNodes(nodes, boundingNodes, options) {
23443
23683
  return await this.exportManager.exportNodesAsImage(nodes, boundingNodes, options);
23444
23684
  }
23685
+ async exportArea(area, options) {
23686
+ return await this.exportManager.exportAreaAsImage(area, options);
23687
+ }
23445
23688
  getExportBoundingBox(nodesIds) {
23446
23689
  const nodes = [];
23447
23690
  for (const nodeId of nodesIds) {
@@ -23604,6 +23847,9 @@ var Weave = class {
23604
23847
  getDragProperties() {
23605
23848
  return this.dragAndDropManager.getDragProperties();
23606
23849
  }
23850
+ getEventsController() {
23851
+ return this.eventsController;
23852
+ }
23607
23853
  };
23608
23854
 
23609
23855
  //#endregion
@@ -23695,6 +23941,7 @@ const downscaleImageFromURL = (url, options) => {
23695
23941
  //#endregion
23696
23942
  //#region src/internal-utils/upscale.ts
23697
23943
  const setupUpscaleStage = (instance, stage) => {
23944
+ if (instance.isServerSide()) return;
23698
23945
  const config = instance.getConfiguration();
23699
23946
  const doUpscale = config.performance?.upscale?.enabled ?? false;
23700
23947
  if (doUpscale) {
@@ -23726,7 +23973,14 @@ const setupUpscaleStage = (instance, stage) => {
23726
23973
  innerElement.style.transformOrigin = "0 0";
23727
23974
  innerElement.style.transform = `scale(${scaleToCover})`;
23728
23975
  }
23729
- } else stage.setAttrs({ upscaleScale: 1 });
23976
+ } else {
23977
+ const realContainer = stage.container();
23978
+ const containerWidth = realContainer.offsetWidth;
23979
+ const containerHeight = realContainer.offsetHeight;
23980
+ stage.width(containerWidth);
23981
+ stage.height(containerHeight);
23982
+ stage.setAttrs({ upscaleScale: 1 });
23983
+ }
23730
23984
  };
23731
23985
 
23732
23986
  //#endregion
@@ -23737,6 +23991,7 @@ var WeaveStageNode = class extends WeaveNode {
23737
23991
  wheelMousePressed = false;
23738
23992
  isCmdCtrlPressed = false;
23739
23993
  globalEventsInitialized = false;
23994
+ initialize = void 0;
23740
23995
  onRender(props) {
23741
23996
  const stage = new Konva.Stage({
23742
23997
  ...props,
@@ -23755,10 +24010,10 @@ var WeaveStageNode = class extends WeaveNode {
23755
24010
  container.setAttribute("tabindex", "0");
23756
24011
  stage.container().addEventListener("focus", () => {
23757
24012
  this.stageFocused = true;
23758
- });
24013
+ }, { signal: this.instance.getEventsController()?.signal });
23759
24014
  stage.container().addEventListener("blur", () => {
23760
24015
  this.stageFocused = false;
23761
- });
24016
+ }, { signal: this.instance.getEventsController()?.signal });
23762
24017
  }
23763
24018
  Konva.Stage.prototype.mode = function(mode) {
23764
24019
  if (typeof mode !== "undefined") this._mode = mode;
@@ -23828,7 +24083,7 @@ var WeaveStageNode = class extends WeaveNode {
23828
24083
  const selectedNode = transformer.nodes()[0];
23829
24084
  selectedNode.fire("onCmdCtrlPressed");
23830
24085
  }
23831
- });
24086
+ }, { signal: this.instance.getEventsController()?.signal });
23832
24087
  window.addEventListener("keyup", (e) => {
23833
24088
  if (!(e.ctrlKey || e.metaKey)) {
23834
24089
  this.isCmdCtrlPressed = false;
@@ -23839,7 +24094,7 @@ var WeaveStageNode = class extends WeaveNode {
23839
24094
  const selectedNode = transformer.nodes()[0];
23840
24095
  selectedNode.fire("onCmdCtrlReleased");
23841
24096
  }
23842
- });
24097
+ }, { signal: this.instance.getEventsController()?.signal });
23843
24098
  this.globalEventsInitialized = true;
23844
24099
  }
23845
24100
  isOnlyCtrlOrMeta(event) {
@@ -23859,6 +24114,7 @@ const WEAVE_LAYER_NODE_TYPE = "layer";
23859
24114
  //#region src/nodes/layer/layer.ts
23860
24115
  var WeaveLayerNode = class extends WeaveNode {
23861
24116
  nodeType = WEAVE_LAYER_NODE_TYPE;
24117
+ initialize = void 0;
23862
24118
  onRender(props) {
23863
24119
  const layer = new Konva.Layer({ ...props });
23864
24120
  layer.canMoveToContainer = function() {
@@ -23906,6 +24162,7 @@ const WEAVE_GROUP_NODE_TYPE = "group";
23906
24162
  //#region src/nodes/group/group.ts
23907
24163
  var WeaveGroupNode = class extends WeaveNode {
23908
24164
  nodeType = WEAVE_GROUP_NODE_TYPE;
24165
+ initialize = void 0;
23909
24166
  constructor(params) {
23910
24167
  super();
23911
24168
  const { config } = params ?? {};
@@ -23998,6 +24255,7 @@ const WEAVE_RECTANGLE_NODE_TYPE = "rectangle";
23998
24255
  //#region src/nodes/rectangle/rectangle.ts
23999
24256
  var WeaveRectangleNode = class extends WeaveNode {
24000
24257
  nodeType = WEAVE_RECTANGLE_NODE_TYPE;
24258
+ initialize = void 0;
24001
24259
  constructor(params) {
24002
24260
  super();
24003
24261
  const { config } = params ?? {};
@@ -24041,6 +24299,7 @@ const WEAVE_ELLIPSE_NODE_TYPE = "ellipse";
24041
24299
  //#region src/nodes/ellipse/ellipse.ts
24042
24300
  var WeaveEllipseNode = class extends WeaveNode {
24043
24301
  nodeType = WEAVE_ELLIPSE_NODE_TYPE;
24302
+ initialize = void 0;
24044
24303
  constructor(params) {
24045
24304
  super();
24046
24305
  const { config } = params ?? {};
@@ -24186,13 +24445,16 @@ var WeaveLineNode = class extends WeaveNode {
24186
24445
  constructor(params) {
24187
24446
  super();
24188
24447
  this.config = mergeExceptArrays(WEAVE_LINE_NODE_DEFAULT_CONFIG, params?.config ?? {});
24189
- this.handleNodeChanges = null;
24190
- this.handleZoomChanges = null;
24191
24448
  this.snapper = new GreedySnapper({
24192
24449
  snapAngles: this.config.snapAngles.angles,
24193
24450
  activateThreshold: this.config.snapAngles.activateThreshold,
24194
24451
  releaseThreshold: this.config.snapAngles.releaseThreshold
24195
24452
  });
24453
+ this.initialize();
24454
+ }
24455
+ initialize() {
24456
+ this.handleNodeChanges = null;
24457
+ this.handleZoomChanges = null;
24196
24458
  }
24197
24459
  onRender(props) {
24198
24460
  const line = new Konva.Line({
@@ -24497,17 +24759,19 @@ const TEXT_LAYOUT = {
24497
24759
  //#region src/nodes/text/text.ts
24498
24760
  var WeaveTextNode = class extends WeaveNode {
24499
24761
  nodeType = WEAVE_TEXT_NODE_TYPE;
24500
- editing = false;
24501
- textAreaSuperContainer = null;
24502
- textAreaContainer = null;
24503
- textArea = null;
24504
- eventsInitialized = false;
24505
- isCtrlMetaPressed = false;
24506
24762
  constructor(params) {
24507
24763
  super();
24508
24764
  const { config } = params ?? {};
24509
24765
  this.config = (0, import_lodash.merge)({}, WEAVE_TEXT_NODE_DEFAULT_CONFIG, config);
24766
+ this.initialize();
24767
+ }
24768
+ initialize() {
24510
24769
  this.keyPressHandler = void 0;
24770
+ this.eventsInitialized = false;
24771
+ this.isCtrlMetaPressed = false;
24772
+ this.textAreaSuperContainer = null;
24773
+ this.textAreaContainer = null;
24774
+ this.textArea = null;
24511
24775
  this.editing = false;
24512
24776
  this.textArea = null;
24513
24777
  }
@@ -24515,10 +24779,10 @@ var WeaveTextNode = class extends WeaveNode {
24515
24779
  if (!this.eventsInitialized && !globalThis._weave_isServerSide) {
24516
24780
  window.addEventListener("keydown", (e) => {
24517
24781
  if (e.ctrlKey || e.metaKey) this.isCtrlMetaPressed = true;
24518
- });
24782
+ }, { signal: this.instance.getEventsController()?.signal });
24519
24783
  window.addEventListener("keyup", (e) => {
24520
24784
  if (!(e.ctrlKey || e.metaKey)) this.isCtrlMetaPressed = false;
24521
- });
24785
+ }, { signal: this.instance.getEventsController()?.signal });
24522
24786
  this.eventsInitialized = true;
24523
24787
  }
24524
24788
  }
@@ -24546,7 +24810,7 @@ var WeaveTextNode = class extends WeaveNode {
24546
24810
  onAdd() {
24547
24811
  if (!this.instance.isServerSide() && !this.keyPressHandler) {
24548
24812
  this.keyPressHandler = this.handleKeyPress.bind(this);
24549
- window.addEventListener("keypress", this.keyPressHandler);
24813
+ window.addEventListener("keypress", this.keyPressHandler, { signal: this.instance.getEventsController()?.signal });
24550
24814
  }
24551
24815
  }
24552
24816
  onRender(props) {
@@ -24700,7 +24964,7 @@ var WeaveTextNode = class extends WeaveNode {
24700
24964
  });
24701
24965
  if (!this.instance.isServerSide() && !this.keyPressHandler) {
24702
24966
  this.keyPressHandler = this.handleKeyPress.bind(this);
24703
- window.addEventListener("keypress", this.keyPressHandler);
24967
+ window.addEventListener("keypress", this.keyPressHandler, { signal: this.instance.getEventsController()?.signal });
24704
24968
  }
24705
24969
  return text;
24706
24970
  }
@@ -24959,17 +25223,17 @@ var WeaveTextNode = class extends WeaveNode {
24959
25223
  this.textAreaSuperContainer.scrollTop = 0;
24960
25224
  this.textAreaSuperContainer.scrollLeft = 0;
24961
25225
  }
24962
- });
25226
+ }, { signal: this.instance.getEventsController()?.signal });
24963
25227
  this.textAreaContainer.addEventListener("scroll", () => {
24964
25228
  if (!this.textAreaContainer) return;
24965
25229
  this.textAreaContainer.scrollTop = 0;
24966
25230
  this.textAreaContainer.scrollLeft = 0;
24967
- });
25231
+ }, { signal: this.instance.getEventsController()?.signal });
24968
25232
  this.textArea.addEventListener("scroll", () => {
24969
25233
  if (!this.textArea) return;
24970
25234
  this.textArea.scrollTop = 0;
24971
25235
  this.textArea.scrollLeft = 0;
24972
- });
25236
+ }, { signal: this.instance.getEventsController()?.signal });
24973
25237
  const rotation = textNode.getAbsoluteRotation();
24974
25238
  if (rotation) {
24975
25239
  const transform = "rotate(" + rotation + "deg)";
@@ -25018,8 +25282,8 @@ var WeaveTextNode = class extends WeaveNode {
25018
25282
  this.textAreaDomResize(textNode);
25019
25283
  }
25020
25284
  };
25021
- this.textArea.addEventListener("keydown", handleKeyDown);
25022
- this.textArea.addEventListener("keyup", handleKeyUp);
25285
+ this.textArea.addEventListener("keydown", handleKeyDown, { signal: this.instance.getEventsController()?.signal });
25286
+ this.textArea.addEventListener("keyup", handleKeyUp, { signal: this.instance.getEventsController()?.signal });
25023
25287
  this.textArea.tabIndex = 1;
25024
25288
  this.textArea.focus();
25025
25289
  const handleOutsideClick = (e) => {
@@ -25045,7 +25309,7 @@ var WeaveTextNode = class extends WeaveNode {
25045
25309
  }
25046
25310
  };
25047
25311
  setTimeout(() => {
25048
- window.addEventListener("pointerup", handleOutsideClick);
25312
+ window.addEventListener("pointerup", handleOutsideClick, { signal: this.instance.getEventsController()?.signal });
25049
25313
  }, 0);
25050
25314
  this.instance.getStage().mode(WEAVE_STAGE_TEXT_EDITION_MODE);
25051
25315
  this.editing = true;
@@ -25381,7 +25645,7 @@ var WeaveImageCrop = class WeaveImageCrop {
25381
25645
  utilityLayer?.add(this.transformer);
25382
25646
  this.transformer?.forceUpdate();
25383
25647
  this.cropGroup.show();
25384
- window.addEventListener("keydown", this.handleHide);
25648
+ window.addEventListener("keydown", this.handleHide, { signal: this.instance.getEventsController()?.signal });
25385
25649
  if (options.cmdCtrl.triggered) {
25386
25650
  utilityLayer?.hide();
25387
25651
  const stage = this.instance.getStage();
@@ -25831,24 +26095,21 @@ const isAllowedUrl = (value) => {
25831
26095
  //#endregion
25832
26096
  //#region src/nodes/image/image.ts
25833
26097
  var WeaveImageNode = class extends WeaveNode {
25834
- imageBitmapCache = {};
25835
- imageSource = {};
25836
- imageFallback = {};
25837
- imageState = {};
25838
- imageTryoutAttempts = {};
25839
- imageTryoutIds = {};
25840
26098
  nodeType = WEAVE_IMAGE_NODE_TYPE;
25841
26099
  cursorsFallback = { loading: "wait" };
25842
26100
  cursors = {};
25843
26101
  constructor(params) {
25844
26102
  super();
25845
26103
  const { config } = params ?? {};
26104
+ this.config = mergeExceptArrays(WEAVE_IMAGE_DEFAULT_CONFIG, config);
26105
+ this.initialize();
26106
+ }
26107
+ initialize() {
25846
26108
  this.tapStart = {
25847
26109
  x: 0,
25848
26110
  y: 0,
25849
26111
  time: 0
25850
26112
  };
25851
- this.config = mergeExceptArrays(WEAVE_IMAGE_DEFAULT_CONFIG, config);
25852
26113
  this.imageCrop = null;
25853
26114
  this.imageBitmapCache = {};
25854
26115
  this.imageSource = {};
@@ -26072,7 +26333,7 @@ var WeaveImageNode = class extends WeaveNode {
26072
26333
  };
26073
26334
  this.updateImageCrop(image);
26074
26335
  } else {
26075
- this.updatePlaceholderSize(image, imagePlaceholder);
26336
+ this.updatePlaceholderSize(image);
26076
26337
  this.loadImage(imageProps, image, true);
26077
26338
  }
26078
26339
  if (this.config.performance.cache.enabled) image.on("transformend", () => {
@@ -26455,7 +26716,7 @@ var WeaveImageNode = class extends WeaveNode {
26455
26716
  }
26456
26717
  this.loadAsyncElement(id);
26457
26718
  preloadFunction(id, realImageURL ?? "", {
26458
- onLoad: () => {
26719
+ onLoad: async () => {
26459
26720
  if (useFallback) this.imageTryoutIds[id] = setTimeout(() => {
26460
26721
  const node = this.instance.getStage().findOne(`#${id}`);
26461
26722
  if (node) {
@@ -26506,7 +26767,7 @@ var WeaveImageNode = class extends WeaveNode {
26506
26767
  error: false
26507
26768
  };
26508
26769
  this.updateImageCrop(image);
26509
- this.resolveAsyncElement(id);
26770
+ if (!useFallback) this.resolveAsyncElement(id);
26510
26771
  this.cacheNode(image);
26511
26772
  }
26512
26773
  },
@@ -26547,13 +26808,9 @@ var WeaveImageNode = class extends WeaveNode {
26547
26808
  }
26548
26809
  }, loadTryout);
26549
26810
  }
26550
- updatePlaceholderSize(image, imagePlaceholder) {
26811
+ updatePlaceholderSize(image) {
26551
26812
  const imageAttrs = image.getAttrs();
26552
26813
  if (!this.imageState[imageAttrs.id ?? ""]?.loaded) return;
26553
- if (!imageAttrs.adding && !imageAttrs.cropInfo) {
26554
- imagePlaceholder.width(imageAttrs.uncroppedImage.width);
26555
- imagePlaceholder.height(imageAttrs.uncroppedImage.height);
26556
- }
26557
26814
  }
26558
26815
  updateImageCrop(image) {
26559
26816
  const imageAttrs = image.getAttrs();
@@ -26687,6 +26944,7 @@ const WEAVE_STAR_NODE_TYPE = "star";
26687
26944
  //#region src/nodes/star/star.ts
26688
26945
  var WeaveStarNode = class extends WeaveNode {
26689
26946
  nodeType = WEAVE_STAR_NODE_TYPE;
26947
+ initialize = void 0;
26690
26948
  constructor(params) {
26691
26949
  super();
26692
26950
  const { config } = params ?? {};
@@ -26772,6 +27030,7 @@ const WEAVE_ARROW_NODE_TYPE = "arrow";
26772
27030
  //#region src/nodes/arrow/arrow.ts
26773
27031
  var WeaveArrowNode = class extends WeaveNode {
26774
27032
  nodeType = WEAVE_ARROW_NODE_TYPE;
27033
+ initialize = void 0;
26775
27034
  constructor(params) {
26776
27035
  super();
26777
27036
  const { config } = params ?? {};
@@ -26828,6 +27087,7 @@ const WEAVE_REGULAR_POLYGON_NODE_TYPE = "regular-polygon";
26828
27087
  //#region src/nodes/regular-polygon/regular-polygon.ts
26829
27088
  var WeaveRegularPolygonNode = class extends WeaveNode {
26830
27089
  nodeType = WEAVE_REGULAR_POLYGON_NODE_TYPE;
27090
+ initialize = void 0;
26831
27091
  constructor(params) {
26832
27092
  super();
26833
27093
  const { config } = params ?? {};
@@ -26941,6 +27201,7 @@ var GroupFrame = class extends Konva.Group {
26941
27201
  //#region src/nodes/frame/frame.ts
26942
27202
  var WeaveFrameNode = class extends WeaveNode {
26943
27203
  nodeType = WEAVE_FRAME_NODE_TYPE;
27204
+ initialize = void 0;
26944
27205
  constructor(params) {
26945
27206
  super();
26946
27207
  const { config } = params ?? {};
@@ -27241,6 +27502,7 @@ const WEAVE_STROKE_NODE_DEFAULT_CONFIG = {
27241
27502
  //#region src/nodes/stroke/stroke.ts
27242
27503
  var WeaveStrokeNode = class extends WeaveNode {
27243
27504
  nodeType = WEAVE_STROKE_NODE_TYPE;
27505
+ initialize = void 0;
27244
27506
  constructor(params) {
27245
27507
  super();
27246
27508
  const { config } = params ?? {};
@@ -27817,8 +28079,6 @@ var WeaveSquareLineTipManager = class extends WeaveBaseLineTipManager {
27817
28079
  //#endregion
27818
28080
  //#region src/nodes/stroke-single/stroke-single.ts
27819
28081
  var WeaveStrokeSingleNode = class extends WeaveNode {
27820
- startHandle = null;
27821
- endHandle = null;
27822
28082
  nodeType = WEAVE_STROKE_SINGLE_NODE_TYPE;
27823
28083
  tipManagers = {
27824
28084
  [WEAVE_STROKE_SINGLE_NODE_TIP_TYPE.ARROW]: new WeaveArrowLineTipManager(),
@@ -27829,24 +28089,29 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
27829
28089
  constructor(params) {
27830
28090
  super();
27831
28091
  this.config = mergeExceptArrays(WEAVE_STROKE_SINGLE_NODE_DEFAULT_CONFIG, params?.config ?? {});
27832
- this.handleNodeChanges = null;
27833
- this.handleZoomChanges = null;
27834
- this.shiftPressed = false;
27835
28092
  this.snapper = new GreedySnapper({
27836
28093
  snapAngles: this.config.snapAngles.angles,
27837
28094
  activateThreshold: this.config.snapAngles.activateThreshold,
27838
28095
  releaseThreshold: this.config.snapAngles.releaseThreshold
27839
28096
  });
28097
+ this.initialize();
28098
+ }
28099
+ initialize() {
27840
28100
  this.eventsInitialized = false;
28101
+ this.startHandle = null;
28102
+ this.endHandle = null;
28103
+ this.handleNodeChanges = null;
28104
+ this.handleZoomChanges = null;
28105
+ this.shiftPressed = false;
27841
28106
  }
27842
28107
  initEvents() {
27843
28108
  if (this.eventsInitialized) return;
27844
28109
  window.addEventListener("keydown", (e) => {
27845
28110
  if (e.key === "Shift") this.shiftPressed = true;
27846
- });
28111
+ }, { signal: this.instance.getEventsController()?.signal });
27847
28112
  window.addEventListener("keyup", (e) => {
27848
28113
  if (e.key === "Shift") this.shiftPressed = false;
27849
- });
28114
+ }, { signal: this.instance.getEventsController()?.signal });
27850
28115
  this.eventsInitialized = true;
27851
28116
  }
27852
28117
  onRender(props) {
@@ -28333,6 +28598,9 @@ var WeaveCommentNode = class extends WeaveNode {
28333
28598
  constructor(params) {
28334
28599
  super();
28335
28600
  this.config = mergeExceptArrays(WEAVE_COMMENT_NODE_DEFAULTS, params.config);
28601
+ this.initialize();
28602
+ }
28603
+ initialize() {
28336
28604
  this.commentDomVisibleId = null;
28337
28605
  this.commentDomVisible = false;
28338
28606
  this.commentDomAction = null;
@@ -28961,10 +29229,6 @@ const WEAVE_VIDEO_DEFAULT_CONFIG = {
28961
29229
  //#endregion
28962
29230
  //#region src/nodes/video/video.ts
28963
29231
  var WeaveVideoNode = class extends WeaveNode {
28964
- videoState = {};
28965
- videoSourceFrameId = {};
28966
- videoSource = {};
28967
- videoPlaceholder = {};
28968
29232
  nodeType = WEAVE_VIDEO_NODE_TYPE;
28969
29233
  constructor(params) {
28970
29234
  super();
@@ -28977,6 +29241,13 @@ var WeaveVideoNode = class extends WeaveNode {
28977
29241
  this.videoIconImage.src = this.config.style.icon.dataURL;
28978
29242
  }
28979
29243
  }
29244
+ initialize() {
29245
+ this.videoState = {};
29246
+ this.videoSource = {};
29247
+ this.videoSourceFrameId = {};
29248
+ this.videoPlaceholder = {};
29249
+ this.videoIconImage = void 0;
29250
+ }
28980
29251
  async loadPlaceholder(params, video) {
28981
29252
  const videoProps = params;
28982
29253
  const { id } = videoProps;
@@ -29471,6 +29742,7 @@ const WEAVE_MEASURE_NODE_DEFAULT_CONFIG = { style: {
29471
29742
  var WeaveMeasureNode = class extends WeaveNode {
29472
29743
  nodeType = WEAVE_MEASURE_NODE_TYPE;
29473
29744
  handlePointCircleRadius = 6;
29745
+ initialize = void 0;
29474
29746
  constructor(params) {
29475
29747
  super();
29476
29748
  this.config = mergeExceptArrays(WEAVE_MEASURE_NODE_DEFAULT_CONFIG, params?.config ?? {});
@@ -30761,6 +31033,7 @@ var WeaveConnectorNode = class extends WeaveNode {
30761
31033
  [WEAVE_CONNECTOR_NODE_DECORATOR_TYPE.DOT]: setupNodeDecoratorDot,
30762
31034
  [WEAVE_CONNECTOR_NODE_DECORATOR_TYPE.ARROW]: setupNodeDecoratorArrow
30763
31035
  };
31036
+ initialize = void 0;
30764
31037
  constructor(params) {
30765
31038
  super();
30766
31039
  this.config = mergeExceptArrays(WEAVE_CONNECTOR_NODE_DEFAULT_CONFIG, params?.config);
@@ -31511,10 +31784,6 @@ const WEAVE_STAGE_ZOOM_DEFAULT_CONFIG = {
31511
31784
  var WeaveStageZoomPlugin = class extends WeavePlugin {
31512
31785
  getLayerName = void 0;
31513
31786
  initLayer = void 0;
31514
- pinching = false;
31515
- zooming = false;
31516
- isTrackpad = false;
31517
- zoomVelocity = 0;
31518
31787
  zoomInertiaType = WEAVE_STAGE_ZOOM_TYPE.MOUSE_WHEEL;
31519
31788
  defaultStep = 3;
31520
31789
  constructor(params) {
@@ -31522,8 +31791,13 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
31522
31791
  const { config } = params ?? {};
31523
31792
  this.config = mergeExceptArrays(WEAVE_STAGE_ZOOM_DEFAULT_CONFIG, config);
31524
31793
  if (!this.config.zoomSteps.includes(this.config.defaultZoom)) throw new Error(`Default zoom ${this.config.defaultZoom} is not in zoom steps`);
31794
+ this.initialize();
31795
+ }
31796
+ initialize() {
31525
31797
  this.pinching = false;
31798
+ this.zooming = false;
31526
31799
  this.isTrackpad = false;
31800
+ this.zoomVelocity = 0;
31527
31801
  this.isCtrlOrMetaPressed = false;
31528
31802
  this.updatedMinimumZoom = false;
31529
31803
  this.actualStep = this.config.zoomSteps.findIndex((step) => step === this.config.defaultZoom);
@@ -31810,6 +32084,15 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
31810
32084
  if (box.width === 0 || box.height === 0) return;
31811
32085
  this.fitToElements(box, finalOptions);
31812
32086
  }
32087
+ fitToArea(area, options) {
32088
+ const finalOptions = mergeExceptArrays({
32089
+ smartZoom: false,
32090
+ overrideZoom: true
32091
+ }, options);
32092
+ if (!this.enabled) return;
32093
+ if (area.width === 0 || area.height === 0) return;
32094
+ this.fitToElements(area, finalOptions);
32095
+ }
31813
32096
  enable() {
31814
32097
  this.enabled = true;
31815
32098
  }
@@ -31828,10 +32111,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
31828
32111
  initEvents() {
31829
32112
  window.addEventListener("keydown", (e) => {
31830
32113
  if (e.ctrlKey || e.metaKey) this.isCtrlOrMetaPressed = true;
31831
- });
32114
+ }, { signal: this.instance.getEventsController()?.signal });
31832
32115
  window.addEventListener("keyup", (e) => {
31833
32116
  if (!(e.ctrlKey || e.metaKey)) this.isCtrlOrMetaPressed = false;
31834
- });
32117
+ }, { signal: this.instance.getEventsController()?.signal });
31835
32118
  const stage = this.instance.getStage();
31836
32119
  let lastCenter = null;
31837
32120
  let lastDist = 0;
@@ -31856,7 +32139,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
31856
32139
  return;
31857
32140
  }
31858
32141
  }
31859
- }, { passive: false });
32142
+ }, {
32143
+ passive: false,
32144
+ signal: this.instance.getEventsController()?.signal
32145
+ });
31860
32146
  stage.getContent().addEventListener("touchmove", (e) => {
31861
32147
  e.preventDefault();
31862
32148
  if (e.touches.length === 2) {
@@ -31896,12 +32182,18 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
31896
32182
  lastDist = dist;
31897
32183
  lastCenter = newCenter;
31898
32184
  }
31899
- }, { passive: false });
32185
+ }, {
32186
+ passive: false,
32187
+ signal: this.instance.getEventsController()?.signal
32188
+ });
31900
32189
  stage.getContent().addEventListener("touchend", () => {
31901
32190
  this.pinching = false;
31902
32191
  lastDist = 0;
31903
32192
  lastCenter = null;
31904
- }, { passive: false });
32193
+ }, {
32194
+ passive: false,
32195
+ signal: this.instance.getEventsController()?.signal
32196
+ });
31905
32197
  let doZoom = false;
31906
32198
  const handleWheelImmediate = (e) => {
31907
32199
  const performZoom = this.isCtrlOrMetaPressed || !this.isCtrlOrMetaPressed && e.ctrlKey && e.deltaMode === 0;
@@ -31919,7 +32211,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
31919
32211
  e.preventDefault();
31920
32212
  doZoom = true;
31921
32213
  };
31922
- window.addEventListener("wheel", handleWheelImmediate, { passive: false });
32214
+ window.addEventListener("wheel", handleWheelImmediate, {
32215
+ signal: this.instance.getEventsController()?.signal,
32216
+ passive: false
32217
+ });
31923
32218
  const handleWheel = (e) => {
31924
32219
  if (!doZoom) return;
31925
32220
  const delta = e.deltaY > 0 ? 1 : -1;
@@ -31932,7 +32227,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
31932
32227
  }
31933
32228
  };
31934
32229
  const throttledHandleWheel = (0, import_lodash.throttle)(handleWheel, DEFAULT_THROTTLE_MS);
31935
- window.addEventListener("wheel", throttledHandleWheel, { passive: true });
32230
+ window.addEventListener("wheel", throttledHandleWheel, {
32231
+ signal: this.instance.getEventsController()?.signal,
32232
+ passive: true
32233
+ });
31936
32234
  }
31937
32235
  getInertiaScale() {
31938
32236
  const stage = this.instance.getStage();
@@ -31990,6 +32288,7 @@ const ZOOM_OUT_TOOL_ACTION_NAME = "zoomOutTool";
31990
32288
  //#region src/actions/zoom-out-tool/zoom-out-tool.ts
31991
32289
  var WeaveZoomOutToolAction = class extends WeaveAction {
31992
32290
  onPropsChange = void 0;
32291
+ initialize = void 0;
31993
32292
  getName() {
31994
32293
  return ZOOM_OUT_TOOL_ACTION_NAME;
31995
32294
  }
@@ -32024,6 +32323,10 @@ const ZOOM_IN_TOOL_ACTION_NAME = "zoomInTool";
32024
32323
  //#region src/actions/zoom-in-tool/zoom-in-tool.ts
32025
32324
  var WeaveZoomInToolAction = class extends WeaveAction {
32026
32325
  onPropsChange = void 0;
32326
+ initialize = void 0;
32327
+ constructor() {
32328
+ super();
32329
+ }
32027
32330
  getName() {
32028
32331
  return ZOOM_IN_TOOL_ACTION_NAME;
32029
32332
  }
@@ -32058,6 +32361,10 @@ const FIT_TO_SCREEN_TOOL_ACTION_NAME = "fitToScreenTool";
32058
32361
  //#region src/actions/fit-to-screen-tool/fit-to-screen-tool.ts
32059
32362
  var WeaveFitToScreenToolAction = class extends WeaveAction {
32060
32363
  onPropsChange = void 0;
32364
+ initialize = void 0;
32365
+ constructor() {
32366
+ super();
32367
+ }
32061
32368
  getName() {
32062
32369
  return FIT_TO_SCREEN_TOOL_ACTION_NAME;
32063
32370
  }
@@ -32091,6 +32398,10 @@ const FIT_TO_SELECTION_TOOL_ACTION_NAME = "fitToSelectionTool";
32091
32398
  //#region src/actions/fit-to-selection-tool/fit-to-selection-tool.ts
32092
32399
  var WeaveFitToSelectionToolAction = class extends WeaveAction {
32093
32400
  onPropsChange = void 0;
32401
+ initialize = void 0;
32402
+ constructor() {
32403
+ super();
32404
+ }
32094
32405
  getName() {
32095
32406
  return FIT_TO_SELECTION_TOOL_ACTION_NAME;
32096
32407
  }
@@ -32133,6 +32444,9 @@ var WeaveMoveToolAction = class extends WeaveAction {
32133
32444
  onInit = void 0;
32134
32445
  constructor() {
32135
32446
  super();
32447
+ this.initialize();
32448
+ }
32449
+ initialize() {
32136
32450
  this.initialized = false;
32137
32451
  this.state = MOVE_TOOL_STATE.IDLE;
32138
32452
  }
@@ -32146,7 +32460,7 @@ var WeaveMoveToolAction = class extends WeaveAction {
32146
32460
  this.cancelAction();
32147
32461
  return;
32148
32462
  }
32149
- });
32463
+ }, { signal: this.instance.getEventsController()?.signal });
32150
32464
  stage.on("pointerdown", () => {
32151
32465
  if ([MOVE_TOOL_ACTION_NAME].includes(this.instance.getActiveAction() ?? "")) stage.container().style.cursor = "grabbing";
32152
32466
  });
@@ -32205,6 +32519,9 @@ var WeaveSelectionToolAction = class extends WeaveAction {
32205
32519
  onInit = void 0;
32206
32520
  constructor() {
32207
32521
  super();
32522
+ this.initialize();
32523
+ }
32524
+ initialize() {
32208
32525
  this.initialized = false;
32209
32526
  this.state = SELECTION_TOOL_STATE.IDLE;
32210
32527
  }
@@ -32268,6 +32585,9 @@ var WeaveEraserToolAction = class extends WeaveAction {
32268
32585
  onInit = void 0;
32269
32586
  constructor() {
32270
32587
  super();
32588
+ this.initialize();
32589
+ }
32590
+ initialize() {
32271
32591
  this.initialized = false;
32272
32592
  this.erasing = false;
32273
32593
  this.state = ERASER_TOOL_STATE.IDLE;
@@ -32301,7 +32621,7 @@ var WeaveEraserToolAction = class extends WeaveAction {
32301
32621
  this.cancelAction();
32302
32622
  return;
32303
32623
  }
32304
- });
32624
+ }, { signal: this.instance.getEventsController()?.signal });
32305
32625
  this.initialized = true;
32306
32626
  }
32307
32627
  setState(state) {
@@ -32368,6 +32688,9 @@ var WeaveRectangleToolAction = class extends WeaveAction {
32368
32688
  onInit = void 0;
32369
32689
  constructor() {
32370
32690
  super();
32691
+ this.initialize();
32692
+ }
32693
+ initialize() {
32371
32694
  this.pointers = new Map();
32372
32695
  this.initialized = false;
32373
32696
  this.state = RECTANGLE_TOOL_STATE.IDLE;
@@ -32403,7 +32726,7 @@ var WeaveRectangleToolAction = class extends WeaveAction {
32403
32726
  this.cancelAction();
32404
32727
  return;
32405
32728
  }
32406
- });
32729
+ }, { signal: this.instance.getEventsController()?.signal });
32407
32730
  stage.on("pointermove", () => {
32408
32731
  if (this.state === RECTANGLE_TOOL_STATE.IDLE) return;
32409
32732
  this.setCursor();
@@ -32577,6 +32900,9 @@ var WeaveEllipseToolAction = class extends WeaveAction {
32577
32900
  onInit = void 0;
32578
32901
  constructor() {
32579
32902
  super();
32903
+ this.initialize();
32904
+ }
32905
+ initialize() {
32580
32906
  this.pointers = new Map();
32581
32907
  this.initialized = false;
32582
32908
  this.state = ELLIPSE_TOOL_STATE.IDLE;
@@ -32612,7 +32938,7 @@ var WeaveEllipseToolAction = class extends WeaveAction {
32612
32938
  this.cancelAction();
32613
32939
  return;
32614
32940
  }
32615
- });
32941
+ }, { signal: this.instance.getEventsController()?.signal });
32616
32942
  stage.on("pointerdown", (e) => {
32617
32943
  this.setTapStart(e);
32618
32944
  this.pointers.set(e.evt.pointerId, {
@@ -32793,6 +33119,9 @@ var WeavePenToolAction = class extends WeaveAction {
32793
33119
  onInit = void 0;
32794
33120
  constructor() {
32795
33121
  super();
33122
+ this.initialize();
33123
+ }
33124
+ initialize() {
32796
33125
  this.pointers = new Map();
32797
33126
  this.initialized = false;
32798
33127
  this.state = PEN_TOOL_STATE.IDLE;
@@ -32828,7 +33157,7 @@ var WeavePenToolAction = class extends WeaveAction {
32828
33157
  this.cancelAction();
32829
33158
  return;
32830
33159
  }
32831
- });
33160
+ }, { signal: this.instance.getEventsController()?.signal });
32832
33161
  stage.on("pointerdown", (e) => {
32833
33162
  this.setTapStart(e);
32834
33163
  this.pointers.set(e.evt.pointerId, {
@@ -33065,6 +33394,9 @@ var WeaveLineToolAction = class extends WeaveAction {
33065
33394
  constructor(params) {
33066
33395
  super();
33067
33396
  this.config = mergeExceptArrays(LINE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
33397
+ this.initialize();
33398
+ }
33399
+ initialize() {
33068
33400
  this.pointers = new Map();
33069
33401
  this.initialized = false;
33070
33402
  this.state = LINE_TOOL_STATE.IDLE;
@@ -33109,13 +33441,13 @@ var WeaveLineToolAction = class extends WeaveAction {
33109
33441
  this.snappedAngle = null;
33110
33442
  this.shiftPressed = true;
33111
33443
  }
33112
- });
33444
+ }, { signal: this.instance.getEventsController()?.signal });
33113
33445
  window.addEventListener("keyup", (e) => {
33114
33446
  if (e.key === "Shift" && this.instance.getActiveAction() === LINE_TOOL_ACTION_NAME) {
33115
33447
  this.snappedAngle = null;
33116
33448
  this.shiftPressed = false;
33117
33449
  }
33118
- });
33450
+ }, { signal: this.instance.getEventsController()?.signal });
33119
33451
  stage.on("pointerdown", (e) => {
33120
33452
  this.setTapStart(e);
33121
33453
  this.pointers.set(e.evt.pointerId, {
@@ -33330,6 +33662,9 @@ var WeaveBrushToolAction = class extends WeaveAction {
33330
33662
  constructor(params) {
33331
33663
  super();
33332
33664
  this.config = mergeExceptArrays(BRUSH_TOOL_DEFAULT_CONFIG, params?.config ?? {});
33665
+ this.initialize();
33666
+ }
33667
+ initialize() {
33333
33668
  this.initialized = false;
33334
33669
  this.state = BRUSH_TOOL_STATE.INACTIVE;
33335
33670
  this.strokeId = null;
@@ -33358,7 +33693,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
33358
33693
  const stage = this.instance.getStage();
33359
33694
  window.addEventListener("keyup", (e) => {
33360
33695
  if (e.code === "Space" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) this.isSpacePressed = false;
33361
- });
33696
+ }, { signal: this.instance.getEventsController()?.signal });
33362
33697
  window.addEventListener("keydown", (e) => {
33363
33698
  if (e.code === "Enter" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) {
33364
33699
  e.stopPropagation();
@@ -33374,7 +33709,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
33374
33709
  e.stopPropagation();
33375
33710
  this.cancelAction();
33376
33711
  }
33377
- });
33712
+ }, { signal: this.instance.getEventsController()?.signal });
33378
33713
  const handlePointerDown = (e) => {
33379
33714
  if (this.state === BRUSH_TOOL_STATE.INACTIVE) return;
33380
33715
  if (this.state !== BRUSH_TOOL_STATE.IDLE) return;
@@ -33583,6 +33918,9 @@ var WeaveTextToolAction = class extends WeaveAction {
33583
33918
  onInit = void 0;
33584
33919
  constructor() {
33585
33920
  super();
33921
+ this.initialize();
33922
+ }
33923
+ initialize() {
33586
33924
  this.initialized = false;
33587
33925
  this.state = TEXT_TOOL_STATE.IDLE;
33588
33926
  this.textId = null;
@@ -33612,7 +33950,7 @@ var WeaveTextToolAction = class extends WeaveAction {
33612
33950
  this.cancelAction();
33613
33951
  return;
33614
33952
  }
33615
- });
33953
+ }, { signal: this.instance.getEventsController()?.signal });
33616
33954
  stage.on("pointermove", () => {
33617
33955
  if (this.state === TEXT_TOOL_STATE.IDLE) return;
33618
33956
  this.setCursor();
@@ -33740,6 +34078,9 @@ var WeaveImageToolAction = class extends WeaveAction {
33740
34078
  constructor(params) {
33741
34079
  super();
33742
34080
  this.config = mergeExceptArrays(WEAVE_IMAGE_TOOL_CONFIG_DEFAULT, params?.config ?? {});
34081
+ this.initialize();
34082
+ }
34083
+ initialize() {
33743
34084
  this.pointers = new Map();
33744
34085
  this.initialized = false;
33745
34086
  this.imageId = null;
@@ -33783,7 +34124,7 @@ var WeaveImageToolAction = class extends WeaveAction {
33783
34124
  this.cancelAction();
33784
34125
  return;
33785
34126
  }
33786
- });
34127
+ }, { signal: this.instance.getEventsController()?.signal });
33787
34128
  stage.on("pointerdown", (e) => {
33788
34129
  this.setTapStart(e);
33789
34130
  if (this.ignorePointerEvents) return;
@@ -34180,6 +34521,9 @@ var WeaveImagesToolAction = class extends WeaveAction {
34180
34521
  constructor(params) {
34181
34522
  super();
34182
34523
  this.config = mergeExceptArrays(WEAVE_IMAGES_TOOL_DEFAULT_CONFIG, params ?? {});
34524
+ this.initialize();
34525
+ }
34526
+ initialize() {
34183
34527
  this.pointers = new Map();
34184
34528
  this.initialized = false;
34185
34529
  this.tempPointerFeedbackNode = null;
@@ -34226,7 +34570,7 @@ var WeaveImagesToolAction = class extends WeaveAction {
34226
34570
  const stage = this.instance.getStage();
34227
34571
  stage.container().addEventListener("keydown", (e) => {
34228
34572
  if (e.key === "Escape" && this.instance.getActiveAction() === WEAVE_IMAGES_TOOL_ACTION_NAME) this.cancelAction();
34229
- });
34573
+ }, { signal: this.instance.getEventsController()?.signal });
34230
34574
  stage.on("pointerdown", (e) => {
34231
34575
  this.setTapStart(e);
34232
34576
  this.pointers.set(e.evt.pointerId, {
@@ -34608,6 +34952,9 @@ var WeaveStarToolAction = class extends WeaveAction {
34608
34952
  onInit = void 0;
34609
34953
  constructor() {
34610
34954
  super();
34955
+ this.initialize();
34956
+ }
34957
+ initialize() {
34611
34958
  this.pointers = new Map();
34612
34959
  this.initialized = false;
34613
34960
  this.state = STAR_TOOL_STATE.IDLE;
@@ -34644,7 +34991,7 @@ var WeaveStarToolAction = class extends WeaveAction {
34644
34991
  this.cancelAction();
34645
34992
  return;
34646
34993
  }
34647
- });
34994
+ }, { signal: this.instance.getEventsController()?.signal });
34648
34995
  stage.on("pointerdown", (e) => {
34649
34996
  this.setTapStart(e);
34650
34997
  this.pointers.set(e.evt.pointerId, {
@@ -34809,8 +35156,8 @@ var WeaveStarToolAction = class extends WeaveAction {
34809
35156
 
34810
35157
  //#endregion
34811
35158
  //#region src/actions/arrow-tool/constants.ts
34812
- const ARROW_TOOL_ACTION_NAME = "arrowTool";
34813
- const ARROW_TOOL_STATE = {
35159
+ const WEAVE_ARROW_TOOL_ACTION_NAME = "arrowTool";
35160
+ const WEAVE_ARROW_TOOL_STATE = {
34814
35161
  ["IDLE"]: "idle",
34815
35162
  ["ADDING"]: "adding",
34816
35163
  ["DEFINING_SIZE"]: "definingSize",
@@ -34826,9 +35173,12 @@ var WeaveArrowToolAction = class extends WeaveAction {
34826
35173
  onInit = void 0;
34827
35174
  constructor() {
34828
35175
  super();
35176
+ this.initialize();
35177
+ }
35178
+ initialize() {
34829
35179
  this.pointers = new Map();
34830
35180
  this.initialized = false;
34831
- this.state = ARROW_TOOL_STATE.IDLE;
35181
+ this.state = WEAVE_ARROW_TOOL_STATE.IDLE;
34832
35182
  this.arrowId = null;
34833
35183
  this.tempArrowId = null;
34834
35184
  this.tempMainArrowNode = null;
@@ -34841,7 +35191,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
34841
35191
  this.props = this.initProps();
34842
35192
  }
34843
35193
  getName() {
34844
- return ARROW_TOOL_ACTION_NAME;
35194
+ return WEAVE_ARROW_TOOL_ACTION_NAME;
34845
35195
  }
34846
35196
  initProps() {
34847
35197
  return {
@@ -34858,40 +35208,37 @@ var WeaveArrowToolAction = class extends WeaveAction {
34858
35208
  setupEvents() {
34859
35209
  const stage = this.instance.getStage();
34860
35210
  window.addEventListener("keydown", (e) => {
34861
- if (e.code === "Enter" && this.instance.getActiveAction() === ARROW_TOOL_ACTION_NAME) {
34862
- this.cancelAction();
34863
- return;
34864
- }
34865
- if (e.code === "Escape" && this.instance.getActiveAction() === ARROW_TOOL_ACTION_NAME) {
35211
+ if (e.code === "Enter" && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
34866
35212
  this.cancelAction();
34867
35213
  return;
34868
35214
  }
34869
- });
35215
+ if (e.code === "Escape" && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) this.cancelAction();
35216
+ }, { signal: this.instance.getEventsController()?.signal });
34870
35217
  stage.on("pointerdown", (e) => {
34871
35218
  this.setTapStart(e);
34872
35219
  this.pointers.set(e.evt.pointerId, {
34873
35220
  x: e.evt.clientX,
34874
35221
  y: e.evt.clientY
34875
35222
  });
34876
- if (this.pointers.size === 2 && this.instance.getActiveAction() === ARROW_TOOL_ACTION_NAME) {
34877
- this.state = ARROW_TOOL_STATE.ADDING;
35223
+ if (this.pointers.size === 2 && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
35224
+ this.state = WEAVE_ARROW_TOOL_STATE.ADDING;
34878
35225
  return;
34879
35226
  }
34880
- if (!this.tempMainArrowNode && this.state === ARROW_TOOL_STATE.ADDING) this.handleAdding();
34881
- if (this.tempMainArrowNode && this.state === ARROW_TOOL_STATE.ADDING) this.state = ARROW_TOOL_STATE.DEFINING_SIZE;
35227
+ if (!this.tempMainArrowNode && this.state === WEAVE_ARROW_TOOL_STATE.ADDING) this.handleAdding();
35228
+ if (this.tempMainArrowNode && this.state === WEAVE_ARROW_TOOL_STATE.ADDING) this.state = WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE;
34882
35229
  });
34883
35230
  stage.on("pointermove", () => {
34884
- if (this.state === ARROW_TOOL_STATE.IDLE) return;
35231
+ if (this.state === WEAVE_ARROW_TOOL_STATE.IDLE) return;
34885
35232
  this.setCursor();
34886
- if (this.pointers.size === 2 && this.instance.getActiveAction() === ARROW_TOOL_ACTION_NAME) {
34887
- this.state = ARROW_TOOL_STATE.ADDING;
35233
+ if (this.pointers.size === 2 && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
35234
+ this.state = WEAVE_ARROW_TOOL_STATE.ADDING;
34888
35235
  return;
34889
35236
  }
34890
- if (this.state === ARROW_TOOL_STATE.DEFINING_SIZE) this.handleMovement();
35237
+ if (this.state === WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) this.handleMovement();
34891
35238
  });
34892
35239
  stage.on("pointerup", (e) => {
34893
35240
  this.pointers.delete(e.evt.pointerId);
34894
- if (this.state === ARROW_TOOL_STATE.DEFINING_SIZE) this.handleSettingSize();
35241
+ if (this.state === WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) this.handleSettingSize();
34895
35242
  });
34896
35243
  this.initialized = true;
34897
35244
  }
@@ -34905,7 +35252,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
34905
35252
  this.tempPoint = void 0;
34906
35253
  this.tempNextPoint = void 0;
34907
35254
  this.clickPoint = null;
34908
- this.setState(ARROW_TOOL_STATE.ADDING);
35255
+ this.setState(WEAVE_ARROW_TOOL_STATE.ADDING);
34909
35256
  }
34910
35257
  handleAdding() {
34911
35258
  const stage = this.instance.getStage();
@@ -34956,7 +35303,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
34956
35303
  this.measureContainer?.add(this.tempNextPoint);
34957
35304
  this.tempPoint.moveToTop();
34958
35305
  this.tempNextPoint.moveToTop();
34959
- this.setState(ARROW_TOOL_STATE.DEFINING_SIZE);
35306
+ this.setState(WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE);
34960
35307
  }
34961
35308
  }
34962
35309
  handleSettingSize() {
@@ -34983,11 +35330,11 @@ var WeaveArrowToolAction = class extends WeaveAction {
34983
35330
  y: mousePoint.y,
34984
35331
  points: [0, 0]
34985
35332
  });
34986
- this.setState(ARROW_TOOL_STATE.DEFINING_SIZE);
35333
+ this.setState(WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE);
34987
35334
  }
34988
35335
  }
34989
35336
  handleMovement() {
34990
- if (this.state !== ARROW_TOOL_STATE.DEFINING_SIZE) return;
35337
+ if (this.state !== WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) return;
34991
35338
  if (this.arrowId && this.tempArrowNode && this.measureContainer && this.tempNextPoint) {
34992
35339
  const { mousePoint } = this.instance.getMousePointerRelativeToContainer(this.measureContainer);
34993
35340
  this.tempArrowNode.setAttrs({
@@ -35054,7 +35401,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
35054
35401
  this.container = void 0;
35055
35402
  this.measureContainer = void 0;
35056
35403
  this.clickPoint = null;
35057
- this.setState(ARROW_TOOL_STATE.IDLE);
35404
+ this.setState(WEAVE_ARROW_TOOL_STATE.IDLE);
35058
35405
  }
35059
35406
  setCursor() {
35060
35407
  const stage = this.instance.getStage();
@@ -35098,13 +35445,15 @@ const WEAVE_STROKE_TOOL_DEFAULT_CONFIG = { snapAngles: {
35098
35445
  var WeaveStrokeToolAction = class extends WeaveAction {
35099
35446
  initialized = false;
35100
35447
  initialCursor = null;
35101
- snappedAngle = null;
35102
35448
  shiftPressed = false;
35103
35449
  onPropsChange = void 0;
35104
35450
  onInit = void 0;
35105
35451
  constructor(params) {
35106
35452
  super();
35107
35453
  this.config = mergeExceptArrays(WEAVE_STROKE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
35454
+ this.initialize();
35455
+ }
35456
+ initialize() {
35108
35457
  this.pointers = new Map();
35109
35458
  this.initialized = false;
35110
35459
  this.state = WEAVE_STROKE_TOOL_STATE.IDLE;
@@ -35113,7 +35462,6 @@ var WeaveStrokeToolAction = class extends WeaveAction {
35113
35462
  this.tempLineId = null;
35114
35463
  this.tempLineNode = null;
35115
35464
  this.container = void 0;
35116
- this.snappedAngle = null;
35117
35465
  this.measureContainer = void 0;
35118
35466
  this.clickPoint = null;
35119
35467
  this.snapper = new GreedySnapper({
@@ -35126,6 +35474,9 @@ var WeaveStrokeToolAction = class extends WeaveAction {
35126
35474
  getName() {
35127
35475
  return WEAVE_STROKE_TOOL_ACTION_NAME;
35128
35476
  }
35477
+ getNames() {
35478
+ return [WEAVE_STROKE_TOOL_ACTION_NAME, ...WEAVE_STROKE_TOOL_ACTION_NAME_ALIASES];
35479
+ }
35129
35480
  hasAliases() {
35130
35481
  return true;
35131
35482
  }
@@ -35144,32 +35495,26 @@ var WeaveStrokeToolAction = class extends WeaveAction {
35144
35495
  setupEvents() {
35145
35496
  const stage = this.instance.getStage();
35146
35497
  window.addEventListener("keydown", (e) => {
35147
- if (e.code === "Enter" && this.instance.getActiveAction() === WEAVE_STROKE_TOOL_ACTION_NAME) {
35498
+ if (e.code === "Enter" && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
35148
35499
  this.cancelAction();
35149
35500
  return;
35150
35501
  }
35151
- if (e.code === "Escape" && this.instance.getActiveAction() === WEAVE_STROKE_TOOL_ACTION_NAME) {
35502
+ if (e.code === "Escape" && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
35152
35503
  this.cancelAction();
35153
35504
  return;
35154
35505
  }
35155
- if (e.key === "Shift" && this.instance.getActiveAction() === WEAVE_STROKE_TOOL_ACTION_NAME) {
35156
- this.snappedAngle = null;
35157
- this.shiftPressed = true;
35158
- }
35159
- });
35506
+ if (e.key === "Shift" && this.getNames().includes(this.instance.getActiveAction() ?? "")) this.shiftPressed = true;
35507
+ }, { signal: this.instance.getEventsController()?.signal });
35160
35508
  window.addEventListener("keyup", (e) => {
35161
- if (e.key === "Shift" && this.instance.getActiveAction() === WEAVE_STROKE_TOOL_ACTION_NAME) {
35162
- this.snappedAngle = null;
35163
- this.shiftPressed = false;
35164
- }
35165
- });
35509
+ if (e.key === "Shift" && this.getNames().includes(this.instance.getActiveAction() ?? "")) this.shiftPressed = false;
35510
+ }, { signal: this.instance.getEventsController()?.signal });
35166
35511
  stage.on("pointerdown", (e) => {
35167
35512
  this.setTapStart(e);
35168
35513
  this.pointers.set(e.evt.pointerId, {
35169
35514
  x: e.evt.clientX,
35170
35515
  y: e.evt.clientY
35171
35516
  });
35172
- if (this.pointers.size === 2 && this.instance.getActiveAction() === WEAVE_STROKE_TOOL_ACTION_NAME) {
35517
+ if (this.pointers.size === 2 && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
35173
35518
  this.state = WEAVE_STROKE_TOOL_STATE.ADDING;
35174
35519
  return;
35175
35520
  }
@@ -35179,7 +35524,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
35179
35524
  stage.on("pointermove", () => {
35180
35525
  if (this.state === WEAVE_STROKE_TOOL_STATE.IDLE) return;
35181
35526
  this.setCursor();
35182
- if (this.pointers.size === 2 && this.instance.getActiveAction() === WEAVE_STROKE_TOOL_ACTION_NAME) {
35527
+ if (this.pointers.size === 2 && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
35183
35528
  this.state = WEAVE_STROKE_TOOL_STATE.ADDING;
35184
35529
  return;
35185
35530
  }
@@ -35197,7 +35542,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
35197
35542
  addLine() {
35198
35543
  this.setCursor();
35199
35544
  this.setFocusStage();
35200
- this.instance.emitEvent("onAddingStroke", { actionName: this.instance.getActiveAction() ?? WEAVE_STROKE_TOOL_ACTION_NAME });
35545
+ this.instance.emitEvent("onAddingStroke", { actionName: this.instance.getActiveAction() ?? "not-defined" });
35201
35546
  this.shiftPressed = false;
35202
35547
  this.clickPoint = null;
35203
35548
  this.setState(WEAVE_STROKE_TOOL_STATE.ADDING);
@@ -35305,7 +35650,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
35305
35650
  });
35306
35651
  delete finalLine.props.dragBoundFunc;
35307
35652
  this.instance.addNode(finalLine, this.container?.getAttrs().id);
35308
- this.instance.emitEvent("onAddedStroke", { actionName: this.instance.getActiveAction() ?? WEAVE_STROKE_TOOL_ACTION_NAME });
35653
+ this.instance.emitEvent("onAddedStroke", { actionName: this.instance.getActiveAction() ?? "not-defined" });
35309
35654
  nodeCreated = true;
35310
35655
  }
35311
35656
  }
@@ -35355,6 +35700,9 @@ var WeaveRegularPolygonToolAction = class extends WeaveAction {
35355
35700
  onInit = void 0;
35356
35701
  constructor() {
35357
35702
  super();
35703
+ this.initialize();
35704
+ }
35705
+ initialize() {
35358
35706
  this.pointers = new Map();
35359
35707
  this.initialized = false;
35360
35708
  this.state = REGULAR_POLYGON_TOOL_STATE.IDLE;
@@ -35389,7 +35737,7 @@ var WeaveRegularPolygonToolAction = class extends WeaveAction {
35389
35737
  this.cancelAction();
35390
35738
  return;
35391
35739
  }
35392
- });
35740
+ }, { signal: this.instance.getEventsController()?.signal });
35393
35741
  stage.on("pointerdown", (e) => {
35394
35742
  this.setTapStart(e);
35395
35743
  this.pointers.set(e.evt.pointerId, {
@@ -35563,6 +35911,9 @@ var WeaveFrameToolAction = class extends WeaveAction {
35563
35911
  onInit = void 0;
35564
35912
  constructor() {
35565
35913
  super();
35914
+ this.initialize();
35915
+ }
35916
+ initialize() {
35566
35917
  this.initialized = false;
35567
35918
  this.state = FRAME_TOOL_STATE.IDLE;
35568
35919
  this.frameId = null;
@@ -35590,7 +35941,7 @@ var WeaveFrameToolAction = class extends WeaveAction {
35590
35941
  this.cancelAction();
35591
35942
  return;
35592
35943
  }
35593
- });
35944
+ }, { signal: this.instance.getEventsController()?.signal });
35594
35945
  stage.on("pointermove", () => {
35595
35946
  if (this.state === FRAME_TOOL_STATE.IDLE) return;
35596
35947
  this.setCursor();
@@ -35692,6 +36043,10 @@ var WeaveExportStageToolAction = class extends WeaveAction {
35692
36043
  };
35693
36044
  onPropsChange = void 0;
35694
36045
  onInit = void 0;
36046
+ initialize = void 0;
36047
+ constructor() {
36048
+ super();
36049
+ }
35695
36050
  getName() {
35696
36051
  return EXPORT_STAGE_TOOL_ACTION_NAME;
35697
36052
  }
@@ -35739,6 +36094,10 @@ var WeaveExportNodesToolAction = class extends WeaveAction {
35739
36094
  };
35740
36095
  onPropsChange = void 0;
35741
36096
  onInit = void 0;
36097
+ initialize = void 0;
36098
+ constructor() {
36099
+ super();
36100
+ }
35742
36101
  getName() {
35743
36102
  return EXPORT_NODES_TOOL_ACTION_NAME;
35744
36103
  }
@@ -35791,6 +36150,9 @@ var WeaveAlignNodesToolAction = class extends WeaveAction {
35791
36150
  onInit = void 0;
35792
36151
  constructor() {
35793
36152
  super();
36153
+ this.initialize();
36154
+ }
36155
+ initialize() {
35794
36156
  this.initialized = false;
35795
36157
  this.state = ALIGN_NODES_TOOL_STATE.IDLE;
35796
36158
  }
@@ -36040,6 +36402,9 @@ var WeaveCommentToolAction = class extends WeaveAction {
36040
36402
  super();
36041
36403
  const { config } = params ?? {};
36042
36404
  this.config = mergeExceptArrays(WEAVE_COMMENT_TOOL_DEFAULT_CONFIG, config);
36405
+ this.initialize();
36406
+ }
36407
+ initialize() {
36043
36408
  this.pointers = new Map();
36044
36409
  this.initialized = false;
36045
36410
  this.state = WEAVE_COMMENT_TOOL_STATE.IDLE;
@@ -36117,7 +36482,7 @@ var WeaveCommentToolAction = class extends WeaveAction {
36117
36482
  return;
36118
36483
  }
36119
36484
  if (e.code === "Escape" && this.state === WEAVE_COMMENT_TOOL_STATE.CREATING_COMMENT) this.setState(WEAVE_COMMENT_TOOL_STATE.ADDING);
36120
- });
36485
+ }, { signal: this.instance.getEventsController()?.signal });
36121
36486
  stage.on("pointermove", (e) => {
36122
36487
  if (this.state === WEAVE_COMMENT_TOOL_STATE.IDLE) return;
36123
36488
  if (commentNodeHandler?.isCommentViewing()) {
@@ -36268,6 +36633,9 @@ var WeaveVideoToolAction = class extends WeaveAction {
36268
36633
  update = void 0;
36269
36634
  constructor() {
36270
36635
  super();
36636
+ this.initialize();
36637
+ }
36638
+ initialize() {
36271
36639
  this.pointers = new Map();
36272
36640
  this.initialized = false;
36273
36641
  this.state = VIDEO_TOOL_STATE.IDLE;
@@ -36314,7 +36682,7 @@ var WeaveVideoToolAction = class extends WeaveAction {
36314
36682
  this.cancelAction();
36315
36683
  return;
36316
36684
  }
36317
- });
36685
+ }, { signal: this.instance.getEventsController()?.signal });
36318
36686
  stage.on("pointerdown", (e) => {
36319
36687
  this.setTapStart(e);
36320
36688
  this.pointers.set(e.evt.pointerId, {
@@ -36447,6 +36815,9 @@ var WeaveMeasureToolAction = class extends WeaveAction {
36447
36815
  constructor(params) {
36448
36816
  super();
36449
36817
  this.config = mergeExceptArrays(WEAVE_MEASURE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
36818
+ this.initialize();
36819
+ }
36820
+ initialize() {
36450
36821
  this.initialized = false;
36451
36822
  this.state = MEASURE_TOOL_STATE.IDLE;
36452
36823
  this.measureId = null;
@@ -36473,7 +36844,7 @@ var WeaveMeasureToolAction = class extends WeaveAction {
36473
36844
  const stage = this.instance.getStage();
36474
36845
  window.addEventListener("keydown", (e) => {
36475
36846
  if (e.code === "Escape" && this.instance.getActiveAction() === MEASURE_TOOL_ACTION_NAME) this.cancelAction();
36476
- });
36847
+ }, { signal: this.instance.getEventsController()?.signal });
36477
36848
  stage.on("pointermove", () => {
36478
36849
  if (this.state === MEASURE_TOOL_STATE.IDLE) return;
36479
36850
  if (this.state === MEASURE_TOOL_STATE.SET_TO) {
@@ -36743,6 +37114,9 @@ var WeaveConnectorToolAction = class extends WeaveAction {
36743
37114
  constructor(params) {
36744
37115
  super();
36745
37116
  this.config = mergeExceptArrays(CONNECTOR_TOOL_DEFAULT_CONFIG, params?.config);
37117
+ this.initialize();
37118
+ }
37119
+ initialize() {
36746
37120
  this.pointers = new Map();
36747
37121
  this.initialized = false;
36748
37122
  this.tempLineNode = null;
@@ -36781,7 +37155,7 @@ var WeaveConnectorToolAction = class extends WeaveAction {
36781
37155
  return;
36782
37156
  }
36783
37157
  if (e.code === "Escape" && this.instance.getActiveAction() === CONNECTOR_TOOL_ACTION_NAME) this.cancelAction();
36784
- });
37158
+ }, { signal: this.instance.getEventsController()?.signal });
36785
37159
  let nodeHovered = void 0;
36786
37160
  stage.on("pointermove", () => {
36787
37161
  if (!(this.state === CONNECTOR_TOOL_STATE.SELECTING_INITIAL || this.state === CONNECTOR_TOOL_STATE.SELECTING_FINAL)) return;
@@ -37096,10 +37470,6 @@ var WeaveConnectorToolAction = class extends WeaveAction {
37096
37470
  //#endregion
37097
37471
  //#region src/plugins/stage-grid/stage-grid.ts
37098
37472
  var WeaveStageGridPlugin = class extends WeavePlugin {
37099
- actStageZoomX = 1;
37100
- actStageZoomY = 1;
37101
- actStagePosX = 0;
37102
- actStagePosY = 0;
37103
37473
  constructor(params) {
37104
37474
  super();
37105
37475
  const { config } = params ?? {};
@@ -37115,6 +37485,10 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
37115
37485
  this.isMouseMiddleButtonPressed = false;
37116
37486
  this.isSpaceKeyPressed = false;
37117
37487
  this.forceStageChange = false;
37488
+ this.actStagePosX = 0;
37489
+ this.actStagePosY = 0;
37490
+ this.actStageZoomX = 1;
37491
+ this.actStageZoomY = 1;
37118
37492
  }
37119
37493
  getName() {
37120
37494
  return WEAVE_STAGE_GRID_PLUGIN_KEY;
@@ -37139,10 +37513,10 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
37139
37513
  const stage = this.instance.getStage();
37140
37514
  window.addEventListener("keydown", (e) => {
37141
37515
  if (e.code === "Space") this.isSpaceKeyPressed = true;
37142
- });
37516
+ }, { signal: this.instance.getEventsController()?.signal });
37143
37517
  window.addEventListener("keyup", (e) => {
37144
37518
  if (e.code === "Space") this.isSpaceKeyPressed = false;
37145
- });
37519
+ }, { signal: this.instance.getEventsController()?.signal });
37146
37520
  this.instance.addEventListener("onStageMove", () => {
37147
37521
  this.onRender();
37148
37522
  });
@@ -37408,15 +37782,14 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
37408
37782
  //#endregion
37409
37783
  //#region src/plugins/stage-panning/stage-panning.ts
37410
37784
  var WeaveStagePanningPlugin = class extends WeavePlugin {
37411
- panning = false;
37412
- currentPointer = null;
37413
- stageScrollInterval = void 0;
37414
- panEdgeTargets = {};
37415
37785
  getLayerName = void 0;
37416
37786
  initLayer = void 0;
37417
37787
  constructor(params) {
37418
37788
  super();
37419
37789
  this.config = mergeExceptArrays(WEAVE_STAGE_PANNING_DEFAULT_CONFIG, params?.config ?? {});
37790
+ this.initialize();
37791
+ }
37792
+ initialize() {
37420
37793
  this.pointers = new Map();
37421
37794
  this.panning = false;
37422
37795
  this.isDragging = false;
@@ -37428,6 +37801,9 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
37428
37801
  this.isCtrlOrMetaPressed = false;
37429
37802
  this.isSpaceKeyPressed = false;
37430
37803
  this.previousPointer = null;
37804
+ this.currentPointer = null;
37805
+ this.stageScrollInterval = void 0;
37806
+ this.panEdgeTargets = {};
37431
37807
  }
37432
37808
  getName() {
37433
37809
  return WEAVE_STAGE_PANNING_KEY;
@@ -37461,7 +37837,7 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
37461
37837
  this.isSpaceKeyPressed = true;
37462
37838
  this.setCursor();
37463
37839
  }
37464
- });
37840
+ }, { signal: this.instance.getEventsController()?.signal });
37465
37841
  window.addEventListener("keyup", (e) => {
37466
37842
  if (e.key === "Meta" || e.key === "Control") this.isCtrlOrMetaPressed = false;
37467
37843
  if (e.code === "Space") {
@@ -37472,7 +37848,7 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
37472
37848
  this.isSpaceKeyPressed = false;
37473
37849
  this.disableMove();
37474
37850
  }
37475
- });
37851
+ }, { signal: this.instance.getEventsController()?.signal });
37476
37852
  let lastPos = null;
37477
37853
  stage.on("pointerdown", (e) => {
37478
37854
  this.pointers.set(e.evt.pointerId, {
@@ -37545,7 +37921,10 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
37545
37921
  this.instance.emitEvent("onStageMove");
37546
37922
  };
37547
37923
  const handleWheelThrottled = (0, import_lodash.throttle)(handleWheel, WEAVE_STAGE_PANNING_THROTTLE_MS);
37548
- window.addEventListener("wheel", handleWheelThrottled, { passive: true });
37924
+ window.addEventListener("wheel", handleWheelThrottled, {
37925
+ passive: true,
37926
+ signal: this.instance.getEventsController()?.signal
37927
+ });
37549
37928
  stage.on("dragstart", (e) => {
37550
37929
  const duration = 1e3 / 60;
37551
37930
  if (this.panEdgeTargets[e.target.getAttrs().id ?? ""] !== void 0) return;
@@ -37603,7 +37982,10 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
37603
37982
  stage.container().style.setProperty("-webkit-user-drag", "none");
37604
37983
  stage.getContent().addEventListener("touchmove", function(e) {
37605
37984
  e.preventDefault();
37606
- }, { passive: false });
37985
+ }, {
37986
+ passive: false,
37987
+ signal: this.instance.getEventsController()?.signal
37988
+ });
37607
37989
  }
37608
37990
  isPanning() {
37609
37991
  return this.panning;
@@ -37681,6 +38063,9 @@ var WeaveStageMinimapPlugin = class extends WeavePlugin {
37681
38063
  constructor(params) {
37682
38064
  super();
37683
38065
  this.config = mergeExceptArrays(STAGE_MINIMAP_DEFAULT_CONFIG, params.config);
38066
+ this.initialize();
38067
+ }
38068
+ initialize() {
37684
38069
  this.initialized = false;
37685
38070
  }
37686
38071
  getName() {
@@ -37858,6 +38243,7 @@ const WEAVE_STAGE_RESIZE_KEY = "stageResize";
37858
38243
  var WeaveStageResizePlugin = class extends WeavePlugin {
37859
38244
  getLayerName = void 0;
37860
38245
  initLayer = void 0;
38246
+ initialize = void 0;
37861
38247
  getName() {
37862
38248
  return WEAVE_STAGE_RESIZE_KEY;
37863
38249
  }
@@ -37877,6 +38263,10 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
37877
38263
  const pluginInstance = plugins[pluginId];
37878
38264
  pluginInstance.onRender?.();
37879
38265
  }
38266
+ this.instance.emitEvent("onStageResize", {
38267
+ width: stage.width(),
38268
+ height: stage.height()
38269
+ });
37880
38270
  }
37881
38271
  }
37882
38272
  onInit() {
@@ -37885,7 +38275,7 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
37885
38275
  }, DEFAULT_THROTTLE_MS);
37886
38276
  window.addEventListener("resize", () => {
37887
38277
  throttledResize();
37888
- });
38278
+ }, { signal: this.instance.getEventsController()?.signal });
37889
38279
  const resizeObserver = new ResizeObserver(() => {
37890
38280
  throttledResize();
37891
38281
  });
@@ -37903,10 +38293,12 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
37903
38293
  //#endregion
37904
38294
  //#region src/plugins/nodes-multi-selection-feedback/nodes-multi-selection-feedback.ts
37905
38295
  var WeaveNodesMultiSelectionFeedbackPlugin = class extends WeavePlugin {
37906
- selectedHalos = {};
37907
38296
  constructor(params) {
37908
38297
  super();
37909
38298
  this.config = mergeExceptArrays(WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_DEFAULT_CONFIG, params?.config ?? {});
38299
+ this.initialize();
38300
+ }
38301
+ initialize() {
37910
38302
  this.selectedHalos = {};
37911
38303
  }
37912
38304
  getName() {
@@ -38072,12 +38464,14 @@ var WeaveNodesMultiSelectionFeedbackPlugin = class extends WeavePlugin {
38072
38464
  //#endregion
38073
38465
  //#region src/plugins/connected-users/connected-users.ts
38074
38466
  var WeaveConnectedUsersPlugin = class extends WeavePlugin {
38075
- connectedUsers = {};
38076
38467
  getLayerName = void 0;
38077
38468
  constructor(params) {
38078
38469
  super();
38079
38470
  const { config } = params ?? {};
38080
38471
  this.config = config;
38472
+ this.initialize();
38473
+ }
38474
+ initialize() {
38081
38475
  this.connectedUsers = {};
38082
38476
  }
38083
38477
  getName() {
@@ -38124,6 +38518,9 @@ var WeaveUsersSelectionPlugin = class extends WeavePlugin {
38124
38518
  this.config = config;
38125
38519
  this.config.getUser = memoize(this.config.getUser);
38126
38520
  this.config.getUserColor = memoize(this.config.getUserColor);
38521
+ this.initialize();
38522
+ }
38523
+ initialize() {
38127
38524
  this.usersSelection = {};
38128
38525
  }
38129
38526
  getName() {
@@ -38316,6 +38713,9 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
38316
38713
  this.config.getUser = memoize(this.config.getUser);
38317
38714
  this.config.getUserBackgroundColor = memoize(this.config.getUserBackgroundColor);
38318
38715
  this.config.getUserForegroundColor = memoize(this.config.getUserForegroundColor);
38716
+ this.initialize();
38717
+ }
38718
+ initialize() {
38319
38719
  this.usersPointers = {};
38320
38720
  this.usersOperations = {};
38321
38721
  }
@@ -38526,6 +38926,9 @@ var WeaveUsersPresencePlugin = class extends WeavePlugin {
38526
38926
  super();
38527
38927
  const { config } = params;
38528
38928
  this.config = mergeExceptArrays(WEAVE_USERS_PRESENCE_CONFIG_DEFAULT_PROPS, config);
38929
+ this.initialize();
38930
+ }
38931
+ initialize() {
38529
38932
  this.userPresence = {};
38530
38933
  }
38531
38934
  getName() {
@@ -38601,6 +39004,9 @@ var WeaveStageDropAreaPlugin = class extends WeavePlugin {
38601
39004
  initLayer = void 0;
38602
39005
  constructor() {
38603
39006
  super();
39007
+ this.initialize();
39008
+ }
39009
+ initialize() {
38604
39010
  this.enabled = true;
38605
39011
  }
38606
39012
  getName() {
@@ -38614,14 +39020,20 @@ var WeaveStageDropAreaPlugin = class extends WeavePlugin {
38614
39020
  stage.container().addEventListener("dragover", (e) => {
38615
39021
  e.preventDefault();
38616
39022
  e.stopPropagation();
38617
- });
39023
+ }, { signal: this.instance.getEventsController()?.signal });
38618
39024
  stage.container().addEventListener("drop", (e) => {
38619
39025
  e.preventDefault();
38620
39026
  e.stopPropagation();
38621
39027
  this.instance.emitEvent("onStageDrop", e);
39028
+ }, { signal: this.instance.getEventsController()?.signal });
39029
+ window.addEventListener("dragover", (e) => e.preventDefault(), {
39030
+ signal: this.instance.getEventsController()?.signal,
39031
+ passive: false
39032
+ });
39033
+ window.addEventListener("drop", (e) => e.preventDefault(), {
39034
+ signal: this.instance.getEventsController()?.signal,
39035
+ passive: false
38622
39036
  });
38623
- window.addEventListener("dragover", (e) => e.preventDefault(), { passive: false });
38624
- window.addEventListener("drop", (e) => e.preventDefault(), { passive: false });
38625
39037
  }
38626
39038
  enable() {
38627
39039
  this.enabled = true;
@@ -38640,6 +39052,9 @@ var WeaveNodesEdgeSnappingPlugin = class extends WeavePlugin {
38640
39052
  this.guideLineConfig = config?.guideLine ?? GUIDE_LINE_DEFAULT_CONFIG;
38641
39053
  this.dragSnappingThreshold = config?.dragSnappingThreshold ?? GUIDE_LINE_DRAG_SNAPPING_THRESHOLD;
38642
39054
  this.transformSnappingThreshold = config?.transformSnappingThreshold ?? GUIDE_LINE_TRANSFORM_SNAPPING_THRESHOLD;
39055
+ this.initialize();
39056
+ }
39057
+ initialize() {
38643
39058
  this.enabled = true;
38644
39059
  }
38645
39060
  getName() {
@@ -39016,6 +39431,9 @@ var WeaveNodesDistanceSnappingPlugin = class extends WeavePlugin {
39016
39431
  this.enterSnappingTolerance = config?.enterSnappingTolerance ?? GUIDE_ENTER_SNAPPING_TOLERANCE;
39017
39432
  this.exitSnappingTolerance = config?.exitSnappingTolerance ?? GUIDE_EXIT_SNAPPING_TOLERANCE;
39018
39433
  this.uiConfig = mergeExceptArrays(GUIDE_DISTANCE_LINE_DEFAULT_CONFIG, config?.ui);
39434
+ this.initialize();
39435
+ }
39436
+ initialize() {
39019
39437
  this.enabled = true;
39020
39438
  }
39021
39439
  getName() {
@@ -39662,12 +40080,14 @@ var WeaveNodesDistanceSnappingPlugin = class extends WeavePlugin {
39662
40080
  //#endregion
39663
40081
  //#region src/plugins/comments-renderer/comments-renderer.ts
39664
40082
  var WeaveCommentsRendererPlugin = class extends WeavePlugin {
39665
- comments = [];
39666
40083
  getLayerName = void 0;
39667
40084
  constructor(params) {
39668
40085
  super();
39669
40086
  const { config } = params ?? {};
39670
40087
  this.config = config;
40088
+ this.initialize();
40089
+ }
40090
+ initialize() {
39671
40091
  this.comments = [];
39672
40092
  }
39673
40093
  getName() {
@@ -39758,6 +40178,7 @@ const WEAVE_STAGE_KEYBOARD_MOVE_DEFAULT_CONFIG = { movementDelta: 5 };
39758
40178
  var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
39759
40179
  getLayerName = void 0;
39760
40180
  initLayer = void 0;
40181
+ initialize = void 0;
39761
40182
  constructor(params) {
39762
40183
  super();
39763
40184
  this.config = mergeExceptArrays(WEAVE_STAGE_KEYBOARD_MOVE_DEFAULT_CONFIG, params?.config ?? {});
@@ -39796,7 +40217,7 @@ var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
39796
40217
  if (e.code === "ArrowLeft" && e.shiftKey) this.handleNodesMovement("left");
39797
40218
  if (e.code === "ArrowRight" && e.shiftKey) this.handleNodesMovement("right");
39798
40219
  if (e.code === "ArrowDown" && e.shiftKey) this.handleNodesMovement("down");
39799
- });
40220
+ }, { signal: this.instance.getEventsController()?.signal });
39800
40221
  }
39801
40222
  enable() {
39802
40223
  this.enabled = true;
@@ -39818,4 +40239,4 @@ const setupCanvasBackend = async () => {
39818
40239
  };
39819
40240
 
39820
40241
  //#endregion
39821
- export { ALIGN_NODES_ALIGN_TO, ALIGN_NODES_TOOL_ACTION_NAME, ALIGN_NODES_TOOL_STATE, ARROW_TOOL_ACTION_NAME, ARROW_TOOL_STATE, BRUSH_TOOL_ACTION_NAME, BRUSH_TOOL_DEFAULT_CONFIG, BRUSH_TOOL_STATE, CONNECTOR_TOOL_ACTION_NAME, CONNECTOR_TOOL_DEFAULT_CONFIG, CONNECTOR_TOOL_STATE, COPY_PASTE_NODES_PLUGIN_STATE, ELLIPSE_TOOL_ACTION_NAME, ELLIPSE_TOOL_STATE, ERASER_TOOL_ACTION_NAME, ERASER_TOOL_STATE, FRAME_TOOL_ACTION_NAME, FRAME_TOOL_STATE, GUIDE_DISTANCE_LINE_DEFAULT_CONFIG, GUIDE_ENTER_SNAPPING_TOLERANCE, GUIDE_EXIT_SNAPPING_TOLERANCE, GUIDE_HORIZONTAL_LINE_NAME, GUIDE_LINE_DEFAULT_CONFIG, GUIDE_LINE_DRAG_SNAPPING_THRESHOLD, GUIDE_LINE_NAME, GUIDE_LINE_TRANSFORM_SNAPPING_THRESHOLD, GUIDE_ORIENTATION, GUIDE_VERTICAL_LINE_NAME, LINE_TOOL_ACTION_NAME, LINE_TOOL_DEFAULT_CONFIG, LINE_TOOL_STATE, MEASURE_TOOL_ACTION_NAME, MEASURE_TOOL_STATE, MOVE_TOOL_ACTION_NAME, MOVE_TOOL_STATE, NODE_SNAP, NODE_SNAP_HORIZONTAL, NODE_SNAP_VERTICAL, PEN_TOOL_ACTION_NAME, PEN_TOOL_STATE, RECTANGLE_TOOL_ACTION_NAME, RECTANGLE_TOOL_STATE, REGULAR_POLYGON_TOOL_ACTION_NAME, REGULAR_POLYGON_TOOL_STATE, SELECTION_TOOL_ACTION_NAME, SELECTION_TOOL_STATE, STAGE_MINIMAP_DEFAULT_CONFIG, STAR_TOOL_ACTION_NAME, STAR_TOOL_STATE, TEXT_LAYOUT, TEXT_TOOL_ACTION_NAME, TEXT_TOOL_STATE, VIDEO_TOOL_ACTION_NAME, VIDEO_TOOL_STATE, WEAVE_ARROW_NODE_TYPE, WEAVE_COMMENTS_RENDERER_KEY, WEAVE_COMMENTS_TOOL_LAYER_ID, WEAVE_COMMENT_CREATE_ACTION, WEAVE_COMMENT_NODE_ACTION, WEAVE_COMMENT_NODE_DEFAULTS, WEAVE_COMMENT_NODE_TYPE, WEAVE_COMMENT_STATUS, WEAVE_COMMENT_TOOL_ACTION_NAME, WEAVE_COMMENT_TOOL_DEFAULT_CONFIG, WEAVE_COMMENT_TOOL_STATE, WEAVE_COMMENT_VIEW_ACTION, WEAVE_CONNECTOR_NODE_ANCHOR_ORIGIN, WEAVE_CONNECTOR_NODE_DECORATOR_TYPE, WEAVE_CONNECTOR_NODE_DEFAULT_CONFIG, WEAVE_CONNECTOR_NODE_LINE_ORIGIN, WEAVE_CONNECTOR_NODE_LINE_TYPE, WEAVE_CONNECTOR_NODE_TYPE, WEAVE_COPY_PASTE_CONFIG_DEFAULT, WEAVE_COPY_PASTE_NODES_KEY, WEAVE_COPY_PASTE_PASTE_CATCHER_ID, WEAVE_COPY_PASTE_PASTE_MODES, WEAVE_DEFAULT_USER_INFO_FUNCTION, WEAVE_ELLIPSE_NODE_TYPE, WEAVE_FRAME_DEFAULT_BACKGROUND_COLOR, WEAVE_FRAME_NODE_DEFAULT_CONFIG, WEAVE_FRAME_NODE_DEFAULT_PROPS, WEAVE_FRAME_NODE_TYPE, WEAVE_GRID_DEFAULT_CONFIG, WEAVE_GRID_DOT_TYPES, WEAVE_GRID_LAYER_ID, WEAVE_GRID_TYPES, WEAVE_GROUP_NODE_TYPE, WEAVE_IMAGES_TOOL_ACTION_NAME, WEAVE_IMAGES_TOOL_DEFAULT_CONFIG, WEAVE_IMAGES_TOOL_STATE, WEAVE_IMAGES_TOOL_UPLOAD_TYPE, WEAVE_IMAGE_CROP_ANCHOR_POSITION, WEAVE_IMAGE_CROP_END_TYPE, WEAVE_IMAGE_DEFAULT_CONFIG, WEAVE_IMAGE_NODE_TYPE, WEAVE_IMAGE_TOOL_ACTION_NAME, WEAVE_IMAGE_TOOL_CONFIG_DEFAULT, WEAVE_IMAGE_TOOL_STATE, WEAVE_IMAGE_TOOL_UPLOAD_TYPE, WEAVE_LAYER_NODE_TYPE, WEAVE_LINE_NODE_DEFAULT_CONFIG, WEAVE_LINE_NODE_TYPE, WEAVE_MEASURE_NODE_DEFAULT_CONFIG, WEAVE_MEASURE_NODE_TYPE, WEAVE_MEASURE_TOOL_DEFAULT_CONFIG, WEAVE_NODES_DISTANCE_SNAPPING_PLUGIN_KEY, WEAVE_NODES_EDGE_SNAPPING_PLUGIN_KEY, WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_DEFAULT_CONFIG, WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_KEY, WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_LAYER_ID, WEAVE_NODES_SELECTION_DEFAULT_CONFIG, WEAVE_NODES_SELECTION_KEY, WEAVE_NODES_SELECTION_LAYER_ID, WEAVE_RECTANGLE_NODE_TYPE, WEAVE_REGULAR_POLYGON_NODE_TYPE, WEAVE_STAGE_DEFAULT_MODE, WEAVE_STAGE_DROP_AREA_KEY, WEAVE_STAGE_GRID_PLUGIN_KEY, WEAVE_STAGE_IMAGE_CROPPING_MODE, WEAVE_STAGE_KEYBOARD_MOVE_DEFAULT_CONFIG, WEAVE_STAGE_KEYBOARD_MOVE_KEY, WEAVE_STAGE_MINIMAP_KEY, WEAVE_STAGE_NODE_TYPE, WEAVE_STAGE_PANNING_DEFAULT_CONFIG, WEAVE_STAGE_PANNING_KEY, WEAVE_STAGE_PANNING_THROTTLE_MS, WEAVE_STAGE_TEXT_EDITION_MODE, WEAVE_STAGE_ZOOM_DEFAULT_CONFIG, WEAVE_STAGE_ZOOM_KEY, WEAVE_STAGE_ZOOM_TYPE, WEAVE_STAR_NODE_TYPE, WEAVE_STROKE_NODE_DEFAULT_CONFIG, WEAVE_STROKE_NODE_TYPE, WEAVE_STROKE_SINGLE_NODE_DEFAULT_CONFIG, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE, WEAVE_STROKE_SINGLE_NODE_TIP_TYPE, WEAVE_STROKE_SINGLE_NODE_TYPE, WEAVE_STROKE_TOOL_ACTION_NAME, WEAVE_STROKE_TOOL_ACTION_NAME_ALIASES, WEAVE_STROKE_TOOL_DEFAULT_CONFIG, WEAVE_STROKE_TOOL_STATE, WEAVE_TEXT_NODE_DEFAULT_CONFIG, WEAVE_TEXT_NODE_TYPE, WEAVE_USERS_POINTERS_CONFIG_DEFAULT_PROPS, WEAVE_USERS_POINTERS_KEY, WEAVE_USERS_PRESENCE_CONFIG_DEFAULT_PROPS, WEAVE_USERS_PRESENCE_PLUGIN_KEY, WEAVE_USERS_SELECTION_KEY, WEAVE_USER_POINTER_KEY, WEAVE_USER_PRESENCE_KEY, WEAVE_USER_SELECTION_KEY, WEAVE_VIDEO_DEFAULT_CONFIG, WEAVE_VIDEO_NODE_TYPE, Weave, WeaveAction, WeaveAlignNodesToolAction, WeaveArrowNode, WeaveArrowToolAction, WeaveBrushToolAction, WeaveCommentNode, WeaveCommentToolAction, WeaveCommentsRendererPlugin, WeaveConnectedUsersPlugin, WeaveConnectorNode, WeaveConnectorToolAction, WeaveContextMenuPlugin, WeaveCopyPasteNodesPlugin, WeaveEllipseNode, WeaveEllipseToolAction, WeaveEraserToolAction, WeaveExportNodesToolAction, WeaveExportStageToolAction, WeaveFitToScreenToolAction, WeaveFitToSelectionToolAction, WeaveFrameNode, WeaveFrameToolAction, WeaveGroupNode, WeaveImageNode, WeaveImageToolAction, WeaveImagesToolAction, WeaveLayerNode, WeaveLineNode, WeaveLineToolAction, WeaveMeasureNode, WeaveMeasureToolAction, WeaveMoveToolAction, WeaveNode, WeaveNodesDistanceSnappingPlugin, WeaveNodesEdgeSnappingPlugin, WeaveNodesMultiSelectionFeedbackPlugin, WeaveNodesSelectionPlugin, WeavePenToolAction, WeavePlugin, WeaveRectangleNode, WeaveRectangleToolAction, WeaveRegularPolygonNode, WeaveRegularPolygonToolAction, WeaveRenderer, WeaveSelectionToolAction, WeaveStageDropAreaPlugin, WeaveStageGridPlugin, WeaveStageKeyboardMovePlugin, WeaveStageMinimapPlugin, WeaveStageNode, WeaveStagePanningPlugin, WeaveStageResizePlugin, WeaveStageZoomPlugin, WeaveStarNode, WeaveStarToolAction, WeaveStore, WeaveStrokeNode, WeaveStrokeSingleNode, WeaveStrokeToolAction, WeaveTextNode, WeaveTextToolAction, WeaveUsersPointersPlugin, WeaveUsersPresencePlugin, WeaveUsersSelectionPlugin, WeaveVideoNode, WeaveVideoToolAction, WeaveZoomInToolAction, WeaveZoomOutToolAction, canComposite, clearContainerTargets, containerOverCursor, containsNodeDeep, defaultInitialState, downscaleImageFile, downscaleImageFromURL, getBoundingBox, getDownscaleRatio, getExportBoundingBox, getImageSizeFromFile, getPositionRelativeToContainerOnPosition, getSelectedNodesMetadata, getStageClickPoint, getTargetAndSkipNodes, getTargetedNode, getTopmostShadowHost, getVisibleNodes, getVisibleNodesInViewport, hasFrames, hasImages, intersectArrays, isIOS, isInShadowDOM, isNodeInSelection, isServer, loadImageSource, memoize, mergeExceptArrays, moveNodeToContainer, moveNodeToContainerNT, resetScale, setupCanvasBackend, setupSkiaBackend };
40242
+ export { ALIGN_NODES_ALIGN_TO, ALIGN_NODES_TOOL_ACTION_NAME, ALIGN_NODES_TOOL_STATE, BRUSH_TOOL_ACTION_NAME, BRUSH_TOOL_DEFAULT_CONFIG, BRUSH_TOOL_STATE, CONNECTOR_TOOL_ACTION_NAME, CONNECTOR_TOOL_DEFAULT_CONFIG, CONNECTOR_TOOL_STATE, COPY_PASTE_NODES_PLUGIN_STATE, ELLIPSE_TOOL_ACTION_NAME, ELLIPSE_TOOL_STATE, ERASER_TOOL_ACTION_NAME, ERASER_TOOL_STATE, FRAME_TOOL_ACTION_NAME, FRAME_TOOL_STATE, GUIDE_DISTANCE_LINE_DEFAULT_CONFIG, GUIDE_ENTER_SNAPPING_TOLERANCE, GUIDE_EXIT_SNAPPING_TOLERANCE, GUIDE_HORIZONTAL_LINE_NAME, GUIDE_LINE_DEFAULT_CONFIG, GUIDE_LINE_DRAG_SNAPPING_THRESHOLD, GUIDE_LINE_NAME, GUIDE_LINE_TRANSFORM_SNAPPING_THRESHOLD, GUIDE_ORIENTATION, GUIDE_VERTICAL_LINE_NAME, LINE_TOOL_ACTION_NAME, LINE_TOOL_DEFAULT_CONFIG, LINE_TOOL_STATE, MEASURE_TOOL_ACTION_NAME, MEASURE_TOOL_STATE, MOVE_TOOL_ACTION_NAME, MOVE_TOOL_STATE, NODE_SNAP, NODE_SNAP_HORIZONTAL, NODE_SNAP_VERTICAL, PEN_TOOL_ACTION_NAME, PEN_TOOL_STATE, RECTANGLE_TOOL_ACTION_NAME, RECTANGLE_TOOL_STATE, REGULAR_POLYGON_TOOL_ACTION_NAME, REGULAR_POLYGON_TOOL_STATE, SELECTION_TOOL_ACTION_NAME, SELECTION_TOOL_STATE, STAGE_MINIMAP_DEFAULT_CONFIG, STAR_TOOL_ACTION_NAME, STAR_TOOL_STATE, TEXT_LAYOUT, TEXT_TOOL_ACTION_NAME, TEXT_TOOL_STATE, VIDEO_TOOL_ACTION_NAME, VIDEO_TOOL_STATE, WEAVE_ARROW_NODE_TYPE, WEAVE_ARROW_TOOL_ACTION_NAME, WEAVE_ARROW_TOOL_STATE, WEAVE_COMMENTS_RENDERER_KEY, WEAVE_COMMENTS_TOOL_LAYER_ID, WEAVE_COMMENT_CREATE_ACTION, WEAVE_COMMENT_NODE_ACTION, WEAVE_COMMENT_NODE_DEFAULTS, WEAVE_COMMENT_NODE_TYPE, WEAVE_COMMENT_STATUS, WEAVE_COMMENT_TOOL_ACTION_NAME, WEAVE_COMMENT_TOOL_DEFAULT_CONFIG, WEAVE_COMMENT_TOOL_STATE, WEAVE_COMMENT_VIEW_ACTION, WEAVE_CONNECTOR_NODE_ANCHOR_ORIGIN, WEAVE_CONNECTOR_NODE_DECORATOR_TYPE, WEAVE_CONNECTOR_NODE_DEFAULT_CONFIG, WEAVE_CONNECTOR_NODE_LINE_ORIGIN, WEAVE_CONNECTOR_NODE_LINE_TYPE, WEAVE_CONNECTOR_NODE_TYPE, WEAVE_COPY_PASTE_CONFIG_DEFAULT, WEAVE_COPY_PASTE_NODES_KEY, WEAVE_COPY_PASTE_PASTE_CATCHER_ID, WEAVE_COPY_PASTE_PASTE_MODES, WEAVE_DEFAULT_USER_INFO_FUNCTION, WEAVE_ELLIPSE_NODE_TYPE, WEAVE_FRAME_DEFAULT_BACKGROUND_COLOR, WEAVE_FRAME_NODE_DEFAULT_CONFIG, WEAVE_FRAME_NODE_DEFAULT_PROPS, WEAVE_FRAME_NODE_TYPE, WEAVE_GRID_DEFAULT_CONFIG, WEAVE_GRID_DOT_TYPES, WEAVE_GRID_LAYER_ID, WEAVE_GRID_TYPES, WEAVE_GROUP_NODE_TYPE, WEAVE_IMAGES_TOOL_ACTION_NAME, WEAVE_IMAGES_TOOL_DEFAULT_CONFIG, WEAVE_IMAGES_TOOL_STATE, WEAVE_IMAGES_TOOL_UPLOAD_TYPE, WEAVE_IMAGE_CROP_ANCHOR_POSITION, WEAVE_IMAGE_CROP_END_TYPE, WEAVE_IMAGE_DEFAULT_CONFIG, WEAVE_IMAGE_NODE_TYPE, WEAVE_IMAGE_TOOL_ACTION_NAME, WEAVE_IMAGE_TOOL_CONFIG_DEFAULT, WEAVE_IMAGE_TOOL_STATE, WEAVE_IMAGE_TOOL_UPLOAD_TYPE, WEAVE_LAYER_NODE_TYPE, WEAVE_LINE_NODE_DEFAULT_CONFIG, WEAVE_LINE_NODE_TYPE, WEAVE_MEASURE_NODE_DEFAULT_CONFIG, WEAVE_MEASURE_NODE_TYPE, WEAVE_MEASURE_TOOL_DEFAULT_CONFIG, WEAVE_NODES_DISTANCE_SNAPPING_PLUGIN_KEY, WEAVE_NODES_EDGE_SNAPPING_PLUGIN_KEY, WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_DEFAULT_CONFIG, WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_KEY, WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_LAYER_ID, WEAVE_NODES_SELECTION_DEFAULT_CONFIG, WEAVE_NODES_SELECTION_KEY, WEAVE_NODES_SELECTION_LAYER_ID, WEAVE_RECTANGLE_NODE_TYPE, WEAVE_REGULAR_POLYGON_NODE_TYPE, WEAVE_STAGE_DEFAULT_MODE, WEAVE_STAGE_DROP_AREA_KEY, WEAVE_STAGE_GRID_PLUGIN_KEY, WEAVE_STAGE_IMAGE_CROPPING_MODE, WEAVE_STAGE_KEYBOARD_MOVE_DEFAULT_CONFIG, WEAVE_STAGE_KEYBOARD_MOVE_KEY, WEAVE_STAGE_MINIMAP_KEY, WEAVE_STAGE_NODE_TYPE, WEAVE_STAGE_PANNING_DEFAULT_CONFIG, WEAVE_STAGE_PANNING_KEY, WEAVE_STAGE_PANNING_THROTTLE_MS, WEAVE_STAGE_TEXT_EDITION_MODE, WEAVE_STAGE_ZOOM_DEFAULT_CONFIG, WEAVE_STAGE_ZOOM_KEY, WEAVE_STAGE_ZOOM_TYPE, WEAVE_STAR_NODE_TYPE, WEAVE_STROKE_NODE_DEFAULT_CONFIG, WEAVE_STROKE_NODE_TYPE, WEAVE_STROKE_SINGLE_NODE_DEFAULT_CONFIG, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE, WEAVE_STROKE_SINGLE_NODE_TIP_TYPE, WEAVE_STROKE_SINGLE_NODE_TYPE, WEAVE_STROKE_TOOL_ACTION_NAME, WEAVE_STROKE_TOOL_ACTION_NAME_ALIASES, WEAVE_STROKE_TOOL_DEFAULT_CONFIG, WEAVE_STROKE_TOOL_STATE, WEAVE_TEXT_NODE_DEFAULT_CONFIG, WEAVE_TEXT_NODE_TYPE, WEAVE_USERS_POINTERS_CONFIG_DEFAULT_PROPS, WEAVE_USERS_POINTERS_KEY, WEAVE_USERS_PRESENCE_CONFIG_DEFAULT_PROPS, WEAVE_USERS_PRESENCE_PLUGIN_KEY, WEAVE_USERS_SELECTION_KEY, WEAVE_USER_POINTER_KEY, WEAVE_USER_PRESENCE_KEY, WEAVE_USER_SELECTION_KEY, WEAVE_VIDEO_DEFAULT_CONFIG, WEAVE_VIDEO_NODE_TYPE, Weave, WeaveAction, WeaveAlignNodesToolAction, WeaveArrowNode, WeaveArrowToolAction, WeaveBrushToolAction, WeaveCommentNode, WeaveCommentToolAction, WeaveCommentsRendererPlugin, WeaveConnectedUsersPlugin, WeaveConnectorNode, WeaveConnectorToolAction, WeaveContextMenuPlugin, WeaveCopyPasteNodesPlugin, WeaveEllipseNode, WeaveEllipseToolAction, WeaveEraserToolAction, WeaveExportNodesToolAction, WeaveExportStageToolAction, WeaveFitToScreenToolAction, WeaveFitToSelectionToolAction, WeaveFrameNode, WeaveFrameToolAction, WeaveGroupNode, WeaveImageNode, WeaveImageToolAction, WeaveImagesToolAction, WeaveLayerNode, WeaveLineNode, WeaveLineToolAction, WeaveMeasureNode, WeaveMeasureToolAction, WeaveMoveToolAction, WeaveNode, WeaveNodesDistanceSnappingPlugin, WeaveNodesEdgeSnappingPlugin, WeaveNodesMultiSelectionFeedbackPlugin, WeaveNodesSelectionPlugin, WeavePenToolAction, WeavePlugin, WeaveRectangleNode, WeaveRectangleToolAction, WeaveRegularPolygonNode, WeaveRegularPolygonToolAction, WeaveRenderer, WeaveSelectionToolAction, WeaveStageDropAreaPlugin, WeaveStageGridPlugin, WeaveStageKeyboardMovePlugin, WeaveStageMinimapPlugin, WeaveStageNode, WeaveStagePanningPlugin, WeaveStageResizePlugin, WeaveStageZoomPlugin, WeaveStarNode, WeaveStarToolAction, WeaveStore, WeaveStrokeNode, WeaveStrokeSingleNode, WeaveStrokeToolAction, WeaveTextNode, WeaveTextToolAction, WeaveUsersPointersPlugin, WeaveUsersPresencePlugin, WeaveUsersSelectionPlugin, WeaveVideoNode, WeaveVideoToolAction, WeaveZoomInToolAction, WeaveZoomOutToolAction, canComposite, clearContainerTargets, containerOverCursor, containsNodeDeep, defaultInitialState, downscaleImageFile, downscaleImageFromURL, getBoundingBox, getDownscaleRatio, getExportBoundingBox, getImageSizeFromFile, getPositionRelativeToContainerOnPosition, getSelectedNodesMetadata, getStageClickPoint, getTargetAndSkipNodes, getTargetedNode, getTopmostShadowHost, getVisibleNodes, getVisibleNodesInViewport, hasFrames, hasImages, intersectArrays, isIOS, isInShadowDOM, isNodeInSelection, isServer, loadImageSource, memoize, mergeExceptArrays, moveNodeToContainer, moveNodeToContainerNT, resetScale, setupCanvasBackend, setupSkiaBackend };