@versa_ai/vmml-editor 1.0.22 → 1.0.24
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/.turbo/turbo-build.log +9 -9
- package/dist/index.js +21 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/components/EditorCanvas.tsx +23 -3
- package/src/index.tsx +2 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @versa_ai/vmml-editor@1.0.
|
|
2
|
+
> @versa_ai/vmml-editor@1.0.24 build D:\code\work\vmml-player\packages\editor
|
|
3
3
|
> tsup
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.tsx
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
[34mCLI[39m Target: node16
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
11
|
[34mESM[39m Build start
|
|
12
|
+
[34mDTS[39m Build start
|
|
12
13
|
|
|
13
14
|
[43m[30m WARN [39m[49m [33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mUsing / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.
|
|
14
15
|
|
|
@@ -123,13 +124,12 @@ More info and automated migrator: https://sass-lang.com/d/slash-div[0m [1m[35
|
|
|
123
124
|
|
|
124
125
|
|
|
125
126
|
|
|
126
|
-
[
|
|
127
|
-
[32mCJS[39m [1mdist\index.js
|
|
128
|
-
[32mCJS[39m
|
|
129
|
-
[
|
|
130
|
-
[32mESM[39m [1mdist\index.mjs
|
|
131
|
-
[32mESM[39m
|
|
132
|
-
[
|
|
133
|
-
[32mDTS[39m ⚡️ Build success in 2259ms
|
|
127
|
+
[32mCJS[39m [1mdist\index.js [22m[32m115.04 KB[39m
|
|
128
|
+
[32mCJS[39m [1mdist\index.js.map [22m[32m218.17 KB[39m
|
|
129
|
+
[32mCJS[39m ⚡️ Build success in 3145ms
|
|
130
|
+
[32mESM[39m [1mdist\index.mjs [22m[32m113.40 KB[39m
|
|
131
|
+
[32mESM[39m [1mdist\index.mjs.map [22m[32m217.88 KB[39m
|
|
132
|
+
[32mESM[39m ⚡️ Build success in 3146ms
|
|
133
|
+
[32mDTS[39m ⚡️ Build success in 2306ms
|
|
134
134
|
[32mDTS[39m [1mdist\index.d.ts [22m[32m158.00 B[39m
|
|
135
135
|
[32mDTS[39m [1mdist\index.d.mts [22m[32m158.00 B[39m
|
package/dist/index.js
CHANGED
|
@@ -1226,6 +1226,7 @@ var EditorCanvas = react.forwardRef(
|
|
|
1226
1226
|
});
|
|
1227
1227
|
if (editRenderTime.current === time) {
|
|
1228
1228
|
canvas.add(...objects).renderAll();
|
|
1229
|
+
checkObjectInPoint();
|
|
1229
1230
|
}
|
|
1230
1231
|
};
|
|
1231
1232
|
const createImageFromClip = (clip, fc2) => {
|
|
@@ -1407,9 +1408,10 @@ var EditorCanvas = react.forwardRef(
|
|
|
1407
1408
|
if (lower.includes(".ttf")) return "truetype";
|
|
1408
1409
|
return null;
|
|
1409
1410
|
};
|
|
1410
|
-
const embedFontInSVG = async (svgString, url) => {
|
|
1411
|
+
const embedFontInSVG = async (svgString, url, fontBase64) => {
|
|
1411
1412
|
if (url) {
|
|
1412
|
-
|
|
1413
|
+
let res = fontBase64;
|
|
1414
|
+
if (!res) await vmmlUtils.urlToBlob({ url });
|
|
1413
1415
|
const format = detectFontFormat(url);
|
|
1414
1416
|
const fontFamilyName = getFontFamilyName(url);
|
|
1415
1417
|
const srcValue = format ? `url('${res}') format('${format}')` : `url('${res}')`;
|
|
@@ -1425,7 +1427,22 @@ var EditorCanvas = react.forwardRef(
|
|
|
1425
1427
|
}
|
|
1426
1428
|
return svgString;
|
|
1427
1429
|
};
|
|
1430
|
+
const loadFont = async (url) => {
|
|
1431
|
+
if (!url) return null;
|
|
1432
|
+
try {
|
|
1433
|
+
const base64 = await vmmlUtils.urlToBlob({ url });
|
|
1434
|
+
const fontFamilyName = getFontFamilyName(url);
|
|
1435
|
+
const format = detectFontFormat(url);
|
|
1436
|
+
const fontFace = new FontFace(fontFamilyName, `url(${base64})${format ? ` format('${format}')` : ""}`);
|
|
1437
|
+
await fontFace.load();
|
|
1438
|
+
document.fonts.add(fontFace);
|
|
1439
|
+
return base64;
|
|
1440
|
+
} catch (e) {
|
|
1441
|
+
return null;
|
|
1442
|
+
}
|
|
1443
|
+
};
|
|
1428
1444
|
const createTextImg = async ({ textContent, bgColor, textColor, stColor, strokeW, fontAssetUrl = null, textBasicInfo }) => {
|
|
1445
|
+
const fontBase64 = await loadFont(fontAssetUrl);
|
|
1429
1446
|
const container = document.createElement("div");
|
|
1430
1447
|
container.style.backgroundColor = bgColor;
|
|
1431
1448
|
container.style.boxSizing = "content-box";
|
|
@@ -1467,7 +1484,7 @@ var EditorCanvas = react.forwardRef(
|
|
|
1467
1484
|
const { width, height } = container == null ? void 0 : container.getBoundingClientRect();
|
|
1468
1485
|
const dataurl = await domToImage.toSvg(container);
|
|
1469
1486
|
document.body.removeChild(container);
|
|
1470
|
-
const base64Image = await embedFontInSVG(dataurl, fontAssetUrl);
|
|
1487
|
+
const base64Image = await embedFontInSVG(dataurl, fontAssetUrl, fontBase64);
|
|
1471
1488
|
return { base64Image, height, width };
|
|
1472
1489
|
};
|
|
1473
1490
|
const createText = async ({ textContent, bgColor, textColor, position, textBasicInfo, id }, fc2) => {
|
|
@@ -2686,7 +2703,7 @@ var EditorFn = ({
|
|
|
2686
2703
|
if (editableArray.length && (vmmlState == null ? void 0 : vmmlState.template)) {
|
|
2687
2704
|
initCanEditClips(vmmlState.template.tracks);
|
|
2688
2705
|
}
|
|
2689
|
-
}, [editableArray, refreshEdit]);
|
|
2706
|
+
}, [editableArray, refreshEdit, vmmlState]);
|
|
2690
2707
|
react.useEffect(() => {
|
|
2691
2708
|
var _a2;
|
|
2692
2709
|
if (propVmml) {
|