@inditextech/weave-sdk 0.29.1 → 0.30.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.cjs +35 -4
- package/dist/sdk.d.cts +5 -2
- package/dist/sdk.d.cts.map +1 -1
- package/dist/sdk.d.ts +5 -2
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +35 -4
- package/dist/sdk.js.map +1 -1
- package/package.json +2 -2
package/dist/sdk.js
CHANGED
|
@@ -16195,6 +16195,11 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16195
16195
|
if (!this.initialized) return;
|
|
16196
16196
|
if (!this.active) return;
|
|
16197
16197
|
if (e.evt instanceof TouchEvent && e.evt.touches && e.evt.touches.length > 1) return;
|
|
16198
|
+
const contextMenuPlugin = this.instance.getPlugin("contextMenu");
|
|
16199
|
+
if (contextMenuPlugin && contextMenuPlugin.isContextMenuVisible()) {
|
|
16200
|
+
this.selecting = false;
|
|
16201
|
+
return;
|
|
16202
|
+
}
|
|
16198
16203
|
if (!this.selecting) {
|
|
16199
16204
|
this.cameFromSelectingMultiple = false;
|
|
16200
16205
|
return;
|
|
@@ -16217,7 +16222,10 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16217
16222
|
if (!this.active) return;
|
|
16218
16223
|
if (e.evt instanceof TouchEvent && e.evt.touches && e.evt.touches.length > 1) return;
|
|
16219
16224
|
const contextMenuPlugin = this.instance.getPlugin("contextMenu");
|
|
16220
|
-
if (contextMenuPlugin && contextMenuPlugin.isContextMenuVisible())
|
|
16225
|
+
if (contextMenuPlugin && contextMenuPlugin.isContextMenuVisible()) {
|
|
16226
|
+
this.selecting = false;
|
|
16227
|
+
return;
|
|
16228
|
+
}
|
|
16221
16229
|
this.selecting = false;
|
|
16222
16230
|
this.instance.emitEvent("onSelectionState", false);
|
|
16223
16231
|
if (!this.selectionRectangle.visible()) {
|
|
@@ -16263,7 +16271,10 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16263
16271
|
stage.on("click tap", (e) => {
|
|
16264
16272
|
if (!this.enabled) return;
|
|
16265
16273
|
const contextMenuPlugin = this.instance.getPlugin("contextMenu");
|
|
16266
|
-
if (contextMenuPlugin && contextMenuPlugin.isContextMenuVisible())
|
|
16274
|
+
if (contextMenuPlugin && contextMenuPlugin.isContextMenuVisible()) {
|
|
16275
|
+
this.selecting = false;
|
|
16276
|
+
return;
|
|
16277
|
+
}
|
|
16267
16278
|
if (this.cameFromSelectingMultiple) {
|
|
16268
16279
|
this.cameFromSelectingMultiple = false;
|
|
16269
16280
|
return;
|
|
@@ -18218,7 +18229,7 @@ var WeaveRegisterManager = class {
|
|
|
18218
18229
|
|
|
18219
18230
|
//#endregion
|
|
18220
18231
|
//#region package.json
|
|
18221
|
-
var version = "0.
|
|
18232
|
+
var version = "0.30.0";
|
|
18222
18233
|
|
|
18223
18234
|
//#endregion
|
|
18224
18235
|
//#region src/managers/setup.ts
|
|
@@ -18482,6 +18493,17 @@ var WeaveExportManager = class {
|
|
|
18482
18493
|
}
|
|
18483
18494
|
});
|
|
18484
18495
|
}
|
|
18496
|
+
imageToBase64(img, mimeType) {
|
|
18497
|
+
const canvas = document.createElement("canvas");
|
|
18498
|
+
canvas.width = img.naturalWidth;
|
|
18499
|
+
canvas.height = img.naturalHeight;
|
|
18500
|
+
const ctx = canvas.getContext("2d");
|
|
18501
|
+
if (!ctx) throw new Error("Could not get canvas context");
|
|
18502
|
+
ctx.drawImage(img, 0, 0);
|
|
18503
|
+
const URL = canvas.toDataURL(mimeType);
|
|
18504
|
+
canvas.remove();
|
|
18505
|
+
return URL;
|
|
18506
|
+
}
|
|
18485
18507
|
};
|
|
18486
18508
|
|
|
18487
18509
|
//#endregion
|
|
@@ -18844,6 +18866,9 @@ var Weave = class extends Emittery {
|
|
|
18844
18866
|
getFonts() {
|
|
18845
18867
|
return this.fontsManager.getFonts();
|
|
18846
18868
|
}
|
|
18869
|
+
imageToBase64(img, mimeType) {
|
|
18870
|
+
return this.exportManager.imageToBase64(img, mimeType);
|
|
18871
|
+
}
|
|
18847
18872
|
async exportNodes(nodes, options) {
|
|
18848
18873
|
return await this.exportManager.exportNodes(nodes, options);
|
|
18849
18874
|
}
|
|
@@ -24984,7 +25009,7 @@ var WeaveExportNodesToolAction = class extends WeaveAction {
|
|
|
24984
25009
|
link.click();
|
|
24985
25010
|
this.cancelAction?.();
|
|
24986
25011
|
}
|
|
24987
|
-
async trigger(cancelAction, { nodes, options }) {
|
|
25012
|
+
async trigger(cancelAction, { nodes, options, download = true }) {
|
|
24988
25013
|
if (!this.instance) throw new Error("Instance not defined");
|
|
24989
25014
|
const stage = this.instance.getStage();
|
|
24990
25015
|
stage.container().tabIndex = 1;
|
|
@@ -24994,6 +25019,12 @@ var WeaveExportNodesToolAction = class extends WeaveAction {
|
|
|
24994
25019
|
...this.defaultFormatOptions,
|
|
24995
25020
|
...options
|
|
24996
25021
|
};
|
|
25022
|
+
if (!download) {
|
|
25023
|
+
const img = await this.instance.exportNodes(nodes, this.options);
|
|
25024
|
+
const base64URL = this.instance.imageToBase64(img, this.options.format ?? "image/png");
|
|
25025
|
+
this.cancelAction?.();
|
|
25026
|
+
return base64URL;
|
|
25027
|
+
}
|
|
24997
25028
|
await this.exportNodes(nodes);
|
|
24998
25029
|
}
|
|
24999
25030
|
cleanup() {
|