@inditextech/weave-sdk 5.0.0-SNAPSHOT.409.1 → 5.0.0-SNAPSHOT.413.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.js +58 -8
- package/dist/sdk.node.js +58 -8
- package/dist/sdk.node.stats.html +1 -1
- package/dist/sdk.stats.html +1 -1
- package/dist/types.d.ts +30 -14
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +58 -8
- package/dist/types.js.map +1 -1
- package/dist/types.stats.html +1 -1
- package/package.json +2 -2
package/dist/types.js
CHANGED
|
@@ -9126,6 +9126,32 @@ var WeaveFontsManager = class {
|
|
|
9126
9126
|
this.logger = this.instance.getChildLogger("fonts-manager");
|
|
9127
9127
|
this.logger.debug("Fonts manager created");
|
|
9128
9128
|
}
|
|
9129
|
+
async loadFontFamily(fontFamily) {
|
|
9130
|
+
const fontsPromises = [];
|
|
9131
|
+
for (const fontFace of fontFamily.fontFaces) {
|
|
9132
|
+
const { source,...fontFaceDescriptors } = fontFace;
|
|
9133
|
+
const fontVariant = new FontFace(fontFamily.family, source, fontFaceDescriptors);
|
|
9134
|
+
fontsPromises.push(fontVariant.load().then(() => document.fonts.add(fontVariant)));
|
|
9135
|
+
}
|
|
9136
|
+
await Promise.all(fontsPromises);
|
|
9137
|
+
return {
|
|
9138
|
+
id: fontFamily.family,
|
|
9139
|
+
name: `${fontFamily.family}, sans-serif`,
|
|
9140
|
+
offsetY: fontFamily.offset.y,
|
|
9141
|
+
supportedStyles: fontFamily.supportedStyles
|
|
9142
|
+
};
|
|
9143
|
+
}
|
|
9144
|
+
async loadFontsFamilies(fontFamilies) {
|
|
9145
|
+
const familiesPromises = [];
|
|
9146
|
+
for (const fontFamily of fontFamilies) familiesPromises.push(this.loadFontFamily(fontFamily));
|
|
9147
|
+
try {
|
|
9148
|
+
const fonts = await Promise.all(familiesPromises);
|
|
9149
|
+
return fonts;
|
|
9150
|
+
} catch (ex) {
|
|
9151
|
+
console.error("Error loading fonts families", ex);
|
|
9152
|
+
return [];
|
|
9153
|
+
}
|
|
9154
|
+
}
|
|
9129
9155
|
async loadFonts() {
|
|
9130
9156
|
this.logger.info("Loading fonts");
|
|
9131
9157
|
const fontsConfig = this.instance.getConfiguration().fonts;
|
|
@@ -9134,7 +9160,7 @@ var WeaveFontsManager = class {
|
|
|
9134
9160
|
return;
|
|
9135
9161
|
}
|
|
9136
9162
|
let fontsToLoad = [];
|
|
9137
|
-
if (fontsConfig && fontsConfig instanceof Function) fontsToLoad = await fontsConfig();
|
|
9163
|
+
if (fontsConfig && fontsConfig instanceof Function) fontsToLoad = await fontsConfig(this.loadFontsFamilies.bind(this));
|
|
9138
9164
|
if (fontsConfig && fontsConfig instanceof Array) fontsToLoad = fontsConfig;
|
|
9139
9165
|
for (const font of fontsToLoad) this.loadedFonts.push(font);
|
|
9140
9166
|
this.logger.info("Fonts loaded");
|
|
@@ -9673,7 +9699,7 @@ var WeaveRegisterManager = class {
|
|
|
9673
9699
|
|
|
9674
9700
|
//#endregion
|
|
9675
9701
|
//#region package.json
|
|
9676
|
-
var version = "5.0.0-SNAPSHOT.
|
|
9702
|
+
var version = "5.0.0-SNAPSHOT.413.1";
|
|
9677
9703
|
|
|
9678
9704
|
//#endregion
|
|
9679
9705
|
//#region src/managers/setup.ts
|
|
@@ -16104,6 +16130,18 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
16104
16130
|
}
|
|
16105
16131
|
if (node) this.loadImage(node.getAttrs(), node, false, false);
|
|
16106
16132
|
}
|
|
16133
|
+
forceLoadFallbackImage(nodeInstance, dataURL) {
|
|
16134
|
+
const nodeId = nodeInstance.getAttrs().id ?? "";
|
|
16135
|
+
const node = this.instance.getStage().findOne(`#${nodeId}`);
|
|
16136
|
+
if (this.imageTryoutIds[nodeId]) {
|
|
16137
|
+
clearTimeout(this.imageTryoutIds[nodeId]);
|
|
16138
|
+
delete this.imageTryoutIds[nodeId];
|
|
16139
|
+
}
|
|
16140
|
+
if (node) {
|
|
16141
|
+
this.cacheImageFallbackURL(node.getAttrs(), dataURL);
|
|
16142
|
+
this.loadImage(node.getAttrs(), node, true);
|
|
16143
|
+
}
|
|
16144
|
+
}
|
|
16107
16145
|
onDestroy(nodeInstance) {
|
|
16108
16146
|
const nodeId = nodeInstance.getAttrs().id ?? "";
|
|
16109
16147
|
const utilityLayer = this.instance.getUtilityLayer();
|
|
@@ -24846,6 +24884,7 @@ const WEAVE_IMAGE_TOOL_CONFIG_DEFAULT = { style: { cursor: {
|
|
|
24846
24884
|
//#endregion
|
|
24847
24885
|
//#region src/actions/image-tool/image-tool.ts
|
|
24848
24886
|
var WeaveImageToolAction = class extends WeaveAction {
|
|
24887
|
+
initInitialized = false;
|
|
24849
24888
|
initialized = false;
|
|
24850
24889
|
initialCursor = null;
|
|
24851
24890
|
imageAction = {};
|
|
@@ -24878,7 +24917,8 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
24878
24917
|
};
|
|
24879
24918
|
}
|
|
24880
24919
|
onInit() {
|
|
24881
|
-
this.
|
|
24920
|
+
if (this.initInitialized) return;
|
|
24921
|
+
const handleImageOnStageDrop = (e) => {
|
|
24882
24922
|
const dragId = this.instance.getDragStartedId();
|
|
24883
24923
|
const dragProperties = this.instance.getDragProperties();
|
|
24884
24924
|
if (dragProperties && dragId === WEAVE_IMAGE_TOOL_ACTION_NAME) {
|
|
@@ -24894,7 +24934,9 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
24894
24934
|
position: mousePoint
|
|
24895
24935
|
});
|
|
24896
24936
|
}
|
|
24897
|
-
}
|
|
24937
|
+
};
|
|
24938
|
+
this.instance.addEventListener("onStageDrop", handleImageOnStageDrop);
|
|
24939
|
+
this.initInitialized = true;
|
|
24898
24940
|
}
|
|
24899
24941
|
setupEvents() {
|
|
24900
24942
|
const stage = this.instance.getStage();
|
|
@@ -25300,6 +25342,7 @@ const WEAVE_IMAGES_TOOL_DEFAULT_CONFIG = {
|
|
|
25300
25342
|
//#endregion
|
|
25301
25343
|
//#region src/actions/images-tool/images-tool.ts
|
|
25302
25344
|
var WeaveImagesToolAction = class extends WeaveAction {
|
|
25345
|
+
initInitialized = false;
|
|
25303
25346
|
initialized = false;
|
|
25304
25347
|
initialCursor = null;
|
|
25305
25348
|
nodesIds = [];
|
|
@@ -25342,7 +25385,8 @@ var WeaveImagesToolAction = class extends WeaveAction {
|
|
|
25342
25385
|
};
|
|
25343
25386
|
}
|
|
25344
25387
|
onInit() {
|
|
25345
|
-
this.
|
|
25388
|
+
if (this.initInitialized) return;
|
|
25389
|
+
const handleImagesOnStageDrop = (e) => {
|
|
25346
25390
|
const dragId = this.instance.getDragStartedId();
|
|
25347
25391
|
const dragProperties = this.instance.getDragProperties();
|
|
25348
25392
|
if (dragProperties && dragId === WEAVE_IMAGES_TOOL_ACTION_NAME) {
|
|
@@ -25357,7 +25401,9 @@ var WeaveImagesToolAction = class extends WeaveAction {
|
|
|
25357
25401
|
...dragProperties.forceMainContainer && { forceMainContainer: dragProperties.forceMainContainer }
|
|
25358
25402
|
});
|
|
25359
25403
|
}
|
|
25360
|
-
}
|
|
25404
|
+
};
|
|
25405
|
+
this.instance.addEventListener("onStageDrop", handleImagesOnStageDrop);
|
|
25406
|
+
this.initInitialized = true;
|
|
25361
25407
|
}
|
|
25362
25408
|
setupEvents() {
|
|
25363
25409
|
const stage = this.instance.getStage();
|
|
@@ -27547,6 +27593,7 @@ const VIDEO_TOOL_STATE = {
|
|
|
27547
27593
|
//#endregion
|
|
27548
27594
|
//#region src/actions/video-tool/video-tool.ts
|
|
27549
27595
|
var WeaveVideoToolAction = class extends WeaveAction {
|
|
27596
|
+
initInitialized = false;
|
|
27550
27597
|
initialized = false;
|
|
27551
27598
|
initialCursor = null;
|
|
27552
27599
|
cursorPadding = 5;
|
|
@@ -27583,7 +27630,8 @@ var WeaveVideoToolAction = class extends WeaveAction {
|
|
|
27583
27630
|
};
|
|
27584
27631
|
}
|
|
27585
27632
|
onInit() {
|
|
27586
|
-
this.
|
|
27633
|
+
if (this.initInitialized) return;
|
|
27634
|
+
const handleVideoOnStageDrop = (e) => {
|
|
27587
27635
|
const dragId = this.instance.getDragStartedId();
|
|
27588
27636
|
const dragProperties = this.instance.getDragProperties();
|
|
27589
27637
|
if (dragProperties && dragId === VIDEO_TOOL_ACTION_NAME) {
|
|
@@ -27597,7 +27645,9 @@ var WeaveVideoToolAction = class extends WeaveAction {
|
|
|
27597
27645
|
position: mousePoint
|
|
27598
27646
|
});
|
|
27599
27647
|
}
|
|
27600
|
-
}
|
|
27648
|
+
};
|
|
27649
|
+
this.instance.addEventListener("onStageDrop", handleVideoOnStageDrop);
|
|
27650
|
+
this.initInitialized = true;
|
|
27601
27651
|
}
|
|
27602
27652
|
setupEvents() {
|
|
27603
27653
|
const stage = this.instance.getStage();
|