@aicut/core 0.3.0 → 0.4.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 +12 -11
- package/dist/lighting/index.cjs +24 -15
- package/dist/lighting/index.cjs.map +1 -1
- package/dist/lighting/index.d.cts +7 -1
- package/dist/lighting/index.d.ts +7 -1
- package/dist/lighting/index.js +24 -15
- package/dist/lighting/index.js.map +1 -1
- package/package.json +1 -1
- package/styles/theme.css +20 -19
|
@@ -15,7 +15,6 @@ interface LightingLocale {
|
|
|
15
15
|
lightingRim: string;
|
|
16
16
|
lightingViewPerspective: string;
|
|
17
17
|
lightingViewFront: string;
|
|
18
|
-
lightingResetParams: string;
|
|
19
18
|
lightingDirLeft: string;
|
|
20
19
|
lightingDirRight: string;
|
|
21
20
|
lightingDirTop: string;
|
|
@@ -94,6 +93,10 @@ declare class LightingEditor {
|
|
|
94
93
|
private controls;
|
|
95
94
|
private sceneViewport;
|
|
96
95
|
private viewToggleEl;
|
|
96
|
+
/** Footer slot in the controls column. Host appends Reset/Generate/
|
|
97
|
+
* preset-save/etc. buttons here. The library renders nothing into
|
|
98
|
+
* it — it's the same convention as the video editor's toolbar slots. */
|
|
99
|
+
readonly controlsFooter: HTMLDivElement;
|
|
97
100
|
private resizeObs;
|
|
98
101
|
private destroyed;
|
|
99
102
|
static create(opts: LightingEditorOptions): LightingEditor;
|
|
@@ -101,6 +104,9 @@ declare class LightingEditor {
|
|
|
101
104
|
getConfig(): LightingConfig;
|
|
102
105
|
setConfig(partial: Partial<LightingConfig>, _reason?: "external" | "reset"): void;
|
|
103
106
|
setSubjectImage(url: string): void;
|
|
107
|
+
/** Restore config to the safe defaults. Convenience for host's
|
|
108
|
+
* "Reset" button — equivalent to `setConfig(DEFAULT_LIGHTING_CONFIG)`. */
|
|
109
|
+
reset(): void;
|
|
104
110
|
setView(v: LightingView): void;
|
|
105
111
|
getView(): LightingView;
|
|
106
112
|
setTheme(theme: Theme): void;
|
package/dist/lighting/index.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ interface LightingLocale {
|
|
|
15
15
|
lightingRim: string;
|
|
16
16
|
lightingViewPerspective: string;
|
|
17
17
|
lightingViewFront: string;
|
|
18
|
-
lightingResetParams: string;
|
|
19
18
|
lightingDirLeft: string;
|
|
20
19
|
lightingDirRight: string;
|
|
21
20
|
lightingDirTop: string;
|
|
@@ -94,6 +93,10 @@ declare class LightingEditor {
|
|
|
94
93
|
private controls;
|
|
95
94
|
private sceneViewport;
|
|
96
95
|
private viewToggleEl;
|
|
96
|
+
/** Footer slot in the controls column. Host appends Reset/Generate/
|
|
97
|
+
* preset-save/etc. buttons here. The library renders nothing into
|
|
98
|
+
* it — it's the same convention as the video editor's toolbar slots. */
|
|
99
|
+
readonly controlsFooter: HTMLDivElement;
|
|
97
100
|
private resizeObs;
|
|
98
101
|
private destroyed;
|
|
99
102
|
static create(opts: LightingEditorOptions): LightingEditor;
|
|
@@ -101,6 +104,9 @@ declare class LightingEditor {
|
|
|
101
104
|
getConfig(): LightingConfig;
|
|
102
105
|
setConfig(partial: Partial<LightingConfig>, _reason?: "external" | "reset"): void;
|
|
103
106
|
setSubjectImage(url: string): void;
|
|
107
|
+
/** Restore config to the safe defaults. Convenience for host's
|
|
108
|
+
* "Reset" button — equivalent to `setConfig(DEFAULT_LIGHTING_CONFIG)`. */
|
|
109
|
+
reset(): void;
|
|
104
110
|
setView(v: LightingView): void;
|
|
105
111
|
getView(): LightingView;
|
|
106
112
|
setTheme(theme: Theme): void;
|
package/dist/lighting/index.js
CHANGED
|
@@ -33,6 +33,13 @@ var LightingControls = class {
|
|
|
33
33
|
/** Exposed so the editor can append host-level chrome (e.g. the
|
|
34
34
|
* Smart Mode toggle) without LightingControls knowing about it. */
|
|
35
35
|
headerSlot;
|
|
36
|
+
/**
|
|
37
|
+
* Footer slot — sits where the built-in Reset used to live. Host
|
|
38
|
+
* appends any action buttons (Reset, Generate, Save preset, etc.)
|
|
39
|
+
* via the React wrapper's `controlsFooter` prop / Vue's
|
|
40
|
+
* `<slot name="controlsFooter">`. Library renders nothing here.
|
|
41
|
+
*/
|
|
42
|
+
footerSlot;
|
|
36
43
|
brightnessInput;
|
|
37
44
|
colorInput;
|
|
38
45
|
dirButtons;
|
|
@@ -45,7 +52,6 @@ var LightingControls = class {
|
|
|
45
52
|
colorLabelEl;
|
|
46
53
|
keyLabelEl;
|
|
47
54
|
rimLabelEl;
|
|
48
|
-
resetBtn;
|
|
49
55
|
locale;
|
|
50
56
|
lastConfig = null;
|
|
51
57
|
constructor(locale, cb) {
|
|
@@ -135,15 +141,12 @@ var LightingControls = class {
|
|
|
135
141
|
});
|
|
136
142
|
rimSection.appendChild(this.rimToggle);
|
|
137
143
|
this.root.appendChild(rimSection);
|
|
138
|
-
|
|
139
|
-
this.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
this.
|
|
144
|
-
this.resetBtn.addEventListener("click", () => cb.onReset());
|
|
145
|
-
footer.appendChild(this.resetBtn);
|
|
146
|
-
this.root.appendChild(footer);
|
|
144
|
+
this.footerSlot = mkDiv("aicut-lighting-controls-footer");
|
|
145
|
+
this.footerSlot.setAttribute(
|
|
146
|
+
"data-testid",
|
|
147
|
+
"aicut-lighting-controls-footer"
|
|
148
|
+
);
|
|
149
|
+
this.root.appendChild(this.footerSlot);
|
|
147
150
|
}
|
|
148
151
|
/** Idempotent — mirror the given config into all visible controls. */
|
|
149
152
|
render(cfg) {
|
|
@@ -172,7 +175,6 @@ var LightingControls = class {
|
|
|
172
175
|
this.colorLabelEl.textContent = locale.lightingColor;
|
|
173
176
|
this.keyLabelEl.textContent = locale.lightingKeyTitle;
|
|
174
177
|
this.rimLabelEl.textContent = locale.lightingRim;
|
|
175
|
-
this.resetBtn.textContent = locale.lightingResetParams;
|
|
176
178
|
const dirLabels = {
|
|
177
179
|
left: "lightingDirLeft",
|
|
178
180
|
right: "lightingDirRight",
|
|
@@ -208,7 +210,6 @@ var lightingLocaleEn = {
|
|
|
208
210
|
lightingRim: "Rim light",
|
|
209
211
|
lightingViewPerspective: "Perspective",
|
|
210
212
|
lightingViewFront: "Front",
|
|
211
|
-
lightingResetParams: "Reset",
|
|
212
213
|
lightingDirLeft: "Left",
|
|
213
214
|
lightingDirRight: "Right",
|
|
214
215
|
lightingDirTop: "Top",
|
|
@@ -225,7 +226,6 @@ var lightingLocaleZh = {
|
|
|
225
226
|
lightingRim: "\u8F6E\u5ED3\u5149",
|
|
226
227
|
lightingViewPerspective: "\u900F\u89C6",
|
|
227
228
|
lightingViewFront: "\u6B63\u9762",
|
|
228
|
-
lightingResetParams: "\u91CD\u7F6E\u53C2\u6570",
|
|
229
229
|
lightingDirLeft: "\u5DE6\u4FA7",
|
|
230
230
|
lightingDirRight: "\u53F3\u4FA7",
|
|
231
231
|
lightingDirTop: "\u9876\u90E8",
|
|
@@ -18984,6 +18984,10 @@ var LightingEditor = class _LightingEditor {
|
|
|
18984
18984
|
controls;
|
|
18985
18985
|
sceneViewport;
|
|
18986
18986
|
viewToggleEl;
|
|
18987
|
+
/** Footer slot in the controls column. Host appends Reset/Generate/
|
|
18988
|
+
* preset-save/etc. buttons here. The library renders nothing into
|
|
18989
|
+
* it — it's the same convention as the video editor's toolbar slots. */
|
|
18990
|
+
controlsFooter;
|
|
18987
18991
|
resizeObs = null;
|
|
18988
18992
|
destroyed = false;
|
|
18989
18993
|
static create(opts) {
|
|
@@ -19021,10 +19025,10 @@ var LightingEditor = class _LightingEditor {
|
|
|
19021
19025
|
keyDirection: PRESET_DIRECTIONS[preset],
|
|
19022
19026
|
keyPreset: preset
|
|
19023
19027
|
}),
|
|
19024
|
-
onRimToggle: (on) => this.applyMutation({ rim: on })
|
|
19025
|
-
onReset: () => this.setConfig(DEFAULT_LIGHTING_CONFIG, "reset")
|
|
19028
|
+
onRimToggle: (on) => this.applyMutation({ rim: on })
|
|
19026
19029
|
});
|
|
19027
19030
|
body.appendChild(this.controls.root);
|
|
19031
|
+
this.controlsFooter = this.controls.footerSlot;
|
|
19028
19032
|
this.scene = new LightingScene(this.sceneViewport, this.view);
|
|
19029
19033
|
this.scene.setLightDirection(this.config.keyDirection);
|
|
19030
19034
|
this.scene.setBrightness(this.config.brightness);
|
|
@@ -19068,6 +19072,11 @@ var LightingEditor = class _LightingEditor {
|
|
|
19068
19072
|
this.opts.subjectImageUrl = url;
|
|
19069
19073
|
this.scene.setSubjectImage(url);
|
|
19070
19074
|
}
|
|
19075
|
+
/** Restore config to the safe defaults. Convenience for host's
|
|
19076
|
+
* "Reset" button — equivalent to `setConfig(DEFAULT_LIGHTING_CONFIG)`. */
|
|
19077
|
+
reset() {
|
|
19078
|
+
this.setConfig(DEFAULT_LIGHTING_CONFIG, "reset");
|
|
19079
|
+
}
|
|
19071
19080
|
setView(v) {
|
|
19072
19081
|
if (v === this.view) return;
|
|
19073
19082
|
this.view = v;
|