@aicut/vue 0.1.1 → 0.3.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 +39 -0
- package/dist/LightingEditor.vue.d.ts +26 -0
- package/dist/LightingEditor.vue.d.ts.map +1 -0
- package/dist/Timeline.vue.d.ts +2 -2
- package/dist/Timeline.vue.d.ts.map +1 -1
- package/dist/VideoEditor.vue.d.ts +2 -2
- package/dist/lighting.cjs +2 -0
- package/dist/lighting.cjs.map +1 -0
- package/dist/lighting.d.ts +7 -0
- package/dist/lighting.d.ts.map +1 -0
- package/dist/lighting.js +62 -0
- package/dist/lighting.js.map +1 -0
- package/package.json +11 -4
package/README.md
CHANGED
|
@@ -130,6 +130,45 @@ const locale = computed<Locale>(() =>
|
|
|
130
130
|
|
|
131
131
|
`locale` swap re-titles the toolbar and re-paints canvas labels in place.
|
|
132
132
|
|
|
133
|
+
## `<LightingEditor>` (opt-in sub-entry)
|
|
134
|
+
|
|
135
|
+
A 3D lighting director for AI relighting flows — separate sub-entry; three.js bundles only here.
|
|
136
|
+
|
|
137
|
+
```vue
|
|
138
|
+
<script setup lang="ts">
|
|
139
|
+
import { ref } from "vue";
|
|
140
|
+
import { LightingEditor, type LightingConfig } from "@aicut/vue/lighting";
|
|
141
|
+
import "@aicut/core/styles.css";
|
|
142
|
+
|
|
143
|
+
const editor = ref<{ api(): any } | null>(null);
|
|
144
|
+
|
|
145
|
+
function onChange(cfg: LightingConfig) {
|
|
146
|
+
console.log(cfg);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function onGenerate(cfg: LightingConfig) {
|
|
150
|
+
fetch("/relight", { method: "POST", body: JSON.stringify(cfg) });
|
|
151
|
+
}
|
|
152
|
+
</script>
|
|
153
|
+
|
|
154
|
+
<template>
|
|
155
|
+
<LightingEditor
|
|
156
|
+
ref="editor"
|
|
157
|
+
subject-image-url="/frames/subject.jpg"
|
|
158
|
+
smart-enabled
|
|
159
|
+
@change="onChange"
|
|
160
|
+
@generate="onGenerate"
|
|
161
|
+
>
|
|
162
|
+
<template #smart>
|
|
163
|
+
<textarea placeholder="Describe the mood…" />
|
|
164
|
+
<button @click="editor?.api()?.requestGenerate()">Generate</button>
|
|
165
|
+
</template>
|
|
166
|
+
</LightingEditor>
|
|
167
|
+
</template>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Props: `subjectImageUrl`, `defaultConfig`, `defaultView`, `theme`, `locale`, `smartEnabled`, `smartOpen`. Events: `ready`, `change`, `generate`. Use the named `<slot name="smart">` for the smart-mode panel content.
|
|
171
|
+
|
|
133
172
|
## Standalone `<Timeline>`
|
|
134
173
|
|
|
135
174
|
```vue
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { LightingEditor as CoreLightingEditor, type LightingConfig, type LightingEditorOptions, type LightingView } from "@aicut/core/lighting";
|
|
2
|
+
import type { Theme } from "@aicut/core";
|
|
3
|
+
/**
|
|
4
|
+
* Vue 3 shell for the 3D lighting picker. Renders scene + controls;
|
|
5
|
+
* nothing else. Host code lays out their own surrounding UI (smart
|
|
6
|
+
* mode panel, generate button, etc.) alongside this component in
|
|
7
|
+
* their own template.
|
|
8
|
+
*/
|
|
9
|
+
type __VLS_Props = {
|
|
10
|
+
subjectImageUrl?: string;
|
|
11
|
+
defaultConfig?: Partial<LightingConfig>;
|
|
12
|
+
defaultView?: LightingView;
|
|
13
|
+
theme?: Theme;
|
|
14
|
+
locale?: LightingEditorOptions["locale"];
|
|
15
|
+
};
|
|
16
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {
|
|
17
|
+
api: () => CoreLightingEditor | null;
|
|
18
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
19
|
+
ready: (api: CoreLightingEditor) => any;
|
|
20
|
+
change: (cfg: LightingConfig) => any;
|
|
21
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
22
|
+
onReady?: ((api: CoreLightingEditor) => any) | undefined;
|
|
23
|
+
onChange?: ((cfg: LightingConfig) => any) | undefined;
|
|
24
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
25
|
+
export default _default;
|
|
26
|
+
//# sourceMappingURL=LightingEditor.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LightingEditor.vue.d.ts","sourceRoot":"","sources":["../src/LightingEditor.vue"],"names":[],"mappings":"AAiFA,OAAO,EACL,cAAc,IAAI,kBAAkB,EACpC,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC;;;;;GAKG;AACH,KAAK,WAAW,GAAG;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACxC,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,MAAM,CAAC,EAAE,qBAAqB,CAAC,QAAQ,CAAC,CAAC;CAC1C,CAAC;;eAmDS,kBAAkB,GAAG,IAAI;;;;;;;;AAuCpC,wBAQG"}
|
package/dist/Timeline.vue.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ type __VLS_Props = {
|
|
|
18
18
|
declare const _default: import("vue").DefineComponent<__VLS_Props, {
|
|
19
19
|
api: () => CoreTimeline | null;
|
|
20
20
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
21
|
+
change: (project: Project) => any;
|
|
21
22
|
seek: (timeMs: number) => any;
|
|
22
23
|
selectClip: (clipId: string | null) => any;
|
|
23
24
|
scaleChange: (pxPerSec: number) => any;
|
|
@@ -26,8 +27,8 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {
|
|
|
26
27
|
trackId?: string;
|
|
27
28
|
}) => any;
|
|
28
29
|
resizeClip: (clipId: string, edits: Partial<Pick<Clip, "in" | "out" | "start">>) => any;
|
|
29
|
-
change: (project: Project) => any;
|
|
30
30
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
31
|
+
onChange?: ((project: Project) => any) | undefined;
|
|
31
32
|
onSeek?: ((timeMs: number) => any) | undefined;
|
|
32
33
|
onSelectClip?: ((clipId: string | null) => any) | undefined;
|
|
33
34
|
onScaleChange?: ((pxPerSec: number) => any) | undefined;
|
|
@@ -36,7 +37,6 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {
|
|
|
36
37
|
trackId?: string;
|
|
37
38
|
}) => any) | undefined;
|
|
38
39
|
onResizeClip?: ((clipId: string, edits: Partial<Pick<Clip, "in" | "out" | "start">>) => any) | undefined;
|
|
39
|
-
onChange?: ((project: Project) => any) | undefined;
|
|
40
40
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
41
41
|
export default _default;
|
|
42
42
|
//# sourceMappingURL=Timeline.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Timeline.vue.d.ts","sourceRoot":"","sources":["../src/Timeline.vue"],"names":[],"mappings":"AAwFA,OAAO,EACL,QAAQ,IAAI,YAAY,EACxB,KAAK,IAAI,EACT,KAAK,MAAM,EACX,KAAK,EAAE,EACP,KAAK,OAAO,EACb,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,EAAE,CAAC;IACjB,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;CAC1B,CAAC;;eAuDS,YAAY,GAAG,IAAI
|
|
1
|
+
{"version":3,"file":"Timeline.vue.d.ts","sourceRoot":"","sources":["../src/Timeline.vue"],"names":[],"mappings":"AAwFA,OAAO,EACL,QAAQ,IAAI,YAAY,EACxB,KAAK,IAAI,EACT,KAAK,MAAM,EACX,KAAK,EAAE,EACP,KAAK,OAAO,EACb,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,EAAE,CAAC;IACjB,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;CAC1B,CAAC;;eAuDS,YAAY,GAAG,IAAI;;;;;;;gBAhDoB,EAAE;kBAAY,MAAM;;;;;;;;;gBAApB,EAAE;kBAAY,MAAM;;;;AAwFtE,wBAQG"}
|
|
@@ -14,8 +14,8 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {
|
|
|
14
14
|
/** Returns the underlying core API or null if not yet mounted. */
|
|
15
15
|
api: () => EditorApi | null;
|
|
16
16
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
17
|
-
change: (project: Project) => any;
|
|
18
17
|
ready: (api: EditorApi) => any;
|
|
18
|
+
change: (project: Project) => any;
|
|
19
19
|
export: (project: Project) => any;
|
|
20
20
|
timeUpdate: (timeMs: number) => any;
|
|
21
21
|
play: () => any;
|
|
@@ -23,8 +23,8 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {
|
|
|
23
23
|
selectionChange: (clipId: string | null) => any;
|
|
24
24
|
error: (error: Error) => any;
|
|
25
25
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
26
|
-
onChange?: ((project: Project) => any) | undefined;
|
|
27
26
|
onReady?: ((api: EditorApi) => any) | undefined;
|
|
27
|
+
onChange?: ((project: Project) => any) | undefined;
|
|
28
28
|
onExport?: ((project: Project) => any) | undefined;
|
|
29
29
|
onTimeUpdate?: ((timeMs: number) => any) | undefined;
|
|
30
30
|
onPlay?: (() => any) | undefined;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),i=require("@aicut/core/lighting"),u=n.defineComponent({__name:"LightingEditor",props:{subjectImageUrl:{},defaultConfig:{},defaultView:{},theme:{},locale:{}},emits:["ready","change"],setup(l,{expose:c,emit:g}){const r=l,a=g,o=n.useTemplateRef("host");let e=null;return n.onMounted(()=>{o.value&&(e=i.LightingEditor.create({container:o.value,subjectImageUrl:r.subjectImageUrl,config:r.defaultConfig,view:r.defaultView,theme:r.theme,locale:r.locale,onChange:t=>a("change",t)}),a("ready",e))}),n.watch(()=>r.theme,t=>{t&&e&&e.setTheme(t)}),n.watch(()=>r.locale,t=>{e&&e.setLocale(t??{})}),n.watch(()=>r.subjectImageUrl,t=>{t&&e&&e.setSubjectImage(t)}),n.onBeforeUnmount(()=>{e==null||e.destroy(),e=null}),c({api:()=>e}),(t,s)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"host",ref:o,"data-aicut-lighting-host":""},null,512))}});Object.defineProperty(exports,"DEFAULT_LIGHTING_CONFIG",{enumerable:!0,get:()=>i.DEFAULT_LIGHTING_CONFIG});Object.defineProperty(exports,"PRESET_DIRECTIONS",{enumerable:!0,get:()=>i.PRESET_DIRECTIONS});Object.defineProperty(exports,"lightingLocaleEn",{enumerable:!0,get:()=>i.lightingLocaleEn});Object.defineProperty(exports,"lightingLocaleZh",{enumerable:!0,get:()=>i.lightingLocaleZh});Object.defineProperty(exports,"mergeLightingLocale",{enumerable:!0,get:()=>i.mergeLightingLocale});Object.defineProperty(exports,"snapToPreset",{enumerable:!0,get:()=>i.snapToPreset});exports.LightingEditor=u;
|
|
2
|
+
//# sourceMappingURL=lighting.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lighting.cjs","sources":["../src/LightingEditor.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { onBeforeUnmount, onMounted, useTemplateRef, watch } from \"vue\";\nimport {\n LightingEditor as CoreLightingEditor,\n type LightingConfig,\n type LightingEditorOptions,\n type LightingView,\n} from \"@aicut/core/lighting\";\nimport type { Theme } from \"@aicut/core\";\n\n/**\n * Vue 3 shell for the 3D lighting picker. Renders scene + controls;\n * nothing else. Host code lays out their own surrounding UI (smart\n * mode panel, generate button, etc.) alongside this component in\n * their own template.\n */\nconst props = defineProps<{\n subjectImageUrl?: string;\n defaultConfig?: Partial<LightingConfig>;\n defaultView?: LightingView;\n theme?: Theme;\n locale?: LightingEditorOptions[\"locale\"];\n}>();\n\nconst emit = defineEmits<{\n (e: \"ready\", api: CoreLightingEditor): void;\n (e: \"change\", cfg: LightingConfig): void;\n}>();\n\nconst host = useTemplateRef<HTMLDivElement>(\"host\");\nlet editor: CoreLightingEditor | null = null;\n\nonMounted(() => {\n if (!host.value) return;\n editor = CoreLightingEditor.create({\n container: host.value,\n subjectImageUrl: props.subjectImageUrl,\n config: props.defaultConfig,\n view: props.defaultView,\n theme: props.theme,\n locale: props.locale,\n onChange: (cfg) => emit(\"change\", cfg),\n });\n emit(\"ready\", editor);\n});\n\nwatch(\n () => props.theme,\n (theme) => {\n if (theme && editor) editor.setTheme(theme);\n },\n);\nwatch(\n () => props.locale,\n (locale) => {\n if (editor) editor.setLocale(locale ?? {});\n },\n);\nwatch(\n () => props.subjectImageUrl,\n (url) => {\n if (url && editor) editor.setSubjectImage(url);\n },\n);\n\nonBeforeUnmount(() => {\n editor?.destroy();\n editor = null;\n});\n\ndefineExpose({\n api: (): CoreLightingEditor | null => editor,\n});\n</script>\n\n<template>\n <div ref=\"host\" data-aicut-lighting-host=\"\" />\n</template>\n"],"names":["props","__props","emit","__emit","host","useTemplateRef","editor","onMounted","CoreLightingEditor","cfg","watch","theme","locale","url","onBeforeUnmount","__expose","_createElementBlock"],"mappings":"wTAgBA,MAAMA,EAAQC,EAQRC,EAAOC,EAKPC,EAAOC,EAAAA,eAA+B,MAAM,EAClD,IAAIC,EAAoC,KAExCC,OAAAA,EAAAA,UAAU,IAAM,CACTH,EAAK,QACVE,EAASE,EAAAA,eAAmB,OAAO,CACjC,UAAWJ,EAAK,MAChB,gBAAiBJ,EAAM,gBACvB,OAAQA,EAAM,cACd,KAAMA,EAAM,YACZ,MAAOA,EAAM,MACb,OAAQA,EAAM,OACd,SAAWS,GAAQP,EAAK,SAAUO,CAAG,CAAA,CACtC,EACDP,EAAK,QAASI,CAAM,EACtB,CAAC,EAEDI,EAAAA,MACE,IAAMV,EAAM,MACXW,GAAU,CACLA,GAASL,GAAQA,EAAO,SAASK,CAAK,CAC5C,CAAA,EAEFD,EAAAA,MACE,IAAMV,EAAM,OACXY,GAAW,CACNN,GAAQA,EAAO,UAAUM,GAAU,CAAA,CAAE,CAC3C,CAAA,EAEFF,EAAAA,MACE,IAAMV,EAAM,gBACXa,GAAQ,CACHA,GAAOP,GAAQA,EAAO,gBAAgBO,CAAG,CAC/C,CAAA,EAGFC,EAAAA,gBAAgB,IAAM,CACpBR,GAAA,MAAAA,EAAQ,UACRA,EAAS,IACX,CAAC,EAEDS,EAAa,CACX,IAAK,IAAiCT,CAAA,CACvC,wBAICU,EAAAA,mBAA8C,MAAA,SAArC,OAAJ,IAAIZ,EAAO,2BAAyB,EAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @aicut/vue/lighting — separate entry that pulls three.js.
|
|
3
|
+
*/
|
|
4
|
+
export { default as LightingEditor } from "./LightingEditor.vue";
|
|
5
|
+
export { DEFAULT_LIGHTING_CONFIG, PRESET_DIRECTIONS, lightingLocaleEn, lightingLocaleZh, mergeLightingLocale, snapToPreset, } from "@aicut/core/lighting";
|
|
6
|
+
export type { KeyPreset, LightingConfig, LightingEditorOptions, LightingLocale, LightingView, } from "@aicut/core/lighting";
|
|
7
|
+
//# sourceMappingURL=lighting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lighting.d.ts","sourceRoot":"","sources":["../src/lighting.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEjE,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,YAAY,GACb,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,SAAS,EACT,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,YAAY,GACb,MAAM,sBAAsB,CAAC"}
|
package/dist/lighting.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { defineComponent as g, useTemplateRef as s, onMounted as m, watch as a, onBeforeUnmount as h, openBlock as u, createElementBlock as f } from "vue";
|
|
2
|
+
import { LightingEditor as p } from "@aicut/core/lighting";
|
|
3
|
+
import { DEFAULT_LIGHTING_CONFIG as C, PRESET_DIRECTIONS as U, lightingLocaleEn as b, lightingLocaleZh as j, mergeLightingLocale as v, snapToPreset as w } from "@aicut/core/lighting";
|
|
4
|
+
const _ = /* @__PURE__ */ g({
|
|
5
|
+
__name: "LightingEditor",
|
|
6
|
+
props: {
|
|
7
|
+
subjectImageUrl: {},
|
|
8
|
+
defaultConfig: {},
|
|
9
|
+
defaultView: {},
|
|
10
|
+
theme: {},
|
|
11
|
+
locale: {}
|
|
12
|
+
},
|
|
13
|
+
emits: ["ready", "change"],
|
|
14
|
+
setup(l, { expose: c, emit: r }) {
|
|
15
|
+
const o = l, i = r, n = s("host");
|
|
16
|
+
let e = null;
|
|
17
|
+
return m(() => {
|
|
18
|
+
n.value && (e = p.create({
|
|
19
|
+
container: n.value,
|
|
20
|
+
subjectImageUrl: o.subjectImageUrl,
|
|
21
|
+
config: o.defaultConfig,
|
|
22
|
+
view: o.defaultView,
|
|
23
|
+
theme: o.theme,
|
|
24
|
+
locale: o.locale,
|
|
25
|
+
onChange: (t) => i("change", t)
|
|
26
|
+
}), i("ready", e));
|
|
27
|
+
}), a(
|
|
28
|
+
() => o.theme,
|
|
29
|
+
(t) => {
|
|
30
|
+
t && e && e.setTheme(t);
|
|
31
|
+
}
|
|
32
|
+
), a(
|
|
33
|
+
() => o.locale,
|
|
34
|
+
(t) => {
|
|
35
|
+
e && e.setLocale(t ?? {});
|
|
36
|
+
}
|
|
37
|
+
), a(
|
|
38
|
+
() => o.subjectImageUrl,
|
|
39
|
+
(t) => {
|
|
40
|
+
t && e && e.setSubjectImage(t);
|
|
41
|
+
}
|
|
42
|
+
), h(() => {
|
|
43
|
+
e == null || e.destroy(), e = null;
|
|
44
|
+
}), c({
|
|
45
|
+
api: () => e
|
|
46
|
+
}), (t, d) => (u(), f("div", {
|
|
47
|
+
ref_key: "host",
|
|
48
|
+
ref: n,
|
|
49
|
+
"data-aicut-lighting-host": ""
|
|
50
|
+
}, null, 512));
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
export {
|
|
54
|
+
C as DEFAULT_LIGHTING_CONFIG,
|
|
55
|
+
_ as LightingEditor,
|
|
56
|
+
U as PRESET_DIRECTIONS,
|
|
57
|
+
b as lightingLocaleEn,
|
|
58
|
+
j as lightingLocaleZh,
|
|
59
|
+
v as mergeLightingLocale,
|
|
60
|
+
w as snapToPreset
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=lighting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lighting.js","sources":["../src/LightingEditor.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { onBeforeUnmount, onMounted, useTemplateRef, watch } from \"vue\";\nimport {\n LightingEditor as CoreLightingEditor,\n type LightingConfig,\n type LightingEditorOptions,\n type LightingView,\n} from \"@aicut/core/lighting\";\nimport type { Theme } from \"@aicut/core\";\n\n/**\n * Vue 3 shell for the 3D lighting picker. Renders scene + controls;\n * nothing else. Host code lays out their own surrounding UI (smart\n * mode panel, generate button, etc.) alongside this component in\n * their own template.\n */\nconst props = defineProps<{\n subjectImageUrl?: string;\n defaultConfig?: Partial<LightingConfig>;\n defaultView?: LightingView;\n theme?: Theme;\n locale?: LightingEditorOptions[\"locale\"];\n}>();\n\nconst emit = defineEmits<{\n (e: \"ready\", api: CoreLightingEditor): void;\n (e: \"change\", cfg: LightingConfig): void;\n}>();\n\nconst host = useTemplateRef<HTMLDivElement>(\"host\");\nlet editor: CoreLightingEditor | null = null;\n\nonMounted(() => {\n if (!host.value) return;\n editor = CoreLightingEditor.create({\n container: host.value,\n subjectImageUrl: props.subjectImageUrl,\n config: props.defaultConfig,\n view: props.defaultView,\n theme: props.theme,\n locale: props.locale,\n onChange: (cfg) => emit(\"change\", cfg),\n });\n emit(\"ready\", editor);\n});\n\nwatch(\n () => props.theme,\n (theme) => {\n if (theme && editor) editor.setTheme(theme);\n },\n);\nwatch(\n () => props.locale,\n (locale) => {\n if (editor) editor.setLocale(locale ?? {});\n },\n);\nwatch(\n () => props.subjectImageUrl,\n (url) => {\n if (url && editor) editor.setSubjectImage(url);\n },\n);\n\nonBeforeUnmount(() => {\n editor?.destroy();\n editor = null;\n});\n\ndefineExpose({\n api: (): CoreLightingEditor | null => editor,\n});\n</script>\n\n<template>\n <div ref=\"host\" data-aicut-lighting-host=\"\" />\n</template>\n"],"names":["props","__props","emit","__emit","host","useTemplateRef","editor","onMounted","CoreLightingEditor","cfg","watch","theme","locale","url","onBeforeUnmount","__expose","_createElementBlock"],"mappings":";;;;;;;;;;;;;;AAgBA,UAAMA,IAAQC,GAQRC,IAAOC,GAKPC,IAAOC,EAA+B,MAAM;AAClD,QAAIC,IAAoC;AAExC,WAAAC,EAAU,MAAM;AACd,MAAKH,EAAK,UACVE,IAASE,EAAmB,OAAO;AAAA,QACjC,WAAWJ,EAAK;AAAA,QAChB,iBAAiBJ,EAAM;AAAA,QACvB,QAAQA,EAAM;AAAA,QACd,MAAMA,EAAM;AAAA,QACZ,OAAOA,EAAM;AAAA,QACb,QAAQA,EAAM;AAAA,QACd,UAAU,CAACS,MAAQP,EAAK,UAAUO,CAAG;AAAA,MAAA,CACtC,GACDP,EAAK,SAASI,CAAM;AAAA,IACtB,CAAC,GAEDI;AAAA,MACE,MAAMV,EAAM;AAAA,MACZ,CAACW,MAAU;AACT,QAAIA,KAASL,KAAQA,EAAO,SAASK,CAAK;AAAA,MAC5C;AAAA,IAAA,GAEFD;AAAA,MACE,MAAMV,EAAM;AAAA,MACZ,CAACY,MAAW;AACV,QAAIN,KAAQA,EAAO,UAAUM,KAAU,CAAA,CAAE;AAAA,MAC3C;AAAA,IAAA,GAEFF;AAAA,MACE,MAAMV,EAAM;AAAA,MACZ,CAACa,MAAQ;AACP,QAAIA,KAAOP,KAAQA,EAAO,gBAAgBO,CAAG;AAAA,MAC/C;AAAA,IAAA,GAGFC,EAAgB,MAAM;AACpB,MAAAR,KAAA,QAAAA,EAAQ,WACRA,IAAS;AAAA,IACX,CAAC,GAEDS,EAAa;AAAA,MACX,KAAK,MAAiCT;AAAA,IAAA,CACvC,mBAICU,EAA8C,OAAA;AAAA,eAArC;AAAA,MAAJ,KAAIZ;AAAA,MAAO,4BAAyB;AAAA,IAAA;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aicut/vue",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Vue 3 wrapper for the AiCut video editor — thin declarative
|
|
3
|
+
"version": "0.3.0",
|
|
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>",
|
|
7
7
|
"homepage": "https://github.com/ziqiangai/AiCut#readme",
|
|
@@ -35,7 +35,9 @@
|
|
|
35
35
|
"davinci",
|
|
36
36
|
"imovie",
|
|
37
37
|
"veed",
|
|
38
|
-
"filmora"
|
|
38
|
+
"filmora",
|
|
39
|
+
"lighting",
|
|
40
|
+
"three.js"
|
|
39
41
|
],
|
|
40
42
|
"type": "module",
|
|
41
43
|
"main": "./dist/index.cjs",
|
|
@@ -46,6 +48,11 @@
|
|
|
46
48
|
"types": "./dist/index.d.ts",
|
|
47
49
|
"import": "./dist/index.js",
|
|
48
50
|
"require": "./dist/index.cjs"
|
|
51
|
+
},
|
|
52
|
+
"./lighting": {
|
|
53
|
+
"types": "./dist/lighting.d.ts",
|
|
54
|
+
"import": "./dist/lighting.js",
|
|
55
|
+
"require": "./dist/lighting.cjs"
|
|
49
56
|
}
|
|
50
57
|
},
|
|
51
58
|
"files": [
|
|
@@ -53,7 +60,7 @@
|
|
|
53
60
|
"README.md"
|
|
54
61
|
],
|
|
55
62
|
"dependencies": {
|
|
56
|
-
"@aicut/core": "0.
|
|
63
|
+
"@aicut/core": "0.3.0"
|
|
57
64
|
},
|
|
58
65
|
"peerDependencies": {
|
|
59
66
|
"vue": "^3.4.0"
|