@inditextech/weave-sdk 3.2.5 → 3.4.0-SNAPSHOT.38.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/sdk.js CHANGED
@@ -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() {
@@ -18646,6 +18654,9 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
18646
18654
  constructor(params) {
18647
18655
  super();
18648
18656
  this.config = mergeExceptArrays(WEAVE_NODES_SELECTION_DEFAULT_CONFIG, params?.config ?? {});
18657
+ this.initialize();
18658
+ }
18659
+ initialize() {
18649
18660
  this.defaultEnabledAnchors = this.config.selection?.enabledAnchors ?? [
18650
18661
  "top-left",
18651
18662
  "top-center",
@@ -19435,7 +19446,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
19435
19446
  if (existNode) newSelectedNodes.push(existNode);
19436
19447
  }
19437
19448
  this.tr.nodes([...newSelectedNodes]);
19438
- this.tr.forceUpdate();
19449
+ if (newSelectedNodes.length > 0) this.tr.forceUpdate();
19439
19450
  this.triggerSelectedNodesEvent();
19440
19451
  }
19441
19452
  getSelectionPlugin() {
@@ -19688,6 +19699,9 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
19688
19699
  super();
19689
19700
  this.getImageBase64 = params.getImageBase64;
19690
19701
  this.config = mergeExceptArrays(WEAVE_COPY_PASTE_CONFIG_DEFAULT, params?.config);
19702
+ this.initialize();
19703
+ }
19704
+ initialize() {
19691
19705
  this.actualInternalPaddingX = 0;
19692
19706
  this.actualInternalPaddingY = 0;
19693
19707
  this.lastInternalPasteSnapshot = "";
@@ -21967,11 +21981,34 @@ var WeaveRegisterManager = class {
21967
21981
  }
21968
21982
  }
21969
21983
  }
21984
+ resetNodesHandlers() {
21985
+ for (const nodeHandlerId of Object.keys(this.nodesHandlers)) {
21986
+ const nodeHandler = this.nodesHandlers[nodeHandlerId];
21987
+ nodeHandler.initialize?.();
21988
+ }
21989
+ }
21990
+ resetActionsHandlers() {
21991
+ for (const actionHandlerId of Object.keys(this.actionsHandlers)) {
21992
+ const actionHandler = this.actionsHandlers[actionHandlerId];
21993
+ actionHandler.initialize?.();
21994
+ }
21995
+ }
21996
+ resetPlugins() {
21997
+ for (const pluginId of Object.keys(this.plugins)) {
21998
+ const plugin = this.plugins[pluginId];
21999
+ plugin.initialize?.();
22000
+ }
22001
+ }
22002
+ reset() {
22003
+ this.resetNodesHandlers();
22004
+ this.resetActionsHandlers();
22005
+ this.resetPlugins();
22006
+ }
21970
22007
  };
21971
22008
 
21972
22009
  //#endregion
21973
22010
  //#region package.json
21974
- var version = "3.2.5";
22011
+ var version = "3.4.0-SNAPSHOT.38.1";
21975
22012
 
21976
22013
  //#endregion
21977
22014
  //#region src/managers/setup.ts
@@ -22088,6 +22125,9 @@ var WeaveStageManager = class {
22088
22125
  initialZIndex: void 0
22089
22126
  };
22090
22127
  const stage = new Konva.Stage({ ...props });
22128
+ const containerParent = stage.container().parentNode;
22129
+ stage.width(containerParent.clientWidth);
22130
+ stage.height(containerParent.clientHeight);
22091
22131
  const realContainer = stage.container();
22092
22132
  if (realContainer !== void 0 && realContainer.style?.position !== "relative") realContainer.style.position = "relative";
22093
22133
  this.setStage(stage);
@@ -22396,6 +22436,91 @@ var WeaveExportManager = class {
22396
22436
  height: imageHeight * pixelRatio
22397
22437
  };
22398
22438
  }
22439
+ async exportAreaServerSide(area, options) {
22440
+ const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
22441
+ this.getNodesSelectionPlugin()?.disable();
22442
+ this.getNodesDistanceSnappingPlugin()?.disable();
22443
+ this.getNodesEdgeSnappingPlugin()?.disable();
22444
+ this.getStageGridPlugin()?.disable();
22445
+ const stage = this.instance.getStage();
22446
+ const mainLayer = this.instance.getMainLayer();
22447
+ if (!mainLayer) throw new Error("Main layer not found");
22448
+ const originalPosition = {
22449
+ x: stage.x(),
22450
+ y: stage.y()
22451
+ };
22452
+ const originalScale = {
22453
+ x: stage.scaleX(),
22454
+ y: stage.scaleY()
22455
+ };
22456
+ stage.scale({
22457
+ x: 1,
22458
+ y: 1
22459
+ });
22460
+ const bounds = area;
22461
+ const scaleX = stage.scaleX();
22462
+ const scaleY = stage.scaleY();
22463
+ const unscaledBounds = {
22464
+ x: bounds.x / scaleX,
22465
+ y: bounds.y / scaleY,
22466
+ width: bounds.width / scaleX,
22467
+ height: bounds.height / scaleY
22468
+ };
22469
+ const background = new Konva.Rect({
22470
+ x: unscaledBounds.x - padding,
22471
+ y: unscaledBounds.y - padding,
22472
+ width: unscaledBounds.width + 2 * padding,
22473
+ height: unscaledBounds.height + 2 * padding,
22474
+ strokeWidth: 0,
22475
+ fill: backgroundColor
22476
+ });
22477
+ mainLayer.add(background);
22478
+ background.moveToBottom();
22479
+ const backgroundRect = background.getClientRect();
22480
+ const composites = [];
22481
+ const imageWidth = Math.round(backgroundRect.width);
22482
+ const imageHeight = Math.round(backgroundRect.height);
22483
+ const maxRenderSize = 1920;
22484
+ const cols = Math.ceil(imageWidth / maxRenderSize);
22485
+ const rows = Math.ceil(imageHeight / maxRenderSize);
22486
+ const tileWidth = Math.floor(imageWidth / cols);
22487
+ const tileHeight = Math.floor(imageHeight / rows);
22488
+ for (let y = 0; y < imageHeight; y += tileHeight) for (let x = 0; x < imageWidth; x += tileWidth) {
22489
+ const width = Math.min(tileWidth, imageWidth - x);
22490
+ const height = Math.min(tileHeight, imageHeight - y);
22491
+ const canvas = await mainLayer.toCanvas({
22492
+ x: Math.round(backgroundRect.x) + x,
22493
+ y: Math.round(backgroundRect.y) + y,
22494
+ width,
22495
+ height,
22496
+ mimeType: format,
22497
+ pixelRatio,
22498
+ quality: options.quality ?? 1
22499
+ });
22500
+ let buffer = null;
22501
+ if (globalThis._weave_serverSideBackend === WEAVE_KONVA_BACKEND.CANVAS) buffer = canvas.toBuffer();
22502
+ if (globalThis._weave_serverSideBackend === WEAVE_KONVA_BACKEND.SKIA) buffer = await canvas.toBuffer();
22503
+ if (!buffer) throw new Error("Failed to generate image buffer");
22504
+ composites.push({
22505
+ top: y * pixelRatio,
22506
+ left: x * pixelRatio,
22507
+ input: buffer
22508
+ });
22509
+ }
22510
+ background.destroy();
22511
+ stage.position(originalPosition);
22512
+ stage.scale(originalScale);
22513
+ stage.batchDraw();
22514
+ this.getNodesSelectionPlugin()?.enable();
22515
+ this.getNodesDistanceSnappingPlugin()?.enable();
22516
+ this.getNodesEdgeSnappingPlugin()?.enable();
22517
+ this.getStageGridPlugin()?.enable();
22518
+ return {
22519
+ composites,
22520
+ width: imageWidth * pixelRatio,
22521
+ height: imageHeight * pixelRatio
22522
+ };
22523
+ }
22399
22524
  imageToBase64(img, mimeType) {
22400
22525
  if (img.naturalWidth === 0 && img.naturalHeight === 0) throw new Error("Image has no content");
22401
22526
  const canvas = document.createElement("canvas");
@@ -22675,7 +22800,12 @@ var WeaveAsyncManager = class {
22675
22800
  this.instance.emitEvent("onAsyncElementChange");
22676
22801
  }, new Map());
22677
22802
  }
22803
+ reset() {
22804
+ this.asyncElements.clear();
22805
+ this.asyncElementsLoadedEventEmitted = false;
22806
+ }
22678
22807
  checkForAsyncElements(elements) {
22808
+ this.instance.emitEvent("onAsyncElementsIdle");
22679
22809
  const amountAsyncResourcesExtracted = this.extractAsyncResources(elements);
22680
22810
  if (amountAsyncResourcesExtracted === 0 && !this.asyncElementsLoadedEventEmitted) {
22681
22811
  this.instance.emitEvent("onAsyncElementsLoaded");
@@ -22728,7 +22858,7 @@ var WeaveAsyncManager = class {
22728
22858
  status: WEAVE_ASYNC_STATUS.LOADING
22729
22859
  };
22730
22860
  this.asyncElements.set(nodeId, element);
22731
- this.instance.emitEvent("onAsyncElementsLoading", {
22861
+ if (!this.asyncElementsLoadedEventEmitted) this.instance.emitEvent("onAsyncElementsLoading", {
22732
22862
  loaded: this.getAmountAsyncElementsLoaded(),
22733
22863
  total: this.getAmountAsyncElements()
22734
22864
  });
@@ -22741,11 +22871,11 @@ var WeaveAsyncManager = class {
22741
22871
  status: WEAVE_ASYNC_STATUS.LOADED
22742
22872
  };
22743
22873
  this.asyncElements.set(nodeId, element);
22744
- this.instance.emitEvent("onAsyncElementsLoading", {
22745
- loaded: this.getAmountAsyncElementsLoaded(),
22746
- total: this.getAmountAsyncElements()
22747
- });
22748
22874
  if (!this.asyncElementsLoadedEventEmitted) {
22875
+ this.instance.emitEvent("onAsyncElementsLoading", {
22876
+ loaded: this.getAmountAsyncElementsLoaded(),
22877
+ total: this.getAmountAsyncElements()
22878
+ });
22749
22879
  const allLoaded = this.asyncElementsLoaded();
22750
22880
  if (allLoaded) {
22751
22881
  this.instance.emitEvent("onAsyncElementsLoaded");
@@ -22962,6 +23092,34 @@ var Weave = class {
22962
23092
  store.setup();
22963
23093
  store.connect();
22964
23094
  }
23095
+ async switchRoom() {
23096
+ this.moduleLogger.info(`Switching room`);
23097
+ const nodeHandlers = this.registerManager.getNodesHandlers();
23098
+ for (const nodeHandlerKey of Object.keys(nodeHandlers)) {
23099
+ const nodeHandler = nodeHandlers[nodeHandlerKey];
23100
+ nodeHandler?.onDestroyInstance();
23101
+ }
23102
+ const stage = this.getStage();
23103
+ if (stage) stage.destroy();
23104
+ this.registerManager.reset();
23105
+ this.asyncManager.reset();
23106
+ this.moduleLogger.info("Switching room instance");
23107
+ if (!this.isServerSide()) {
23108
+ if (!window.weave) window.weave = this;
23109
+ }
23110
+ this.emitEvent("onRoomLoaded", false);
23111
+ this.status = WEAVE_INSTANCE_STATUS.STARTING;
23112
+ this.emitEvent("onInstanceStatus", this.status);
23113
+ this.registerManager.reset();
23114
+ this.status = WEAVE_INSTANCE_STATUS.LOADING_FONTS;
23115
+ this.emitEvent("onInstanceStatus", this.status);
23116
+ await this.fontsManager.loadFonts();
23117
+ this.setupManager.setupLog();
23118
+ this.stageManager.initStage();
23119
+ this.status = WEAVE_INSTANCE_STATUS.CONNECTING_TO_ROOM;
23120
+ this.emitEvent("onInstanceStatus", this.status);
23121
+ this.addEventListener("onStoreConnectionStatusChange", this.handleStoreConnectionStatusChange.bind(this));
23122
+ }
22965
23123
  destroy() {
22966
23124
  this.moduleLogger.info(`Destroying the instance`);
22967
23125
  this.emitter.clearListeners();
@@ -23433,6 +23591,9 @@ var Weave = class {
23433
23591
  async exportNodesServerSide(nodes, boundingNodes, options) {
23434
23592
  return await this.exportManager.exportNodesServerSide(nodes, boundingNodes, options);
23435
23593
  }
23594
+ async exportAreaServerSide(area, options) {
23595
+ return await this.exportManager.exportAreaServerSide(area, options);
23596
+ }
23436
23597
  async exportNodes(nodes, boundingNodes, options) {
23437
23598
  return await this.exportManager.exportNodesAsImage(nodes, boundingNodes, options);
23438
23599
  }
@@ -23720,7 +23881,14 @@ const setupUpscaleStage = (instance, stage) => {
23720
23881
  innerElement.style.transformOrigin = "0 0";
23721
23882
  innerElement.style.transform = `scale(${scaleToCover})`;
23722
23883
  }
23723
- } else stage.setAttrs({ upscaleScale: 1 });
23884
+ } else {
23885
+ const realContainer = stage.container();
23886
+ const containerWidth = realContainer.offsetWidth;
23887
+ const containerHeight = realContainer.offsetHeight;
23888
+ stage.width(containerWidth);
23889
+ stage.height(containerHeight);
23890
+ stage.setAttrs({ upscaleScale: 1 });
23891
+ }
23724
23892
  };
23725
23893
 
23726
23894
  //#endregion
@@ -23731,6 +23899,7 @@ var WeaveStageNode = class extends WeaveNode {
23731
23899
  wheelMousePressed = false;
23732
23900
  isCmdCtrlPressed = false;
23733
23901
  globalEventsInitialized = false;
23902
+ initialize = void 0;
23734
23903
  onRender(props) {
23735
23904
  const stage = new Konva.Stage({
23736
23905
  ...props,
@@ -23853,6 +24022,7 @@ const WEAVE_LAYER_NODE_TYPE = "layer";
23853
24022
  //#region src/nodes/layer/layer.ts
23854
24023
  var WeaveLayerNode = class extends WeaveNode {
23855
24024
  nodeType = WEAVE_LAYER_NODE_TYPE;
24025
+ initialize = void 0;
23856
24026
  onRender(props) {
23857
24027
  const layer = new Konva.Layer({ ...props });
23858
24028
  layer.canMoveToContainer = function() {
@@ -23900,6 +24070,7 @@ const WEAVE_GROUP_NODE_TYPE = "group";
23900
24070
  //#region src/nodes/group/group.ts
23901
24071
  var WeaveGroupNode = class extends WeaveNode {
23902
24072
  nodeType = WEAVE_GROUP_NODE_TYPE;
24073
+ initialize = void 0;
23903
24074
  constructor(params) {
23904
24075
  super();
23905
24076
  const { config } = params ?? {};
@@ -23992,6 +24163,7 @@ const WEAVE_RECTANGLE_NODE_TYPE = "rectangle";
23992
24163
  //#region src/nodes/rectangle/rectangle.ts
23993
24164
  var WeaveRectangleNode = class extends WeaveNode {
23994
24165
  nodeType = WEAVE_RECTANGLE_NODE_TYPE;
24166
+ initialize = void 0;
23995
24167
  constructor(params) {
23996
24168
  super();
23997
24169
  const { config } = params ?? {};
@@ -24035,6 +24207,7 @@ const WEAVE_ELLIPSE_NODE_TYPE = "ellipse";
24035
24207
  //#region src/nodes/ellipse/ellipse.ts
24036
24208
  var WeaveEllipseNode = class extends WeaveNode {
24037
24209
  nodeType = WEAVE_ELLIPSE_NODE_TYPE;
24210
+ initialize = void 0;
24038
24211
  constructor(params) {
24039
24212
  super();
24040
24213
  const { config } = params ?? {};
@@ -24139,11 +24312,15 @@ var GreedySnapper = class {
24139
24312
  reset() {
24140
24313
  this.snappedAngle = null;
24141
24314
  }
24315
+ angleDiff(a, b) {
24316
+ const diff = Math.abs(a - b) % 360;
24317
+ return diff > 180 ? 360 - diff : diff;
24318
+ }
24142
24319
  apply(angleDeg) {
24143
24320
  const { snapAngles, activateThreshold, releaseThreshold } = this.config;
24144
24321
  const normalized = (angleDeg % 360 + 360) % 360;
24145
24322
  if (this.snappedAngle !== null) {
24146
- const diff = Math.abs(normalized - this.snappedAngle);
24323
+ const diff = this.angleDiff(normalized, this.snappedAngle);
24147
24324
  if (diff > releaseThreshold) {
24148
24325
  this.snappedAngle = null;
24149
24326
  return normalized;
@@ -24176,13 +24353,16 @@ var WeaveLineNode = class extends WeaveNode {
24176
24353
  constructor(params) {
24177
24354
  super();
24178
24355
  this.config = mergeExceptArrays(WEAVE_LINE_NODE_DEFAULT_CONFIG, params?.config ?? {});
24179
- this.handleNodeChanges = null;
24180
- this.handleZoomChanges = null;
24181
24356
  this.snapper = new GreedySnapper({
24182
24357
  snapAngles: this.config.snapAngles.angles,
24183
24358
  activateThreshold: this.config.snapAngles.activateThreshold,
24184
24359
  releaseThreshold: this.config.snapAngles.releaseThreshold
24185
24360
  });
24361
+ this.initialize();
24362
+ }
24363
+ initialize() {
24364
+ this.handleNodeChanges = null;
24365
+ this.handleZoomChanges = null;
24186
24366
  }
24187
24367
  onRender(props) {
24188
24368
  const line = new Konva.Line({
@@ -24487,17 +24667,19 @@ const TEXT_LAYOUT = {
24487
24667
  //#region src/nodes/text/text.ts
24488
24668
  var WeaveTextNode = class extends WeaveNode {
24489
24669
  nodeType = WEAVE_TEXT_NODE_TYPE;
24490
- editing = false;
24491
- textAreaSuperContainer = null;
24492
- textAreaContainer = null;
24493
- textArea = null;
24494
- eventsInitialized = false;
24495
- isCtrlMetaPressed = false;
24496
24670
  constructor(params) {
24497
24671
  super();
24498
24672
  const { config } = params ?? {};
24499
24673
  this.config = (0, import_lodash.merge)({}, WEAVE_TEXT_NODE_DEFAULT_CONFIG, config);
24674
+ this.initialize();
24675
+ }
24676
+ initialize() {
24500
24677
  this.keyPressHandler = void 0;
24678
+ this.eventsInitialized = false;
24679
+ this.isCtrlMetaPressed = false;
24680
+ this.textAreaSuperContainer = null;
24681
+ this.textAreaContainer = null;
24682
+ this.textArea = null;
24501
24683
  this.editing = false;
24502
24684
  this.textArea = null;
24503
24685
  }
@@ -25819,24 +26001,21 @@ const isAllowedUrl = (value) => {
25819
26001
  //#endregion
25820
26002
  //#region src/nodes/image/image.ts
25821
26003
  var WeaveImageNode = class extends WeaveNode {
25822
- imageBitmapCache = {};
25823
- imageSource = {};
25824
- imageFallback = {};
25825
- imageState = {};
25826
- imageTryoutAttempts = {};
25827
- imageTryoutIds = {};
25828
26004
  nodeType = WEAVE_IMAGE_NODE_TYPE;
25829
26005
  cursorsFallback = { loading: "wait" };
25830
26006
  cursors = {};
25831
26007
  constructor(params) {
25832
26008
  super();
25833
26009
  const { config } = params ?? {};
26010
+ this.config = mergeExceptArrays(WEAVE_IMAGE_DEFAULT_CONFIG, config);
26011
+ this.initialize();
26012
+ }
26013
+ initialize() {
25834
26014
  this.tapStart = {
25835
26015
  x: 0,
25836
26016
  y: 0,
25837
26017
  time: 0
25838
26018
  };
25839
- this.config = mergeExceptArrays(WEAVE_IMAGE_DEFAULT_CONFIG, config);
25840
26019
  this.imageCrop = null;
25841
26020
  this.imageBitmapCache = {};
25842
26021
  this.imageSource = {};
@@ -26442,7 +26621,7 @@ var WeaveImageNode = class extends WeaveNode {
26442
26621
  }
26443
26622
  this.loadAsyncElement(id);
26444
26623
  preloadFunction(id, realImageURL ?? "", {
26445
- onLoad: () => {
26624
+ onLoad: async () => {
26446
26625
  if (useFallback) this.imageTryoutIds[id] = setTimeout(() => {
26447
26626
  const node = this.instance.getStage().findOne(`#${id}`);
26448
26627
  if (node) {
@@ -26674,6 +26853,7 @@ const WEAVE_STAR_NODE_TYPE = "star";
26674
26853
  //#region src/nodes/star/star.ts
26675
26854
  var WeaveStarNode = class extends WeaveNode {
26676
26855
  nodeType = WEAVE_STAR_NODE_TYPE;
26856
+ initialize = void 0;
26677
26857
  constructor(params) {
26678
26858
  super();
26679
26859
  const { config } = params ?? {};
@@ -26759,6 +26939,7 @@ const WEAVE_ARROW_NODE_TYPE = "arrow";
26759
26939
  //#region src/nodes/arrow/arrow.ts
26760
26940
  var WeaveArrowNode = class extends WeaveNode {
26761
26941
  nodeType = WEAVE_ARROW_NODE_TYPE;
26942
+ initialize = void 0;
26762
26943
  constructor(params) {
26763
26944
  super();
26764
26945
  const { config } = params ?? {};
@@ -26815,6 +26996,7 @@ const WEAVE_REGULAR_POLYGON_NODE_TYPE = "regular-polygon";
26815
26996
  //#region src/nodes/regular-polygon/regular-polygon.ts
26816
26997
  var WeaveRegularPolygonNode = class extends WeaveNode {
26817
26998
  nodeType = WEAVE_REGULAR_POLYGON_NODE_TYPE;
26999
+ initialize = void 0;
26818
27000
  constructor(params) {
26819
27001
  super();
26820
27002
  const { config } = params ?? {};
@@ -26928,6 +27110,7 @@ var GroupFrame = class extends Konva.Group {
26928
27110
  //#region src/nodes/frame/frame.ts
26929
27111
  var WeaveFrameNode = class extends WeaveNode {
26930
27112
  nodeType = WEAVE_FRAME_NODE_TYPE;
27113
+ initialize = void 0;
26931
27114
  constructor(params) {
26932
27115
  super();
26933
27116
  const { config } = params ?? {};
@@ -27228,6 +27411,7 @@ const WEAVE_STROKE_NODE_DEFAULT_CONFIG = {
27228
27411
  //#region src/nodes/stroke/stroke.ts
27229
27412
  var WeaveStrokeNode = class extends WeaveNode {
27230
27413
  nodeType = WEAVE_STROKE_NODE_TYPE;
27414
+ initialize = void 0;
27231
27415
  constructor(params) {
27232
27416
  super();
27233
27417
  const { config } = params ?? {};
@@ -27466,8 +27650,8 @@ const WEAVE_STROKE_SINGLE_NODE_DEFAULT_CONFIG = { snapAngles: {
27466
27650
  270,
27467
27651
  315
27468
27652
  ],
27469
- activateThreshold: 5,
27470
- releaseThreshold: 10
27653
+ activateThreshold: 3,
27654
+ releaseThreshold: 4
27471
27655
  } };
27472
27656
  const WEAVE_STROKE_SINGLE_NODE_TIP_TYPE = {
27473
27657
  NONE: "none",
@@ -27589,7 +27773,7 @@ var WeaveArrowLineTipManager = class extends WeaveBaseLineTipManager {
27589
27773
  const height = instance.getAttrs()[`tip${this.capitalizeFirst(point)}Height`] ?? Math.sqrt(3) / 2 * 3;
27590
27774
  const triangle = new Konva.Line({
27591
27775
  id: `${instance.getAttrs().id}-tip-${point}`,
27592
- name: "lineTip",
27776
+ name: "lineTip stroke-internal",
27593
27777
  nodeId: instance.getAttrs().id,
27594
27778
  closed: true,
27595
27779
  stroke,
@@ -27655,7 +27839,7 @@ var WeaveCircleLineTipManager = class extends WeaveBaseLineTipManager {
27655
27839
  const radius = instance.getAttrs()[`tip${this.capitalizeFirst(point)}Radius`] ?? 1.5;
27656
27840
  const circle = new Konva.Circle({
27657
27841
  id: `${instance.getAttrs().id}-tip-${point}`,
27658
- name: "lineTip",
27842
+ name: "lineTip stroke-internal",
27659
27843
  nodeId: instance.getAttrs().id,
27660
27844
  radius,
27661
27845
  stroke: "black",
@@ -27769,7 +27953,7 @@ var WeaveSquareLineTipManager = class extends WeaveBaseLineTipManager {
27769
27953
  const width = instance.getAttrs()[`tip${this.capitalizeFirst(point)}Width`] ?? 3;
27770
27954
  const square = new Konva.Rect({
27771
27955
  id: `${instance.getAttrs().id}-tip-${point}`,
27772
- name: "lineTip",
27956
+ name: "lineTip stroke-internal",
27773
27957
  nodeId: instance.getAttrs().id,
27774
27958
  width,
27775
27959
  height: width,
@@ -27804,8 +27988,6 @@ var WeaveSquareLineTipManager = class extends WeaveBaseLineTipManager {
27804
27988
  //#endregion
27805
27989
  //#region src/nodes/stroke-single/stroke-single.ts
27806
27990
  var WeaveStrokeSingleNode = class extends WeaveNode {
27807
- startHandle = null;
27808
- endHandle = null;
27809
27991
  nodeType = WEAVE_STROKE_SINGLE_NODE_TYPE;
27810
27992
  tipManagers = {
27811
27993
  [WEAVE_STROKE_SINGLE_NODE_TIP_TYPE.ARROW]: new WeaveArrowLineTipManager(),
@@ -27816,15 +27998,33 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
27816
27998
  constructor(params) {
27817
27999
  super();
27818
28000
  this.config = mergeExceptArrays(WEAVE_STROKE_SINGLE_NODE_DEFAULT_CONFIG, params?.config ?? {});
27819
- this.handleNodeChanges = null;
27820
- this.handleZoomChanges = null;
27821
28001
  this.snapper = new GreedySnapper({
27822
28002
  snapAngles: this.config.snapAngles.angles,
27823
28003
  activateThreshold: this.config.snapAngles.activateThreshold,
27824
28004
  releaseThreshold: this.config.snapAngles.releaseThreshold
27825
28005
  });
28006
+ this.initialize();
28007
+ }
28008
+ initialize() {
28009
+ this.eventsInitialized = false;
28010
+ this.startHandle = null;
28011
+ this.endHandle = null;
28012
+ this.handleNodeChanges = null;
28013
+ this.handleZoomChanges = null;
28014
+ this.shiftPressed = false;
28015
+ }
28016
+ initEvents() {
28017
+ if (this.eventsInitialized) return;
28018
+ window.addEventListener("keydown", (e) => {
28019
+ if (e.key === "Shift") this.shiftPressed = true;
28020
+ });
28021
+ window.addEventListener("keyup", (e) => {
28022
+ if (e.key === "Shift") this.shiftPressed = false;
28023
+ });
28024
+ this.eventsInitialized = true;
27826
28025
  }
27827
28026
  onRender(props) {
28027
+ this.initEvents();
27828
28028
  const stroke = new Konva.Group({
27829
28029
  ...props,
27830
28030
  name: `node ${WEAVE_STROKE_SINGLE_NODE_TYPE}`,
@@ -27836,7 +28036,7 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
27836
28036
  ...props,
27837
28037
  id: `${stroke.getAttrs().id}-line`,
27838
28038
  nodeId: stroke.getAttrs().id,
27839
- name: void 0,
28039
+ name: "stroke-internal",
27840
28040
  x: 0,
27841
28041
  y: 0,
27842
28042
  strokeScaleEnabled: true,
@@ -27858,6 +28058,7 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
27858
28058
  shouldOverdrawWholeArea: points.length !== 4
27859
28059
  };
27860
28060
  };
28061
+ this.setupDefaultNodeEvents(stroke);
27861
28062
  let originalStartHandleVisibility = null;
27862
28063
  let originalEndHandleVisibility = null;
27863
28064
  stroke.on("dragstart", () => {
@@ -27872,7 +28073,6 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
27872
28073
  originalStartHandleVisibility = null;
27873
28074
  originalEndHandleVisibility = null;
27874
28075
  });
27875
- this.setupDefaultNodeEvents(stroke);
27876
28076
  if (!this.handleZoomChanges) {
27877
28077
  this.handleZoomChanges = () => {
27878
28078
  if (this.startHandle) this.startHandle.scale({
@@ -27889,12 +28089,10 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
27889
28089
  if (!this.handleNodeChanges) {
27890
28090
  this.handleNodeChanges = (nodes) => {
27891
28091
  this.teardownSelection();
27892
- if (nodes.length === 1 && nodes[0].instance.getAttrs().nodeType === WEAVE_STROKE_SINGLE_NODE_TYPE) {
27893
- const strokeSelected = this.instance.getStage().findOne(`#${nodes[0].instance.getAttrs().id}`);
27894
- if (!strokeSelected) return;
28092
+ if (nodes.length === 1 && nodes[0].node?.type === WEAVE_STROKE_SINGLE_NODE_TYPE) {
27895
28093
  this.setupHandles();
27896
- this.showHandles(strokeSelected);
27897
- this.setupSelection(strokeSelected, true);
28094
+ this.showHandles(nodes[0].instance);
28095
+ this.setupSelection(nodes[0].instance, true);
27898
28096
  } else {
27899
28097
  this.startHandle?.setAttr("strokeId", void 0);
27900
28098
  this.startHandle?.visible(false);
@@ -27937,175 +28135,92 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
27937
28135
  return stroke;
27938
28136
  }
27939
28137
  setupHandles() {
27940
- if (!this.startHandle) {
27941
- const startHandle = new Konva.Circle({
27942
- id: "line-start-handle",
27943
- radius: 5,
27944
- fill: "#ffffff",
27945
- stroke: "#000000",
27946
- strokeWidth: 1,
27947
- edgeDistanceDisableOnDrag: true,
27948
- scaleX: 1 / this.instance.getStage().scaleX(),
27949
- scaleY: 1 / this.instance.getStage().scaleY(),
27950
- draggable: true
27951
- });
27952
- startHandle.on("pointerover", () => {
27953
- this.instance.getStage().container().style.cursor = "move";
27954
- });
27955
- startHandle.on("pointerout", () => {
27956
- this.instance.getStage().container().style.cursor = "default";
27957
- });
27958
- startHandle.on("dragstart", (e) => {
27959
- const tr = this.instance.getPlugin("nodesSelection")?.getTransformer();
27960
- if (tr) tr.hide();
27961
- const strokeId = e.target.getAttr("strokeId");
27962
- const stroke = this.instance.getStage().findOne(`#${strokeId}`);
27963
- if (!stroke) return;
27964
- const points = stroke.getAttrs().linePoints;
27965
- if (points.length === 4) stroke.setAttr("eventTarget", true);
27966
- this.instance.emitEvent("onDrag", e.target);
27967
- });
27968
- startHandle.on("dragmove", (e) => {
27969
- const draggedTarget = e.target;
27970
- const strokeId = draggedTarget.getAttr("strokeId");
27971
- const draggedStroke = this.instance.getStage().findOne(`#${strokeId}`);
27972
- if (!draggedStroke) return;
27973
- const internalLine = draggedStroke.findOne(`#${draggedStroke.getAttrs().id}-line`);
27974
- if (!internalLine) return;
27975
- const points = draggedStroke.getAttrs().linePoints;
27976
- if (points.length !== 4) return;
27977
- this.teardownSelection();
27978
- const newLinePoint = this.getLinePointFromHandle(draggedStroke, e);
27979
- draggedStroke.setAttrs({ linePoints: [
27980
- newLinePoint.x,
27981
- newLinePoint.y,
27982
- points[2],
27983
- points[3]
27984
- ] });
27985
- this.positionHandle(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.START);
27986
- const tipStartStyle = draggedStroke.getAttrs().tipStartStyle ?? "none";
27987
- this.tipManagers[tipStartStyle]?.update(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.START);
27988
- const tipEndStyle = draggedStroke.getAttrs().tipEndStyle ?? "none";
27989
- this.tipManagers[tipEndStyle]?.update(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.END);
27990
- this.setupSelection(draggedStroke);
27991
- });
27992
- startHandle.on("dragend", (e) => {
27993
- const tr = this.instance.getPlugin("nodesSelection")?.getTransformer();
27994
- if (tr) tr.show();
27995
- const draggedTarget = e.target;
27996
- const strokeId = draggedTarget.getAttr("strokeId");
27997
- const draggedStroke = this.instance.getStage().findOne(`#${strokeId}`);
27998
- if (!draggedStroke) return;
27999
- const internalLine = draggedStroke.findOne(`#${draggedStroke.getAttrs().id}-line`);
28000
- if (!internalLine) return;
28001
- const points = draggedStroke.getAttrs().linePoints;
28002
- if (points.length !== 4) return;
28003
- this.teardownSelection();
28004
- const newLinePoint = this.getLinePointFromHandle(draggedStroke, e);
28005
- draggedStroke.setAttrs({ linePoints: [
28006
- newLinePoint.x,
28007
- newLinePoint.y,
28008
- points[2],
28009
- points[3]
28010
- ] });
28011
- this.positionHandle(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.START);
28012
- const tipStartStyle = draggedStroke.getAttrs().tipStartStyle ?? "none";
28013
- this.tipManagers[tipStartStyle]?.update(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.START);
28014
- const tipEndStyle = draggedStroke.getAttrs().tipEndStyle ?? "none";
28015
- this.tipManagers[tipEndStyle]?.update(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.END);
28016
- this.setupSelection(draggedStroke);
28017
- this.instance.updateNode(this.serialize(draggedStroke));
28018
- this.instance.emitEvent("onDrag", null);
28019
- });
28020
- this.startHandle = startHandle;
28138
+ if (!this.startHandle) this.setupHandle("start");
28139
+ if (!this.endHandle) this.setupHandle("end");
28140
+ }
28141
+ setupHandle(side) {
28142
+ const handleDragStart = (e) => {
28143
+ const tr = this.instance.getPlugin("nodesSelection")?.getTransformer();
28144
+ if (tr) tr.hide();
28145
+ const strokeId = e.target.getAttr("strokeId");
28146
+ const stroke = this.instance.getStage().findOne(`#${strokeId}`);
28147
+ if (!stroke) return;
28148
+ const points = stroke.getAttrs().linePoints;
28149
+ if (points.length === 4) stroke.setAttr("eventTarget", true);
28150
+ this.instance.emitEvent("onDrag", e.target);
28151
+ };
28152
+ const handleDragPosition = (side$1) => (e) => {
28153
+ const draggedTarget = e.target;
28154
+ const strokeId = draggedTarget.getAttr("strokeId");
28155
+ const draggedStroke = this.instance.getStage().findOne(`#${strokeId}`);
28156
+ if (!draggedStroke) return;
28157
+ const internalLine = draggedStroke.findOne(`#${draggedStroke.getAttrs().id}-line`);
28158
+ if (!internalLine) return;
28159
+ const points = draggedStroke.getAttrs().linePoints;
28160
+ if (points.length !== 4) return;
28161
+ this.teardownSelection();
28162
+ const newLinePoint = this.getLinePointFromHandle(draggedStroke, e);
28163
+ const pos = this.getDragPoint(draggedStroke, newLinePoint, side$1);
28164
+ if (side$1 === "start") draggedStroke.setAttrs({ linePoints: [
28165
+ pos.x,
28166
+ pos.y,
28167
+ points[2],
28168
+ points[3]
28169
+ ] });
28170
+ else draggedStroke.setAttrs({ linePoints: [
28171
+ points[0],
28172
+ points[1],
28173
+ pos.x,
28174
+ pos.y
28175
+ ] });
28176
+ this.positionHandle(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.START);
28177
+ this.positionHandle(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.END);
28178
+ const tipStartStyle = draggedStroke.getAttrs().tipStartStyle ?? "none";
28179
+ this.tipManagers[tipStartStyle]?.update(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.START);
28180
+ const tipEndStyle = draggedStroke.getAttrs().tipEndStyle ?? "none";
28181
+ this.tipManagers[tipEndStyle]?.update(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.END);
28182
+ this.setupSelection(draggedStroke);
28183
+ };
28184
+ const handleDragMove = (side$1) => (e) => {
28185
+ handleDragPosition(side$1)(e);
28186
+ };
28187
+ const handleDragEnd = (side$1) => (e) => {
28188
+ handleDragPosition(side$1)(e);
28189
+ const draggedTarget = e.target;
28190
+ const strokeId = draggedTarget.getAttr("strokeId");
28191
+ const draggedStroke = this.instance.getStage().findOne(`#${strokeId}`);
28192
+ if (!draggedStroke) return;
28193
+ this.instance.updateNode(this.serialize(draggedStroke));
28194
+ this.instance.emitEvent("onDrag", null);
28195
+ };
28196
+ const handle = new Konva.Circle({
28197
+ id: `line-${side}-handle`,
28198
+ radius: 5,
28199
+ fill: "#ffffff",
28200
+ stroke: "#000000",
28201
+ strokeWidth: 1,
28202
+ edgeDistanceDisableOnDrag: true,
28203
+ scaleX: 1 / this.instance.getStage().scaleX(),
28204
+ scaleY: 1 / this.instance.getStage().scaleY(),
28205
+ draggable: true
28206
+ });
28207
+ handle.on("pointerover", () => {
28208
+ this.instance.getStage().container().style.cursor = "move";
28209
+ });
28210
+ handle.on("pointerout", () => {
28211
+ this.instance.getStage().container().style.cursor = "default";
28212
+ });
28213
+ handle.on("dragstart", handleDragStart);
28214
+ handle.on("dragmove", handleDragMove(side));
28215
+ handle.on("dragend", handleDragEnd(side));
28216
+ if (side === "start") {
28217
+ this.startHandle = handle;
28021
28218
  this.startHandle.visible(false);
28022
- this.instance.getSelectionLayer()?.add(this.startHandle);
28023
- }
28024
- if (!this.endHandle) {
28025
- const endHandle = new Konva.Circle({
28026
- id: "line-end-handle",
28027
- radius: 5,
28028
- fill: "#ffffff",
28029
- stroke: "#000000",
28030
- strokeWidth: 1,
28031
- edgeDistanceDisableOnDrag: true,
28032
- scaleX: 1 / this.instance.getStage().scaleX(),
28033
- scaleY: 1 / this.instance.getStage().scaleY(),
28034
- draggable: true
28035
- });
28036
- endHandle.on("pointerover", () => {
28037
- this.instance.getStage().container().style.cursor = "move";
28038
- });
28039
- endHandle.on("pointerout", () => {
28040
- this.instance.getStage().container().style.cursor = "default";
28041
- });
28042
- endHandle.on("dragstart", (e) => {
28043
- const tr = this.instance.getPlugin("nodesSelection")?.getTransformer();
28044
- if (tr) tr.hide();
28045
- const strokeId = e.target.getAttr("strokeId");
28046
- const draggedStroke = this.instance.getStage().findOne(`#${strokeId}`);
28047
- if (!draggedStroke) return;
28048
- const points = draggedStroke.getAttrs().linePoints;
28049
- if (points.length !== 4) return;
28050
- if (points.length === 4) draggedStroke.setAttr("eventTarget", true);
28051
- this.instance.emitEvent("onDrag", e.target);
28052
- });
28053
- endHandle.on("dragmove", (e) => {
28054
- const draggedTarget = e.target;
28055
- const strokeId = draggedTarget.getAttr("strokeId");
28056
- const draggedStroke = this.instance.getStage().findOne(`#${strokeId}`);
28057
- if (!draggedStroke) return;
28058
- const internalLine = draggedStroke.findOne(`#${draggedStroke.getAttrs().id}-line`);
28059
- if (!internalLine) return;
28060
- const points = draggedStroke.getAttrs().linePoints;
28061
- if (points.length !== 4) return;
28062
- this.teardownSelection();
28063
- const newLinePoint = this.getLinePointFromHandle(draggedStroke, e);
28064
- draggedStroke.setAttrs({ linePoints: [
28065
- points[0],
28066
- points[1],
28067
- newLinePoint.x,
28068
- newLinePoint.y
28069
- ] });
28070
- this.positionHandle(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.END);
28071
- const tipStartStyle = draggedStroke.getAttrs().tipStartStyle ?? "none";
28072
- this.tipManagers[tipStartStyle]?.update(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.START);
28073
- const tipEndStyle = draggedStroke.getAttrs().tipEndStyle ?? "none";
28074
- this.tipManagers[tipEndStyle]?.update(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.END);
28075
- this.setupSelection(draggedStroke);
28076
- });
28077
- endHandle.on("dragend", (e) => {
28078
- const tr = this.instance.getPlugin("nodesSelection")?.getTransformer();
28079
- if (tr) tr.show();
28080
- const draggedTarget = e.target;
28081
- const strokeId = draggedTarget.getAttr("strokeId");
28082
- const draggedStroke = this.instance.getStage().findOne(`#${strokeId}`);
28083
- if (!draggedStroke) return;
28084
- const internalLine = draggedStroke.findOne(`#${draggedStroke.getAttrs().id}-line`);
28085
- if (!internalLine) return;
28086
- const points = draggedStroke.getAttrs().linePoints;
28087
- if (points.length !== 4) return;
28088
- this.teardownSelection();
28089
- const newLinePoint = this.getLinePointFromHandle(draggedStroke, e);
28090
- draggedStroke.setAttrs({ linePoints: [
28091
- points[0],
28092
- points[1],
28093
- newLinePoint.x,
28094
- newLinePoint.y
28095
- ] });
28096
- this.positionHandle(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.END);
28097
- const tipStartStyle = draggedStroke.getAttrs().tipStartStyle ?? "none";
28098
- this.tipManagers[tipStartStyle]?.update(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.START);
28099
- const tipEndStyle = draggedStroke.getAttrs().tipEndStyle ?? "none";
28100
- this.tipManagers[tipEndStyle]?.update(draggedStroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.END);
28101
- this.setupSelection(draggedStroke);
28102
- this.instance.updateNode(this.serialize(draggedStroke));
28103
- this.instance.emitEvent("onDrag", null);
28104
- });
28105
- this.endHandle = endHandle;
28219
+ } else {
28220
+ this.endHandle = handle;
28106
28221
  this.endHandle.visible(false);
28107
- this.instance.getSelectionLayer()?.add(this.endHandle);
28108
28222
  }
28223
+ this.instance.getSelectionLayer()?.add(handle);
28109
28224
  }
28110
28225
  showHandles(stroke) {
28111
28226
  if (this.startHandle === null || this.endHandle === null) return;
@@ -28129,7 +28244,7 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
28129
28244
  this.tipManagers[tipEndStyle]?.render(stroke, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.END);
28130
28245
  const internalLine = stroke.findOne(`#${stroke.getAttrs().id}-line`);
28131
28246
  if (internalLine) internalLine.setAttrs({
28132
- name: void 0,
28247
+ name: "stroke-internal",
28133
28248
  dash: nextProps.dash,
28134
28249
  fill: nextProps.fill,
28135
28250
  stroke: nextProps.stroke,
@@ -28189,20 +28304,19 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
28189
28304
  if (markSelected) instance.setAttrs({ isSelected: true });
28190
28305
  const hoverClone = instance.findOne(".hoverClone");
28191
28306
  if (hoverClone) return;
28192
- const internalLine = instance.findOne(`#${instance.getAttrs().id}-line`);
28193
- if (!internalLine) return;
28194
- const internalLineHover = internalLine.clone();
28195
- internalLineHover.setAttrs({
28196
- name: "hoverClone",
28197
- stroke: "#1a1aff",
28198
- listening: false,
28199
- draggable: false,
28200
- strokeWidth: 1,
28201
- points: instance.getAttrs().linePoints,
28202
- strokeScaleEnabled: false
28203
- });
28204
- instance.add(internalLineHover);
28205
- internalLineHover.moveToTop();
28307
+ const internalNodes = instance.find(".stroke-internal");
28308
+ for (const node of internalNodes) {
28309
+ const internalNode = node.clone();
28310
+ internalNode.setAttrs({
28311
+ name: "hoverClone",
28312
+ fill: "#1a1aff",
28313
+ stroke: "#1a1aff",
28314
+ listening: false,
28315
+ draggable: false
28316
+ });
28317
+ instance.add(internalNode);
28318
+ internalNode.moveToTop();
28319
+ }
28206
28320
  }
28207
28321
  teardownSelection() {
28208
28322
  const stage = this.instance.getStage();
@@ -28220,6 +28334,37 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
28220
28334
  const tipEndStyle = instance.getAttrs().tipEndStyle ?? "none";
28221
28335
  this.tipManagers[tipEndStyle]?.update(instance, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE.END);
28222
28336
  }
28337
+ getDragPoint(draggedStroke, newLinePoint, dragFrom) {
28338
+ const pos = {
28339
+ x: 0,
28340
+ y: 0
28341
+ };
28342
+ const linePoints = draggedStroke.getAttrs().linePoints;
28343
+ const fixed = dragFrom === "start" ? {
28344
+ x: linePoints[2],
28345
+ y: linePoints[3]
28346
+ } : {
28347
+ x: linePoints[0],
28348
+ y: linePoints[1]
28349
+ };
28350
+ if (this.shiftPressed) {
28351
+ let dx = newLinePoint.x - fixed.x;
28352
+ let dy = newLinePoint.y - fixed.y;
28353
+ const angle = Math.atan2(dy, dx);
28354
+ const angleDeg = angle * 180 / Math.PI;
28355
+ const snapped = this.snapper.apply(angleDeg);
28356
+ const dist = Math.hypot(dx, dy);
28357
+ const rad = snapped * Math.PI / 180;
28358
+ dx = Math.cos(rad) * dist;
28359
+ dy = Math.sin(rad) * dist;
28360
+ pos.x = fixed.x + dx;
28361
+ pos.y = fixed.y + dy;
28362
+ } else {
28363
+ pos.x = newLinePoint.x;
28364
+ pos.y = newLinePoint.y;
28365
+ }
28366
+ return pos;
28367
+ }
28223
28368
  };
28224
28369
 
28225
28370
  //#endregion
@@ -28362,6 +28507,9 @@ var WeaveCommentNode = class extends WeaveNode {
28362
28507
  constructor(params) {
28363
28508
  super();
28364
28509
  this.config = mergeExceptArrays(WEAVE_COMMENT_NODE_DEFAULTS, params.config);
28510
+ this.initialize();
28511
+ }
28512
+ initialize() {
28365
28513
  this.commentDomVisibleId = null;
28366
28514
  this.commentDomVisible = false;
28367
28515
  this.commentDomAction = null;
@@ -28990,10 +29138,6 @@ const WEAVE_VIDEO_DEFAULT_CONFIG = {
28990
29138
  //#endregion
28991
29139
  //#region src/nodes/video/video.ts
28992
29140
  var WeaveVideoNode = class extends WeaveNode {
28993
- videoState = {};
28994
- videoSourceFrameId = {};
28995
- videoSource = {};
28996
- videoPlaceholder = {};
28997
29141
  nodeType = WEAVE_VIDEO_NODE_TYPE;
28998
29142
  constructor(params) {
28999
29143
  super();
@@ -29006,6 +29150,13 @@ var WeaveVideoNode = class extends WeaveNode {
29006
29150
  this.videoIconImage.src = this.config.style.icon.dataURL;
29007
29151
  }
29008
29152
  }
29153
+ initialize() {
29154
+ this.videoState = {};
29155
+ this.videoSource = {};
29156
+ this.videoSourceFrameId = {};
29157
+ this.videoPlaceholder = {};
29158
+ this.videoIconImage = void 0;
29159
+ }
29009
29160
  async loadPlaceholder(params, video) {
29010
29161
  const videoProps = params;
29011
29162
  const { id } = videoProps;
@@ -29500,6 +29651,7 @@ const WEAVE_MEASURE_NODE_DEFAULT_CONFIG = { style: {
29500
29651
  var WeaveMeasureNode = class extends WeaveNode {
29501
29652
  nodeType = WEAVE_MEASURE_NODE_TYPE;
29502
29653
  handlePointCircleRadius = 6;
29654
+ initialize = void 0;
29503
29655
  constructor(params) {
29504
29656
  super();
29505
29657
  this.config = mergeExceptArrays(WEAVE_MEASURE_NODE_DEFAULT_CONFIG, params?.config ?? {});
@@ -30790,6 +30942,7 @@ var WeaveConnectorNode = class extends WeaveNode {
30790
30942
  [WEAVE_CONNECTOR_NODE_DECORATOR_TYPE.DOT]: setupNodeDecoratorDot,
30791
30943
  [WEAVE_CONNECTOR_NODE_DECORATOR_TYPE.ARROW]: setupNodeDecoratorArrow
30792
30944
  };
30945
+ initialize = void 0;
30793
30946
  constructor(params) {
30794
30947
  super();
30795
30948
  this.config = mergeExceptArrays(WEAVE_CONNECTOR_NODE_DEFAULT_CONFIG, params?.config);
@@ -31540,10 +31693,6 @@ const WEAVE_STAGE_ZOOM_DEFAULT_CONFIG = {
31540
31693
  var WeaveStageZoomPlugin = class extends WeavePlugin {
31541
31694
  getLayerName = void 0;
31542
31695
  initLayer = void 0;
31543
- pinching = false;
31544
- zooming = false;
31545
- isTrackpad = false;
31546
- zoomVelocity = 0;
31547
31696
  zoomInertiaType = WEAVE_STAGE_ZOOM_TYPE.MOUSE_WHEEL;
31548
31697
  defaultStep = 3;
31549
31698
  constructor(params) {
@@ -31551,8 +31700,13 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
31551
31700
  const { config } = params ?? {};
31552
31701
  this.config = mergeExceptArrays(WEAVE_STAGE_ZOOM_DEFAULT_CONFIG, config);
31553
31702
  if (!this.config.zoomSteps.includes(this.config.defaultZoom)) throw new Error(`Default zoom ${this.config.defaultZoom} is not in zoom steps`);
31703
+ this.initialize();
31704
+ }
31705
+ initialize() {
31554
31706
  this.pinching = false;
31707
+ this.zooming = false;
31555
31708
  this.isTrackpad = false;
31709
+ this.zoomVelocity = 0;
31556
31710
  this.isCtrlOrMetaPressed = false;
31557
31711
  this.updatedMinimumZoom = false;
31558
31712
  this.actualStep = this.config.zoomSteps.findIndex((step) => step === this.config.defaultZoom);
@@ -31839,6 +31993,15 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
31839
31993
  if (box.width === 0 || box.height === 0) return;
31840
31994
  this.fitToElements(box, finalOptions);
31841
31995
  }
31996
+ fitToArea(area, options) {
31997
+ const finalOptions = mergeExceptArrays({
31998
+ smartZoom: false,
31999
+ overrideZoom: true
32000
+ }, options);
32001
+ if (!this.enabled) return;
32002
+ if (area.width === 0 || area.height === 0) return;
32003
+ this.fitToElements(area, finalOptions);
32004
+ }
31842
32005
  enable() {
31843
32006
  this.enabled = true;
31844
32007
  }
@@ -32019,6 +32182,7 @@ const ZOOM_OUT_TOOL_ACTION_NAME = "zoomOutTool";
32019
32182
  //#region src/actions/zoom-out-tool/zoom-out-tool.ts
32020
32183
  var WeaveZoomOutToolAction = class extends WeaveAction {
32021
32184
  onPropsChange = void 0;
32185
+ initialize = void 0;
32022
32186
  getName() {
32023
32187
  return ZOOM_OUT_TOOL_ACTION_NAME;
32024
32188
  }
@@ -32053,6 +32217,10 @@ const ZOOM_IN_TOOL_ACTION_NAME = "zoomInTool";
32053
32217
  //#region src/actions/zoom-in-tool/zoom-in-tool.ts
32054
32218
  var WeaveZoomInToolAction = class extends WeaveAction {
32055
32219
  onPropsChange = void 0;
32220
+ initialize = void 0;
32221
+ constructor() {
32222
+ super();
32223
+ }
32056
32224
  getName() {
32057
32225
  return ZOOM_IN_TOOL_ACTION_NAME;
32058
32226
  }
@@ -32087,6 +32255,10 @@ const FIT_TO_SCREEN_TOOL_ACTION_NAME = "fitToScreenTool";
32087
32255
  //#region src/actions/fit-to-screen-tool/fit-to-screen-tool.ts
32088
32256
  var WeaveFitToScreenToolAction = class extends WeaveAction {
32089
32257
  onPropsChange = void 0;
32258
+ initialize = void 0;
32259
+ constructor() {
32260
+ super();
32261
+ }
32090
32262
  getName() {
32091
32263
  return FIT_TO_SCREEN_TOOL_ACTION_NAME;
32092
32264
  }
@@ -32120,6 +32292,10 @@ const FIT_TO_SELECTION_TOOL_ACTION_NAME = "fitToSelectionTool";
32120
32292
  //#region src/actions/fit-to-selection-tool/fit-to-selection-tool.ts
32121
32293
  var WeaveFitToSelectionToolAction = class extends WeaveAction {
32122
32294
  onPropsChange = void 0;
32295
+ initialize = void 0;
32296
+ constructor() {
32297
+ super();
32298
+ }
32123
32299
  getName() {
32124
32300
  return FIT_TO_SELECTION_TOOL_ACTION_NAME;
32125
32301
  }
@@ -32162,6 +32338,9 @@ var WeaveMoveToolAction = class extends WeaveAction {
32162
32338
  onInit = void 0;
32163
32339
  constructor() {
32164
32340
  super();
32341
+ this.initialize();
32342
+ }
32343
+ initialize() {
32165
32344
  this.initialized = false;
32166
32345
  this.state = MOVE_TOOL_STATE.IDLE;
32167
32346
  }
@@ -32234,6 +32413,9 @@ var WeaveSelectionToolAction = class extends WeaveAction {
32234
32413
  onInit = void 0;
32235
32414
  constructor() {
32236
32415
  super();
32416
+ this.initialize();
32417
+ }
32418
+ initialize() {
32237
32419
  this.initialized = false;
32238
32420
  this.state = SELECTION_TOOL_STATE.IDLE;
32239
32421
  }
@@ -32297,6 +32479,9 @@ var WeaveEraserToolAction = class extends WeaveAction {
32297
32479
  onInit = void 0;
32298
32480
  constructor() {
32299
32481
  super();
32482
+ this.initialize();
32483
+ }
32484
+ initialize() {
32300
32485
  this.initialized = false;
32301
32486
  this.erasing = false;
32302
32487
  this.state = ERASER_TOOL_STATE.IDLE;
@@ -32397,6 +32582,9 @@ var WeaveRectangleToolAction = class extends WeaveAction {
32397
32582
  onInit = void 0;
32398
32583
  constructor() {
32399
32584
  super();
32585
+ this.initialize();
32586
+ }
32587
+ initialize() {
32400
32588
  this.pointers = new Map();
32401
32589
  this.initialized = false;
32402
32590
  this.state = RECTANGLE_TOOL_STATE.IDLE;
@@ -32606,6 +32794,9 @@ var WeaveEllipseToolAction = class extends WeaveAction {
32606
32794
  onInit = void 0;
32607
32795
  constructor() {
32608
32796
  super();
32797
+ this.initialize();
32798
+ }
32799
+ initialize() {
32609
32800
  this.pointers = new Map();
32610
32801
  this.initialized = false;
32611
32802
  this.state = ELLIPSE_TOOL_STATE.IDLE;
@@ -32822,6 +33013,9 @@ var WeavePenToolAction = class extends WeaveAction {
32822
33013
  onInit = void 0;
32823
33014
  constructor() {
32824
33015
  super();
33016
+ this.initialize();
33017
+ }
33018
+ initialize() {
32825
33019
  this.pointers = new Map();
32826
33020
  this.initialized = false;
32827
33021
  this.state = PEN_TOOL_STATE.IDLE;
@@ -33094,6 +33288,9 @@ var WeaveLineToolAction = class extends WeaveAction {
33094
33288
  constructor(params) {
33095
33289
  super();
33096
33290
  this.config = mergeExceptArrays(LINE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
33291
+ this.initialize();
33292
+ }
33293
+ initialize() {
33097
33294
  this.pointers = new Map();
33098
33295
  this.initialized = false;
33099
33296
  this.state = LINE_TOOL_STATE.IDLE;
@@ -33359,6 +33556,9 @@ var WeaveBrushToolAction = class extends WeaveAction {
33359
33556
  constructor(params) {
33360
33557
  super();
33361
33558
  this.config = mergeExceptArrays(BRUSH_TOOL_DEFAULT_CONFIG, params?.config ?? {});
33559
+ this.initialize();
33560
+ }
33561
+ initialize() {
33362
33562
  this.initialized = false;
33363
33563
  this.state = BRUSH_TOOL_STATE.INACTIVE;
33364
33564
  this.strokeId = null;
@@ -33612,6 +33812,9 @@ var WeaveTextToolAction = class extends WeaveAction {
33612
33812
  onInit = void 0;
33613
33813
  constructor() {
33614
33814
  super();
33815
+ this.initialize();
33816
+ }
33817
+ initialize() {
33615
33818
  this.initialized = false;
33616
33819
  this.state = TEXT_TOOL_STATE.IDLE;
33617
33820
  this.textId = null;
@@ -33769,6 +33972,9 @@ var WeaveImageToolAction = class extends WeaveAction {
33769
33972
  constructor(params) {
33770
33973
  super();
33771
33974
  this.config = mergeExceptArrays(WEAVE_IMAGE_TOOL_CONFIG_DEFAULT, params?.config ?? {});
33975
+ this.initialize();
33976
+ }
33977
+ initialize() {
33772
33978
  this.pointers = new Map();
33773
33979
  this.initialized = false;
33774
33980
  this.imageId = null;
@@ -34209,6 +34415,9 @@ var WeaveImagesToolAction = class extends WeaveAction {
34209
34415
  constructor(params) {
34210
34416
  super();
34211
34417
  this.config = mergeExceptArrays(WEAVE_IMAGES_TOOL_DEFAULT_CONFIG, params ?? {});
34418
+ this.initialize();
34419
+ }
34420
+ initialize() {
34212
34421
  this.pointers = new Map();
34213
34422
  this.initialized = false;
34214
34423
  this.tempPointerFeedbackNode = null;
@@ -34637,6 +34846,9 @@ var WeaveStarToolAction = class extends WeaveAction {
34637
34846
  onInit = void 0;
34638
34847
  constructor() {
34639
34848
  super();
34849
+ this.initialize();
34850
+ }
34851
+ initialize() {
34640
34852
  this.pointers = new Map();
34641
34853
  this.initialized = false;
34642
34854
  this.state = STAR_TOOL_STATE.IDLE;
@@ -34838,8 +35050,8 @@ var WeaveStarToolAction = class extends WeaveAction {
34838
35050
 
34839
35051
  //#endregion
34840
35052
  //#region src/actions/arrow-tool/constants.ts
34841
- const ARROW_TOOL_ACTION_NAME = "arrowTool";
34842
- const ARROW_TOOL_STATE = {
35053
+ const WEAVE_ARROW_TOOL_ACTION_NAME = "arrowTool";
35054
+ const WEAVE_ARROW_TOOL_STATE = {
34843
35055
  ["IDLE"]: "idle",
34844
35056
  ["ADDING"]: "adding",
34845
35057
  ["DEFINING_SIZE"]: "definingSize",
@@ -34855,9 +35067,12 @@ var WeaveArrowToolAction = class extends WeaveAction {
34855
35067
  onInit = void 0;
34856
35068
  constructor() {
34857
35069
  super();
35070
+ this.initialize();
35071
+ }
35072
+ initialize() {
34858
35073
  this.pointers = new Map();
34859
35074
  this.initialized = false;
34860
- this.state = ARROW_TOOL_STATE.IDLE;
35075
+ this.state = WEAVE_ARROW_TOOL_STATE.IDLE;
34861
35076
  this.arrowId = null;
34862
35077
  this.tempArrowId = null;
34863
35078
  this.tempMainArrowNode = null;
@@ -34870,7 +35085,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
34870
35085
  this.props = this.initProps();
34871
35086
  }
34872
35087
  getName() {
34873
- return ARROW_TOOL_ACTION_NAME;
35088
+ return WEAVE_ARROW_TOOL_ACTION_NAME;
34874
35089
  }
34875
35090
  initProps() {
34876
35091
  return {
@@ -34887,14 +35102,11 @@ var WeaveArrowToolAction = class extends WeaveAction {
34887
35102
  setupEvents() {
34888
35103
  const stage = this.instance.getStage();
34889
35104
  window.addEventListener("keydown", (e) => {
34890
- if (e.code === "Enter" && this.instance.getActiveAction() === ARROW_TOOL_ACTION_NAME) {
34891
- this.cancelAction();
34892
- return;
34893
- }
34894
- if (e.code === "Escape" && this.instance.getActiveAction() === ARROW_TOOL_ACTION_NAME) {
35105
+ if (e.code === "Enter" && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
34895
35106
  this.cancelAction();
34896
35107
  return;
34897
35108
  }
35109
+ if (e.code === "Escape" && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) this.cancelAction();
34898
35110
  });
34899
35111
  stage.on("pointerdown", (e) => {
34900
35112
  this.setTapStart(e);
@@ -34902,25 +35114,25 @@ var WeaveArrowToolAction = class extends WeaveAction {
34902
35114
  x: e.evt.clientX,
34903
35115
  y: e.evt.clientY
34904
35116
  });
34905
- if (this.pointers.size === 2 && this.instance.getActiveAction() === ARROW_TOOL_ACTION_NAME) {
34906
- this.state = ARROW_TOOL_STATE.ADDING;
35117
+ if (this.pointers.size === 2 && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
35118
+ this.state = WEAVE_ARROW_TOOL_STATE.ADDING;
34907
35119
  return;
34908
35120
  }
34909
- if (!this.tempMainArrowNode && this.state === ARROW_TOOL_STATE.ADDING) this.handleAdding();
34910
- if (this.tempMainArrowNode && this.state === ARROW_TOOL_STATE.ADDING) this.state = ARROW_TOOL_STATE.DEFINING_SIZE;
35121
+ if (!this.tempMainArrowNode && this.state === WEAVE_ARROW_TOOL_STATE.ADDING) this.handleAdding();
35122
+ if (this.tempMainArrowNode && this.state === WEAVE_ARROW_TOOL_STATE.ADDING) this.state = WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE;
34911
35123
  });
34912
35124
  stage.on("pointermove", () => {
34913
- if (this.state === ARROW_TOOL_STATE.IDLE) return;
35125
+ if (this.state === WEAVE_ARROW_TOOL_STATE.IDLE) return;
34914
35126
  this.setCursor();
34915
- if (this.pointers.size === 2 && this.instance.getActiveAction() === ARROW_TOOL_ACTION_NAME) {
34916
- this.state = ARROW_TOOL_STATE.ADDING;
35127
+ if (this.pointers.size === 2 && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
35128
+ this.state = WEAVE_ARROW_TOOL_STATE.ADDING;
34917
35129
  return;
34918
35130
  }
34919
- if (this.state === ARROW_TOOL_STATE.DEFINING_SIZE) this.handleMovement();
35131
+ if (this.state === WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) this.handleMovement();
34920
35132
  });
34921
35133
  stage.on("pointerup", (e) => {
34922
35134
  this.pointers.delete(e.evt.pointerId);
34923
- if (this.state === ARROW_TOOL_STATE.DEFINING_SIZE) this.handleSettingSize();
35135
+ if (this.state === WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) this.handleSettingSize();
34924
35136
  });
34925
35137
  this.initialized = true;
34926
35138
  }
@@ -34934,7 +35146,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
34934
35146
  this.tempPoint = void 0;
34935
35147
  this.tempNextPoint = void 0;
34936
35148
  this.clickPoint = null;
34937
- this.setState(ARROW_TOOL_STATE.ADDING);
35149
+ this.setState(WEAVE_ARROW_TOOL_STATE.ADDING);
34938
35150
  }
34939
35151
  handleAdding() {
34940
35152
  const stage = this.instance.getStage();
@@ -34985,7 +35197,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
34985
35197
  this.measureContainer?.add(this.tempNextPoint);
34986
35198
  this.tempPoint.moveToTop();
34987
35199
  this.tempNextPoint.moveToTop();
34988
- this.setState(ARROW_TOOL_STATE.DEFINING_SIZE);
35200
+ this.setState(WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE);
34989
35201
  }
34990
35202
  }
34991
35203
  handleSettingSize() {
@@ -35012,11 +35224,11 @@ var WeaveArrowToolAction = class extends WeaveAction {
35012
35224
  y: mousePoint.y,
35013
35225
  points: [0, 0]
35014
35226
  });
35015
- this.setState(ARROW_TOOL_STATE.DEFINING_SIZE);
35227
+ this.setState(WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE);
35016
35228
  }
35017
35229
  }
35018
35230
  handleMovement() {
35019
- if (this.state !== ARROW_TOOL_STATE.DEFINING_SIZE) return;
35231
+ if (this.state !== WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) return;
35020
35232
  if (this.arrowId && this.tempArrowNode && this.measureContainer && this.tempNextPoint) {
35021
35233
  const { mousePoint } = this.instance.getMousePointerRelativeToContainer(this.measureContainer);
35022
35234
  this.tempArrowNode.setAttrs({
@@ -35083,7 +35295,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
35083
35295
  this.container = void 0;
35084
35296
  this.measureContainer = void 0;
35085
35297
  this.clickPoint = null;
35086
- this.setState(ARROW_TOOL_STATE.IDLE);
35298
+ this.setState(WEAVE_ARROW_TOOL_STATE.IDLE);
35087
35299
  }
35088
35300
  setCursor() {
35089
35301
  const stage = this.instance.getStage();
@@ -35127,13 +35339,15 @@ const WEAVE_STROKE_TOOL_DEFAULT_CONFIG = { snapAngles: {
35127
35339
  var WeaveStrokeToolAction = class extends WeaveAction {
35128
35340
  initialized = false;
35129
35341
  initialCursor = null;
35130
- snappedAngle = null;
35131
35342
  shiftPressed = false;
35132
35343
  onPropsChange = void 0;
35133
35344
  onInit = void 0;
35134
35345
  constructor(params) {
35135
35346
  super();
35136
35347
  this.config = mergeExceptArrays(WEAVE_STROKE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
35348
+ this.initialize();
35349
+ }
35350
+ initialize() {
35137
35351
  this.pointers = new Map();
35138
35352
  this.initialized = false;
35139
35353
  this.state = WEAVE_STROKE_TOOL_STATE.IDLE;
@@ -35142,7 +35356,6 @@ var WeaveStrokeToolAction = class extends WeaveAction {
35142
35356
  this.tempLineId = null;
35143
35357
  this.tempLineNode = null;
35144
35358
  this.container = void 0;
35145
- this.snappedAngle = null;
35146
35359
  this.measureContainer = void 0;
35147
35360
  this.clickPoint = null;
35148
35361
  this.snapper = new GreedySnapper({
@@ -35155,6 +35368,9 @@ var WeaveStrokeToolAction = class extends WeaveAction {
35155
35368
  getName() {
35156
35369
  return WEAVE_STROKE_TOOL_ACTION_NAME;
35157
35370
  }
35371
+ getNames() {
35372
+ return [WEAVE_STROKE_TOOL_ACTION_NAME, ...WEAVE_STROKE_TOOL_ACTION_NAME_ALIASES];
35373
+ }
35158
35374
  hasAliases() {
35159
35375
  return true;
35160
35376
  }
@@ -35173,24 +35389,18 @@ var WeaveStrokeToolAction = class extends WeaveAction {
35173
35389
  setupEvents() {
35174
35390
  const stage = this.instance.getStage();
35175
35391
  window.addEventListener("keydown", (e) => {
35176
- if (e.code === "Enter" && this.instance.getActiveAction() === WEAVE_STROKE_TOOL_ACTION_NAME) {
35392
+ if (e.code === "Enter" && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
35177
35393
  this.cancelAction();
35178
35394
  return;
35179
35395
  }
35180
- if (e.code === "Escape" && this.instance.getActiveAction() === WEAVE_STROKE_TOOL_ACTION_NAME) {
35396
+ if (e.code === "Escape" && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
35181
35397
  this.cancelAction();
35182
35398
  return;
35183
35399
  }
35184
- if (e.key === "Shift" && this.instance.getActiveAction() === WEAVE_STROKE_TOOL_ACTION_NAME) {
35185
- this.snappedAngle = null;
35186
- this.shiftPressed = true;
35187
- }
35400
+ if (e.key === "Shift" && this.getNames().includes(this.instance.getActiveAction() ?? "")) this.shiftPressed = true;
35188
35401
  });
35189
35402
  window.addEventListener("keyup", (e) => {
35190
- if (e.key === "Shift" && this.instance.getActiveAction() === WEAVE_STROKE_TOOL_ACTION_NAME) {
35191
- this.snappedAngle = null;
35192
- this.shiftPressed = false;
35193
- }
35403
+ if (e.key === "Shift" && this.getNames().includes(this.instance.getActiveAction() ?? "")) this.shiftPressed = false;
35194
35404
  });
35195
35405
  stage.on("pointerdown", (e) => {
35196
35406
  this.setTapStart(e);
@@ -35198,7 +35408,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
35198
35408
  x: e.evt.clientX,
35199
35409
  y: e.evt.clientY
35200
35410
  });
35201
- if (this.pointers.size === 2 && this.instance.getActiveAction() === WEAVE_STROKE_TOOL_ACTION_NAME) {
35411
+ if (this.pointers.size === 2 && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
35202
35412
  this.state = WEAVE_STROKE_TOOL_STATE.ADDING;
35203
35413
  return;
35204
35414
  }
@@ -35208,7 +35418,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
35208
35418
  stage.on("pointermove", () => {
35209
35419
  if (this.state === WEAVE_STROKE_TOOL_STATE.IDLE) return;
35210
35420
  this.setCursor();
35211
- if (this.pointers.size === 2 && this.instance.getActiveAction() === WEAVE_STROKE_TOOL_ACTION_NAME) {
35421
+ if (this.pointers.size === 2 && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
35212
35422
  this.state = WEAVE_STROKE_TOOL_STATE.ADDING;
35213
35423
  return;
35214
35424
  }
@@ -35226,7 +35436,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
35226
35436
  addLine() {
35227
35437
  this.setCursor();
35228
35438
  this.setFocusStage();
35229
- this.instance.emitEvent("onAddingStroke", { actionName: this.instance.getActiveAction() ?? WEAVE_STROKE_TOOL_ACTION_NAME });
35439
+ this.instance.emitEvent("onAddingStroke", { actionName: this.instance.getActiveAction() ?? "not-defined" });
35230
35440
  this.shiftPressed = false;
35231
35441
  this.clickPoint = null;
35232
35442
  this.setState(WEAVE_STROKE_TOOL_STATE.ADDING);
@@ -35334,7 +35544,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
35334
35544
  });
35335
35545
  delete finalLine.props.dragBoundFunc;
35336
35546
  this.instance.addNode(finalLine, this.container?.getAttrs().id);
35337
- this.instance.emitEvent("onAddedStroke", { actionName: this.instance.getActiveAction() ?? WEAVE_STROKE_TOOL_ACTION_NAME });
35547
+ this.instance.emitEvent("onAddedStroke", { actionName: this.instance.getActiveAction() ?? "not-defined" });
35338
35548
  nodeCreated = true;
35339
35549
  }
35340
35550
  }
@@ -35384,6 +35594,9 @@ var WeaveRegularPolygonToolAction = class extends WeaveAction {
35384
35594
  onInit = void 0;
35385
35595
  constructor() {
35386
35596
  super();
35597
+ this.initialize();
35598
+ }
35599
+ initialize() {
35387
35600
  this.pointers = new Map();
35388
35601
  this.initialized = false;
35389
35602
  this.state = REGULAR_POLYGON_TOOL_STATE.IDLE;
@@ -35592,6 +35805,9 @@ var WeaveFrameToolAction = class extends WeaveAction {
35592
35805
  onInit = void 0;
35593
35806
  constructor() {
35594
35807
  super();
35808
+ this.initialize();
35809
+ }
35810
+ initialize() {
35595
35811
  this.initialized = false;
35596
35812
  this.state = FRAME_TOOL_STATE.IDLE;
35597
35813
  this.frameId = null;
@@ -35721,6 +35937,10 @@ var WeaveExportStageToolAction = class extends WeaveAction {
35721
35937
  };
35722
35938
  onPropsChange = void 0;
35723
35939
  onInit = void 0;
35940
+ initialize = void 0;
35941
+ constructor() {
35942
+ super();
35943
+ }
35724
35944
  getName() {
35725
35945
  return EXPORT_STAGE_TOOL_ACTION_NAME;
35726
35946
  }
@@ -35768,6 +35988,10 @@ var WeaveExportNodesToolAction = class extends WeaveAction {
35768
35988
  };
35769
35989
  onPropsChange = void 0;
35770
35990
  onInit = void 0;
35991
+ initialize = void 0;
35992
+ constructor() {
35993
+ super();
35994
+ }
35771
35995
  getName() {
35772
35996
  return EXPORT_NODES_TOOL_ACTION_NAME;
35773
35997
  }
@@ -35820,6 +36044,9 @@ var WeaveAlignNodesToolAction = class extends WeaveAction {
35820
36044
  onInit = void 0;
35821
36045
  constructor() {
35822
36046
  super();
36047
+ this.initialize();
36048
+ }
36049
+ initialize() {
35823
36050
  this.initialized = false;
35824
36051
  this.state = ALIGN_NODES_TOOL_STATE.IDLE;
35825
36052
  }
@@ -36069,6 +36296,9 @@ var WeaveCommentToolAction = class extends WeaveAction {
36069
36296
  super();
36070
36297
  const { config } = params ?? {};
36071
36298
  this.config = mergeExceptArrays(WEAVE_COMMENT_TOOL_DEFAULT_CONFIG, config);
36299
+ this.initialize();
36300
+ }
36301
+ initialize() {
36072
36302
  this.pointers = new Map();
36073
36303
  this.initialized = false;
36074
36304
  this.state = WEAVE_COMMENT_TOOL_STATE.IDLE;
@@ -36297,6 +36527,9 @@ var WeaveVideoToolAction = class extends WeaveAction {
36297
36527
  update = void 0;
36298
36528
  constructor() {
36299
36529
  super();
36530
+ this.initialize();
36531
+ }
36532
+ initialize() {
36300
36533
  this.pointers = new Map();
36301
36534
  this.initialized = false;
36302
36535
  this.state = VIDEO_TOOL_STATE.IDLE;
@@ -36476,6 +36709,9 @@ var WeaveMeasureToolAction = class extends WeaveAction {
36476
36709
  constructor(params) {
36477
36710
  super();
36478
36711
  this.config = mergeExceptArrays(WEAVE_MEASURE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
36712
+ this.initialize();
36713
+ }
36714
+ initialize() {
36479
36715
  this.initialized = false;
36480
36716
  this.state = MEASURE_TOOL_STATE.IDLE;
36481
36717
  this.measureId = null;
@@ -36772,6 +37008,9 @@ var WeaveConnectorToolAction = class extends WeaveAction {
36772
37008
  constructor(params) {
36773
37009
  super();
36774
37010
  this.config = mergeExceptArrays(CONNECTOR_TOOL_DEFAULT_CONFIG, params?.config);
37011
+ this.initialize();
37012
+ }
37013
+ initialize() {
36775
37014
  this.pointers = new Map();
36776
37015
  this.initialized = false;
36777
37016
  this.tempLineNode = null;
@@ -37125,16 +37364,9 @@ var WeaveConnectorToolAction = class extends WeaveAction {
37125
37364
  //#endregion
37126
37365
  //#region src/plugins/stage-grid/stage-grid.ts
37127
37366
  var WeaveStageGridPlugin = class extends WeavePlugin {
37128
- actStageZoomX = 1;
37129
- actStageZoomY = 1;
37130
- actStagePosX = 0;
37131
- actStagePosY = 0;
37132
37367
  constructor(params) {
37133
37368
  super();
37134
37369
  const { config } = params ?? {};
37135
- this.moveToolActive = false;
37136
- this.isMouseMiddleButtonPressed = false;
37137
- this.isSpaceKeyPressed = false;
37138
37370
  this.config = {
37139
37371
  type: WEAVE_GRID_DEFAULT_TYPE,
37140
37372
  gridColor: WEAVE_GRID_DEFAULT_COLOR,
@@ -37143,7 +37375,17 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
37143
37375
  gridDotMaxDotsPerAxis: WEAVE_GRID_DEFAULT_DOT_MAX_DOTS_PER_AXIS,
37144
37376
  ...config
37145
37377
  };
37378
+ this.initialize();
37379
+ }
37380
+ initialize() {
37381
+ this.moveToolActive = false;
37382
+ this.isMouseMiddleButtonPressed = false;
37383
+ this.isSpaceKeyPressed = false;
37146
37384
  this.forceStageChange = false;
37385
+ this.actStagePosX = 0;
37386
+ this.actStagePosY = 0;
37387
+ this.actStageZoomX = 1;
37388
+ this.actStageZoomY = 1;
37147
37389
  }
37148
37390
  getName() {
37149
37391
  return WEAVE_STAGE_GRID_PLUGIN_KEY;
@@ -37405,15 +37647,14 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
37405
37647
  //#endregion
37406
37648
  //#region src/plugins/stage-panning/stage-panning.ts
37407
37649
  var WeaveStagePanningPlugin = class extends WeavePlugin {
37408
- panning = false;
37409
- currentPointer = null;
37410
- stageScrollInterval = void 0;
37411
- panEdgeTargets = {};
37412
37650
  getLayerName = void 0;
37413
37651
  initLayer = void 0;
37414
37652
  constructor(params) {
37415
37653
  super();
37416
37654
  this.config = mergeExceptArrays(WEAVE_STAGE_PANNING_DEFAULT_CONFIG, params?.config ?? {});
37655
+ this.initialize();
37656
+ }
37657
+ initialize() {
37417
37658
  this.pointers = new Map();
37418
37659
  this.panning = false;
37419
37660
  this.isDragging = false;
@@ -37425,6 +37666,9 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
37425
37666
  this.isCtrlOrMetaPressed = false;
37426
37667
  this.isSpaceKeyPressed = false;
37427
37668
  this.previousPointer = null;
37669
+ this.currentPointer = null;
37670
+ this.stageScrollInterval = void 0;
37671
+ this.panEdgeTargets = {};
37428
37672
  }
37429
37673
  getName() {
37430
37674
  return WEAVE_STAGE_PANNING_KEY;
@@ -37678,6 +37922,9 @@ var WeaveStageMinimapPlugin = class extends WeavePlugin {
37678
37922
  constructor(params) {
37679
37923
  super();
37680
37924
  this.config = mergeExceptArrays(STAGE_MINIMAP_DEFAULT_CONFIG, params.config);
37925
+ this.initialize();
37926
+ }
37927
+ initialize() {
37681
37928
  this.initialized = false;
37682
37929
  }
37683
37930
  getName() {
@@ -37855,6 +38102,7 @@ const WEAVE_STAGE_RESIZE_KEY = "stageResize";
37855
38102
  var WeaveStageResizePlugin = class extends WeavePlugin {
37856
38103
  getLayerName = void 0;
37857
38104
  initLayer = void 0;
38105
+ initialize = void 0;
37858
38106
  getName() {
37859
38107
  return WEAVE_STAGE_RESIZE_KEY;
37860
38108
  }
@@ -37874,6 +38122,10 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
37874
38122
  const pluginInstance = plugins[pluginId];
37875
38123
  pluginInstance.onRender?.();
37876
38124
  }
38125
+ this.instance.emitEvent("onStageResize", {
38126
+ width: stage.width(),
38127
+ height: stage.height()
38128
+ });
37877
38129
  }
37878
38130
  }
37879
38131
  onInit() {
@@ -37900,10 +38152,12 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
37900
38152
  //#endregion
37901
38153
  //#region src/plugins/nodes-multi-selection-feedback/nodes-multi-selection-feedback.ts
37902
38154
  var WeaveNodesMultiSelectionFeedbackPlugin = class extends WeavePlugin {
37903
- selectedHalos = {};
37904
38155
  constructor(params) {
37905
38156
  super();
37906
38157
  this.config = mergeExceptArrays(WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_DEFAULT_CONFIG, params?.config ?? {});
38158
+ this.initialize();
38159
+ }
38160
+ initialize() {
37907
38161
  this.selectedHalos = {};
37908
38162
  }
37909
38163
  getName() {
@@ -38069,12 +38323,14 @@ var WeaveNodesMultiSelectionFeedbackPlugin = class extends WeavePlugin {
38069
38323
  //#endregion
38070
38324
  //#region src/plugins/connected-users/connected-users.ts
38071
38325
  var WeaveConnectedUsersPlugin = class extends WeavePlugin {
38072
- connectedUsers = {};
38073
38326
  getLayerName = void 0;
38074
38327
  constructor(params) {
38075
38328
  super();
38076
38329
  const { config } = params ?? {};
38077
38330
  this.config = config;
38331
+ this.initialize();
38332
+ }
38333
+ initialize() {
38078
38334
  this.connectedUsers = {};
38079
38335
  }
38080
38336
  getName() {
@@ -38121,6 +38377,9 @@ var WeaveUsersSelectionPlugin = class extends WeavePlugin {
38121
38377
  this.config = config;
38122
38378
  this.config.getUser = memoize(this.config.getUser);
38123
38379
  this.config.getUserColor = memoize(this.config.getUserColor);
38380
+ this.initialize();
38381
+ }
38382
+ initialize() {
38124
38383
  this.usersSelection = {};
38125
38384
  }
38126
38385
  getName() {
@@ -38313,6 +38572,9 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
38313
38572
  this.config.getUser = memoize(this.config.getUser);
38314
38573
  this.config.getUserBackgroundColor = memoize(this.config.getUserBackgroundColor);
38315
38574
  this.config.getUserForegroundColor = memoize(this.config.getUserForegroundColor);
38575
+ this.initialize();
38576
+ }
38577
+ initialize() {
38316
38578
  this.usersPointers = {};
38317
38579
  this.usersOperations = {};
38318
38580
  }
@@ -38523,6 +38785,9 @@ var WeaveUsersPresencePlugin = class extends WeavePlugin {
38523
38785
  super();
38524
38786
  const { config } = params;
38525
38787
  this.config = mergeExceptArrays(WEAVE_USERS_PRESENCE_CONFIG_DEFAULT_PROPS, config);
38788
+ this.initialize();
38789
+ }
38790
+ initialize() {
38526
38791
  this.userPresence = {};
38527
38792
  }
38528
38793
  getName() {
@@ -38598,6 +38863,9 @@ var WeaveStageDropAreaPlugin = class extends WeavePlugin {
38598
38863
  initLayer = void 0;
38599
38864
  constructor() {
38600
38865
  super();
38866
+ this.initialize();
38867
+ }
38868
+ initialize() {
38601
38869
  this.enabled = true;
38602
38870
  }
38603
38871
  getName() {
@@ -38637,6 +38905,9 @@ var WeaveNodesEdgeSnappingPlugin = class extends WeavePlugin {
38637
38905
  this.guideLineConfig = config?.guideLine ?? GUIDE_LINE_DEFAULT_CONFIG;
38638
38906
  this.dragSnappingThreshold = config?.dragSnappingThreshold ?? GUIDE_LINE_DRAG_SNAPPING_THRESHOLD;
38639
38907
  this.transformSnappingThreshold = config?.transformSnappingThreshold ?? GUIDE_LINE_TRANSFORM_SNAPPING_THRESHOLD;
38908
+ this.initialize();
38909
+ }
38910
+ initialize() {
38640
38911
  this.enabled = true;
38641
38912
  }
38642
38913
  getName() {
@@ -39013,6 +39284,9 @@ var WeaveNodesDistanceSnappingPlugin = class extends WeavePlugin {
39013
39284
  this.enterSnappingTolerance = config?.enterSnappingTolerance ?? GUIDE_ENTER_SNAPPING_TOLERANCE;
39014
39285
  this.exitSnappingTolerance = config?.exitSnappingTolerance ?? GUIDE_EXIT_SNAPPING_TOLERANCE;
39015
39286
  this.uiConfig = mergeExceptArrays(GUIDE_DISTANCE_LINE_DEFAULT_CONFIG, config?.ui);
39287
+ this.initialize();
39288
+ }
39289
+ initialize() {
39016
39290
  this.enabled = true;
39017
39291
  }
39018
39292
  getName() {
@@ -39659,12 +39933,14 @@ var WeaveNodesDistanceSnappingPlugin = class extends WeavePlugin {
39659
39933
  //#endregion
39660
39934
  //#region src/plugins/comments-renderer/comments-renderer.ts
39661
39935
  var WeaveCommentsRendererPlugin = class extends WeavePlugin {
39662
- comments = [];
39663
39936
  getLayerName = void 0;
39664
39937
  constructor(params) {
39665
39938
  super();
39666
39939
  const { config } = params ?? {};
39667
39940
  this.config = config;
39941
+ this.initialize();
39942
+ }
39943
+ initialize() {
39668
39944
  this.comments = [];
39669
39945
  }
39670
39946
  getName() {
@@ -39755,6 +40031,7 @@ const WEAVE_STAGE_KEYBOARD_MOVE_DEFAULT_CONFIG = { movementDelta: 5 };
39755
40031
  var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
39756
40032
  getLayerName = void 0;
39757
40033
  initLayer = void 0;
40034
+ initialize = void 0;
39758
40035
  constructor(params) {
39759
40036
  super();
39760
40037
  this.config = mergeExceptArrays(WEAVE_STAGE_KEYBOARD_MOVE_DEFAULT_CONFIG, params?.config ?? {});
@@ -39850,4 +40127,4 @@ function getJSONFromYjsBinary(actualState) {
39850
40127
  }
39851
40128
 
39852
40129
  //#endregion
39853
- 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_COLOR, WEAVE_GRID_DEFAULT_DOT_MAX_DOTS_PER_AXIS, WEAVE_GRID_DEFAULT_MAJOR_DOT_RATIO, WEAVE_GRID_DEFAULT_MAJOR_EVERY, WEAVE_GRID_DEFAULT_MAJOR_LINE_RATIO, WEAVE_GRID_DEFAULT_ORIGIN_COLOR, WEAVE_GRID_DEFAULT_RADIUS, WEAVE_GRID_DEFAULT_SIZE, WEAVE_GRID_DEFAULT_STROKE, WEAVE_GRID_DEFAULT_TYPE, 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, weavejsToYjsBinary };
40130
+ 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_COLOR, WEAVE_GRID_DEFAULT_DOT_MAX_DOTS_PER_AXIS, WEAVE_GRID_DEFAULT_MAJOR_DOT_RATIO, WEAVE_GRID_DEFAULT_MAJOR_EVERY, WEAVE_GRID_DEFAULT_MAJOR_LINE_RATIO, WEAVE_GRID_DEFAULT_ORIGIN_COLOR, WEAVE_GRID_DEFAULT_RADIUS, WEAVE_GRID_DEFAULT_SIZE, WEAVE_GRID_DEFAULT_STROKE, WEAVE_GRID_DEFAULT_TYPE, 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, weavejsToYjsBinary };