@aicut/vue 0.4.3 → 0.6.0
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/README.md +132 -2
- package/dist/VideoEditor.vue.d.ts +48 -1
- package/dist/VideoEditor.vue.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +118 -61
- package/dist/index.js.map +1 -1
- package/dist/webcodecs.cjs +2 -0
- package/dist/webcodecs.cjs.map +1 -0
- package/dist/webcodecs.d.ts +10 -0
- package/dist/webcodecs.d.ts.map +1 -0
- package/dist/webcodecs.js +7 -0
- package/dist/webcodecs.js.map +1 -0
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -74,8 +74,16 @@ editor.value?.api()?.setProject(saved);
|
|
|
74
74
|
```ts
|
|
75
75
|
interface VideoEditorProps {
|
|
76
76
|
defaultProject?: Project;
|
|
77
|
-
theme?: Theme;
|
|
78
|
-
locale?: Partial<Locale>;
|
|
77
|
+
theme?: Theme; // CSS-var overrides; reactive
|
|
78
|
+
locale?: Partial<Locale>; // EN default; pass localeZh for ZH; reactive
|
|
79
|
+
|
|
80
|
+
playbackEngine?: PlaybackEngineFactory; // pluggable playback; default
|
|
81
|
+
// HtmlVideoEngine. Bound at mount.
|
|
82
|
+
timelineHeight?: number; // outer height of bottom area
|
|
83
|
+
// (default 240). Reactive.
|
|
84
|
+
trackHeight?: number; // per-row height (default 56);
|
|
85
|
+
// process-wide, initial-only.
|
|
86
|
+
rulerHeight?: number; // time-label strip (default 24).
|
|
79
87
|
}
|
|
80
88
|
```
|
|
81
89
|
|
|
@@ -146,6 +154,128 @@ const locale = computed<Locale>(() =>
|
|
|
146
154
|
|
|
147
155
|
`locale` swap re-titles the toolbar and re-paints canvas labels in place.
|
|
148
156
|
|
|
157
|
+
## Compact viewports
|
|
158
|
+
|
|
159
|
+
Default chrome is sized for desktop. For laptop side panels or embedded editors, shrink the bottom area to reclaim preview height:
|
|
160
|
+
|
|
161
|
+
```vue
|
|
162
|
+
<script setup lang="ts">
|
|
163
|
+
import { ref } from "vue";
|
|
164
|
+
const timelineHeight = ref(160);
|
|
165
|
+
</script>
|
|
166
|
+
|
|
167
|
+
<template>
|
|
168
|
+
<VideoEditor
|
|
169
|
+
:default-project="project"
|
|
170
|
+
:timeline-height="timelineHeight"
|
|
171
|
+
:track-height="40"
|
|
172
|
+
/>
|
|
173
|
+
</template>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
`timelineHeight` is reactive — bind it to a slider and the editor recompacts in place. `trackHeight` / `rulerHeight` are initial-only (process-wide via `setTimelineMetrics`); change + remount to re-apply. Range guidance: `timelineHeight` ∈ [120, 480], `trackHeight` ∈ [28, 96], `rulerHeight` ∈ [18, 36].
|
|
177
|
+
|
|
178
|
+
## Custom playback engine
|
|
179
|
+
|
|
180
|
+
The editor talks to playback through a single interface. The default is
|
|
181
|
+
`HtmlVideoEngine` (one hidden `<video>` per source, swap on clip
|
|
182
|
+
boundaries). To plug in a different one — WebCodecs, WebGL compositor,
|
|
183
|
+
desktop-wrapper IPC bridge — pass a factory:
|
|
184
|
+
|
|
185
|
+
```vue
|
|
186
|
+
<script setup lang="ts">
|
|
187
|
+
import { VideoEditor, type PlaybackEngineFactory } from "@aicut/vue";
|
|
188
|
+
|
|
189
|
+
const myEngine: PlaybackEngineFactory = ({ host, project }) =>
|
|
190
|
+
new MyCustomEngine(host, project); // implements PlaybackEngine
|
|
191
|
+
</script>
|
|
192
|
+
|
|
193
|
+
<template>
|
|
194
|
+
<VideoEditor
|
|
195
|
+
:default-project="project"
|
|
196
|
+
:playback-engine="myEngine"
|
|
197
|
+
/* initial-only — bound at mount */
|
|
198
|
+
/>
|
|
199
|
+
</template>
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
`PlaybackEngine`, `PlaybackEngineFactory`, `PlaybackEngineOptions`, and
|
|
203
|
+
the built-in `HtmlVideoEngine` are re-exported from `@aicut/vue` so
|
|
204
|
+
you don't need a separate `@aicut/core` import to write one.
|
|
205
|
+
|
|
206
|
+
See [@aicut/core's playback section](https://www.npmjs.com/package/@aicut/core#playback-engine)
|
|
207
|
+
for the full interface contract.
|
|
208
|
+
|
|
209
|
+
### WebCodecs engine (opt-in sub-entry)
|
|
210
|
+
|
|
211
|
+
For frame-accurate playback via the browser's `VideoDecoder` API, import from the sub-entry so mp4box.js (~200 KB) only loads when you ask for it:
|
|
212
|
+
|
|
213
|
+
```vue
|
|
214
|
+
<script setup lang="ts">
|
|
215
|
+
import { computed } from "vue";
|
|
216
|
+
import { VideoEditor } from "@aicut/vue";
|
|
217
|
+
import {
|
|
218
|
+
WebCodecsEngine,
|
|
219
|
+
isWebCodecsSupported,
|
|
220
|
+
} from "@aicut/vue/webcodecs";
|
|
221
|
+
|
|
222
|
+
const factory = computed(() =>
|
|
223
|
+
isWebCodecsSupported()
|
|
224
|
+
? (opts) => new WebCodecsEngine({ ...opts, debug: true })
|
|
225
|
+
: undefined,
|
|
226
|
+
);
|
|
227
|
+
</script>
|
|
228
|
+
|
|
229
|
+
<template>
|
|
230
|
+
<VideoEditor :playback-engine="factory" /* … */ />
|
|
231
|
+
</template>
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
`WebCodecsEngine` v1 covers single-track MP4/MOV playback (H.264 / HEVC / VP9 / AV1 — whatever the browser's `VideoDecoder` supports). Multi-track compositing, audio, transitions land in follow-up releases.
|
|
235
|
+
|
|
236
|
+
## Keyframes (panX / panY / scale animation)
|
|
237
|
+
|
|
238
|
+
Off by default. Flip the `keyframes` prop and **all three** playback engines (HTML5, Canvas, WebCodecs) start interpolating per-clip transforms between adjacent keyframes. Diamond markers appear on the timeline; drag them, edit values via the floating panel, snap them to each other.
|
|
239
|
+
|
|
240
|
+
```vue
|
|
241
|
+
<script setup lang="ts">
|
|
242
|
+
import { ref } from "vue";
|
|
243
|
+
const kfEnabled = ref(true);
|
|
244
|
+
const edgeNav = ref(true);
|
|
245
|
+
function onKfSelection(t: { clipId: string; keyframeId: string } | null) {
|
|
246
|
+
console.log(t);
|
|
247
|
+
}
|
|
248
|
+
</script>
|
|
249
|
+
|
|
250
|
+
<template>
|
|
251
|
+
<VideoEditor
|
|
252
|
+
ref="editor"
|
|
253
|
+
:default-project="project"
|
|
254
|
+
:keyframes="{ enabled: kfEnabled }"
|
|
255
|
+
:clip-edge-nav="{ enabled: edgeNav }"
|
|
256
|
+
@keyframe-selection-change="onKfSelection"
|
|
257
|
+
/>
|
|
258
|
+
</template>
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
```ts
|
|
262
|
+
// Per-property mutators on the editor API.
|
|
263
|
+
api.addKeyframe("clip-1", "scale", { time: 0, value: 1 });
|
|
264
|
+
api.addKeyframe("clip-1", "scale", { time: 2000, value: 2.5, easing: "easeInOut" });
|
|
265
|
+
api.setKeyframeValue("clip-1", kfId, 1.8);
|
|
266
|
+
api.setKeyframeEasing("clip-1", kfId, "easeOut");
|
|
267
|
+
|
|
268
|
+
// Toolbar-style "K at playhead" drops all 3 props at once.
|
|
269
|
+
api.setSelection("clip-1");
|
|
270
|
+
api.toggleKeyframeAtPlayhead();
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
`Keyframe`, `KeyframeProp`, `EasingKind`, `EffectiveTransform`, `getEffectiveTransform`, `getTransformAtTimelineTime`, `IDENTITY_TRANSFORM`, `isIdentityTransform` are all re-exported from `@aicut/vue` for thumbnail / preview rendering outside the editor.
|
|
274
|
+
|
|
275
|
+
**Backend export:** both `@aicut/backend-ts` and `@aicut/backend-go` compile keyframes to ffmpeg `t`-expressions (`scale=…:eval=frame` + `overlay=…:eval=frame`). Pass `output: { width, height, fps }` in the export request — required for the keyframe filter graph to apply.
|
|
276
|
+
|
|
277
|
+
See [@aicut/core's keyframes section](https://www.npmjs.com/package/@aicut/core#keyframes-per-clip-panx--pany--scale-animation) for the full API.
|
|
278
|
+
|
|
149
279
|
## `<LightingEditor>` (opt-in sub-entry)
|
|
150
280
|
|
|
151
281
|
A 3D lighting director for AI relighting flows — separate sub-entry; three.js bundles only here.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type EditorApi, type Locale, type Project, type Theme } from "@aicut/core";
|
|
1
|
+
import { type EditorApi, type Locale, type PlaybackEngineFactory, type Project, type Theme } from "@aicut/core";
|
|
2
2
|
/**
|
|
3
3
|
* Vue 3 wrapper around `@aicut/core`. Same shape as `@aicut/react`:
|
|
4
4
|
* uncontrolled for project state, theme is reactive, API exposed via
|
|
@@ -9,6 +9,45 @@ type __VLS_Props = {
|
|
|
9
9
|
theme?: Theme;
|
|
10
10
|
/** UI string overrides (English default). Reactive — swap to `localeZh` for Chinese. */
|
|
11
11
|
locale?: Partial<Locale>;
|
|
12
|
+
/**
|
|
13
|
+
* Initial-only factory for a custom playback engine. Defaults to the
|
|
14
|
+
* built-in `HtmlVideoEngine`. Pass `WebCodecsEngine` (v0.6+) or your
|
|
15
|
+
* own engine to override. Bound at mount; later prop changes are
|
|
16
|
+
* ignored.
|
|
17
|
+
*/
|
|
18
|
+
playbackEngine?: PlaybackEngineFactory;
|
|
19
|
+
/**
|
|
20
|
+
* Initial-only — pixel height of each track row (default 56). Lower
|
|
21
|
+
* values (~32–40) shrink the timeline for small viewports. Applied
|
|
22
|
+
* process-wide at construction time.
|
|
23
|
+
*/
|
|
24
|
+
trackHeight?: number;
|
|
25
|
+
/** Initial-only — pixel height of the timeline ruler (default 24). */
|
|
26
|
+
rulerHeight?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Pixel height of the whole bottom timeline area (default 240).
|
|
29
|
+
* Reactive — swap any time to recompact. The canvas inside fills
|
|
30
|
+
* 100% and shows an internal scrollbar when track count overflows.
|
|
31
|
+
*/
|
|
32
|
+
timelineHeight?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Per-clip keyframe animation (X / Y / Scale). Reactive — set
|
|
35
|
+
* `{ enabled: true }` to surface keyframe diamonds on the timeline
|
|
36
|
+
* and route the canvas-based engines through the transform pipeline.
|
|
37
|
+
* Data is preserved when disabled.
|
|
38
|
+
*/
|
|
39
|
+
keyframes?: {
|
|
40
|
+
enabled?: boolean;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Jump-to-clip-edge toolbar cluster (|◀ ▶|) + I/O keyboard shortcuts.
|
|
44
|
+
* Reactive — set `{ enabled: true }` to surface the buttons next to
|
|
45
|
+
* the keyframe diamond and bind the shortcuts. Off hides the buttons
|
|
46
|
+
* entirely (no toolbar space cost).
|
|
47
|
+
*/
|
|
48
|
+
clipEdgeNav?: {
|
|
49
|
+
enabled?: boolean;
|
|
50
|
+
};
|
|
12
51
|
};
|
|
13
52
|
declare var __VLS_5: {}, __VLS_11: {};
|
|
14
53
|
type __VLS_Slots = {} & {
|
|
@@ -27,6 +66,10 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {
|
|
|
27
66
|
play: () => any;
|
|
28
67
|
pause: () => any;
|
|
29
68
|
selectionChange: (clipId: string | null) => any;
|
|
69
|
+
keyframeSelectionChange: (target: {
|
|
70
|
+
clipId: string;
|
|
71
|
+
keyframeId: string;
|
|
72
|
+
} | null) => any;
|
|
30
73
|
error: (error: Error) => any;
|
|
31
74
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
32
75
|
onReady?: ((api: EditorApi) => any) | undefined;
|
|
@@ -36,6 +79,10 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {
|
|
|
36
79
|
onPlay?: (() => any) | undefined;
|
|
37
80
|
onPause?: (() => any) | undefined;
|
|
38
81
|
onSelectionChange?: ((clipId: string | null) => any) | undefined;
|
|
82
|
+
onKeyframeSelectionChange?: ((target: {
|
|
83
|
+
clipId: string;
|
|
84
|
+
keyframeId: string;
|
|
85
|
+
} | null) => any) | undefined;
|
|
39
86
|
onError?: ((error: Error) => any) | undefined;
|
|
40
87
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
41
88
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoEditor.vue.d.ts","sourceRoot":"","sources":["../src/VideoEditor.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VideoEditor.vue.d.ts","sourceRoot":"","sources":["../src/VideoEditor.vue"],"names":[],"mappings":"AA4MA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,MAAM,EAEX,KAAK,qBAAqB,EAC1B,KAAK,OAAO,EACZ,KAAK,KAAK,EACX,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,KAAK,WAAW,GAAG;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,wFAAwF;IACxF,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sEAAsE;IACtE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,SAAS,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAClC;;;;;OAKG;IACH,WAAW,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CACrC,CAAC;AAoLF,QAAA,IAAI,OAAO,IAAU,EAAE,QAAQ,IAAY,CAAE;AAC7C,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GAC/C;IAAE,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAwBpD,QAAA,MAAM,eAAe;IA5EnB,kEAAkE;eACzD,SAAS,GAAG,IAAI;;;;;;;;;;gBAvHL,MAAM;oBAAc,MAAM;;;;;;;;;;;;gBAA1B,MAAM;oBAAc,MAAM;;;kFA0M9C,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAQ1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),o=require("@aicut/core"),f=n.defineComponent({__name:"VideoEditor",props:{defaultProject:{},theme:{},locale:{},playbackEngine:{type:Function},trackHeight:{},rulerHeight:{},timelineHeight:{},keyframes:{},clipEdgeNav:{}},emits:["ready","change","export","timeUpdate","play","pause","selectionChange","keyframeSelectionChange","error"],setup(d,{expose:p,emit:m}){const r=d,a=m,u=n.ref(null);let e=null;const l=[],c=n.ref(null),s=n.ref(null);return n.onMounted(()=>{u.value&&(e=o.Editor.create({container:u.value,project:r.defaultProject,theme:r.theme,locale:r.locale,playbackEngine:r.playbackEngine,...r.trackHeight!=null?{trackHeight:r.trackHeight}:{},...r.rulerHeight!=null?{rulerHeight:r.rulerHeight}:{},...r.timelineHeight!=null?{timelineHeight:r.timelineHeight}:{},...r.keyframes!=null?{keyframes:r.keyframes}:{},...r.clipEdgeNav!=null?{clipEdgeNav:r.clipEdgeNav}:{}}),l.push(e.on("change",({project:t})=>a("change",t)),e.on("export",({project:t})=>a("export",t)),e.on("time",({timeMs:t})=>a("timeUpdate",t)),e.on("play",()=>a("play")),e.on("pause",()=>a("pause")),e.on("selectionChange",({clipId:t})=>a("selectionChange",t)),e.on("keyframeSelectionChange",({target:t})=>a("keyframeSelectionChange",t)),e.on("error",({error:t})=>a("error",t))),c.value=e.headerLeft,s.value=e.headerRight,a("ready",e))}),n.watch(()=>r.theme,t=>{t&&e&&e.setTheme(t)}),n.watch(()=>r.locale,t=>{t&&e&&e.setLocale(t)}),n.watch(()=>{var t;return(t=r.keyframes)==null?void 0:t.enabled},t=>{if(!e)return;const i=t===!0;e.isKeyframesEnabled()!==i&&e.setKeyframesEnabled(i)}),n.watch(()=>{var t;return(t=r.clipEdgeNav)==null?void 0:t.enabled},t=>{if(!e)return;const i=t===!0;e.isClipEdgeNavEnabled()!==i&&e.setClipEdgeNavEnabled(i)}),n.watch(()=>r.timelineHeight,t=>{const i=u.value;i&&(t!=null&&t>0?i.style.setProperty("--aicut-timeline-height",`${Math.round(t)}px`):i.style.removeProperty("--aicut-timeline-height"))}),n.onBeforeUnmount(()=>{for(const t of l)t();l.length=0,e==null||e.destroy(),e=null,c.value=null,s.value=null}),p({api:()=>e}),(t,i)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"host",ref:u,"data-aicut-host":""},[c.value?(n.openBlock(),n.createBlock(n.Teleport,{key:0,to:c.value},[n.renderSlot(t.$slots,"headerLeft")],8,["to"])):n.createCommentVNode("",!0),s.value?(n.openBlock(),n.createBlock(n.Teleport,{key:1,to:s.value},[n.renderSlot(t.$slots,"headerRight")],8,["to"])):n.createCommentVNode("",!0)],512))}}),g=n.defineComponent({__name:"Timeline",props:{defaultProject:{},defaultScale:{},defaultTime:{},defaultSelectedClipId:{},showHeader:{type:Boolean},readOnly:{type:Boolean},snap:{type:Boolean},autoFit:{type:Boolean},locale:{}},emits:["seek","selectClip","scaleChange","moveClip","resizeClip","change"],setup(d,{expose:p,emit:m}){const r=d,a=m,u=n.ref(null);let e=null;return n.onMounted(()=>{u.value&&(e=o.Timeline.create({container:u.value,project:r.defaultProject,pxPerSec:r.defaultScale,time:r.defaultTime,selectedClipId:r.defaultSelectedClipId??null,showHeader:r.showHeader,readOnly:r.readOnly,snap:r.snap,autoFit:r.autoFit,locale:r.locale,onSeek:l=>a("seek",l),onSelectClip:l=>a("selectClip",l),onScaleChange:l=>a("scaleChange",l),onMoveClip:(l,c)=>a("moveClip",l,c),onResizeClip:(l,c)=>a("resizeClip",l,c),onChange:l=>a("change",l)}))}),n.watch(()=>r.locale,l=>{l&&e&&e.setLocale(l)}),n.onBeforeUnmount(()=>{e==null||e.destroy(),e=null}),p({api:()=>e}),(l,c)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"host",ref:u,"data-aicut-timeline-host":"",style:{width:"100%",height:"240px"}},null,512))}});Object.defineProperty(exports,"CanvasCompositorEngine",{enumerable:!0,get:()=>o.CanvasCompositorEngine});Object.defineProperty(exports,"HEADER_WIDTH",{enumerable:!0,get:()=>o.HEADER_WIDTH});Object.defineProperty(exports,"HtmlVideoEngine",{enumerable:!0,get:()=>o.HtmlVideoEngine});Object.defineProperty(exports,"IDENTITY_TRANSFORM",{enumerable:!0,get:()=>o.IDENTITY_TRANSFORM});Object.defineProperty(exports,"RULER_HEIGHT",{enumerable:!0,get:()=>o.RULER_HEIGHT});Object.defineProperty(exports,"TRACK_HEIGHT",{enumerable:!0,get:()=>o.TRACK_HEIGHT});Object.defineProperty(exports,"canvasCompositorEngineFactory",{enumerable:!0,get:()=>o.canvasCompositorEngineFactory});Object.defineProperty(exports,"createEmptyProject",{enumerable:!0,get:()=>o.createEmptyProject});Object.defineProperty(exports,"createId",{enumerable:!0,get:()=>o.createId});Object.defineProperty(exports,"getEffectiveTransform",{enumerable:!0,get:()=>o.getEffectiveTransform});Object.defineProperty(exports,"getTransformAtTimelineTime",{enumerable:!0,get:()=>o.getTransformAtTimelineTime});Object.defineProperty(exports,"htmlVideoEngineFactory",{enumerable:!0,get:()=>o.htmlVideoEngineFactory});Object.defineProperty(exports,"isIdentityTransform",{enumerable:!0,get:()=>o.isIdentityTransform});Object.defineProperty(exports,"localeEn",{enumerable:!0,get:()=>o.localeEn});Object.defineProperty(exports,"localeZh",{enumerable:!0,get:()=>o.localeZh});Object.defineProperty(exports,"setTimelineMetrics",{enumerable:!0,get:()=>o.setTimelineMetrics});exports.Timeline=g;exports.VideoEditor=f;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/VideoEditor.vue","../src/Timeline.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { onBeforeUnmount, onMounted, ref, watch } from \"vue\";\nimport {\n Editor,\n type EditorApi,\n type Locale,\n type Ms,\n type Project,\n type Theme,\n} from \"@aicut/core\";\n\n/**\n * Vue 3 wrapper around `@aicut/core`. Same shape as `@aicut/react`:\n * uncontrolled for project state, theme is reactive, API exposed via\n * `defineExpose` so a parent `ref` can call cut/seek/setProject/etc.\n */\nconst props = defineProps<{\n defaultProject?: Project;\n theme?: Theme;\n /** UI string overrides (English default). Reactive — swap to `localeZh` for Chinese. */\n locale?: Partial<Locale>;\n}>();\n\nconst emit = defineEmits<{\n (e: \"ready\", api: EditorApi): void;\n (e: \"change\", project: Project): void;\n (e: \"export\", project: Project): void;\n (e: \"timeUpdate\", timeMs: Ms): void;\n (e: \"play\"): void;\n (e: \"pause\"): void;\n (e: \"selectionChange\", clipId: string | null): void;\n (e: \"error\", error: Error): void;\n}>();\n\nconst host = ref<HTMLDivElement | null>(null);\nlet editor: Editor | null = null;\nconst offs: Array<() => void> = [];\n/** Header slot DOM nodes — set after editor mount so Vue Teleports\n * have a valid target. Library renders nothing here; named slots\n * `#headerLeft` / `#headerRight` portal whatever the host provides. */\nconst headerLeftSlot = ref<HTMLElement | null>(null);\nconst headerRightSlot = ref<HTMLElement | null>(null);\n\nonMounted(() => {\n if (!host.value) return;\n editor = Editor.create({\n container: host.value,\n project: props.defaultProject,\n theme: props.theme,\n locale: props.locale,\n });\n\n offs.push(\n editor.on(\"change\", ({ project }) => emit(\"change\", project)),\n editor.on(\"export\", ({ project }) => emit(\"export\", project)),\n editor.on(\"time\", ({ timeMs }) => emit(\"timeUpdate\", timeMs)),\n editor.on(\"play\", () => emit(\"play\")),\n editor.on(\"pause\", () => emit(\"pause\")),\n editor.on(\"selectionChange\", ({ clipId }) =>\n emit(\"selectionChange\", clipId),\n ),\n editor.on(\"error\", ({ error }) => emit(\"error\", error)),\n );\n\n headerLeftSlot.value = editor.headerLeft;\n headerRightSlot.value = editor.headerRight;\n emit(\"ready\", editor);\n});\n\nwatch(\n () => props.theme,\n (theme) => {\n if (theme && editor) editor.setTheme(theme);\n },\n);\n\nwatch(\n () => props.locale,\n (locale) => {\n if (locale && editor) editor.setLocale(locale);\n },\n);\n\nonBeforeUnmount(() => {\n for (const off of offs) off();\n offs.length = 0;\n editor?.destroy();\n editor = null;\n headerLeftSlot.value = null;\n headerRightSlot.value = null;\n});\n\ndefineExpose({\n /** Returns the underlying core API or null if not yet mounted. */\n api: (): EditorApi | null => editor,\n});\n</script>\n\n<template>\n <div ref=\"host\" data-aicut-host=\"\">\n <Teleport v-if=\"headerLeftSlot\" :to=\"headerLeftSlot\">\n <slot name=\"headerLeft\" />\n </Teleport>\n <Teleport v-if=\"headerRightSlot\" :to=\"headerRightSlot\">\n <slot name=\"headerRight\" />\n </Teleport>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { onBeforeUnmount, onMounted, ref, watch } from \"vue\";\nimport {\n Timeline as CoreTimeline,\n type Clip,\n type Locale,\n type Ms,\n type Project,\n} from \"@aicut/core\";\n\n/**\n * Standalone canvas Timeline wrapped for Vue 3. Same surface as the\n * React `<Timeline>`: pass `defaultProject`, drive imperatively via\n * the exposed `api()` ref.\n */\nconst props = defineProps<{\n defaultProject: Project;\n defaultScale?: number;\n defaultTime?: Ms;\n defaultSelectedClipId?: string | null;\n showHeader?: boolean;\n readOnly?: boolean;\n snap?: boolean;\n autoFit?: boolean;\n locale?: Partial<Locale>;\n}>();\n\nconst emit = defineEmits<{\n (e: \"seek\", timeMs: Ms): void;\n (e: \"selectClip\", clipId: string | null): void;\n (e: \"scaleChange\", pxPerSec: number): void;\n (e: \"moveClip\", clipId: string, opts: { start?: Ms; trackId?: string }): void;\n (\n e: \"resizeClip\",\n clipId: string,\n edits: Partial<Pick<Clip, \"in\" | \"out\" | \"start\">>,\n ): void;\n (e: \"change\", project: Project): void;\n}>();\n\nconst host = ref<HTMLDivElement | null>(null);\nlet timeline: CoreTimeline | null = null;\n\nonMounted(() => {\n if (!host.value) return;\n timeline = CoreTimeline.create({\n container: host.value,\n project: props.defaultProject,\n pxPerSec: props.defaultScale,\n time: props.defaultTime,\n selectedClipId: props.defaultSelectedClipId ?? null,\n showHeader: props.showHeader,\n readOnly: props.readOnly,\n snap: props.snap,\n autoFit: props.autoFit,\n locale: props.locale,\n onSeek: (t) => emit(\"seek\", t),\n onSelectClip: (id) => emit(\"selectClip\", id),\n onScaleChange: (s) => emit(\"scaleChange\", s),\n onMoveClip: (id, opts) => emit(\"moveClip\", id, opts),\n onResizeClip: (id, edits) => emit(\"resizeClip\", id, edits),\n onChange: (p) => emit(\"change\", p),\n });\n});\n\nwatch(\n () => props.locale,\n (locale) => {\n if (locale && timeline) timeline.setLocale(locale);\n },\n);\n\nonBeforeUnmount(() => {\n timeline?.destroy();\n timeline = null;\n});\n\ndefineExpose({\n api: (): CoreTimeline | null => timeline,\n});\n</script>\n\n<template>\n <div ref=\"host\" data-aicut-timeline-host=\"\" :style=\"{ width: '100%', height: '240px' }\" />\n</template>\n"],"names":["props","__props","emit","__emit","host","ref","editor","offs","headerLeftSlot","headerRightSlot","onMounted","Editor","project","timeMs","clipId","error","watch","theme","locale","onBeforeUnmount","off","__expose","_createElementBlock","_createBlock","_Teleport","_renderSlot","_ctx","timeline","CoreTimeline","t","id","s","opts","edits","p"],"mappings":"0UAgBA,MAAMA,EAAQC,EAORC,EAAOC,EAWPC,EAAOC,EAAAA,IAA2B,IAAI,EAC5C,IAAIC,EA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AAA,MAAAA,EAAU,UACVA,EAAW,IACb,CAAC,EAEDN,EAAa,CACX,IAAK,IAA2BM,CAAA,CACjC,wBAICL,EAAAA,mBAA0F,MAAA,SAAjF,OAAJ,IAAIlB,EAAO,2BAAyB,GAAI,MAAO,CAAA,MAAA,OAAA,OAAA,OAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/VideoEditor.vue","../src/Timeline.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { onBeforeUnmount, onMounted, ref, watch } from \"vue\";\nimport {\n Editor,\n type EditorApi,\n type Locale,\n type Ms,\n type PlaybackEngineFactory,\n type Project,\n type Theme,\n} from \"@aicut/core\";\n\n/**\n * Vue 3 wrapper around `@aicut/core`. Same shape as `@aicut/react`:\n * uncontrolled for project state, theme is reactive, API exposed via\n * `defineExpose` so a parent `ref` can call cut/seek/setProject/etc.\n */\nconst props = defineProps<{\n defaultProject?: Project;\n theme?: Theme;\n /** UI string overrides (English default). Reactive — swap to `localeZh` for Chinese. */\n locale?: Partial<Locale>;\n /**\n * Initial-only factory for a custom playback engine. Defaults to the\n * built-in `HtmlVideoEngine`. Pass `WebCodecsEngine` (v0.6+) or your\n * own engine to override. Bound at mount; later prop changes are\n * ignored.\n */\n playbackEngine?: PlaybackEngineFactory;\n /**\n * Initial-only — pixel height of each track row (default 56). Lower\n * values (~32–40) shrink the timeline for small viewports. Applied\n * process-wide at construction time.\n */\n trackHeight?: number;\n /** Initial-only — pixel height of the timeline ruler (default 24). */\n rulerHeight?: number;\n /**\n * Pixel height of the whole bottom timeline area (default 240).\n * Reactive — swap any time to recompact. The canvas inside fills\n * 100% and shows an internal scrollbar when track count overflows.\n */\n timelineHeight?: number;\n /**\n * Per-clip keyframe animation (X / Y / Scale). Reactive — set\n * `{ enabled: true }` to surface keyframe diamonds on the timeline\n * and route the canvas-based engines through the transform pipeline.\n * Data is preserved when disabled.\n */\n keyframes?: { enabled?: boolean };\n /**\n * Jump-to-clip-edge toolbar cluster (|◀ ▶|) + I/O keyboard shortcuts.\n * Reactive — set `{ enabled: true }` to surface the buttons next to\n * the keyframe diamond and bind the shortcuts. Off hides the buttons\n * entirely (no toolbar space cost).\n */\n clipEdgeNav?: { enabled?: boolean };\n}>();\n\nconst emit = defineEmits<{\n (e: \"ready\", api: EditorApi): void;\n (e: \"change\", project: Project): void;\n (e: \"export\", project: Project): void;\n (e: \"timeUpdate\", timeMs: Ms): void;\n (e: \"play\"): void;\n (e: \"pause\"): void;\n (e: \"selectionChange\", clipId: string | null): void;\n (\n e: \"keyframeSelectionChange\",\n target: { clipId: string; keyframeId: string } | null,\n ): void;\n (e: \"error\", error: Error): void;\n}>();\n\nconst host = ref<HTMLDivElement | null>(null);\nlet editor: Editor | null = null;\nconst offs: Array<() => void> = [];\n/** Header slot DOM nodes — set after editor mount so Vue Teleports\n * have a valid target. Library renders nothing here; named slots\n * `#headerLeft` / `#headerRight` portal whatever the host provides. */\nconst headerLeftSlot = ref<HTMLElement | null>(null);\nconst headerRightSlot = ref<HTMLElement | null>(null);\n\nonMounted(() => {\n if (!host.value) return;\n editor = Editor.create({\n container: host.value,\n project: props.defaultProject,\n theme: props.theme,\n locale: props.locale,\n playbackEngine: props.playbackEngine,\n ...(props.trackHeight != null ? { trackHeight: props.trackHeight } : {}),\n ...(props.rulerHeight != null ? { rulerHeight: props.rulerHeight } : {}),\n ...(props.timelineHeight != null\n ? { timelineHeight: props.timelineHeight }\n : {}),\n ...(props.keyframes != null ? { keyframes: props.keyframes } : {}),\n ...(props.clipEdgeNav != null ? { clipEdgeNav: props.clipEdgeNav } : {}),\n });\n\n offs.push(\n editor.on(\"change\", ({ project }) => emit(\"change\", project)),\n editor.on(\"export\", ({ project }) => emit(\"export\", project)),\n editor.on(\"time\", ({ timeMs }) => emit(\"timeUpdate\", timeMs)),\n editor.on(\"play\", () => emit(\"play\")),\n editor.on(\"pause\", () => emit(\"pause\")),\n editor.on(\"selectionChange\", ({ clipId }) =>\n emit(\"selectionChange\", clipId),\n ),\n editor.on(\"keyframeSelectionChange\", ({ target }) =>\n emit(\"keyframeSelectionChange\", target),\n ),\n editor.on(\"error\", ({ error }) => emit(\"error\", error)),\n );\n\n headerLeftSlot.value = editor.headerLeft;\n headerRightSlot.value = editor.headerRight;\n emit(\"ready\", editor);\n});\n\nwatch(\n () => props.theme,\n (theme) => {\n if (theme && editor) editor.setTheme(theme);\n },\n);\n\nwatch(\n () => props.locale,\n (locale) => {\n if (locale && editor) editor.setLocale(locale);\n },\n);\n\n// Reactive — flip keyframe mode without remount. Data preserved.\nwatch(\n () => props.keyframes?.enabled,\n (enabled) => {\n if (!editor) return;\n const desired = enabled === true;\n if (editor.isKeyframesEnabled() !== desired) {\n editor.setKeyframesEnabled(desired);\n }\n },\n);\n\n// Reactive — flip clip-edge nav cluster (|◀ ▶|) + I/O shortcuts.\nwatch(\n () => props.clipEdgeNav?.enabled,\n (enabled) => {\n if (!editor) return;\n const desired = enabled === true;\n if (editor.isClipEdgeNavEnabled() !== desired) {\n editor.setClipEdgeNavEnabled(desired);\n }\n },\n);\n\n// Reactive — sets the CSS custom property directly so the timeline\n// height can be tweaked without remounting.\nwatch(\n () => props.timelineHeight,\n (timelineHeight) => {\n const root = host.value;\n if (!root) return;\n if (timelineHeight != null && timelineHeight > 0) {\n root.style.setProperty(\n \"--aicut-timeline-height\",\n `${Math.round(timelineHeight)}px`,\n );\n } else {\n root.style.removeProperty(\"--aicut-timeline-height\");\n }\n },\n);\n\nonBeforeUnmount(() => {\n for (const off of offs) off();\n offs.length = 0;\n editor?.destroy();\n editor = null;\n headerLeftSlot.value = null;\n headerRightSlot.value = null;\n});\n\ndefineExpose({\n /** Returns the underlying core API or null if not yet mounted. */\n api: (): EditorApi | null => editor,\n});\n</script>\n\n<template>\n <div ref=\"host\" data-aicut-host=\"\">\n <Teleport v-if=\"headerLeftSlot\" :to=\"headerLeftSlot\">\n <slot name=\"headerLeft\" />\n </Teleport>\n <Teleport v-if=\"headerRightSlot\" :to=\"headerRightSlot\">\n <slot name=\"headerRight\" />\n </Teleport>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { onBeforeUnmount, onMounted, ref, watch } from \"vue\";\nimport {\n Timeline as CoreTimeline,\n type Clip,\n type Locale,\n type Ms,\n type Project,\n} from \"@aicut/core\";\n\n/**\n * Standalone canvas Timeline wrapped for Vue 3. Same surface as the\n * React `<Timeline>`: pass `defaultProject`, drive imperatively via\n * the exposed `api()` ref.\n */\nconst props = defineProps<{\n defaultProject: Project;\n defaultScale?: number;\n defaultTime?: Ms;\n defaultSelectedClipId?: string | null;\n showHeader?: boolean;\n readOnly?: boolean;\n snap?: boolean;\n autoFit?: boolean;\n locale?: Partial<Locale>;\n}>();\n\nconst emit = defineEmits<{\n (e: \"seek\", timeMs: Ms): void;\n (e: \"selectClip\", clipId: string | null): void;\n (e: \"scaleChange\", pxPerSec: number): void;\n (e: \"moveClip\", clipId: string, opts: { start?: Ms; trackId?: string }): void;\n (\n e: \"resizeClip\",\n clipId: string,\n edits: Partial<Pick<Clip, \"in\" | \"out\" | \"start\">>,\n ): void;\n (e: \"change\", project: Project): void;\n}>();\n\nconst host = ref<HTMLDivElement | null>(null);\nlet timeline: CoreTimeline | null = null;\n\nonMounted(() => {\n if (!host.value) return;\n timeline = CoreTimeline.create({\n container: host.value,\n project: props.defaultProject,\n pxPerSec: props.defaultScale,\n time: props.defaultTime,\n selectedClipId: props.defaultSelectedClipId ?? null,\n showHeader: props.showHeader,\n readOnly: props.readOnly,\n snap: props.snap,\n autoFit: props.autoFit,\n locale: props.locale,\n onSeek: (t) => emit(\"seek\", t),\n onSelectClip: (id) => emit(\"selectClip\", id),\n onScaleChange: (s) => emit(\"scaleChange\", s),\n onMoveClip: (id, opts) => emit(\"moveClip\", id, opts),\n onResizeClip: (id, edits) => emit(\"resizeClip\", id, edits),\n onChange: (p) => emit(\"change\", p),\n });\n});\n\nwatch(\n () => props.locale,\n (locale) => {\n if (locale && timeline) timeline.setLocale(locale);\n },\n);\n\nonBeforeUnmount(() => {\n timeline?.destroy();\n timeline = null;\n});\n\ndefineExpose({\n api: (): CoreTimeline | null => timeline,\n});\n</script>\n\n<template>\n <div ref=\"host\" data-aicut-timeline-host=\"\" :style=\"{ width: '100%', height: '240px' }\" />\n</template>\n"],"names":["props","__props","emit","__emit","host","ref","editor","offs","headerLeftSlot","headerRightSlot","onMounted","Editor","project","timeMs","clipId","target","error","watch","theme","locale","_a","enabled","desired","timelineHeight","root","onBeforeUnmount","off","__expose","_createElementBlock","_createBlock","_Teleport","_renderSlot","_ctx","timeline","CoreTimeline","t","id","s","opts","edits","p"],"mappings":"+cAiBA,MAAMA,EAAQC,EA0CRC,EAAOC,EAePC,EAAOC,EAAAA,IAA2B,IAAI,EAC5C,IAAIC,EAAwB,KAC5B,MAAMC,EAA0B,CAAA,EAI1BC,EAAiBH,EAAAA,IAAwB,IAAI,EAC7CI,EAAkBJ,EAAAA,IAAwB,IAAI,EAEpDK,OAAAA,EAAAA,UAAU,IAAM,CACTN,EAAK,QACVE,EAASK,EAAAA,OAAO,OAAO,CACrB,UAAWP,EAAK,MAChB,QAASJ,EAAM,eACf,MAAOA,EAAM,MACb,OAAQA,EAAM,OACd,eAAgBA,EAAM,eACtB,GAAIA,EAAM,aAAe,KAAO,CAAE,YAAaA,EAAM,WAAA,EAAgB,CAAA,EACrE,GAAIA,EAAM,aAAe,KAAO,CAAE,YAAaA,EAAM,WAAA,EAAgB,CAAA,EACrE,GAAIA,EAAM,gBAAkB,KACxB,CAAE,eAAgBA,EAAM,cAAA,EACxB,CAAA,EACJ,GAAIA,EAAM,WAAa,KAAO,CAAE,UAAWA,EAAM,SAAA,EAAc,CAAA,EAC/D,GAAIA,EAAM,aAAe,KAAO,CAAE,YAAaA,EAAM,aAAgB,CAAA,CAAC,CACvE,EAEDO,EAAK,KACHD,EAAO,GAAG,SAAU,CAAC,CAAE,QAAAM,KAAcV,EAAK,SAAUU,CAAO,CAAC,EAC5DN,EAAO,GAAG,SAAU,CAAC,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AAK,cAAemC,CAAC,EAC3C,WAAY,CAACD,EAAIE,IAASpC,EAAK,WAAYkC,EAAIE,CAAI,EACnD,aAAc,CAACF,EAAIG,IAAUrC,EAAK,aAAckC,EAAIG,CAAK,EACzD,SAAWC,GAAMtC,EAAK,SAAUsC,CAAC,CAAA,CAClC,EACH,CAAC,EAEDvB,EAAAA,MACE,IAAMjB,EAAM,OACXmB,GAAW,CACNA,GAAUc,GAAUA,EAAS,UAAUd,CAAM,CACnD,CAAA,EAGFM,EAAAA,gBAAgB,IAAM,CACpBQ,GAAA,MAAAA,EAAU,UACVA,EAAW,IACb,CAAC,EAEDN,EAAa,CACX,IAAK,IAA2BM,CAAA,CACjC,wBAICL,EAAAA,mBAA0F,MAAA,SAAjF,OAAJ,IAAIxB,EAAO,2BAAyB,GAAI,MAAO,CAAA,MAAA,OAAA,OAAA,OAAA,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default as VideoEditor } from "./VideoEditor.vue";
|
|
2
2
|
export { default as Timeline } from "./Timeline.vue";
|
|
3
|
-
export type { Project, MediaSource, Track, Clip, Ms, Theme, EditorApi, TimelineOptions, Locale, } from "@aicut/core";
|
|
4
|
-
export { createEmptyProject, createId, localeEn, localeZh } from "@aicut/core";
|
|
3
|
+
export type { Project, MediaSource, Track, Clip, Keyframe, Ms, Theme, EditorApi, TimelineOptions, Locale, PlaybackEngine, PlaybackEngineFactory, PlaybackEngineOptions, CanvasCompositorEngineOptions, EffectiveTransform, } from "@aicut/core";
|
|
4
|
+
export { createEmptyProject, createId, localeEn, localeZh, HtmlVideoEngine, htmlVideoEngineFactory, CanvasCompositorEngine, canvasCompositorEngineFactory, TRACK_HEIGHT, RULER_HEIGHT, HEADER_WIDTH, setTimelineMetrics, IDENTITY_TRANSFORM, isIdentityTransform, getEffectiveTransform, getTransformAtTimelineTime, } from "@aicut/core";
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,YAAY,EACV,OAAO,EACP,WAAW,EACX,KAAK,EACL,IAAI,EACJ,EAAE,EACF,KAAK,EACL,SAAS,EACT,eAAe,EACf,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,YAAY,EACV,OAAO,EACP,WAAW,EACX,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,EAAE,EACF,KAAK,EACL,SAAS,EACT,eAAe,EACf,MAAM,EACN,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,6BAA6B,EAC7B,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,kBAAkB,EAClB,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,6BAA6B,EAC7B,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,72 +1,117 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Editor as
|
|
3
|
-
import { createEmptyProject as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as C, ref as u, onMounted as v, watch as c, onBeforeUnmount as k, openBlock as p, createElementBlock as H, createBlock as f, Teleport as g, renderSlot as y, createCommentVNode as E } from "vue";
|
|
2
|
+
import { Editor as T, Timeline as _ } from "@aicut/core";
|
|
3
|
+
import { CanvasCompositorEngine as B, HEADER_WIDTH as P, HtmlVideoEngine as j, IDENTITY_TRANSFORM as F, RULER_HEIGHT as L, TRACK_HEIGHT as w, canvasCompositorEngineFactory as M, createEmptyProject as V, createId as A, getEffectiveTransform as O, getTransformAtTimelineTime as U, htmlVideoEngineFactory as $, isIdentityTransform as z, localeEn as D, localeZh as K, setTimelineMetrics as G } from "@aicut/core";
|
|
4
|
+
const I = /* @__PURE__ */ C({
|
|
5
5
|
__name: "VideoEditor",
|
|
6
6
|
props: {
|
|
7
7
|
defaultProject: {},
|
|
8
8
|
theme: {},
|
|
9
|
-
locale: {}
|
|
9
|
+
locale: {},
|
|
10
|
+
playbackEngine: { type: Function },
|
|
11
|
+
trackHeight: {},
|
|
12
|
+
rulerHeight: {},
|
|
13
|
+
timelineHeight: {},
|
|
14
|
+
keyframes: {},
|
|
15
|
+
clipEdgeNav: {}
|
|
10
16
|
},
|
|
11
|
-
emits: ["ready", "change", "export", "timeUpdate", "play", "pause", "selectionChange", "error"],
|
|
12
|
-
setup(
|
|
13
|
-
const l =
|
|
17
|
+
emits: ["ready", "change", "export", "timeUpdate", "play", "pause", "selectionChange", "keyframeSelectionChange", "error"],
|
|
18
|
+
setup(d, { expose: h, emit: m }) {
|
|
19
|
+
const l = d, o = m, i = u(null);
|
|
14
20
|
let e = null;
|
|
15
|
-
const
|
|
21
|
+
const a = [], r = u(null), s = u(null);
|
|
16
22
|
return v(() => {
|
|
17
|
-
|
|
18
|
-
container:
|
|
23
|
+
i.value && (e = T.create({
|
|
24
|
+
container: i.value,
|
|
19
25
|
project: l.defaultProject,
|
|
20
26
|
theme: l.theme,
|
|
21
|
-
locale: l.locale
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
locale: l.locale,
|
|
28
|
+
playbackEngine: l.playbackEngine,
|
|
29
|
+
...l.trackHeight != null ? { trackHeight: l.trackHeight } : {},
|
|
30
|
+
...l.rulerHeight != null ? { rulerHeight: l.rulerHeight } : {},
|
|
31
|
+
...l.timelineHeight != null ? { timelineHeight: l.timelineHeight } : {},
|
|
32
|
+
...l.keyframes != null ? { keyframes: l.keyframes } : {},
|
|
33
|
+
...l.clipEdgeNav != null ? { clipEdgeNav: l.clipEdgeNav } : {}
|
|
34
|
+
}), a.push(
|
|
35
|
+
e.on("change", ({ project: t }) => o("change", t)),
|
|
36
|
+
e.on("export", ({ project: t }) => o("export", t)),
|
|
37
|
+
e.on("time", ({ timeMs: t }) => o("timeUpdate", t)),
|
|
38
|
+
e.on("play", () => o("play")),
|
|
39
|
+
e.on("pause", () => o("pause")),
|
|
28
40
|
e.on(
|
|
29
41
|
"selectionChange",
|
|
30
|
-
({ clipId: t }) =>
|
|
42
|
+
({ clipId: t }) => o("selectionChange", t)
|
|
31
43
|
),
|
|
32
|
-
e.on(
|
|
33
|
-
|
|
34
|
-
|
|
44
|
+
e.on(
|
|
45
|
+
"keyframeSelectionChange",
|
|
46
|
+
({ target: t }) => o("keyframeSelectionChange", t)
|
|
47
|
+
),
|
|
48
|
+
e.on("error", ({ error: t }) => o("error", t))
|
|
49
|
+
), r.value = e.headerLeft, s.value = e.headerRight, o("ready", e));
|
|
50
|
+
}), c(
|
|
35
51
|
() => l.theme,
|
|
36
52
|
(t) => {
|
|
37
53
|
t && e && e.setTheme(t);
|
|
38
54
|
}
|
|
39
|
-
),
|
|
55
|
+
), c(
|
|
40
56
|
() => l.locale,
|
|
41
57
|
(t) => {
|
|
42
58
|
t && e && e.setLocale(t);
|
|
43
59
|
}
|
|
44
|
-
),
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
60
|
+
), c(
|
|
61
|
+
() => {
|
|
62
|
+
var t;
|
|
63
|
+
return (t = l.keyframes) == null ? void 0 : t.enabled;
|
|
64
|
+
},
|
|
65
|
+
(t) => {
|
|
66
|
+
if (!e) return;
|
|
67
|
+
const n = t === !0;
|
|
68
|
+
e.isKeyframesEnabled() !== n && e.setKeyframesEnabled(n);
|
|
69
|
+
}
|
|
70
|
+
), c(
|
|
71
|
+
() => {
|
|
72
|
+
var t;
|
|
73
|
+
return (t = l.clipEdgeNav) == null ? void 0 : t.enabled;
|
|
74
|
+
},
|
|
75
|
+
(t) => {
|
|
76
|
+
if (!e) return;
|
|
77
|
+
const n = t === !0;
|
|
78
|
+
e.isClipEdgeNavEnabled() !== n && e.setClipEdgeNavEnabled(n);
|
|
79
|
+
}
|
|
80
|
+
), c(
|
|
81
|
+
() => l.timelineHeight,
|
|
82
|
+
(t) => {
|
|
83
|
+
const n = i.value;
|
|
84
|
+
n && (t != null && t > 0 ? n.style.setProperty(
|
|
85
|
+
"--aicut-timeline-height",
|
|
86
|
+
`${Math.round(t)}px`
|
|
87
|
+
) : n.style.removeProperty("--aicut-timeline-height"));
|
|
88
|
+
}
|
|
89
|
+
), k(() => {
|
|
90
|
+
for (const t of a) t();
|
|
91
|
+
a.length = 0, e == null || e.destroy(), e = null, r.value = null, s.value = null;
|
|
92
|
+
}), h({
|
|
48
93
|
/** Returns the underlying core API or null if not yet mounted. */
|
|
49
94
|
api: () => e
|
|
50
|
-
}), (t,
|
|
95
|
+
}), (t, n) => (p(), H("div", {
|
|
51
96
|
ref_key: "host",
|
|
52
|
-
ref:
|
|
97
|
+
ref: i,
|
|
53
98
|
"data-aicut-host": ""
|
|
54
99
|
}, [
|
|
55
|
-
|
|
100
|
+
r.value ? (p(), f(g, {
|
|
56
101
|
key: 0,
|
|
57
|
-
to:
|
|
102
|
+
to: r.value
|
|
58
103
|
}, [
|
|
59
|
-
|
|
60
|
-
], 8, ["to"])) :
|
|
61
|
-
|
|
104
|
+
y(t.$slots, "headerLeft")
|
|
105
|
+
], 8, ["to"])) : E("", !0),
|
|
106
|
+
s.value ? (p(), f(g, {
|
|
62
107
|
key: 1,
|
|
63
|
-
to:
|
|
108
|
+
to: s.value
|
|
64
109
|
}, [
|
|
65
|
-
|
|
66
|
-
], 8, ["to"])) :
|
|
110
|
+
y(t.$slots, "headerRight")
|
|
111
|
+
], 8, ["to"])) : E("", !0)
|
|
67
112
|
], 512));
|
|
68
113
|
}
|
|
69
|
-
}),
|
|
114
|
+
}), N = /* @__PURE__ */ C({
|
|
70
115
|
__name: "Timeline",
|
|
71
116
|
props: {
|
|
72
117
|
defaultProject: {},
|
|
@@ -80,12 +125,12 @@ const E = /* @__PURE__ */ g({
|
|
|
80
125
|
locale: {}
|
|
81
126
|
},
|
|
82
127
|
emits: ["seek", "selectClip", "scaleChange", "moveClip", "resizeClip", "change"],
|
|
83
|
-
setup(
|
|
84
|
-
const l =
|
|
128
|
+
setup(d, { expose: h, emit: m }) {
|
|
129
|
+
const l = d, o = m, i = u(null);
|
|
85
130
|
let e = null;
|
|
86
131
|
return v(() => {
|
|
87
|
-
|
|
88
|
-
container:
|
|
132
|
+
i.value && (e = _.create({
|
|
133
|
+
container: i.value,
|
|
89
134
|
project: l.defaultProject,
|
|
90
135
|
pxPerSec: l.defaultScale,
|
|
91
136
|
time: l.defaultTime,
|
|
@@ -95,36 +140,48 @@ const E = /* @__PURE__ */ g({
|
|
|
95
140
|
snap: l.snap,
|
|
96
141
|
autoFit: l.autoFit,
|
|
97
142
|
locale: l.locale,
|
|
98
|
-
onSeek: (
|
|
99
|
-
onSelectClip: (
|
|
100
|
-
onScaleChange: (
|
|
101
|
-
onMoveClip: (
|
|
102
|
-
onResizeClip: (
|
|
103
|
-
onChange: (
|
|
143
|
+
onSeek: (a) => o("seek", a),
|
|
144
|
+
onSelectClip: (a) => o("selectClip", a),
|
|
145
|
+
onScaleChange: (a) => o("scaleChange", a),
|
|
146
|
+
onMoveClip: (a, r) => o("moveClip", a, r),
|
|
147
|
+
onResizeClip: (a, r) => o("resizeClip", a, r),
|
|
148
|
+
onChange: (a) => o("change", a)
|
|
104
149
|
}));
|
|
105
|
-
}),
|
|
150
|
+
}), c(
|
|
106
151
|
() => l.locale,
|
|
107
|
-
(
|
|
108
|
-
|
|
152
|
+
(a) => {
|
|
153
|
+
a && e && e.setLocale(a);
|
|
109
154
|
}
|
|
110
|
-
),
|
|
155
|
+
), k(() => {
|
|
111
156
|
e == null || e.destroy(), e = null;
|
|
112
|
-
}),
|
|
157
|
+
}), h({
|
|
113
158
|
api: () => e
|
|
114
|
-
}), (
|
|
159
|
+
}), (a, r) => (p(), H("div", {
|
|
115
160
|
ref_key: "host",
|
|
116
|
-
ref:
|
|
161
|
+
ref: i,
|
|
117
162
|
"data-aicut-timeline-host": "",
|
|
118
163
|
style: { width: "100%", height: "240px" }
|
|
119
164
|
}, null, 512));
|
|
120
165
|
}
|
|
121
166
|
});
|
|
122
167
|
export {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
168
|
+
B as CanvasCompositorEngine,
|
|
169
|
+
P as HEADER_WIDTH,
|
|
170
|
+
j as HtmlVideoEngine,
|
|
171
|
+
F as IDENTITY_TRANSFORM,
|
|
172
|
+
L as RULER_HEIGHT,
|
|
173
|
+
w as TRACK_HEIGHT,
|
|
174
|
+
N as Timeline,
|
|
175
|
+
I as VideoEditor,
|
|
176
|
+
M as canvasCompositorEngineFactory,
|
|
177
|
+
V as createEmptyProject,
|
|
178
|
+
A as createId,
|
|
179
|
+
O as getEffectiveTransform,
|
|
180
|
+
U as getTransformAtTimelineTime,
|
|
181
|
+
$ as htmlVideoEngineFactory,
|
|
182
|
+
z as isIdentityTransform,
|
|
183
|
+
D as localeEn,
|
|
184
|
+
K as localeZh,
|
|
185
|
+
G as setTimelineMetrics
|
|
129
186
|
};
|
|
130
187
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/VideoEditor.vue","../src/Timeline.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { onBeforeUnmount, onMounted, ref, watch } from \"vue\";\nimport {\n Editor,\n type EditorApi,\n type Locale,\n type Ms,\n type Project,\n type Theme,\n} from \"@aicut/core\";\n\n/**\n * Vue 3 wrapper around `@aicut/core`. Same shape as `@aicut/react`:\n * uncontrolled for project state, theme is reactive, API exposed via\n * `defineExpose` so a parent `ref` can call cut/seek/setProject/etc.\n */\nconst props = defineProps<{\n defaultProject?: Project;\n theme?: Theme;\n /** UI string overrides (English default). Reactive — swap to `localeZh` for Chinese. */\n locale?: Partial<Locale>;\n}>();\n\nconst emit = defineEmits<{\n (e: \"ready\", api: EditorApi): void;\n (e: \"change\", project: Project): void;\n (e: \"export\", project: Project): void;\n (e: \"timeUpdate\", timeMs: Ms): void;\n (e: \"play\"): void;\n (e: \"pause\"): void;\n (e: \"selectionChange\", clipId: string | null): void;\n (e: \"error\", error: Error): void;\n}>();\n\nconst host = ref<HTMLDivElement | null>(null);\nlet editor: Editor | null = null;\nconst offs: Array<() => void> = [];\n/** Header slot DOM nodes — set after editor mount so Vue Teleports\n * have a valid target. Library renders nothing here; named slots\n * `#headerLeft` / `#headerRight` portal whatever the host provides. */\nconst headerLeftSlot = ref<HTMLElement | null>(null);\nconst headerRightSlot = ref<HTMLElement | null>(null);\n\nonMounted(() => {\n if (!host.value) return;\n editor = Editor.create({\n container: host.value,\n project: props.defaultProject,\n theme: props.theme,\n locale: props.locale,\n });\n\n offs.push(\n editor.on(\"change\", ({ project }) => emit(\"change\", project)),\n editor.on(\"export\", ({ project }) => emit(\"export\", project)),\n editor.on(\"time\", ({ timeMs }) => emit(\"timeUpdate\", timeMs)),\n editor.on(\"play\", () => emit(\"play\")),\n editor.on(\"pause\", () => emit(\"pause\")),\n editor.on(\"selectionChange\", ({ clipId }) =>\n emit(\"selectionChange\", clipId),\n ),\n editor.on(\"error\", ({ error }) => emit(\"error\", error)),\n );\n\n headerLeftSlot.value = editor.headerLeft;\n headerRightSlot.value = editor.headerRight;\n emit(\"ready\", editor);\n});\n\nwatch(\n () => props.theme,\n (theme) => {\n if (theme && editor) editor.setTheme(theme);\n },\n);\n\nwatch(\n () => props.locale,\n (locale) => {\n if (locale && editor) editor.setLocale(locale);\n },\n);\n\nonBeforeUnmount(() => {\n for (const off of offs) off();\n offs.length = 0;\n editor?.destroy();\n editor = null;\n headerLeftSlot.value = null;\n headerRightSlot.value = null;\n});\n\ndefineExpose({\n /** Returns the underlying core API or null if not yet mounted. */\n api: (): EditorApi | null => editor,\n});\n</script>\n\n<template>\n <div ref=\"host\" data-aicut-host=\"\">\n <Teleport v-if=\"headerLeftSlot\" :to=\"headerLeftSlot\">\n <slot name=\"headerLeft\" />\n </Teleport>\n <Teleport v-if=\"headerRightSlot\" :to=\"headerRightSlot\">\n <slot name=\"headerRight\" />\n </Teleport>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { onBeforeUnmount, onMounted, ref, watch } from \"vue\";\nimport {\n Timeline as CoreTimeline,\n type Clip,\n type Locale,\n type Ms,\n type Project,\n} from \"@aicut/core\";\n\n/**\n * Standalone canvas Timeline wrapped for Vue 3. Same surface as the\n * React `<Timeline>`: pass `defaultProject`, drive imperatively via\n * the exposed `api()` ref.\n */\nconst props = defineProps<{\n defaultProject: Project;\n defaultScale?: number;\n defaultTime?: Ms;\n defaultSelectedClipId?: string | null;\n showHeader?: boolean;\n readOnly?: boolean;\n snap?: boolean;\n autoFit?: boolean;\n locale?: Partial<Locale>;\n}>();\n\nconst emit = defineEmits<{\n (e: \"seek\", timeMs: Ms): void;\n (e: \"selectClip\", clipId: string | null): void;\n (e: \"scaleChange\", pxPerSec: number): void;\n (e: \"moveClip\", clipId: string, opts: { start?: Ms; trackId?: string }): void;\n (\n e: \"resizeClip\",\n clipId: string,\n edits: Partial<Pick<Clip, \"in\" | \"out\" | \"start\">>,\n ): void;\n (e: \"change\", project: Project): void;\n}>();\n\nconst host = ref<HTMLDivElement | null>(null);\nlet timeline: CoreTimeline | null = null;\n\nonMounted(() => {\n if (!host.value) return;\n timeline = CoreTimeline.create({\n container: host.value,\n project: props.defaultProject,\n pxPerSec: props.defaultScale,\n time: props.defaultTime,\n selectedClipId: props.defaultSelectedClipId ?? null,\n showHeader: props.showHeader,\n readOnly: props.readOnly,\n snap: props.snap,\n autoFit: props.autoFit,\n locale: props.locale,\n onSeek: (t) => emit(\"seek\", t),\n onSelectClip: (id) => emit(\"selectClip\", id),\n onScaleChange: (s) => emit(\"scaleChange\", s),\n onMoveClip: (id, opts) => emit(\"moveClip\", id, opts),\n onResizeClip: (id, edits) => emit(\"resizeClip\", id, edits),\n onChange: (p) => emit(\"change\", p),\n });\n});\n\nwatch(\n () => props.locale,\n (locale) => {\n if (locale && timeline) timeline.setLocale(locale);\n },\n);\n\nonBeforeUnmount(() => {\n timeline?.destroy();\n timeline = null;\n});\n\ndefineExpose({\n api: (): CoreTimeline | null => timeline,\n});\n</script>\n\n<template>\n <div ref=\"host\" data-aicut-timeline-host=\"\" :style=\"{ width: '100%', height: '240px' }\" />\n</template>\n"],"names":["props","__props","emit","__emit","host","ref","editor","offs","headerLeftSlot","headerRightSlot","onMounted","Editor","project","timeMs","clipId","error","watch","theme","locale","onBeforeUnmount","off","__expose","_createElementBlock","_createBlock","_Teleport","_renderSlot","_ctx","timeline","CoreTimeline","t","id","s","opts","edits","p"],"mappings":";;;;;;;;;;;;AAgBA,UAAMA,IAAQC,GAORC,IAAOC,GAWPC,IAAOC,EAA2B,IAAI;AAC5C,QAAIC,IAAwB;AAC5B,UAAMC,IAA0B,CAAA,GAI1BC,IAAiBH,EAAwB,IAAI,GAC7CI,IAAkBJ,EAAwB,IAAI;AAEpD,WAAAK,EAAU,MAAM;AACd,MAAKN,EAAK,UACVE,IAASK,EAAO,OAAO;AAAA,QACrB,WAAWP,EAAK;AAAA,QAChB,SAASJ,EAAM;AAAA,QACf,OAAOA,EAAM;AAAA,QACb,QAAQA,EAAM;AAAA,MAAA,CACf,GAEDO,EAAK;AAAA,QACHD,EAAO,GAAG,UAAU,CAAC,EAAE,SAAAM,Q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AAA,QAAAA,EAAU,WACVA,IAAW;AAAA,IACb,CAAC,GAEDN,EAAa;AAAA,MACX,KAAK,MAA2BM;AAAA,IAAA,CACjC,mBAICL,EAA0F,OAAA;AAAA,eAAjF;AAAA,MAAJ,KAAIlB;AAAA,MAAO,4BAAyB;AAAA,MAAI,OAAO,EAAA,OAAA,QAAA,QAAA,QAAA;AAAA,IAAA;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/VideoEditor.vue","../src/Timeline.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { onBeforeUnmount, onMounted, ref, watch } from \"vue\";\nimport {\n Editor,\n type EditorApi,\n type Locale,\n type Ms,\n type PlaybackEngineFactory,\n type Project,\n type Theme,\n} from \"@aicut/core\";\n\n/**\n * Vue 3 wrapper around `@aicut/core`. Same shape as `@aicut/react`:\n * uncontrolled for project state, theme is reactive, API exposed via\n * `defineExpose` so a parent `ref` can call cut/seek/setProject/etc.\n */\nconst props = defineProps<{\n defaultProject?: Project;\n theme?: Theme;\n /** UI string overrides (English default). Reactive — swap to `localeZh` for Chinese. */\n locale?: Partial<Locale>;\n /**\n * Initial-only factory for a custom playback engine. Defaults to the\n * built-in `HtmlVideoEngine`. Pass `WebCodecsEngine` (v0.6+) or your\n * own engine to override. Bound at mount; later prop changes are\n * ignored.\n */\n playbackEngine?: PlaybackEngineFactory;\n /**\n * Initial-only — pixel height of each track row (default 56). Lower\n * values (~32–40) shrink the timeline for small viewports. Applied\n * process-wide at construction time.\n */\n trackHeight?: number;\n /** Initial-only — pixel height of the timeline ruler (default 24). */\n rulerHeight?: number;\n /**\n * Pixel height of the whole bottom timeline area (default 240).\n * Reactive — swap any time to recompact. The canvas inside fills\n * 100% and shows an internal scrollbar when track count overflows.\n */\n timelineHeight?: number;\n /**\n * Per-clip keyframe animation (X / Y / Scale). Reactive — set\n * `{ enabled: true }` to surface keyframe diamonds on the timeline\n * and route the canvas-based engines through the transform pipeline.\n * Data is preserved when disabled.\n */\n keyframes?: { enabled?: boolean };\n /**\n * Jump-to-clip-edge toolbar cluster (|◀ ▶|) + I/O keyboard shortcuts.\n * Reactive — set `{ enabled: true }` to surface the buttons next to\n * the keyframe diamond and bind the shortcuts. Off hides the buttons\n * entirely (no toolbar space cost).\n */\n clipEdgeNav?: { enabled?: boolean };\n}>();\n\nconst emit = defineEmits<{\n (e: \"ready\", api: EditorApi): void;\n (e: \"change\", project: Project): void;\n (e: \"export\", project: Project): void;\n (e: \"timeUpdate\", timeMs: Ms): void;\n (e: \"play\"): void;\n (e: \"pause\"): void;\n (e: \"selectionChange\", clipId: string | null): void;\n (\n e: \"keyframeSelectionChange\",\n target: { clipId: string; keyframeId: string } | null,\n ): void;\n (e: \"error\", error: Error): void;\n}>();\n\nconst host = ref<HTMLDivElement | null>(null);\nlet editor: Editor | null = null;\nconst offs: Array<() => void> = [];\n/** Header slot DOM nodes — set after editor mount so Vue Teleports\n * have a valid target. Library renders nothing here; named slots\n * `#headerLeft` / `#headerRight` portal whatever the host provides. */\nconst headerLeftSlot = ref<HTMLElement | null>(null);\nconst headerRightSlot = ref<HTMLElement | null>(null);\n\nonMounted(() => {\n if (!host.value) return;\n editor = Editor.create({\n container: host.value,\n project: props.defaultProject,\n theme: props.theme,\n locale: props.locale,\n playbackEngine: props.playbackEngine,\n ...(props.trackHeight != null ? { trackHeight: props.trackHeight } : {}),\n ...(props.rulerHeight != null ? { rulerHeight: props.rulerHeight } : {}),\n ...(props.timelineHeight != null\n ? { timelineHeight: props.timelineHeight }\n : {}),\n ...(props.keyframes != null ? { keyframes: props.keyframes } : {}),\n ...(props.clipEdgeNav != null ? { clipEdgeNav: props.clipEdgeNav } : {}),\n });\n\n offs.push(\n editor.on(\"change\", ({ project }) => emit(\"change\", project)),\n editor.on(\"export\", ({ project }) => emit(\"export\", project)),\n editor.on(\"time\", ({ timeMs }) => emit(\"timeUpdate\", timeMs)),\n editor.on(\"play\", () => emit(\"play\")),\n editor.on(\"pause\", () => emit(\"pause\")),\n editor.on(\"selectionChange\", ({ clipId }) =>\n emit(\"selectionChange\", clipId),\n ),\n editor.on(\"keyframeSelectionChange\", ({ target }) =>\n emit(\"keyframeSelectionChange\", target),\n ),\n editor.on(\"error\", ({ error }) => emit(\"error\", error)),\n );\n\n headerLeftSlot.value = editor.headerLeft;\n headerRightSlot.value = editor.headerRight;\n emit(\"ready\", editor);\n});\n\nwatch(\n () => props.theme,\n (theme) => {\n if (theme && editor) editor.setTheme(theme);\n },\n);\n\nwatch(\n () => props.locale,\n (locale) => {\n if (locale && editor) editor.setLocale(locale);\n },\n);\n\n// Reactive — flip keyframe mode without remount. Data preserved.\nwatch(\n () => props.keyframes?.enabled,\n (enabled) => {\n if (!editor) return;\n const desired = enabled === true;\n if (editor.isKeyframesEnabled() !== desired) {\n editor.setKeyframesEnabled(desired);\n }\n },\n);\n\n// Reactive — flip clip-edge nav cluster (|◀ ▶|) + I/O shortcuts.\nwatch(\n () => props.clipEdgeNav?.enabled,\n (enabled) => {\n if (!editor) return;\n const desired = enabled === true;\n if (editor.isClipEdgeNavEnabled() !== desired) {\n editor.setClipEdgeNavEnabled(desired);\n }\n },\n);\n\n// Reactive — sets the CSS custom property directly so the timeline\n// height can be tweaked without remounting.\nwatch(\n () => props.timelineHeight,\n (timelineHeight) => {\n const root = host.value;\n if (!root) return;\n if (timelineHeight != null && timelineHeight > 0) {\n root.style.setProperty(\n \"--aicut-timeline-height\",\n `${Math.round(timelineHeight)}px`,\n );\n } else {\n root.style.removeProperty(\"--aicut-timeline-height\");\n }\n },\n);\n\nonBeforeUnmount(() => {\n for (const off of offs) off();\n offs.length = 0;\n editor?.destroy();\n editor = null;\n headerLeftSlot.value = null;\n headerRightSlot.value = null;\n});\n\ndefineExpose({\n /** Returns the underlying core API or null if not yet mounted. */\n api: (): EditorApi | null => editor,\n});\n</script>\n\n<template>\n <div ref=\"host\" data-aicut-host=\"\">\n <Teleport v-if=\"headerLeftSlot\" :to=\"headerLeftSlot\">\n <slot name=\"headerLeft\" />\n </Teleport>\n <Teleport v-if=\"headerRightSlot\" :to=\"headerRightSlot\">\n <slot name=\"headerRight\" />\n </Teleport>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { onBeforeUnmount, onMounted, ref, watch } from \"vue\";\nimport {\n Timeline as CoreTimeline,\n type Clip,\n type Locale,\n type Ms,\n type Project,\n} from \"@aicut/core\";\n\n/**\n * Standalone canvas Timeline wrapped for Vue 3. Same surface as the\n * React `<Timeline>`: pass `defaultProject`, drive imperatively via\n * the exposed `api()` ref.\n */\nconst props = defineProps<{\n defaultProject: Project;\n defaultScale?: number;\n defaultTime?: Ms;\n defaultSelectedClipId?: string | null;\n showHeader?: boolean;\n readOnly?: boolean;\n snap?: boolean;\n autoFit?: boolean;\n locale?: Partial<Locale>;\n}>();\n\nconst emit = defineEmits<{\n (e: \"seek\", timeMs: Ms): void;\n (e: \"selectClip\", clipId: string | null): void;\n (e: \"scaleChange\", pxPerSec: number): void;\n (e: \"moveClip\", clipId: string, opts: { start?: Ms; trackId?: string }): void;\n (\n e: \"resizeClip\",\n clipId: string,\n edits: Partial<Pick<Clip, \"in\" | \"out\" | \"start\">>,\n ): void;\n (e: \"change\", project: Project): void;\n}>();\n\nconst host = ref<HTMLDivElement | null>(null);\nlet timeline: CoreTimeline | null = null;\n\nonMounted(() => {\n if (!host.value) return;\n timeline = CoreTimeline.create({\n container: host.value,\n project: props.defaultProject,\n pxPerSec: props.defaultScale,\n time: props.defaultTime,\n selectedClipId: props.defaultSelectedClipId ?? null,\n showHeader: props.showHeader,\n readOnly: props.readOnly,\n snap: props.snap,\n autoFit: props.autoFit,\n locale: props.locale,\n onSeek: (t) => emit(\"seek\", t),\n onSelectClip: (id) => emit(\"selectClip\", id),\n onScaleChange: (s) => emit(\"scaleChange\", s),\n onMoveClip: (id, opts) => emit(\"moveClip\", id, opts),\n onResizeClip: (id, edits) => emit(\"resizeClip\", id, edits),\n onChange: (p) => emit(\"change\", p),\n });\n});\n\nwatch(\n () => props.locale,\n (locale) => {\n if (locale && timeline) timeline.setLocale(locale);\n },\n);\n\nonBeforeUnmount(() => {\n timeline?.destroy();\n timeline = null;\n});\n\ndefineExpose({\n api: (): CoreTimeline | null => timeline,\n});\n</script>\n\n<template>\n <div ref=\"host\" data-aicut-timeline-host=\"\" :style=\"{ width: '100%', height: '240px' }\" />\n</template>\n"],"names":["props","__props","emit","__emit","host","ref","editor","offs","headerLeftSlot","headerRightSlot","onMounted","Editor","project","timeMs","clipId","target","error","watch","theme","locale","_a","enabled","desired","timelineHeight","root","onBeforeUnmount","off","__expose","_createElementBlock","_createBlock","_Teleport","_renderSlot","_ctx","timeline","CoreTimeline","t","id","s","opts","edits","p"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,UAAMA,IAAQC,GA0CRC,IAAOC,GAePC,IAAOC,EAA2B,IAAI;AAC5C,QAAIC,IAAwB;AAC5B,UAAMC,IAA0B,CAAA,GAI1BC,IAAiBH,EAAwB,IAAI,GAC7CI,IAAkBJ,EAAwB,IAAI;AAEpD,WAAAK,EAAU,MAAM;AACd,MAAKN,EAAK,UACVE,IAASK,EAAO,OAAO;AAAA,QACrB,WAAWP,EAAK;AAAA,QAChB,SAASJ,EAAM;AAAA,QACf,OAAOA,EAAM;AAAA,QACb,QAAQA,EAAM;AAAA,QACd,gBAAgBA,EAAM;AAAA,QACtB,GAAIA,EAAM,eAAe,OAAO,EAAE,aAAaA,EAAM,YAAA,IAAgB,CAAA;AAAA,QACrE,GAAIA,EAAM,eAAe,OAAO,EAAE,aAAaA,EAAM,YAAA,IAAgB,CAAA;AAAA,QACrE,GAAIA,EAAM,kBAAkB,OACxB,EAAE,gBAAgBA,EAAM,eAAA,IACxB,CAAA;AAAA,QACJ,GAAIA,EAAM,aAAa,OAAO,EAAE,WAAWA,EAAM,UAAA,IAAc,CAAA;AAAA,QAC/D,GAAIA,EAAM,eAAe,OAAO,EAAE,aAAaA,EAAM,gBAAgB,CAAA;AAAA,MAAC,CACvE,GAEDO,EAAK;AAAA,QACH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symbol.toStringTag,{value:"Module"});const e=require("@aicut/core/webcodecs");Object.defineProperty(exports,"WebCodecsEngine",{enumerable:!0,get:()=>e.WebCodecsEngine});Object.defineProperty(exports,"isWebCodecsSupported",{enumerable:!0,get:()=>e.isWebCodecsSupported});Object.defineProperty(exports,"webCodecsEngineFactory",{enumerable:!0,get:()=>e.webCodecsEngineFactory});
|
|
2
|
+
//# sourceMappingURL=webcodecs.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webcodecs.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @aicut/vue/webcodecs — separate entry that pulls mp4box.js for
|
|
3
|
+
* frame-accurate WebCodecs playback. Users who never import this
|
|
4
|
+
* path don't pay the mp4box bundle cost.
|
|
5
|
+
*
|
|
6
|
+
* Pass the factory directly to `<VideoEditor :playback-engine="…" />`,
|
|
7
|
+
* or wrap it in a closure to flip `debug: true`.
|
|
8
|
+
*/
|
|
9
|
+
export { WebCodecsEngine, webCodecsEngineFactory, isWebCodecsSupported, type WebCodecsEngineOptions, type DemuxedTrack, } from "@aicut/core/webcodecs";
|
|
10
|
+
//# sourceMappingURL=webcodecs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webcodecs.d.ts","sourceRoot":"","sources":["../src/webcodecs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACpB,KAAK,sBAAsB,EAC3B,KAAK,YAAY,GAClB,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webcodecs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aicut/vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Vue 3 wrapper for the AiCut video editor + lighting picker — thin declarative shells over @aicut/core.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ziqiang <ziqiangytu@gmail.com>",
|
|
@@ -53,6 +53,11 @@
|
|
|
53
53
|
"types": "./dist/lighting.d.ts",
|
|
54
54
|
"import": "./dist/lighting.js",
|
|
55
55
|
"require": "./dist/lighting.cjs"
|
|
56
|
+
},
|
|
57
|
+
"./webcodecs": {
|
|
58
|
+
"types": "./dist/webcodecs.d.ts",
|
|
59
|
+
"import": "./dist/webcodecs.js",
|
|
60
|
+
"require": "./dist/webcodecs.cjs"
|
|
56
61
|
}
|
|
57
62
|
},
|
|
58
63
|
"files": [
|
|
@@ -60,7 +65,7 @@
|
|
|
60
65
|
"README.md"
|
|
61
66
|
],
|
|
62
67
|
"dependencies": {
|
|
63
|
-
"@aicut/core": "0.
|
|
68
|
+
"@aicut/core": "0.6.0"
|
|
64
69
|
},
|
|
65
70
|
"peerDependencies": {
|
|
66
71
|
"vue": "^3.4.0"
|