@aicut/vue 0.1.0 → 0.1.1
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 +46 -27
- package/package.json +36 -2
package/README.md
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
# @aicut/vue
|
|
2
2
|
|
|
3
|
-
Vue 3 wrapper
|
|
3
|
+
> Vue 3 wrapper for the **AiCut** video editor — canvas timeline, custom toolbar slots, theming, i18n, drop-in `<VideoEditor>`.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@aicut/vue)
|
|
6
|
+
[](./LICENSE)
|
|
7
|
+
[](https://github.com/ziqiangai/AiCut)
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
## Install
|
|
4
12
|
|
|
5
13
|
```bash
|
|
6
14
|
pnpm add @aicut/vue @aicut/core
|
|
@@ -20,12 +28,14 @@ import "@aicut/core/styles.css";
|
|
|
20
28
|
|
|
21
29
|
const project: Project = {
|
|
22
30
|
version: 1,
|
|
23
|
-
sources: [
|
|
24
|
-
|
|
25
|
-
{ id: "t1", kind: "video", clips: [
|
|
26
|
-
{ id: "c1", sourceId: "s1", in: 0, out: 5000, start: 0 },
|
|
27
|
-
]},
|
|
31
|
+
sources: [
|
|
32
|
+
{ id: "s1", url: "/media/a.mp4", kind: "video", name: "a.mp4" },
|
|
28
33
|
],
|
|
34
|
+
tracks: [{
|
|
35
|
+
id: "t1",
|
|
36
|
+
kind: "video",
|
|
37
|
+
clips: [{ id: "c1", sourceId: "s1", in: 0, out: 5000, start: 0 }],
|
|
38
|
+
}],
|
|
29
39
|
};
|
|
30
40
|
|
|
31
41
|
const editor = ref<{ api(): EditorApi | null } | null>(null);
|
|
@@ -53,29 +63,36 @@ async function doExport(p: Project) {
|
|
|
53
63
|
</template>
|
|
54
64
|
```
|
|
55
65
|
|
|
56
|
-
The component is **uncontrolled for project state**. Restore later with
|
|
66
|
+
The component is **uncontrolled for project state**. Restore later with:
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
editor.value?.api()?.setProject(saved);
|
|
70
|
+
```
|
|
57
71
|
|
|
58
72
|
## Props
|
|
59
73
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
74
|
+
```ts
|
|
75
|
+
interface VideoEditorProps {
|
|
76
|
+
defaultProject?: Project;
|
|
77
|
+
theme?: Theme; // CSS-var overrides; reactive
|
|
78
|
+
locale?: Partial<Locale>; // EN default; pass localeZh for ZH; reactive
|
|
79
|
+
}
|
|
80
|
+
```
|
|
65
81
|
|
|
66
82
|
## Events
|
|
67
83
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
84
|
+
```ts
|
|
85
|
+
ready (api: EditorApi)
|
|
86
|
+
change (project: Project)
|
|
87
|
+
export (project: Project) // fired by api.requestExport()
|
|
88
|
+
time-update (timeMs: number)
|
|
89
|
+
play ()
|
|
90
|
+
pause ()
|
|
91
|
+
selection-change (clipId: string | null)
|
|
92
|
+
error (error: Error)
|
|
93
|
+
```
|
|
77
94
|
|
|
78
|
-
The exposed `api()` returns the
|
|
95
|
+
The exposed `api()` returns the full **`EditorApi`** described in [@aicut/core](https://www.npmjs.com/package/@aicut/core) — `play`, `pause`, `seek`, `split`, `setProject`, `requestExport`, `setTheme`, `setLocale`, and more.
|
|
79
96
|
|
|
80
97
|
## Theming
|
|
81
98
|
|
|
@@ -93,8 +110,6 @@ The exposed `api()` returns the same `EditorApi` instance described in [`@aicut/
|
|
|
93
110
|
/>
|
|
94
111
|
```
|
|
95
112
|
|
|
96
|
-
The `theme` prop is reactive — swap the binding and the editor calls `setTheme` internally.
|
|
97
|
-
|
|
98
113
|
## i18n
|
|
99
114
|
|
|
100
115
|
```vue
|
|
@@ -103,7 +118,9 @@ import { ref, computed } from "vue";
|
|
|
103
118
|
import { VideoEditor, localeEn, localeZh, type Locale } from "@aicut/vue";
|
|
104
119
|
|
|
105
120
|
const lang = ref<"en" | "zh">("en");
|
|
106
|
-
const locale = computed<Locale>(() =>
|
|
121
|
+
const locale = computed<Locale>(() =>
|
|
122
|
+
lang.value === "zh" ? localeZh : localeEn,
|
|
123
|
+
);
|
|
107
124
|
</script>
|
|
108
125
|
|
|
109
126
|
<template>
|
|
@@ -111,6 +128,8 @@ const locale = computed<Locale>(() => (lang.value === "zh" ? localeZh : localeEn
|
|
|
111
128
|
</template>
|
|
112
129
|
```
|
|
113
130
|
|
|
131
|
+
`locale` swap re-titles the toolbar and re-paints canvas labels in place.
|
|
132
|
+
|
|
114
133
|
## Standalone `<Timeline>`
|
|
115
134
|
|
|
116
135
|
```vue
|
|
@@ -131,6 +150,6 @@ const picked = ref(0);
|
|
|
131
150
|
</template>
|
|
132
151
|
```
|
|
133
152
|
|
|
134
|
-
|
|
153
|
+
---
|
|
135
154
|
|
|
136
|
-
|
|
155
|
+
[Full docs & demo](https://github.com/ziqiangai/AiCut) · [@aicut/core](https://www.npmjs.com/package/@aicut/core) · [@aicut/react](https://www.npmjs.com/package/@aicut/react)
|
package/package.json
CHANGED
|
@@ -1,8 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aicut/vue",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Vue 3 wrapper for the AiCut video editor — thin declarative shell over @aicut/core.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"author": "ziqiang <ziqiangytu@gmail.com>",
|
|
7
|
+
"homepage": "https://github.com/ziqiangai/AiCut#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/ziqiangai/AiCut.git",
|
|
11
|
+
"directory": "packages/vue"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/ziqiangai/AiCut/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"video-editor",
|
|
18
|
+
"video-editing",
|
|
19
|
+
"vue",
|
|
20
|
+
"vue3",
|
|
21
|
+
"vue-component",
|
|
22
|
+
"timeline",
|
|
23
|
+
"timeline-editor",
|
|
24
|
+
"nle",
|
|
25
|
+
"video-cutter",
|
|
26
|
+
"video-clip",
|
|
27
|
+
"canvas",
|
|
28
|
+
"video",
|
|
29
|
+
"editor",
|
|
30
|
+
"mp4",
|
|
31
|
+
"component",
|
|
32
|
+
"capcut",
|
|
33
|
+
"premiere",
|
|
34
|
+
"final-cut",
|
|
35
|
+
"davinci",
|
|
36
|
+
"imovie",
|
|
37
|
+
"veed",
|
|
38
|
+
"filmora"
|
|
39
|
+
],
|
|
6
40
|
"type": "module",
|
|
7
41
|
"main": "./dist/index.cjs",
|
|
8
42
|
"module": "./dist/index.js",
|
|
@@ -19,7 +53,7 @@
|
|
|
19
53
|
"README.md"
|
|
20
54
|
],
|
|
21
55
|
"dependencies": {
|
|
22
|
-
"@aicut/core": "0.1.
|
|
56
|
+
"@aicut/core": "0.1.1"
|
|
23
57
|
},
|
|
24
58
|
"peerDependencies": {
|
|
25
59
|
"vue": "^3.4.0"
|