@aicut/vue 0.2.0 → 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.
@@ -1,10 +1,10 @@
1
1
  import { LightingEditor as CoreLightingEditor, type LightingConfig, type LightingEditorOptions, type LightingView } from "@aicut/core/lighting";
2
2
  import type { Theme } from "@aicut/core";
3
3
  /**
4
- * Vue 3 wrapper around the core `LightingEditor`. Same shape as the
5
- * React component: `defaultConfig` is read once on mount, `theme` /
6
- * `locale` / `subjectImageUrl` are reactive, the host AI UI goes into
7
- * a `<slot name="smart">` that Vue teleports into the smart slot DOM.
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
8
  */
9
9
  type __VLS_Props = {
10
10
  subjectImageUrl?: string;
@@ -13,26 +13,14 @@ type __VLS_Props = {
13
13
  theme?: Theme;
14
14
  locale?: LightingEditorOptions["locale"];
15
15
  };
16
- declare var __VLS_5: {};
17
- type __VLS_Slots = {} & {
18
- smart?: (props: typeof __VLS_5) => any;
19
- };
20
- declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {
16
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {
21
17
  api: () => CoreLightingEditor | null;
22
18
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
23
19
  ready: (api: CoreLightingEditor) => any;
24
20
  change: (cfg: LightingConfig) => any;
25
- generate: (cfg: LightingConfig) => any;
26
21
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
27
22
  onReady?: ((api: CoreLightingEditor) => any) | undefined;
28
23
  onChange?: ((cfg: LightingConfig) => any) | undefined;
29
- onGenerate?: ((cfg: LightingConfig) => any) | undefined;
30
24
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
31
- declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
32
25
  export default _default;
33
- type __VLS_WithSlots<T, S> = T & {
34
- new (): {
35
- $slots: S;
36
- };
37
- };
38
26
  //# sourceMappingURL=LightingEditor.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LightingEditor.vue.d.ts","sourceRoot":"","sources":["../src/LightingEditor.vue"],"names":[],"mappings":"AA0FA,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;AAyFF,QAAA,IAAI,OAAO,IAAW,CAAE;AACxB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAuB7C,QAAA,MAAM,eAAe;eA1DV,kBAAkB,GAAG,IAAI;;;;;;;;;kFAkElC,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"}
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/lighting.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),o=require("@aicut/core/lighting"),s=e.defineComponent({__name:"LightingEditor",props:{subjectImageUrl:{},defaultConfig:{},defaultView:{},theme:{},locale:{}},emits:["ready","change","generate"],setup(c,{expose:g,emit:u}){const r=c,l=u,i=e.useTemplateRef("host");let t=null;const a=e.ref(null);return e.onMounted(()=>{i.value&&(t=o.LightingEditor.create({container:i.value,subjectImageUrl:r.subjectImageUrl,config:r.defaultConfig,view:r.defaultView,theme:r.theme,locale:r.locale,onChange:n=>l("change",n),onGenerate:n=>l("generate",n)}),a.value=t.smartSlot,l("ready",t))}),e.watch(()=>r.theme,n=>{n&&t&&t.setTheme(n)}),e.watch(()=>r.locale,n=>{n&&t&&t.setLocale(n)}),e.watch(()=>r.subjectImageUrl,n=>{n&&t&&t.setSubjectImage(n)}),e.onBeforeUnmount(()=>{t==null||t.destroy(),t=null,a.value=null}),g({api:()=>t}),(n,m)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"host",ref:i,"data-aicut-lighting-host":""},[a.value?(e.openBlock(),e.createBlock(e.Teleport,{key:0,to:a.value},[e.renderSlot(n.$slots,"smart")],8,["to"])):e.createCommentVNode("",!0)],512))}});Object.defineProperty(exports,"DEFAULT_LIGHTING_CONFIG",{enumerable:!0,get:()=>o.DEFAULT_LIGHTING_CONFIG});Object.defineProperty(exports,"PRESET_DIRECTIONS",{enumerable:!0,get:()=>o.PRESET_DIRECTIONS});Object.defineProperty(exports,"lightingLocaleEn",{enumerable:!0,get:()=>o.lightingLocaleEn});Object.defineProperty(exports,"lightingLocaleZh",{enumerable:!0,get:()=>o.lightingLocaleZh});Object.defineProperty(exports,"mergeLightingLocale",{enumerable:!0,get:()=>o.mergeLightingLocale});Object.defineProperty(exports,"snapToPreset",{enumerable:!0,get:()=>o.snapToPreset});exports.LightingEditor=s;
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
2
  //# sourceMappingURL=lighting.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"lighting.cjs","sources":["../src/LightingEditor.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { onBeforeUnmount, onMounted, ref, 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 wrapper around the core `LightingEditor`. Same shape as the\n * React component: `defaultConfig` is read once on mount, `theme` /\n * `locale` / `subjectImageUrl` are reactive, the host AI UI goes into\n * a `<slot name=\"smart\">` that Vue teleports into the smart slot DOM.\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 (e: \"generate\", cfg: LightingConfig): void;\n}>();\n\nconst host = useTemplateRef<HTMLDivElement>(\"host\");\nlet editor: CoreLightingEditor | null = null;\nconst smartSlot = ref<HTMLElement | 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 onGenerate: (cfg) => emit(\"generate\", cfg),\n });\n smartSlot.value = editor.smartSlot;\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 (locale && 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 smartSlot.value = null;\n});\n\ndefineExpose({\n api: (): CoreLightingEditor | null => editor,\n});\n</script>\n\n<template>\n <div ref=\"host\" data-aicut-lighting-host=\"\">\n <Teleport v-if=\"smartSlot\" :to=\"smartSlot\">\n <slot name=\"smart\" />\n </Teleport>\n </div>\n</template>\n"],"names":["props","__props","emit","__emit","host","useTemplateRef","editor","smartSlot","ref","onMounted","CoreLightingEditor","cfg","watch","theme","locale","url","onBeforeUnmount","__expose","_createElementBlock","_createBlock","_Teleport","_renderSlot","_ctx"],"mappings":"mUAgBA,MAAMA,EAAQC,EAQRC,EAAOC,EAMPC,EAAOC,EAAAA,eAA+B,MAAM,EAClD,IAAIC,EAAoC,KACxC,MAAMC,EAAYC,EAAAA,IAAwB,IAAI,EAE9CC,OAAAA,EAAAA,UAAU,IAAM,CACTL,EAAK,QACVE,EAASI,EAAAA,eAAmB,OAAO,CACjC,UAAWN,EAAK,MAChB,gBAAiBJ,EAAM,gBACvB,OAAQA,EAAM,cACd,KAAMA,EAAM,YACZ,MAAOA,EAAM,MACb,OAAQA,EAAM,OACd,SAAWW,GAAQT,EAAK,SAAUS,CAAG,EACrC,WAAaA,GAAQT,EAAK,WAAYS,CAAG,CAAA,CAC1C,EACDJ,EAAU,MAAQD,EAAO,UACzBJ,EAAK,QAASI,CAAM,EACtB,CAAC,EAEDM,EAAAA,MACE,IAAMZ,EAAM,MACXa,GAAU,CACLA,GAASP,GAAQA,EAAO,SAASO,CAAK,CAC5C,CAAA,EAEFD,EAAAA,MACE,IAAMZ,EAAM,OACXc,GAAW,CACNA,GAAUR,GAAQA,EAAO,UAAUQ,CAAM,CAC/C,CAAA,EAEFF,EAAAA,MACE,IAAMZ,EAAM,gBACXe,GAAQ,CACHA,GAAOT,GAAQA,EAAO,gBAAgBS,CAAG,CAC/C,CAAA,EAGFC,EAAAA,gBAAgB,IAAM,CACpBV,GAAA,MAAAA,EAAQ,UACRA,EAAS,KACTC,EAAU,MAAQ,IACpB,CAAC,EAEDU,EAAa,CACX,IAAK,IAAiCX,CAAA,CACvC,wBAICY,EAAAA,mBAIM,MAAA,SAJG,OAAJ,IAAId,EAAO,2BAAyB,EAAA,GACvBG,EAAA,qBAAhBY,EAAAA,YAEWC,EAAAA,SAAA,OAFiB,GAAIb,EAAA,KAAA,GAC9Bc,aAAqBC,EAAA,OAAA,OAAA,CAAA"}
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"}
package/dist/lighting.js CHANGED
@@ -1,7 +1,7 @@
1
- import { defineComponent as g, useTemplateRef as u, ref as f, onMounted as h, watch as r, onBeforeUnmount as p, openBlock as i, createElementBlock as d, createBlock as I, Teleport as L, renderSlot as E, createCommentVNode as _ } from "vue";
2
- import { LightingEditor as v } from "@aicut/core/lighting";
3
- import { DEFAULT_LIGHTING_CONFIG as k, PRESET_DIRECTIONS as y, lightingLocaleEn as w, lightingLocaleZh as B, mergeLightingLocale as G, snapToPreset as N } from "@aicut/core/lighting";
4
- const U = /* @__PURE__ */ g({
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
5
  __name: "LightingEditor",
6
6
  props: {
7
7
  subjectImageUrl: {},
@@ -10,62 +10,53 @@ const U = /* @__PURE__ */ g({
10
10
  theme: {},
11
11
  locale: {}
12
12
  },
13
- emits: ["ready", "change", "generate"],
14
- setup(c, { expose: s, emit: m }) {
15
- const o = c, n = m, l = u("host");
13
+ emits: ["ready", "change"],
14
+ setup(l, { expose: c, emit: r }) {
15
+ const o = l, i = r, n = s("host");
16
16
  let e = null;
17
- const a = f(null);
18
- return h(() => {
19
- l.value && (e = v.create({
20
- container: l.value,
17
+ return m(() => {
18
+ n.value && (e = p.create({
19
+ container: n.value,
21
20
  subjectImageUrl: o.subjectImageUrl,
22
21
  config: o.defaultConfig,
23
22
  view: o.defaultView,
24
23
  theme: o.theme,
25
24
  locale: o.locale,
26
- onChange: (t) => n("change", t),
27
- onGenerate: (t) => n("generate", t)
28
- }), a.value = e.smartSlot, n("ready", e));
29
- }), r(
25
+ onChange: (t) => i("change", t)
26
+ }), i("ready", e));
27
+ }), a(
30
28
  () => o.theme,
31
29
  (t) => {
32
30
  t && e && e.setTheme(t);
33
31
  }
34
- ), r(
32
+ ), a(
35
33
  () => o.locale,
36
34
  (t) => {
37
- t && e && e.setLocale(t);
35
+ e && e.setLocale(t ?? {});
38
36
  }
39
- ), r(
37
+ ), a(
40
38
  () => o.subjectImageUrl,
41
39
  (t) => {
42
40
  t && e && e.setSubjectImage(t);
43
41
  }
44
- ), p(() => {
45
- e == null || e.destroy(), e = null, a.value = null;
46
- }), s({
42
+ ), h(() => {
43
+ e == null || e.destroy(), e = null;
44
+ }), c({
47
45
  api: () => e
48
- }), (t, T) => (i(), d("div", {
46
+ }), (t, d) => (u(), f("div", {
49
47
  ref_key: "host",
50
- ref: l,
48
+ ref: n,
51
49
  "data-aicut-lighting-host": ""
52
- }, [
53
- a.value ? (i(), I(L, {
54
- key: 0,
55
- to: a.value
56
- }, [
57
- E(t.$slots, "smart")
58
- ], 8, ["to"])) : _("", !0)
59
- ], 512));
50
+ }, null, 512));
60
51
  }
61
52
  });
62
53
  export {
63
- k as DEFAULT_LIGHTING_CONFIG,
64
- U as LightingEditor,
65
- y as PRESET_DIRECTIONS,
66
- w as lightingLocaleEn,
67
- B as lightingLocaleZh,
68
- G as mergeLightingLocale,
69
- N as snapToPreset
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
70
61
  };
71
62
  //# sourceMappingURL=lighting.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lighting.js","sources":["../src/LightingEditor.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { onBeforeUnmount, onMounted, ref, 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 wrapper around the core `LightingEditor`. Same shape as the\n * React component: `defaultConfig` is read once on mount, `theme` /\n * `locale` / `subjectImageUrl` are reactive, the host AI UI goes into\n * a `<slot name=\"smart\">` that Vue teleports into the smart slot DOM.\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 (e: \"generate\", cfg: LightingConfig): void;\n}>();\n\nconst host = useTemplateRef<HTMLDivElement>(\"host\");\nlet editor: CoreLightingEditor | null = null;\nconst smartSlot = ref<HTMLElement | 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 onGenerate: (cfg) => emit(\"generate\", cfg),\n });\n smartSlot.value = editor.smartSlot;\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 (locale && 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 smartSlot.value = null;\n});\n\ndefineExpose({\n api: (): CoreLightingEditor | null => editor,\n});\n</script>\n\n<template>\n <div ref=\"host\" data-aicut-lighting-host=\"\">\n <Teleport v-if=\"smartSlot\" :to=\"smartSlot\">\n <slot name=\"smart\" />\n </Teleport>\n </div>\n</template>\n"],"names":["props","__props","emit","__emit","host","useTemplateRef","editor","smartSlot","ref","onMounted","CoreLightingEditor","cfg","watch","theme","locale","url","onBeforeUnmount","__expose","_createElementBlock","_createBlock","_Teleport","_renderSlot","_ctx"],"mappings":";;;;;;;;;;;;;;AAgBA,UAAMA,IAAQC,GAQRC,IAAOC,GAMPC,IAAOC,EAA+B,MAAM;AAClD,QAAIC,IAAoC;AACxC,UAAMC,IAAYC,EAAwB,IAAI;AAE9C,WAAAC,EAAU,MAAM;AACd,MAAKL,EAAK,UACVE,IAASI,EAAmB,OAAO;AAAA,QACjC,WAAWN,EAAK;AAAA,QAChB,iBAAiBJ,EAAM;AAAA,QACvB,QAAQA,EAAM;AAAA,QACd,MAAMA,EAAM;AAAA,QACZ,OAAOA,EAAM;AAAA,QACb,QAAQA,EAAM;AAAA,QACd,UAAU,CAACW,MAAQT,EAAK,UAAUS,CAAG;AAAA,QACrC,YAAY,CAACA,MAAQT,EAAK,YAAYS,CAAG;AAAA,MAAA,CAC1C,GACDJ,EAAU,QAAQD,EAAO,WACzBJ,EAAK,SAASI,CAAM;AAAA,IACtB,CAAC,GAEDM;AAAA,MACE,MAAMZ,EAAM;AAAA,MACZ,CAACa,MAAU;AACT,QAAIA,KAASP,KAAQA,EAAO,SAASO,CAAK;AAAA,MAC5C;AAAA,IAAA,GAEFD;AAAA,MACE,MAAMZ,EAAM;AAAA,MACZ,CAACc,MAAW;AACV,QAAIA,KAAUR,KAAQA,EAAO,UAAUQ,CAAM;AAAA,MAC/C;AAAA,IAAA,GAEFF;AAAA,MACE,MAAMZ,EAAM;AAAA,MACZ,CAACe,MAAQ;AACP,QAAIA,KAAOT,KAAQA,EAAO,gBAAgBS,CAAG;AAAA,MAC/C;AAAA,IAAA,GAGFC,EAAgB,MAAM;AACpB,MAAAV,KAAA,QAAAA,EAAQ,WACRA,IAAS,MACTC,EAAU,QAAQ;AAAA,IACpB,CAAC,GAEDU,EAAa;AAAA,MACX,KAAK,MAAiCX;AAAA,IAAA,CACvC,mBAICY,EAIM,OAAA;AAAA,eAJG;AAAA,MAAJ,KAAId;AAAA,MAAO,4BAAyB;AAAA,IAAA;MACvBG,EAAA,cAAhBY,EAEWC,GAAA;AAAA;QAFiB,IAAIb,EAAA;AAAA,MAAA;QAC9Bc,EAAqBC,EAAA,QAAA,OAAA;AAAA,MAAA;;;;"}
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@aicut/vue",
3
- "version": "0.2.0",
3
+ "version": "0.3.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>",
@@ -60,7 +60,7 @@
60
60
  "README.md"
61
61
  ],
62
62
  "dependencies": {
63
- "@aicut/core": "0.2.0"
63
+ "@aicut/core": "0.3.0"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "vue": "^3.4.0"