@pixerate/editor-react 0.166.0 → 0.169.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,406 @@
1
+ // src/image-editor/controls/controls.tsx
2
+ import { createContext, useContext } from "react";
3
+
4
+ // src/image-editor/styles.ts
5
+ var imageEditorFrameClass = "relative flex flex-col bg-background border border-border rounded-xl overflow-hidden shadow-sm text-foreground";
6
+ var imageEditorHeaderClass = "flex flex-wrap items-center justify-between px-4 py-3 bg-muted/40 border-b border-border gap-3";
7
+ var imageTabListClass = "flex items-center gap-1 bg-background p-1 rounded-lg border border-border text-xs";
8
+ var imageTabClass = (active) => `px-3 py-1.5 rounded-md font-medium transition-colors ${active ? "bg-primary text-primary-foreground shadow" : "text-muted-foreground hover:text-foreground hover:bg-muted"}`;
9
+ var imageHeaderButtonClass = "p-1.5 rounded-lg border border-border bg-background text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed";
10
+ var imagePrimaryButtonClass = "rounded-lg bg-primary hover:bg-primary/90 text-primary-foreground font-medium shadow transition-colors disabled:opacity-50";
11
+ var imageSidebarClass = "w-full md:w-80 bg-background border-t md:border-t-0 md:border-l border-border p-4 overflow-y-auto h-auto md:h-full md:max-h-[560px]";
12
+ var imageSectionTitleClass = "font-semibold text-foreground uppercase tracking-wider text-[11px]";
13
+ var imageSectionClass = "border-t border-border pt-3";
14
+ var imageDividerClass = "h-px bg-border my-1";
15
+ var imageSmallButtonClass = "px-2 py-1 rounded text-[11px] bg-muted text-foreground hover:bg-accent hover:text-accent-foreground self-start disabled:opacity-40";
16
+ var imageIconButtonClass = "px-1.5 py-0.5 rounded text-[10px] bg-muted text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
17
+ var imageOutlineButtonClass = "rounded border border-border px-1.5 py-0.5 text-[11px] text-foreground hover:bg-muted disabled:opacity-40";
18
+ var imageChipClass = (on) => `px-2 py-1 rounded text-[11px] ${on ? "bg-primary text-primary-foreground" : "bg-muted text-foreground hover:bg-accent hover:text-accent-foreground"}`;
19
+ var imageFieldClass = "rounded border border-input bg-background px-1 py-0.5 text-foreground";
20
+ var imageSelectClass = "rounded border border-input bg-background px-1.5 py-1 text-foreground";
21
+ var imageColorInputClass = "h-6 w-8 rounded border border-border bg-transparent";
22
+ var imageRangeClass = "w-full accent-primary";
23
+ var imageErrorBannerClass = "border-b border-destructive/40 bg-destructive/10 px-4 py-1.5 text-xs text-destructive";
24
+ var imageSpinnerClass = "w-3.5 h-3.5 border-2 border-primary-foreground/30 border-t-primary-foreground rounded-full animate-spin";
25
+
26
+ // src/image-editor/controls/controls.tsx
27
+ import { jsx, jsxs } from "react/jsx-runtime";
28
+ var ControlsContext = createContext({});
29
+ function ImageEditorControlsProvider({ controls, children }) {
30
+ return /* @__PURE__ */ jsx(ControlsContext.Provider, { value: controls, children });
31
+ }
32
+ function useImageEditorControls() {
33
+ return useContext(ControlsContext);
34
+ }
35
+ function ImageCheckbox(props) {
36
+ const Host = useImageEditorControls().Checkbox;
37
+ if (Host) return /* @__PURE__ */ jsx(Host, { ...props });
38
+ const { checked, label, disabled, onChange, className = "" } = props;
39
+ return /* @__PURE__ */ jsx(
40
+ "input",
41
+ {
42
+ type: "checkbox",
43
+ "aria-label": label,
44
+ checked,
45
+ disabled,
46
+ onChange: (e) => onChange(e.target.checked),
47
+ className: `accent-primary ${className}`
48
+ }
49
+ );
50
+ }
51
+ function ImageRange(props) {
52
+ const Host = useImageEditorControls().Range;
53
+ if (Host) return /* @__PURE__ */ jsx(Host, { ...props });
54
+ const { value, min, max, step, label, disabled, onChange, onStart, onEnd, className = "" } = props;
55
+ return /* @__PURE__ */ jsx(
56
+ "input",
57
+ {
58
+ type: "range",
59
+ "aria-label": label,
60
+ min,
61
+ max,
62
+ step,
63
+ value,
64
+ disabled,
65
+ onPointerDown: () => onStart?.(),
66
+ onPointerUp: () => onEnd?.(),
67
+ onKeyDown: () => onStart?.(),
68
+ onKeyUp: () => onEnd?.(),
69
+ onChange: (e) => onChange(Number(e.target.value)),
70
+ className: `w-full accent-primary disabled:opacity-40 ${className}`
71
+ }
72
+ );
73
+ }
74
+ function ImageSelect(props) {
75
+ const Host = useImageEditorControls().Select;
76
+ if (Host) return /* @__PURE__ */ jsx(Host, { ...props });
77
+ const { value, options, label, placeholder, disabled, onChange, className = "" } = props;
78
+ return /* @__PURE__ */ jsxs("select", { "aria-label": label, value, disabled, onChange: (e) => onChange(e.target.value), className: `${imageSelectClass} ${className}`, children: [
79
+ placeholder !== void 0 && /* @__PURE__ */ jsx("option", { value: "", children: placeholder }),
80
+ options.map((o) => /* @__PURE__ */ jsx("option", { value: o.value, children: o.label }, o.value))
81
+ ] });
82
+ }
83
+ function ImageColor(props) {
84
+ const Host = useImageEditorControls().Color;
85
+ if (Host) return /* @__PURE__ */ jsx(Host, { ...props });
86
+ const { value, label, alpha, disabled, onChange, className = "" } = props;
87
+ return /* @__PURE__ */ jsx(
88
+ "input",
89
+ {
90
+ type: "color",
91
+ "aria-label": label,
92
+ value: value.slice(0, 7),
93
+ disabled,
94
+ onChange: (e) => onChange(e.target.value + (alpha ? value.slice(7, 9) : "")),
95
+ className: `${imageColorInputClass} ${className}`
96
+ }
97
+ );
98
+ }
99
+
100
+ // src/image-editor/LayerEffectsPanel.tsx
101
+ import { useEffect, useRef, useState } from "react";
102
+ import { LAYER_EFFECT_MENU, effectControlChange, layerEffectControls, layerEffectsPanel } from "@pixerate/editor/raster";
103
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
104
+ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) => {
105
+ const [, setTick] = useState(0);
106
+ useEffect(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
107
+ const [open, setOpen] = useState(null);
108
+ const [error, setError] = useState(null);
109
+ const commitNext = useRef(true);
110
+ const layer = layerId ? controller.getLayer(layerId) : controller.getActiveLayer();
111
+ const model = layerEffectsPanel(layer);
112
+ const id = layer?.id;
113
+ const attempt = (fn) => {
114
+ try {
115
+ setError(null);
116
+ fn();
117
+ } catch (err) {
118
+ setError(err instanceof Error ? err.message : String(err));
119
+ }
120
+ };
121
+ if (!model.available || !id) {
122
+ return /* @__PURE__ */ jsx2("div", { className: `text-xs text-muted-foreground ${className ?? ""}`, "data-testid": "layer-effects", children: model.reason });
123
+ }
124
+ const effects = controller.getLayerEffects(id);
125
+ const patterns = controller.getDocumentPatterns();
126
+ const change = (effectId, control, value, drag = false) => attempt(() => {
127
+ const effect = controller.getLayerEffects(id).items.find((e) => e.id === effectId);
128
+ controller.updateLayerEffect(id, effectId, effectControlChange(effect, control.key, value, patterns), drag ? commitNext.current : true);
129
+ if (drag) commitNext.current = false;
130
+ });
131
+ const renderControl = (effectId, c) => {
132
+ const label = `${c.label}`;
133
+ switch (c.type) {
134
+ case "range": {
135
+ const k = c.percent ? 100 : 1;
136
+ const shown = Math.round(c.value * k * 100) / 100;
137
+ return /* @__PURE__ */ jsxs2("label", { className: "flex flex-col gap-0.5", children: [
138
+ /* @__PURE__ */ jsxs2("span", { className: "text-muted-foreground", children: [
139
+ label,
140
+ " ",
141
+ shown,
142
+ c.unit
143
+ ] }),
144
+ /* @__PURE__ */ jsx2(
145
+ ImageRange,
146
+ {
147
+ label,
148
+ min: c.min * k,
149
+ max: c.max * k,
150
+ step: c.step * k,
151
+ value: shown,
152
+ disabled: model.readOnly,
153
+ onStart: () => commitNext.current = true,
154
+ onEnd: () => commitNext.current = true,
155
+ onChange: (v) => change(effectId, c, v / k, true)
156
+ }
157
+ )
158
+ ] }, c.key);
159
+ }
160
+ case "color":
161
+ return /* @__PURE__ */ jsxs2("label", { className: "flex items-center gap-1.5 text-foreground", children: [
162
+ /* @__PURE__ */ jsx2(ImageColor, { label, value: c.value, disabled: model.readOnly, onChange: (v) => change(effectId, c, v) }),
163
+ label
164
+ ] }, c.key);
165
+ case "checkbox":
166
+ return /* @__PURE__ */ jsxs2("label", { className: "flex items-center gap-1.5 text-foreground", children: [
167
+ /* @__PURE__ */ jsx2(ImageCheckbox, { label, checked: c.value, disabled: model.readOnly, onChange: (on) => change(effectId, c, on) }),
168
+ label
169
+ ] }, c.key);
170
+ case "select":
171
+ return /* @__PURE__ */ jsxs2("label", { className: "flex flex-col gap-0.5", children: [
172
+ /* @__PURE__ */ jsx2("span", { className: "text-muted-foreground", children: label }),
173
+ /* @__PURE__ */ jsx2(
174
+ ImageSelect,
175
+ {
176
+ label,
177
+ value: String(c.value),
178
+ disabled: model.readOnly,
179
+ options: c.options.map((o) => ({ value: String(o.value), label: o.label })),
180
+ onChange: (v) => change(effectId, c, v)
181
+ }
182
+ )
183
+ ] }, c.key);
184
+ }
185
+ };
186
+ return /* @__PURE__ */ jsxs2("div", { className: `flex flex-col gap-1.5 text-xs text-foreground ${className ?? ""}`, "data-testid": "layer-effects", "aria-label": "Layer style", role: "group", children: [
187
+ /* @__PURE__ */ jsxs2("div", { className: "flex flex-wrap items-center gap-2", children: [
188
+ /* @__PURE__ */ jsx2("span", { className: "font-semibold text-foreground", children: heading ? "Layer Style" : "Styles" }),
189
+ /* @__PURE__ */ jsxs2("label", { className: "flex items-center gap-1 text-foreground", children: [
190
+ /* @__PURE__ */ jsx2(ImageCheckbox, { label: "Effects on", checked: model.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.setLayerEffectsEnabled(id, on)) }),
191
+ "On"
192
+ ] }),
193
+ /* @__PURE__ */ jsxs2("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
194
+ "Scale",
195
+ /* @__PURE__ */ jsx2(
196
+ "input",
197
+ {
198
+ type: "number",
199
+ "aria-label": "Scale effects",
200
+ min: 1,
201
+ max: 1e3,
202
+ step: 1,
203
+ value: Math.round(model.scale * 100),
204
+ disabled: model.readOnly,
205
+ onChange: (e) => {
206
+ const v = Number(e.target.value);
207
+ if (v >= 1 && v <= 1e3) attempt(() => controller.setLayerEffectsEnabled(id, model.enabled, v / 100));
208
+ },
209
+ className: "w-14 bg-muted border border-border rounded px-1"
210
+ }
211
+ ),
212
+ "%"
213
+ ] }),
214
+ heading && /* @__PURE__ */ jsx2(
215
+ ImageSelect,
216
+ {
217
+ label: "Add style",
218
+ value: "",
219
+ placeholder: "Add style\u2026",
220
+ disabled: model.readOnly,
221
+ options: LAYER_EFFECT_MENU.map((m) => ({ value: m.kind, label: m.label })),
222
+ onChange: (v) => {
223
+ const kind = v;
224
+ if (!kind) return;
225
+ attempt(() => setOpen(controller.addLayerEffect(id, kind).effect.id));
226
+ }
227
+ }
228
+ )
229
+ ] }),
230
+ model.readOnly && model.reason && /* @__PURE__ */ jsx2("p", { className: "text-muted-foreground", children: model.reason }),
231
+ /* @__PURE__ */ jsx2("ul", { className: "flex flex-col gap-1", "aria-label": "Effects", children: model.rows.map((row) => {
232
+ const effect = effects.items.find((e) => e.id === row.id);
233
+ const expanded = open === row.id;
234
+ return /* @__PURE__ */ jsxs2("li", { "data-effect-id": row.id, className: "rounded bg-background/60 ring-1 ring-border", children: [
235
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-1.5 px-1.5 py-1", children: [
236
+ /* @__PURE__ */ jsx2(ImageCheckbox, { label: `${row.label} on`, checked: row.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.updateLayerEffect(id, row.id, { enabled: on })) }),
237
+ /* @__PURE__ */ jsx2(
238
+ "button",
239
+ {
240
+ type: "button",
241
+ "aria-expanded": expanded,
242
+ className: `flex-1 text-left ${row.enabled && model.enabled ? "" : "text-muted-foreground"}`,
243
+ onClick: () => setOpen(expanded ? null : row.id),
244
+ children: row.label
245
+ }
246
+ ),
247
+ /* @__PURE__ */ jsx2("button", { type: "button", className: imageIconButtonClass, "aria-label": `Remove ${row.label}`, disabled: model.readOnly, onClick: () => attempt(() => controller.removeLayerEffect(id, row.id)), children: "\u2715" })
248
+ ] }),
249
+ expanded && /* @__PURE__ */ jsx2("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 px-1.5 pb-1.5", "data-testid": "effect-settings", children: layerEffectControls(effect, patterns).map((c) => renderControl(row.id, c)) })
250
+ ] }, row.id);
251
+ }) }),
252
+ error && /* @__PURE__ */ jsx2("p", { role: "alert", className: "text-destructive", children: error })
253
+ ] });
254
+ };
255
+
256
+ // src/paint-editor/PaintGradientEditorView.tsx
257
+ import { useState as useState2 } from "react";
258
+ import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
259
+ var button = "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700 disabled:opacity-40";
260
+ var select = "rounded bg-slate-800 px-1 py-0.5 text-[11px]";
261
+ var number = "w-16 rounded bg-slate-800 px-1 py-0.5 text-[11px]";
262
+ var pct = (v) => Math.round(v * 1e3) / 10;
263
+ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
264
+ const {
265
+ PAINT_GRADIENT_MAPPINGS,
266
+ PAINT_GRADIENT_MAPPING_LABELS,
267
+ PAINT_GRADIENT_PRESETS,
268
+ PAINT_GRADIENT_REPEATS,
269
+ PAINT_GRADIENT_REPEAT_LABELS,
270
+ PAINT_GRADIENT_SPACES,
271
+ PAINT_GRADIENT_SPACE_LABELS,
272
+ addPaintGradientStop,
273
+ paintGradientMappingFor,
274
+ paintSourceCss,
275
+ removePaintGradientStop,
276
+ reversePaintGradient,
277
+ updatePaintGradientStop
278
+ } = kit;
279
+ const [selected, setSelected] = useState2(0);
280
+ const sel = Math.min(selected, value.stops.length - 1);
281
+ const stop = value.stops[sel];
282
+ const map = value.map;
283
+ const stopHex = (c) => c === "paint" ? colors.paint : c === "secondary" ? colors.secondary : c;
284
+ const patchStop = (patch) => {
285
+ const r = updatePaintGradientStop(value, sel, patch);
286
+ setSelected(r.index);
287
+ onChange(r.paint);
288
+ };
289
+ return /* @__PURE__ */ jsxs3("div", { className: `flex flex-col gap-1.5 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "paint-gradient-editor", "aria-label": "Gradient paint", children: [
290
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-1", children: [
291
+ /* @__PURE__ */ jsxs3("select", { "aria-label": "Gradient preset", className: select, value: "", onChange: (e) => e.target.value && (setSelected(0), onChange(PAINT_GRADIENT_PRESETS[Number(e.target.value)].paint)), children: [
292
+ /* @__PURE__ */ jsx3("option", { value: "", children: "Presets\u2026" }),
293
+ PAINT_GRADIENT_PRESETS.map((p, i) => /* @__PURE__ */ jsx3("option", { value: i, children: p.name }, p.name))
294
+ ] }),
295
+ /* @__PURE__ */ jsx3("button", { type: "button", className: button, onClick: () => onChange(reversePaintGradient(value)), children: "Reverse" })
296
+ ] }),
297
+ /* @__PURE__ */ jsx3(
298
+ "div",
299
+ {
300
+ role: "slider",
301
+ tabIndex: 0,
302
+ "aria-label": "Gradient ramp: click to add a stop",
303
+ "aria-valuemin": 0,
304
+ "aria-valuemax": 100,
305
+ "aria-valuenow": pct(stop.offset),
306
+ "data-testid": "paint-gradient-ramp",
307
+ className: "relative h-6 cursor-copy rounded ring-1 ring-slate-700",
308
+ style: { background: paintSourceCss(value, colors) },
309
+ onClick: (e) => {
310
+ const rect = e.currentTarget.getBoundingClientRect();
311
+ const r = addPaintGradientStop(value, rect.width ? (e.clientX - rect.left) / rect.width : 0.5, colors);
312
+ if (r.index >= 0) {
313
+ setSelected(r.index);
314
+ onChange(r.paint);
315
+ }
316
+ }
317
+ }
318
+ ),
319
+ /* @__PURE__ */ jsx3("div", { className: "relative h-4", "aria-label": "Stops", children: value.stops.map((s, i) => /* @__PURE__ */ jsx3(
320
+ "button",
321
+ {
322
+ type: "button",
323
+ "aria-label": `Stop ${i + 1} at ${pct(s.offset)}%`,
324
+ "aria-pressed": i === sel,
325
+ className: `absolute top-0 h-4 w-3 -translate-x-1/2 rounded-sm ring-1 ${i === sel ? "ring-white" : "ring-slate-600"}`,
326
+ style: { left: `${s.offset * 100}%`, background: stopHex(s.color) },
327
+ onClick: () => setSelected(i)
328
+ },
329
+ i
330
+ )) }),
331
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-stop", children: [
332
+ /* @__PURE__ */ jsxs3("select", { "aria-label": "Stop colour source", className: select, value: stop.color === "paint" || stop.color === "secondary" ? stop.color : "color", onChange: (e) => patchStop({ color: e.target.value === "color" ? stopHex(stop.color) : e.target.value }), children: [
333
+ /* @__PURE__ */ jsx3("option", { value: "color", children: "Colour" }),
334
+ /* @__PURE__ */ jsx3("option", { value: "paint", children: "Paint colour" }),
335
+ /* @__PURE__ */ jsx3("option", { value: "secondary", children: "Second colour" })
336
+ ] }),
337
+ stop.color !== "paint" && stop.color !== "secondary" && /* @__PURE__ */ jsx3("input", { type: "color", "aria-label": "Stop colour", value: stop.color, onChange: (e) => patchStop({ color: e.target.value }), className: "h-6 w-8 rounded bg-transparent" }),
338
+ /* @__PURE__ */ jsxs3("label", { className: "flex items-center gap-1", children: [
339
+ "At",
340
+ /* @__PURE__ */ jsx3("input", { type: "number", "aria-label": "Stop position", min: 0, max: 100, step: 1, value: pct(stop.offset), onChange: (e) => patchStop({ offset: Number(e.target.value) / 100 }), className: number }),
341
+ "%"
342
+ ] }),
343
+ /* @__PURE__ */ jsxs3("label", { className: "flex items-center gap-1", children: [
344
+ "Opacity",
345
+ /* @__PURE__ */ jsx3("input", { type: "number", "aria-label": "Stop opacity", min: 0, max: 100, step: 5, value: pct(stop.opacity ?? 1), onChange: (e) => patchStop({ opacity: Number(e.target.value) / 100 }), className: number }),
346
+ "%"
347
+ ] }),
348
+ sel < value.stops.length - 1 && /* @__PURE__ */ jsxs3("label", { className: "flex items-center gap-1", children: [
349
+ "Midpoint",
350
+ /* @__PURE__ */ jsx3("input", { type: "number", "aria-label": "Stop midpoint", min: 5, max: 95, step: 1, value: pct(stop.midpoint ?? 0.5), onChange: (e) => patchStop({ midpoint: Number(e.target.value) / 100 }), className: number }),
351
+ "%"
352
+ ] }),
353
+ /* @__PURE__ */ jsx3("button", { type: "button", className: button, disabled: value.stops.length <= 2, onClick: () => (setSelected(Math.max(0, sel - 1)), onChange(removePaintGradientStop(value, sel))), children: "Remove stop" })
354
+ ] }),
355
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-mapping", children: [
356
+ /* @__PURE__ */ jsx3("select", { "aria-label": "Gradient follows", className: select, value: map.by, onChange: (e) => onChange({ ...value, map: paintGradientMappingFor(e.target.value, map) }), children: PAINT_GRADIENT_MAPPINGS.map((m) => /* @__PURE__ */ jsx3("option", { value: m, children: PAINT_GRADIENT_MAPPING_LABELS[m] }, m)) }),
357
+ map.by === "distance" && /* @__PURE__ */ jsxs3(Fragment, { children: [
358
+ /* @__PURE__ */ jsx3("input", { type: "number", "aria-label": "Gradient length", min: 1, max: 1e5, value: map.length, onChange: (e) => onChange({ ...value, map: { ...map, length: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
359
+ /* @__PURE__ */ jsxs3("select", { "aria-label": "Gradient length unit", className: select, value: map.unit ?? "px", onChange: (e) => onChange({ ...value, map: { ...map, unit: e.target.value } }), children: [
360
+ /* @__PURE__ */ jsx3("option", { value: "px", children: "px" }),
361
+ /* @__PURE__ */ jsx3("option", { value: "dabs", children: "dabs" })
362
+ ] })
363
+ ] }),
364
+ map.by === "time" && /* @__PURE__ */ jsx3("input", { type: "number", "aria-label": "Gradient duration", min: 1, max: 6e5, value: map.duration, onChange: (e) => onChange({ ...value, map: { ...map, duration: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
365
+ map.by === "random" && /* @__PURE__ */ jsx3("input", { type: "number", "aria-label": "Dabs per pick", min: 1, max: 500, value: map.every ?? 1, onChange: (e) => onChange({ ...value, map: { ...map, every: Math.max(1, Math.round(Number(e.target.value) || 1)) } }), className: number }),
366
+ (map.by === "distance" || map.by === "time") && /* @__PURE__ */ jsx3("select", { "aria-label": "Gradient repeat", className: select, value: map.repeat ?? "clamp", onChange: (e) => onChange({ ...value, map: { ...map, repeat: e.target.value } }), children: PAINT_GRADIENT_REPEATS.map((r) => /* @__PURE__ */ jsx3("option", { value: r, children: PAINT_GRADIENT_REPEAT_LABELS[r] }, r)) })
367
+ ] }),
368
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-1", children: [
369
+ /* @__PURE__ */ jsx3("select", { "aria-label": "Gradient mixing", className: select, value: value.space, onChange: (e) => onChange({ ...value, space: e.target.value }), children: PAINT_GRADIENT_SPACES.map((s) => /* @__PURE__ */ jsx3("option", { value: s, children: PAINT_GRADIENT_SPACE_LABELS[s] }, s)) }),
370
+ /* @__PURE__ */ jsxs3("label", { className: "flex flex-1 items-center gap-1", children: [
371
+ "Softness",
372
+ /* @__PURE__ */ jsx3("input", { type: "range", "aria-label": "Gradient softness", min: 0, max: 1, step: 0.05, value: value.softness ?? 1, onChange: (e) => onChange({ ...value, softness: Number(e.target.value) }), className: "flex-1 accent-indigo-500" })
373
+ ] })
374
+ ] })
375
+ ] });
376
+ };
377
+
378
+ export {
379
+ imageEditorFrameClass,
380
+ imageEditorHeaderClass,
381
+ imageTabListClass,
382
+ imageTabClass,
383
+ imageHeaderButtonClass,
384
+ imagePrimaryButtonClass,
385
+ imageSidebarClass,
386
+ imageSectionTitleClass,
387
+ imageSectionClass,
388
+ imageDividerClass,
389
+ imageSmallButtonClass,
390
+ imageIconButtonClass,
391
+ imageOutlineButtonClass,
392
+ imageChipClass,
393
+ imageFieldClass,
394
+ imageSelectClass,
395
+ imageRangeClass,
396
+ imageErrorBannerClass,
397
+ imageSpinnerClass,
398
+ ImageEditorControlsProvider,
399
+ useImageEditorControls,
400
+ ImageCheckbox,
401
+ ImageRange,
402
+ ImageSelect,
403
+ ImageColor,
404
+ LayerEffectsPanel,
405
+ PaintGradientEditorView
406
+ };
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
- import type { ImageEditorController } from '@pixerate/editor/image-editor';
2
+ import type { LayerEffectsController } from '@pixerate/editor/raster';
3
3
  export interface LayerEffectsPanelProps {
4
- controller: ImageEditorController;
4
+ /** The image editor's controller, the paint editor's, or anything else with layer effects. */
5
+ controller: LayerEffectsController;
5
6
  /** The layer whose effects to show (default: the active layer). */
6
7
  layerId?: string | null;
7
8
  /**
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
- import type { ImageEditorController } from '@pixerate/editor/image-editor';
2
+ import type { LayerEffectsController } from '@pixerate/editor/raster';
3
3
  export interface LayerEffectsPanelProps {
4
- controller: ImageEditorController;
4
+ /** The image editor's controller, the paint editor's, or anything else with layer effects. */
5
+ controller: LayerEffectsController;
5
6
  /** The layer whose effects to show (default: the active layer). */
6
7
  layerId?: string | null;
7
8
  /**