@inditextech/weave-sdk 0.2.1 → 0.3.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.cjs +209 -307
- package/dist/sdk.d.cts +83 -100
- package/dist/sdk.d.ts +83 -100
- package/dist/sdk.js +206 -308
- package/package.json +5 -4
package/dist/sdk.cjs
CHANGED
|
@@ -15621,8 +15621,13 @@ var WeavePlugin = class {
|
|
|
15621
15621
|
|
|
15622
15622
|
//#endregion
|
|
15623
15623
|
//#region src/plugins/nodes-selection/constants.ts
|
|
15624
|
+
const WEAVE_NODES_SELECTION_KEY = "nodesSelection";
|
|
15624
15625
|
const WEAVE_NODES_SELECTION_LAYER_ID = "selectionLayer";
|
|
15625
15626
|
|
|
15627
|
+
//#endregion
|
|
15628
|
+
//#region src/plugins/context-menu/constants.ts
|
|
15629
|
+
const WEAVE_CONTEXT_MENU_KEY = "contextMenu";
|
|
15630
|
+
|
|
15626
15631
|
//#endregion
|
|
15627
15632
|
//#region src/plugins/context-menu/context-menu.ts
|
|
15628
15633
|
var WeaveContextMenuPlugin = class extends WeavePlugin {
|
|
@@ -15636,9 +15641,9 @@ var WeaveContextMenuPlugin = class extends WeavePlugin {
|
|
|
15636
15641
|
this.callbacks = callbacks;
|
|
15637
15642
|
}
|
|
15638
15643
|
getName() {
|
|
15639
|
-
return
|
|
15644
|
+
return WEAVE_CONTEXT_MENU_KEY;
|
|
15640
15645
|
}
|
|
15641
|
-
|
|
15646
|
+
onInit() {
|
|
15642
15647
|
this.initEvents();
|
|
15643
15648
|
}
|
|
15644
15649
|
triggerContextMenu(target) {
|
|
@@ -15659,7 +15664,7 @@ var WeaveContextMenuPlugin = class extends WeavePlugin {
|
|
|
15659
15664
|
const nodeHandler = this.instance.getNodeHandler(node.getAttrs().nodeType);
|
|
15660
15665
|
return {
|
|
15661
15666
|
instance: node,
|
|
15662
|
-
node: nodeHandler.
|
|
15667
|
+
node: nodeHandler.serialize(node)
|
|
15663
15668
|
};
|
|
15664
15669
|
}).filter((node) => node !== void 0);
|
|
15665
15670
|
}
|
|
@@ -15734,7 +15739,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
15734
15739
|
this.enabled = false;
|
|
15735
15740
|
}
|
|
15736
15741
|
getName() {
|
|
15737
|
-
return
|
|
15742
|
+
return WEAVE_NODES_SELECTION_KEY;
|
|
15738
15743
|
}
|
|
15739
15744
|
getLayerName() {
|
|
15740
15745
|
return WEAVE_NODES_SELECTION_LAYER_ID;
|
|
@@ -15744,7 +15749,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
15744
15749
|
const layer = new konva.default.Layer({ id: this.getLayerName() });
|
|
15745
15750
|
stage.add(layer);
|
|
15746
15751
|
}
|
|
15747
|
-
|
|
15752
|
+
onInit() {
|
|
15748
15753
|
const stage = this.instance.getStage();
|
|
15749
15754
|
const selectionLayer = this.getLayer();
|
|
15750
15755
|
stage.container().tabIndex = 1;
|
|
@@ -15848,7 +15853,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
15848
15853
|
const nodeHandler = this.instance.getNodeHandler(nodeType);
|
|
15849
15854
|
return {
|
|
15850
15855
|
instance: node,
|
|
15851
|
-
node: nodeHandler.
|
|
15856
|
+
node: nodeHandler.serialize(node)
|
|
15852
15857
|
};
|
|
15853
15858
|
});
|
|
15854
15859
|
this.callbacks?.onNodesChange?.(selectedNodes);
|
|
@@ -15863,7 +15868,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
15863
15868
|
const selectedNodes = this.getSelectedNodes();
|
|
15864
15869
|
const mappedSelectedNodes = selectedNodes.map((node) => {
|
|
15865
15870
|
const handler = this.instance.getNodeHandler(node.getAttrs().nodeType);
|
|
15866
|
-
return handler.
|
|
15871
|
+
return handler.serialize(node);
|
|
15867
15872
|
});
|
|
15868
15873
|
this.instance.removeNodes(mappedSelectedNodes);
|
|
15869
15874
|
this.tr.nodes([]);
|
|
@@ -16051,6 +16056,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16051
16056
|
|
|
16052
16057
|
//#endregion
|
|
16053
16058
|
//#region src/plugins/copy-paste-nodes/constants.ts
|
|
16059
|
+
const WEAVE_COPY_PASTE_NODES_KEY = "copyPasteNodes";
|
|
16054
16060
|
const COPY_PASTE_NODES_PLUGIN_STATE = {
|
|
16055
16061
|
["IDLE"]: "idle",
|
|
16056
16062
|
["PASTING"]: "pasting"
|
|
@@ -16065,9 +16071,9 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
|
|
|
16065
16071
|
this.state = COPY_PASTE_NODES_PLUGIN_STATE.IDLE;
|
|
16066
16072
|
}
|
|
16067
16073
|
getName() {
|
|
16068
|
-
return
|
|
16074
|
+
return WEAVE_COPY_PASTE_NODES_KEY;
|
|
16069
16075
|
}
|
|
16070
|
-
|
|
16076
|
+
onInit() {
|
|
16071
16077
|
this.initEvents();
|
|
16072
16078
|
}
|
|
16073
16079
|
readClipboardData() {
|
|
@@ -16291,19 +16297,19 @@ var WeaveNode = class {
|
|
|
16291
16297
|
});
|
|
16292
16298
|
node.on("transform", (e) => {
|
|
16293
16299
|
if (this.isSelecting() && this.isNodeSelected(node)) {
|
|
16294
|
-
this.instance.updateNode(this.
|
|
16300
|
+
this.instance.updateNode(this.serialize(node));
|
|
16295
16301
|
e.cancelBubble = true;
|
|
16296
16302
|
}
|
|
16297
16303
|
});
|
|
16298
16304
|
node.on("dragmove", (e) => {
|
|
16299
16305
|
if (this.isSelecting() && this.isNodeSelected(node)) {
|
|
16300
|
-
this.instance.updateNode(this.
|
|
16306
|
+
this.instance.updateNode(this.serialize(node));
|
|
16301
16307
|
e.cancelBubble = true;
|
|
16302
16308
|
}
|
|
16303
16309
|
});
|
|
16304
16310
|
node.on("dragend", (e) => {
|
|
16305
16311
|
if (this.isSelecting() && this.isNodeSelected(node)) {
|
|
16306
|
-
this.instance.updateNode(this.
|
|
16312
|
+
this.instance.updateNode(this.serialize(node));
|
|
16307
16313
|
e.cancelBubble = true;
|
|
16308
16314
|
}
|
|
16309
16315
|
});
|
|
@@ -16327,6 +16333,36 @@ var WeaveNode = class {
|
|
|
16327
16333
|
}
|
|
16328
16334
|
});
|
|
16329
16335
|
}
|
|
16336
|
+
create(key, props) {
|
|
16337
|
+
return {
|
|
16338
|
+
key,
|
|
16339
|
+
type: this.nodeType,
|
|
16340
|
+
props: {
|
|
16341
|
+
...props,
|
|
16342
|
+
id: key,
|
|
16343
|
+
nodeType: this.nodeType,
|
|
16344
|
+
children: []
|
|
16345
|
+
}
|
|
16346
|
+
};
|
|
16347
|
+
}
|
|
16348
|
+
onDestroy(nodeInstance) {
|
|
16349
|
+
nodeInstance.destroy();
|
|
16350
|
+
}
|
|
16351
|
+
serialize(instance) {
|
|
16352
|
+
const attrs = instance.getAttrs();
|
|
16353
|
+
const cleanedAttrs = { ...attrs };
|
|
16354
|
+
delete cleanedAttrs.draggable;
|
|
16355
|
+
return {
|
|
16356
|
+
key: attrs.id ?? "",
|
|
16357
|
+
type: attrs.nodeType,
|
|
16358
|
+
props: {
|
|
16359
|
+
...cleanedAttrs,
|
|
16360
|
+
id: attrs.id ?? "",
|
|
16361
|
+
nodeType: attrs.nodeType,
|
|
16362
|
+
children: []
|
|
16363
|
+
}
|
|
16364
|
+
};
|
|
16365
|
+
}
|
|
16330
16366
|
};
|
|
16331
16367
|
|
|
16332
16368
|
//#endregion
|
|
@@ -16486,7 +16522,7 @@ var WeaveReconciler = class {
|
|
|
16486
16522
|
newProps.width = rootContainer.getStageConfiguration().width;
|
|
16487
16523
|
newProps.height = rootContainer.getStageConfiguration().height;
|
|
16488
16524
|
}
|
|
16489
|
-
return handler.
|
|
16525
|
+
return handler.onRender(newProps);
|
|
16490
16526
|
},
|
|
16491
16527
|
detachDeletedInstance(node) {
|
|
16492
16528
|
logger.debug({ node }, "detachDeletedInstance");
|
|
@@ -16582,7 +16618,7 @@ var WeaveReconciler = class {
|
|
|
16582
16618
|
if (!(0, import_lodash.isEqual)(prevProps, nextProps)) {
|
|
16583
16619
|
const handler = weaveInstance.getNodeHandler(type);
|
|
16584
16620
|
if (!handler) return;
|
|
16585
|
-
handler.
|
|
16621
|
+
handler.onUpdate(instance, nextProps);
|
|
16586
16622
|
const childZIndex = nextProps.zIndex;
|
|
16587
16623
|
if (childZIndex) instance.zIndex(childZIndex);
|
|
16588
16624
|
}
|
|
@@ -16592,7 +16628,10 @@ var WeaveReconciler = class {
|
|
|
16592
16628
|
},
|
|
16593
16629
|
removeChild(_, child) {
|
|
16594
16630
|
logger.debug({ child }, "removeChild");
|
|
16595
|
-
child.
|
|
16631
|
+
const type = child.getAttrs().nodeType;
|
|
16632
|
+
const handler = weaveInstance.getNodeHandler(type);
|
|
16633
|
+
if (!handler) return;
|
|
16634
|
+
handler.onDestroy(child);
|
|
16596
16635
|
}
|
|
16597
16636
|
};
|
|
16598
16637
|
}
|
|
@@ -16727,7 +16766,7 @@ var WeaveGroupsManager = class {
|
|
|
16727
16766
|
});
|
|
16728
16767
|
parentLayer?.add(groupInstance);
|
|
16729
16768
|
const groupHandler = this.instance.getNodeHandler("group");
|
|
16730
|
-
const groupNode = groupHandler.
|
|
16769
|
+
const groupNode = groupHandler.create(groupId, { draggable: true });
|
|
16731
16770
|
this.instance.addNode(groupNode, nodeId ?? parentNodeId);
|
|
16732
16771
|
const nodesWithZIndex = nodes.map((node) => {
|
|
16733
16772
|
const instance = mainLayer?.findOne(`#${node.key}`);
|
|
@@ -16751,7 +16790,7 @@ var WeaveGroupsManager = class {
|
|
|
16751
16790
|
konvaGroup.setAttr("id", v4_default());
|
|
16752
16791
|
konvaGroup.setAttr("draggable", false);
|
|
16753
16792
|
const handler = this.instance.getNodeHandler("group");
|
|
16754
|
-
const stateNode = handler.
|
|
16793
|
+
const stateNode = handler.serialize(konvaGroup);
|
|
16755
16794
|
this.instance.addNode(stateNode, groupId);
|
|
16756
16795
|
}
|
|
16757
16796
|
continue;
|
|
@@ -16767,7 +16806,7 @@ var WeaveGroupsManager = class {
|
|
|
16767
16806
|
konvaNode.setAttr("id", v4_default());
|
|
16768
16807
|
konvaNode.setAttr("draggable", false);
|
|
16769
16808
|
const handler = this.instance.getNodeHandler(konvaNode.getAttrs().nodeType);
|
|
16770
|
-
const stateNode = handler.
|
|
16809
|
+
const stateNode = handler.serialize(konvaNode);
|
|
16771
16810
|
this.instance.addNode(stateNode, groupId);
|
|
16772
16811
|
}
|
|
16773
16812
|
}
|
|
@@ -16818,12 +16857,12 @@ var WeaveGroupsManager = class {
|
|
|
16818
16857
|
child.setAttr("draggable", true);
|
|
16819
16858
|
newChildId = child.getAttrs().id;
|
|
16820
16859
|
const handler = this.instance.getNodeHandler(child.getAttrs().nodeType);
|
|
16821
|
-
const node = handler.
|
|
16860
|
+
const node = handler.serialize(child);
|
|
16822
16861
|
this.instance.addNode(node, nodeId ?? newLayer.getAttrs().id);
|
|
16823
16862
|
child.destroy();
|
|
16824
16863
|
}
|
|
16825
16864
|
const groupHandler = this.instance.getNodeHandler("group");
|
|
16826
|
-
const groupNode = groupHandler.
|
|
16865
|
+
const groupNode = groupHandler.serialize(konvaGroup);
|
|
16827
16866
|
this.instance.removeNode(groupNode);
|
|
16828
16867
|
setTimeout(() => {
|
|
16829
16868
|
const firstElement = newLayer.findOne(`#${newChildId}`);
|
|
@@ -17043,7 +17082,7 @@ var WeaveCloningManager = class {
|
|
|
17043
17082
|
minPoint.x = node.x();
|
|
17044
17083
|
minPoint.y = node.y();
|
|
17045
17084
|
}
|
|
17046
|
-
const serialized = nodeHandler.
|
|
17085
|
+
const serialized = nodeHandler.serialize(node);
|
|
17047
17086
|
serializedNodes.push(serialized);
|
|
17048
17087
|
});
|
|
17049
17088
|
newGroup.destroy();
|
|
@@ -17100,7 +17139,7 @@ var WeaveCloningManager = class {
|
|
|
17100
17139
|
node.setAbsolutePosition(nodePos);
|
|
17101
17140
|
node.rotation(nodeRotation);
|
|
17102
17141
|
const handler = this.instance.getNodeHandler(node.getAttrs().nodeType);
|
|
17103
|
-
const stateNode = handler.
|
|
17142
|
+
const stateNode = handler.serialize(node);
|
|
17104
17143
|
this.instance.addNode(stateNode, targetContainer.getAttrs().id);
|
|
17105
17144
|
node.destroy();
|
|
17106
17145
|
}
|
|
@@ -17318,28 +17357,28 @@ var WeaveZIndexManager = class {
|
|
|
17318
17357
|
this.logger.debug(`Moving instance with id [${instance.getAttrs().id}], up one step of z-index`);
|
|
17319
17358
|
instance.moveUp();
|
|
17320
17359
|
const handler = this.instance.getNodeHandler(instance.getAttrs().nodeType);
|
|
17321
|
-
const node = handler.
|
|
17360
|
+
const node = handler.serialize(instance);
|
|
17322
17361
|
this.instance.moveNode(node, __inditextech_weave_types.WEAVE_NODE_POSITION.UP);
|
|
17323
17362
|
}
|
|
17324
17363
|
moveDown(instance) {
|
|
17325
17364
|
this.logger.debug(`Moving instance with id [${instance.getAttrs().id}], down one step of z-index`);
|
|
17326
17365
|
instance.moveDown();
|
|
17327
17366
|
const handler = this.instance.getNodeHandler(instance.getAttrs().nodeType);
|
|
17328
|
-
const node = handler.
|
|
17367
|
+
const node = handler.serialize(instance);
|
|
17329
17368
|
this.instance.moveNode(node, __inditextech_weave_types.WEAVE_NODE_POSITION.DOWN);
|
|
17330
17369
|
}
|
|
17331
17370
|
sendToBack(instance) {
|
|
17332
17371
|
this.logger.debug(`Moving instance with id [${instance.getAttrs().id}], to bottom of z-index`);
|
|
17333
17372
|
instance.moveToBottom();
|
|
17334
17373
|
const handler = this.instance.getNodeHandler(instance.getAttrs().nodeType);
|
|
17335
|
-
const node = handler.
|
|
17374
|
+
const node = handler.serialize(instance);
|
|
17336
17375
|
this.instance.moveNode(node, __inditextech_weave_types.WEAVE_NODE_POSITION.BACK);
|
|
17337
17376
|
}
|
|
17338
17377
|
bringToFront(instance) {
|
|
17339
17378
|
this.logger.debug(`Moving instance with id [${instance.getAttrs().id}], to top of z-index`);
|
|
17340
17379
|
instance.moveToTop();
|
|
17341
17380
|
const handler = this.instance.getNodeHandler(instance.getAttrs().nodeType);
|
|
17342
|
-
const node = handler.
|
|
17381
|
+
const node = handler.serialize(instance);
|
|
17343
17382
|
this.instance.updateNode(node);
|
|
17344
17383
|
this.instance.moveNode(node, __inditextech_weave_types.WEAVE_NODE_POSITION.FRONT);
|
|
17345
17384
|
}
|
|
@@ -17660,7 +17699,7 @@ var WeaveRegisterManager = class {
|
|
|
17660
17699
|
|
|
17661
17700
|
//#endregion
|
|
17662
17701
|
//#region package.json
|
|
17663
|
-
var version = "0.
|
|
17702
|
+
var version = "0.3.1";
|
|
17664
17703
|
|
|
17665
17704
|
//#endregion
|
|
17666
17705
|
//#region src/managers/setup.ts
|
|
@@ -17697,7 +17736,7 @@ var WeaveSetupManager = class {
|
|
|
17697
17736
|
const plugins = this.instance.getRegisterManager().getPlugins();
|
|
17698
17737
|
for (const plugin of Object.keys(plugins)) {
|
|
17699
17738
|
const pluginInstance = plugins[plugin];
|
|
17700
|
-
pluginInstance.
|
|
17739
|
+
pluginInstance.onInit?.();
|
|
17701
17740
|
}
|
|
17702
17741
|
}
|
|
17703
17742
|
setupActions() {
|
|
@@ -17705,7 +17744,7 @@ var WeaveSetupManager = class {
|
|
|
17705
17744
|
const actionsHandlers = this.instance.getRegisterManager().getActionsHandlers();
|
|
17706
17745
|
for (const actionId of Object.keys(actionsHandlers)) {
|
|
17707
17746
|
const actionInstance = actionsHandlers[actionId];
|
|
17708
|
-
actionInstance.
|
|
17747
|
+
actionInstance.onInit?.();
|
|
17709
17748
|
}
|
|
17710
17749
|
}
|
|
17711
17750
|
};
|
|
@@ -17887,7 +17926,7 @@ var WeaveExportManager = class {
|
|
|
17887
17926
|
const plugins = this.instance.getPlugins();
|
|
17888
17927
|
for (const pluginId of Object.keys(plugins)) {
|
|
17889
17928
|
const pluginInstance = plugins[pluginId];
|
|
17890
|
-
pluginInstance.
|
|
17929
|
+
pluginInstance.onRender?.();
|
|
17891
17930
|
}
|
|
17892
17931
|
const stageClientRect = stage.getClientRect({ relativeTo: stage });
|
|
17893
17932
|
background = new konva.default.Rect({
|
|
@@ -17917,7 +17956,7 @@ var WeaveExportManager = class {
|
|
|
17917
17956
|
const plugins$1 = this.instance.getPlugins();
|
|
17918
17957
|
for (const pluginId of Object.keys(plugins$1)) {
|
|
17919
17958
|
const pluginInstance = plugins$1[pluginId];
|
|
17920
|
-
pluginInstance.
|
|
17959
|
+
pluginInstance.onRender?.();
|
|
17921
17960
|
}
|
|
17922
17961
|
background?.destroy();
|
|
17923
17962
|
resolve(img);
|
|
@@ -18279,80 +18318,43 @@ function resetScale(node) {
|
|
|
18279
18318
|
}
|
|
18280
18319
|
|
|
18281
18320
|
//#endregion
|
|
18282
|
-
//#region src/nodes/stage/
|
|
18321
|
+
//#region src/nodes/stage/constants.ts
|
|
18283
18322
|
const WEAVE_STAGE_NODE_TYPE = "stage";
|
|
18323
|
+
|
|
18324
|
+
//#endregion
|
|
18325
|
+
//#region src/nodes/stage/stage.ts
|
|
18284
18326
|
var WeaveStageNode = class extends WeaveNode {
|
|
18285
18327
|
nodeType = WEAVE_STAGE_NODE_TYPE;
|
|
18286
|
-
|
|
18287
|
-
return {
|
|
18288
|
-
key,
|
|
18289
|
-
type: this.nodeType,
|
|
18290
|
-
props: {
|
|
18291
|
-
...props,
|
|
18292
|
-
id: key,
|
|
18293
|
-
nodeType: this.nodeType,
|
|
18294
|
-
children: []
|
|
18295
|
-
}
|
|
18296
|
-
};
|
|
18297
|
-
}
|
|
18298
|
-
createInstance(props) {
|
|
18328
|
+
onRender(props) {
|
|
18299
18329
|
const stage = new konva.default.Stage({ ...props });
|
|
18300
18330
|
stage.draw();
|
|
18301
18331
|
return stage;
|
|
18302
18332
|
}
|
|
18303
|
-
|
|
18304
|
-
removeInstance(nodeInstance) {
|
|
18305
|
-
nodeInstance.destroy();
|
|
18306
|
-
}
|
|
18307
|
-
toNode(instance) {
|
|
18308
|
-
const attrs = instance.getAttrs();
|
|
18309
|
-
return {
|
|
18310
|
-
key: attrs.id ?? "",
|
|
18311
|
-
type: attrs.nodeType,
|
|
18312
|
-
props: {
|
|
18313
|
-
...attrs,
|
|
18314
|
-
id: attrs.id ?? "",
|
|
18315
|
-
nodeType: attrs.nodeType,
|
|
18316
|
-
children: []
|
|
18317
|
-
}
|
|
18318
|
-
};
|
|
18319
|
-
}
|
|
18333
|
+
onUpdate() {}
|
|
18320
18334
|
};
|
|
18321
18335
|
|
|
18322
18336
|
//#endregion
|
|
18323
|
-
//#region src/nodes/layer/
|
|
18337
|
+
//#region src/nodes/layer/constants.ts
|
|
18324
18338
|
const WEAVE_LAYER_NODE_TYPE = "layer";
|
|
18339
|
+
|
|
18340
|
+
//#endregion
|
|
18341
|
+
//#region src/nodes/layer/layer.ts
|
|
18325
18342
|
var WeaveLayerNode = class extends WeaveNode {
|
|
18326
18343
|
nodeType = WEAVE_LAYER_NODE_TYPE;
|
|
18327
|
-
|
|
18328
|
-
return {
|
|
18329
|
-
key,
|
|
18330
|
-
type: this.nodeType,
|
|
18331
|
-
props: {
|
|
18332
|
-
...props,
|
|
18333
|
-
id: key,
|
|
18334
|
-
nodeType: this.nodeType,
|
|
18335
|
-
children: []
|
|
18336
|
-
}
|
|
18337
|
-
};
|
|
18338
|
-
}
|
|
18339
|
-
createInstance(props) {
|
|
18344
|
+
onRender(props) {
|
|
18340
18345
|
const layer = new konva.default.Layer({ ...props });
|
|
18341
18346
|
return layer;
|
|
18342
18347
|
}
|
|
18343
|
-
|
|
18348
|
+
onUpdate(nodeInstance, nextProps) {
|
|
18344
18349
|
nodeInstance.setAttrs({ ...nextProps });
|
|
18345
18350
|
}
|
|
18346
|
-
|
|
18347
|
-
nodeInstance.destroy();
|
|
18348
|
-
}
|
|
18349
|
-
toNode(instance) {
|
|
18351
|
+
serialize(instance) {
|
|
18350
18352
|
const attrs = instance.getAttrs();
|
|
18351
18353
|
const childrenMapped = [];
|
|
18352
18354
|
const children = [...instance.getChildren()];
|
|
18353
18355
|
for (const node of children) {
|
|
18354
18356
|
const handler = this.instance.getNodeHandler(node.getAttr("nodeType"));
|
|
18355
|
-
childrenMapped.push(handler.
|
|
18357
|
+
childrenMapped.push(handler.serialize(node));
|
|
18356
18358
|
}
|
|
18357
18359
|
return {
|
|
18358
18360
|
key: attrs.id ?? "",
|
|
@@ -18368,23 +18370,14 @@ var WeaveLayerNode = class extends WeaveNode {
|
|
|
18368
18370
|
};
|
|
18369
18371
|
|
|
18370
18372
|
//#endregion
|
|
18371
|
-
//#region src/nodes/group/
|
|
18373
|
+
//#region src/nodes/group/constants.ts
|
|
18372
18374
|
const WEAVE_GROUP_NODE_TYPE = "group";
|
|
18375
|
+
|
|
18376
|
+
//#endregion
|
|
18377
|
+
//#region src/nodes/group/group.ts
|
|
18373
18378
|
var WeaveGroupNode = class extends WeaveNode {
|
|
18374
18379
|
nodeType = WEAVE_GROUP_NODE_TYPE;
|
|
18375
|
-
|
|
18376
|
-
return {
|
|
18377
|
-
key,
|
|
18378
|
-
type: this.nodeType,
|
|
18379
|
-
props: {
|
|
18380
|
-
...props,
|
|
18381
|
-
id: key,
|
|
18382
|
-
nodeType: this.nodeType,
|
|
18383
|
-
children: []
|
|
18384
|
-
}
|
|
18385
|
-
};
|
|
18386
|
-
}
|
|
18387
|
-
createInstance(props) {
|
|
18380
|
+
onRender(props) {
|
|
18388
18381
|
const group = new konva.default.Group({
|
|
18389
18382
|
...props,
|
|
18390
18383
|
name: "node"
|
|
@@ -18392,19 +18385,16 @@ var WeaveGroupNode = class extends WeaveNode {
|
|
|
18392
18385
|
this.setupDefaultNodeEvents(group);
|
|
18393
18386
|
return group;
|
|
18394
18387
|
}
|
|
18395
|
-
|
|
18388
|
+
onUpdate(nodeInstance, nextProps) {
|
|
18396
18389
|
nodeInstance.setAttrs({ ...nextProps });
|
|
18397
18390
|
}
|
|
18398
|
-
|
|
18399
|
-
nodeInstance.destroy();
|
|
18400
|
-
}
|
|
18401
|
-
toNode(instance) {
|
|
18391
|
+
serialize(instance) {
|
|
18402
18392
|
const attrs = instance.getAttrs();
|
|
18403
18393
|
const childrenMapped = [];
|
|
18404
18394
|
const children = [...instance.getChildren()];
|
|
18405
18395
|
for (const node of children) {
|
|
18406
18396
|
const handler = this.instance.getNodeHandler(node.getAttr("nodeType"));
|
|
18407
|
-
childrenMapped.push(handler.
|
|
18397
|
+
childrenMapped.push(handler.serialize(node));
|
|
18408
18398
|
}
|
|
18409
18399
|
return {
|
|
18410
18400
|
key: attrs.id ?? "",
|
|
@@ -18420,23 +18410,14 @@ var WeaveGroupNode = class extends WeaveNode {
|
|
|
18420
18410
|
};
|
|
18421
18411
|
|
|
18422
18412
|
//#endregion
|
|
18423
|
-
//#region src/nodes/rectangle/
|
|
18413
|
+
//#region src/nodes/rectangle/constants.ts
|
|
18424
18414
|
const WEAVE_RECTANGLE_NODE_TYPE = "rectangle";
|
|
18415
|
+
|
|
18416
|
+
//#endregion
|
|
18417
|
+
//#region src/nodes/rectangle/rectangle.ts
|
|
18425
18418
|
var WeaveRectangleNode = class extends WeaveNode {
|
|
18426
18419
|
nodeType = WEAVE_RECTANGLE_NODE_TYPE;
|
|
18427
|
-
|
|
18428
|
-
return {
|
|
18429
|
-
key,
|
|
18430
|
-
type: this.nodeType,
|
|
18431
|
-
props: {
|
|
18432
|
-
...props,
|
|
18433
|
-
id: key,
|
|
18434
|
-
nodeType: this.nodeType,
|
|
18435
|
-
children: []
|
|
18436
|
-
}
|
|
18437
|
-
};
|
|
18438
|
-
}
|
|
18439
|
-
createInstance(props) {
|
|
18420
|
+
onRender(props) {
|
|
18440
18421
|
const rectangle = new konva.default.Rect({
|
|
18441
18422
|
...props,
|
|
18442
18423
|
name: "node"
|
|
@@ -18444,47 +18425,20 @@ var WeaveRectangleNode = class extends WeaveNode {
|
|
|
18444
18425
|
this.setupDefaultNodeEvents(rectangle);
|
|
18445
18426
|
return rectangle;
|
|
18446
18427
|
}
|
|
18447
|
-
|
|
18428
|
+
onUpdate(nodeInstance, nextProps) {
|
|
18448
18429
|
nodeInstance.setAttrs({ ...nextProps });
|
|
18449
18430
|
}
|
|
18450
|
-
removeInstance(nodeInstance) {
|
|
18451
|
-
nodeInstance.destroy();
|
|
18452
|
-
}
|
|
18453
|
-
toNode(instance) {
|
|
18454
|
-
const attrs = instance.getAttrs();
|
|
18455
|
-
const cleanedAttrs = { ...attrs };
|
|
18456
|
-
delete cleanedAttrs.draggable;
|
|
18457
|
-
return {
|
|
18458
|
-
key: attrs.id ?? "",
|
|
18459
|
-
type: attrs.nodeType,
|
|
18460
|
-
props: {
|
|
18461
|
-
...cleanedAttrs,
|
|
18462
|
-
id: attrs.id ?? "",
|
|
18463
|
-
nodeType: attrs.nodeType,
|
|
18464
|
-
children: []
|
|
18465
|
-
}
|
|
18466
|
-
};
|
|
18467
|
-
}
|
|
18468
18431
|
};
|
|
18469
18432
|
|
|
18470
18433
|
//#endregion
|
|
18471
|
-
//#region src/nodes/line/
|
|
18434
|
+
//#region src/nodes/line/constants.ts
|
|
18472
18435
|
const WEAVE_LINE_NODE_TYPE = "line";
|
|
18436
|
+
|
|
18437
|
+
//#endregion
|
|
18438
|
+
//#region src/nodes/line/line.ts
|
|
18473
18439
|
var WeaveLineNode = class extends WeaveNode {
|
|
18474
18440
|
nodeType = WEAVE_LINE_NODE_TYPE;
|
|
18475
|
-
|
|
18476
|
-
return {
|
|
18477
|
-
key,
|
|
18478
|
-
type: this.nodeType,
|
|
18479
|
-
props: {
|
|
18480
|
-
...props,
|
|
18481
|
-
id: key,
|
|
18482
|
-
nodeType: this.nodeType,
|
|
18483
|
-
children: []
|
|
18484
|
-
}
|
|
18485
|
-
};
|
|
18486
|
-
}
|
|
18487
|
-
createInstance(props) {
|
|
18441
|
+
onRender(props) {
|
|
18488
18442
|
const line = new konva.default.Line({
|
|
18489
18443
|
...props,
|
|
18490
18444
|
name: "node"
|
|
@@ -18492,32 +18446,17 @@ var WeaveLineNode = class extends WeaveNode {
|
|
|
18492
18446
|
this.setupDefaultNodeEvents(line);
|
|
18493
18447
|
return line;
|
|
18494
18448
|
}
|
|
18495
|
-
|
|
18449
|
+
onUpdate(nodeInstance, nextProps) {
|
|
18496
18450
|
nodeInstance.setAttrs({ ...nextProps });
|
|
18497
18451
|
}
|
|
18498
|
-
removeInstance(nodeInstance) {
|
|
18499
|
-
nodeInstance.destroy();
|
|
18500
|
-
}
|
|
18501
|
-
toNode(instance) {
|
|
18502
|
-
const attrs = instance.getAttrs();
|
|
18503
|
-
const cleanedAttrs = { ...attrs };
|
|
18504
|
-
delete cleanedAttrs.draggable;
|
|
18505
|
-
return {
|
|
18506
|
-
key: attrs.id ?? "",
|
|
18507
|
-
type: attrs.nodeType,
|
|
18508
|
-
props: {
|
|
18509
|
-
...cleanedAttrs,
|
|
18510
|
-
id: attrs.id ?? "",
|
|
18511
|
-
nodeType: attrs.nodeType,
|
|
18512
|
-
children: []
|
|
18513
|
-
}
|
|
18514
|
-
};
|
|
18515
|
-
}
|
|
18516
18452
|
};
|
|
18517
18453
|
|
|
18518
18454
|
//#endregion
|
|
18519
|
-
//#region src/nodes/text/
|
|
18455
|
+
//#region src/nodes/text/constants.ts
|
|
18520
18456
|
const WEAVE_TEXT_NODE_TYPE = "text";
|
|
18457
|
+
|
|
18458
|
+
//#endregion
|
|
18459
|
+
//#region src/nodes/text/text.ts
|
|
18521
18460
|
var WeaveTextNode = class extends WeaveNode {
|
|
18522
18461
|
nodeType = WEAVE_TEXT_NODE_TYPE;
|
|
18523
18462
|
editing = false;
|
|
@@ -18525,28 +18464,13 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
18525
18464
|
super();
|
|
18526
18465
|
this.editing = false;
|
|
18527
18466
|
}
|
|
18528
|
-
getType() {
|
|
18529
|
-
return "text";
|
|
18530
|
-
}
|
|
18531
|
-
createNode(key, props) {
|
|
18532
|
-
return {
|
|
18533
|
-
key,
|
|
18534
|
-
type: this.nodeType,
|
|
18535
|
-
props: {
|
|
18536
|
-
...props,
|
|
18537
|
-
id: key,
|
|
18538
|
-
nodeType: this.nodeType,
|
|
18539
|
-
children: []
|
|
18540
|
-
}
|
|
18541
|
-
};
|
|
18542
|
-
}
|
|
18543
18467
|
updateNode(nodeInstance) {
|
|
18544
18468
|
const clonedText = nodeInstance.clone();
|
|
18545
18469
|
clonedText.setAttr("triggerEditMode", void 0);
|
|
18546
|
-
this.instance.updateNode(this.
|
|
18470
|
+
this.instance.updateNode(this.serialize(clonedText));
|
|
18547
18471
|
clonedText.destroy();
|
|
18548
18472
|
}
|
|
18549
|
-
|
|
18473
|
+
onRender(props) {
|
|
18550
18474
|
const text = new konva.default.Text({
|
|
18551
18475
|
...props,
|
|
18552
18476
|
name: "node"
|
|
@@ -18572,20 +18496,17 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
18572
18496
|
});
|
|
18573
18497
|
resetScale(text);
|
|
18574
18498
|
text.fontSize(text.fontSize() * text.scaleY());
|
|
18575
|
-
this.instance.updateNode(this.
|
|
18499
|
+
this.instance.updateNode(this.serialize(text));
|
|
18576
18500
|
e.cancelBubble = true;
|
|
18577
18501
|
}
|
|
18578
18502
|
});
|
|
18579
18503
|
text.setAttr("triggerEditMode", this.triggerEditMode.bind(this));
|
|
18580
18504
|
return text;
|
|
18581
18505
|
}
|
|
18582
|
-
|
|
18506
|
+
onUpdate(nodeInstance, nextProps) {
|
|
18583
18507
|
nodeInstance.setAttrs({ ...nextProps });
|
|
18584
18508
|
}
|
|
18585
|
-
|
|
18586
|
-
nodeInstance.destroy();
|
|
18587
|
-
}
|
|
18588
|
-
toNode(instance) {
|
|
18509
|
+
serialize(instance) {
|
|
18589
18510
|
const attrs = instance.getAttrs();
|
|
18590
18511
|
const cleanedAttrs = { ...attrs };
|
|
18591
18512
|
delete cleanedAttrs.draggable;
|
|
@@ -18784,7 +18705,7 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
18784
18705
|
scaleY: 1
|
|
18785
18706
|
};
|
|
18786
18707
|
}
|
|
18787
|
-
|
|
18708
|
+
onInit() {
|
|
18788
18709
|
this.instance.addEventListener("onStageDrop", () => {
|
|
18789
18710
|
if (window.weaveDragImageURL) {
|
|
18790
18711
|
this.instance.triggerAction("imageTool", { imageURL: window.weaveDragImageURL });
|
|
@@ -18822,7 +18743,7 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
18822
18743
|
strokeWidth: 1
|
|
18823
18744
|
});
|
|
18824
18745
|
const nodeHandler = this.instance.getNodeHandler("rectangle");
|
|
18825
|
-
this.instance.updateNode(nodeHandler.
|
|
18746
|
+
this.instance.updateNode(nodeHandler.serialize(tempImage));
|
|
18826
18747
|
}
|
|
18827
18748
|
});
|
|
18828
18749
|
this.initialized = true;
|
|
@@ -18864,7 +18785,7 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
18864
18785
|
const mousePos = stage.getRelativePointerPosition();
|
|
18865
18786
|
const nodeHandler = this.instance.getNodeHandler("rectangle");
|
|
18866
18787
|
this.tempImageId = v4_default();
|
|
18867
|
-
const node = nodeHandler.
|
|
18788
|
+
const node = nodeHandler.create(this.tempImageId, {
|
|
18868
18789
|
...this.props,
|
|
18869
18790
|
x: (mousePos?.x ?? 0) + 5,
|
|
18870
18791
|
y: (mousePos?.y ?? 0) + 5,
|
|
@@ -18890,7 +18811,7 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
18890
18811
|
this.clickPoint = mousePoint;
|
|
18891
18812
|
this.container = container;
|
|
18892
18813
|
const nodeHandler = this.instance.getNodeHandler("image");
|
|
18893
|
-
const node = nodeHandler.
|
|
18814
|
+
const node = nodeHandler.create(this.imageId, {
|
|
18894
18815
|
...this.props,
|
|
18895
18816
|
x: this.clickPoint?.x ?? 0,
|
|
18896
18817
|
y: this.clickPoint?.y ?? 0,
|
|
@@ -18905,7 +18826,7 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
18905
18826
|
});
|
|
18906
18827
|
this.instance.addNode(node, this.container?.getAttrs().id);
|
|
18907
18828
|
const rectangleNodeHandler = this.instance.getNodeHandler("rectangle");
|
|
18908
|
-
this.instance.removeNode(rectangleNodeHandler.
|
|
18829
|
+
this.instance.removeNode(rectangleNodeHandler.serialize(tempImage));
|
|
18909
18830
|
this.setState(IMAGE_TOOL_STATE.FINISHED);
|
|
18910
18831
|
}
|
|
18911
18832
|
this.cancelAction();
|
|
@@ -18935,7 +18856,7 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
18935
18856
|
strokeWidth: 1
|
|
18936
18857
|
});
|
|
18937
18858
|
const nodeHandler = this.instance.getNodeHandler("rectangle");
|
|
18938
|
-
this.instance.updateNode(nodeHandler.
|
|
18859
|
+
this.instance.updateNode(nodeHandler.serialize(tempImage));
|
|
18939
18860
|
}
|
|
18940
18861
|
}
|
|
18941
18862
|
}
|
|
@@ -18945,7 +18866,7 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
18945
18866
|
const tempImage = this.instance.getStage().findOne(`#${this.tempImageId}`);
|
|
18946
18867
|
if (tempImage) {
|
|
18947
18868
|
const nodeHandler = this.instance.getNodeHandler("rectangle");
|
|
18948
|
-
this.instance.removeNode(nodeHandler.
|
|
18869
|
+
this.instance.removeNode(nodeHandler.serialize(tempImage));
|
|
18949
18870
|
}
|
|
18950
18871
|
const selectionPlugin = this.instance.getPlugin("nodesSelection");
|
|
18951
18872
|
if (selectionPlugin) {
|
|
@@ -19178,14 +19099,17 @@ var WeaveImageClip = class {
|
|
|
19178
19099
|
x: clipRectPos.x,
|
|
19179
19100
|
y: clipRectPos.y
|
|
19180
19101
|
});
|
|
19181
|
-
this.instance.updateNode(this.node.
|
|
19102
|
+
this.instance.updateNode(this.node.serialize(this.image));
|
|
19182
19103
|
}
|
|
19183
19104
|
}
|
|
19184
19105
|
};
|
|
19185
19106
|
|
|
19186
19107
|
//#endregion
|
|
19187
|
-
//#region src/nodes/image/
|
|
19108
|
+
//#region src/nodes/image/constants.ts
|
|
19188
19109
|
const WEAVE_IMAGE_NODE_TYPE = "image";
|
|
19110
|
+
|
|
19111
|
+
//#endregion
|
|
19112
|
+
//#region src/nodes/image/image.ts
|
|
19189
19113
|
var WeaveImageNode = class extends WeaveNode {
|
|
19190
19114
|
nodeType = WEAVE_IMAGE_NODE_TYPE;
|
|
19191
19115
|
constructor() {
|
|
@@ -19193,19 +19117,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
19193
19117
|
this.imageLoaded = false;
|
|
19194
19118
|
this.cropping = false;
|
|
19195
19119
|
}
|
|
19196
|
-
|
|
19197
|
-
return {
|
|
19198
|
-
key,
|
|
19199
|
-
type: this.nodeType,
|
|
19200
|
-
props: {
|
|
19201
|
-
...props,
|
|
19202
|
-
id: key,
|
|
19203
|
-
nodeType: this.nodeType,
|
|
19204
|
-
children: []
|
|
19205
|
-
}
|
|
19206
|
-
};
|
|
19207
|
-
}
|
|
19208
|
-
createInstance(props) {
|
|
19120
|
+
onRender(props) {
|
|
19209
19121
|
const imageProperties = props.imageProperties;
|
|
19210
19122
|
const imageProps = props;
|
|
19211
19123
|
const { id } = imageProps;
|
|
@@ -19289,12 +19201,12 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
19289
19201
|
width: preloadImg.width,
|
|
19290
19202
|
height: preloadImg.height
|
|
19291
19203
|
});
|
|
19292
|
-
this.instance.updateNode(this.
|
|
19204
|
+
this.instance.updateNode(this.serialize(image));
|
|
19293
19205
|
} else this.loadImage(imageProps, image);
|
|
19294
19206
|
image.setAttr("imageURL", imageProps.imageURL);
|
|
19295
19207
|
return image;
|
|
19296
19208
|
}
|
|
19297
|
-
|
|
19209
|
+
onUpdate(nodeInstance, nextProps) {
|
|
19298
19210
|
const id = nodeInstance.getAttrs().id;
|
|
19299
19211
|
const node = nodeInstance;
|
|
19300
19212
|
nodeInstance.setAttrs({ ...nextProps });
|
|
@@ -19353,24 +19265,6 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
19353
19265
|
zIndex: 0
|
|
19354
19266
|
});
|
|
19355
19267
|
}
|
|
19356
|
-
removeInstance(nodeInstance) {
|
|
19357
|
-
nodeInstance.destroy();
|
|
19358
|
-
}
|
|
19359
|
-
toNode(instance) {
|
|
19360
|
-
const attrs = instance.getAttrs();
|
|
19361
|
-
const cleanedAttrs = { ...attrs };
|
|
19362
|
-
delete cleanedAttrs.draggable;
|
|
19363
|
-
return {
|
|
19364
|
-
key: attrs.id ?? "",
|
|
19365
|
-
type: attrs.nodeType,
|
|
19366
|
-
props: {
|
|
19367
|
-
...cleanedAttrs,
|
|
19368
|
-
id: attrs.id ?? "",
|
|
19369
|
-
nodeType: attrs.nodeType,
|
|
19370
|
-
children: []
|
|
19371
|
-
}
|
|
19372
|
-
};
|
|
19373
|
-
}
|
|
19374
19268
|
loadImage(params, image) {
|
|
19375
19269
|
const imageProps = params;
|
|
19376
19270
|
const imageGroup = image.findOne(`#${imageProps.id}`);
|
|
@@ -19402,7 +19296,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
19402
19296
|
width: imageObj.width,
|
|
19403
19297
|
height: imageObj.height
|
|
19404
19298
|
});
|
|
19405
|
-
this.instance.updateNode(this.
|
|
19299
|
+
this.instance.updateNode(this.serialize(image));
|
|
19406
19300
|
};
|
|
19407
19301
|
if (imageProps.imageURL) imageObj.src = imageProps.imageURL;
|
|
19408
19302
|
}
|
|
@@ -19421,19 +19315,7 @@ const WEAVE_FRAME_NODE_TYPE = "frame";
|
|
|
19421
19315
|
//#region src/nodes/frame/frame.ts
|
|
19422
19316
|
var WeaveFrameNode = class extends WeaveNode {
|
|
19423
19317
|
nodeType = WEAVE_FRAME_NODE_TYPE;
|
|
19424
|
-
|
|
19425
|
-
return {
|
|
19426
|
-
key,
|
|
19427
|
-
type: this.nodeType,
|
|
19428
|
-
props: {
|
|
19429
|
-
...props,
|
|
19430
|
-
id: key,
|
|
19431
|
-
nodeType: this.nodeType,
|
|
19432
|
-
children: []
|
|
19433
|
-
}
|
|
19434
|
-
};
|
|
19435
|
-
}
|
|
19436
|
-
createInstance(props) {
|
|
19318
|
+
onRender(props) {
|
|
19437
19319
|
const { id } = props;
|
|
19438
19320
|
const frameParams = { ...props };
|
|
19439
19321
|
delete frameParams.fontFamily;
|
|
@@ -19502,7 +19384,7 @@ var WeaveFrameNode = class extends WeaveNode {
|
|
|
19502
19384
|
this.setupDefaultNodeEvents(frame);
|
|
19503
19385
|
return frame;
|
|
19504
19386
|
}
|
|
19505
|
-
|
|
19387
|
+
onUpdate(nodeInstance, nextProps) {
|
|
19506
19388
|
const { id } = nextProps;
|
|
19507
19389
|
const frameNode = nodeInstance;
|
|
19508
19390
|
const newProps = { ...nextProps };
|
|
@@ -19511,10 +19393,7 @@ var WeaveFrameNode = class extends WeaveNode {
|
|
|
19511
19393
|
const frameTitle = frameNode.findOne(`#${id}-title`);
|
|
19512
19394
|
if (frameTitle) frameTitle.setAttrs({ text: nextProps.title });
|
|
19513
19395
|
}
|
|
19514
|
-
|
|
19515
|
-
nodeInstance.destroy();
|
|
19516
|
-
}
|
|
19517
|
-
toNode(instance) {
|
|
19396
|
+
serialize(instance) {
|
|
19518
19397
|
const attrs = instance.getAttrs();
|
|
19519
19398
|
const frameInternal = instance.findOne(`#${attrs.containerId}`);
|
|
19520
19399
|
const childrenMapped = [];
|
|
@@ -19522,7 +19401,7 @@ var WeaveFrameNode = class extends WeaveNode {
|
|
|
19522
19401
|
const children = [...frameInternal.getChildren()];
|
|
19523
19402
|
for (const node of children) {
|
|
19524
19403
|
const handler = this.instance.getNodeHandler(node.getAttr("nodeType"));
|
|
19525
|
-
childrenMapped.push(handler.
|
|
19404
|
+
childrenMapped.push(handler.serialize(node));
|
|
19526
19405
|
}
|
|
19527
19406
|
}
|
|
19528
19407
|
const cleanedAttrs = { ...attrs };
|
|
@@ -19540,6 +19419,10 @@ var WeaveFrameNode = class extends WeaveNode {
|
|
|
19540
19419
|
}
|
|
19541
19420
|
};
|
|
19542
19421
|
|
|
19422
|
+
//#endregion
|
|
19423
|
+
//#region src/plugins/stage-zoom/constants.ts
|
|
19424
|
+
const WEAVE_STAGE_ZOOM_KEY = "stageZoom";
|
|
19425
|
+
|
|
19543
19426
|
//#endregion
|
|
19544
19427
|
//#region src/plugins/stage-zoom/stage-zoom.ts
|
|
19545
19428
|
var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
@@ -19565,9 +19448,9 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
19565
19448
|
this.onZoomChangeCb = onZoomChange;
|
|
19566
19449
|
}
|
|
19567
19450
|
getName() {
|
|
19568
|
-
return
|
|
19451
|
+
return WEAVE_STAGE_ZOOM_KEY;
|
|
19569
19452
|
}
|
|
19570
|
-
|
|
19453
|
+
onInit() {
|
|
19571
19454
|
this.setZoom(this.zoomSteps[this.actualStep]);
|
|
19572
19455
|
}
|
|
19573
19456
|
setZoom(scale, centered = true) {
|
|
@@ -19598,7 +19481,7 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
19598
19481
|
const plugins = this.instance.getPlugins();
|
|
19599
19482
|
for (const pluginId of Object.keys(plugins)) {
|
|
19600
19483
|
const pluginInstance = plugins[pluginId];
|
|
19601
|
-
pluginInstance.
|
|
19484
|
+
pluginInstance.onRender?.();
|
|
19602
19485
|
}
|
|
19603
19486
|
const callbackParams = {
|
|
19604
19487
|
scale,
|
|
@@ -19729,7 +19612,7 @@ var WeaveZoomOutToolAction = class extends WeaveAction {
|
|
|
19729
19612
|
getStageZoomPlugin() {
|
|
19730
19613
|
return this.instance.getPlugin("stageZoom");
|
|
19731
19614
|
}
|
|
19732
|
-
|
|
19615
|
+
onInit() {
|
|
19733
19616
|
const stageZoomPlugin = this.getStageZoomPlugin();
|
|
19734
19617
|
if (!stageZoomPlugin) throw new Error("WeaveZoomOutToolAction requires the WeaveStageZoomPlugin to be loaded");
|
|
19735
19618
|
}
|
|
@@ -19758,7 +19641,7 @@ var WeaveZoomInToolAction = class extends WeaveAction {
|
|
|
19758
19641
|
getStageZoomPlugin() {
|
|
19759
19642
|
return this.instance.getPlugin("stageZoom");
|
|
19760
19643
|
}
|
|
19761
|
-
|
|
19644
|
+
onInit() {
|
|
19762
19645
|
const stageZoomPlugin = this.getStageZoomPlugin();
|
|
19763
19646
|
if (!stageZoomPlugin) throw new Error("WeaveZoomInToolAction requires the WeaveStageZoomPlugin to be loaded");
|
|
19764
19647
|
}
|
|
@@ -19787,7 +19670,7 @@ var WeaveFitToScreenToolAction = class extends WeaveAction {
|
|
|
19787
19670
|
getStageZoomPlugin() {
|
|
19788
19671
|
return this.instance.getPlugin("stageZoom");
|
|
19789
19672
|
}
|
|
19790
|
-
|
|
19673
|
+
onInit() {
|
|
19791
19674
|
const stageZoomPlugin = this.getStageZoomPlugin();
|
|
19792
19675
|
if (!stageZoomPlugin) throw new Error("WeaveFitToScreenToolAction requires the WeaveStageZoomPlugin to be loaded");
|
|
19793
19676
|
}
|
|
@@ -19818,7 +19701,7 @@ var WeaveFitToSelectionToolAction = class extends WeaveAction {
|
|
|
19818
19701
|
getStageZoomPlugin() {
|
|
19819
19702
|
return this.instance.getPlugin("stageZoom");
|
|
19820
19703
|
}
|
|
19821
|
-
|
|
19704
|
+
onInit() {
|
|
19822
19705
|
const stageZoomPlugin = this.getStageZoomPlugin();
|
|
19823
19706
|
if (!stageZoomPlugin) throw new Error("WeaveFitToSelectionTool requires the WeaveStageZoomPlugin to be loaded");
|
|
19824
19707
|
const nodesSelectionPlugin = this.getNodesSelectionPlugin();
|
|
@@ -19851,7 +19734,7 @@ const MOVE_TOOL_STATE = {
|
|
|
19851
19734
|
var WeaveMoveToolAction = class extends WeaveAction {
|
|
19852
19735
|
initialized = false;
|
|
19853
19736
|
internalUpdate = void 0;
|
|
19854
|
-
|
|
19737
|
+
onInit = void 0;
|
|
19855
19738
|
constructor() {
|
|
19856
19739
|
super();
|
|
19857
19740
|
this.initialized = false;
|
|
@@ -19907,7 +19790,7 @@ const SELECTION_TOOL_STATE = {
|
|
|
19907
19790
|
var WeaveSelectionToolAction = class extends WeaveAction {
|
|
19908
19791
|
initialized = false;
|
|
19909
19792
|
internalUpdate = void 0;
|
|
19910
|
-
|
|
19793
|
+
onInit = void 0;
|
|
19911
19794
|
constructor() {
|
|
19912
19795
|
super();
|
|
19913
19796
|
this.initialized = false;
|
|
@@ -19971,7 +19854,7 @@ const RECTANGLE_TOOL_STATE = {
|
|
|
19971
19854
|
var WeaveRectangleToolAction = class extends WeaveAction {
|
|
19972
19855
|
initialized = false;
|
|
19973
19856
|
internalUpdate = void 0;
|
|
19974
|
-
|
|
19857
|
+
onInit = void 0;
|
|
19975
19858
|
constructor(callbacks) {
|
|
19976
19859
|
super(callbacks);
|
|
19977
19860
|
this.initialized = false;
|
|
@@ -20047,7 +19930,7 @@ var WeaveRectangleToolAction = class extends WeaveAction {
|
|
|
20047
19930
|
this.container = container;
|
|
20048
19931
|
this.rectId = v4_default();
|
|
20049
19932
|
const nodeHandler = this.instance.getNodeHandler("rectangle");
|
|
20050
|
-
const node = nodeHandler.
|
|
19933
|
+
const node = nodeHandler.create(this.rectId, {
|
|
20051
19934
|
...this.props,
|
|
20052
19935
|
x: this.clickPoint?.x ?? 0,
|
|
20053
19936
|
y: this.clickPoint?.y ?? 0,
|
|
@@ -20071,7 +19954,7 @@ var WeaveRectangleToolAction = class extends WeaveAction {
|
|
|
20071
19954
|
width: this.moved ? Math.abs(deltaX) : this.props.width,
|
|
20072
19955
|
height: this.moved ? Math.abs(deltaY) : this.props.height
|
|
20073
19956
|
});
|
|
20074
|
-
this.instance.updateNode(nodeHandler.
|
|
19957
|
+
this.instance.updateNode(nodeHandler.serialize(rectangle));
|
|
20075
19958
|
}
|
|
20076
19959
|
this.cancelAction();
|
|
20077
19960
|
}
|
|
@@ -20087,7 +19970,7 @@ var WeaveRectangleToolAction = class extends WeaveAction {
|
|
|
20087
19970
|
width: deltaX,
|
|
20088
19971
|
height: deltaY
|
|
20089
19972
|
});
|
|
20090
|
-
this.instance.updateNode(nodeHandler.
|
|
19973
|
+
this.instance.updateNode(nodeHandler.serialize(rectangle));
|
|
20091
19974
|
}
|
|
20092
19975
|
}
|
|
20093
19976
|
trigger(cancelAction) {
|
|
@@ -20133,7 +20016,7 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
20133
20016
|
initialized = false;
|
|
20134
20017
|
initialCursor = null;
|
|
20135
20018
|
internalUpdate = void 0;
|
|
20136
|
-
|
|
20019
|
+
onInit = void 0;
|
|
20137
20020
|
constructor(callbacks) {
|
|
20138
20021
|
super(callbacks);
|
|
20139
20022
|
this.initialized = false;
|
|
@@ -20211,7 +20094,7 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
20211
20094
|
this.lineId = v4_default();
|
|
20212
20095
|
this.tempLineId = v4_default();
|
|
20213
20096
|
const nodeHandler = this.instance.getNodeHandler("line");
|
|
20214
|
-
const node = nodeHandler.
|
|
20097
|
+
const node = nodeHandler.create(this.lineId, {
|
|
20215
20098
|
...this.props,
|
|
20216
20099
|
x: this.clickPoint?.x ?? 0,
|
|
20217
20100
|
y: this.clickPoint?.y ?? 0,
|
|
@@ -20227,7 +20110,7 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
20227
20110
|
fill: "#cccccc"
|
|
20228
20111
|
});
|
|
20229
20112
|
this.measureContainer?.add(this.tempPoint);
|
|
20230
|
-
const tempLine = nodeHandler.
|
|
20113
|
+
const tempLine = nodeHandler.create(this.tempLineId, {
|
|
20231
20114
|
...this.props,
|
|
20232
20115
|
x: this.clickPoint?.x ?? 0,
|
|
20233
20116
|
y: this.clickPoint?.y ?? 0,
|
|
@@ -20258,7 +20141,7 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
20258
20141
|
points: newPoints
|
|
20259
20142
|
});
|
|
20260
20143
|
const nodeHandler = this.instance.getNodeHandler("line");
|
|
20261
|
-
this.instance.updateNode(nodeHandler.
|
|
20144
|
+
this.instance.updateNode(nodeHandler.serialize(tempMainLine));
|
|
20262
20145
|
this.tempPoint.setAttrs({
|
|
20263
20146
|
x: mousePoint.x,
|
|
20264
20147
|
y: mousePoint.y
|
|
@@ -20273,7 +20156,7 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
20273
20156
|
y: mousePoint.y,
|
|
20274
20157
|
points: [0, 0]
|
|
20275
20158
|
});
|
|
20276
|
-
this.instance.updateNode(nodeHandler.
|
|
20159
|
+
this.instance.updateNode(nodeHandler.serialize(tempLine));
|
|
20277
20160
|
}
|
|
20278
20161
|
this.setState(PEN_TOOL_STATE.DEFINING_SIZE);
|
|
20279
20162
|
}
|
|
@@ -20292,7 +20175,7 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
20292
20175
|
]
|
|
20293
20176
|
});
|
|
20294
20177
|
const nodeHandler = this.instance.getNodeHandler("line");
|
|
20295
|
-
this.instance.updateNode(nodeHandler.
|
|
20178
|
+
this.instance.updateNode(nodeHandler.serialize(tempLine));
|
|
20296
20179
|
this.tempNextPoint.setAttrs({
|
|
20297
20180
|
x: mousePoint.x,
|
|
20298
20181
|
y: mousePoint.y
|
|
@@ -20317,11 +20200,11 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
20317
20200
|
const tempMainLine = this.instance.getStage().findOne(`#${this.lineId}`);
|
|
20318
20201
|
if (tempLine) {
|
|
20319
20202
|
const nodeHandler = this.instance.getNodeHandler("line");
|
|
20320
|
-
this.instance.removeNode(nodeHandler.
|
|
20203
|
+
this.instance.removeNode(nodeHandler.serialize(tempLine));
|
|
20321
20204
|
}
|
|
20322
20205
|
if (this.lineId && tempMainLine && tempMainLine.points().length < 4) {
|
|
20323
20206
|
const nodeHandler = this.instance.getNodeHandler("line");
|
|
20324
|
-
this.instance.removeNode(nodeHandler.
|
|
20207
|
+
this.instance.removeNode(nodeHandler.serialize(tempMainLine));
|
|
20325
20208
|
}
|
|
20326
20209
|
if (this.lineId && tempMainLine && tempMainLine.points().length >= 4) {
|
|
20327
20210
|
const nodeHandler = this.instance.getNodeHandler("line");
|
|
@@ -20330,7 +20213,7 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
20330
20213
|
strokeWidth: 1,
|
|
20331
20214
|
hitStrokeWidth: 16
|
|
20332
20215
|
});
|
|
20333
|
-
this.instance.updateNode(nodeHandler.
|
|
20216
|
+
this.instance.updateNode(nodeHandler.serialize(tempMainLine));
|
|
20334
20217
|
}
|
|
20335
20218
|
const selectionPlugin = this.instance.getPlugin("nodesSelection");
|
|
20336
20219
|
if (selectionPlugin) {
|
|
@@ -20363,7 +20246,7 @@ const BRUSH_TOOL_STATE = {
|
|
|
20363
20246
|
var WeaveBrushToolAction = class extends WeaveAction {
|
|
20364
20247
|
initialized = false;
|
|
20365
20248
|
internalUpdate = void 0;
|
|
20366
|
-
|
|
20249
|
+
onInit = void 0;
|
|
20367
20250
|
constructor(callbacks) {
|
|
20368
20251
|
super(callbacks);
|
|
20369
20252
|
this.initialized = false;
|
|
@@ -20428,7 +20311,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
20428
20311
|
this.measureContainer = measureContainer;
|
|
20429
20312
|
this.strokeId = v4_default();
|
|
20430
20313
|
const nodeHandler = this.instance.getNodeHandler("line");
|
|
20431
|
-
const node = nodeHandler.
|
|
20314
|
+
const node = nodeHandler.create(this.strokeId, {
|
|
20432
20315
|
...this.props,
|
|
20433
20316
|
x: this.clickPoint?.x ?? 0,
|
|
20434
20317
|
y: this.clickPoint?.y ?? 0,
|
|
@@ -20446,7 +20329,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
20446
20329
|
...this.props,
|
|
20447
20330
|
hitStrokeWidth: 10
|
|
20448
20331
|
});
|
|
20449
|
-
this.instance.updateNode(nodeHandler.
|
|
20332
|
+
this.instance.updateNode(nodeHandler.serialize(tempStroke));
|
|
20450
20333
|
this.clickPoint = null;
|
|
20451
20334
|
stage.container().tabIndex = 1;
|
|
20452
20335
|
stage.container().focus();
|
|
@@ -20464,7 +20347,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
20464
20347
|
mousePoint.y - tempStroke.y()
|
|
20465
20348
|
]);
|
|
20466
20349
|
const nodeHandler = this.instance.getNodeHandler("line");
|
|
20467
|
-
this.instance.updateNode(nodeHandler.
|
|
20350
|
+
this.instance.updateNode(nodeHandler.serialize(tempStroke));
|
|
20468
20351
|
}
|
|
20469
20352
|
}
|
|
20470
20353
|
trigger(cancel) {
|
|
@@ -20511,7 +20394,7 @@ var WeaveTextToolAction = class extends WeaveAction {
|
|
|
20511
20394
|
initialized = false;
|
|
20512
20395
|
initialCursor = null;
|
|
20513
20396
|
internalUpdate = void 0;
|
|
20514
|
-
|
|
20397
|
+
onInit = void 0;
|
|
20515
20398
|
constructor() {
|
|
20516
20399
|
super();
|
|
20517
20400
|
this.initialized = false;
|
|
@@ -20564,7 +20447,7 @@ var WeaveTextToolAction = class extends WeaveAction {
|
|
|
20564
20447
|
this.container = container;
|
|
20565
20448
|
this.textId = v4_default();
|
|
20566
20449
|
const nodeHandler = this.instance.getNodeHandler("text");
|
|
20567
|
-
const node = nodeHandler.
|
|
20450
|
+
const node = nodeHandler.create(this.textId, {
|
|
20568
20451
|
x: this.clickPoint?.x ?? 0,
|
|
20569
20452
|
y: this.clickPoint?.y ?? 0,
|
|
20570
20453
|
text: "Your text here...",
|
|
@@ -20617,7 +20500,7 @@ const FRAME_TOOL_STATE = {
|
|
|
20617
20500
|
var WeaveFrameToolAction = class extends WeaveAction {
|
|
20618
20501
|
initialized = false;
|
|
20619
20502
|
internalUpdate = void 0;
|
|
20620
|
-
|
|
20503
|
+
onInit = void 0;
|
|
20621
20504
|
constructor(callbacks) {
|
|
20622
20505
|
super(callbacks);
|
|
20623
20506
|
this.initialized = false;
|
|
@@ -20676,7 +20559,7 @@ var WeaveFrameToolAction = class extends WeaveAction {
|
|
|
20676
20559
|
this.container = container;
|
|
20677
20560
|
this.frameId = v4_default();
|
|
20678
20561
|
const nodeHandler = this.instance.getNodeHandler("frame");
|
|
20679
|
-
const node = nodeHandler.
|
|
20562
|
+
const node = nodeHandler.create(this.frameId, {
|
|
20680
20563
|
...this.props,
|
|
20681
20564
|
x: this.clickPoint.x,
|
|
20682
20565
|
y: this.clickPoint.y
|
|
@@ -20721,7 +20604,7 @@ var WeaveExportStageToolAction = class extends WeaveAction {
|
|
|
20721
20604
|
quality: 1
|
|
20722
20605
|
};
|
|
20723
20606
|
internalUpdate = void 0;
|
|
20724
|
-
|
|
20607
|
+
onInit = void 0;
|
|
20725
20608
|
getName() {
|
|
20726
20609
|
return "exportStageTool";
|
|
20727
20610
|
}
|
|
@@ -20765,7 +20648,7 @@ var WeaveExportNodeToolAction = class extends WeaveAction {
|
|
|
20765
20648
|
quality: 1
|
|
20766
20649
|
};
|
|
20767
20650
|
internalUpdate = void 0;
|
|
20768
|
-
|
|
20651
|
+
onInit = void 0;
|
|
20769
20652
|
getName() {
|
|
20770
20653
|
return "exportNodeTool";
|
|
20771
20654
|
}
|
|
@@ -20800,6 +20683,7 @@ var WeaveExportNodeToolAction = class extends WeaveAction {
|
|
|
20800
20683
|
|
|
20801
20684
|
//#endregion
|
|
20802
20685
|
//#region src/plugins/stage-grid/constants.ts
|
|
20686
|
+
const WEAVE_STAGE_GRID_KEY = "stageGrid";
|
|
20803
20687
|
const WEAVE_GRID_DEFAULT_SIZE = 50;
|
|
20804
20688
|
const WEAVE_GRID_LAYER_ID = "gridLayer";
|
|
20805
20689
|
const WEAVE_GRID_TYPES = {
|
|
@@ -20822,7 +20706,7 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
20822
20706
|
this.gridSize = gridSize;
|
|
20823
20707
|
}
|
|
20824
20708
|
getName() {
|
|
20825
|
-
return
|
|
20709
|
+
return WEAVE_STAGE_GRID_KEY;
|
|
20826
20710
|
}
|
|
20827
20711
|
getLayerName() {
|
|
20828
20712
|
return WEAVE_GRID_LAYER_ID;
|
|
@@ -20835,7 +20719,7 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
20835
20719
|
});
|
|
20836
20720
|
stage.add(layer);
|
|
20837
20721
|
}
|
|
20838
|
-
|
|
20722
|
+
onInit() {
|
|
20839
20723
|
this.initEvents();
|
|
20840
20724
|
this.renderGrid();
|
|
20841
20725
|
}
|
|
@@ -20872,17 +20756,17 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
20872
20756
|
stage.on("mousemove", (e) => {
|
|
20873
20757
|
e.evt.preventDefault();
|
|
20874
20758
|
if (!this.enabled || !(this.isSpaceKeyPressed || this.isMouseMiddleButtonPressed || this.moveToolActive)) return;
|
|
20875
|
-
this.
|
|
20759
|
+
this.onRender();
|
|
20876
20760
|
});
|
|
20877
20761
|
stage.on("touchmove", (e) => {
|
|
20878
20762
|
e.evt.preventDefault();
|
|
20879
20763
|
if (!this.enabled) return;
|
|
20880
|
-
this.
|
|
20764
|
+
this.onRender();
|
|
20881
20765
|
});
|
|
20882
20766
|
stage.on("wheel", (e) => {
|
|
20883
20767
|
e.evt.preventDefault();
|
|
20884
20768
|
if (!this.enabled || this.isSpaceKeyPressed || this.isMouseMiddleButtonPressed) return;
|
|
20885
|
-
this.
|
|
20769
|
+
this.onRender();
|
|
20886
20770
|
});
|
|
20887
20771
|
}
|
|
20888
20772
|
getLayer() {
|
|
@@ -20981,28 +20865,32 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
20981
20865
|
}
|
|
20982
20866
|
}
|
|
20983
20867
|
}
|
|
20984
|
-
|
|
20868
|
+
onRender() {
|
|
20985
20869
|
this.renderGrid();
|
|
20986
20870
|
}
|
|
20987
20871
|
enable() {
|
|
20988
20872
|
this.enabled = true;
|
|
20989
20873
|
this.getLayer()?.show();
|
|
20990
|
-
this.
|
|
20874
|
+
this.onRender();
|
|
20991
20875
|
}
|
|
20992
20876
|
disable() {
|
|
20993
20877
|
this.enabled = false;
|
|
20994
20878
|
this.getLayer()?.hide();
|
|
20995
|
-
this.
|
|
20879
|
+
this.onRender();
|
|
20996
20880
|
}
|
|
20997
20881
|
getType() {
|
|
20998
20882
|
return this.type;
|
|
20999
20883
|
}
|
|
21000
20884
|
setType(type) {
|
|
21001
20885
|
this.type = type;
|
|
21002
|
-
this.
|
|
20886
|
+
this.onRender();
|
|
21003
20887
|
}
|
|
21004
20888
|
};
|
|
21005
20889
|
|
|
20890
|
+
//#endregion
|
|
20891
|
+
//#region src/plugins/stage-panning/constants.ts
|
|
20892
|
+
const WEAVE_STAGE_PANNING_KEY = "stagePanning";
|
|
20893
|
+
|
|
21006
20894
|
//#endregion
|
|
21007
20895
|
//#region src/plugins/stage-panning/stage-panning.ts
|
|
21008
20896
|
var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
@@ -21017,9 +20905,9 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
21017
20905
|
this.previousPointer = null;
|
|
21018
20906
|
}
|
|
21019
20907
|
getName() {
|
|
21020
|
-
return
|
|
20908
|
+
return WEAVE_STAGE_PANNING_KEY;
|
|
21021
20909
|
}
|
|
21022
|
-
|
|
20910
|
+
onInit() {
|
|
21023
20911
|
this.initEvents();
|
|
21024
20912
|
}
|
|
21025
20913
|
enableMove() {
|
|
@@ -21133,15 +21021,19 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
21133
21021
|
}
|
|
21134
21022
|
};
|
|
21135
21023
|
|
|
21024
|
+
//#endregion
|
|
21025
|
+
//#region src/plugins/stage-resize/constants.ts
|
|
21026
|
+
const WEAVE_STAGE_RESIZE_KEY = "stageResize";
|
|
21027
|
+
|
|
21136
21028
|
//#endregion
|
|
21137
21029
|
//#region src/plugins/stage-resize/stage-resize.ts
|
|
21138
21030
|
var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
21139
21031
|
getLayerName = void 0;
|
|
21140
21032
|
initLayer = void 0;
|
|
21141
21033
|
getName() {
|
|
21142
|
-
return
|
|
21034
|
+
return WEAVE_STAGE_RESIZE_KEY;
|
|
21143
21035
|
}
|
|
21144
|
-
|
|
21036
|
+
onInit() {
|
|
21145
21037
|
const stage = this.instance.getStage();
|
|
21146
21038
|
window.addEventListener("resize", () => {
|
|
21147
21039
|
const containerParent = stage.container().parentNode;
|
|
@@ -21155,7 +21047,7 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
|
21155
21047
|
const plugins = this.instance.getPlugins();
|
|
21156
21048
|
for (const pluginId of Object.keys(plugins)) {
|
|
21157
21049
|
const pluginInstance = plugins[pluginId];
|
|
21158
|
-
pluginInstance.
|
|
21050
|
+
pluginInstance.onRender?.();
|
|
21159
21051
|
}
|
|
21160
21052
|
}
|
|
21161
21053
|
});
|
|
@@ -21190,7 +21082,7 @@ var WeaveConnectedUsersPlugin = class extends WeavePlugin {
|
|
|
21190
21082
|
getName() {
|
|
21191
21083
|
return "connectedUsers";
|
|
21192
21084
|
}
|
|
21193
|
-
|
|
21085
|
+
onInit() {
|
|
21194
21086
|
const store = this.instance.getStore();
|
|
21195
21087
|
const userInfo = this.getUser();
|
|
21196
21088
|
store.setAwarenessInfo(WEAVE_CONNECTED_USER_INFO_KEY, userInfo);
|
|
@@ -21223,6 +21115,7 @@ var WeaveConnectedUsersPlugin = class extends WeavePlugin {
|
|
|
21223
21115
|
|
|
21224
21116
|
//#endregion
|
|
21225
21117
|
//#region src/plugins/users-pointers/constants.ts
|
|
21118
|
+
const WEAVE_USERS_POINTERS_KEY = "usersPointers";
|
|
21226
21119
|
const WEAVE_USERS_POINTERS_LAYER_ID = "usersPointersLayer";
|
|
21227
21120
|
const WEAVE_USER_POINTER_KEY = "userPointer";
|
|
21228
21121
|
|
|
@@ -21248,7 +21141,7 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
21248
21141
|
}));
|
|
21249
21142
|
}
|
|
21250
21143
|
getName() {
|
|
21251
|
-
return
|
|
21144
|
+
return WEAVE_USERS_POINTERS_KEY;
|
|
21252
21145
|
}
|
|
21253
21146
|
getLayerName() {
|
|
21254
21147
|
return WEAVE_USERS_POINTERS_LAYER_ID;
|
|
@@ -21262,7 +21155,7 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
21262
21155
|
const stage = this.instance.getStage();
|
|
21263
21156
|
return stage.findOne(`#${WEAVE_USERS_POINTERS_LAYER_ID}`);
|
|
21264
21157
|
}
|
|
21265
|
-
|
|
21158
|
+
onInit() {
|
|
21266
21159
|
const store = this.instance.getStore();
|
|
21267
21160
|
const stage = this.instance.getStage();
|
|
21268
21161
|
store.onAwarenessChange((changes) => {
|
|
@@ -21446,6 +21339,10 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
21446
21339
|
}
|
|
21447
21340
|
};
|
|
21448
21341
|
|
|
21342
|
+
//#endregion
|
|
21343
|
+
//#region src/plugins/stage-drop-area/constants.ts
|
|
21344
|
+
const WEAVE_STAGE_DROP_AREA_KEY = "stageDropArea";
|
|
21345
|
+
|
|
21449
21346
|
//#endregion
|
|
21450
21347
|
//#region src/plugins/stage-drop-area/stage-drop-area.ts
|
|
21451
21348
|
var WeaveStageDropAreaPlugin = class extends WeavePlugin {
|
|
@@ -21457,9 +21354,9 @@ var WeaveStageDropAreaPlugin = class extends WeavePlugin {
|
|
|
21457
21354
|
this.enabled = true;
|
|
21458
21355
|
}
|
|
21459
21356
|
getName() {
|
|
21460
|
-
return
|
|
21357
|
+
return WEAVE_STAGE_DROP_AREA_KEY;
|
|
21461
21358
|
}
|
|
21462
|
-
|
|
21359
|
+
onInit() {
|
|
21463
21360
|
this.initEvents();
|
|
21464
21361
|
}
|
|
21465
21362
|
initEvents() {
|
|
@@ -21485,6 +21382,7 @@ var WeaveStageDropAreaPlugin = class extends WeavePlugin {
|
|
|
21485
21382
|
|
|
21486
21383
|
//#endregion
|
|
21487
21384
|
//#region src/plugins/nodes-snapping/constants.ts
|
|
21385
|
+
const WEAVE_NODES_SNAPPING_KEY = "nodesSnapping";
|
|
21488
21386
|
const GUIDE_LINE_NAME = "guide-line";
|
|
21489
21387
|
const GUIDE_ORIENTATION = {
|
|
21490
21388
|
["HORIZONTAL"]: "H",
|
|
@@ -21505,9 +21403,9 @@ var WeaveNodesSnappingPlugin = class extends WeavePlugin {
|
|
|
21505
21403
|
this.enabled = true;
|
|
21506
21404
|
}
|
|
21507
21405
|
getName() {
|
|
21508
|
-
return
|
|
21406
|
+
return WEAVE_NODES_SNAPPING_KEY;
|
|
21509
21407
|
}
|
|
21510
|
-
|
|
21408
|
+
onInit() {
|
|
21511
21409
|
this.initEvents();
|
|
21512
21410
|
}
|
|
21513
21411
|
setEnabled(enabled) {
|
|
@@ -21733,11 +21631,15 @@ exports.RECTANGLE_TOOL_STATE = RECTANGLE_TOOL_STATE
|
|
|
21733
21631
|
exports.SELECTION_TOOL_ACTION_NAME = SELECTION_TOOL_ACTION_NAME
|
|
21734
21632
|
exports.SELECTION_TOOL_STATE = SELECTION_TOOL_STATE
|
|
21735
21633
|
exports.TEXT_TOOL_STATE = TEXT_TOOL_STATE
|
|
21634
|
+
exports.WEAVE_COPY_PASTE_NODES_KEY = WEAVE_COPY_PASTE_NODES_KEY
|
|
21736
21635
|
exports.WEAVE_FRAME_NODE_TYPE = WEAVE_FRAME_NODE_TYPE
|
|
21737
21636
|
exports.WEAVE_GRID_DEFAULT_SIZE = WEAVE_GRID_DEFAULT_SIZE
|
|
21738
21637
|
exports.WEAVE_GRID_LAYER_ID = WEAVE_GRID_LAYER_ID
|
|
21739
21638
|
exports.WEAVE_GRID_TYPES = WEAVE_GRID_TYPES
|
|
21639
|
+
exports.WEAVE_NODES_SELECTION_KEY = WEAVE_NODES_SELECTION_KEY
|
|
21740
21640
|
exports.WEAVE_NODES_SELECTION_LAYER_ID = WEAVE_NODES_SELECTION_LAYER_ID
|
|
21641
|
+
exports.WEAVE_NODES_SNAPPING_KEY = WEAVE_NODES_SNAPPING_KEY
|
|
21642
|
+
exports.WEAVE_STAGE_GRID_KEY = WEAVE_STAGE_GRID_KEY
|
|
21741
21643
|
exports.Weave = Weave
|
|
21742
21644
|
exports.WeaveAction = WeaveAction
|
|
21743
21645
|
exports.WeaveBrushToolAction = WeaveBrushToolAction
|