@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/types.js CHANGED
@@ -15084,6 +15084,11 @@ var WeaveStore = class {
15084
15084
  getDocument() {
15085
15085
  return this.document;
15086
15086
  }
15087
+ restartDocument() {
15088
+ this.latestState = { weave: {} };
15089
+ this.state = syncedStore({ weave: {} });
15090
+ this.document = getYjsDoc(this.state);
15091
+ }
15087
15092
  loadDocument(roomData) {
15088
15093
  yjs_default.applyUpdate(this.document, roomData);
15089
15094
  }
@@ -17959,6 +17964,15 @@ var WeaveContextMenuPlugin = class extends WeavePlugin {
17959
17964
  initLayer = void 0;
17960
17965
  constructor(params) {
17961
17966
  super();
17967
+ const { config } = params ?? {};
17968
+ this.config = {
17969
+ xOffset: WEAVE_CONTEXT_MENU_X_OFFSET_DEFAULT,
17970
+ yOffset: WEAVE_CONTEXT_MENU_Y_OFFSET_DEFAULT,
17971
+ ...config
17972
+ };
17973
+ this.initialize();
17974
+ }
17975
+ initialize() {
17962
17976
  this.timer = null;
17963
17977
  this.tapHold = false;
17964
17978
  this.contextMenuVisible = false;
@@ -17968,12 +17982,6 @@ var WeaveContextMenuPlugin = class extends WeavePlugin {
17968
17982
  time: 0
17969
17983
  };
17970
17984
  this.tapHoldTimeout = WEAVE_CONTEXT_MENU_TAP_HOLD_TIMEOUT;
17971
- const { config } = params ?? {};
17972
- this.config = {
17973
- xOffset: WEAVE_CONTEXT_MENU_X_OFFSET_DEFAULT,
17974
- yOffset: WEAVE_CONTEXT_MENU_Y_OFFSET_DEFAULT,
17975
- ...config
17976
- };
17977
17985
  this.pointers = {};
17978
17986
  }
17979
17987
  getName() {
@@ -18624,7 +18632,10 @@ const DEFAULT_ADD_NODE_OPTIONS = { emitUserChangeEvent: false };
18624
18632
  const DEFAULT_UPDATE_NODE_OPTIONS = { emitUserChangeEvent: false };
18625
18633
  const DEFAULT_REMOVE_NODE_OPTIONS = { emitUserChangeEvent: false };
18626
18634
  const DEFAULT_MOVE_NODE_OPTIONS = { emitUserChangeEvent: false };
18627
- const WEAVE_DEFAULT_CONFIG = { behaviors: { axisLockThreshold: 5 } };
18635
+ const WEAVE_DEFAULT_CONFIG = {
18636
+ behaviors: { axisLockThreshold: 5 },
18637
+ performance: { upscale: { enabled: false } }
18638
+ };
18628
18639
 
18629
18640
  //#endregion
18630
18641
  //#region src/plugins/users-presence/constants.ts
@@ -18653,6 +18664,9 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
18653
18664
  constructor(params) {
18654
18665
  super();
18655
18666
  this.config = mergeExceptArrays(WEAVE_NODES_SELECTION_DEFAULT_CONFIG, params?.config ?? {});
18667
+ this.initialize();
18668
+ }
18669
+ initialize() {
18656
18670
  this.defaultEnabledAnchors = this.config.selection?.enabledAnchors ?? [
18657
18671
  "top-left",
18658
18672
  "top-center",
@@ -18816,7 +18830,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
18816
18830
  nodeHovered = void 0;
18817
18831
  }
18818
18832
  this.instance.getStage().handleMouseover?.();
18819
- });
18833
+ }, { signal: this.instance.getEventsController()?.signal });
18820
18834
  const handleTransform = (e) => {
18821
18835
  const moved = this.checkMoved(e);
18822
18836
  if (moved) this.getContextMenuPlugin()?.cancelLongPressTimer();
@@ -19231,11 +19245,11 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
19231
19245
  });
19232
19246
  return;
19233
19247
  }
19234
- });
19248
+ }, { signal: this.instance.getEventsController()?.signal });
19235
19249
  stage.container().addEventListener("keyup", (e) => {
19236
19250
  if (!(e.ctrlKey || e.metaKey)) this.isCtrlMetaPressed = false;
19237
19251
  if (e.code === "Space") this.isSpaceKeyPressed = false;
19238
- });
19252
+ }, { signal: this.instance.getEventsController()?.signal });
19239
19253
  stage.on("pointerdown", (e) => {
19240
19254
  this.setTapStart(e);
19241
19255
  this.handledClickOrTap = false;
@@ -19442,7 +19456,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
19442
19456
  if (existNode) newSelectedNodes.push(existNode);
19443
19457
  }
19444
19458
  this.tr.nodes([...newSelectedNodes]);
19445
- this.tr.forceUpdate();
19459
+ if (newSelectedNodes.length > 0) this.tr.forceUpdate();
19446
19460
  this.triggerSelectedNodesEvent();
19447
19461
  }
19448
19462
  getSelectionPlugin() {
@@ -19695,6 +19709,9 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
19695
19709
  super();
19696
19710
  this.getImageBase64 = params.getImageBase64;
19697
19711
  this.config = mergeExceptArrays(WEAVE_COPY_PASTE_CONFIG_DEFAULT, params?.config);
19712
+ this.initialize();
19713
+ }
19714
+ initialize() {
19698
19715
  this.actualInternalPaddingX = 0;
19699
19716
  this.actualInternalPaddingY = 0;
19700
19717
  this.lastInternalPasteSnapshot = "";
@@ -19800,7 +19817,7 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
19800
19817
  this.focusPasteCatcher();
19801
19818
  if (!this.enabled) return;
19802
19819
  }
19803
- });
19820
+ }, { signal: this.instance.getEventsController()?.signal });
19804
19821
  if (catcher) catcher.addEventListener("paste", async (e) => {
19805
19822
  e.preventDefault();
19806
19823
  let items = void 0;
@@ -19819,7 +19836,7 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
19819
19836
  return;
19820
19837
  }
19821
19838
  this.sendExternalPasteEvent(void 0, items);
19822
- });
19839
+ }, { signal: this.instance.getEventsController()?.signal });
19823
19840
  }
19824
19841
  sendExternalPasteEvent(dataList, items) {
19825
19842
  const stage = this.instance.getStage();
@@ -21985,11 +22002,34 @@ var WeaveRegisterManager = class {
21985
22002
  }
21986
22003
  }
21987
22004
  }
22005
+ resetNodesHandlers() {
22006
+ for (const nodeHandlerId of Object.keys(this.nodesHandlers)) {
22007
+ const nodeHandler = this.nodesHandlers[nodeHandlerId];
22008
+ nodeHandler.initialize?.();
22009
+ }
22010
+ }
22011
+ resetActionsHandlers() {
22012
+ for (const actionHandlerId of Object.keys(this.actionsHandlers)) {
22013
+ const actionHandler = this.actionsHandlers[actionHandlerId];
22014
+ actionHandler.initialize?.();
22015
+ }
22016
+ }
22017
+ resetPlugins() {
22018
+ for (const pluginId of Object.keys(this.plugins)) {
22019
+ const plugin = this.plugins[pluginId];
22020
+ plugin.initialize?.();
22021
+ }
22022
+ }
22023
+ reset() {
22024
+ this.resetNodesHandlers();
22025
+ this.resetActionsHandlers();
22026
+ this.resetPlugins();
22027
+ }
21988
22028
  };
21989
22029
 
21990
22030
  //#endregion
21991
22031
  //#region package.json
21992
- var version = "3.5.0";
22032
+ var version = "3.6.0-SNAPSHOT.112.1";
21993
22033
 
21994
22034
  //#endregion
21995
22035
  //#region src/managers/setup.ts
@@ -22106,6 +22146,11 @@ var WeaveStageManager = class {
22106
22146
  initialZIndex: void 0
22107
22147
  };
22108
22148
  const stage = new Konva.Stage({ ...props });
22149
+ if (!this.instance.isServerSide()) {
22150
+ const containerParent = stage.container().parentNode;
22151
+ stage.width(containerParent.clientWidth);
22152
+ stage.height(containerParent.clientHeight);
22153
+ }
22109
22154
  const realContainer = stage.container();
22110
22155
  if (realContainer !== void 0 && realContainer.style?.position !== "relative") realContainer.style.position = "relative";
22111
22156
  this.setStage(stage);
@@ -22238,6 +22283,10 @@ var WeaveExportManager = class {
22238
22283
  exportNodesAsImage(nodes, boundingNodes, options) {
22239
22284
  return new Promise((resolve) => {
22240
22285
  const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
22286
+ const nodesSelectionPluginPrev = this.getNodesSelectionPlugin()?.isEnabled();
22287
+ const nodesDistanceSnappingPluginPrev = this.getNodesDistanceSnappingPlugin()?.isEnabled();
22288
+ const nodesEdgeSnappingPluginPrev = this.getNodesDistanceSnappingPlugin()?.isEnabled();
22289
+ const nodesStageGridPluginPrev = this.getStageGridPlugin()?.isEnabled();
22241
22290
  this.getNodesSelectionPlugin()?.disable();
22242
22291
  this.getNodesDistanceSnappingPlugin()?.disable();
22243
22292
  this.getNodesEdgeSnappingPlugin()?.disable();
@@ -22302,16 +22351,80 @@ var WeaveExportManager = class {
22302
22351
  stage.position(originalPosition);
22303
22352
  stage.scale(originalScale);
22304
22353
  stage.batchDraw();
22305
- this.getNodesSelectionPlugin()?.enable();
22306
- this.getNodesDistanceSnappingPlugin()?.enable();
22307
- this.getNodesEdgeSnappingPlugin()?.enable();
22308
- this.getStageGridPlugin()?.enable();
22354
+ if (nodesSelectionPluginPrev) this.getNodesSelectionPlugin()?.enable();
22355
+ if (nodesDistanceSnappingPluginPrev) this.getNodesDistanceSnappingPlugin()?.enable();
22356
+ if (nodesEdgeSnappingPluginPrev) this.getNodesEdgeSnappingPlugin()?.enable();
22357
+ if (nodesStageGridPluginPrev) this.getStageGridPlugin()?.enable();
22309
22358
  resolve(img);
22310
22359
  }
22311
22360
  });
22312
22361
  }
22313
22362
  });
22314
22363
  }
22364
+ exportAreaAsImage(area, options) {
22365
+ return new Promise((resolve) => {
22366
+ const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
22367
+ const nodesSelectionPluginPrev = this.getNodesSelectionPlugin()?.isEnabled();
22368
+ const nodesDistanceSnappingPluginPrev = this.getNodesDistanceSnappingPlugin()?.isEnabled();
22369
+ const nodesEdgeSnappingPluginPrev = this.getNodesDistanceSnappingPlugin()?.isEnabled();
22370
+ const nodesStageGridPluginPrev = this.getStageGridPlugin()?.isEnabled();
22371
+ this.getNodesSelectionPlugin()?.disable();
22372
+ this.getNodesDistanceSnappingPlugin()?.disable();
22373
+ this.getNodesEdgeSnappingPlugin()?.disable();
22374
+ this.getStageGridPlugin()?.disable();
22375
+ const stage = this.instance.getStage();
22376
+ const mainLayer = this.instance.getMainLayer();
22377
+ if (!mainLayer) throw new Error("Main layer not found");
22378
+ const originalPosition = {
22379
+ x: stage.x(),
22380
+ y: stage.y()
22381
+ };
22382
+ const originalScale = {
22383
+ x: stage.scaleX(),
22384
+ y: stage.scaleY()
22385
+ };
22386
+ stage.scale({
22387
+ x: 1,
22388
+ y: 1
22389
+ });
22390
+ stage.position({
22391
+ x: 0,
22392
+ y: 0
22393
+ });
22394
+ const bounds = area;
22395
+ const background = new Konva.Rect({
22396
+ x: bounds.x - padding,
22397
+ y: bounds.y - padding,
22398
+ width: bounds.width + 2 * padding,
22399
+ height: bounds.height + 2 * padding,
22400
+ strokeWidth: 0,
22401
+ fill: backgroundColor
22402
+ });
22403
+ mainLayer.add(background);
22404
+ background.moveToBottom();
22405
+ stage.batchDraw();
22406
+ stage.toImage({
22407
+ x: area.x,
22408
+ y: area.y,
22409
+ width: area.width,
22410
+ height: area.height,
22411
+ mimeType: format,
22412
+ pixelRatio,
22413
+ quality: options.quality ?? 1,
22414
+ callback: (img) => {
22415
+ background.destroy();
22416
+ stage.position(originalPosition);
22417
+ stage.scale(originalScale);
22418
+ stage.batchDraw();
22419
+ if (nodesSelectionPluginPrev) this.getNodesSelectionPlugin()?.enable();
22420
+ if (nodesDistanceSnappingPluginPrev) this.getNodesDistanceSnappingPlugin()?.enable();
22421
+ if (nodesEdgeSnappingPluginPrev) this.getNodesEdgeSnappingPlugin()?.enable();
22422
+ if (nodesStageGridPluginPrev) this.getStageGridPlugin()?.enable();
22423
+ resolve(img);
22424
+ }
22425
+ });
22426
+ });
22427
+ }
22315
22428
  async exportNodesServerSide(nodes, boundingNodes, options) {
22316
22429
  const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
22317
22430
  this.getNodesSelectionPlugin()?.disable();
@@ -22414,6 +22527,91 @@ var WeaveExportManager = class {
22414
22527
  height: imageHeight * pixelRatio
22415
22528
  };
22416
22529
  }
22530
+ async exportAreaServerSide(area, options) {
22531
+ const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
22532
+ this.getNodesSelectionPlugin()?.disable();
22533
+ this.getNodesDistanceSnappingPlugin()?.disable();
22534
+ this.getNodesEdgeSnappingPlugin()?.disable();
22535
+ this.getStageGridPlugin()?.disable();
22536
+ const stage = this.instance.getStage();
22537
+ const mainLayer = this.instance.getMainLayer();
22538
+ if (!mainLayer) throw new Error("Main layer not found");
22539
+ const originalPosition = {
22540
+ x: stage.x(),
22541
+ y: stage.y()
22542
+ };
22543
+ const originalScale = {
22544
+ x: stage.scaleX(),
22545
+ y: stage.scaleY()
22546
+ };
22547
+ stage.scale({
22548
+ x: 1,
22549
+ y: 1
22550
+ });
22551
+ const bounds = area;
22552
+ const scaleX = stage.scaleX();
22553
+ const scaleY = stage.scaleY();
22554
+ const unscaledBounds = {
22555
+ x: bounds.x / scaleX,
22556
+ y: bounds.y / scaleY,
22557
+ width: bounds.width / scaleX,
22558
+ height: bounds.height / scaleY
22559
+ };
22560
+ const background = new Konva.Rect({
22561
+ x: unscaledBounds.x - padding,
22562
+ y: unscaledBounds.y - padding,
22563
+ width: unscaledBounds.width + 2 * padding,
22564
+ height: unscaledBounds.height + 2 * padding,
22565
+ strokeWidth: 0,
22566
+ fill: backgroundColor
22567
+ });
22568
+ mainLayer.add(background);
22569
+ background.moveToBottom();
22570
+ const backgroundRect = background.getClientRect({ relativeTo: stage });
22571
+ const composites = [];
22572
+ const imageWidth = Math.round(backgroundRect.width);
22573
+ const imageHeight = Math.round(backgroundRect.height);
22574
+ const maxRenderSize = 1920;
22575
+ const cols = Math.ceil(imageWidth / maxRenderSize);
22576
+ const rows = Math.ceil(imageHeight / maxRenderSize);
22577
+ const tileWidth = Math.floor(imageWidth / cols);
22578
+ const tileHeight = Math.floor(imageHeight / rows);
22579
+ for (let y = 0; y < imageHeight; y += tileHeight) for (let x = 0; x < imageWidth; x += tileWidth) {
22580
+ const width = Math.min(tileWidth, imageWidth - x);
22581
+ const height = Math.min(tileHeight, imageHeight - y);
22582
+ const canvas = await mainLayer.toCanvas({
22583
+ x: Math.round(backgroundRect.x) + x,
22584
+ y: Math.round(backgroundRect.y) + y,
22585
+ width,
22586
+ height,
22587
+ mimeType: format,
22588
+ pixelRatio,
22589
+ quality: options.quality ?? 1
22590
+ });
22591
+ let buffer = null;
22592
+ if (globalThis._weave_serverSideBackend === WEAVE_KONVA_BACKEND.CANVAS) buffer = canvas.toBuffer();
22593
+ if (globalThis._weave_serverSideBackend === WEAVE_KONVA_BACKEND.SKIA) buffer = await canvas.toBuffer();
22594
+ if (!buffer) throw new Error("Failed to generate image buffer");
22595
+ composites.push({
22596
+ top: y * pixelRatio,
22597
+ left: x * pixelRatio,
22598
+ input: buffer
22599
+ });
22600
+ }
22601
+ background.destroy();
22602
+ stage.position(originalPosition);
22603
+ stage.scale(originalScale);
22604
+ stage.batchDraw();
22605
+ this.getNodesSelectionPlugin()?.enable();
22606
+ this.getNodesDistanceSnappingPlugin()?.enable();
22607
+ this.getNodesEdgeSnappingPlugin()?.enable();
22608
+ this.getStageGridPlugin()?.enable();
22609
+ return {
22610
+ composites,
22611
+ width: imageWidth * pixelRatio,
22612
+ height: imageHeight * pixelRatio
22613
+ };
22614
+ }
22417
22615
  imageToBase64(img, mimeType) {
22418
22616
  if (img.naturalWidth === 0 && img.naturalHeight === 0) throw new Error("Image has no content");
22419
22617
  const canvas = document.createElement("canvas");
@@ -22693,7 +22891,12 @@ var WeaveAsyncManager = class {
22693
22891
  this.instance.emitEvent("onAsyncElementChange");
22694
22892
  }, new Map());
22695
22893
  }
22894
+ reset() {
22895
+ this.asyncElements.clear();
22896
+ this.asyncElementsLoadedEventEmitted = false;
22897
+ }
22696
22898
  checkForAsyncElements(elements) {
22899
+ this.instance.emitEvent("onAsyncElementsIdle");
22697
22900
  const amountAsyncResourcesExtracted = this.extractAsyncResources(elements);
22698
22901
  if (amountAsyncResourcesExtracted === 0 && !this.asyncElementsLoadedEventEmitted) {
22699
22902
  this.instance.emitEvent("onAsyncElementsLoaded");
@@ -22746,7 +22949,7 @@ var WeaveAsyncManager = class {
22746
22949
  status: WEAVE_ASYNC_STATUS.LOADING
22747
22950
  };
22748
22951
  this.asyncElements.set(nodeId, element);
22749
- this.instance.emitEvent("onAsyncElementsLoading", {
22952
+ if (!this.asyncElementsLoadedEventEmitted) this.instance.emitEvent("onAsyncElementsLoading", {
22750
22953
  loaded: this.getAmountAsyncElementsLoaded(),
22751
22954
  total: this.getAmountAsyncElements()
22752
22955
  });
@@ -22759,11 +22962,11 @@ var WeaveAsyncManager = class {
22759
22962
  status: WEAVE_ASYNC_STATUS.LOADED
22760
22963
  };
22761
22964
  this.asyncElements.set(nodeId, element);
22762
- this.instance.emitEvent("onAsyncElementsLoading", {
22763
- loaded: this.getAmountAsyncElementsLoaded(),
22764
- total: this.getAmountAsyncElements()
22765
- });
22766
22965
  if (!this.asyncElementsLoadedEventEmitted) {
22966
+ this.instance.emitEvent("onAsyncElementsLoading", {
22967
+ loaded: this.getAmountAsyncElementsLoaded(),
22968
+ total: this.getAmountAsyncElements()
22969
+ });
22767
22970
  const allLoaded = this.asyncElementsLoaded();
22768
22971
  if (allLoaded) {
22769
22972
  this.instance.emitEvent("onAsyncElementsLoaded");
@@ -22888,6 +23091,7 @@ var Weave = class {
22888
23091
  constructor(weaveConfig, stageConfig) {
22889
23092
  globalThis._weave_isServerSide = false;
22890
23093
  if (typeof window === "undefined") globalThis._weave_isServerSide = true;
23094
+ this.eventsController = void 0;
22891
23095
  this.emitter = new Emittery();
22892
23096
  Konva.showWarnings = false;
22893
23097
  this.id = v4_default();
@@ -22933,6 +23137,7 @@ var Weave = class {
22933
23137
  this.initialized = true;
22934
23138
  this.status = WEAVE_INSTANCE_STATUS.RUNNING;
22935
23139
  this.emitEvent("onInstanceStatus", this.status);
23140
+ this.emitEvent("onRender");
22936
23141
  });
22937
23142
  }
22938
23143
  setStatus(status) {
@@ -22957,6 +23162,7 @@ var Weave = class {
22957
23162
  async start() {
22958
23163
  this.moduleLogger.info("Start instance");
22959
23164
  if (!this.isServerSide()) {
23165
+ this.eventsController = new AbortController();
22960
23166
  if (!window.weave) window.weave = this;
22961
23167
  }
22962
23168
  this.emitEvent("onRoomLoaded", false);
@@ -22980,8 +23186,39 @@ var Weave = class {
22980
23186
  store.setup();
22981
23187
  store.connect();
22982
23188
  }
23189
+ async switchRoom() {
23190
+ this.moduleLogger.info(`Switching room`);
23191
+ const nodeHandlers = this.registerManager.getNodesHandlers();
23192
+ for (const nodeHandlerKey of Object.keys(nodeHandlers)) {
23193
+ const nodeHandler = nodeHandlers[nodeHandlerKey];
23194
+ nodeHandler?.onDestroyInstance();
23195
+ }
23196
+ const stage = this.getStage();
23197
+ if (stage) stage.destroy();
23198
+ if (this.eventsController) this.eventsController.abort();
23199
+ if (!this.isServerSide()) this.eventsController = new AbortController();
23200
+ this.registerManager.reset();
23201
+ this.asyncManager.reset();
23202
+ this.moduleLogger.info("Switching room instance");
23203
+ if (!this.isServerSide()) {
23204
+ if (!window.weave) window.weave = this;
23205
+ }
23206
+ this.emitEvent("onRoomLoaded", false);
23207
+ this.status = WEAVE_INSTANCE_STATUS.STARTING;
23208
+ this.emitEvent("onInstanceStatus", this.status);
23209
+ this.registerManager.reset();
23210
+ this.status = WEAVE_INSTANCE_STATUS.LOADING_FONTS;
23211
+ this.emitEvent("onInstanceStatus", this.status);
23212
+ await this.fontsManager.loadFonts();
23213
+ this.setupManager.setupLog();
23214
+ this.stageManager.initStage();
23215
+ this.status = WEAVE_INSTANCE_STATUS.CONNECTING_TO_ROOM;
23216
+ this.emitEvent("onInstanceStatus", this.status);
23217
+ this.addEventListener("onStoreConnectionStatusChange", this.handleStoreConnectionStatusChange.bind(this));
23218
+ }
22983
23219
  destroy() {
22984
23220
  this.moduleLogger.info(`Destroying the instance`);
23221
+ if (this.eventsController) this.eventsController.abort();
22985
23222
  this.emitter.clearListeners();
22986
23223
  this.status = WEAVE_INSTANCE_STATUS.IDLE;
22987
23224
  this.emitEvent("onInstanceStatus", this.status);
@@ -23451,9 +23688,15 @@ var Weave = class {
23451
23688
  async exportNodesServerSide(nodes, boundingNodes, options) {
23452
23689
  return await this.exportManager.exportNodesServerSide(nodes, boundingNodes, options);
23453
23690
  }
23691
+ async exportAreaServerSide(area, options) {
23692
+ return await this.exportManager.exportAreaServerSide(area, options);
23693
+ }
23454
23694
  async exportNodes(nodes, boundingNodes, options) {
23455
23695
  return await this.exportManager.exportNodesAsImage(nodes, boundingNodes, options);
23456
23696
  }
23697
+ async exportArea(area, options) {
23698
+ return await this.exportManager.exportAreaAsImage(area, options);
23699
+ }
23457
23700
  getExportBoundingBox(nodesIds) {
23458
23701
  const nodes = [];
23459
23702
  for (const nodeId of nodesIds) {
@@ -23616,6 +23859,9 @@ var Weave = class {
23616
23859
  getDragProperties() {
23617
23860
  return this.dragAndDropManager.getDragProperties();
23618
23861
  }
23862
+ getEventsController() {
23863
+ return this.eventsController;
23864
+ }
23619
23865
  };
23620
23866
 
23621
23867
  //#endregion
@@ -23707,6 +23953,7 @@ const downscaleImageFromURL = (url, options) => {
23707
23953
  //#endregion
23708
23954
  //#region src/internal-utils/upscale.ts
23709
23955
  const setupUpscaleStage = (instance, stage) => {
23956
+ if (instance.isServerSide()) return;
23710
23957
  const config = instance.getConfiguration();
23711
23958
  const doUpscale = config.performance?.upscale?.enabled ?? false;
23712
23959
  if (doUpscale) {
@@ -23738,7 +23985,14 @@ const setupUpscaleStage = (instance, stage) => {
23738
23985
  innerElement.style.transformOrigin = "0 0";
23739
23986
  innerElement.style.transform = `scale(${scaleToCover})`;
23740
23987
  }
23741
- } else stage.setAttrs({ upscaleScale: 1 });
23988
+ } else {
23989
+ const realContainer = stage.container();
23990
+ const containerWidth = realContainer.offsetWidth;
23991
+ const containerHeight = realContainer.offsetHeight;
23992
+ stage.width(containerWidth);
23993
+ stage.height(containerHeight);
23994
+ stage.setAttrs({ upscaleScale: 1 });
23995
+ }
23742
23996
  };
23743
23997
 
23744
23998
  //#endregion
@@ -23749,6 +24003,7 @@ var WeaveStageNode = class extends WeaveNode {
23749
24003
  wheelMousePressed = false;
23750
24004
  isCmdCtrlPressed = false;
23751
24005
  globalEventsInitialized = false;
24006
+ initialize = void 0;
23752
24007
  onRender(props) {
23753
24008
  const stage = new Konva.Stage({
23754
24009
  ...props,
@@ -23767,10 +24022,10 @@ var WeaveStageNode = class extends WeaveNode {
23767
24022
  container.setAttribute("tabindex", "0");
23768
24023
  stage.container().addEventListener("focus", () => {
23769
24024
  this.stageFocused = true;
23770
- });
24025
+ }, { signal: this.instance.getEventsController()?.signal });
23771
24026
  stage.container().addEventListener("blur", () => {
23772
24027
  this.stageFocused = false;
23773
- });
24028
+ }, { signal: this.instance.getEventsController()?.signal });
23774
24029
  }
23775
24030
  Konva.Stage.prototype.mode = function(mode) {
23776
24031
  if (typeof mode !== "undefined") this._mode = mode;
@@ -23840,7 +24095,7 @@ var WeaveStageNode = class extends WeaveNode {
23840
24095
  const selectedNode = transformer.nodes()[0];
23841
24096
  selectedNode.fire("onCmdCtrlPressed");
23842
24097
  }
23843
- });
24098
+ }, { signal: this.instance.getEventsController()?.signal });
23844
24099
  window.addEventListener("keyup", (e) => {
23845
24100
  if (!(e.ctrlKey || e.metaKey)) {
23846
24101
  this.isCmdCtrlPressed = false;
@@ -23851,7 +24106,7 @@ var WeaveStageNode = class extends WeaveNode {
23851
24106
  const selectedNode = transformer.nodes()[0];
23852
24107
  selectedNode.fire("onCmdCtrlReleased");
23853
24108
  }
23854
- });
24109
+ }, { signal: this.instance.getEventsController()?.signal });
23855
24110
  this.globalEventsInitialized = true;
23856
24111
  }
23857
24112
  isOnlyCtrlOrMeta(event) {
@@ -23871,6 +24126,7 @@ const WEAVE_LAYER_NODE_TYPE = "layer";
23871
24126
  //#region src/nodes/layer/layer.ts
23872
24127
  var WeaveLayerNode = class extends WeaveNode {
23873
24128
  nodeType = WEAVE_LAYER_NODE_TYPE;
24129
+ initialize = void 0;
23874
24130
  onRender(props) {
23875
24131
  const layer = new Konva.Layer({ ...props });
23876
24132
  layer.canMoveToContainer = function() {
@@ -23918,6 +24174,7 @@ const WEAVE_GROUP_NODE_TYPE = "group";
23918
24174
  //#region src/nodes/group/group.ts
23919
24175
  var WeaveGroupNode = class extends WeaveNode {
23920
24176
  nodeType = WEAVE_GROUP_NODE_TYPE;
24177
+ initialize = void 0;
23921
24178
  constructor(params) {
23922
24179
  super();
23923
24180
  const { config } = params ?? {};
@@ -24010,6 +24267,7 @@ const WEAVE_RECTANGLE_NODE_TYPE = "rectangle";
24010
24267
  //#region src/nodes/rectangle/rectangle.ts
24011
24268
  var WeaveRectangleNode = class extends WeaveNode {
24012
24269
  nodeType = WEAVE_RECTANGLE_NODE_TYPE;
24270
+ initialize = void 0;
24013
24271
  constructor(params) {
24014
24272
  super();
24015
24273
  const { config } = params ?? {};
@@ -24053,6 +24311,7 @@ const WEAVE_ELLIPSE_NODE_TYPE = "ellipse";
24053
24311
  //#region src/nodes/ellipse/ellipse.ts
24054
24312
  var WeaveEllipseNode = class extends WeaveNode {
24055
24313
  nodeType = WEAVE_ELLIPSE_NODE_TYPE;
24314
+ initialize = void 0;
24056
24315
  constructor(params) {
24057
24316
  super();
24058
24317
  const { config } = params ?? {};
@@ -24198,13 +24457,16 @@ var WeaveLineNode = class extends WeaveNode {
24198
24457
  constructor(params) {
24199
24458
  super();
24200
24459
  this.config = mergeExceptArrays(WEAVE_LINE_NODE_DEFAULT_CONFIG, params?.config ?? {});
24201
- this.handleNodeChanges = null;
24202
- this.handleZoomChanges = null;
24203
24460
  this.snapper = new GreedySnapper({
24204
24461
  snapAngles: this.config.snapAngles.angles,
24205
24462
  activateThreshold: this.config.snapAngles.activateThreshold,
24206
24463
  releaseThreshold: this.config.snapAngles.releaseThreshold
24207
24464
  });
24465
+ this.initialize();
24466
+ }
24467
+ initialize() {
24468
+ this.handleNodeChanges = null;
24469
+ this.handleZoomChanges = null;
24208
24470
  }
24209
24471
  onRender(props) {
24210
24472
  const line = new Konva.Line({
@@ -24509,17 +24771,19 @@ const TEXT_LAYOUT = {
24509
24771
  //#region src/nodes/text/text.ts
24510
24772
  var WeaveTextNode = class extends WeaveNode {
24511
24773
  nodeType = WEAVE_TEXT_NODE_TYPE;
24512
- editing = false;
24513
- textAreaSuperContainer = null;
24514
- textAreaContainer = null;
24515
- textArea = null;
24516
- eventsInitialized = false;
24517
- isCtrlMetaPressed = false;
24518
24774
  constructor(params) {
24519
24775
  super();
24520
24776
  const { config } = params ?? {};
24521
24777
  this.config = (0, import_lodash.merge)({}, WEAVE_TEXT_NODE_DEFAULT_CONFIG, config);
24778
+ this.initialize();
24779
+ }
24780
+ initialize() {
24522
24781
  this.keyPressHandler = void 0;
24782
+ this.eventsInitialized = false;
24783
+ this.isCtrlMetaPressed = false;
24784
+ this.textAreaSuperContainer = null;
24785
+ this.textAreaContainer = null;
24786
+ this.textArea = null;
24523
24787
  this.editing = false;
24524
24788
  this.textArea = null;
24525
24789
  }
@@ -24527,10 +24791,10 @@ var WeaveTextNode = class extends WeaveNode {
24527
24791
  if (!this.eventsInitialized && !globalThis._weave_isServerSide) {
24528
24792
  window.addEventListener("keydown", (e) => {
24529
24793
  if (e.ctrlKey || e.metaKey) this.isCtrlMetaPressed = true;
24530
- });
24794
+ }, { signal: this.instance.getEventsController()?.signal });
24531
24795
  window.addEventListener("keyup", (e) => {
24532
24796
  if (!(e.ctrlKey || e.metaKey)) this.isCtrlMetaPressed = false;
24533
- });
24797
+ }, { signal: this.instance.getEventsController()?.signal });
24534
24798
  this.eventsInitialized = true;
24535
24799
  }
24536
24800
  }
@@ -24558,7 +24822,7 @@ var WeaveTextNode = class extends WeaveNode {
24558
24822
  onAdd() {
24559
24823
  if (!this.instance.isServerSide() && !this.keyPressHandler) {
24560
24824
  this.keyPressHandler = this.handleKeyPress.bind(this);
24561
- window.addEventListener("keypress", this.keyPressHandler);
24825
+ window.addEventListener("keypress", this.keyPressHandler, { signal: this.instance.getEventsController()?.signal });
24562
24826
  }
24563
24827
  }
24564
24828
  onRender(props) {
@@ -24712,7 +24976,7 @@ var WeaveTextNode = class extends WeaveNode {
24712
24976
  });
24713
24977
  if (!this.instance.isServerSide() && !this.keyPressHandler) {
24714
24978
  this.keyPressHandler = this.handleKeyPress.bind(this);
24715
- window.addEventListener("keypress", this.keyPressHandler);
24979
+ window.addEventListener("keypress", this.keyPressHandler, { signal: this.instance.getEventsController()?.signal });
24716
24980
  }
24717
24981
  return text;
24718
24982
  }
@@ -24971,17 +25235,17 @@ var WeaveTextNode = class extends WeaveNode {
24971
25235
  this.textAreaSuperContainer.scrollTop = 0;
24972
25236
  this.textAreaSuperContainer.scrollLeft = 0;
24973
25237
  }
24974
- });
25238
+ }, { signal: this.instance.getEventsController()?.signal });
24975
25239
  this.textAreaContainer.addEventListener("scroll", () => {
24976
25240
  if (!this.textAreaContainer) return;
24977
25241
  this.textAreaContainer.scrollTop = 0;
24978
25242
  this.textAreaContainer.scrollLeft = 0;
24979
- });
25243
+ }, { signal: this.instance.getEventsController()?.signal });
24980
25244
  this.textArea.addEventListener("scroll", () => {
24981
25245
  if (!this.textArea) return;
24982
25246
  this.textArea.scrollTop = 0;
24983
25247
  this.textArea.scrollLeft = 0;
24984
- });
25248
+ }, { signal: this.instance.getEventsController()?.signal });
24985
25249
  const rotation = textNode.getAbsoluteRotation();
24986
25250
  if (rotation) {
24987
25251
  const transform = "rotate(" + rotation + "deg)";
@@ -25030,8 +25294,8 @@ var WeaveTextNode = class extends WeaveNode {
25030
25294
  this.textAreaDomResize(textNode);
25031
25295
  }
25032
25296
  };
25033
- this.textArea.addEventListener("keydown", handleKeyDown);
25034
- this.textArea.addEventListener("keyup", handleKeyUp);
25297
+ this.textArea.addEventListener("keydown", handleKeyDown, { signal: this.instance.getEventsController()?.signal });
25298
+ this.textArea.addEventListener("keyup", handleKeyUp, { signal: this.instance.getEventsController()?.signal });
25035
25299
  this.textArea.tabIndex = 1;
25036
25300
  this.textArea.focus();
25037
25301
  const handleOutsideClick = (e) => {
@@ -25057,7 +25321,7 @@ var WeaveTextNode = class extends WeaveNode {
25057
25321
  }
25058
25322
  };
25059
25323
  setTimeout(() => {
25060
- window.addEventListener("pointerup", handleOutsideClick);
25324
+ window.addEventListener("pointerup", handleOutsideClick, { signal: this.instance.getEventsController()?.signal });
25061
25325
  }, 0);
25062
25326
  this.instance.getStage().mode(WEAVE_STAGE_TEXT_EDITION_MODE);
25063
25327
  this.editing = true;
@@ -25393,7 +25657,7 @@ var WeaveImageCrop = class WeaveImageCrop {
25393
25657
  utilityLayer?.add(this.transformer);
25394
25658
  this.transformer?.forceUpdate();
25395
25659
  this.cropGroup.show();
25396
- window.addEventListener("keydown", this.handleHide);
25660
+ window.addEventListener("keydown", this.handleHide, { signal: this.instance.getEventsController()?.signal });
25397
25661
  if (options.cmdCtrl.triggered) {
25398
25662
  utilityLayer?.hide();
25399
25663
  const stage = this.instance.getStage();
@@ -25843,24 +26107,21 @@ const isAllowedUrl = (value) => {
25843
26107
  //#endregion
25844
26108
  //#region src/nodes/image/image.ts
25845
26109
  var WeaveImageNode = class extends WeaveNode {
25846
- imageBitmapCache = {};
25847
- imageSource = {};
25848
- imageFallback = {};
25849
- imageState = {};
25850
- imageTryoutAttempts = {};
25851
- imageTryoutIds = {};
25852
26110
  nodeType = WEAVE_IMAGE_NODE_TYPE;
25853
26111
  cursorsFallback = { loading: "wait" };
25854
26112
  cursors = {};
25855
26113
  constructor(params) {
25856
26114
  super();
25857
26115
  const { config } = params ?? {};
26116
+ this.config = mergeExceptArrays(WEAVE_IMAGE_DEFAULT_CONFIG, config);
26117
+ this.initialize();
26118
+ }
26119
+ initialize() {
25858
26120
  this.tapStart = {
25859
26121
  x: 0,
25860
26122
  y: 0,
25861
26123
  time: 0
25862
26124
  };
25863
- this.config = mergeExceptArrays(WEAVE_IMAGE_DEFAULT_CONFIG, config);
25864
26125
  this.imageCrop = null;
25865
26126
  this.imageBitmapCache = {};
25866
26127
  this.imageSource = {};
@@ -26084,7 +26345,7 @@ var WeaveImageNode = class extends WeaveNode {
26084
26345
  };
26085
26346
  this.updateImageCrop(image);
26086
26347
  } else {
26087
- this.updatePlaceholderSize(image, imagePlaceholder);
26348
+ this.updatePlaceholderSize(image);
26088
26349
  this.loadImage(imageProps, image, true);
26089
26350
  }
26090
26351
  if (this.config.performance.cache.enabled) image.on("transformend", () => {
@@ -26467,7 +26728,7 @@ var WeaveImageNode = class extends WeaveNode {
26467
26728
  }
26468
26729
  this.loadAsyncElement(id);
26469
26730
  preloadFunction(id, realImageURL ?? "", {
26470
- onLoad: () => {
26731
+ onLoad: async () => {
26471
26732
  if (useFallback) this.imageTryoutIds[id] = setTimeout(() => {
26472
26733
  const node = this.instance.getStage().findOne(`#${id}`);
26473
26734
  if (node) {
@@ -26518,7 +26779,7 @@ var WeaveImageNode = class extends WeaveNode {
26518
26779
  error: false
26519
26780
  };
26520
26781
  this.updateImageCrop(image);
26521
- this.resolveAsyncElement(id);
26782
+ if (!useFallback) this.resolveAsyncElement(id);
26522
26783
  this.cacheNode(image);
26523
26784
  }
26524
26785
  },
@@ -26559,13 +26820,9 @@ var WeaveImageNode = class extends WeaveNode {
26559
26820
  }
26560
26821
  }, loadTryout);
26561
26822
  }
26562
- updatePlaceholderSize(image, imagePlaceholder) {
26823
+ updatePlaceholderSize(image) {
26563
26824
  const imageAttrs = image.getAttrs();
26564
26825
  if (!this.imageState[imageAttrs.id ?? ""]?.loaded) return;
26565
- if (!imageAttrs.adding && !imageAttrs.cropInfo) {
26566
- imagePlaceholder.width(imageAttrs.uncroppedImage.width);
26567
- imagePlaceholder.height(imageAttrs.uncroppedImage.height);
26568
- }
26569
26826
  }
26570
26827
  updateImageCrop(image) {
26571
26828
  const imageAttrs = image.getAttrs();
@@ -26699,6 +26956,7 @@ const WEAVE_STAR_NODE_TYPE = "star";
26699
26956
  //#region src/nodes/star/star.ts
26700
26957
  var WeaveStarNode = class extends WeaveNode {
26701
26958
  nodeType = WEAVE_STAR_NODE_TYPE;
26959
+ initialize = void 0;
26702
26960
  constructor(params) {
26703
26961
  super();
26704
26962
  const { config } = params ?? {};
@@ -26784,6 +27042,7 @@ const WEAVE_ARROW_NODE_TYPE = "arrow";
26784
27042
  //#region src/nodes/arrow/arrow.ts
26785
27043
  var WeaveArrowNode = class extends WeaveNode {
26786
27044
  nodeType = WEAVE_ARROW_NODE_TYPE;
27045
+ initialize = void 0;
26787
27046
  constructor(params) {
26788
27047
  super();
26789
27048
  const { config } = params ?? {};
@@ -26840,6 +27099,7 @@ const WEAVE_REGULAR_POLYGON_NODE_TYPE = "regular-polygon";
26840
27099
  //#region src/nodes/regular-polygon/regular-polygon.ts
26841
27100
  var WeaveRegularPolygonNode = class extends WeaveNode {
26842
27101
  nodeType = WEAVE_REGULAR_POLYGON_NODE_TYPE;
27102
+ initialize = void 0;
26843
27103
  constructor(params) {
26844
27104
  super();
26845
27105
  const { config } = params ?? {};
@@ -26953,6 +27213,7 @@ var GroupFrame = class extends Konva.Group {
26953
27213
  //#region src/nodes/frame/frame.ts
26954
27214
  var WeaveFrameNode = class extends WeaveNode {
26955
27215
  nodeType = WEAVE_FRAME_NODE_TYPE;
27216
+ initialize = void 0;
26956
27217
  constructor(params) {
26957
27218
  super();
26958
27219
  const { config } = params ?? {};
@@ -27253,6 +27514,7 @@ const WEAVE_STROKE_NODE_DEFAULT_CONFIG = {
27253
27514
  //#region src/nodes/stroke/stroke.ts
27254
27515
  var WeaveStrokeNode = class extends WeaveNode {
27255
27516
  nodeType = WEAVE_STROKE_NODE_TYPE;
27517
+ initialize = void 0;
27256
27518
  constructor(params) {
27257
27519
  super();
27258
27520
  const { config } = params ?? {};
@@ -27829,8 +28091,6 @@ var WeaveSquareLineTipManager = class extends WeaveBaseLineTipManager {
27829
28091
  //#endregion
27830
28092
  //#region src/nodes/stroke-single/stroke-single.ts
27831
28093
  var WeaveStrokeSingleNode = class extends WeaveNode {
27832
- startHandle = null;
27833
- endHandle = null;
27834
28094
  nodeType = WEAVE_STROKE_SINGLE_NODE_TYPE;
27835
28095
  tipManagers = {
27836
28096
  [WEAVE_STROKE_SINGLE_NODE_TIP_TYPE.ARROW]: new WeaveArrowLineTipManager(),
@@ -27841,24 +28101,29 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
27841
28101
  constructor(params) {
27842
28102
  super();
27843
28103
  this.config = mergeExceptArrays(WEAVE_STROKE_SINGLE_NODE_DEFAULT_CONFIG, params?.config ?? {});
27844
- this.handleNodeChanges = null;
27845
- this.handleZoomChanges = null;
27846
- this.shiftPressed = false;
27847
28104
  this.snapper = new GreedySnapper({
27848
28105
  snapAngles: this.config.snapAngles.angles,
27849
28106
  activateThreshold: this.config.snapAngles.activateThreshold,
27850
28107
  releaseThreshold: this.config.snapAngles.releaseThreshold
27851
28108
  });
28109
+ this.initialize();
28110
+ }
28111
+ initialize() {
27852
28112
  this.eventsInitialized = false;
28113
+ this.startHandle = null;
28114
+ this.endHandle = null;
28115
+ this.handleNodeChanges = null;
28116
+ this.handleZoomChanges = null;
28117
+ this.shiftPressed = false;
27853
28118
  }
27854
28119
  initEvents() {
27855
28120
  if (this.eventsInitialized) return;
27856
28121
  window.addEventListener("keydown", (e) => {
27857
28122
  if (e.key === "Shift") this.shiftPressed = true;
27858
- });
28123
+ }, { signal: this.instance.getEventsController()?.signal });
27859
28124
  window.addEventListener("keyup", (e) => {
27860
28125
  if (e.key === "Shift") this.shiftPressed = false;
27861
- });
28126
+ }, { signal: this.instance.getEventsController()?.signal });
27862
28127
  this.eventsInitialized = true;
27863
28128
  }
27864
28129
  onRender(props) {
@@ -28345,6 +28610,9 @@ var WeaveCommentNode = class extends WeaveNode {
28345
28610
  constructor(params) {
28346
28611
  super();
28347
28612
  this.config = mergeExceptArrays(WEAVE_COMMENT_NODE_DEFAULTS, params.config);
28613
+ this.initialize();
28614
+ }
28615
+ initialize() {
28348
28616
  this.commentDomVisibleId = null;
28349
28617
  this.commentDomVisible = false;
28350
28618
  this.commentDomAction = null;
@@ -28973,10 +29241,6 @@ const WEAVE_VIDEO_DEFAULT_CONFIG = {
28973
29241
  //#endregion
28974
29242
  //#region src/nodes/video/video.ts
28975
29243
  var WeaveVideoNode = class extends WeaveNode {
28976
- videoState = {};
28977
- videoSourceFrameId = {};
28978
- videoSource = {};
28979
- videoPlaceholder = {};
28980
29244
  nodeType = WEAVE_VIDEO_NODE_TYPE;
28981
29245
  constructor(params) {
28982
29246
  super();
@@ -28989,6 +29253,13 @@ var WeaveVideoNode = class extends WeaveNode {
28989
29253
  this.videoIconImage.src = this.config.style.icon.dataURL;
28990
29254
  }
28991
29255
  }
29256
+ initialize() {
29257
+ this.videoState = {};
29258
+ this.videoSource = {};
29259
+ this.videoSourceFrameId = {};
29260
+ this.videoPlaceholder = {};
29261
+ this.videoIconImage = void 0;
29262
+ }
28992
29263
  async loadPlaceholder(params, video) {
28993
29264
  const videoProps = params;
28994
29265
  const { id } = videoProps;
@@ -29483,6 +29754,7 @@ const WEAVE_MEASURE_NODE_DEFAULT_CONFIG = { style: {
29483
29754
  var WeaveMeasureNode = class extends WeaveNode {
29484
29755
  nodeType = WEAVE_MEASURE_NODE_TYPE;
29485
29756
  handlePointCircleRadius = 6;
29757
+ initialize = void 0;
29486
29758
  constructor(params) {
29487
29759
  super();
29488
29760
  this.config = mergeExceptArrays(WEAVE_MEASURE_NODE_DEFAULT_CONFIG, params?.config ?? {});
@@ -30773,6 +31045,7 @@ var WeaveConnectorNode = class extends WeaveNode {
30773
31045
  [WEAVE_CONNECTOR_NODE_DECORATOR_TYPE.DOT]: setupNodeDecoratorDot,
30774
31046
  [WEAVE_CONNECTOR_NODE_DECORATOR_TYPE.ARROW]: setupNodeDecoratorArrow
30775
31047
  };
31048
+ initialize = void 0;
30776
31049
  constructor(params) {
30777
31050
  super();
30778
31051
  this.config = mergeExceptArrays(WEAVE_CONNECTOR_NODE_DEFAULT_CONFIG, params?.config);
@@ -31523,10 +31796,6 @@ const WEAVE_STAGE_ZOOM_DEFAULT_CONFIG = {
31523
31796
  var WeaveStageZoomPlugin = class extends WeavePlugin {
31524
31797
  getLayerName = void 0;
31525
31798
  initLayer = void 0;
31526
- pinching = false;
31527
- zooming = false;
31528
- isTrackpad = false;
31529
- zoomVelocity = 0;
31530
31799
  zoomInertiaType = WEAVE_STAGE_ZOOM_TYPE.MOUSE_WHEEL;
31531
31800
  defaultStep = 3;
31532
31801
  constructor(params) {
@@ -31534,8 +31803,13 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
31534
31803
  const { config } = params ?? {};
31535
31804
  this.config = mergeExceptArrays(WEAVE_STAGE_ZOOM_DEFAULT_CONFIG, config);
31536
31805
  if (!this.config.zoomSteps.includes(this.config.defaultZoom)) throw new Error(`Default zoom ${this.config.defaultZoom} is not in zoom steps`);
31806
+ this.initialize();
31807
+ }
31808
+ initialize() {
31537
31809
  this.pinching = false;
31810
+ this.zooming = false;
31538
31811
  this.isTrackpad = false;
31812
+ this.zoomVelocity = 0;
31539
31813
  this.isCtrlOrMetaPressed = false;
31540
31814
  this.updatedMinimumZoom = false;
31541
31815
  this.actualStep = this.config.zoomSteps.findIndex((step) => step === this.config.defaultZoom);
@@ -31822,6 +32096,15 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
31822
32096
  if (box.width === 0 || box.height === 0) return;
31823
32097
  this.fitToElements(box, finalOptions);
31824
32098
  }
32099
+ fitToArea(area, options) {
32100
+ const finalOptions = mergeExceptArrays({
32101
+ smartZoom: false,
32102
+ overrideZoom: true
32103
+ }, options);
32104
+ if (!this.enabled) return;
32105
+ if (area.width === 0 || area.height === 0) return;
32106
+ this.fitToElements(area, finalOptions);
32107
+ }
31825
32108
  enable() {
31826
32109
  this.enabled = true;
31827
32110
  }
@@ -31840,10 +32123,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
31840
32123
  initEvents() {
31841
32124
  window.addEventListener("keydown", (e) => {
31842
32125
  if (e.ctrlKey || e.metaKey) this.isCtrlOrMetaPressed = true;
31843
- });
32126
+ }, { signal: this.instance.getEventsController()?.signal });
31844
32127
  window.addEventListener("keyup", (e) => {
31845
32128
  if (!(e.ctrlKey || e.metaKey)) this.isCtrlOrMetaPressed = false;
31846
- });
32129
+ }, { signal: this.instance.getEventsController()?.signal });
31847
32130
  const stage = this.instance.getStage();
31848
32131
  let lastCenter = null;
31849
32132
  let lastDist = 0;
@@ -31868,7 +32151,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
31868
32151
  return;
31869
32152
  }
31870
32153
  }
31871
- }, { passive: false });
32154
+ }, {
32155
+ passive: false,
32156
+ signal: this.instance.getEventsController()?.signal
32157
+ });
31872
32158
  stage.getContent().addEventListener("touchmove", (e) => {
31873
32159
  e.preventDefault();
31874
32160
  if (e.touches.length === 2) {
@@ -31908,12 +32194,18 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
31908
32194
  lastDist = dist;
31909
32195
  lastCenter = newCenter;
31910
32196
  }
31911
- }, { passive: false });
32197
+ }, {
32198
+ passive: false,
32199
+ signal: this.instance.getEventsController()?.signal
32200
+ });
31912
32201
  stage.getContent().addEventListener("touchend", () => {
31913
32202
  this.pinching = false;
31914
32203
  lastDist = 0;
31915
32204
  lastCenter = null;
31916
- }, { passive: false });
32205
+ }, {
32206
+ passive: false,
32207
+ signal: this.instance.getEventsController()?.signal
32208
+ });
31917
32209
  let doZoom = false;
31918
32210
  const handleWheelImmediate = (e) => {
31919
32211
  const performZoom = this.isCtrlOrMetaPressed || !this.isCtrlOrMetaPressed && e.ctrlKey && e.deltaMode === 0;
@@ -31931,7 +32223,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
31931
32223
  e.preventDefault();
31932
32224
  doZoom = true;
31933
32225
  };
31934
- window.addEventListener("wheel", handleWheelImmediate, { passive: false });
32226
+ window.addEventListener("wheel", handleWheelImmediate, {
32227
+ signal: this.instance.getEventsController()?.signal,
32228
+ passive: false
32229
+ });
31935
32230
  const handleWheel = (e) => {
31936
32231
  if (!doZoom) return;
31937
32232
  const delta = e.deltaY > 0 ? 1 : -1;
@@ -31944,7 +32239,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
31944
32239
  }
31945
32240
  };
31946
32241
  const throttledHandleWheel = (0, import_lodash.throttle)(handleWheel, DEFAULT_THROTTLE_MS);
31947
- window.addEventListener("wheel", throttledHandleWheel, { passive: true });
32242
+ window.addEventListener("wheel", throttledHandleWheel, {
32243
+ signal: this.instance.getEventsController()?.signal,
32244
+ passive: true
32245
+ });
31948
32246
  }
31949
32247
  getInertiaScale() {
31950
32248
  const stage = this.instance.getStage();
@@ -32002,6 +32300,7 @@ const ZOOM_OUT_TOOL_ACTION_NAME = "zoomOutTool";
32002
32300
  //#region src/actions/zoom-out-tool/zoom-out-tool.ts
32003
32301
  var WeaveZoomOutToolAction = class extends WeaveAction {
32004
32302
  onPropsChange = void 0;
32303
+ initialize = void 0;
32005
32304
  getName() {
32006
32305
  return ZOOM_OUT_TOOL_ACTION_NAME;
32007
32306
  }
@@ -32036,6 +32335,10 @@ const ZOOM_IN_TOOL_ACTION_NAME = "zoomInTool";
32036
32335
  //#region src/actions/zoom-in-tool/zoom-in-tool.ts
32037
32336
  var WeaveZoomInToolAction = class extends WeaveAction {
32038
32337
  onPropsChange = void 0;
32338
+ initialize = void 0;
32339
+ constructor() {
32340
+ super();
32341
+ }
32039
32342
  getName() {
32040
32343
  return ZOOM_IN_TOOL_ACTION_NAME;
32041
32344
  }
@@ -32070,6 +32373,10 @@ const FIT_TO_SCREEN_TOOL_ACTION_NAME = "fitToScreenTool";
32070
32373
  //#region src/actions/fit-to-screen-tool/fit-to-screen-tool.ts
32071
32374
  var WeaveFitToScreenToolAction = class extends WeaveAction {
32072
32375
  onPropsChange = void 0;
32376
+ initialize = void 0;
32377
+ constructor() {
32378
+ super();
32379
+ }
32073
32380
  getName() {
32074
32381
  return FIT_TO_SCREEN_TOOL_ACTION_NAME;
32075
32382
  }
@@ -32103,6 +32410,10 @@ const FIT_TO_SELECTION_TOOL_ACTION_NAME = "fitToSelectionTool";
32103
32410
  //#region src/actions/fit-to-selection-tool/fit-to-selection-tool.ts
32104
32411
  var WeaveFitToSelectionToolAction = class extends WeaveAction {
32105
32412
  onPropsChange = void 0;
32413
+ initialize = void 0;
32414
+ constructor() {
32415
+ super();
32416
+ }
32106
32417
  getName() {
32107
32418
  return FIT_TO_SELECTION_TOOL_ACTION_NAME;
32108
32419
  }
@@ -32145,6 +32456,9 @@ var WeaveMoveToolAction = class extends WeaveAction {
32145
32456
  onInit = void 0;
32146
32457
  constructor() {
32147
32458
  super();
32459
+ this.initialize();
32460
+ }
32461
+ initialize() {
32148
32462
  this.initialized = false;
32149
32463
  this.state = MOVE_TOOL_STATE.IDLE;
32150
32464
  }
@@ -32158,7 +32472,7 @@ var WeaveMoveToolAction = class extends WeaveAction {
32158
32472
  this.cancelAction();
32159
32473
  return;
32160
32474
  }
32161
- });
32475
+ }, { signal: this.instance.getEventsController()?.signal });
32162
32476
  stage.on("pointerdown", () => {
32163
32477
  if ([MOVE_TOOL_ACTION_NAME].includes(this.instance.getActiveAction() ?? "")) stage.container().style.cursor = "grabbing";
32164
32478
  });
@@ -32217,6 +32531,9 @@ var WeaveSelectionToolAction = class extends WeaveAction {
32217
32531
  onInit = void 0;
32218
32532
  constructor() {
32219
32533
  super();
32534
+ this.initialize();
32535
+ }
32536
+ initialize() {
32220
32537
  this.initialized = false;
32221
32538
  this.state = SELECTION_TOOL_STATE.IDLE;
32222
32539
  }
@@ -32280,6 +32597,9 @@ var WeaveEraserToolAction = class extends WeaveAction {
32280
32597
  onInit = void 0;
32281
32598
  constructor() {
32282
32599
  super();
32600
+ this.initialize();
32601
+ }
32602
+ initialize() {
32283
32603
  this.initialized = false;
32284
32604
  this.erasing = false;
32285
32605
  this.state = ERASER_TOOL_STATE.IDLE;
@@ -32313,7 +32633,7 @@ var WeaveEraserToolAction = class extends WeaveAction {
32313
32633
  this.cancelAction();
32314
32634
  return;
32315
32635
  }
32316
- });
32636
+ }, { signal: this.instance.getEventsController()?.signal });
32317
32637
  this.initialized = true;
32318
32638
  }
32319
32639
  setState(state) {
@@ -32380,6 +32700,9 @@ var WeaveRectangleToolAction = class extends WeaveAction {
32380
32700
  onInit = void 0;
32381
32701
  constructor() {
32382
32702
  super();
32703
+ this.initialize();
32704
+ }
32705
+ initialize() {
32383
32706
  this.pointers = new Map();
32384
32707
  this.initialized = false;
32385
32708
  this.state = RECTANGLE_TOOL_STATE.IDLE;
@@ -32415,7 +32738,7 @@ var WeaveRectangleToolAction = class extends WeaveAction {
32415
32738
  this.cancelAction();
32416
32739
  return;
32417
32740
  }
32418
- });
32741
+ }, { signal: this.instance.getEventsController()?.signal });
32419
32742
  stage.on("pointermove", () => {
32420
32743
  if (this.state === RECTANGLE_TOOL_STATE.IDLE) return;
32421
32744
  this.setCursor();
@@ -32589,6 +32912,9 @@ var WeaveEllipseToolAction = class extends WeaveAction {
32589
32912
  onInit = void 0;
32590
32913
  constructor() {
32591
32914
  super();
32915
+ this.initialize();
32916
+ }
32917
+ initialize() {
32592
32918
  this.pointers = new Map();
32593
32919
  this.initialized = false;
32594
32920
  this.state = ELLIPSE_TOOL_STATE.IDLE;
@@ -32624,7 +32950,7 @@ var WeaveEllipseToolAction = class extends WeaveAction {
32624
32950
  this.cancelAction();
32625
32951
  return;
32626
32952
  }
32627
- });
32953
+ }, { signal: this.instance.getEventsController()?.signal });
32628
32954
  stage.on("pointerdown", (e) => {
32629
32955
  this.setTapStart(e);
32630
32956
  this.pointers.set(e.evt.pointerId, {
@@ -32805,6 +33131,9 @@ var WeavePenToolAction = class extends WeaveAction {
32805
33131
  onInit = void 0;
32806
33132
  constructor() {
32807
33133
  super();
33134
+ this.initialize();
33135
+ }
33136
+ initialize() {
32808
33137
  this.pointers = new Map();
32809
33138
  this.initialized = false;
32810
33139
  this.state = PEN_TOOL_STATE.IDLE;
@@ -32840,7 +33169,7 @@ var WeavePenToolAction = class extends WeaveAction {
32840
33169
  this.cancelAction();
32841
33170
  return;
32842
33171
  }
32843
- });
33172
+ }, { signal: this.instance.getEventsController()?.signal });
32844
33173
  stage.on("pointerdown", (e) => {
32845
33174
  this.setTapStart(e);
32846
33175
  this.pointers.set(e.evt.pointerId, {
@@ -33077,6 +33406,9 @@ var WeaveLineToolAction = class extends WeaveAction {
33077
33406
  constructor(params) {
33078
33407
  super();
33079
33408
  this.config = mergeExceptArrays(LINE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
33409
+ this.initialize();
33410
+ }
33411
+ initialize() {
33080
33412
  this.pointers = new Map();
33081
33413
  this.initialized = false;
33082
33414
  this.state = LINE_TOOL_STATE.IDLE;
@@ -33121,13 +33453,13 @@ var WeaveLineToolAction = class extends WeaveAction {
33121
33453
  this.snappedAngle = null;
33122
33454
  this.shiftPressed = true;
33123
33455
  }
33124
- });
33456
+ }, { signal: this.instance.getEventsController()?.signal });
33125
33457
  window.addEventListener("keyup", (e) => {
33126
33458
  if (e.key === "Shift" && this.instance.getActiveAction() === LINE_TOOL_ACTION_NAME) {
33127
33459
  this.snappedAngle = null;
33128
33460
  this.shiftPressed = false;
33129
33461
  }
33130
- });
33462
+ }, { signal: this.instance.getEventsController()?.signal });
33131
33463
  stage.on("pointerdown", (e) => {
33132
33464
  this.setTapStart(e);
33133
33465
  this.pointers.set(e.evt.pointerId, {
@@ -33342,6 +33674,9 @@ var WeaveBrushToolAction = class extends WeaveAction {
33342
33674
  constructor(params) {
33343
33675
  super();
33344
33676
  this.config = mergeExceptArrays(BRUSH_TOOL_DEFAULT_CONFIG, params?.config ?? {});
33677
+ this.initialize();
33678
+ }
33679
+ initialize() {
33345
33680
  this.initialized = false;
33346
33681
  this.state = BRUSH_TOOL_STATE.INACTIVE;
33347
33682
  this.strokeId = null;
@@ -33370,7 +33705,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
33370
33705
  const stage = this.instance.getStage();
33371
33706
  window.addEventListener("keyup", (e) => {
33372
33707
  if (e.code === "Space" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) this.isSpacePressed = false;
33373
- });
33708
+ }, { signal: this.instance.getEventsController()?.signal });
33374
33709
  window.addEventListener("keydown", (e) => {
33375
33710
  if (e.code === "Enter" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) {
33376
33711
  e.stopPropagation();
@@ -33386,7 +33721,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
33386
33721
  e.stopPropagation();
33387
33722
  this.cancelAction();
33388
33723
  }
33389
- });
33724
+ }, { signal: this.instance.getEventsController()?.signal });
33390
33725
  const handlePointerDown = (e) => {
33391
33726
  if (this.state === BRUSH_TOOL_STATE.INACTIVE) return;
33392
33727
  if (this.state !== BRUSH_TOOL_STATE.IDLE) return;
@@ -33595,6 +33930,9 @@ var WeaveTextToolAction = class extends WeaveAction {
33595
33930
  onInit = void 0;
33596
33931
  constructor() {
33597
33932
  super();
33933
+ this.initialize();
33934
+ }
33935
+ initialize() {
33598
33936
  this.initialized = false;
33599
33937
  this.state = TEXT_TOOL_STATE.IDLE;
33600
33938
  this.textId = null;
@@ -33624,7 +33962,7 @@ var WeaveTextToolAction = class extends WeaveAction {
33624
33962
  this.cancelAction();
33625
33963
  return;
33626
33964
  }
33627
- });
33965
+ }, { signal: this.instance.getEventsController()?.signal });
33628
33966
  stage.on("pointermove", () => {
33629
33967
  if (this.state === TEXT_TOOL_STATE.IDLE) return;
33630
33968
  this.setCursor();
@@ -33752,6 +34090,9 @@ var WeaveImageToolAction = class extends WeaveAction {
33752
34090
  constructor(params) {
33753
34091
  super();
33754
34092
  this.config = mergeExceptArrays(WEAVE_IMAGE_TOOL_CONFIG_DEFAULT, params?.config ?? {});
34093
+ this.initialize();
34094
+ }
34095
+ initialize() {
33755
34096
  this.pointers = new Map();
33756
34097
  this.initialized = false;
33757
34098
  this.imageId = null;
@@ -33795,7 +34136,7 @@ var WeaveImageToolAction = class extends WeaveAction {
33795
34136
  this.cancelAction();
33796
34137
  return;
33797
34138
  }
33798
- });
34139
+ }, { signal: this.instance.getEventsController()?.signal });
33799
34140
  stage.on("pointerdown", (e) => {
33800
34141
  this.setTapStart(e);
33801
34142
  if (this.ignorePointerEvents) return;
@@ -34192,6 +34533,9 @@ var WeaveImagesToolAction = class extends WeaveAction {
34192
34533
  constructor(params) {
34193
34534
  super();
34194
34535
  this.config = mergeExceptArrays(WEAVE_IMAGES_TOOL_DEFAULT_CONFIG, params ?? {});
34536
+ this.initialize();
34537
+ }
34538
+ initialize() {
34195
34539
  this.pointers = new Map();
34196
34540
  this.initialized = false;
34197
34541
  this.tempPointerFeedbackNode = null;
@@ -34238,7 +34582,7 @@ var WeaveImagesToolAction = class extends WeaveAction {
34238
34582
  const stage = this.instance.getStage();
34239
34583
  stage.container().addEventListener("keydown", (e) => {
34240
34584
  if (e.key === "Escape" && this.instance.getActiveAction() === WEAVE_IMAGES_TOOL_ACTION_NAME) this.cancelAction();
34241
- });
34585
+ }, { signal: this.instance.getEventsController()?.signal });
34242
34586
  stage.on("pointerdown", (e) => {
34243
34587
  this.setTapStart(e);
34244
34588
  this.pointers.set(e.evt.pointerId, {
@@ -34620,6 +34964,9 @@ var WeaveStarToolAction = class extends WeaveAction {
34620
34964
  onInit = void 0;
34621
34965
  constructor() {
34622
34966
  super();
34967
+ this.initialize();
34968
+ }
34969
+ initialize() {
34623
34970
  this.pointers = new Map();
34624
34971
  this.initialized = false;
34625
34972
  this.state = STAR_TOOL_STATE.IDLE;
@@ -34656,7 +35003,7 @@ var WeaveStarToolAction = class extends WeaveAction {
34656
35003
  this.cancelAction();
34657
35004
  return;
34658
35005
  }
34659
- });
35006
+ }, { signal: this.instance.getEventsController()?.signal });
34660
35007
  stage.on("pointerdown", (e) => {
34661
35008
  this.setTapStart(e);
34662
35009
  this.pointers.set(e.evt.pointerId, {
@@ -34821,8 +35168,8 @@ var WeaveStarToolAction = class extends WeaveAction {
34821
35168
 
34822
35169
  //#endregion
34823
35170
  //#region src/actions/arrow-tool/constants.ts
34824
- const ARROW_TOOL_ACTION_NAME = "arrowTool";
34825
- const ARROW_TOOL_STATE = {
35171
+ const WEAVE_ARROW_TOOL_ACTION_NAME = "arrowTool";
35172
+ const WEAVE_ARROW_TOOL_STATE = {
34826
35173
  ["IDLE"]: "idle",
34827
35174
  ["ADDING"]: "adding",
34828
35175
  ["DEFINING_SIZE"]: "definingSize",
@@ -34838,9 +35185,12 @@ var WeaveArrowToolAction = class extends WeaveAction {
34838
35185
  onInit = void 0;
34839
35186
  constructor() {
34840
35187
  super();
35188
+ this.initialize();
35189
+ }
35190
+ initialize() {
34841
35191
  this.pointers = new Map();
34842
35192
  this.initialized = false;
34843
- this.state = ARROW_TOOL_STATE.IDLE;
35193
+ this.state = WEAVE_ARROW_TOOL_STATE.IDLE;
34844
35194
  this.arrowId = null;
34845
35195
  this.tempArrowId = null;
34846
35196
  this.tempMainArrowNode = null;
@@ -34853,7 +35203,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
34853
35203
  this.props = this.initProps();
34854
35204
  }
34855
35205
  getName() {
34856
- return ARROW_TOOL_ACTION_NAME;
35206
+ return WEAVE_ARROW_TOOL_ACTION_NAME;
34857
35207
  }
34858
35208
  initProps() {
34859
35209
  return {
@@ -34870,40 +35220,37 @@ var WeaveArrowToolAction = class extends WeaveAction {
34870
35220
  setupEvents() {
34871
35221
  const stage = this.instance.getStage();
34872
35222
  window.addEventListener("keydown", (e) => {
34873
- if (e.code === "Enter" && this.instance.getActiveAction() === ARROW_TOOL_ACTION_NAME) {
34874
- this.cancelAction();
34875
- return;
34876
- }
34877
- if (e.code === "Escape" && this.instance.getActiveAction() === ARROW_TOOL_ACTION_NAME) {
35223
+ if (e.code === "Enter" && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
34878
35224
  this.cancelAction();
34879
35225
  return;
34880
35226
  }
34881
- });
35227
+ if (e.code === "Escape" && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) this.cancelAction();
35228
+ }, { signal: this.instance.getEventsController()?.signal });
34882
35229
  stage.on("pointerdown", (e) => {
34883
35230
  this.setTapStart(e);
34884
35231
  this.pointers.set(e.evt.pointerId, {
34885
35232
  x: e.evt.clientX,
34886
35233
  y: e.evt.clientY
34887
35234
  });
34888
- if (this.pointers.size === 2 && this.instance.getActiveAction() === ARROW_TOOL_ACTION_NAME) {
34889
- this.state = ARROW_TOOL_STATE.ADDING;
35235
+ if (this.pointers.size === 2 && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
35236
+ this.state = WEAVE_ARROW_TOOL_STATE.ADDING;
34890
35237
  return;
34891
35238
  }
34892
- if (!this.tempMainArrowNode && this.state === ARROW_TOOL_STATE.ADDING) this.handleAdding();
34893
- if (this.tempMainArrowNode && this.state === ARROW_TOOL_STATE.ADDING) this.state = ARROW_TOOL_STATE.DEFINING_SIZE;
35239
+ if (!this.tempMainArrowNode && this.state === WEAVE_ARROW_TOOL_STATE.ADDING) this.handleAdding();
35240
+ if (this.tempMainArrowNode && this.state === WEAVE_ARROW_TOOL_STATE.ADDING) this.state = WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE;
34894
35241
  });
34895
35242
  stage.on("pointermove", () => {
34896
- if (this.state === ARROW_TOOL_STATE.IDLE) return;
35243
+ if (this.state === WEAVE_ARROW_TOOL_STATE.IDLE) return;
34897
35244
  this.setCursor();
34898
- if (this.pointers.size === 2 && this.instance.getActiveAction() === ARROW_TOOL_ACTION_NAME) {
34899
- this.state = ARROW_TOOL_STATE.ADDING;
35245
+ if (this.pointers.size === 2 && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
35246
+ this.state = WEAVE_ARROW_TOOL_STATE.ADDING;
34900
35247
  return;
34901
35248
  }
34902
- if (this.state === ARROW_TOOL_STATE.DEFINING_SIZE) this.handleMovement();
35249
+ if (this.state === WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) this.handleMovement();
34903
35250
  });
34904
35251
  stage.on("pointerup", (e) => {
34905
35252
  this.pointers.delete(e.evt.pointerId);
34906
- if (this.state === ARROW_TOOL_STATE.DEFINING_SIZE) this.handleSettingSize();
35253
+ if (this.state === WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) this.handleSettingSize();
34907
35254
  });
34908
35255
  this.initialized = true;
34909
35256
  }
@@ -34917,7 +35264,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
34917
35264
  this.tempPoint = void 0;
34918
35265
  this.tempNextPoint = void 0;
34919
35266
  this.clickPoint = null;
34920
- this.setState(ARROW_TOOL_STATE.ADDING);
35267
+ this.setState(WEAVE_ARROW_TOOL_STATE.ADDING);
34921
35268
  }
34922
35269
  handleAdding() {
34923
35270
  const stage = this.instance.getStage();
@@ -34968,7 +35315,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
34968
35315
  this.measureContainer?.add(this.tempNextPoint);
34969
35316
  this.tempPoint.moveToTop();
34970
35317
  this.tempNextPoint.moveToTop();
34971
- this.setState(ARROW_TOOL_STATE.DEFINING_SIZE);
35318
+ this.setState(WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE);
34972
35319
  }
34973
35320
  }
34974
35321
  handleSettingSize() {
@@ -34995,11 +35342,11 @@ var WeaveArrowToolAction = class extends WeaveAction {
34995
35342
  y: mousePoint.y,
34996
35343
  points: [0, 0]
34997
35344
  });
34998
- this.setState(ARROW_TOOL_STATE.DEFINING_SIZE);
35345
+ this.setState(WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE);
34999
35346
  }
35000
35347
  }
35001
35348
  handleMovement() {
35002
- if (this.state !== ARROW_TOOL_STATE.DEFINING_SIZE) return;
35349
+ if (this.state !== WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) return;
35003
35350
  if (this.arrowId && this.tempArrowNode && this.measureContainer && this.tempNextPoint) {
35004
35351
  const { mousePoint } = this.instance.getMousePointerRelativeToContainer(this.measureContainer);
35005
35352
  this.tempArrowNode.setAttrs({
@@ -35066,7 +35413,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
35066
35413
  this.container = void 0;
35067
35414
  this.measureContainer = void 0;
35068
35415
  this.clickPoint = null;
35069
- this.setState(ARROW_TOOL_STATE.IDLE);
35416
+ this.setState(WEAVE_ARROW_TOOL_STATE.IDLE);
35070
35417
  }
35071
35418
  setCursor() {
35072
35419
  const stage = this.instance.getStage();
@@ -35110,13 +35457,15 @@ const WEAVE_STROKE_TOOL_DEFAULT_CONFIG = { snapAngles: {
35110
35457
  var WeaveStrokeToolAction = class extends WeaveAction {
35111
35458
  initialized = false;
35112
35459
  initialCursor = null;
35113
- snappedAngle = null;
35114
35460
  shiftPressed = false;
35115
35461
  onPropsChange = void 0;
35116
35462
  onInit = void 0;
35117
35463
  constructor(params) {
35118
35464
  super();
35119
35465
  this.config = mergeExceptArrays(WEAVE_STROKE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
35466
+ this.initialize();
35467
+ }
35468
+ initialize() {
35120
35469
  this.pointers = new Map();
35121
35470
  this.initialized = false;
35122
35471
  this.state = WEAVE_STROKE_TOOL_STATE.IDLE;
@@ -35125,7 +35474,6 @@ var WeaveStrokeToolAction = class extends WeaveAction {
35125
35474
  this.tempLineId = null;
35126
35475
  this.tempLineNode = null;
35127
35476
  this.container = void 0;
35128
- this.snappedAngle = null;
35129
35477
  this.measureContainer = void 0;
35130
35478
  this.clickPoint = null;
35131
35479
  this.snapper = new GreedySnapper({
@@ -35138,6 +35486,9 @@ var WeaveStrokeToolAction = class extends WeaveAction {
35138
35486
  getName() {
35139
35487
  return WEAVE_STROKE_TOOL_ACTION_NAME;
35140
35488
  }
35489
+ getNames() {
35490
+ return [WEAVE_STROKE_TOOL_ACTION_NAME, ...WEAVE_STROKE_TOOL_ACTION_NAME_ALIASES];
35491
+ }
35141
35492
  hasAliases() {
35142
35493
  return true;
35143
35494
  }
@@ -35156,32 +35507,26 @@ var WeaveStrokeToolAction = class extends WeaveAction {
35156
35507
  setupEvents() {
35157
35508
  const stage = this.instance.getStage();
35158
35509
  window.addEventListener("keydown", (e) => {
35159
- if (e.code === "Enter" && this.instance.getActiveAction() === WEAVE_STROKE_TOOL_ACTION_NAME) {
35510
+ if (e.code === "Enter" && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
35160
35511
  this.cancelAction();
35161
35512
  return;
35162
35513
  }
35163
- if (e.code === "Escape" && this.instance.getActiveAction() === WEAVE_STROKE_TOOL_ACTION_NAME) {
35514
+ if (e.code === "Escape" && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
35164
35515
  this.cancelAction();
35165
35516
  return;
35166
35517
  }
35167
- if (e.key === "Shift" && this.instance.getActiveAction() === WEAVE_STROKE_TOOL_ACTION_NAME) {
35168
- this.snappedAngle = null;
35169
- this.shiftPressed = true;
35170
- }
35171
- });
35518
+ if (e.key === "Shift" && this.getNames().includes(this.instance.getActiveAction() ?? "")) this.shiftPressed = true;
35519
+ }, { signal: this.instance.getEventsController()?.signal });
35172
35520
  window.addEventListener("keyup", (e) => {
35173
- if (e.key === "Shift" && this.instance.getActiveAction() === WEAVE_STROKE_TOOL_ACTION_NAME) {
35174
- this.snappedAngle = null;
35175
- this.shiftPressed = false;
35176
- }
35177
- });
35521
+ if (e.key === "Shift" && this.getNames().includes(this.instance.getActiveAction() ?? "")) this.shiftPressed = false;
35522
+ }, { signal: this.instance.getEventsController()?.signal });
35178
35523
  stage.on("pointerdown", (e) => {
35179
35524
  this.setTapStart(e);
35180
35525
  this.pointers.set(e.evt.pointerId, {
35181
35526
  x: e.evt.clientX,
35182
35527
  y: e.evt.clientY
35183
35528
  });
35184
- if (this.pointers.size === 2 && this.instance.getActiveAction() === WEAVE_STROKE_TOOL_ACTION_NAME) {
35529
+ if (this.pointers.size === 2 && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
35185
35530
  this.state = WEAVE_STROKE_TOOL_STATE.ADDING;
35186
35531
  return;
35187
35532
  }
@@ -35191,7 +35536,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
35191
35536
  stage.on("pointermove", () => {
35192
35537
  if (this.state === WEAVE_STROKE_TOOL_STATE.IDLE) return;
35193
35538
  this.setCursor();
35194
- if (this.pointers.size === 2 && this.instance.getActiveAction() === WEAVE_STROKE_TOOL_ACTION_NAME) {
35539
+ if (this.pointers.size === 2 && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
35195
35540
  this.state = WEAVE_STROKE_TOOL_STATE.ADDING;
35196
35541
  return;
35197
35542
  }
@@ -35209,7 +35554,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
35209
35554
  addLine() {
35210
35555
  this.setCursor();
35211
35556
  this.setFocusStage();
35212
- this.instance.emitEvent("onAddingStroke", { actionName: this.instance.getActiveAction() ?? WEAVE_STROKE_TOOL_ACTION_NAME });
35557
+ this.instance.emitEvent("onAddingStroke", { actionName: this.instance.getActiveAction() ?? "not-defined" });
35213
35558
  this.shiftPressed = false;
35214
35559
  this.clickPoint = null;
35215
35560
  this.setState(WEAVE_STROKE_TOOL_STATE.ADDING);
@@ -35317,7 +35662,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
35317
35662
  });
35318
35663
  delete finalLine.props.dragBoundFunc;
35319
35664
  this.instance.addNode(finalLine, this.container?.getAttrs().id);
35320
- this.instance.emitEvent("onAddedStroke", { actionName: this.instance.getActiveAction() ?? WEAVE_STROKE_TOOL_ACTION_NAME });
35665
+ this.instance.emitEvent("onAddedStroke", { actionName: this.instance.getActiveAction() ?? "not-defined" });
35321
35666
  nodeCreated = true;
35322
35667
  }
35323
35668
  }
@@ -35367,6 +35712,9 @@ var WeaveRegularPolygonToolAction = class extends WeaveAction {
35367
35712
  onInit = void 0;
35368
35713
  constructor() {
35369
35714
  super();
35715
+ this.initialize();
35716
+ }
35717
+ initialize() {
35370
35718
  this.pointers = new Map();
35371
35719
  this.initialized = false;
35372
35720
  this.state = REGULAR_POLYGON_TOOL_STATE.IDLE;
@@ -35401,7 +35749,7 @@ var WeaveRegularPolygonToolAction = class extends WeaveAction {
35401
35749
  this.cancelAction();
35402
35750
  return;
35403
35751
  }
35404
- });
35752
+ }, { signal: this.instance.getEventsController()?.signal });
35405
35753
  stage.on("pointerdown", (e) => {
35406
35754
  this.setTapStart(e);
35407
35755
  this.pointers.set(e.evt.pointerId, {
@@ -35575,6 +35923,9 @@ var WeaveFrameToolAction = class extends WeaveAction {
35575
35923
  onInit = void 0;
35576
35924
  constructor() {
35577
35925
  super();
35926
+ this.initialize();
35927
+ }
35928
+ initialize() {
35578
35929
  this.initialized = false;
35579
35930
  this.state = FRAME_TOOL_STATE.IDLE;
35580
35931
  this.frameId = null;
@@ -35602,7 +35953,7 @@ var WeaveFrameToolAction = class extends WeaveAction {
35602
35953
  this.cancelAction();
35603
35954
  return;
35604
35955
  }
35605
- });
35956
+ }, { signal: this.instance.getEventsController()?.signal });
35606
35957
  stage.on("pointermove", () => {
35607
35958
  if (this.state === FRAME_TOOL_STATE.IDLE) return;
35608
35959
  this.setCursor();
@@ -35704,6 +36055,10 @@ var WeaveExportStageToolAction = class extends WeaveAction {
35704
36055
  };
35705
36056
  onPropsChange = void 0;
35706
36057
  onInit = void 0;
36058
+ initialize = void 0;
36059
+ constructor() {
36060
+ super();
36061
+ }
35707
36062
  getName() {
35708
36063
  return EXPORT_STAGE_TOOL_ACTION_NAME;
35709
36064
  }
@@ -35751,6 +36106,10 @@ var WeaveExportNodesToolAction = class extends WeaveAction {
35751
36106
  };
35752
36107
  onPropsChange = void 0;
35753
36108
  onInit = void 0;
36109
+ initialize = void 0;
36110
+ constructor() {
36111
+ super();
36112
+ }
35754
36113
  getName() {
35755
36114
  return EXPORT_NODES_TOOL_ACTION_NAME;
35756
36115
  }
@@ -35803,6 +36162,9 @@ var WeaveAlignNodesToolAction = class extends WeaveAction {
35803
36162
  onInit = void 0;
35804
36163
  constructor() {
35805
36164
  super();
36165
+ this.initialize();
36166
+ }
36167
+ initialize() {
35806
36168
  this.initialized = false;
35807
36169
  this.state = ALIGN_NODES_TOOL_STATE.IDLE;
35808
36170
  }
@@ -36052,6 +36414,9 @@ var WeaveCommentToolAction = class extends WeaveAction {
36052
36414
  super();
36053
36415
  const { config } = params ?? {};
36054
36416
  this.config = mergeExceptArrays(WEAVE_COMMENT_TOOL_DEFAULT_CONFIG, config);
36417
+ this.initialize();
36418
+ }
36419
+ initialize() {
36055
36420
  this.pointers = new Map();
36056
36421
  this.initialized = false;
36057
36422
  this.state = WEAVE_COMMENT_TOOL_STATE.IDLE;
@@ -36129,7 +36494,7 @@ var WeaveCommentToolAction = class extends WeaveAction {
36129
36494
  return;
36130
36495
  }
36131
36496
  if (e.code === "Escape" && this.state === WEAVE_COMMENT_TOOL_STATE.CREATING_COMMENT) this.setState(WEAVE_COMMENT_TOOL_STATE.ADDING);
36132
- });
36497
+ }, { signal: this.instance.getEventsController()?.signal });
36133
36498
  stage.on("pointermove", (e) => {
36134
36499
  if (this.state === WEAVE_COMMENT_TOOL_STATE.IDLE) return;
36135
36500
  if (commentNodeHandler?.isCommentViewing()) {
@@ -36280,6 +36645,9 @@ var WeaveVideoToolAction = class extends WeaveAction {
36280
36645
  update = void 0;
36281
36646
  constructor() {
36282
36647
  super();
36648
+ this.initialize();
36649
+ }
36650
+ initialize() {
36283
36651
  this.pointers = new Map();
36284
36652
  this.initialized = false;
36285
36653
  this.state = VIDEO_TOOL_STATE.IDLE;
@@ -36326,7 +36694,7 @@ var WeaveVideoToolAction = class extends WeaveAction {
36326
36694
  this.cancelAction();
36327
36695
  return;
36328
36696
  }
36329
- });
36697
+ }, { signal: this.instance.getEventsController()?.signal });
36330
36698
  stage.on("pointerdown", (e) => {
36331
36699
  this.setTapStart(e);
36332
36700
  this.pointers.set(e.evt.pointerId, {
@@ -36505,6 +36873,9 @@ var WeaveMeasureToolAction = class extends WeaveAction {
36505
36873
  constructor(params) {
36506
36874
  super();
36507
36875
  this.config = mergeExceptArrays(WEAVE_MEASURE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
36876
+ this.initialize();
36877
+ }
36878
+ initialize() {
36508
36879
  this.initialized = false;
36509
36880
  this.state = MEASURE_TOOL_STATE.IDLE;
36510
36881
  this.measureId = null;
@@ -36531,7 +36902,7 @@ var WeaveMeasureToolAction = class extends WeaveAction {
36531
36902
  const stage = this.instance.getStage();
36532
36903
  window.addEventListener("keydown", (e) => {
36533
36904
  if (e.code === "Escape" && this.instance.getActiveAction() === MEASURE_TOOL_ACTION_NAME) this.cancelAction();
36534
- });
36905
+ }, { signal: this.instance.getEventsController()?.signal });
36535
36906
  stage.on("pointermove", () => {
36536
36907
  if (this.state === MEASURE_TOOL_STATE.IDLE) return;
36537
36908
  if (this.state === MEASURE_TOOL_STATE.SET_TO) {
@@ -36801,6 +37172,9 @@ var WeaveConnectorToolAction = class extends WeaveAction {
36801
37172
  constructor(params) {
36802
37173
  super();
36803
37174
  this.config = mergeExceptArrays(CONNECTOR_TOOL_DEFAULT_CONFIG, params?.config);
37175
+ this.initialize();
37176
+ }
37177
+ initialize() {
36804
37178
  this.pointers = new Map();
36805
37179
  this.initialized = false;
36806
37180
  this.tempLineNode = null;
@@ -36839,7 +37213,7 @@ var WeaveConnectorToolAction = class extends WeaveAction {
36839
37213
  return;
36840
37214
  }
36841
37215
  if (e.code === "Escape" && this.instance.getActiveAction() === CONNECTOR_TOOL_ACTION_NAME) this.cancelAction();
36842
- });
37216
+ }, { signal: this.instance.getEventsController()?.signal });
36843
37217
  let nodeHovered = void 0;
36844
37218
  stage.on("pointermove", () => {
36845
37219
  if (!(this.state === CONNECTOR_TOOL_STATE.SELECTING_INITIAL || this.state === CONNECTOR_TOOL_STATE.SELECTING_FINAL)) return;
@@ -37154,10 +37528,6 @@ var WeaveConnectorToolAction = class extends WeaveAction {
37154
37528
  //#endregion
37155
37529
  //#region src/plugins/stage-grid/stage-grid.ts
37156
37530
  var WeaveStageGridPlugin = class extends WeavePlugin {
37157
- actStageZoomX = 1;
37158
- actStageZoomY = 1;
37159
- actStagePosX = 0;
37160
- actStagePosY = 0;
37161
37531
  constructor(params) {
37162
37532
  super();
37163
37533
  const { config } = params ?? {};
@@ -37173,6 +37543,10 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
37173
37543
  this.isMouseMiddleButtonPressed = false;
37174
37544
  this.isSpaceKeyPressed = false;
37175
37545
  this.forceStageChange = false;
37546
+ this.actStagePosX = 0;
37547
+ this.actStagePosY = 0;
37548
+ this.actStageZoomX = 1;
37549
+ this.actStageZoomY = 1;
37176
37550
  }
37177
37551
  getName() {
37178
37552
  return WEAVE_STAGE_GRID_PLUGIN_KEY;
@@ -37197,10 +37571,10 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
37197
37571
  const stage = this.instance.getStage();
37198
37572
  window.addEventListener("keydown", (e) => {
37199
37573
  if (e.code === "Space") this.isSpaceKeyPressed = true;
37200
- });
37574
+ }, { signal: this.instance.getEventsController()?.signal });
37201
37575
  window.addEventListener("keyup", (e) => {
37202
37576
  if (e.code === "Space") this.isSpaceKeyPressed = false;
37203
- });
37577
+ }, { signal: this.instance.getEventsController()?.signal });
37204
37578
  this.instance.addEventListener("onStageMove", () => {
37205
37579
  this.onRender();
37206
37580
  });
@@ -37466,15 +37840,14 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
37466
37840
  //#endregion
37467
37841
  //#region src/plugins/stage-panning/stage-panning.ts
37468
37842
  var WeaveStagePanningPlugin = class extends WeavePlugin {
37469
- panning = false;
37470
- currentPointer = null;
37471
- stageScrollInterval = void 0;
37472
- panEdgeTargets = {};
37473
37843
  getLayerName = void 0;
37474
37844
  initLayer = void 0;
37475
37845
  constructor(params) {
37476
37846
  super();
37477
37847
  this.config = mergeExceptArrays(WEAVE_STAGE_PANNING_DEFAULT_CONFIG, params?.config ?? {});
37848
+ this.initialize();
37849
+ }
37850
+ initialize() {
37478
37851
  this.pointers = new Map();
37479
37852
  this.panning = false;
37480
37853
  this.isDragging = false;
@@ -37486,6 +37859,9 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
37486
37859
  this.isCtrlOrMetaPressed = false;
37487
37860
  this.isSpaceKeyPressed = false;
37488
37861
  this.previousPointer = null;
37862
+ this.currentPointer = null;
37863
+ this.stageScrollInterval = void 0;
37864
+ this.panEdgeTargets = {};
37489
37865
  }
37490
37866
  getName() {
37491
37867
  return WEAVE_STAGE_PANNING_KEY;
@@ -37519,7 +37895,7 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
37519
37895
  this.isSpaceKeyPressed = true;
37520
37896
  this.setCursor();
37521
37897
  }
37522
- });
37898
+ }, { signal: this.instance.getEventsController()?.signal });
37523
37899
  window.addEventListener("keyup", (e) => {
37524
37900
  if (e.key === "Meta" || e.key === "Control") this.isCtrlOrMetaPressed = false;
37525
37901
  if (e.code === "Space") {
@@ -37530,7 +37906,7 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
37530
37906
  this.isSpaceKeyPressed = false;
37531
37907
  this.disableMove();
37532
37908
  }
37533
- });
37909
+ }, { signal: this.instance.getEventsController()?.signal });
37534
37910
  let lastPos = null;
37535
37911
  stage.on("pointerdown", (e) => {
37536
37912
  this.pointers.set(e.evt.pointerId, {
@@ -37603,7 +37979,10 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
37603
37979
  this.instance.emitEvent("onStageMove");
37604
37980
  };
37605
37981
  const handleWheelThrottled = (0, import_lodash.throttle)(handleWheel, WEAVE_STAGE_PANNING_THROTTLE_MS);
37606
- window.addEventListener("wheel", handleWheelThrottled, { passive: true });
37982
+ window.addEventListener("wheel", handleWheelThrottled, {
37983
+ passive: true,
37984
+ signal: this.instance.getEventsController()?.signal
37985
+ });
37607
37986
  stage.on("dragstart", (e) => {
37608
37987
  const duration = 1e3 / 60;
37609
37988
  if (this.panEdgeTargets[e.target.getAttrs().id ?? ""] !== void 0) return;
@@ -37661,7 +38040,10 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
37661
38040
  stage.container().style.setProperty("-webkit-user-drag", "none");
37662
38041
  stage.getContent().addEventListener("touchmove", function(e) {
37663
38042
  e.preventDefault();
37664
- }, { passive: false });
38043
+ }, {
38044
+ passive: false,
38045
+ signal: this.instance.getEventsController()?.signal
38046
+ });
37665
38047
  }
37666
38048
  isPanning() {
37667
38049
  return this.panning;
@@ -37739,6 +38121,9 @@ var WeaveStageMinimapPlugin = class extends WeavePlugin {
37739
38121
  constructor(params) {
37740
38122
  super();
37741
38123
  this.config = mergeExceptArrays(STAGE_MINIMAP_DEFAULT_CONFIG, params.config);
38124
+ this.initialize();
38125
+ }
38126
+ initialize() {
37742
38127
  this.initialized = false;
37743
38128
  }
37744
38129
  getName() {
@@ -37916,6 +38301,7 @@ const WEAVE_STAGE_RESIZE_KEY = "stageResize";
37916
38301
  var WeaveStageResizePlugin = class extends WeavePlugin {
37917
38302
  getLayerName = void 0;
37918
38303
  initLayer = void 0;
38304
+ initialize = void 0;
37919
38305
  getName() {
37920
38306
  return WEAVE_STAGE_RESIZE_KEY;
37921
38307
  }
@@ -37935,6 +38321,10 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
37935
38321
  const pluginInstance = plugins[pluginId];
37936
38322
  pluginInstance.onRender?.();
37937
38323
  }
38324
+ this.instance.emitEvent("onStageResize", {
38325
+ width: stage.width(),
38326
+ height: stage.height()
38327
+ });
37938
38328
  }
37939
38329
  }
37940
38330
  onInit() {
@@ -37943,7 +38333,7 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
37943
38333
  }, DEFAULT_THROTTLE_MS);
37944
38334
  window.addEventListener("resize", () => {
37945
38335
  throttledResize();
37946
- });
38336
+ }, { signal: this.instance.getEventsController()?.signal });
37947
38337
  const resizeObserver = new ResizeObserver(() => {
37948
38338
  throttledResize();
37949
38339
  });
@@ -37961,10 +38351,12 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
37961
38351
  //#endregion
37962
38352
  //#region src/plugins/nodes-multi-selection-feedback/nodes-multi-selection-feedback.ts
37963
38353
  var WeaveNodesMultiSelectionFeedbackPlugin = class extends WeavePlugin {
37964
- selectedHalos = {};
37965
38354
  constructor(params) {
37966
38355
  super();
37967
38356
  this.config = mergeExceptArrays(WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_DEFAULT_CONFIG, params?.config ?? {});
38357
+ this.initialize();
38358
+ }
38359
+ initialize() {
37968
38360
  this.selectedHalos = {};
37969
38361
  }
37970
38362
  getName() {
@@ -38130,12 +38522,14 @@ var WeaveNodesMultiSelectionFeedbackPlugin = class extends WeavePlugin {
38130
38522
  //#endregion
38131
38523
  //#region src/plugins/connected-users/connected-users.ts
38132
38524
  var WeaveConnectedUsersPlugin = class extends WeavePlugin {
38133
- connectedUsers = {};
38134
38525
  getLayerName = void 0;
38135
38526
  constructor(params) {
38136
38527
  super();
38137
38528
  const { config } = params ?? {};
38138
38529
  this.config = config;
38530
+ this.initialize();
38531
+ }
38532
+ initialize() {
38139
38533
  this.connectedUsers = {};
38140
38534
  }
38141
38535
  getName() {
@@ -38182,6 +38576,9 @@ var WeaveUsersSelectionPlugin = class extends WeavePlugin {
38182
38576
  this.config = config;
38183
38577
  this.config.getUser = memoize(this.config.getUser);
38184
38578
  this.config.getUserColor = memoize(this.config.getUserColor);
38579
+ this.initialize();
38580
+ }
38581
+ initialize() {
38185
38582
  this.usersSelection = {};
38186
38583
  }
38187
38584
  getName() {
@@ -38374,6 +38771,9 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
38374
38771
  this.config.getUser = memoize(this.config.getUser);
38375
38772
  this.config.getUserBackgroundColor = memoize(this.config.getUserBackgroundColor);
38376
38773
  this.config.getUserForegroundColor = memoize(this.config.getUserForegroundColor);
38774
+ this.initialize();
38775
+ }
38776
+ initialize() {
38377
38777
  this.usersPointers = {};
38378
38778
  this.usersOperations = {};
38379
38779
  }
@@ -38584,6 +38984,9 @@ var WeaveUsersPresencePlugin = class extends WeavePlugin {
38584
38984
  super();
38585
38985
  const { config } = params;
38586
38986
  this.config = mergeExceptArrays(WEAVE_USERS_PRESENCE_CONFIG_DEFAULT_PROPS, config);
38987
+ this.initialize();
38988
+ }
38989
+ initialize() {
38587
38990
  this.userPresence = {};
38588
38991
  }
38589
38992
  getName() {
@@ -38659,6 +39062,9 @@ var WeaveStageDropAreaPlugin = class extends WeavePlugin {
38659
39062
  initLayer = void 0;
38660
39063
  constructor() {
38661
39064
  super();
39065
+ this.initialize();
39066
+ }
39067
+ initialize() {
38662
39068
  this.enabled = true;
38663
39069
  }
38664
39070
  getName() {
@@ -38672,14 +39078,20 @@ var WeaveStageDropAreaPlugin = class extends WeavePlugin {
38672
39078
  stage.container().addEventListener("dragover", (e) => {
38673
39079
  e.preventDefault();
38674
39080
  e.stopPropagation();
38675
- });
39081
+ }, { signal: this.instance.getEventsController()?.signal });
38676
39082
  stage.container().addEventListener("drop", (e) => {
38677
39083
  e.preventDefault();
38678
39084
  e.stopPropagation();
38679
39085
  this.instance.emitEvent("onStageDrop", e);
39086
+ }, { signal: this.instance.getEventsController()?.signal });
39087
+ window.addEventListener("dragover", (e) => e.preventDefault(), {
39088
+ signal: this.instance.getEventsController()?.signal,
39089
+ passive: false
39090
+ });
39091
+ window.addEventListener("drop", (e) => e.preventDefault(), {
39092
+ signal: this.instance.getEventsController()?.signal,
39093
+ passive: false
38680
39094
  });
38681
- window.addEventListener("dragover", (e) => e.preventDefault(), { passive: false });
38682
- window.addEventListener("drop", (e) => e.preventDefault(), { passive: false });
38683
39095
  }
38684
39096
  enable() {
38685
39097
  this.enabled = true;
@@ -38698,6 +39110,9 @@ var WeaveNodesEdgeSnappingPlugin = class extends WeavePlugin {
38698
39110
  this.guideLineConfig = config?.guideLine ?? GUIDE_LINE_DEFAULT_CONFIG;
38699
39111
  this.dragSnappingThreshold = config?.dragSnappingThreshold ?? GUIDE_LINE_DRAG_SNAPPING_THRESHOLD;
38700
39112
  this.transformSnappingThreshold = config?.transformSnappingThreshold ?? GUIDE_LINE_TRANSFORM_SNAPPING_THRESHOLD;
39113
+ this.initialize();
39114
+ }
39115
+ initialize() {
38701
39116
  this.enabled = true;
38702
39117
  }
38703
39118
  getName() {
@@ -39074,6 +39489,9 @@ var WeaveNodesDistanceSnappingPlugin = class extends WeavePlugin {
39074
39489
  this.enterSnappingTolerance = config?.enterSnappingTolerance ?? GUIDE_ENTER_SNAPPING_TOLERANCE;
39075
39490
  this.exitSnappingTolerance = config?.exitSnappingTolerance ?? GUIDE_EXIT_SNAPPING_TOLERANCE;
39076
39491
  this.uiConfig = mergeExceptArrays(GUIDE_DISTANCE_LINE_DEFAULT_CONFIG, config?.ui);
39492
+ this.initialize();
39493
+ }
39494
+ initialize() {
39077
39495
  this.enabled = true;
39078
39496
  }
39079
39497
  getName() {
@@ -39720,12 +40138,14 @@ var WeaveNodesDistanceSnappingPlugin = class extends WeavePlugin {
39720
40138
  //#endregion
39721
40139
  //#region src/plugins/comments-renderer/comments-renderer.ts
39722
40140
  var WeaveCommentsRendererPlugin = class extends WeavePlugin {
39723
- comments = [];
39724
40141
  getLayerName = void 0;
39725
40142
  constructor(params) {
39726
40143
  super();
39727
40144
  const { config } = params ?? {};
39728
40145
  this.config = config;
40146
+ this.initialize();
40147
+ }
40148
+ initialize() {
39729
40149
  this.comments = [];
39730
40150
  }
39731
40151
  getName() {
@@ -39816,6 +40236,7 @@ const WEAVE_STAGE_KEYBOARD_MOVE_DEFAULT_CONFIG = { movementDelta: 5 };
39816
40236
  var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
39817
40237
  getLayerName = void 0;
39818
40238
  initLayer = void 0;
40239
+ initialize = void 0;
39819
40240
  constructor(params) {
39820
40241
  super();
39821
40242
  this.config = mergeExceptArrays(WEAVE_STAGE_KEYBOARD_MOVE_DEFAULT_CONFIG, params?.config ?? {});
@@ -39854,7 +40275,7 @@ var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
39854
40275
  if (e.code === "ArrowLeft" && e.shiftKey) this.handleNodesMovement("left");
39855
40276
  if (e.code === "ArrowRight" && e.shiftKey) this.handleNodesMovement("right");
39856
40277
  if (e.code === "ArrowDown" && e.shiftKey) this.handleNodesMovement("down");
39857
- });
40278
+ }, { signal: this.instance.getEventsController()?.signal });
39858
40279
  }
39859
40280
  enable() {
39860
40281
  this.enabled = true;
@@ -39865,5 +40286,5 @@ var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
39865
40286
  };
39866
40287
 
39867
40288
  //#endregion
39868
- 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, getJSONFromYjsBinary, getPositionRelativeToContainerOnPosition, getSelectedNodesMetadata, getStageClickPoint, getTargetAndSkipNodes, getTargetedNode, getTopmostShadowHost, getVisibleNodes, getVisibleNodesInViewport, hasFrames, hasImages, intersectArrays, isArray, isIOS, isInShadowDOM, isNodeInSelection, isObject, isServer, loadImageSource, mapJsonToYjsArray, mapJsonToYjsElements, mapJsonToYjsMap, memoize, mergeExceptArrays, moveNodeToContainer, moveNodeToContainerNT, resetScale, setupCanvasBackend, setupSkiaBackend, weavejsToYjsBinary };
40289
+ 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, getJSONFromYjsBinary, getPositionRelativeToContainerOnPosition, getSelectedNodesMetadata, getStageClickPoint, getTargetAndSkipNodes, getTargetedNode, getTopmostShadowHost, getVisibleNodes, getVisibleNodesInViewport, hasFrames, hasImages, intersectArrays, isArray, isIOS, isInShadowDOM, isNodeInSelection, isObject, isServer, loadImageSource, mapJsonToYjsArray, mapJsonToYjsElements, mapJsonToYjsMap, memoize, mergeExceptArrays, moveNodeToContainer, moveNodeToContainerNT, resetScale, setupCanvasBackend, setupSkiaBackend, weavejsToYjsBinary };
39869
40290
  //# sourceMappingURL=types.js.map