@inditextech/weave-sdk 2.1.0 → 2.2.0
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.d.ts +9 -0
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +160 -111
- package/dist/sdk.js.map +1 -1
- package/dist/sdk.node.d.ts +9 -0
- package/dist/sdk.node.d.ts.map +1 -1
- package/dist/sdk.node.js +174 -124
- package/dist/sdk.node.js.map +1 -1
- package/package.json +2 -2
package/dist/sdk.js
CHANGED
|
@@ -2,7 +2,6 @@ import Konva from "konva";
|
|
|
2
2
|
import pino from "pino";
|
|
3
3
|
import { WEAVE_AWARENESS_LAYER_ID, WEAVE_EXPORT_BACKGROUND_COLOR, WEAVE_EXPORT_FORMATS, WEAVE_INSTANCE_STATUS, WEAVE_KONVA_BACKEND, 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$1 from "yjs";
|
|
6
5
|
import * as Y from "yjs";
|
|
7
6
|
import React from "react";
|
|
8
7
|
import ReactReconciler from "react-reconciler";
|
|
@@ -15013,24 +15012,24 @@ var import_lodash = __toESM(require_lodash(), 1);
|
|
|
15013
15012
|
|
|
15014
15013
|
//#endregion
|
|
15015
15014
|
//#region src/yjs.ts
|
|
15016
|
-
var yjs_default = Y
|
|
15015
|
+
var yjs_default = Y;
|
|
15017
15016
|
|
|
15018
15017
|
//#endregion
|
|
15019
15018
|
//#region src/stores/default-initial-state.ts
|
|
15020
15019
|
const yjsLayer = function(id) {
|
|
15021
|
-
const newLayerMap = new
|
|
15020
|
+
const newLayerMap = new yjs_default.Map();
|
|
15022
15021
|
newLayerMap.set("key", id);
|
|
15023
15022
|
newLayerMap.set("type", "layer");
|
|
15024
|
-
const newLayerMapProps = new
|
|
15023
|
+
const newLayerMapProps = new yjs_default.Map();
|
|
15025
15024
|
newLayerMapProps.set("id", id);
|
|
15026
15025
|
newLayerMapProps.set("nodeType", "layer");
|
|
15027
|
-
newLayerMapProps.set("children", new
|
|
15026
|
+
newLayerMapProps.set("children", new yjs_default.Array());
|
|
15028
15027
|
newLayerMap.set("props", newLayerMapProps);
|
|
15029
15028
|
return newLayerMap;
|
|
15030
15029
|
};
|
|
15031
15030
|
function defaultInitialState(doc) {
|
|
15032
15031
|
doc.transact(() => {
|
|
15033
|
-
const children = new
|
|
15032
|
+
const children = new yjs_default.Array();
|
|
15034
15033
|
children.insert(0, [
|
|
15035
15034
|
yjsLayer("gridLayer"),
|
|
15036
15035
|
yjsLayer("mainLayer"),
|
|
@@ -15038,7 +15037,7 @@ function defaultInitialState(doc) {
|
|
|
15038
15037
|
yjsLayer("usersPointersLayer"),
|
|
15039
15038
|
yjsLayer("utilityLayer")
|
|
15040
15039
|
]);
|
|
15041
|
-
const stageProps = new
|
|
15040
|
+
const stageProps = new yjs_default.Map();
|
|
15042
15041
|
stageProps.set("id", "stage");
|
|
15043
15042
|
stageProps.set("children", children);
|
|
15044
15043
|
doc.getMap("weave").set("key", "stage");
|
|
@@ -19348,11 +19347,11 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
19348
19347
|
}
|
|
19349
19348
|
if (nodesSelected === 1) {
|
|
19350
19349
|
transformerAttrs = mergeExceptArrays(transformerAttrs, nodes[0].getTransformerProperties());
|
|
19351
|
-
transformerAttrs.enabledAnchors = nodes[0]
|
|
19350
|
+
transformerAttrs.enabledAnchors = nodes[0]?.allowedAnchors() ?? [];
|
|
19352
19351
|
}
|
|
19353
19352
|
if (nodesSelected > 1) {
|
|
19354
19353
|
const anchorsArrays = [];
|
|
19355
|
-
for (const node of nodes) anchorsArrays.push(node
|
|
19354
|
+
for (const node of nodes) anchorsArrays.push(node?.allowedAnchors() ?? []);
|
|
19356
19355
|
transformerAttrs.enabledAnchors = intersectArrays(anchorsArrays);
|
|
19357
19356
|
}
|
|
19358
19357
|
if (this.tr && this.tr.nodes().length > 0) {
|
|
@@ -20395,29 +20394,50 @@ var WeaveReconciler = class {
|
|
|
20395
20394
|
const type = child.getAttrs().nodeType;
|
|
20396
20395
|
const handler = this.instance.getNodeHandler(type);
|
|
20397
20396
|
if (!handler) return;
|
|
20397
|
+
let nodeAdded = false;
|
|
20398
20398
|
if (parentInstance instanceof Konva.Stage && child instanceof Konva.Layer) {
|
|
20399
20399
|
parentInstance.add(child);
|
|
20400
20400
|
handler.onAdd?.(child);
|
|
20401
|
+
nodeAdded = true;
|
|
20401
20402
|
}
|
|
20402
20403
|
if (parentInstance instanceof Konva.Layer) {
|
|
20403
20404
|
parentInstance.add(child);
|
|
20404
20405
|
handler.onAdd?.(child);
|
|
20406
|
+
nodeAdded = true;
|
|
20405
20407
|
}
|
|
20406
20408
|
if (parentInstance instanceof Konva.Group && typeof parentAttrs.containerId !== "undefined") {
|
|
20407
20409
|
const realParent = parentInstance.findOne(`#${parentAttrs.containerId}`);
|
|
20408
20410
|
realParent?.add(child);
|
|
20409
20411
|
handler.onAdd?.(child);
|
|
20412
|
+
nodeAdded = true;
|
|
20410
20413
|
}
|
|
20411
20414
|
if (parentInstance instanceof Konva.Group && typeof parentAttrs.containerId === "undefined") {
|
|
20412
20415
|
parentInstance.add(child);
|
|
20413
20416
|
handler.onAdd?.(child);
|
|
20417
|
+
nodeAdded = true;
|
|
20414
20418
|
}
|
|
20415
20419
|
if (childInitialZIndex) child.zIndex(childInitialZIndex);
|
|
20420
|
+
if (nodeAdded) this.instance.emitEvent("onNodeRenderedAdded", child);
|
|
20421
|
+
}
|
|
20422
|
+
updateNode(instance, type, prevProps, nextProps) {
|
|
20423
|
+
if (!(0, import_lodash.isEqual)(prevProps, nextProps)) {
|
|
20424
|
+
const handler = this.instance.getNodeHandler(type);
|
|
20425
|
+
if (!handler) return;
|
|
20426
|
+
handler.onUpdate(instance, nextProps);
|
|
20427
|
+
const childZIndex = nextProps.zIndex;
|
|
20428
|
+
if (childZIndex) instance.zIndex(childZIndex);
|
|
20429
|
+
this.instance.emitEvent("onNodeRenderedUpdated", instance);
|
|
20430
|
+
}
|
|
20431
|
+
}
|
|
20432
|
+
removeNode(node) {
|
|
20433
|
+
this.instance.emitEvent("onNodeRenderedRemoved", node);
|
|
20416
20434
|
}
|
|
20417
20435
|
getConfig() {
|
|
20418
20436
|
const weaveInstance = this.instance;
|
|
20419
20437
|
const logger = this.logger;
|
|
20420
20438
|
const addNode = this.addNode.bind(this);
|
|
20439
|
+
const updateNode = this.updateNode.bind(this);
|
|
20440
|
+
const removeNode = this.removeNode.bind(this);
|
|
20421
20441
|
return {
|
|
20422
20442
|
noTimeout: -1,
|
|
20423
20443
|
isPrimaryRenderer: true,
|
|
@@ -20611,13 +20631,7 @@ var WeaveReconciler = class {
|
|
|
20611
20631
|
nextProps
|
|
20612
20632
|
}, "commitUpdate");
|
|
20613
20633
|
if (instance instanceof Weave) return;
|
|
20614
|
-
|
|
20615
|
-
const handler = weaveInstance.getNodeHandler(type);
|
|
20616
|
-
if (!handler) return;
|
|
20617
|
-
handler.onUpdate(instance, nextProps);
|
|
20618
|
-
const childZIndex = nextProps.zIndex;
|
|
20619
|
-
if (childZIndex) instance.zIndex(childZIndex);
|
|
20620
|
-
}
|
|
20634
|
+
updateNode(instance, type, prevProps, nextProps);
|
|
20621
20635
|
},
|
|
20622
20636
|
removeChildFromContainer() {
|
|
20623
20637
|
logger.debug("removeChildFromContainer");
|
|
@@ -20628,6 +20642,7 @@ var WeaveReconciler = class {
|
|
|
20628
20642
|
const handler = weaveInstance.getNodeHandler(type);
|
|
20629
20643
|
if (!handler) return;
|
|
20630
20644
|
handler.onDestroy(child);
|
|
20645
|
+
removeNode(child);
|
|
20631
20646
|
}
|
|
20632
20647
|
};
|
|
20633
20648
|
}
|
|
@@ -23001,6 +23016,7 @@ var WeaveStrokeNode = class extends WeaveNode {
|
|
|
23001
23016
|
return result;
|
|
23002
23017
|
}
|
|
23003
23018
|
drawRibbonWithDash(ctx, pts, baseW, color, dash) {
|
|
23019
|
+
if (!pts) return;
|
|
23004
23020
|
if (pts.length < 2) return;
|
|
23005
23021
|
const filtered = this.resamplePoints(pts, 2);
|
|
23006
23022
|
const centerline = this.getSplinePoints(filtered, 8);
|
|
@@ -23088,7 +23104,7 @@ var WeaveStrokeNode = class extends WeaveNode {
|
|
|
23088
23104
|
}
|
|
23089
23105
|
drawShape(ctx, shape) {
|
|
23090
23106
|
const strokeElements = shape.getAttrs().strokeElements;
|
|
23091
|
-
if (strokeElements
|
|
23107
|
+
if (strokeElements?.length === 0) return;
|
|
23092
23108
|
const color = shape.getAttrs().stroke ?? "black";
|
|
23093
23109
|
const strokeWidth = shape.getAttrs().strokeWidth ?? 1;
|
|
23094
23110
|
const dash = shape.getAttrs().dash ?? [];
|
|
@@ -23255,50 +23271,52 @@ const WEAVE_COMMENT_NODE_DEFAULTS = {
|
|
|
23255
23271
|
|
|
23256
23272
|
//#endregion
|
|
23257
23273
|
//#region src/nodes/comment/text-max-lines.ts
|
|
23258
|
-
|
|
23259
|
-
|
|
23260
|
-
|
|
23261
|
-
|
|
23262
|
-
|
|
23263
|
-
|
|
23264
|
-
|
|
23265
|
-
|
|
23266
|
-
|
|
23267
|
-
|
|
23268
|
-
|
|
23269
|
-
|
|
23270
|
-
|
|
23271
|
-
|
|
23272
|
-
|
|
23273
|
-
|
|
23274
|
-
|
|
23275
|
-
|
|
23276
|
-
|
|
23277
|
-
this._applyTruncation();
|
|
23278
|
-
return this;
|
|
23279
|
-
}
|
|
23280
|
-
_applyTruncation() {
|
|
23281
|
-
if (!this._maxLines || this._maxLines <= 0) {
|
|
23274
|
+
function CreateTextWithMaxLines() {
|
|
23275
|
+
return class TextWithMaxLines extends Konva.Text {
|
|
23276
|
+
constructor(config) {
|
|
23277
|
+
super(config);
|
|
23278
|
+
this._maxLines = config.maxLines;
|
|
23279
|
+
this._fullText = config.text?.toString() ?? "";
|
|
23280
|
+
this.on("textChange widthChange fontSizeChange fontFamilyChange fontStyleChange paddingChange alignChange letterSpacingChange lineHeightChange wrapChange", () => this._applyTruncation());
|
|
23281
|
+
this._applyTruncation();
|
|
23282
|
+
}
|
|
23283
|
+
get maxLines() {
|
|
23284
|
+
return this._maxLines;
|
|
23285
|
+
}
|
|
23286
|
+
set maxLines(v) {
|
|
23287
|
+
this._maxLines = v;
|
|
23288
|
+
this._applyTruncation();
|
|
23289
|
+
}
|
|
23290
|
+
setText(text) {
|
|
23291
|
+
if (typeof text === "undefined") return this;
|
|
23292
|
+
this._fullText = text ?? "";
|
|
23282
23293
|
super.setText(this._fullText);
|
|
23283
|
-
|
|
23294
|
+
this._applyTruncation();
|
|
23295
|
+
return this;
|
|
23284
23296
|
}
|
|
23285
|
-
|
|
23286
|
-
|
|
23287
|
-
|
|
23288
|
-
|
|
23289
|
-
|
|
23290
|
-
|
|
23291
|
-
const
|
|
23292
|
-
super.setText([...visible.slice(0, -1), candidate].join("\n"));
|
|
23297
|
+
_applyTruncation() {
|
|
23298
|
+
if (!this._maxLines || this._maxLines <= 0) {
|
|
23299
|
+
super.setText(this._fullText);
|
|
23300
|
+
return;
|
|
23301
|
+
}
|
|
23302
|
+
super.setText(this._fullText);
|
|
23303
|
+
const selfAny = this;
|
|
23293
23304
|
if (typeof selfAny._setTextData === "function") selfAny._setTextData();
|
|
23294
|
-
textArr = selfAny.textArr || [];
|
|
23305
|
+
let textArr = selfAny.textArr || [];
|
|
23306
|
+
if (textArr.length > this._maxLines) {
|
|
23307
|
+
const visible = textArr.slice(0, this._maxLines).map((l) => l.text);
|
|
23308
|
+
const candidate = visible[visible.length - 1] + "…";
|
|
23309
|
+
super.setText([...visible.slice(0, -1), candidate].join("\n"));
|
|
23310
|
+
if (typeof selfAny._setTextData === "function") selfAny._setTextData();
|
|
23311
|
+
textArr = selfAny.textArr || [];
|
|
23312
|
+
}
|
|
23313
|
+
const lines = textArr.length;
|
|
23314
|
+
const fontSize = this.fontSize();
|
|
23315
|
+
const lineHeight = this.lineHeight() || 1;
|
|
23316
|
+
this.height(fontSize * lineHeight * lines);
|
|
23295
23317
|
}
|
|
23296
|
-
|
|
23297
|
-
|
|
23298
|
-
const lineHeight = this.lineHeight() || 1;
|
|
23299
|
-
this.height(fontSize * lineHeight * lines);
|
|
23300
|
-
}
|
|
23301
|
-
};
|
|
23318
|
+
};
|
|
23319
|
+
}
|
|
23302
23320
|
|
|
23303
23321
|
//#endregion
|
|
23304
23322
|
//#region src/nodes/comment/comment.ts
|
|
@@ -23468,7 +23486,7 @@ var WeaveCommentNode = class extends WeaveNode {
|
|
|
23468
23486
|
});
|
|
23469
23487
|
internalUserName.setAttrs({ width: widthExpanded - (widthContracted - 2 * circlePaddingContracted) - userNameLeftMargin - dateLeftMargin - dateWidth.width });
|
|
23470
23488
|
const commentContent = this.config.model.getContent(commentParams.commentModel);
|
|
23471
|
-
const internalComment = new
|
|
23489
|
+
const internalComment = new (CreateTextWithMaxLines())({
|
|
23472
23490
|
id: `${id}-comment`,
|
|
23473
23491
|
x: widthContracted - 2 * circlePaddingContracted + userNameLeftMargin,
|
|
23474
23492
|
text: commentContent,
|
|
@@ -31375,27 +31393,23 @@ var WeaveStateManager = class {
|
|
|
31375
31393
|
}, msg);
|
|
31376
31394
|
return;
|
|
31377
31395
|
}
|
|
31378
|
-
|
|
31379
|
-
|
|
31380
|
-
|
|
31381
|
-
|
|
31382
|
-
|
|
31383
|
-
|
|
31384
|
-
|
|
31385
|
-
|
|
31386
|
-
|
|
31387
|
-
|
|
31388
|
-
|
|
31389
|
-
|
|
31390
|
-
|
|
31391
|
-
|
|
31392
|
-
|
|
31393
|
-
|
|
31394
|
-
|
|
31395
|
-
parent.props.children.push(nodeToAdd);
|
|
31396
|
-
}
|
|
31397
|
-
this.instance.emitEvent("onNodeAdded", node);
|
|
31398
|
-
}, userId);
|
|
31396
|
+
if (!parent.props.children) parent.props.children = [];
|
|
31397
|
+
if (index) {
|
|
31398
|
+
parent.props.children.splice(index, 0, node);
|
|
31399
|
+
for (let i = 0; i < parent.props.children.length; i++) parent.props.children[i].props.zIndex = i;
|
|
31400
|
+
}
|
|
31401
|
+
if (!index) {
|
|
31402
|
+
const childrenAmount = parent.props.children.length;
|
|
31403
|
+
const nodeToAdd = {
|
|
31404
|
+
...node,
|
|
31405
|
+
props: {
|
|
31406
|
+
...node.props,
|
|
31407
|
+
zIndex: childrenAmount
|
|
31408
|
+
}
|
|
31409
|
+
};
|
|
31410
|
+
parent.props.children.push(nodeToAdd);
|
|
31411
|
+
}
|
|
31412
|
+
this.instance.emitEvent("onNodeAdded", node);
|
|
31399
31413
|
}
|
|
31400
31414
|
deepSyncSyncedStore(target, source) {
|
|
31401
31415
|
for (const key in target) if (!(key in source)) delete target[key];
|
|
@@ -31432,12 +31446,19 @@ var WeaveStateManager = class {
|
|
|
31432
31446
|
this.logger.warn({ node }, msg);
|
|
31433
31447
|
return;
|
|
31434
31448
|
}
|
|
31449
|
+
this.deepSyncSyncedStore(nodeState.props, node.props);
|
|
31450
|
+
this.instance.emitEvent("onNodeUpdated", node);
|
|
31451
|
+
}
|
|
31452
|
+
updateNodes(nodes) {
|
|
31453
|
+
for (const node of nodes) this.updateNode(node);
|
|
31454
|
+
}
|
|
31455
|
+
stateTransactional(callback) {
|
|
31456
|
+
const state = this.instance.getStore().getState();
|
|
31435
31457
|
const doc = getYjsDoc(state);
|
|
31436
31458
|
const userId = this.instance.getStore().getUser().id;
|
|
31437
31459
|
doc.transact(() => {
|
|
31438
|
-
|
|
31460
|
+
callback();
|
|
31439
31461
|
}, userId);
|
|
31440
|
-
this.instance.emitEvent("onNodeUpdated", node);
|
|
31441
31462
|
}
|
|
31442
31463
|
removeNode(node) {
|
|
31443
31464
|
const state = this.instance.getStore().getState();
|
|
@@ -31457,21 +31478,14 @@ var WeaveStateManager = class {
|
|
|
31457
31478
|
this.logger.warn({ node }, msg);
|
|
31458
31479
|
return;
|
|
31459
31480
|
}
|
|
31460
|
-
|
|
31461
|
-
|
|
31462
|
-
|
|
31463
|
-
|
|
31464
|
-
for (let i = parent.props.children.length - 1; i >= 0; i--) if (parent.props.children[i].key === node.key) {
|
|
31465
|
-
parent.props.children.splice(i, 1);
|
|
31466
|
-
break;
|
|
31467
|
-
}
|
|
31468
|
-
for (let i = 0; i < parent.props.children.length; i++) parent.props.children[i].props.zIndex = i;
|
|
31469
|
-
this.instance.emitEvent("onNodeRemoved", node);
|
|
31481
|
+
if (parent.props.children) {
|
|
31482
|
+
for (let i = parent.props.children.length - 1; i >= 0; i--) if (parent.props.children[i].key === node.key) {
|
|
31483
|
+
parent.props.children.splice(i, 1);
|
|
31484
|
+
break;
|
|
31470
31485
|
}
|
|
31471
|
-
|
|
31472
|
-
|
|
31473
|
-
|
|
31474
|
-
for (const node of nodes) this.removeNode(node);
|
|
31486
|
+
for (let i = 0; i < parent.props.children.length; i++) parent.props.children[i].props.zIndex = i;
|
|
31487
|
+
this.instance.emitEvent("onNodeRemoved", node);
|
|
31488
|
+
}
|
|
31475
31489
|
}
|
|
31476
31490
|
moveNode(node, position) {
|
|
31477
31491
|
const state = this.instance.getStore().getState();
|
|
@@ -31499,19 +31513,15 @@ var WeaveStateManager = class {
|
|
|
31499
31513
|
this.logger.warn({ node }, msg);
|
|
31500
31514
|
return;
|
|
31501
31515
|
}
|
|
31502
|
-
|
|
31503
|
-
|
|
31504
|
-
|
|
31505
|
-
if (parent.props.children)
|
|
31506
|
-
|
|
31507
|
-
|
|
31508
|
-
|
|
31509
|
-
|
|
31510
|
-
|
|
31511
|
-
if (item && position === WEAVE_NODE_POSITION.BACK) parent.props.children.splice(0, 0, item);
|
|
31512
|
-
for (let i = 0; i < parent.props.children.length; i++) parent.props.children[i].props.zIndex = i;
|
|
31513
|
-
}
|
|
31514
|
-
}, userId);
|
|
31516
|
+
if (parent.props.children) {
|
|
31517
|
+
const item = JSON.parse(JSON.stringify(parent.props.children[nodeIndex]));
|
|
31518
|
+
parent.props.children.splice(nodeIndex, 1);
|
|
31519
|
+
if (item && position === WEAVE_NODE_POSITION.UP) parent.props.children.splice(nodeIndex + 1, 0, item);
|
|
31520
|
+
if (item && position === WEAVE_NODE_POSITION.DOWN) parent.props.children.splice(nodeIndex - 1, 0, item);
|
|
31521
|
+
if (item && position === WEAVE_NODE_POSITION.FRONT) parent.props.children.splice(childrenAmount - 1, 0, item);
|
|
31522
|
+
if (item && position === WEAVE_NODE_POSITION.BACK) parent.props.children.splice(0, 0, item);
|
|
31523
|
+
for (let i = 0; i < parent.props.children.length; i++) parent.props.children[i].props.zIndex = i;
|
|
31524
|
+
}
|
|
31515
31525
|
}
|
|
31516
31526
|
}
|
|
31517
31527
|
getElementsTree() {
|
|
@@ -31597,7 +31607,7 @@ var WeaveRegisterManager = class {
|
|
|
31597
31607
|
|
|
31598
31608
|
//#endregion
|
|
31599
31609
|
//#region package.json
|
|
31600
|
-
var version = "2.
|
|
31610
|
+
var version = "2.2.0";
|
|
31601
31611
|
|
|
31602
31612
|
//#endregion
|
|
31603
31613
|
//#region src/managers/setup.ts
|
|
@@ -32217,6 +32227,8 @@ var Weave = class {
|
|
|
32217
32227
|
store.disconnect();
|
|
32218
32228
|
const stage = this.getStage();
|
|
32219
32229
|
if (stage) stage.destroy();
|
|
32230
|
+
globalThis.Konva = void 0;
|
|
32231
|
+
globalThis["__ $YJS$ __"] = void 0;
|
|
32220
32232
|
this.moduleLogger.info(`Instance destroyed`);
|
|
32221
32233
|
}
|
|
32222
32234
|
getId() {
|
|
@@ -32377,25 +32389,59 @@ var Weave = class {
|
|
|
32377
32389
|
return this.stateManager.getNode(nodeKey);
|
|
32378
32390
|
}
|
|
32379
32391
|
addNode(node, parentId = "mainLayer", index = void 0) {
|
|
32392
|
+
this.stateTransactional(() => {
|
|
32393
|
+
this.stateManager.addNode(node, parentId, index);
|
|
32394
|
+
});
|
|
32395
|
+
}
|
|
32396
|
+
addNodeNT(node, parentId = "mainLayer", index = void 0) {
|
|
32380
32397
|
this.stateManager.addNode(node, parentId, index);
|
|
32381
32398
|
}
|
|
32382
32399
|
updateNode(node) {
|
|
32400
|
+
this.stateTransactional(() => {
|
|
32401
|
+
this.stateManager.updateNode(node);
|
|
32402
|
+
});
|
|
32403
|
+
}
|
|
32404
|
+
updateNodeNT(node) {
|
|
32383
32405
|
this.stateManager.updateNode(node);
|
|
32384
32406
|
}
|
|
32385
32407
|
updateNodes(nodes) {
|
|
32386
|
-
|
|
32408
|
+
this.stateTransactional(() => {
|
|
32409
|
+
this.stateManager.updateNodes(nodes);
|
|
32410
|
+
});
|
|
32411
|
+
}
|
|
32412
|
+
updateNodesNT(nodes) {
|
|
32413
|
+
this.stateManager.updateNodes(nodes);
|
|
32387
32414
|
}
|
|
32388
32415
|
removeNode(node) {
|
|
32416
|
+
this.stateTransactional(() => {
|
|
32417
|
+
this.stateManager.removeNode(node);
|
|
32418
|
+
const selectionPlugin = this.getPlugin("nodesSelection");
|
|
32419
|
+
if (selectionPlugin) selectionPlugin.setSelectedNodes([]);
|
|
32420
|
+
});
|
|
32421
|
+
}
|
|
32422
|
+
removeNodeNT(node) {
|
|
32389
32423
|
this.stateManager.removeNode(node);
|
|
32390
32424
|
const selectionPlugin = this.getPlugin("nodesSelection");
|
|
32391
32425
|
if (selectionPlugin) selectionPlugin.setSelectedNodes([]);
|
|
32392
32426
|
}
|
|
32393
32427
|
removeNodes(nodes) {
|
|
32394
|
-
|
|
32428
|
+
this.stateTransactional(() => {
|
|
32429
|
+
for (const node of nodes) this.removeNodeNT(node);
|
|
32430
|
+
const selectionPlugin = this.getPlugin("nodesSelection");
|
|
32431
|
+
if (selectionPlugin) selectionPlugin.setSelectedNodes([]);
|
|
32432
|
+
});
|
|
32433
|
+
}
|
|
32434
|
+
removeNodesNT(nodes) {
|
|
32435
|
+
for (const node of nodes) this.removeNodeNT(node);
|
|
32395
32436
|
const selectionPlugin = this.getPlugin("nodesSelection");
|
|
32396
32437
|
if (selectionPlugin) selectionPlugin.setSelectedNodes([]);
|
|
32397
32438
|
}
|
|
32398
32439
|
moveNode(node, position) {
|
|
32440
|
+
this.stateTransactional(() => {
|
|
32441
|
+
this.stateManager.moveNode(node, position);
|
|
32442
|
+
});
|
|
32443
|
+
}
|
|
32444
|
+
moveNodeNT(node, position) {
|
|
32399
32445
|
this.stateManager.moveNode(node, position);
|
|
32400
32446
|
}
|
|
32401
32447
|
getElementsTree() {
|
|
@@ -32425,6 +32471,9 @@ var Weave = class {
|
|
|
32425
32471
|
getBoundingBox(nodes, config) {
|
|
32426
32472
|
return getBoundingBox(nodes, config);
|
|
32427
32473
|
}
|
|
32474
|
+
stateTransactional(callback) {
|
|
32475
|
+
this.stateManager.stateTransactional(callback);
|
|
32476
|
+
}
|
|
32428
32477
|
moveUp(node) {
|
|
32429
32478
|
this.zIndexManager.moveUp(node);
|
|
32430
32479
|
}
|