@versa_ai/vmml-editor 1.0.51 → 1.0.52

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @versa_ai/vmml-editor@1.0.51 build D:\code\work\vmml-player\packages\editor
2
+ > @versa_ai/vmml-editor@1.0.52 build D:\code\work\vmml-player\packages\editor
3
3
  > tsup
4
4
 
5
5
  CLI Building entry: src/index.tsx
@@ -17,7 +17,6 @@ Recommendation: math.div($px, 750) or calc($px / 750)
17
17
  More info and automated migrator: https://sass-lang.com/d/slash-div [plugin sass-plugin]
18
18
 
19
19
  src/assets/css/colorSelector.scss:4:9:
20
- DTS Build start
21
20
   4 │ $px / 750
22
21
  ╵ ^
23
22
 
@@ -67,6 +66,7 @@ More info and automated migrator: https://sass-lang.com/d/slash-div [35
67
66
 
68
67
 
69
68
 
69
+ DTS Build start
70
70
 
71
71
   WARN  ▲ [WARNING] Using / 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 [35
124
124
 
125
125
 
126
126
 
127
- CJS dist\index.js 121.84 KB
128
- CJS dist\index.js.map 233.86 KB
129
- CJS ⚡️ Build success in 997ms
130
- ESM dist\index.mjs 119.97 KB
131
- ESM dist\index.mjs.map 233.56 KB
132
- ESM ⚡️ Build success in 998ms
133
- DTS ⚡️ Build success in 2081ms
127
+ CJS dist\index.js 121.78 KB
128
+ CJS dist\index.js.map 233.41 KB
129
+ CJS ⚡️ Build success in 673ms
130
+ ESM dist\index.mjs 119.91 KB
131
+ ESM dist\index.mjs.map 233.11 KB
132
+ ESM ⚡️ Build success in 674ms
133
+ DTS ⚡️ Build success in 1560ms
134
134
  DTS dist\index.d.ts 158.00 B
135
135
  DTS dist\index.d.mts 158.00 B
package/dist/index.js CHANGED
@@ -681,6 +681,7 @@ var VmmlConverter = class {
681
681
  } else {
682
682
  editorTrack.clips.push(tClipData);
683
683
  }
684
+ this.updateVmml(this.vmml);
684
685
  }
685
686
  /**
686
687
  * 转换 VideoClip
@@ -748,29 +749,6 @@ var VmmlConverter = class {
748
749
  }
749
750
  }
750
751
  }
751
- updateTextClip(fObj, duration) {
752
- const posParam = this.setPosParam(fObj);
753
- const {
754
- clipData: { id }
755
- } = fObj;
756
- const [existClip] = this.findClip(id);
757
- if (existClip) {
758
- const { clipData: { text, textColor, bgColor } } = fObj;
759
- const scale = this.fontSize / 22;
760
- existClip.duration = duration;
761
- existClip.textClip = {
762
- ...existClip.textClip,
763
- posParam,
764
- backgroundColor: this.toARGB(bgColor),
765
- textContent: text,
766
- textColor: this.toARGB(textColor),
767
- dimension: {
768
- width: Math.floor(fObj.width * scale),
769
- height: Math.floor(fObj.height * scale)
770
- }
771
- };
772
- }
773
- }
774
752
  /**
775
753
  * 删除 Clip
776
754
  * @param id - 实例 id
@@ -1041,7 +1019,7 @@ function usePeekControl(canvas, hideConfig) {
1041
1019
  return canvas;
1042
1020
  }
1043
1021
  var EditorCanvas = react.forwardRef(
1044
- ({ previewState, showCanvas, canvasSize, enterPreview, intoTextEdit, frame, vmml, dragState, initFcObjs, editClips = [], onVideoChange, isBatchModify, hideConfig, textWarapCenter }, ref) => {
1022
+ ({ previewState, showCanvas, canvasSize, enterPreview, intoTextEdit, frame, vmml, dragState, initFcObjs, editClips = [], onVideoChange, isBatchModify, hideConfig, textWarapCenter, updateVmml }, ref) => {
1045
1023
  const [fc, setFc] = react.useState(null);
1046
1024
  const [history, setHistory] = react.useState(null);
1047
1025
  const [canvasReady, setCanvasReady] = react.useState(false);
@@ -1317,7 +1295,7 @@ var EditorCanvas = react.forwardRef(
1317
1295
  history.undo();
1318
1296
  };
1319
1297
  const onBatchModify = (fObj, canvas) => {
1320
- var _a;
1298
+ var _a, _b;
1321
1299
  if (!canvas) return;
1322
1300
  const textObjects = canvas.getObjects().filter((item) => {
1323
1301
  var _a2;
@@ -1337,9 +1315,10 @@ var EditorCanvas = react.forwardRef(
1337
1315
  vmmlConverterRef.current.updateClip(updatedFObj);
1338
1316
  });
1339
1317
  canvas.renderAll();
1318
+ updateVmml((_a = vmmlConverterRef.current) == null ? void 0 : _a.vmml);
1340
1319
  const event = new CustomEvent("editor-vmml-batch-change", {
1341
1320
  detail: {
1342
- vmml: ((_a = vmmlConverterRef.current) == null ? void 0 : _a.vmml) ?? null
1321
+ vmml: ((_b = vmmlConverterRef.current) == null ? void 0 : _b.vmml) ?? null
1343
1322
  }
1344
1323
  });
1345
1324
  window.dispatchEvent(event);
@@ -1484,6 +1463,7 @@ var EditorCanvas = react.forwardRef(
1484
1463
  options.transform.target.isSelected = 0;
1485
1464
  });
1486
1465
  group.on("modified", () => {
1466
+ var _a;
1487
1467
  const fObj = convertToJSON(group);
1488
1468
  if (fObj.clipData.isAiError) {
1489
1469
  fObj.clipData.textColor = "rgba(0, 0, 0, 0)";
@@ -1492,6 +1472,7 @@ var EditorCanvas = react.forwardRef(
1492
1472
  onBatchModify(fObj, canvas);
1493
1473
  } else {
1494
1474
  vmmlConverterRef.current.updateClip(fObj);
1475
+ updateVmml((_a = vmmlConverterRef.current) == null ? void 0 : _a.vmml);
1495
1476
  }
1496
1477
  });
1497
1478
  resolve(group);
@@ -2604,12 +2585,12 @@ var EditorFn = ({
2604
2585
  }
2605
2586
  };
2606
2587
  const onControlsClick = () => {
2607
- setPreviewState(true);
2608
2588
  if (previewState) {
2609
2589
  const { current } = vmmlPlayerRef;
2610
2590
  current.unmute();
2611
2591
  current.play();
2612
2592
  } else {
2593
+ setPreviewState(true);
2613
2594
  setMenuState("");
2614
2595
  }
2615
2596
  };
@@ -2982,6 +2963,14 @@ var EditorFn = ({
2982
2963
  }
2983
2964
  return {};
2984
2965
  }, [loading]);
2966
+ const updateVmml = (vmml) => {
2967
+ var _a2, _b;
2968
+ const { current } = vmmlPlayerRef;
2969
+ if (!current) return;
2970
+ const playing = ((_b = (_a2 = current == null ? void 0 : current.playerRef) == null ? void 0 : _a2.isPlaying) == null ? void 0 : _b.call(_a2)) ?? false;
2971
+ if (!playing) needPlay.current = false;
2972
+ current.setVmml(vmml, frame, false);
2973
+ };
2985
2974
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2986
2975
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "editor", style: { height }, children: [
2987
2976
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "editor-vessel", onClick: () => {
@@ -3021,7 +3010,8 @@ var EditorFn = ({
3021
3010
  onVideoChange,
3022
3011
  isBatchModify,
3023
3012
  hideConfig,
3024
- textWarapCenter
3013
+ textWarapCenter,
3014
+ updateVmml
3025
3015
  }
3026
3016
  ),
3027
3017
  /* @__PURE__ */ jsxRuntime.jsx(Loading_default, { show: loading })