@inditextech/weave-sdk 4.0.1 → 4.2.0-SNAPSHOT.307.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
@@ -2,8 +2,11 @@ import Konva from "konva";
2
2
  import pino from "pino";
3
3
  import { WEAVE_ASYNC_STATUS, WEAVE_AWARENESS_LAYER_ID, WEAVE_EXPORT_BACKGROUND_COLOR, WEAVE_EXPORT_FORMATS, WEAVE_EXPORT_RETURN_FORMAT, WEAVE_INSTANCE_STATUS, WEAVE_KONVA_BACKEND, WEAVE_LOG_LEVEL, WEAVE_NODE_CHANGE_TYPE, WEAVE_NODE_CUSTOM_EVENTS, WEAVE_NODE_LAYER_ID, WEAVE_NODE_POSITION, WEAVE_STORE_CONNECTION_STATUS, WEAVE_UTILITY_LAYER_ID } from "@inditextech/weave-types";
4
4
  import { getYjsDoc, getYjsValue, observeDeep, syncedStore } from "@syncedstore/core";
5
+ import * as Y$2 from "yjs";
5
6
  import * as Y$1 from "yjs";
6
7
  import * as Y from "yjs";
8
+ import { z } from "zod";
9
+ import simplify from "simplify-js";
7
10
  import "konva/lib/types";
8
11
  import { Stage } from "konva/lib/Stage";
9
12
 
@@ -15196,7 +15199,7 @@ var import_lodash = __toESM(require_lodash(), 1);
15196
15199
 
15197
15200
  //#endregion
15198
15201
  //#region src/yjs.ts
15199
- var yjs_default = Y$1;
15202
+ var yjs_default = Y$2;
15200
15203
 
15201
15204
  //#endregion
15202
15205
  //#region src/stores/default-initial-state.ts
@@ -15275,6 +15278,7 @@ var WeaveStore = class {
15275
15278
  return this.document;
15276
15279
  }
15277
15280
  restartDocument() {
15281
+ this.document?.destroy();
15278
15282
  this.latestState = {
15279
15283
  weave: {},
15280
15284
  weaveMetadata: {}
@@ -18951,10 +18955,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
18951
18955
  });
18952
18956
  tr.on("mouseover", () => {
18953
18957
  const nodesSelected = tr.nodes();
18954
- if (nodesSelected.length === 1) {
18955
- const node = nodesSelected[0];
18956
- stage.container().style.cursor = (typeof node?.defineMousePointer === "function" ? node.defineMousePointer() : null) ?? "grab";
18957
- } else stage.container().style.cursor = "grab";
18958
+ if (nodesSelected.length > 1) stage.container().style.cursor = "grab";
18958
18959
  });
18959
18960
  tr.on("mouseout", (e) => {
18960
18961
  this.instance.getStage().handleMouseover?.(e);
@@ -20912,16 +20913,16 @@ var WeaveNode = class {
20912
20913
  if ([MOVE_TOOL_ACTION_NAME].includes(activeAction ?? "")) return false;
20913
20914
  let showHover = false;
20914
20915
  let cancelBubble = false;
20915
- if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(realNode) && !this.isPasting() && (isLocked || isMutexLocked)) {
20916
+ if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(realNode) && !this.isPasting() && node.hasName("node") && (isLocked || isMutexLocked)) {
20916
20917
  stage.container().style.cursor = "default";
20917
20918
  cancelBubble = true;
20918
20919
  }
20919
- if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(realNode) && !this.isPasting() && isTargetable && !(isLocked || isMutexLocked) && stage.mode() === WEAVE_STAGE_DEFAULT_MODE) {
20920
+ if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(realNode) && !this.isPasting() && isTargetable && node.hasName("node") && !(isLocked || isMutexLocked) && stage.mode() === WEAVE_STAGE_DEFAULT_MODE) {
20920
20921
  showHover = true;
20921
20922
  stage.container().style.cursor = (typeof node?.defineMousePointer === "function" ? node.defineMousePointer() : null) ?? "pointer";
20922
20923
  cancelBubble = true;
20923
20924
  }
20924
- if (isNodeSelectionEnabled && this.isSelecting() && this.isNodeSelected(realNode) && !this.isPasting() && isTargetable && !(isLocked || isMutexLocked) && stage.mode() === WEAVE_STAGE_DEFAULT_MODE) {
20925
+ if (isNodeSelectionEnabled && this.isSelecting() && this.isNodeSelected(realNode) && !this.isPasting() && node.hasName("node") && isTargetable && !(isLocked || isMutexLocked) && stage.mode() === WEAVE_STAGE_DEFAULT_MODE) {
20925
20926
  showHover = true;
20926
20927
  stage.container().style.cursor = (typeof node?.defineMousePointer === "function" ? node.defineMousePointer() : null) ?? "grab";
20927
20928
  cancelBubble = true;
@@ -21076,6 +21077,48 @@ var WeaveNode = class {
21076
21077
  getIsAsync() {
21077
21078
  return false;
21078
21079
  }
21080
+ static defaultState(nodeId) {
21081
+ return {
21082
+ key: nodeId,
21083
+ type: "unknown",
21084
+ props: {
21085
+ id: nodeId,
21086
+ nodeType: "unknown",
21087
+ x: 0,
21088
+ y: 0,
21089
+ width: 100,
21090
+ height: 100,
21091
+ rotation: 0,
21092
+ scaleX: 1,
21093
+ scaleY: 1,
21094
+ opacity: 1,
21095
+ zIndex: 1,
21096
+ children: []
21097
+ }
21098
+ };
21099
+ }
21100
+ static getSchema() {
21101
+ const baseNodeSchema = z.object({
21102
+ key: z.string().describe("Unique identifier (uuid) for the node, generate one it if not provided"),
21103
+ type: z.string().describe("Type of the node, must be always provided"),
21104
+ props: z.object({
21105
+ id: z.string().describe("Unique identifier (uuid) for the node instance, is the same as key"),
21106
+ nodeType: z.string().describe("Type of the node, must be always provided"),
21107
+ x: z.number().describe("X position of the node, relative to the parent container"),
21108
+ y: z.number().describe("Y position of the node, relative to the parent container"),
21109
+ width: z.number().describe("Width of the node in pixels"),
21110
+ height: z.number().describe("Height of the node in pixels"),
21111
+ scaleX: z.number().describe("Scale factor on the X axis, default is 1"),
21112
+ scaleY: z.number().describe("Scale factor on the Y axis, default is 1"),
21113
+ rotation: z.number().optional().describe("Rotation of the node in degrees, default is 0"),
21114
+ skewX: z.number().optional().describe("Skew on the X axis in degrees, default is 0"),
21115
+ skewY: z.number().optional().describe("Skew on the Y axis in degrees, default is 0"),
21116
+ opacity: z.number().describe("Opacity of the node, between 0 and 1, default is 1"),
21117
+ children: z.array(z.any()).length(0).describe("Children nodes, always be an empty array for leaf nodes")
21118
+ })
21119
+ });
21120
+ return baseNodeSchema;
21121
+ }
21079
21122
  };
21080
21123
 
21081
21124
  //#endregion
@@ -22198,7 +22241,7 @@ var WeaveRegisterManager = class {
22198
22241
 
22199
22242
  //#endregion
22200
22243
  //#region package.json
22201
- var version = "4.0.1";
22244
+ var version = "4.2.0-SNAPSHOT.307.1";
22202
22245
 
22203
22246
  //#endregion
22204
22247
  //#region src/managers/setup.ts
@@ -23422,6 +23465,9 @@ var WeaveHooksManager = class {
23422
23465
  unregisterHook(hookName) {
23423
23466
  this.registeredHooks.delete(hookName);
23424
23467
  }
23468
+ reset() {
23469
+ this.registeredHooks.clear();
23470
+ }
23425
23471
  };
23426
23472
 
23427
23473
  //#endregion
@@ -23616,8 +23662,13 @@ var Weave = class {
23616
23662
  const nodeHandler = nodeHandlers[nodeHandlerKey];
23617
23663
  nodeHandler?.onDestroyInstance();
23618
23664
  }
23665
+ const mainLayer = this.stageManager.getMainLayer();
23666
+ if (mainLayer) mainLayer.destroy();
23619
23667
  const stage = this.getStage();
23620
- if (stage) stage.destroy();
23668
+ if (stage) {
23669
+ console.log("remove stage");
23670
+ stage.destroy();
23671
+ }
23621
23672
  if (this.eventsController) this.eventsController.abort();
23622
23673
  if (!this.isServerSide()) this.eventsController = new AbortController();
23623
23674
  this.registerManager.reset();
@@ -23630,6 +23681,8 @@ var Weave = class {
23630
23681
  this.status = WEAVE_INSTANCE_STATUS.STARTING;
23631
23682
  this.emitEvent("onInstanceStatus", this.status);
23632
23683
  this.registerManager.reset();
23684
+ this.hooks.removeAllHooks();
23685
+ this.hooksManager.reset();
23633
23686
  this.status = WEAVE_INSTANCE_STATUS.LOADING_FONTS;
23634
23687
  this.emitEvent("onInstanceStatus", this.status);
23635
23688
  await this.fontsManager.loadFonts();
@@ -23647,6 +23700,7 @@ var Weave = class {
23647
23700
  this.emitEvent("onInstanceStatus", this.status);
23648
23701
  const store = this.storeManager.getStore();
23649
23702
  store.disconnect();
23703
+ store.getDocument()?.destroy();
23650
23704
  const nodeHandlers = this.registerManager.getNodesHandlers();
23651
23705
  for (const nodeHandlerKey of Object.keys(nodeHandlers)) {
23652
23706
  const nodeHandler = nodeHandlers[nodeHandlerKey];
@@ -24413,6 +24467,114 @@ const downscaleImageFromURL = (url, options) => {
24413
24467
  });
24414
24468
  };
24415
24469
 
24470
+ //#endregion
24471
+ //#region src/state.manipulation.ts
24472
+ var WeaveStateManipulation = class WeaveStateManipulation {
24473
+ static mapPropsToYjs(props) {
24474
+ const propsMap = new Y$1.Map();
24475
+ for (const propKey of Object.keys(props)) {
24476
+ const propValue = props[propKey];
24477
+ if (Array.isArray(propValue)) {
24478
+ const childrenArray = new Y$1.Array();
24479
+ propValue.forEach((child) => {
24480
+ const childMap = WeaveStateManipulation.mapPropsToYjs(child);
24481
+ childrenArray.push([childMap]);
24482
+ });
24483
+ } else if (typeof propValue === "object" && propValue !== null && !Array.isArray(propValue)) propsMap.set(propKey, WeaveStateManipulation.mapPropsToYjs(propValue));
24484
+ else propsMap.set(propKey, propValue);
24485
+ }
24486
+ return propsMap;
24487
+ }
24488
+ static mapNodeToYjs(node) {
24489
+ const nodeId = node.key;
24490
+ const element = new Y$1.Map();
24491
+ const elementProps = new Y$1.Map();
24492
+ element.set("key", nodeId);
24493
+ element.set("type", node.type);
24494
+ element.set("props", elementProps);
24495
+ for (const propKey of Object.keys(node.props)) {
24496
+ const propValue = node.props[propKey];
24497
+ if (Array.isArray(propValue) && propKey === "children") {
24498
+ const childrenArray = new Y$1.Array();
24499
+ propValue.forEach((child) => {
24500
+ const childMap = WeaveStateManipulation.mapNodeToYjs(child);
24501
+ childrenArray.push([childMap.element]);
24502
+ });
24503
+ elementProps.set(propKey, childrenArray);
24504
+ } else if (Array.isArray(propValue) && propKey !== "children") {
24505
+ const childrenArray = new Y$1.Array();
24506
+ propValue.forEach((child) => {
24507
+ const childMap = WeaveStateManipulation.mapPropsToYjs(child);
24508
+ childrenArray.push([childMap]);
24509
+ });
24510
+ elementProps.set(propKey, childrenArray);
24511
+ } else if (typeof propValue === "object" && propValue !== null && !Array.isArray(propValue)) {
24512
+ const childrenMap = WeaveStateManipulation.mapPropsToYjs(propValue);
24513
+ elementProps.set(propKey, childrenMap);
24514
+ } else elementProps.set(propKey, propValue);
24515
+ }
24516
+ return {
24517
+ nodeId: node.key,
24518
+ element
24519
+ };
24520
+ }
24521
+ static addElements(layerYjsElement, yjsElements) {
24522
+ layerYjsElement.get("props").get("children").push(yjsElements);
24523
+ }
24524
+ static updateElements(layerYjsElement, yjsElements) {
24525
+ for (let i = 0; i < yjsElements.length; i++) {
24526
+ const yjsElement = yjsElements[i];
24527
+ const nodeId = yjsElement.nodeId;
24528
+ const element = yjsElement.element;
24529
+ const childrenArr = JSON.parse(JSON.stringify(layerYjsElement.get("props").get("children")));
24530
+ const index = childrenArr.findIndex((child) => child["key"] === nodeId);
24531
+ if (index !== -1) {
24532
+ layerYjsElement.get("props").get("children").delete(index);
24533
+ layerYjsElement.get("props").get("children").insert(index, [element]);
24534
+ }
24535
+ }
24536
+ }
24537
+ static deleteElements(layerYjsElement, yjsElementsIds) {
24538
+ for (let i = 0; i < yjsElementsIds.length; i++) {
24539
+ const yjsElementId = yjsElementsIds[i];
24540
+ const childrenArr = JSON.parse(JSON.stringify(layerYjsElement.get("props").get("children")));
24541
+ const index = childrenArr.findIndex((child) => child["key"] === yjsElementId);
24542
+ if (index !== -1) layerYjsElement.get("props").get("children").delete(index);
24543
+ }
24544
+ }
24545
+ static getYjsElement(doc, nodeId) {
24546
+ const stage = doc.getMap("weave");
24547
+ const stageProps = stage.get("props");
24548
+ const stageChildren = stageProps.get("children");
24549
+ for (let i = 0; i < stageChildren.length; i++) {
24550
+ const child = stageChildren.get(i);
24551
+ const childProps = child.get("props");
24552
+ if (childProps.get("id") === nodeId) return child;
24553
+ if (childProps.get("children")) {
24554
+ const childChildren = childProps.get("children");
24555
+ for (let j = 0; j < childChildren.length; j++) {
24556
+ const grandChild = childChildren.get(j);
24557
+ const grandChildProps = grandChild.get("props");
24558
+ if (grandChildProps.get("id") === nodeId) return grandChild;
24559
+ }
24560
+ }
24561
+ }
24562
+ return null;
24563
+ }
24564
+ static getNodesBoundingBox(nodes) {
24565
+ const minX = Math.min(...nodes.map((n) => n.props.x));
24566
+ const minY = Math.min(...nodes.map((n) => n.props.y));
24567
+ const maxX = Math.max(...nodes.map((n) => n.props.x + n.props.width));
24568
+ const maxY = Math.max(...nodes.map((n) => n.props.y + n.props.height));
24569
+ return {
24570
+ x: minX,
24571
+ y: minY,
24572
+ width: maxX - minX,
24573
+ height: maxY - minY
24574
+ };
24575
+ }
24576
+ };
24577
+
24416
24578
  //#endregion
24417
24579
  //#region src/internal-utils/upscale.ts
24418
24580
  const setupUpscaleStage = (instance, stage) => {
@@ -24529,10 +24691,11 @@ var WeaveStageNode = class extends WeaveNode {
24529
24691
  const activeAction = this.instance.getActiveAction();
24530
24692
  if ([MOVE_TOOL_ACTION_NAME].includes(activeAction ?? "")) return;
24531
24693
  if (e.target !== stage && !e.target.getAttrs().nodeId) return;
24532
- const parent = e.target.getParent();
24694
+ let parent = e.target.getParent();
24533
24695
  if (parent && parent instanceof Konva.Transformer) return;
24534
24696
  this.hideHoverState();
24535
- if (!this.instance.isServerSide()) stage.container().style.cursor = "default";
24697
+ if (e.target.getAttrs().nodeId) parent = stage.findOne(`#${e.target.getAttrs().nodeId}`);
24698
+ if (!this.instance.isServerSide() && !parent?.hasName("node")) stage.container().style.cursor = "default";
24536
24699
  });
24537
24700
  this.setupEvents();
24538
24701
  return stage;
@@ -24715,6 +24878,52 @@ var WeaveGroupNode = class extends WeaveNode {
24715
24878
  //#region src/nodes/rectangle/constants.ts
24716
24879
  const WEAVE_RECTANGLE_NODE_TYPE = "rectangle";
24717
24880
 
24881
+ //#endregion
24882
+ //#region src/internal-utils/mapping.ts
24883
+ const isArray = (val) => {
24884
+ return Array.isArray(val);
24885
+ };
24886
+ const isObject = (val) => {
24887
+ return val !== null && typeof val === "object" && !Array.isArray(val);
24888
+ };
24889
+ const mapJsonToYjsMap = (jsonData) => {
24890
+ const map = new Y.Map();
24891
+ const keys = Object.keys(jsonData);
24892
+ for (const key of keys) {
24893
+ const value = jsonData[key];
24894
+ if (isArray(value)) map.set(key, mapJsonToYjsArray(value));
24895
+ else if (isObject(value)) map.set(key, mapJsonToYjsMap(value));
24896
+ else map.set(key, value);
24897
+ }
24898
+ return map;
24899
+ };
24900
+ const mapJsonToYjsArray = (jsonData) => {
24901
+ const array = new Y.Array();
24902
+ for (const item of jsonData) if (isArray(item)) array.push([mapJsonToYjsArray(item)]);
24903
+ else if (isObject(item)) array.push([mapJsonToYjsMap(item)]);
24904
+ else array.push(item);
24905
+ return array;
24906
+ };
24907
+ const mapJsonToYjsElements = (jsonData) => {
24908
+ if (isArray(jsonData)) return mapJsonToYjsArray(jsonData);
24909
+ else if (isObject(jsonData)) return mapJsonToYjsMap(jsonData);
24910
+ };
24911
+ const weavejsToYjsBinary = (weavejsData) => {
24912
+ const doc = new Y.Doc();
24913
+ doc.getMap("weave").set("key", weavejsData.weave.key);
24914
+ doc.getMap("weave").set("type", weavejsData.weave.type);
24915
+ doc.getMap("weave").set("props", mapJsonToYjsElements(weavejsData.weave.props));
24916
+ const actualState = Y.encodeStateAsUpdate(doc);
24917
+ return actualState;
24918
+ };
24919
+ function getJSONFromYjsBinary(actualState) {
24920
+ const document$1 = new Y.Doc();
24921
+ Y.applyUpdate(document$1, actualState);
24922
+ const actualStateString = JSON.stringify(document$1.getMap("weave").toJSON());
24923
+ const actualStateJson = JSON.parse(actualStateString);
24924
+ return actualStateJson;
24925
+ }
24926
+
24718
24927
  //#endregion
24719
24928
  //#region src/nodes/rectangle/rectangle.ts
24720
24929
  var WeaveRectangleNode = class extends WeaveNode {
@@ -24814,6 +25023,65 @@ var WeaveRectangleNode = class extends WeaveNode {
24814
25023
  const nodesSelectionPlugin = this.instance.getPlugin("nodesSelection");
24815
25024
  if (nodesSelectionPlugin) nodesSelectionPlugin.getTransformer().forceUpdate();
24816
25025
  }
25026
+ static defaultState(nodeId) {
25027
+ return {
25028
+ ...super.defaultState(nodeId),
25029
+ type: WEAVE_RECTANGLE_NODE_TYPE,
25030
+ props: {
25031
+ ...super.defaultState(nodeId).props,
25032
+ nodeType: WEAVE_RECTANGLE_NODE_TYPE,
25033
+ x: 0,
25034
+ y: 0,
25035
+ width: 100,
25036
+ height: 100,
25037
+ stroke: "#000000",
25038
+ fill: "#FFFFFF",
25039
+ strokeWidth: 1,
25040
+ strokeScaleEnabled: true,
25041
+ rotation: 0,
25042
+ zIndex: 1,
25043
+ children: []
25044
+ }
25045
+ };
25046
+ }
25047
+ static addNodeState(defaultNodeState, props) {
25048
+ return mergeExceptArrays(defaultNodeState, { props: {
25049
+ x: props.x,
25050
+ y: props.y,
25051
+ width: props.width,
25052
+ height: props.height,
25053
+ rotation: props.rotation,
25054
+ fill: props.fill,
25055
+ ...props.stroke && { stroke: props.stroke },
25056
+ ...props.strokeWidth && { strokeWidth: props.strokeWidth }
25057
+ } });
25058
+ }
25059
+ static updateNodeState(prevNodeState, nextProps) {
25060
+ return mergeExceptArrays(prevNodeState, { props: {
25061
+ x: nextProps.x,
25062
+ y: nextProps.y,
25063
+ width: nextProps.width,
25064
+ height: nextProps.height,
25065
+ rotation: nextProps.rotation,
25066
+ fill: nextProps.fill,
25067
+ ...nextProps.stroke && { stroke: nextProps.stroke },
25068
+ ...nextProps.strokeWidth && { strokeWidth: nextProps.strokeWidth }
25069
+ } });
25070
+ }
25071
+ static getSchema() {
25072
+ const baseSchema = super.getSchema();
25073
+ const imageNodeSchema = baseSchema.extend({
25074
+ type: z.literal("rectangle").describe("Type of the node, for a rectangle node it will always be \"rectangle\""),
25075
+ props: baseSchema.shape.props.extend({
25076
+ nodeType: z.literal("rectangle").describe("Type of the node, for a rectangle node it will always be \"rectangle\""),
25077
+ fill: z.string().describe("Fill color of the rectangle in hex format with alpha channel (e.g. #RRGGBBAA)"),
25078
+ stroke: z.string().describe("Stroke color of the rectangle in hex format with alpha channel (e.g. #RRGGBBAA)"),
25079
+ strokeWidth: z.number().describe("Stroke width of the rectangle in pixels"),
25080
+ strokeScaleEnabled: z.boolean().describe("Whether the rectangle stroke width should scale when the node is scaled. Defaults to true.")
25081
+ })
25082
+ });
25083
+ return imageNodeSchema;
25084
+ }
24817
25085
  };
24818
25086
 
24819
25087
  //#endregion
@@ -25985,6 +26253,62 @@ var WeaveTextNode = class extends WeaveNode {
25985
26253
  textNode.width(textAreaWidth);
25986
26254
  this.instance.updateNode(this.serialize(textNode));
25987
26255
  }
26256
+ static defaultState(nodeId, params) {
26257
+ const config = (0, import_lodash.merge)({}, WEAVE_TEXT_NODE_DEFAULT_CONFIG, params?.config ?? {});
26258
+ return {
26259
+ ...super.defaultState(nodeId),
26260
+ type: WEAVE_TEXT_NODE_TYPE,
26261
+ props: {
26262
+ ...super.defaultState(nodeId).props,
26263
+ nodeType: "text",
26264
+ fontFamily: "Arial",
26265
+ fontSize: 32,
26266
+ fontStyle: "normal",
26267
+ fontVariant: "normal",
26268
+ textDecoration: "none",
26269
+ letterSpacing: 0,
26270
+ lineHeight: 1,
26271
+ align: "left",
26272
+ verticalAlign: "top",
26273
+ fill: "#000000ff",
26274
+ text: "This is a text node",
26275
+ ...!config.outline.enabled && { strokeEnabled: false },
26276
+ ...config.outline.enabled && {
26277
+ strokeEnabled: true,
26278
+ stroke: config.outline.color,
26279
+ strokeWidth: config.outline.width,
26280
+ fillAfterStrokeEnabled: true
26281
+ },
26282
+ layout: TEXT_LAYOUT.SMART
26283
+ }
26284
+ };
26285
+ }
26286
+ static getSchema() {
26287
+ const baseSchema = super.getSchema();
26288
+ const textNodeSchema = baseSchema.extend({
26289
+ type: z.literal("text"),
26290
+ props: z.object({
26291
+ nodeType: z.literal("text"),
26292
+ fontFamily: z.string().default("Arial"),
26293
+ fontSize: z.number().default(16),
26294
+ fontStyle: z.string().default("normal"),
26295
+ fontVariant: z.string().default("normal"),
26296
+ textDecoration: z.string().default("none"),
26297
+ letterSpacing: z.number().default(0),
26298
+ lineHeight: z.number().default(1),
26299
+ align: z.string().default("left"),
26300
+ verticalAlign: z.string().default("top"),
26301
+ fill: z.string().default("#000000ff"),
26302
+ text: z.string().default("text"),
26303
+ stroke: z.string().optional().default("#d6d6d6"),
26304
+ strokeWidth: z.number().optional().default(2),
26305
+ strokeScaleEnabled: z.boolean().optional().default(true),
26306
+ fillAfterStrokeEnabled: z.boolean().optional().default(true),
26307
+ layout: z.enum(TEXT_LAYOUT).default(TEXT_LAYOUT.SMART)
26308
+ })
26309
+ });
26310
+ return textNodeSchema;
26311
+ }
25988
26312
  };
25989
26313
 
25990
26314
  //#endregion
@@ -27620,6 +27944,108 @@ var WeaveImageNode = class extends WeaveNode {
27620
27944
  this.getNodesSelectionPlugin()?.setSelectedNodes([image]);
27621
27945
  this.getNodesSelectionPlugin()?.getHoverTransformer().forceUpdate();
27622
27946
  }
27947
+ static defaultState(nodeId) {
27948
+ return {
27949
+ ...super.defaultState(nodeId),
27950
+ props: {
27951
+ ...super.defaultState(nodeId).props,
27952
+ nodeType: WEAVE_IMAGE_NODE_TYPE,
27953
+ width: 800,
27954
+ height: 600,
27955
+ imageURL: "https://picsum.photos/id/10/800/600",
27956
+ adding: false,
27957
+ imageWidth: 800,
27958
+ imageHeight: 600,
27959
+ imageInfo: {
27960
+ width: 800,
27961
+ height: 600
27962
+ },
27963
+ uncroppedImage: {
27964
+ width: 800,
27965
+ height: 600
27966
+ },
27967
+ cropping: false,
27968
+ stroke: "#000000",
27969
+ fill: "#FFFFFF",
27970
+ strokeWidth: 0,
27971
+ strokeScaleEnabled: true,
27972
+ children: []
27973
+ }
27974
+ };
27975
+ }
27976
+ static addNodeState(defaultNodeState, props) {
27977
+ return mergeExceptArrays(defaultNodeState, { props: {
27978
+ x: props.x,
27979
+ y: props.y,
27980
+ width: props.width,
27981
+ height: props.height,
27982
+ rotation: props.rotation,
27983
+ imageURL: props.imageURL,
27984
+ ...props.imageFallback && { imageFallback: props.imageFallback },
27985
+ ...props.imageId && { imageId: props.imageId },
27986
+ adding: props.adding,
27987
+ imageWidth: props.imageWidth,
27988
+ imageHeight: props.imageHeight,
27989
+ imageInfo: {
27990
+ width: props.imageInfo.width,
27991
+ height: props.imageInfo.height
27992
+ },
27993
+ uncroppedImage: {
27994
+ width: props.uncroppedImage.width,
27995
+ height: props.uncroppedImage.height
27996
+ },
27997
+ cropping: props.cropping
27998
+ } });
27999
+ }
28000
+ static updateNodeState(prevNodeState, nextProps) {
28001
+ return mergeExceptArrays(prevNodeState, { props: {
28002
+ x: nextProps.x,
28003
+ y: nextProps.y,
28004
+ width: nextProps.width,
28005
+ height: nextProps.height,
28006
+ rotation: nextProps.rotation,
28007
+ imageURL: nextProps.imageURL,
28008
+ ...nextProps.imageFallback && { imageFallback: nextProps.imageFallback },
28009
+ ...nextProps.imageId && { imageId: nextProps.imageId },
28010
+ adding: nextProps.adding,
28011
+ imageWidth: nextProps.imageWidth,
28012
+ imageHeight: nextProps.imageHeight,
28013
+ ...nextProps.imageInfo && { imageInfo: {
28014
+ width: nextProps.imageInfo.width,
28015
+ height: nextProps.imageInfo.height
28016
+ } },
28017
+ ...nextProps.uncroppedImage && { uncroppedImage: {
28018
+ width: nextProps.uncroppedImage?.width,
28019
+ height: nextProps.uncroppedImage?.height
28020
+ } },
28021
+ cropping: nextProps.cropping
28022
+ } });
28023
+ }
28024
+ static getSchema() {
28025
+ const baseSchema = super.getSchema();
28026
+ const imageNodeSchema = baseSchema.extend({
28027
+ type: z.literal("image").describe("Type of the node, for a image node it will always be \"image\""),
28028
+ props: baseSchema.shape.props.extend({
28029
+ nodeType: z.literal("image").describe("Type of the node, for a image node it will always be \"image\""),
28030
+ imageURL: z.string().describe("The URL of the image to be rendered by the node"),
28031
+ imageFallback: z.string().optional().describe("The fallback image to display while the image to loads, it must be a base64 string with the format: data:image/{format};base64,{data}"),
28032
+ adding: z.boolean().default(false),
28033
+ imageId: z.string().optional().describe("The id of the image, used for external management of the node."),
28034
+ imageWidth: z.number().describe("The width of the image in pixels"),
28035
+ imageHeight: z.number().describe("The height of the image in pixels"),
28036
+ imageInfo: z.object({
28037
+ width: z.number().describe("The original width of the image in pixels"),
28038
+ height: z.number().describe("The original height of the image in pixels")
28039
+ }),
28040
+ uncroppedImage: z.object({
28041
+ width: z.number().describe("The width of the image before cropping, used for cropping calculations"),
28042
+ height: z.number().describe("The height of the image before cropping, used for cropping calculations")
28043
+ }),
28044
+ cropping: z.boolean().default(false).describe("Whether the image is currently being cropped")
28045
+ })
28046
+ });
28047
+ return imageNodeSchema;
28048
+ }
27623
28049
  };
27624
28050
 
27625
28051
  //#endregion
@@ -28217,6 +28643,7 @@ var WeaveFrameNode = class extends WeaveNode {
28217
28643
  strokeWidth: 0,
28218
28644
  fill: "transparent",
28219
28645
  nodeId: id,
28646
+ nodeType: void 0,
28220
28647
  id: `${id}-selection-area`,
28221
28648
  listening: true,
28222
28649
  draggable: true,
@@ -28373,6 +28800,79 @@ var WeaveFrameNode = class extends WeaveNode {
28373
28800
  };
28374
28801
  }
28375
28802
  scaleReset() {}
28803
+ static defaultState(nodeId) {
28804
+ return {
28805
+ ...super.defaultState(nodeId),
28806
+ type: WEAVE_FRAME_NODE_TYPE,
28807
+ props: {
28808
+ ...super.defaultState(nodeId).props,
28809
+ nodeType: WEAVE_FRAME_NODE_TYPE,
28810
+ x: 0,
28811
+ y: 0,
28812
+ width: WEAVE_FRAME_NODE_DEFAULT_PROPS.frameWidth,
28813
+ height: WEAVE_FRAME_NODE_DEFAULT_PROPS.frameHeight,
28814
+ title: WEAVE_FRAME_NODE_DEFAULT_PROPS.title,
28815
+ frameWidth: WEAVE_FRAME_NODE_DEFAULT_PROPS.frameWidth,
28816
+ frameHeight: WEAVE_FRAME_NODE_DEFAULT_PROPS.frameHeight,
28817
+ frameBackground: WEAVE_FRAME_NODE_DEFAULT_PROPS.frameBackground,
28818
+ borderWidth: WEAVE_FRAME_NODE_DEFAULT_CONFIG.borderWidth,
28819
+ borderColor: WEAVE_FRAME_NODE_DEFAULT_CONFIG.borderColor,
28820
+ stroke: "transparent",
28821
+ strokeWidth: 0,
28822
+ strokeScaleEnabled: true,
28823
+ rotation: 0,
28824
+ zIndex: 1,
28825
+ children: []
28826
+ }
28827
+ };
28828
+ }
28829
+ static addNodeState(defaultNodeState, props) {
28830
+ return mergeExceptArrays(defaultNodeState, { props: {
28831
+ x: props.props.x,
28832
+ y: props.props.y,
28833
+ width: props.props.width,
28834
+ height: props.props.height,
28835
+ ...props.props.title && { stroke: props.props.title },
28836
+ frameWidth: props.props.frameWidth,
28837
+ frameHeight: props.props.frameHeight,
28838
+ ...props.props.frameBackground && { stroke: props.props.frameBackground },
28839
+ rotation: props.props.rotation,
28840
+ ...props.props.borderColor && { borderColor: props.props.borderColor },
28841
+ ...props.props.borderWidth && { borderWidth: props.props.borderWidth }
28842
+ } });
28843
+ }
28844
+ static updateNodeState(prevNodeState, nextProps) {
28845
+ return mergeExceptArrays(prevNodeState, { props: {
28846
+ x: nextProps.x,
28847
+ y: nextProps.y,
28848
+ width: nextProps.width,
28849
+ height: nextProps.height,
28850
+ rotation: nextProps.rotation,
28851
+ title: nextProps.title,
28852
+ ...nextProps.frameBackground && { frameBackground: nextProps.frameBackground },
28853
+ ...nextProps.borderColor && { stroke: nextProps.borderColor },
28854
+ ...nextProps.borderWidth && { strokeWidth: nextProps.borderWidth }
28855
+ } });
28856
+ }
28857
+ static getSchema() {
28858
+ const baseSchema = super.getSchema();
28859
+ const frameNodeSchema = baseSchema.extend({
28860
+ type: z.literal("frame"),
28861
+ props: baseSchema.shape.props.extend({
28862
+ nodeType: z.literal("frame"),
28863
+ width: z.number().optional(),
28864
+ height: z.number().optional(),
28865
+ borderColor: z.string().default("#000000ff"),
28866
+ borderWidth: z.number().default(1),
28867
+ title: z.string().default("Frame"),
28868
+ frameWidth: z.number(),
28869
+ frameHeight: z.number(),
28870
+ frameBackground: z.string().default(WEAVE_FRAME_DEFAULT_BACKGROUND_COLOR),
28871
+ children: z.array(z.any()).default([])
28872
+ })
28873
+ });
28874
+ return frameNodeSchema;
28875
+ }
28376
28876
  };
28377
28877
 
28378
28878
  //#endregion
@@ -28453,8 +28953,8 @@ var WeaveStrokeNode = class extends WeaveNode {
28453
28953
  const segLen = Math.hypot(dx, dy) || 1;
28454
28954
  const nx = -dy / segLen;
28455
28955
  const ny = dx / segLen;
28456
- const w0 = baseW * p0.pressure / 2;
28457
- const w1 = baseW * p1.pressure / 2;
28956
+ const w0 = Math.max(baseW * p0.pressure / 2, .5);
28957
+ const w1 = Math.max(baseW * p1.pressure / 2, .5);
28458
28958
  let traveled = 0;
28459
28959
  while (traveled < segLen) {
28460
28960
  const step = Math.min(dashRemaining, segLen - traveled);
@@ -28990,6 +29490,7 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
28990
29490
  this.shiftPressed = false;
28991
29491
  }
28992
29492
  initEvents() {
29493
+ if (this.instance.isServerSide()) return;
28993
29494
  if (this.eventsInitialized) return;
28994
29495
  window.addEventListener("keydown", (e) => {
28995
29496
  if (e.key === "Shift") this.shiftPressed = true;
@@ -34532,6 +35033,11 @@ const BRUSH_TOOL_DEFAULT_CONFIG = { interpolationSteps: 10 };
34532
35033
  var WeaveBrushToolAction = class extends WeaveAction {
34533
35034
  initialized = false;
34534
35035
  isSpacePressed = false;
35036
+ penActive = false;
35037
+ lastSmoothedPressure = .5;
35038
+ lastPointerPos = null;
35039
+ lastPointerTime = 0;
35040
+ predictedCount = 0;
34535
35041
  onPropsChange = void 0;
34536
35042
  onInit = void 0;
34537
35043
  constructor(params) {
@@ -34561,11 +35067,29 @@ var WeaveBrushToolAction = class extends WeaveAction {
34561
35067
  };
34562
35068
  }
34563
35069
  getEventPressure(e) {
34564
- if (e.evt.pointerType && e.evt.pointerType === "pen") return e.evt.pressure || .5;
34565
- return .5;
35070
+ const now$2 = performance.now();
35071
+ let velocity = 0;
35072
+ if (this.lastPointerPos && now$2 - this.lastPointerTime > 0) {
35073
+ const dx = e.evt.clientX - this.lastPointerPos.x;
35074
+ const dy = e.evt.clientY - this.lastPointerPos.y;
35075
+ velocity = Math.hypot(dx, dy) / (now$2 - this.lastPointerTime) * 1e3;
35076
+ }
35077
+ this.lastPointerPos = {
35078
+ x: e.evt.clientX,
35079
+ y: e.evt.clientY
35080
+ };
35081
+ this.lastPointerTime = now$2;
35082
+ const alpha = Math.min(Math.max(velocity / 1500, .15), .6);
35083
+ let raw;
35084
+ if (e.evt.pointerType === "pen") raw = e.evt.pressure || .5;
35085
+ else raw = .5;
35086
+ this.lastSmoothedPressure = alpha * raw + (1 - alpha) * this.lastSmoothedPressure;
35087
+ return Math.max(this.lastSmoothedPressure, .15);
34566
35088
  }
34567
35089
  setupEvents() {
34568
35090
  const stage = this.instance.getStage();
35091
+ this.prevTouchAction = stage.container().style.touchAction;
35092
+ stage.container().style.touchAction = "none";
34569
35093
  window.addEventListener("keyup", (e) => {
34570
35094
  if (e.code === "Space" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) this.isSpacePressed = false;
34571
35095
  }, { signal: this.instance.getEventsController()?.signal });
@@ -34591,6 +35115,8 @@ var WeaveBrushToolAction = class extends WeaveAction {
34591
35115
  if (this.getZoomPlugin()?.isPinching()) return;
34592
35116
  if (this.isSpacePressed) return;
34593
35117
  if (e?.evt?.button !== 0) return;
35118
+ if (e.evt.pointerType === "touch" && this.penActive) return;
35119
+ if (e.evt.pointerType === "pen") this.penActive = true;
34594
35120
  const pointPressure = this.getEventPressure(e);
34595
35121
  this.handleStartStroke(pointPressure);
34596
35122
  e.evt.stopPropagation();
@@ -34601,12 +35127,27 @@ var WeaveBrushToolAction = class extends WeaveAction {
34601
35127
  this.setCursor();
34602
35128
  if (this.state !== BRUSH_TOOL_STATE.DEFINE_STROKE) return;
34603
35129
  if (this.getZoomPlugin()?.isPinching()) return;
34604
- const pointPressure = this.getEventPressure(e);
34605
- this.handleMovement(pointPressure);
35130
+ const coalescedEvents = e.evt.getCoalescedEvents ? e.evt.getCoalescedEvents() : [];
35131
+ if (coalescedEvents.length > 1) {
35132
+ for (const ce of coalescedEvents) {
35133
+ const pointPressure = ce.pointerType === "pen" && typeof ce.pressure === "number" ? ce.pressure : .5;
35134
+ this.handleMovement(pointPressure, void 0, false);
35135
+ }
35136
+ const predictedEvents = e.evt.getPredictedEvents ? e.evt.getPredictedEvents() : [];
35137
+ if (predictedEvents.length > 0) {
35138
+ const last = predictedEvents[predictedEvents.length - 1];
35139
+ const predPressure = last.pointerType === "pen" && typeof last.pressure === "number" ? last.pressure : .5;
35140
+ this.handleMovement(predPressure, last, true);
35141
+ }
35142
+ } else {
35143
+ const pointPressure = this.getEventPressure(e);
35144
+ this.handleMovement(pointPressure, void 0, false);
35145
+ }
34606
35146
  e.evt.stopPropagation();
34607
35147
  };
34608
35148
  stage.on("pointermove", handlePointerMove);
34609
35149
  const handlePointerUp = (e) => {
35150
+ this.penActive = false;
34610
35151
  if (this.state !== BRUSH_TOOL_STATE.DEFINE_STROKE) return;
34611
35152
  if (this.getZoomPlugin()?.isPinching()) return;
34612
35153
  this.handleEndStroke();
@@ -34643,6 +35184,10 @@ var WeaveBrushToolAction = class extends WeaveAction {
34643
35184
  };
34644
35185
  }
34645
35186
  handleStartStroke(pressure) {
35187
+ this.lastSmoothedPressure = .5;
35188
+ this.lastPointerPos = null;
35189
+ this.lastPointerTime = 0;
35190
+ this.predictedCount = 0;
34646
35191
  const { mousePoint, container, measureContainer } = this.instance.getMousePointer();
34647
35192
  this.clickPoint = mousePoint;
34648
35193
  this.container = container;
@@ -34671,17 +35216,25 @@ var WeaveBrushToolAction = class extends WeaveAction {
34671
35216
  }
34672
35217
  this.setState(BRUSH_TOOL_STATE.DEFINE_STROKE);
34673
35218
  }
34674
- handleMovement(pressure) {
35219
+ handleMovement(pressure, predictedEvent, isPredicted = false) {
34675
35220
  if (this.state !== BRUSH_TOOL_STATE.DEFINE_STROKE) return;
35221
+ const stage = this.instance.getStage();
34676
35222
  const tempStroke = this.instance.getStage().findOne(`#${this.strokeId}`);
34677
35223
  if (this.measureContainer && tempStroke) {
35224
+ if (predictedEvent) stage.setPointersPositions(predictedEvent);
34678
35225
  const { mousePoint } = this.instance.getMousePointerRelativeToContainer(this.measureContainer);
34679
35226
  const currentPoint = {
34680
35227
  x: mousePoint.x - tempStroke.x(),
34681
35228
  y: mousePoint.y - tempStroke.y(),
34682
35229
  pressure
34683
35230
  };
34684
- const newStrokeElements = [...tempStroke.getAttrs().strokeElements, currentPoint];
35231
+ let newStrokeElements = [...tempStroke.getAttrs().strokeElements];
35232
+ if (!isPredicted && this.predictedCount > 0) {
35233
+ newStrokeElements = newStrokeElements.slice(0, -1 * this.predictedCount);
35234
+ this.predictedCount = 0;
35235
+ }
35236
+ newStrokeElements.push(currentPoint);
35237
+ if (isPredicted) this.predictedCount++;
34685
35238
  const box = this.getBoundingBox(newStrokeElements);
34686
35239
  tempStroke.setAttrs({
34687
35240
  width: box.width,
@@ -34701,17 +35254,22 @@ var WeaveBrushToolAction = class extends WeaveAction {
34701
35254
  if (nodeHandler) {
34702
35255
  const box = this.getBoundingBox(tempStroke.getAttrs().strokeElements);
34703
35256
  let newStrokeElements = [...tempStroke.getAttrs().strokeElements];
35257
+ if (this.predictedCount > 0) {
35258
+ newStrokeElements = newStrokeElements.slice(0, -1 * this.predictedCount);
35259
+ this.predictedCount = 0;
35260
+ }
34704
35261
  newStrokeElements = newStrokeElements.map((point) => ({
34705
35262
  ...point,
34706
35263
  x: point.x - box.x,
34707
35264
  y: point.y - box.y
34708
35265
  }));
35266
+ const compressedPoints = simplify(newStrokeElements, 1, true);
34709
35267
  tempStroke.setAttrs({
34710
35268
  width: box.width,
34711
35269
  height: box.height,
34712
35270
  x: box.x,
34713
35271
  y: box.y,
34714
- strokeElements: newStrokeElements
35272
+ strokeElements: compressedPoints
34715
35273
  });
34716
35274
  const realNode = this.instance.getStage().findOne(`#${tempStroke.getAttrs().id}`);
34717
35275
  if (realNode) realNode.destroy();
@@ -34747,6 +35305,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
34747
35305
  }
34748
35306
  cleanup() {
34749
35307
  const stage = this.instance.getStage();
35308
+ stage.container().style.touchAction = this.prevTouchAction;
34750
35309
  stage.container().style.cursor = "default";
34751
35310
  this.instance.emitEvent("onAddedBrush");
34752
35311
  const selectionPlugin = this.instance.getPlugin("nodesSelection");
@@ -37686,52 +38245,6 @@ const MEASURE_TOOL_STATE = {
37686
38245
  };
37687
38246
  const WEAVE_MEASURE_TOOL_DEFAULT_CONFIG = { style: { stroke: "#FF3366" } };
37688
38247
 
37689
- //#endregion
37690
- //#region src/internal-utils/mapping.ts
37691
- const isArray = (val) => {
37692
- return Array.isArray(val);
37693
- };
37694
- const isObject = (val) => {
37695
- return val !== null && typeof val === "object" && !Array.isArray(val);
37696
- };
37697
- const mapJsonToYjsMap = (jsonData) => {
37698
- const map = new Y.Map();
37699
- const keys = Object.keys(jsonData);
37700
- for (const key of keys) {
37701
- const value = jsonData[key];
37702
- if (isArray(value)) map.set(key, mapJsonToYjsArray(value));
37703
- else if (isObject(value)) map.set(key, mapJsonToYjsMap(value));
37704
- else map.set(key, value);
37705
- }
37706
- return map;
37707
- };
37708
- const mapJsonToYjsArray = (jsonData) => {
37709
- const array = new Y.Array();
37710
- for (const item of jsonData) if (isArray(item)) array.push([mapJsonToYjsArray(item)]);
37711
- else if (isObject(item)) array.push([mapJsonToYjsMap(item)]);
37712
- else array.push(item);
37713
- return array;
37714
- };
37715
- const mapJsonToYjsElements = (jsonData) => {
37716
- if (isArray(jsonData)) return mapJsonToYjsArray(jsonData);
37717
- else if (isObject(jsonData)) return mapJsonToYjsMap(jsonData);
37718
- };
37719
- const weavejsToYjsBinary = (weavejsData) => {
37720
- const doc = new Y.Doc();
37721
- doc.getMap("weave").set("key", weavejsData.weave.key);
37722
- doc.getMap("weave").set("type", weavejsData.weave.type);
37723
- doc.getMap("weave").set("props", mapJsonToYjsElements(weavejsData.weave.props));
37724
- const actualState = Y.encodeStateAsUpdate(doc);
37725
- return actualState;
37726
- };
37727
- function getJSONFromYjsBinary(actualState) {
37728
- const document$1 = new Y.Doc();
37729
- Y.applyUpdate(document$1, actualState);
37730
- const actualStateString = JSON.stringify(document$1.getMap("weave").toJSON());
37731
- const actualStateJson = JSON.parse(actualStateString);
37732
- return actualStateJson;
37733
- }
37734
-
37735
38248
  //#endregion
37736
38249
  //#region src/actions/measure-tool/measure-tool.ts
37737
38250
  var WeaveMeasureToolAction = class extends WeaveAction {
@@ -42916,5 +43429,5 @@ var WeaveNodesSnappingPlugin = class extends WeavePlugin {
42916
43429
  };
42917
43430
 
42918
43431
  //#endregion
42919
- 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, DEFAULT_GUIDE_TOOL_ACTION_CONFIG, DEFAULT_SNAPPING_MANAGER_CONFIG, ELLIPSE_TOOL_ACTION_NAME, ELLIPSE_TOOL_STATE, ERASER_TOOL_ACTION_NAME, ERASER_TOOL_STATE, FRAME_TOOL_ACTION_NAME, FRAME_TOOL_STATE, GUIDE_DISTANCE_NAME, GUIDE_DISTANCE_ORIGIN, GUIDE_KIND, GUIDE_NAME, GUIDE_ORIENTATION, GUIDE_STATE, GUIDE_TOOL_ACTION_NAME, GUIDE_TOOL_STATE, LINE_TOOL_ACTION_NAME, LINE_TOOL_DEFAULT_CONFIG, LINE_TOOL_STATE, MEASURE_TOOL_ACTION_NAME, MEASURE_TOOL_STATE, MOVE_ORIENTATION, MOVE_TOOL_ACTION_NAME, MOVE_TOOL_STATE, 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_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_NODES_SNAPPING_PLUGIN_KEY, 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_KEYBOARD_MOVE_ORIENTATION, 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, WeaveGuideToolAction, WeaveImageNode, WeaveImageToolAction, WeaveImagesToolAction, WeaveLayerNode, WeaveLineNode, WeaveLineToolAction, WeaveMeasureNode, WeaveMeasureToolAction, WeaveMoveToolAction, WeaveNode, WeaveNodesMultiSelectionFeedbackPlugin, WeaveNodesSelectionPlugin, WeaveNodesSnappingPlugin, 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, 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 };
43432
+ 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, DEFAULT_GUIDE_TOOL_ACTION_CONFIG, DEFAULT_SNAPPING_MANAGER_CONFIG, ELLIPSE_TOOL_ACTION_NAME, ELLIPSE_TOOL_STATE, ERASER_TOOL_ACTION_NAME, ERASER_TOOL_STATE, FRAME_TOOL_ACTION_NAME, FRAME_TOOL_STATE, GUIDE_DISTANCE_NAME, GUIDE_DISTANCE_ORIGIN, GUIDE_KIND, GUIDE_NAME, GUIDE_ORIENTATION, GUIDE_STATE, GUIDE_TOOL_ACTION_NAME, GUIDE_TOOL_STATE, LINE_TOOL_ACTION_NAME, LINE_TOOL_DEFAULT_CONFIG, LINE_TOOL_STATE, MEASURE_TOOL_ACTION_NAME, MEASURE_TOOL_STATE, MOVE_ORIENTATION, MOVE_TOOL_ACTION_NAME, MOVE_TOOL_STATE, 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_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_NODES_SNAPPING_PLUGIN_KEY, 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_KEYBOARD_MOVE_ORIENTATION, 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, WeaveGuideToolAction, WeaveImageNode, WeaveImageToolAction, WeaveImagesToolAction, WeaveLayerNode, WeaveLineNode, WeaveLineToolAction, WeaveMeasureNode, WeaveMeasureToolAction, WeaveMoveToolAction, WeaveNode, WeaveNodesMultiSelectionFeedbackPlugin, WeaveNodesSelectionPlugin, WeaveNodesSnappingPlugin, WeavePenToolAction, WeavePlugin, WeaveRectangleNode, WeaveRectangleToolAction, WeaveRegularPolygonNode, WeaveRegularPolygonToolAction, WeaveRenderer, WeaveSelectionToolAction, WeaveStageDropAreaPlugin, WeaveStageGridPlugin, WeaveStageKeyboardMovePlugin, WeaveStageMinimapPlugin, WeaveStageNode, WeaveStagePanningPlugin, WeaveStageResizePlugin, WeaveStageZoomPlugin, WeaveStarNode, WeaveStarToolAction, WeaveStateManipulation, 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, 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 };
42920
43433
  //# sourceMappingURL=types.js.map