@inditextech/weave-sdk 0.56.1 → 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 -7
- package/dist/sdk.js +28 -19
- package/dist/sdk.js.map +1 -1
- package/package.json +2 -2
package/dist/sdk.cjs
CHANGED
|
@@ -20602,14 +20602,18 @@ var WeaveReconciler = class {
|
|
|
20602
20602
|
beforeChild
|
|
20603
20603
|
}, "insertBefore ");
|
|
20604
20604
|
if (parentInstance instanceof konva.default.Layer || parentInstance instanceof konva.default.Group) {
|
|
20605
|
-
const
|
|
20606
|
-
const fromIndex =
|
|
20607
|
-
const toIndex =
|
|
20605
|
+
const actualChildren = parentInstance.getChildren();
|
|
20606
|
+
const fromIndex = actualChildren.indexOf(child);
|
|
20607
|
+
const toIndex = actualChildren.indexOf(beforeChild);
|
|
20608
20608
|
if (fromIndex === -1 || toIndex === -1) return;
|
|
20609
|
-
children.splice(fromIndex, 1);
|
|
20610
20609
|
const adjustedIndex = fromIndex < toIndex ? toIndex - 1 : toIndex;
|
|
20611
|
-
|
|
20612
|
-
|
|
20610
|
+
child.setZIndex(adjustedIndex);
|
|
20611
|
+
const children = parentInstance.getChildren();
|
|
20612
|
+
for (let i = 0; i < children.length; i++) {
|
|
20613
|
+
const child$1 = children[i];
|
|
20614
|
+
child$1.setAttrs({ zIndex: i });
|
|
20615
|
+
}
|
|
20616
|
+
weaveInstance.getMainLayer()?.batchDraw();
|
|
20613
20617
|
}
|
|
20614
20618
|
},
|
|
20615
20619
|
appendChild(parentInstance, child) {
|
|
@@ -21569,6 +21573,7 @@ var WeaveZIndexManager = class {
|
|
|
21569
21573
|
this.logger.debug(`Moving instance with id [${instance.getAttrs().id}], up one step of z-index`);
|
|
21570
21574
|
const handler = this.instance.getNodeHandler(instance.getAttrs().nodeType);
|
|
21571
21575
|
if (handler) {
|
|
21576
|
+
instance.moveUp();
|
|
21572
21577
|
const nodeState = handler.serialize(instance);
|
|
21573
21578
|
this.instance.moveNode(nodeState, __inditextech_weave_types.WEAVE_NODE_POSITION.UP);
|
|
21574
21579
|
}
|
|
@@ -21577,6 +21582,7 @@ var WeaveZIndexManager = class {
|
|
|
21577
21582
|
this.logger.debug(`Moving instance with id [${instance.getAttrs().id}], down one step of z-index`);
|
|
21578
21583
|
const handler = this.instance.getNodeHandler(instance.getAttrs().nodeType);
|
|
21579
21584
|
if (handler) {
|
|
21585
|
+
instance.moveDown();
|
|
21580
21586
|
const nodeState = handler.serialize(instance);
|
|
21581
21587
|
this.instance.moveNode(nodeState, __inditextech_weave_types.WEAVE_NODE_POSITION.DOWN);
|
|
21582
21588
|
}
|
|
@@ -21587,6 +21593,7 @@ var WeaveZIndexManager = class {
|
|
|
21587
21593
|
for (const node of nodesDescending) {
|
|
21588
21594
|
const handler = this.instance.getNodeHandler(node.getAttrs().nodeType);
|
|
21589
21595
|
if (handler) {
|
|
21596
|
+
node.moveToBottom();
|
|
21590
21597
|
const nodeState = handler.serialize(node);
|
|
21591
21598
|
this.instance.moveNode(nodeState, __inditextech_weave_types.WEAVE_NODE_POSITION.BACK);
|
|
21592
21599
|
}
|
|
@@ -21598,6 +21605,7 @@ var WeaveZIndexManager = class {
|
|
|
21598
21605
|
for (const node of nodesAscending) {
|
|
21599
21606
|
const handler = this.instance.getNodeHandler(node.getAttrs().nodeType);
|
|
21600
21607
|
if (handler) {
|
|
21608
|
+
node.moveToTop();
|
|
21601
21609
|
const nodeState = handler.serialize(node);
|
|
21602
21610
|
this.instance.moveNode(nodeState, __inditextech_weave_types.WEAVE_NODE_POSITION.FRONT);
|
|
21603
21611
|
}
|
|
@@ -21922,7 +21930,7 @@ var WeaveRegisterManager = class {
|
|
|
21922
21930
|
|
|
21923
21931
|
//#endregion
|
|
21924
21932
|
//#region package.json
|
|
21925
|
-
var version = "0.56.
|
|
21933
|
+
var version = "0.56.2";
|
|
21926
21934
|
|
|
21927
21935
|
//#endregion
|
|
21928
21936
|
//#region src/managers/setup.ts
|
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
|
|
@@ -20162,7 +20163,7 @@ var WeaveNode = class {
|
|
|
20162
20163
|
if (nodesSelectionPlugin && this.isSelecting() && this.isNodeSelected(node$1)) nodesSelectionPlugin.getTransformer().forceUpdate();
|
|
20163
20164
|
if (nodesEdgeSnappingPlugin && transforming && this.isSelecting() && this.isNodeSelected(node$1)) nodesEdgeSnappingPlugin.evaluateGuidelines(e);
|
|
20164
20165
|
};
|
|
20165
|
-
node.on("transform", (0, import_lodash.throttle)(handleTransform, 100));
|
|
20166
|
+
node.on("transform", (0, import_lodash$1.throttle)(handleTransform, 100));
|
|
20166
20167
|
node.on("transformend", (e) => {
|
|
20167
20168
|
const node$1 = e.target;
|
|
20168
20169
|
this.instance.emitEvent("onTransform", null);
|
|
@@ -20216,7 +20217,7 @@ var WeaveNode = class {
|
|
|
20216
20217
|
if (layerToMove && !hasFrames(node) && node.isDragging()) layerToMove.fire(WEAVE_NODE_CUSTOM_EVENTS.onTargetEnter, { bubbles: true });
|
|
20217
20218
|
}
|
|
20218
20219
|
};
|
|
20219
|
-
node.on("dragmove", (0, import_lodash.throttle)(handleDragMove, 100));
|
|
20220
|
+
node.on("dragmove", (0, import_lodash$1.throttle)(handleDragMove, 100));
|
|
20220
20221
|
node.on("dragend", (e) => {
|
|
20221
20222
|
if (!this.didMove) return;
|
|
20222
20223
|
const isErasing = this.instance.getActiveAction() === "eraseTool";
|
|
@@ -20602,14 +20603,18 @@ var WeaveReconciler = class {
|
|
|
20602
20603
|
beforeChild
|
|
20603
20604
|
}, "insertBefore ");
|
|
20604
20605
|
if (parentInstance instanceof Konva.Layer || parentInstance instanceof Konva.Group) {
|
|
20605
|
-
const
|
|
20606
|
-
const fromIndex =
|
|
20607
|
-
const toIndex =
|
|
20606
|
+
const actualChildren = parentInstance.getChildren();
|
|
20607
|
+
const fromIndex = actualChildren.indexOf(child);
|
|
20608
|
+
const toIndex = actualChildren.indexOf(beforeChild);
|
|
20608
20609
|
if (fromIndex === -1 || toIndex === -1) return;
|
|
20609
|
-
children.splice(fromIndex, 1);
|
|
20610
20610
|
const adjustedIndex = fromIndex < toIndex ? toIndex - 1 : toIndex;
|
|
20611
|
-
|
|
20612
|
-
|
|
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();
|
|
20613
20618
|
}
|
|
20614
20619
|
},
|
|
20615
20620
|
appendChild(parentInstance, child) {
|
|
@@ -21569,6 +21574,7 @@ var WeaveZIndexManager = class {
|
|
|
21569
21574
|
this.logger.debug(`Moving instance with id [${instance.getAttrs().id}], up one step of z-index`);
|
|
21570
21575
|
const handler = this.instance.getNodeHandler(instance.getAttrs().nodeType);
|
|
21571
21576
|
if (handler) {
|
|
21577
|
+
instance.moveUp();
|
|
21572
21578
|
const nodeState = handler.serialize(instance);
|
|
21573
21579
|
this.instance.moveNode(nodeState, WEAVE_NODE_POSITION.UP);
|
|
21574
21580
|
}
|
|
@@ -21577,6 +21583,7 @@ var WeaveZIndexManager = class {
|
|
|
21577
21583
|
this.logger.debug(`Moving instance with id [${instance.getAttrs().id}], down one step of z-index`);
|
|
21578
21584
|
const handler = this.instance.getNodeHandler(instance.getAttrs().nodeType);
|
|
21579
21585
|
if (handler) {
|
|
21586
|
+
instance.moveDown();
|
|
21580
21587
|
const nodeState = handler.serialize(instance);
|
|
21581
21588
|
this.instance.moveNode(nodeState, WEAVE_NODE_POSITION.DOWN);
|
|
21582
21589
|
}
|
|
@@ -21587,6 +21594,7 @@ var WeaveZIndexManager = class {
|
|
|
21587
21594
|
for (const node of nodesDescending) {
|
|
21588
21595
|
const handler = this.instance.getNodeHandler(node.getAttrs().nodeType);
|
|
21589
21596
|
if (handler) {
|
|
21597
|
+
node.moveToBottom();
|
|
21590
21598
|
const nodeState = handler.serialize(node);
|
|
21591
21599
|
this.instance.moveNode(nodeState, WEAVE_NODE_POSITION.BACK);
|
|
21592
21600
|
}
|
|
@@ -21598,6 +21606,7 @@ var WeaveZIndexManager = class {
|
|
|
21598
21606
|
for (const node of nodesAscending) {
|
|
21599
21607
|
const handler = this.instance.getNodeHandler(node.getAttrs().nodeType);
|
|
21600
21608
|
if (handler) {
|
|
21609
|
+
node.moveToTop();
|
|
21601
21610
|
const nodeState = handler.serialize(node);
|
|
21602
21611
|
this.instance.moveNode(nodeState, WEAVE_NODE_POSITION.FRONT);
|
|
21603
21612
|
}
|
|
@@ -21922,7 +21931,7 @@ var WeaveRegisterManager = class {
|
|
|
21922
21931
|
|
|
21923
21932
|
//#endregion
|
|
21924
21933
|
//#region package.json
|
|
21925
|
-
var version = "0.56.
|
|
21934
|
+
var version = "0.56.2";
|
|
21926
21935
|
|
|
21927
21936
|
//#endregion
|
|
21928
21937
|
//#region src/managers/setup.ts
|
|
@@ -23182,7 +23191,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
23182
23191
|
text.on("transformstart", (e) => {
|
|
23183
23192
|
this.instance.emitEvent("onTransform", e.target);
|
|
23184
23193
|
});
|
|
23185
|
-
text.on("transform", (0, import_lodash.throttle)(handleTextTransform, 50));
|
|
23194
|
+
text.on("transform", (0, import_lodash$1.throttle)(handleTextTransform, 50));
|
|
23186
23195
|
text.on("transformend", () => {
|
|
23187
23196
|
this.instance.emitEvent("onTransform", null);
|
|
23188
23197
|
});
|
|
@@ -24491,7 +24500,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
24491
24500
|
const stage = this.instance.getStage();
|
|
24492
24501
|
const image = stage.findOne(`#${imageAttrs.id}`);
|
|
24493
24502
|
const internalImage = image?.findOne(`#${imageAttrs.id}-image`);
|
|
24494
|
-
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 ?? ""])) {
|
|
24495
24504
|
const actualScale = imageAttrs.uncroppedImage.width / imageAttrs.imageInfo.width;
|
|
24496
24505
|
internalImage.width(imageAttrs.uncroppedImage.width);
|
|
24497
24506
|
internalImage.height(imageAttrs.uncroppedImage.height);
|
|
@@ -24508,7 +24517,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
24508
24517
|
internalImage.height(imageAttrs.cropSize.height);
|
|
24509
24518
|
this.cachedCropInfo[imageAttrs.id ?? ""] = imageAttrs.cropInfo;
|
|
24510
24519
|
}
|
|
24511
|
-
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 ?? ""])) {
|
|
24512
24521
|
internalImage.width(imageAttrs.uncroppedImage.width);
|
|
24513
24522
|
internalImage.height(imageAttrs.uncroppedImage.height);
|
|
24514
24523
|
internalImage.rotation(0);
|
|
@@ -25357,7 +25366,7 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
25357
25366
|
constructor(params) {
|
|
25358
25367
|
super();
|
|
25359
25368
|
const { config } = params ?? {};
|
|
25360
|
-
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);
|
|
25361
25370
|
if (!this.config.zoomSteps.includes(this.config.defaultZoom)) throw new Error(`Default zoom ${this.config.defaultZoom} is not in zoom steps`);
|
|
25362
25371
|
this.pinching = false;
|
|
25363
25372
|
this.isTrackpad = false;
|
|
@@ -25385,7 +25394,7 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
25385
25394
|
this.config.zoomSteps = [minimumZoom, ...this.config.zoomSteps];
|
|
25386
25395
|
}
|
|
25387
25396
|
};
|
|
25388
|
-
mainLayer?.on("draw", (0, import_lodash.throttle)(handleDraw, 50));
|
|
25397
|
+
mainLayer?.on("draw", (0, import_lodash$1.throttle)(handleDraw, 50));
|
|
25389
25398
|
this.setZoom(this.config.zoomSteps[this.actualStep]);
|
|
25390
25399
|
}
|
|
25391
25400
|
setZoom(scale, centered = true, pointer) {
|
|
@@ -28302,7 +28311,7 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
28302
28311
|
if (!this.enabled || !(this.isSpaceKeyPressed || this.isMouseMiddleButtonPressed || this.moveToolActive)) return;
|
|
28303
28312
|
this.onRender();
|
|
28304
28313
|
};
|
|
28305
|
-
stage.on("pointermove", (0, import_lodash.throttle)(handleMouseMove, 50));
|
|
28314
|
+
stage.on("pointermove", (0, import_lodash$1.throttle)(handleMouseMove, 50));
|
|
28306
28315
|
stage.on("pointermove", () => {
|
|
28307
28316
|
if (this.enabled) this.onRender();
|
|
28308
28317
|
});
|