@versa_ai/vmml-editor 1.0.39 → 1.0.41
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 +35 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/EditorCanvas.tsx +9 -7
- package/src/utils/VmmlConverter.ts +30 -16
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.41 build D:\code\work\vmml-player\packages\editor
|
|
3
3
|
> tsup
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.tsx
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
[34mCLI[39m Target: node16
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
11
|
[34mESM[39m Build start
|
|
12
|
-
[34mDTS[39m Build start
|
|
13
12
|
|
|
14
13
|
[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.
|
|
15
14
|
|
|
@@ -67,6 +66,7 @@ More info and automated migrator: https://sass-lang.com/d/slash-div[0m [1m[35
|
|
|
67
66
|
|
|
68
67
|
|
|
69
68
|
|
|
69
|
+
[34mDTS[39m Build start
|
|
70
70
|
|
|
71
71
|
[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.
|
|
72
72
|
|
|
@@ -124,12 +124,12 @@ More info and automated migrator: https://sass-lang.com/d/slash-div[0m [1m[35
|
|
|
124
124
|
|
|
125
125
|
|
|
126
126
|
|
|
127
|
-
[32mCJS[39m [1mdist\index.js [22m[32m122.
|
|
128
|
-
[32mCJS[39m [1mdist\index.js.map [22m[
|
|
129
|
-
[32mCJS[39m ⚡️ Build success in
|
|
130
|
-
[32mESM[39m [1mdist\index.mjs [22m[32m120.
|
|
131
|
-
[32mESM[39m [1mdist\index.mjs.map [22m[
|
|
132
|
-
[32mESM[39m ⚡️ Build success in
|
|
133
|
-
[32mDTS[39m ⚡️ Build success in
|
|
127
|
+
[32mCJS[39m [1mdist\index.js [22m[32m122.59 KB[39m
|
|
128
|
+
[32mCJS[39m [1mdist\index.js.map [22m[32m234.64 KB[39m
|
|
129
|
+
[32mCJS[39m ⚡️ Build success in 868ms
|
|
130
|
+
[32mESM[39m [1mdist\index.mjs [22m[32m120.90 KB[39m
|
|
131
|
+
[32mESM[39m [1mdist\index.mjs.map [22m[32m234.34 KB[39m
|
|
132
|
+
[32mESM[39m ⚡️ Build success in 868ms
|
|
133
|
+
[32mDTS[39m ⚡️ Build success in 1828ms
|
|
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
|
@@ -617,6 +617,20 @@ var VmmlConverter = class {
|
|
|
617
617
|
rotationY: _rotationY
|
|
618
618
|
};
|
|
619
619
|
}
|
|
620
|
+
findClip(id) {
|
|
621
|
+
const tracks = this.vmml.template.tracks || [];
|
|
622
|
+
const isString = typeof id === "string";
|
|
623
|
+
const ids = isString ? [id] : id;
|
|
624
|
+
const list = [];
|
|
625
|
+
tracks.forEach((track) => {
|
|
626
|
+
track.clips.forEach((clip) => {
|
|
627
|
+
if (ids == null ? void 0 : ids.includes(clip.id)) {
|
|
628
|
+
list.push(clip);
|
|
629
|
+
}
|
|
630
|
+
});
|
|
631
|
+
});
|
|
632
|
+
return list;
|
|
633
|
+
}
|
|
620
634
|
/**
|
|
621
635
|
* 转换 TextClip
|
|
622
636
|
* @param fObj - 画布fObj
|
|
@@ -709,19 +723,12 @@ var VmmlConverter = class {
|
|
|
709
723
|
* @param fObj - 画布fObj
|
|
710
724
|
*/
|
|
711
725
|
updateClip(fObj) {
|
|
712
|
-
console.log("updateClip fObj", fObj);
|
|
726
|
+
console.log("updateClip fObj", fObj, this.tracks);
|
|
713
727
|
const posParam = this.setPosParam(fObj);
|
|
714
728
|
const {
|
|
715
|
-
// clipData: { id, type, lineSpacing },
|
|
716
729
|
clipData: { id, type, lineSpacing, originClip }
|
|
717
730
|
} = fObj;
|
|
718
|
-
|
|
719
|
-
if (originClip) {
|
|
720
|
-
existClip = originClip;
|
|
721
|
-
} else {
|
|
722
|
-
const editorTrack = this.tracks.find((track) => track.editorType === type);
|
|
723
|
-
existClip = ((editorTrack == null ? void 0 : editorTrack.clips) || []).find((clip) => clip.id === id);
|
|
724
|
-
}
|
|
731
|
+
const [existClip] = this.findClip(id);
|
|
725
732
|
if (existClip) {
|
|
726
733
|
!originClip && (existClip.fObj = fObj);
|
|
727
734
|
if (type === "\u8868\u60C5\u5305") {
|
|
@@ -742,7 +749,6 @@ var VmmlConverter = class {
|
|
|
742
749
|
};
|
|
743
750
|
}
|
|
744
751
|
}
|
|
745
|
-
console.log("updateClip \u6700\u7EC8vmml", this.vmml);
|
|
746
752
|
}
|
|
747
753
|
/**
|
|
748
754
|
* 删除 Clip
|
|
@@ -751,7 +757,13 @@ var VmmlConverter = class {
|
|
|
751
757
|
*/
|
|
752
758
|
deleteClip({ id, type, originClip }) {
|
|
753
759
|
if (originClip) {
|
|
754
|
-
|
|
760
|
+
for (const track of this.tracks) {
|
|
761
|
+
const clip = (track.clips || []).find((c) => c.id === originClip.id);
|
|
762
|
+
if (clip) {
|
|
763
|
+
clip.duration = 0;
|
|
764
|
+
break;
|
|
765
|
+
}
|
|
766
|
+
}
|
|
755
767
|
} else {
|
|
756
768
|
const editorTrack = this.tracks.find((track) => track.editorType === type);
|
|
757
769
|
const index = editorTrack.clips.findIndex((item) => item.id === id);
|
|
@@ -769,7 +781,9 @@ var VmmlConverter = class {
|
|
|
769
781
|
}
|
|
770
782
|
}
|
|
771
783
|
}
|
|
772
|
-
|
|
784
|
+
}
|
|
785
|
+
changeVmml(newVmml) {
|
|
786
|
+
this.vmml = newVmml;
|
|
773
787
|
}
|
|
774
788
|
//切换静音 视频/音频
|
|
775
789
|
changeMute({ id, isMute }) {
|
|
@@ -1056,13 +1070,12 @@ var EditorCanvas = react.forwardRef(
|
|
|
1056
1070
|
if (fc) {
|
|
1057
1071
|
const ns = Math.floor((f ?? frame) / 30 * 1e6);
|
|
1058
1072
|
const objects = fc.getObjects();
|
|
1059
|
-
console.log(objects, "fc>>>>>>>>>>>>>>>>", frame);
|
|
1060
1073
|
objects.forEach((item) => {
|
|
1061
1074
|
var _a, _b, _c;
|
|
1062
1075
|
if (((_a = item == null ? void 0 : item.clipData) == null ? void 0 : _a.type) === "\u6587\u5B57") {
|
|
1063
|
-
item.set("visible", ns >= item.clipData.inPoint && ns < item.clipData.inPoint + (item.clipData.duration || vmml.template.duration));
|
|
1076
|
+
item.set("visible", item.clipData.duration > 0 && ns >= item.clipData.inPoint && ns < item.clipData.inPoint + (item.clipData.duration || vmml.template.duration));
|
|
1064
1077
|
} else {
|
|
1065
|
-
item.set("visible", ns >= item.clipData.inPoint && ns < item.clipData.inPoint + ((_c = (_b = item.clipData) == null ? void 0 : _b.fileUrl) == null ? void 0 : _c.duration));
|
|
1078
|
+
item.set("visible", item.clipData.duration > 0 && ns >= item.clipData.inPoint && ns < item.clipData.inPoint + ((_c = (_b = item.clipData) == null ? void 0 : _b.fileUrl) == null ? void 0 : _c.duration));
|
|
1066
1079
|
}
|
|
1067
1080
|
});
|
|
1068
1081
|
fc.discardActiveObject();
|
|
@@ -1338,7 +1351,7 @@ var EditorCanvas = react.forwardRef(
|
|
|
1338
1351
|
await document.fonts.ready;
|
|
1339
1352
|
}
|
|
1340
1353
|
}
|
|
1341
|
-
const lines = textContent.split("\n");
|
|
1354
|
+
const lines = textContent.split("\n").filter((item) => item);
|
|
1342
1355
|
const lineHeight = 22 + strokeW;
|
|
1343
1356
|
const textHeight = lines.length * lineHeight;
|
|
1344
1357
|
const groupWidth = Math.max(...lines.map((l) => {
|
|
@@ -1762,8 +1775,12 @@ var EditorCanvas = react.forwardRef(
|
|
|
1762
1775
|
}
|
|
1763
1776
|
}, [fc, dragState]);
|
|
1764
1777
|
react.useEffect(() => {
|
|
1765
|
-
if (canvasSize.width && canvasSize.height
|
|
1766
|
-
vmmlConverterRef.current
|
|
1778
|
+
if (canvasSize.width && canvasSize.height) {
|
|
1779
|
+
if (vmmlConverterRef.current) {
|
|
1780
|
+
vmmlConverterRef.current.changeVmml(vmml);
|
|
1781
|
+
} else {
|
|
1782
|
+
vmmlConverterRef.current = new VmmlConverter_default({ vmml, canvasSize });
|
|
1783
|
+
}
|
|
1767
1784
|
}
|
|
1768
1785
|
}, [canvasSize, vmml]);
|
|
1769
1786
|
react.useEffect(() => {
|