@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/sdk.js
CHANGED
|
@@ -9115,6 +9115,32 @@ var WeaveFontsManager = class {
|
|
|
9115
9115
|
this.logger = this.instance.getChildLogger("fonts-manager");
|
|
9116
9116
|
this.logger.debug("Fonts manager created");
|
|
9117
9117
|
}
|
|
9118
|
+
async loadFontFamily(fontFamily) {
|
|
9119
|
+
const fontsPromises = [];
|
|
9120
|
+
for (const fontFace of fontFamily.fontFaces) {
|
|
9121
|
+
const { source,...fontFaceDescriptors } = fontFace;
|
|
9122
|
+
const fontVariant = new FontFace(fontFamily.family, source, fontFaceDescriptors);
|
|
9123
|
+
fontsPromises.push(fontVariant.load().then(() => document.fonts.add(fontVariant)));
|
|
9124
|
+
}
|
|
9125
|
+
await Promise.all(fontsPromises);
|
|
9126
|
+
return {
|
|
9127
|
+
id: fontFamily.family,
|
|
9128
|
+
name: `${fontFamily.family}, sans-serif`,
|
|
9129
|
+
offsetY: fontFamily.offset.y,
|
|
9130
|
+
supportedStyles: fontFamily.supportedStyles
|
|
9131
|
+
};
|
|
9132
|
+
}
|
|
9133
|
+
async loadFontsFamilies(fontFamilies) {
|
|
9134
|
+
const familiesPromises = [];
|
|
9135
|
+
for (const fontFamily of fontFamilies) familiesPromises.push(this.loadFontFamily(fontFamily));
|
|
9136
|
+
try {
|
|
9137
|
+
const fonts = await Promise.all(familiesPromises);
|
|
9138
|
+
return fonts;
|
|
9139
|
+
} catch (ex) {
|
|
9140
|
+
console.error("Error loading fonts families", ex);
|
|
9141
|
+
return [];
|
|
9142
|
+
}
|
|
9143
|
+
}
|
|
9118
9144
|
async loadFonts() {
|
|
9119
9145
|
this.logger.info("Loading fonts");
|
|
9120
9146
|
const fontsConfig = this.instance.getConfiguration().fonts;
|
|
@@ -9123,7 +9149,7 @@ var WeaveFontsManager = class {
|
|
|
9123
9149
|
return;
|
|
9124
9150
|
}
|
|
9125
9151
|
let fontsToLoad = [];
|
|
9126
|
-
if (fontsConfig && fontsConfig instanceof Function) fontsToLoad = await fontsConfig();
|
|
9152
|
+
if (fontsConfig && fontsConfig instanceof Function) fontsToLoad = await fontsConfig(this.loadFontsFamilies.bind(this));
|
|
9127
9153
|
if (fontsConfig && fontsConfig instanceof Array) fontsToLoad = fontsConfig;
|
|
9128
9154
|
for (const font of fontsToLoad) this.loadedFonts.push(font);
|
|
9129
9155
|
this.logger.info("Fonts loaded");
|
|
@@ -9662,7 +9688,7 @@ var WeaveRegisterManager = class {
|
|
|
9662
9688
|
|
|
9663
9689
|
//#endregion
|
|
9664
9690
|
//#region package.json
|
|
9665
|
-
var version = "5.0.0-SNAPSHOT.
|
|
9691
|
+
var version = "5.0.0-SNAPSHOT.413.1";
|
|
9666
9692
|
|
|
9667
9693
|
//#endregion
|
|
9668
9694
|
//#region src/managers/setup.ts
|
|
@@ -16047,6 +16073,18 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
16047
16073
|
}
|
|
16048
16074
|
if (node) this.loadImage(node.getAttrs(), node, false, false);
|
|
16049
16075
|
}
|
|
16076
|
+
forceLoadFallbackImage(nodeInstance, dataURL) {
|
|
16077
|
+
const nodeId = nodeInstance.getAttrs().id ?? "";
|
|
16078
|
+
const node = this.instance.getStage().findOne(`#${nodeId}`);
|
|
16079
|
+
if (this.imageTryoutIds[nodeId]) {
|
|
16080
|
+
clearTimeout(this.imageTryoutIds[nodeId]);
|
|
16081
|
+
delete this.imageTryoutIds[nodeId];
|
|
16082
|
+
}
|
|
16083
|
+
if (node) {
|
|
16084
|
+
this.cacheImageFallbackURL(node.getAttrs(), dataURL);
|
|
16085
|
+
this.loadImage(node.getAttrs(), node, true);
|
|
16086
|
+
}
|
|
16087
|
+
}
|
|
16050
16088
|
onDestroy(nodeInstance) {
|
|
16051
16089
|
const nodeId = nodeInstance.getAttrs().id ?? "";
|
|
16052
16090
|
const utilityLayer = this.instance.getUtilityLayer();
|
|
@@ -24789,6 +24827,7 @@ const WEAVE_IMAGE_TOOL_CONFIG_DEFAULT = { style: { cursor: {
|
|
|
24789
24827
|
//#endregion
|
|
24790
24828
|
//#region src/actions/image-tool/image-tool.ts
|
|
24791
24829
|
var WeaveImageToolAction = class extends WeaveAction {
|
|
24830
|
+
initInitialized = false;
|
|
24792
24831
|
initialized = false;
|
|
24793
24832
|
initialCursor = null;
|
|
24794
24833
|
imageAction = {};
|
|
@@ -24821,7 +24860,8 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
24821
24860
|
};
|
|
24822
24861
|
}
|
|
24823
24862
|
onInit() {
|
|
24824
|
-
this.
|
|
24863
|
+
if (this.initInitialized) return;
|
|
24864
|
+
const handleImageOnStageDrop = (e) => {
|
|
24825
24865
|
const dragId = this.instance.getDragStartedId();
|
|
24826
24866
|
const dragProperties = this.instance.getDragProperties();
|
|
24827
24867
|
if (dragProperties && dragId === WEAVE_IMAGE_TOOL_ACTION_NAME) {
|
|
@@ -24837,7 +24877,9 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
24837
24877
|
position: mousePoint
|
|
24838
24878
|
});
|
|
24839
24879
|
}
|
|
24840
|
-
}
|
|
24880
|
+
};
|
|
24881
|
+
this.instance.addEventListener("onStageDrop", handleImageOnStageDrop);
|
|
24882
|
+
this.initInitialized = true;
|
|
24841
24883
|
}
|
|
24842
24884
|
setupEvents() {
|
|
24843
24885
|
const stage = this.instance.getStage();
|
|
@@ -25243,6 +25285,7 @@ const WEAVE_IMAGES_TOOL_DEFAULT_CONFIG = {
|
|
|
25243
25285
|
//#endregion
|
|
25244
25286
|
//#region src/actions/images-tool/images-tool.ts
|
|
25245
25287
|
var WeaveImagesToolAction = class extends WeaveAction {
|
|
25288
|
+
initInitialized = false;
|
|
25246
25289
|
initialized = false;
|
|
25247
25290
|
initialCursor = null;
|
|
25248
25291
|
nodesIds = [];
|
|
@@ -25285,7 +25328,8 @@ var WeaveImagesToolAction = class extends WeaveAction {
|
|
|
25285
25328
|
};
|
|
25286
25329
|
}
|
|
25287
25330
|
onInit() {
|
|
25288
|
-
this.
|
|
25331
|
+
if (this.initInitialized) return;
|
|
25332
|
+
const handleImagesOnStageDrop = (e) => {
|
|
25289
25333
|
const dragId = this.instance.getDragStartedId();
|
|
25290
25334
|
const dragProperties = this.instance.getDragProperties();
|
|
25291
25335
|
if (dragProperties && dragId === WEAVE_IMAGES_TOOL_ACTION_NAME) {
|
|
@@ -25300,7 +25344,9 @@ var WeaveImagesToolAction = class extends WeaveAction {
|
|
|
25300
25344
|
...dragProperties.forceMainContainer && { forceMainContainer: dragProperties.forceMainContainer }
|
|
25301
25345
|
});
|
|
25302
25346
|
}
|
|
25303
|
-
}
|
|
25347
|
+
};
|
|
25348
|
+
this.instance.addEventListener("onStageDrop", handleImagesOnStageDrop);
|
|
25349
|
+
this.initInitialized = true;
|
|
25304
25350
|
}
|
|
25305
25351
|
setupEvents() {
|
|
25306
25352
|
const stage = this.instance.getStage();
|
|
@@ -27490,6 +27536,7 @@ const VIDEO_TOOL_STATE = {
|
|
|
27490
27536
|
//#endregion
|
|
27491
27537
|
//#region src/actions/video-tool/video-tool.ts
|
|
27492
27538
|
var WeaveVideoToolAction = class extends WeaveAction {
|
|
27539
|
+
initInitialized = false;
|
|
27493
27540
|
initialized = false;
|
|
27494
27541
|
initialCursor = null;
|
|
27495
27542
|
cursorPadding = 5;
|
|
@@ -27526,7 +27573,8 @@ var WeaveVideoToolAction = class extends WeaveAction {
|
|
|
27526
27573
|
};
|
|
27527
27574
|
}
|
|
27528
27575
|
onInit() {
|
|
27529
|
-
this.
|
|
27576
|
+
if (this.initInitialized) return;
|
|
27577
|
+
const handleVideoOnStageDrop = (e) => {
|
|
27530
27578
|
const dragId = this.instance.getDragStartedId();
|
|
27531
27579
|
const dragProperties = this.instance.getDragProperties();
|
|
27532
27580
|
if (dragProperties && dragId === VIDEO_TOOL_ACTION_NAME) {
|
|
@@ -27540,7 +27588,9 @@ var WeaveVideoToolAction = class extends WeaveAction {
|
|
|
27540
27588
|
position: mousePoint
|
|
27541
27589
|
});
|
|
27542
27590
|
}
|
|
27543
|
-
}
|
|
27591
|
+
};
|
|
27592
|
+
this.instance.addEventListener("onStageDrop", handleVideoOnStageDrop);
|
|
27593
|
+
this.initInitialized = true;
|
|
27544
27594
|
}
|
|
27545
27595
|
setupEvents() {
|
|
27546
27596
|
const stage = this.instance.getStage();
|
package/dist/sdk.node.js
CHANGED
|
@@ -9114,6 +9114,32 @@ var WeaveFontsManager = class {
|
|
|
9114
9114
|
this.logger = this.instance.getChildLogger("fonts-manager");
|
|
9115
9115
|
this.logger.debug("Fonts manager created");
|
|
9116
9116
|
}
|
|
9117
|
+
async loadFontFamily(fontFamily) {
|
|
9118
|
+
const fontsPromises = [];
|
|
9119
|
+
for (const fontFace of fontFamily.fontFaces) {
|
|
9120
|
+
const { source,...fontFaceDescriptors } = fontFace;
|
|
9121
|
+
const fontVariant = new FontFace(fontFamily.family, source, fontFaceDescriptors);
|
|
9122
|
+
fontsPromises.push(fontVariant.load().then(() => document.fonts.add(fontVariant)));
|
|
9123
|
+
}
|
|
9124
|
+
await Promise.all(fontsPromises);
|
|
9125
|
+
return {
|
|
9126
|
+
id: fontFamily.family,
|
|
9127
|
+
name: `${fontFamily.family}, sans-serif`,
|
|
9128
|
+
offsetY: fontFamily.offset.y,
|
|
9129
|
+
supportedStyles: fontFamily.supportedStyles
|
|
9130
|
+
};
|
|
9131
|
+
}
|
|
9132
|
+
async loadFontsFamilies(fontFamilies) {
|
|
9133
|
+
const familiesPromises = [];
|
|
9134
|
+
for (const fontFamily of fontFamilies) familiesPromises.push(this.loadFontFamily(fontFamily));
|
|
9135
|
+
try {
|
|
9136
|
+
const fonts = await Promise.all(familiesPromises);
|
|
9137
|
+
return fonts;
|
|
9138
|
+
} catch (ex) {
|
|
9139
|
+
console.error("Error loading fonts families", ex);
|
|
9140
|
+
return [];
|
|
9141
|
+
}
|
|
9142
|
+
}
|
|
9117
9143
|
async loadFonts() {
|
|
9118
9144
|
this.logger.info("Loading fonts");
|
|
9119
9145
|
const fontsConfig = this.instance.getConfiguration().fonts;
|
|
@@ -9122,7 +9148,7 @@ var WeaveFontsManager = class {
|
|
|
9122
9148
|
return;
|
|
9123
9149
|
}
|
|
9124
9150
|
let fontsToLoad = [];
|
|
9125
|
-
if (fontsConfig && fontsConfig instanceof Function) fontsToLoad = await fontsConfig();
|
|
9151
|
+
if (fontsConfig && fontsConfig instanceof Function) fontsToLoad = await fontsConfig(this.loadFontsFamilies.bind(this));
|
|
9126
9152
|
if (fontsConfig && fontsConfig instanceof Array) fontsToLoad = fontsConfig;
|
|
9127
9153
|
for (const font of fontsToLoad) this.loadedFonts.push(font);
|
|
9128
9154
|
this.logger.info("Fonts loaded");
|
|
@@ -9661,7 +9687,7 @@ var WeaveRegisterManager = class {
|
|
|
9661
9687
|
|
|
9662
9688
|
//#endregion
|
|
9663
9689
|
//#region package.json
|
|
9664
|
-
var version = "5.0.0-SNAPSHOT.
|
|
9690
|
+
var version = "5.0.0-SNAPSHOT.413.1";
|
|
9665
9691
|
|
|
9666
9692
|
//#endregion
|
|
9667
9693
|
//#region src/managers/setup.ts
|
|
@@ -16046,6 +16072,18 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
16046
16072
|
}
|
|
16047
16073
|
if (node) this.loadImage(node.getAttrs(), node, false, false);
|
|
16048
16074
|
}
|
|
16075
|
+
forceLoadFallbackImage(nodeInstance, dataURL) {
|
|
16076
|
+
const nodeId = nodeInstance.getAttrs().id ?? "";
|
|
16077
|
+
const node = this.instance.getStage().findOne(`#${nodeId}`);
|
|
16078
|
+
if (this.imageTryoutIds[nodeId]) {
|
|
16079
|
+
clearTimeout(this.imageTryoutIds[nodeId]);
|
|
16080
|
+
delete this.imageTryoutIds[nodeId];
|
|
16081
|
+
}
|
|
16082
|
+
if (node) {
|
|
16083
|
+
this.cacheImageFallbackURL(node.getAttrs(), dataURL);
|
|
16084
|
+
this.loadImage(node.getAttrs(), node, true);
|
|
16085
|
+
}
|
|
16086
|
+
}
|
|
16049
16087
|
onDestroy(nodeInstance) {
|
|
16050
16088
|
const nodeId = nodeInstance.getAttrs().id ?? "";
|
|
16051
16089
|
const utilityLayer = this.instance.getUtilityLayer();
|
|
@@ -24788,6 +24826,7 @@ const WEAVE_IMAGE_TOOL_CONFIG_DEFAULT = { style: { cursor: {
|
|
|
24788
24826
|
//#endregion
|
|
24789
24827
|
//#region src/actions/image-tool/image-tool.ts
|
|
24790
24828
|
var WeaveImageToolAction = class extends WeaveAction {
|
|
24829
|
+
initInitialized = false;
|
|
24791
24830
|
initialized = false;
|
|
24792
24831
|
initialCursor = null;
|
|
24793
24832
|
imageAction = {};
|
|
@@ -24820,7 +24859,8 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
24820
24859
|
};
|
|
24821
24860
|
}
|
|
24822
24861
|
onInit() {
|
|
24823
|
-
this.
|
|
24862
|
+
if (this.initInitialized) return;
|
|
24863
|
+
const handleImageOnStageDrop = (e) => {
|
|
24824
24864
|
const dragId = this.instance.getDragStartedId();
|
|
24825
24865
|
const dragProperties = this.instance.getDragProperties();
|
|
24826
24866
|
if (dragProperties && dragId === WEAVE_IMAGE_TOOL_ACTION_NAME) {
|
|
@@ -24836,7 +24876,9 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
24836
24876
|
position: mousePoint
|
|
24837
24877
|
});
|
|
24838
24878
|
}
|
|
24839
|
-
}
|
|
24879
|
+
};
|
|
24880
|
+
this.instance.addEventListener("onStageDrop", handleImageOnStageDrop);
|
|
24881
|
+
this.initInitialized = true;
|
|
24840
24882
|
}
|
|
24841
24883
|
setupEvents() {
|
|
24842
24884
|
const stage = this.instance.getStage();
|
|
@@ -25242,6 +25284,7 @@ const WEAVE_IMAGES_TOOL_DEFAULT_CONFIG = {
|
|
|
25242
25284
|
//#endregion
|
|
25243
25285
|
//#region src/actions/images-tool/images-tool.ts
|
|
25244
25286
|
var WeaveImagesToolAction = class extends WeaveAction {
|
|
25287
|
+
initInitialized = false;
|
|
25245
25288
|
initialized = false;
|
|
25246
25289
|
initialCursor = null;
|
|
25247
25290
|
nodesIds = [];
|
|
@@ -25284,7 +25327,8 @@ var WeaveImagesToolAction = class extends WeaveAction {
|
|
|
25284
25327
|
};
|
|
25285
25328
|
}
|
|
25286
25329
|
onInit() {
|
|
25287
|
-
this.
|
|
25330
|
+
if (this.initInitialized) return;
|
|
25331
|
+
const handleImagesOnStageDrop = (e) => {
|
|
25288
25332
|
const dragId = this.instance.getDragStartedId();
|
|
25289
25333
|
const dragProperties = this.instance.getDragProperties();
|
|
25290
25334
|
if (dragProperties && dragId === WEAVE_IMAGES_TOOL_ACTION_NAME) {
|
|
@@ -25299,7 +25343,9 @@ var WeaveImagesToolAction = class extends WeaveAction {
|
|
|
25299
25343
|
...dragProperties.forceMainContainer && { forceMainContainer: dragProperties.forceMainContainer }
|
|
25300
25344
|
});
|
|
25301
25345
|
}
|
|
25302
|
-
}
|
|
25346
|
+
};
|
|
25347
|
+
this.instance.addEventListener("onStageDrop", handleImagesOnStageDrop);
|
|
25348
|
+
this.initInitialized = true;
|
|
25303
25349
|
}
|
|
25304
25350
|
setupEvents() {
|
|
25305
25351
|
const stage = this.instance.getStage();
|
|
@@ -27489,6 +27535,7 @@ const VIDEO_TOOL_STATE = {
|
|
|
27489
27535
|
//#endregion
|
|
27490
27536
|
//#region src/actions/video-tool/video-tool.ts
|
|
27491
27537
|
var WeaveVideoToolAction = class extends WeaveAction {
|
|
27538
|
+
initInitialized = false;
|
|
27492
27539
|
initialized = false;
|
|
27493
27540
|
initialCursor = null;
|
|
27494
27541
|
cursorPadding = 5;
|
|
@@ -27525,7 +27572,8 @@ var WeaveVideoToolAction = class extends WeaveAction {
|
|
|
27525
27572
|
};
|
|
27526
27573
|
}
|
|
27527
27574
|
onInit() {
|
|
27528
|
-
this.
|
|
27575
|
+
if (this.initInitialized) return;
|
|
27576
|
+
const handleVideoOnStageDrop = (e) => {
|
|
27529
27577
|
const dragId = this.instance.getDragStartedId();
|
|
27530
27578
|
const dragProperties = this.instance.getDragProperties();
|
|
27531
27579
|
if (dragProperties && dragId === VIDEO_TOOL_ACTION_NAME) {
|
|
@@ -27539,7 +27587,9 @@ var WeaveVideoToolAction = class extends WeaveAction {
|
|
|
27539
27587
|
position: mousePoint
|
|
27540
27588
|
});
|
|
27541
27589
|
}
|
|
27542
|
-
}
|
|
27590
|
+
};
|
|
27591
|
+
this.instance.addEventListener("onStageDrop", handleVideoOnStageDrop);
|
|
27592
|
+
this.initInitialized = true;
|
|
27543
27593
|
}
|
|
27544
27594
|
setupEvents() {
|
|
27545
27595
|
const stage = this.instance.getStage();
|