@inditextech/weave-sdk 0.56.0 → 0.56.2
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 +15 -8
- package/dist/sdk.d.cts.map +1 -1
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +28 -20
- package/dist/sdk.js.map +1 -1
- package/package.json +2 -2
package/dist/sdk.js
CHANGED
|
@@ -15494,6 +15494,7 @@ var require_lodash = __commonJS({ "../../node_modules/lodash/lodash.js"(exports,
|
|
|
15494
15494
|
} else root$8._ = _;
|
|
15495
15495
|
}).call(exports);
|
|
15496
15496
|
} });
|
|
15497
|
+
var import_lodash$1 = __toESM(require_lodash());
|
|
15497
15498
|
var import_lodash = __toESM(require_lodash(), 1);
|
|
15498
15499
|
|
|
15499
15500
|
//#endregion
|
|
@@ -15588,12 +15589,12 @@ var WeaveStore = class {
|
|
|
15588
15589
|
node: JSON.parse(JSON.stringify(nodeInfo.node))
|
|
15589
15590
|
});
|
|
15590
15591
|
}
|
|
15591
|
-
if (!this.isRoomLoaded && !(0, import_lodash.isEmpty)(this.state.weave)) {
|
|
15592
|
+
if (!this.isRoomLoaded && !(0, import_lodash$1.isEmpty)(this.state.weave)) {
|
|
15592
15593
|
this.instance.setupRenderer();
|
|
15593
15594
|
this.isRoomLoaded = true;
|
|
15594
15595
|
this.instance.emitEvent("onRoomLoaded", this.isRoomLoaded);
|
|
15595
15596
|
}
|
|
15596
|
-
if (this.isRoomLoaded && !(0, import_lodash.isEmpty)(this.state.weave)) this.instance.render();
|
|
15597
|
+
if (this.isRoomLoaded && !(0, import_lodash$1.isEmpty)(this.state.weave)) this.instance.render();
|
|
15597
15598
|
});
|
|
15598
15599
|
}
|
|
15599
15600
|
canUndoStateStep() {
|
|
@@ -17918,7 +17919,7 @@ var require_merge = __commonJS({ "../../node_modules/lodash/merge.js"(exports, m
|
|
|
17918
17919
|
});
|
|
17919
17920
|
module.exports = merge;
|
|
17920
17921
|
} });
|
|
17921
|
-
var import_merge = __toESM(require_merge()
|
|
17922
|
+
var import_merge = __toESM(require_merge());
|
|
17922
17923
|
|
|
17923
17924
|
//#endregion
|
|
17924
17925
|
//#region src/plugins/plugin.ts
|
|
@@ -18791,7 +18792,7 @@ var require_throttle = __commonJS({ "../../node_modules/lodash/throttle.js"(expo
|
|
|
18791
18792
|
}
|
|
18792
18793
|
module.exports = throttle;
|
|
18793
18794
|
} });
|
|
18794
|
-
var import_throttle = __toESM(require_throttle()
|
|
18795
|
+
var import_throttle = __toESM(require_throttle());
|
|
18795
18796
|
|
|
18796
18797
|
//#endregion
|
|
18797
18798
|
//#region src/nodes/stage/constants.ts
|
|
@@ -19735,7 +19736,6 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
|
|
|
19735
19736
|
});
|
|
19736
19737
|
if (catcher) {
|
|
19737
19738
|
document.addEventListener("paste", async (e) => {
|
|
19738
|
-
e.preventDefault();
|
|
19739
19739
|
const dataList = e.clipboardData?.items;
|
|
19740
19740
|
if (!dataList) return;
|
|
19741
19741
|
if (dataList?.length > 0) this.sendExternalPasteEvent(dataList);
|
|
@@ -20163,7 +20163,7 @@ var WeaveNode = class {
|
|
|
20163
20163
|
if (nodesSelectionPlugin && this.isSelecting() && this.isNodeSelected(node$1)) nodesSelectionPlugin.getTransformer().forceUpdate();
|
|
20164
20164
|
if (nodesEdgeSnappingPlugin && transforming && this.isSelecting() && this.isNodeSelected(node$1)) nodesEdgeSnappingPlugin.evaluateGuidelines(e);
|
|
20165
20165
|
};
|
|
20166
|
-
node.on("transform", (0, import_lodash.throttle)(handleTransform, 100));
|
|
20166
|
+
node.on("transform", (0, import_lodash$1.throttle)(handleTransform, 100));
|
|
20167
20167
|
node.on("transformend", (e) => {
|
|
20168
20168
|
const node$1 = e.target;
|
|
20169
20169
|
this.instance.emitEvent("onTransform", null);
|
|
@@ -20217,7 +20217,7 @@ var WeaveNode = class {
|
|
|
20217
20217
|
if (layerToMove && !hasFrames(node) && node.isDragging()) layerToMove.fire(WEAVE_NODE_CUSTOM_EVENTS.onTargetEnter, { bubbles: true });
|
|
20218
20218
|
}
|
|
20219
20219
|
};
|
|
20220
|
-
node.on("dragmove", (0, import_lodash.throttle)(handleDragMove, 100));
|
|
20220
|
+
node.on("dragmove", (0, import_lodash$1.throttle)(handleDragMove, 100));
|
|
20221
20221
|
node.on("dragend", (e) => {
|
|
20222
20222
|
if (!this.didMove) return;
|
|
20223
20223
|
const isErasing = this.instance.getActiveAction() === "eraseTool";
|
|
@@ -20603,14 +20603,18 @@ var WeaveReconciler = class {
|
|
|
20603
20603
|
beforeChild
|
|
20604
20604
|
}, "insertBefore ");
|
|
20605
20605
|
if (parentInstance instanceof Konva.Layer || parentInstance instanceof Konva.Group) {
|
|
20606
|
-
const
|
|
20607
|
-
const fromIndex =
|
|
20608
|
-
const toIndex =
|
|
20606
|
+
const actualChildren = parentInstance.getChildren();
|
|
20607
|
+
const fromIndex = actualChildren.indexOf(child);
|
|
20608
|
+
const toIndex = actualChildren.indexOf(beforeChild);
|
|
20609
20609
|
if (fromIndex === -1 || toIndex === -1) return;
|
|
20610
|
-
children.splice(fromIndex, 1);
|
|
20611
20610
|
const adjustedIndex = fromIndex < toIndex ? toIndex - 1 : toIndex;
|
|
20612
|
-
|
|
20613
|
-
|
|
20611
|
+
child.setZIndex(adjustedIndex);
|
|
20612
|
+
const children = parentInstance.getChildren();
|
|
20613
|
+
for (let i = 0; i < children.length; i++) {
|
|
20614
|
+
const child$1 = children[i];
|
|
20615
|
+
child$1.setAttrs({ zIndex: i });
|
|
20616
|
+
}
|
|
20617
|
+
weaveInstance.getMainLayer()?.batchDraw();
|
|
20614
20618
|
}
|
|
20615
20619
|
},
|
|
20616
20620
|
appendChild(parentInstance, child) {
|
|
@@ -21570,6 +21574,7 @@ var WeaveZIndexManager = class {
|
|
|
21570
21574
|
this.logger.debug(`Moving instance with id [${instance.getAttrs().id}], up one step of z-index`);
|
|
21571
21575
|
const handler = this.instance.getNodeHandler(instance.getAttrs().nodeType);
|
|
21572
21576
|
if (handler) {
|
|
21577
|
+
instance.moveUp();
|
|
21573
21578
|
const nodeState = handler.serialize(instance);
|
|
21574
21579
|
this.instance.moveNode(nodeState, WEAVE_NODE_POSITION.UP);
|
|
21575
21580
|
}
|
|
@@ -21578,6 +21583,7 @@ var WeaveZIndexManager = class {
|
|
|
21578
21583
|
this.logger.debug(`Moving instance with id [${instance.getAttrs().id}], down one step of z-index`);
|
|
21579
21584
|
const handler = this.instance.getNodeHandler(instance.getAttrs().nodeType);
|
|
21580
21585
|
if (handler) {
|
|
21586
|
+
instance.moveDown();
|
|
21581
21587
|
const nodeState = handler.serialize(instance);
|
|
21582
21588
|
this.instance.moveNode(nodeState, WEAVE_NODE_POSITION.DOWN);
|
|
21583
21589
|
}
|
|
@@ -21588,6 +21594,7 @@ var WeaveZIndexManager = class {
|
|
|
21588
21594
|
for (const node of nodesDescending) {
|
|
21589
21595
|
const handler = this.instance.getNodeHandler(node.getAttrs().nodeType);
|
|
21590
21596
|
if (handler) {
|
|
21597
|
+
node.moveToBottom();
|
|
21591
21598
|
const nodeState = handler.serialize(node);
|
|
21592
21599
|
this.instance.moveNode(nodeState, WEAVE_NODE_POSITION.BACK);
|
|
21593
21600
|
}
|
|
@@ -21599,6 +21606,7 @@ var WeaveZIndexManager = class {
|
|
|
21599
21606
|
for (const node of nodesAscending) {
|
|
21600
21607
|
const handler = this.instance.getNodeHandler(node.getAttrs().nodeType);
|
|
21601
21608
|
if (handler) {
|
|
21609
|
+
node.moveToTop();
|
|
21602
21610
|
const nodeState = handler.serialize(node);
|
|
21603
21611
|
this.instance.moveNode(nodeState, WEAVE_NODE_POSITION.FRONT);
|
|
21604
21612
|
}
|
|
@@ -21923,7 +21931,7 @@ var WeaveRegisterManager = class {
|
|
|
21923
21931
|
|
|
21924
21932
|
//#endregion
|
|
21925
21933
|
//#region package.json
|
|
21926
|
-
var version = "0.56.
|
|
21934
|
+
var version = "0.56.2";
|
|
21927
21935
|
|
|
21928
21936
|
//#endregion
|
|
21929
21937
|
//#region src/managers/setup.ts
|
|
@@ -23183,7 +23191,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
23183
23191
|
text.on("transformstart", (e) => {
|
|
23184
23192
|
this.instance.emitEvent("onTransform", e.target);
|
|
23185
23193
|
});
|
|
23186
|
-
text.on("transform", (0, import_lodash.throttle)(handleTextTransform, 50));
|
|
23194
|
+
text.on("transform", (0, import_lodash$1.throttle)(handleTextTransform, 50));
|
|
23187
23195
|
text.on("transformend", () => {
|
|
23188
23196
|
this.instance.emitEvent("onTransform", null);
|
|
23189
23197
|
});
|
|
@@ -24492,7 +24500,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
24492
24500
|
const stage = this.instance.getStage();
|
|
24493
24501
|
const image = stage.findOne(`#${imageAttrs.id}`);
|
|
24494
24502
|
const internalImage = image?.findOne(`#${imageAttrs.id}-image`);
|
|
24495
|
-
if (image && internalImage && !imageAttrs.adding && imageAttrs.cropInfo && !(0, import_lodash.isEqual)(imageAttrs.cropInfo, this.cachedCropInfo[imageAttrs.id ?? ""])) {
|
|
24503
|
+
if (image && internalImage && !imageAttrs.adding && imageAttrs.cropInfo && !(0, import_lodash$1.isEqual)(imageAttrs.cropInfo, this.cachedCropInfo[imageAttrs.id ?? ""])) {
|
|
24496
24504
|
const actualScale = imageAttrs.uncroppedImage.width / imageAttrs.imageInfo.width;
|
|
24497
24505
|
internalImage.width(imageAttrs.uncroppedImage.width);
|
|
24498
24506
|
internalImage.height(imageAttrs.uncroppedImage.height);
|
|
@@ -24509,7 +24517,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
24509
24517
|
internalImage.height(imageAttrs.cropSize.height);
|
|
24510
24518
|
this.cachedCropInfo[imageAttrs.id ?? ""] = imageAttrs.cropInfo;
|
|
24511
24519
|
}
|
|
24512
|
-
if (image && internalImage && !imageAttrs.adding && !imageAttrs.cropInfo && !(0, import_lodash.isEqual)(imageAttrs.cropInfo, this.cachedCropInfo[imageAttrs.id ?? ""])) {
|
|
24520
|
+
if (image && internalImage && !imageAttrs.adding && !imageAttrs.cropInfo && !(0, import_lodash$1.isEqual)(imageAttrs.cropInfo, this.cachedCropInfo[imageAttrs.id ?? ""])) {
|
|
24513
24521
|
internalImage.width(imageAttrs.uncroppedImage.width);
|
|
24514
24522
|
internalImage.height(imageAttrs.uncroppedImage.height);
|
|
24515
24523
|
internalImage.rotation(0);
|
|
@@ -25358,7 +25366,7 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
25358
25366
|
constructor(params) {
|
|
25359
25367
|
super();
|
|
25360
25368
|
const { config } = params ?? {};
|
|
25361
|
-
this.config = (0, import_lodash.merge)(WEAVE_STAGE_ZOOM_DEFAULT_CONFIG, config);
|
|
25369
|
+
this.config = (0, import_lodash$1.merge)(WEAVE_STAGE_ZOOM_DEFAULT_CONFIG, config);
|
|
25362
25370
|
if (!this.config.zoomSteps.includes(this.config.defaultZoom)) throw new Error(`Default zoom ${this.config.defaultZoom} is not in zoom steps`);
|
|
25363
25371
|
this.pinching = false;
|
|
25364
25372
|
this.isTrackpad = false;
|
|
@@ -25386,7 +25394,7 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
25386
25394
|
this.config.zoomSteps = [minimumZoom, ...this.config.zoomSteps];
|
|
25387
25395
|
}
|
|
25388
25396
|
};
|
|
25389
|
-
mainLayer?.on("draw", (0, import_lodash.throttle)(handleDraw, 50));
|
|
25397
|
+
mainLayer?.on("draw", (0, import_lodash$1.throttle)(handleDraw, 50));
|
|
25390
25398
|
this.setZoom(this.config.zoomSteps[this.actualStep]);
|
|
25391
25399
|
}
|
|
25392
25400
|
setZoom(scale, centered = true, pointer) {
|
|
@@ -28303,7 +28311,7 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
28303
28311
|
if (!this.enabled || !(this.isSpaceKeyPressed || this.isMouseMiddleButtonPressed || this.moveToolActive)) return;
|
|
28304
28312
|
this.onRender();
|
|
28305
28313
|
};
|
|
28306
|
-
stage.on("pointermove", (0, import_lodash.throttle)(handleMouseMove, 50));
|
|
28314
|
+
stage.on("pointermove", (0, import_lodash$1.throttle)(handleMouseMove, 50));
|
|
28307
28315
|
stage.on("pointermove", () => {
|
|
28308
28316
|
if (this.enabled) this.onRender();
|
|
28309
28317
|
});
|