daily-video-editor 0.1.5 → 0.1.7

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.
Files changed (58) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +117 -0
  3. package/dist/algorithm/transitions/crossfade.wasm +0 -0
  4. package/dist/clip-track/components/Ruler/index.vue.d.ts +1 -3
  5. package/dist/clip-track/components/ToolsBar/index.vue.d.ts +0 -4
  6. package/dist/clip-track/components/Tracks/TrackArea.vue.d.ts +4 -2
  7. package/dist/clip-track/components/Tracks/index.vue.d.ts +12 -2
  8. package/dist/clip-track/components/index.vue.d.ts +71 -4
  9. package/dist/clip-track/composables/useKeyboard.d.ts +4 -0
  10. package/dist/clip-track/stores/history.d.ts +10 -1
  11. package/dist/clip-track/stores/playback.d.ts +29 -15
  12. package/dist/clip-track/stores/tracks.d.ts +100 -1
  13. package/dist/clip-track/types/track.d.ts +3 -0
  14. package/dist/crossfade-D3gimDxx.js +8 -0
  15. package/dist/editor/VideoComposeEditor.vue.d.ts +276 -84
  16. package/dist/editor/asset-panel/VideoComposeAssetPanel.vue.d.ts +2 -0
  17. package/dist/editor/asset-panel/VideoComposeTransitionCatalog.vue.d.ts +10 -0
  18. package/dist/editor/composeRuntime.d.ts +5 -0
  19. package/dist/editor/player/VideoComposePlayer.vue.d.ts +12 -6
  20. package/dist/editor/session/createComposeEditorState.d.ts +11 -11
  21. package/dist/editor/session/ports.d.ts +0 -2
  22. package/dist/editor/session/useComposeEditorSession.d.ts +275 -89
  23. package/dist/editor/session/useComposePlaybackBridge.d.ts +4 -5
  24. package/dist/editor/session/useComposeVideoFrame.d.ts +2 -1
  25. package/dist/editor/timeline/ComposeTransitionHandles.vue.d.ts +19 -0
  26. package/dist/editor/timeline/VideoComposeTimeline.vue.d.ts +215 -31
  27. package/dist/editor/timeline/VideoComposeZoomBar.vue.d.ts +2 -2
  28. package/dist/editor/timeline/useTimelineTransitions.d.ts +21 -0
  29. package/dist/gpuPixelPreview-BH4LceX_.js +93 -0
  30. package/dist/hooks/composeFrameProcessor.d.ts +32 -0
  31. package/dist/hooks/previewAudioMixer.d.ts +9 -1
  32. package/dist/hooks/previewCanvasFrame.d.ts +8 -0
  33. package/dist/hooks/previewFrameScheduler.d.ts +35 -0
  34. package/dist/hooks/previewPlaybackClock.d.ts +3 -0
  35. package/dist/hooks/previewSourceTime.d.ts +3 -1
  36. package/dist/hooks/previewVideoDecoder.d.ts +22 -0
  37. package/dist/hooks/previewVideoFrame.d.ts +8 -0
  38. package/dist/hooks/useComposePreviewFrame.d.ts +17 -21
  39. package/dist/hooks/useVideoComposePreview.d.ts +54 -33
  40. package/dist/index-B1CcvzDG.js +33745 -0
  41. package/dist/index.d.ts +5 -0
  42. package/dist/index.js +12 -37738
  43. package/dist/style.css +1 -1
  44. package/dist/transitions/algorithms/crossfade.d.ts +3 -0
  45. package/dist/transitions/catalog.d.ts +6 -0
  46. package/dist/transitions/engine.d.ts +20 -0
  47. package/dist/transitions/registry.d.ts +14 -0
  48. package/dist/transitions/timing.d.ts +13 -0
  49. package/dist/transitions/wasmAdapter.d.ts +3 -0
  50. package/dist/types/beautyPreview.d.ts +48 -55
  51. package/dist/types/previewPlayback.d.ts +91 -0
  52. package/dist/types/transition.d.ts +122 -0
  53. package/dist/types/videoCompose.d.ts +3 -0
  54. package/dist/utils/beauty/gpuPixelPreview.d.ts +4 -6
  55. package/dist/workers/beauty/copyFrameRgba.d.ts +4 -6
  56. package/dist/workers/beauty/facePass.d.ts +5 -2
  57. package/package.json +9 -3
  58. package/dist/workers/beauty/decodeSession.d.ts +0 -30
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -124,6 +124,123 @@ createApp(App).mount("#app");
124
124
 
125
125
  可用 `createDefaultVideoComposeEditorModel({ bizType, bizId })` 创建空工程。
126
126
 
127
+ ### 主视频轨转场
128
+
129
+ 左侧「转场」提供基础淡化。卡片可拖至主轨接缝,也可选中相邻视频后双击应用;接缝双竖线手柄可修改时长或删除转场。
130
+ 转场默认 1 秒,以切点居中,不改变片段位置或工程总时长。仅混合视频画面,原声仍在切点切换;两侧各自的美颜和画面变换会先处理再淡化。
131
+
132
+ 配置保存在 `modelValue.tracks[].transitions`,随撤销重做、`reload()` 和 `exportComposePayload()` 一起读写:
133
+
134
+ ```ts
135
+ transitions: [
136
+ {
137
+ id: "transition-1",
138
+ clipAId: "video-a",
139
+ clipBId: "video-b",
140
+ effectId: "crossfade",
141
+ durationSec: 1,
142
+ params: { curve: "linear" },
143
+ },
144
+ ];
145
+ ```
146
+
147
+ 旧工程缺省为空;关联视频不再相邻时清理转场,缩短片段时自动限制转场时长。实际成片服务由宿主消费该字段,本库不执行服务端渲染。
148
+
149
+ 绘制驱动 `TransitionEngine` 与算法通过 `TransitionRegistry` 解耦。内置目录位于 `src/transitions/catalog.ts`;新增算法实现
150
+ `TransitionAlgorithm` 并在目录注册描述及 `load()`,素材面板与手柄菜单从该目录读取,不必修改引擎分发。
151
+ 外部可使用导出的引擎、注册表和类型独立集成;引擎返回的 Canvas 为复用缓冲,需要保存跨帧结果时调用 `renderBitmap()`。
152
+
153
+ Canvas 为默认后端。宿主可通过 `<VideoComposeEditor v-model="model" transition-backend="wasm" />` 使用内置淡化 WASM;
154
+ 独立使用时调用 `new TransitionEngine(createTransitionRegistry({ backend: "wasm" }))`。后端在挂载/创建注册表时固定,切换时需重建;
155
+ `effectId`、参数与工程数据不变。预热和渲染共用编辑器注册表,WASM 首次使用时加载,失败沿用现有错误处理(预览提示并回退普通画面)。
156
+
157
+ 宿主可通过 `transitionEffects` 追加自定义转场。素材栏、缩略图、接缝菜单、时间轴命令、预热与播放器共用编辑器注册表,
158
+ 保留内置效果并按传入顺序追加;重复 ID(包括内置 ID)报错。后端与效果列表均在挂载时固定,变更时需重新挂载编辑器。
159
+
160
+ ```vue
161
+ <VideoComposeEditor v-model="model" :transition-effects="hostTransitions" />
162
+ ```
163
+
164
+ Canvas 算法示例(使用包根导出的类型):
165
+
166
+ ```ts
167
+ import type { TransitionAlgorithm, TransitionEffectDefinition } from "daily-video-editor";
168
+
169
+ const hostTransitions: readonly TransitionEffectDefinition[] = [
170
+ {
171
+ id: "host-wipe",
172
+ name: "向右擦除",
173
+ description: "入场画面从左向右覆盖离场画面",
174
+ defaultParams: {},
175
+ /** 当前效果无需专属参数。 */
176
+ normalizeParams(): Record<string, unknown> {
177
+ return {};
178
+ },
179
+ /** 首次生成缩略图或播放时加载;实例内的 render 应支持重入。 */
180
+ async load(): Promise<TransitionAlgorithm> {
181
+ return {
182
+ /** 输入已完成画面变换,进度已缓动,绘制状态由引擎隔离。 */
183
+ render({ ctx, outgoing, incoming, width, height, progress }): void {
184
+ ctx.drawImage(outgoing, 0, 0, width, height);
185
+ ctx.beginPath();
186
+ ctx.rect(0, 0, width * progress, height);
187
+ ctx.clip();
188
+ ctx.drawImage(incoming, 0, 0, width, height);
189
+ },
190
+ };
191
+ },
192
+ },
193
+ ];
194
+ ```
195
+
196
+ 宿主 WASM 算法使用相同定义,将 `load` 替换为适配器调用,并使用独立 ID:
197
+
198
+ ```ts
199
+ import { loadWasmTransitionAlgorithm } from "daily-video-editor";
200
+
201
+ const hostWasmTransition: TransitionEffectDefinition = {
202
+ ...hostTransitions[0],
203
+ id: "host-wasm-fade",
204
+ name: "宿主淡化",
205
+ description: "使用宿主提供的 WASM 混合两帧",
206
+ load: () => loadWasmTransitionAlgorithm("/custom-transitions/fade.wasm"),
207
+ };
208
+ ```
209
+
210
+ `transitionBackend` 仅选择内置效果的实现;宿主效果始终使用自身的 `load()`。独立使用引擎时可调用
211
+ `new TransitionEngine(createTransitionRegistry({ effects: hostTransitions }))`,也可继续手动 `registry.register()`。
212
+ 注册和 `list()` 查询不加载算法;素材卡片生成缩略图属于首次实际使用,会触发 `load()`。同一注册表缓存同一效果的加载结果,
213
+ 宿主异步算法须支持多个引擎调用同一实例,不得在渲染结束后保留调用方的画面或上下文;独立引擎仍依赖浏览器 Canvas API。
214
+ 工程仅保存效果 ID、时长和可序列化参数,重载时宿主须再次提供对应定义;缺失算法保留工程配置,并沿用普通画面降级提示。
215
+
216
+ 适配器 `loadWasmTransitionAlgorithm(url)` 可在自定义效果的 `load()` 中使用。模块不得依赖宿主导入,并须导出:
217
+
218
+ - `memory`:wasm32 线性内存。
219
+ - `__heap_base`:栈和静态数据之后的首个可用地址。该地址之后的空间由适配器保留,内核不得另行分配或增长内存。
220
+ - `render(a, b, output, width, height, progress, params, paramsLength): i32`:成功返回 0;其他返回值视为失败。
221
+
222
+ 地址、尺寸和参数长度均为 `i32`,`progress` 为已经缓动的 `f64`。图像是自左上至右下、每行 `width * 4` 字节的
223
+ **非预乘 sRGB RGBA8**;参数为 UTF-8 JSON。适配器负责 Canvas 像素读写和缓冲复用,内核负责预乘颜色混合与反预乘输出。
224
+ 内置淡化采用 Q16 权重与整数舍入;它与 Canvas 的量化方式可能略有差异,不承诺逐字节相同。
225
+ 后端直接调用时,从 `__heap_base` 起为 A、B、输出各保留 `width * height * 4` 字节,再放参数;
226
+ 调用前通过 `memory.grow()` 按 65536 字节一页补足内存,之后复用缓冲。
227
+
228
+ 内置源码为 `src/transitions/wasm/crossfade.c`,仓库包含对应 `.wasm`,使用现有产物不需要安装编译器。
229
+ 重新编译需支持 wasm32 的 LLVM Clang(Emscripten SDK 自带),在 PowerShell 执行:
230
+
231
+ ```powershell
232
+ $env:WASM_CLANG = "D:\CODE\emsdk\upstream\bin\clang.exe"
233
+ pnpm run build:transitions-wasm
234
+ ```
235
+
236
+ 库构建将 WASM 随浏览器代码打包,并额外输出 `dist/algorithm/transitions/crossfade.wasm`;包子路径
237
+ `daily-video-editor/transitions/crossfade.wasm` 指向该独立产物。后端可在无浏览器的 WASM 运行时执行相同 ABI,
238
+ 将 FFmpeg 解码的 RGBA 帧传入内核,再把输出交给 FFmpeg 编码;本库未实现 FFmpeg 桥接。
239
+ 严格对照还需统一源帧、缓动、色彩转换、美颜、变换与输出尺寸。
240
+
241
+ 开发验证:`pnpm test`、`pnpm typecheck`。真实浏览器验证先启动 `pnpm exec vite --host 127.0.0.1 --port 5175 --strictPort`,再运行
242
+ `node tests/browser-transitions.mjs`;默认使用本机 Edge,可通过 `TRANSITION_TEST_BROWSER` 指定 Chromium 可执行文件。
243
+
127
244
  ---
128
245
 
129
246
  ## 组件 Ref 方法(`VideoComposeEditorExpose`)
@@ -7,13 +7,11 @@ declare const _default: import('vue').DefineComponent<Props, {
7
7
  isDraggingCursor: import('vue').Ref<boolean, boolean>;
8
8
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
9
9
  scroll: (left: number) => any;
10
- seek: (time: number) => any;
11
10
  }, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
12
11
  onScroll?: ((left: number) => any) | undefined;
13
- onSeek?: ((time: number) => any) | undefined;
14
12
  }>, {
15
- scrollLeft: number;
16
13
  width: number;
14
+ scrollLeft: number;
17
15
  trackControlWidth: number;
18
16
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
19
17
  rulerRef: HTMLDivElement;
@@ -24,12 +24,8 @@ declare function __VLS_template(): {
24
24
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
25
25
  declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
26
26
  operation: (operation: string) => any;
27
- "playback:play": () => any;
28
- "playback:pause": () => any;
29
27
  }, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
30
28
  onOperation?: ((operation: string) => any) | undefined;
31
- "onPlayback:play"?: (() => any) | undefined;
32
- "onPlayback:pause"?: (() => any) | undefined;
33
29
  }>, {
34
30
  operationButtons: OperationButton[];
35
31
  scaleConfigButtons: ScaleConfigButton[];
@@ -10,6 +10,10 @@ declare function __VLS_template(): {
10
10
  clip: Clip;
11
11
  track: Track;
12
12
  }): any;
13
+ 'track-overlay'?(_: {
14
+ track: Track;
15
+ pixelsPerSecond: number;
16
+ }): any;
13
17
  };
14
18
  refs: {
15
19
  trackAreaRef: HTMLDivElement;
@@ -19,7 +23,6 @@ declare function __VLS_template(): {
19
23
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
20
24
  declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
21
25
  scroll: (left: number) => any;
22
- seek: (time: number) => any;
23
26
  contextMenu: (clip: Clip, event: MouseEvent) => any;
24
27
  addTransition: (beforeClipId: string, afterClipId: string) => any;
25
28
  trackContextMenu: (track: Track, time: number, event: MouseEvent) => any;
@@ -27,7 +30,6 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
27
30
  "clip:dblclick": (clip: Clip, time: number) => any;
28
31
  }, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
29
32
  onScroll?: ((left: number) => any) | undefined;
30
- onSeek?: ((time: number) => any) | undefined;
31
33
  onContextMenu?: ((clip: Clip, event: MouseEvent) => any) | undefined;
32
34
  onAddTransition?: ((beforeClipId: string, afterClipId: string) => any) | undefined;
33
35
  onTrackContextMenu?: ((track: Track, time: number, event: MouseEvent) => any) | undefined;
@@ -9,6 +9,14 @@ declare function __VLS_template(): {
9
9
  slots: {
10
10
  'track-control'?(_: {
11
11
  track: {
12
+ transitions?: {
13
+ id: string;
14
+ clipAId: string;
15
+ clipBId: string;
16
+ effectId: string;
17
+ durationSec: number;
18
+ params: Record<string, unknown>;
19
+ }[] | undefined;
12
20
  id: string;
13
21
  type: import('../..').TrackType;
14
22
  name: string;
@@ -308,6 +316,10 @@ declare function __VLS_template(): {
308
316
  clip: import('../..').Clip;
309
317
  track: Track;
310
318
  }): any;
319
+ 'track-overlay'?(_: {
320
+ track: Track;
321
+ pixelsPerSecond: number;
322
+ }): any;
311
323
  };
312
324
  refs: {
313
325
  tracksRef: HTMLDivElement;
@@ -319,7 +331,6 @@ declare function __VLS_template(): {
319
331
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
320
332
  declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
321
333
  scroll: (left: number) => any;
322
- seek: (time: number) => any;
323
334
  contextMenu: (clip: any, event: MouseEvent) => any;
324
335
  addTransition: (beforeClipId: string, afterClipId: string) => any;
325
336
  trackContextMenu: (track: Track, time: number, event: MouseEvent) => any;
@@ -329,7 +340,6 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
329
340
  "update:trackControlWidth": (width: number) => any;
330
341
  }, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
331
342
  onScroll?: ((left: number) => any) | undefined;
332
- onSeek?: ((time: number) => any) | undefined;
333
343
  onContextMenu?: ((clip: any, event: MouseEvent) => any) | undefined;
334
344
  onAddTransition?: ((beforeClipId: string, afterClipId: string) => any) | undefined;
335
345
  onTrackContextMenu?: ((track: Track, time: number, event: MouseEvent) => any) | undefined;
@@ -1,7 +1,10 @@
1
1
  import { nextTick } from 'vue';
2
+ import { PreviewPlaybackClock, TimelinePlaybackCommand } from '../../types/previewPlayback';
2
3
  import { OperationButton, ScaleConfigButton, TrackTypeConfig, ClipTypeConfig, TrackContextMenuConfig, ClipContextMenuConfig, ContextMenuItem, Track, LocaleConfig, ThemeConfig } from '../types';
3
4
  /** 时间轴组件入参 */
4
5
  export interface Props {
6
+ /** 可选的只读预览时钟;提供后时间轴只发送控制请求。 */
7
+ playbackClock?: Readonly<PreviewPlaybackClock>;
5
8
  operationButtons?: OperationButton[];
6
9
  scaleConfigButtons?: ScaleConfigButton[];
7
10
  trackTypes?: TrackTypeConfig;
@@ -67,6 +70,14 @@ declare function addTrack(track: Track): boolean;
67
70
  declare function removeTrack(trackId: string): void;
68
71
  declare function updateTrack(trackId: string, updates: Partial<Track>): void;
69
72
  declare function getTracks(): {
73
+ transitions?: {
74
+ id: string;
75
+ clipAId: string;
76
+ clipBId: string;
77
+ effectId: string;
78
+ durationSec: number;
79
+ params: Record<string, unknown>;
80
+ }[] | undefined;
70
81
  id: string;
71
82
  type: import('..').TrackType;
72
83
  name: string;
@@ -362,6 +373,14 @@ declare function getTracks(): {
362
373
  order: number;
363
374
  }[];
364
375
  declare function getSortedTracks(): {
376
+ transitions?: {
377
+ id: string;
378
+ clipAId: string;
379
+ clipBId: string;
380
+ effectId: string;
381
+ durationSec: number;
382
+ params: Record<string, unknown>;
383
+ }[] | undefined;
365
384
  id: string;
366
385
  type: import('..').TrackType;
367
386
  name: string;
@@ -657,6 +676,14 @@ declare function getSortedTracks(): {
657
676
  order: number;
658
677
  }[];
659
678
  declare function getTrackById(trackId: string): {
679
+ transitions?: {
680
+ id: string;
681
+ clipAId: string;
682
+ clipBId: string;
683
+ effectId: string;
684
+ durationSec: number;
685
+ params: Record<string, unknown>;
686
+ }[] | undefined;
660
687
  id: string;
661
688
  type: import('..').TrackType;
662
689
  name: string;
@@ -952,6 +979,14 @@ declare function getTrackById(trackId: string): {
952
979
  order: number;
953
980
  } | undefined;
954
981
  declare function getMainTrack(): {
982
+ transitions?: {
983
+ id: string;
984
+ clipAId: string;
985
+ clipBId: string;
986
+ effectId: string;
987
+ durationSec: number;
988
+ params: Record<string, unknown>;
989
+ }[] | undefined;
955
990
  id: string;
956
991
  type: import('..').TrackType;
957
992
  name: string;
@@ -1277,11 +1312,19 @@ declare function selectClips(clipIds: string[]): void;
1277
1312
  declare function clearSelection(): void;
1278
1313
  declare function getSelectedClips(): import('..').Clip[];
1279
1314
  declare function getSelectedClipIds(): string[];
1315
+ /** 公开播放 API 与工具栏使用同一命令出口。 */
1280
1316
  declare function play(): void;
1317
+ /** 公开暂停 API 不回写时间轴游标。 */
1281
1318
  declare function pause(): void;
1319
+ /** 切换播放意图,最终状态由绑定的时钟反馈。 */
1282
1320
  declare function togglePlay(): void;
1321
+ /** 公开定位 API 只请求目标,不提前修改受控时间轴显示。 */
1283
1322
  declare function seekTo(time: number): void;
1323
+ /** 分割、裁剪和粘贴位置使用已展示时间。 */
1284
1324
  declare function getCurrentTime(): number;
1325
+ /** 连续步进使用尚未完成的目标,编辑操作仍读取 getCurrentTime。 */
1326
+ declare function getRequestedTime(): number;
1327
+ /** 公开倍速 API 交给当前播放协调器。 */
1285
1328
  declare function setPlaybackRate(rate: number): void;
1286
1329
  declare function getPlaybackRate(): number;
1287
1330
  declare function isPlaying(): boolean;
@@ -1299,6 +1342,12 @@ declare function getHistoryState(): {
1299
1342
  };
1300
1343
  declare function undo(): void;
1301
1344
  declare function redo(): void;
1345
+ /** 开始合并历史:其间 add/update/remove 的 pushSnapshot 不入栈 */
1346
+ declare function beginHistoryBatch(description?: string): void;
1347
+ /** 结束合并并提交一条快照 */
1348
+ declare function endHistoryBatch(description?: string): void;
1349
+ /** 回调内不写历史(空轨清理等) */
1350
+ declare function runWithoutHistory(fn: () => void): void;
1302
1351
  declare function __VLS_template(): {
1303
1352
  attrs: Partial<{}>;
1304
1353
  slots: Partial<Record<string, (_: any) => any>> & Partial<Record<string, (_: any) => any>> & {
@@ -1315,6 +1364,14 @@ declare function __VLS_template(): {
1315
1364
  'tracks-before'?(_: {}): any;
1316
1365
  'track-control'?(_: {
1317
1366
  track: {
1367
+ transitions?: {
1368
+ id: string;
1369
+ clipAId: string;
1370
+ clipBId: string;
1371
+ effectId: string;
1372
+ durationSec: number;
1373
+ params: Record<string, unknown>;
1374
+ }[] | undefined;
1318
1375
  id: string;
1319
1376
  type: import('..').TrackType;
1320
1377
  name: string;
@@ -1611,6 +1668,10 @@ declare function __VLS_template(): {
1611
1668
  };
1612
1669
  }): any;
1613
1670
  'track-area'?(_: any): any;
1671
+ 'track-overlay'?(_: {
1672
+ track: Track;
1673
+ pixelsPerSecond: number;
1674
+ }): any;
1614
1675
  'clip-content'?(_: {
1615
1676
  clip: import('..').Clip;
1616
1677
  track: Track;
@@ -1726,6 +1787,7 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {
1726
1787
  togglePlay: typeof togglePlay;
1727
1788
  seekTo: typeof seekTo;
1728
1789
  getCurrentTime: typeof getCurrentTime;
1790
+ getRequestedTime: typeof getRequestedTime;
1729
1791
  setPlaybackRate: typeof setPlaybackRate;
1730
1792
  getPlaybackRate: typeof getPlaybackRate;
1731
1793
  isPlaying: typeof isPlaying;
@@ -1743,10 +1805,11 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {
1743
1805
  undo: typeof undo;
1744
1806
  redo: typeof redo;
1745
1807
  getHistoryState: typeof getHistoryState;
1808
+ beginHistoryBatch: typeof beginHistoryBatch;
1809
+ endHistoryBatch: typeof endHistoryBatch;
1810
+ runWithoutHistory: typeof runWithoutHistory;
1746
1811
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
1747
1812
  scroll: (left: number) => any;
1748
- "playback:play": () => any;
1749
- "playback:pause": () => any;
1750
1813
  addTransition: (beforeClipId: string, afterClipId: string) => any;
1751
1814
  dropMedia: (mediaData: any, trackId: string, startTime: number) => any;
1752
1815
  "clip:dblclick": (clip: any, time: number) => any;
@@ -1770,6 +1833,9 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {
1770
1833
  "track:removed": (track: Track) => any;
1771
1834
  "track:updated": (trackId: string, changes: any) => any;
1772
1835
  "selection:changed": (selectedClipIds: string[], previousIds: string[]) => any;
1836
+ "playback:command": (command: TimelinePlaybackCommand) => any;
1837
+ "playback:play": () => any;
1838
+ "playback:pause": () => any;
1773
1839
  "playback:seek": (time: number) => any;
1774
1840
  "playback:timeupdate": (time: number) => any;
1775
1841
  "playback:ratechange": (rate: number) => any;
@@ -1785,8 +1851,6 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {
1785
1851
  "data:changed": () => any;
1786
1852
  }, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
1787
1853
  onScroll?: ((left: number) => any) | undefined;
1788
- "onPlayback:play"?: (() => any) | undefined;
1789
- "onPlayback:pause"?: (() => any) | undefined;
1790
1854
  onAddTransition?: ((beforeClipId: string, afterClipId: string) => any) | undefined;
1791
1855
  onDropMedia?: ((mediaData: any, trackId: string, startTime: number) => any) | undefined;
1792
1856
  "onClip:dblclick"?: ((clip: any, time: number) => any) | undefined;
@@ -1810,6 +1874,9 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {
1810
1874
  "onTrack:removed"?: ((track: Track) => any) | undefined;
1811
1875
  "onTrack:updated"?: ((trackId: string, changes: any) => any) | undefined;
1812
1876
  "onSelection:changed"?: ((selectedClipIds: string[], previousIds: string[]) => any) | undefined;
1877
+ "onPlayback:command"?: ((command: TimelinePlaybackCommand) => any) | undefined;
1878
+ "onPlayback:play"?: (() => any) | undefined;
1879
+ "onPlayback:pause"?: (() => any) | undefined;
1813
1880
  "onPlayback:seek"?: ((time: number) => any) | undefined;
1814
1881
  "onPlayback:timeupdate"?: ((time: number) => any) | undefined;
1815
1882
  "onPlayback:ratechange"?: ((rate: number) => any) | undefined;
@@ -7,6 +7,10 @@ interface KeyboardCallbacks {
7
7
  onPaste?: (clips: any[], trackId: string, time: number) => void;
8
8
  onPlay?: () => void;
9
9
  onPause?: () => void;
10
+ /** 撤销后回调(用于向外同步 history:changed) */
11
+ onUndo?: () => void;
12
+ /** 重做后回调 */
13
+ onRedo?: () => void;
10
14
  }
11
15
  interface UseKeyboardOptions {
12
16
  containerRef?: Ref<HTMLElement | undefined>;
@@ -17,6 +17,9 @@ export declare const useHistoryStore: import('pinia').StoreDefinition<"history",
17
17
  canRedo: import('vue').ComputedRef<boolean>;
18
18
  createSnapshot: (description?: string) => HistoryItem;
19
19
  pushSnapshot: (description?: string) => void;
20
+ beginHistoryBatch: (description?: string) => void;
21
+ endHistoryBatch: (description?: string) => void;
22
+ runWithoutHistory: (fn: () => void) => void;
20
23
  restoreSnapshot: (snapshot: HistoryItem) => void;
21
24
  undo: () => void;
22
25
  redo: () => void;
@@ -41,6 +44,9 @@ export declare const useHistoryStore: import('pinia').StoreDefinition<"history",
41
44
  canRedo: import('vue').ComputedRef<boolean>;
42
45
  createSnapshot: (description?: string) => HistoryItem;
43
46
  pushSnapshot: (description?: string) => void;
47
+ beginHistoryBatch: (description?: string) => void;
48
+ endHistoryBatch: (description?: string) => void;
49
+ runWithoutHistory: (fn: () => void) => void;
44
50
  restoreSnapshot: (snapshot: HistoryItem) => void;
45
51
  undo: () => void;
46
52
  redo: () => void;
@@ -65,10 +71,13 @@ export declare const useHistoryStore: import('pinia').StoreDefinition<"history",
65
71
  canRedo: import('vue').ComputedRef<boolean>;
66
72
  createSnapshot: (description?: string) => HistoryItem;
67
73
  pushSnapshot: (description?: string) => void;
74
+ beginHistoryBatch: (description?: string) => void;
75
+ endHistoryBatch: (description?: string) => void;
76
+ runWithoutHistory: (fn: () => void) => void;
68
77
  restoreSnapshot: (snapshot: HistoryItem) => void;
69
78
  undo: () => void;
70
79
  redo: () => void;
71
80
  initialize: () => void;
72
81
  clear: () => void;
73
82
  reset: () => void;
74
- }, "reset" | "undo" | "redo" | "clear" | "createSnapshot" | "pushSnapshot" | "restoreSnapshot" | "initialize">>;
83
+ }, "reset" | "undo" | "redo" | "clear" | "createSnapshot" | "pushSnapshot" | "beginHistoryBatch" | "endHistoryBatch" | "runWithoutHistory" | "restoreSnapshot" | "initialize">>;