@aicut/core 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.
@@ -0,0 +1,135 @@
1
+ import { b as Theme, L as Locale } from '../types-C95koNwJ.cjs';
2
+
3
+ /**
4
+ * Lighting-editor-specific string keys. Kept in a SEPARATE interface
5
+ * from the video editor's `Locale` so the timeline-only consumer's
6
+ * type doesn't grow unused fields, but exported so a single host
7
+ * locale object can spread both shapes together.
8
+ */
9
+ interface LightingLocale {
10
+ lightingGlobalTitle: string;
11
+ lightingSmartMode: string;
12
+ lightingBrightness: string;
13
+ lightingColor: string;
14
+ lightingKeyTitle: string;
15
+ lightingRim: string;
16
+ lightingViewPerspective: string;
17
+ lightingViewFront: string;
18
+ lightingResetParams: string;
19
+ lightingDirLeft: string;
20
+ lightingDirRight: string;
21
+ lightingDirTop: string;
22
+ lightingDirBottom: string;
23
+ lightingDirFront: string;
24
+ lightingDirBack: string;
25
+ }
26
+ declare const lightingLocaleEn: LightingLocale;
27
+ declare const lightingLocaleZh: LightingLocale;
28
+ declare function mergeLightingLocale(partial: Partial<LightingLocale> | undefined): LightingLocale;
29
+
30
+ /** One of the six canonical key-light directions plus a sentinel for free-drag. */
31
+ type KeyPreset = "left" | "right" | "top" | "bottom" | "front" | "back" | "custom";
32
+ /** Snapshot of every adjustable lighting parameter — what `onChange` emits. */
33
+ interface LightingConfig {
34
+ /** 0–1 multiplier. Snapped to 5 UI levels (0 / 0.25 / 0.5 / 0.75 / 1). */
35
+ brightness: number;
36
+ /** Hex RGB string, e.g. "#ffffff". */
37
+ color: string;
38
+ /**
39
+ * Unit vector from the subject toward the light. `(0,0,1)` = light in
40
+ * front of the subject, `(0,1,0)` = light directly overhead, etc.
41
+ * Always renormalised on write.
42
+ */
43
+ keyDirection: {
44
+ x: number;
45
+ y: number;
46
+ z: number;
47
+ };
48
+ /** Which canonical direction the dot is closest to, or `"custom"`. */
49
+ keyPreset: KeyPreset;
50
+ /** Rim / contour light toggle. */
51
+ rim: boolean;
52
+ }
53
+ type LightingView = "perspective" | "front";
54
+ interface LightingEditorOptions {
55
+ /** Host element. Will be wiped on init. */
56
+ container: HTMLElement;
57
+ /**
58
+ * Image URL or data URI shown on the in-sphere plane (the "subject"
59
+ * being lit). Can be swapped at runtime via `setSubjectImage`.
60
+ */
61
+ subjectImageUrl?: string;
62
+ /** Initial config — merges over the safe defaults below. */
63
+ config?: Partial<LightingConfig>;
64
+ /** Initial camera view. Default `"perspective"`. */
65
+ view?: LightingView;
66
+ /** Theme tokens — same shape as the video Editor's theme. */
67
+ theme?: Theme;
68
+ /** Locale overrides on top of English defaults (`localeEn` + `lightingLocaleEn`). */
69
+ locale?: Partial<Locale & LightingLocale>;
70
+ /** Fires on any config mutation (drag, slider, preset click, toggle). */
71
+ onChange?: (cfg: LightingConfig) => void;
72
+ }
73
+ /** Safe, conservative defaults for first mount. */
74
+ declare const DEFAULT_LIGHTING_CONFIG: LightingConfig;
75
+
76
+ /**
77
+ * Top-level lighting picker. Two columns: a 3D scene (sphere + subject
78
+ * plane + draggable light dot + cone beam) and a controls panel
79
+ * (brightness / color / 6-direction key-light grid / rim toggle).
80
+ *
81
+ * Deliberately scoped to JUST the picker — the host owns everything
82
+ * around it (smart-mode UI, generate buttons, layout, close handling,
83
+ * theming above the editor). Render <LightingEditor> alongside your
84
+ * own Smart panel in your own flex/grid; the library doesn't try to
85
+ * model "open / closed drawer" semantics for you.
86
+ */
87
+ declare class LightingEditor {
88
+ private root;
89
+ private opts;
90
+ private config;
91
+ private view;
92
+ private locale;
93
+ private scene;
94
+ private controls;
95
+ private sceneViewport;
96
+ private viewToggleEl;
97
+ private resizeObs;
98
+ private destroyed;
99
+ static create(opts: LightingEditorOptions): LightingEditor;
100
+ constructor(opts: LightingEditorOptions);
101
+ getConfig(): LightingConfig;
102
+ setConfig(partial: Partial<LightingConfig>, _reason?: "external" | "reset"): void;
103
+ setSubjectImage(url: string): void;
104
+ setView(v: LightingView): void;
105
+ getView(): LightingView;
106
+ setTheme(theme: Theme): void;
107
+ setLocale(locale: Partial<Locale & LightingLocale>): void;
108
+ destroy(): void;
109
+ private applyMutation;
110
+ private buildViewToggle;
111
+ private syncViewToggle;
112
+ }
113
+
114
+ /**
115
+ * Canonical key-light direction unit vectors. Coordinate space matches
116
+ * three.js's defaults — +X right, +Y up, +Z toward the camera. So
117
+ * `front: (0, 0, 1)` means "light positioned between the camera and
118
+ * the subject," which is the most flattering portrait default.
119
+ */
120
+ declare const PRESET_DIRECTIONS: Record<Exclude<KeyPreset, "custom">, {
121
+ x: number;
122
+ y: number;
123
+ z: number;
124
+ }>;
125
+ /**
126
+ * Decide which preset (if any) a given unit-vector direction snaps to.
127
+ * Returns `"custom"` when no preset is within `PRESET_SNAP_RADIANS`.
128
+ */
129
+ declare function snapToPreset(d: {
130
+ x: number;
131
+ y: number;
132
+ z: number;
133
+ }): KeyPreset;
134
+
135
+ export { DEFAULT_LIGHTING_CONFIG, type KeyPreset, type LightingConfig, LightingEditor, type LightingEditorOptions, type LightingLocale, type LightingView, PRESET_DIRECTIONS, lightingLocaleEn, lightingLocaleZh, mergeLightingLocale, snapToPreset };
@@ -0,0 +1,135 @@
1
+ import { b as Theme, L as Locale } from '../types-C95koNwJ.js';
2
+
3
+ /**
4
+ * Lighting-editor-specific string keys. Kept in a SEPARATE interface
5
+ * from the video editor's `Locale` so the timeline-only consumer's
6
+ * type doesn't grow unused fields, but exported so a single host
7
+ * locale object can spread both shapes together.
8
+ */
9
+ interface LightingLocale {
10
+ lightingGlobalTitle: string;
11
+ lightingSmartMode: string;
12
+ lightingBrightness: string;
13
+ lightingColor: string;
14
+ lightingKeyTitle: string;
15
+ lightingRim: string;
16
+ lightingViewPerspective: string;
17
+ lightingViewFront: string;
18
+ lightingResetParams: string;
19
+ lightingDirLeft: string;
20
+ lightingDirRight: string;
21
+ lightingDirTop: string;
22
+ lightingDirBottom: string;
23
+ lightingDirFront: string;
24
+ lightingDirBack: string;
25
+ }
26
+ declare const lightingLocaleEn: LightingLocale;
27
+ declare const lightingLocaleZh: LightingLocale;
28
+ declare function mergeLightingLocale(partial: Partial<LightingLocale> | undefined): LightingLocale;
29
+
30
+ /** One of the six canonical key-light directions plus a sentinel for free-drag. */
31
+ type KeyPreset = "left" | "right" | "top" | "bottom" | "front" | "back" | "custom";
32
+ /** Snapshot of every adjustable lighting parameter — what `onChange` emits. */
33
+ interface LightingConfig {
34
+ /** 0–1 multiplier. Snapped to 5 UI levels (0 / 0.25 / 0.5 / 0.75 / 1). */
35
+ brightness: number;
36
+ /** Hex RGB string, e.g. "#ffffff". */
37
+ color: string;
38
+ /**
39
+ * Unit vector from the subject toward the light. `(0,0,1)` = light in
40
+ * front of the subject, `(0,1,0)` = light directly overhead, etc.
41
+ * Always renormalised on write.
42
+ */
43
+ keyDirection: {
44
+ x: number;
45
+ y: number;
46
+ z: number;
47
+ };
48
+ /** Which canonical direction the dot is closest to, or `"custom"`. */
49
+ keyPreset: KeyPreset;
50
+ /** Rim / contour light toggle. */
51
+ rim: boolean;
52
+ }
53
+ type LightingView = "perspective" | "front";
54
+ interface LightingEditorOptions {
55
+ /** Host element. Will be wiped on init. */
56
+ container: HTMLElement;
57
+ /**
58
+ * Image URL or data URI shown on the in-sphere plane (the "subject"
59
+ * being lit). Can be swapped at runtime via `setSubjectImage`.
60
+ */
61
+ subjectImageUrl?: string;
62
+ /** Initial config — merges over the safe defaults below. */
63
+ config?: Partial<LightingConfig>;
64
+ /** Initial camera view. Default `"perspective"`. */
65
+ view?: LightingView;
66
+ /** Theme tokens — same shape as the video Editor's theme. */
67
+ theme?: Theme;
68
+ /** Locale overrides on top of English defaults (`localeEn` + `lightingLocaleEn`). */
69
+ locale?: Partial<Locale & LightingLocale>;
70
+ /** Fires on any config mutation (drag, slider, preset click, toggle). */
71
+ onChange?: (cfg: LightingConfig) => void;
72
+ }
73
+ /** Safe, conservative defaults for first mount. */
74
+ declare const DEFAULT_LIGHTING_CONFIG: LightingConfig;
75
+
76
+ /**
77
+ * Top-level lighting picker. Two columns: a 3D scene (sphere + subject
78
+ * plane + draggable light dot + cone beam) and a controls panel
79
+ * (brightness / color / 6-direction key-light grid / rim toggle).
80
+ *
81
+ * Deliberately scoped to JUST the picker — the host owns everything
82
+ * around it (smart-mode UI, generate buttons, layout, close handling,
83
+ * theming above the editor). Render <LightingEditor> alongside your
84
+ * own Smart panel in your own flex/grid; the library doesn't try to
85
+ * model "open / closed drawer" semantics for you.
86
+ */
87
+ declare class LightingEditor {
88
+ private root;
89
+ private opts;
90
+ private config;
91
+ private view;
92
+ private locale;
93
+ private scene;
94
+ private controls;
95
+ private sceneViewport;
96
+ private viewToggleEl;
97
+ private resizeObs;
98
+ private destroyed;
99
+ static create(opts: LightingEditorOptions): LightingEditor;
100
+ constructor(opts: LightingEditorOptions);
101
+ getConfig(): LightingConfig;
102
+ setConfig(partial: Partial<LightingConfig>, _reason?: "external" | "reset"): void;
103
+ setSubjectImage(url: string): void;
104
+ setView(v: LightingView): void;
105
+ getView(): LightingView;
106
+ setTheme(theme: Theme): void;
107
+ setLocale(locale: Partial<Locale & LightingLocale>): void;
108
+ destroy(): void;
109
+ private applyMutation;
110
+ private buildViewToggle;
111
+ private syncViewToggle;
112
+ }
113
+
114
+ /**
115
+ * Canonical key-light direction unit vectors. Coordinate space matches
116
+ * three.js's defaults — +X right, +Y up, +Z toward the camera. So
117
+ * `front: (0, 0, 1)` means "light positioned between the camera and
118
+ * the subject," which is the most flattering portrait default.
119
+ */
120
+ declare const PRESET_DIRECTIONS: Record<Exclude<KeyPreset, "custom">, {
121
+ x: number;
122
+ y: number;
123
+ z: number;
124
+ }>;
125
+ /**
126
+ * Decide which preset (if any) a given unit-vector direction snaps to.
127
+ * Returns `"custom"` when no preset is within `PRESET_SNAP_RADIANS`.
128
+ */
129
+ declare function snapToPreset(d: {
130
+ x: number;
131
+ y: number;
132
+ z: number;
133
+ }): KeyPreset;
134
+
135
+ export { DEFAULT_LIGHTING_CONFIG, type KeyPreset, type LightingConfig, LightingEditor, type LightingEditorOptions, type LightingLocale, type LightingView, PRESET_DIRECTIONS, lightingLocaleEn, lightingLocaleZh, mergeLightingLocale, snapToPreset };