@pixerate/editor-react 0.114.3 → 0.115.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.
@@ -2336,7 +2336,8 @@ function resolveParameterComponents(explicit, context) {
2336
2336
  return {
2337
2337
  input: explicit?.input ?? context?.input,
2338
2338
  slider: explicit?.slider ?? context?.slider,
2339
- select: explicit?.select ?? context?.select
2339
+ select: explicit?.select ?? context?.select,
2340
+ color: explicit?.color ?? context?.color
2340
2341
  };
2341
2342
  }
2342
2343
 
@@ -2570,7 +2571,8 @@ function ParameterSelect(props) {
2570
2571
  }
2571
2572
  );
2572
2573
  }
2573
- function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id }) {
2574
+ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id, components }) {
2575
+ const CustomColor = resolveParameterComponents(components, useParameterComponents()).color;
2574
2576
  const [open, setOpen] = (0, import_react19.useState)(false);
2575
2577
  const containerRef = (0, import_react19.useRef)(null);
2576
2578
  const buttonRef = (0, import_react19.useRef)(null);
@@ -2602,6 +2604,22 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
2602
2604
  window.removeEventListener("keydown", onKeyDown, true);
2603
2605
  };
2604
2606
  }, [open]);
2607
+ if (CustomColor) {
2608
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2609
+ CustomColor,
2610
+ {
2611
+ id,
2612
+ value: shown,
2613
+ alpha,
2614
+ swatches: field.swatches,
2615
+ disabled: off,
2616
+ label: name,
2617
+ onChange,
2618
+ onGestureStart,
2619
+ onGestureEnd
2620
+ }
2621
+ );
2622
+ }
2605
2623
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
2606
2624
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
2607
2625
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
@@ -3,8 +3,8 @@ import {
3
3
  EffectsBrowser,
4
4
  useEffectDescription,
5
5
  useEffects
6
- } from "../chunk-TOGMXZM4.js";
7
- import "../chunk-354TA5QV.js";
6
+ } from "../chunk-6BWTJ3EE.js";
7
+ import "../chunk-5RPB4WGT.js";
8
8
  import "../chunk-KIRIU53A.js";
9
9
  import "../chunk-3I7FOSLF.js";
10
10
  import {
@@ -3158,7 +3158,8 @@ function resolveParameterComponents(explicit, context) {
3158
3158
  return {
3159
3159
  input: explicit?.input ?? context?.input,
3160
3160
  slider: explicit?.slider ?? context?.slider,
3161
- select: explicit?.select ?? context?.select
3161
+ select: explicit?.select ?? context?.select,
3162
+ color: explicit?.color ?? context?.color
3162
3163
  };
3163
3164
  }
3164
3165
 
@@ -3392,7 +3393,8 @@ function ParameterSelect(props) {
3392
3393
  }
3393
3394
  );
3394
3395
  }
3395
- function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id }) {
3396
+ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id, components }) {
3397
+ const CustomColor = resolveParameterComponents(components, useParameterComponents()).color;
3396
3398
  const [open, setOpen] = (0, import_react28.useState)(false);
3397
3399
  const containerRef = (0, import_react28.useRef)(null);
3398
3400
  const buttonRef = (0, import_react28.useRef)(null);
@@ -3424,6 +3426,22 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3424
3426
  window.removeEventListener("keydown", onKeyDown, true);
3425
3427
  };
3426
3428
  }, [open]);
3429
+ if (CustomColor) {
3430
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3431
+ CustomColor,
3432
+ {
3433
+ id,
3434
+ value: shown,
3435
+ alpha,
3436
+ swatches: field.swatches,
3437
+ disabled: off,
3438
+ label: name,
3439
+ onChange,
3440
+ onGestureStart,
3441
+ onGestureEnd
3442
+ }
3443
+ );
3444
+ }
3427
3445
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
3428
3446
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
3429
3447
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
@@ -2,8 +2,8 @@ import {
2
2
  EffectParameters,
3
3
  EffectsBrowser,
4
4
  useEffectDescription
5
- } from "../chunk-TOGMXZM4.js";
6
- import "../chunk-354TA5QV.js";
5
+ } from "../chunk-6BWTJ3EE.js";
6
+ import "../chunk-5RPB4WGT.js";
7
7
  import "../chunk-KIRIU53A.js";
8
8
  import "../chunk-3I7FOSLF.js";
9
9
  import {
@@ -6,11 +6,11 @@ import {
6
6
  EffectsBrowser,
7
7
  useEffectDescription,
8
8
  useEffects
9
- } from "./chunk-TOGMXZM4.js";
9
+ } from "./chunk-6BWTJ3EE.js";
10
10
  import {
11
11
  resolveParameterComponents,
12
12
  useParameterComponents
13
- } from "./chunk-354TA5QV.js";
13
+ } from "./chunk-5RPB4WGT.js";
14
14
  import {
15
15
  PresenceLayer,
16
16
  useAgentPlayback,
@@ -1037,6 +1037,22 @@ function ImageSelect(props) {
1037
1037
  options.map((o) => /* @__PURE__ */ jsx2("option", { value: o.value, children: o.label }, o.value))
1038
1038
  ] });
1039
1039
  }
1040
+ function ImageColor(props) {
1041
+ const Host = useImageEditorControls().Color;
1042
+ if (Host) return /* @__PURE__ */ jsx2(Host, { ...props });
1043
+ const { value, label, alpha, disabled, onChange, className = "" } = props;
1044
+ return /* @__PURE__ */ jsx2(
1045
+ "input",
1046
+ {
1047
+ type: "color",
1048
+ "aria-label": label,
1049
+ value: value.slice(0, 7),
1050
+ disabled,
1051
+ onChange: (e) => onChange(e.target.value + (alpha ? value.slice(7, 9) : "")),
1052
+ className: `${imageColorInputClass} ${className}`
1053
+ }
1054
+ );
1055
+ }
1040
1056
 
1041
1057
  // src/image-editor/ControlSlider.tsx
1042
1058
  import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
@@ -1296,32 +1312,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
1296
1312
  /* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-2 text-foreground", children: [
1297
1313
  /* @__PURE__ */ jsx6(ImageCheckbox, { label: "Tint", checked: layer.params.tint !== null, onChange: (on) => setParam(layer, "tint", on ? "#e1d3b3" : null) }),
1298
1314
  "Tint",
1299
- layer.params.tint && /* @__PURE__ */ jsx6(
1300
- "input",
1301
- {
1302
- type: "color",
1303
- "aria-label": "Tint colour",
1304
- value: layer.params.tint,
1305
- onChange: (e) => setParam(layer, "tint", e.target.value),
1306
- className: "h-5 w-8 bg-transparent"
1307
- }
1308
- )
1315
+ layer.params.tint && /* @__PURE__ */ jsx6(ImageColor, { label: "Tint colour", value: layer.params.tint, onChange: (v) => setParam(layer, "tint", v) })
1309
1316
  ] })
1310
1317
  ] });
1311
1318
  case "photoFilter":
1312
1319
  return /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-2", children: [
1313
1320
  /* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-2 text-foreground", children: [
1314
1321
  "Filter colour",
1315
- /* @__PURE__ */ jsx6(
1316
- "input",
1317
- {
1318
- type: "color",
1319
- "aria-label": "Filter colour",
1320
- value: layer.params.color,
1321
- onChange: (e) => setParam(layer, "color", e.target.value),
1322
- className: "h-5 w-8 bg-transparent"
1323
- }
1324
- )
1322
+ /* @__PURE__ */ jsx6(ImageColor, { label: "Filter colour", value: layer.params.color, onChange: (v) => setParam(layer, "color", v) })
1325
1323
  ] }),
1326
1324
  controlsOf(layer).map((s) => slider(layer, s)),
1327
1325
  checkbox(layer, "preserveLuminosity", "Preserve luminosity")
@@ -1511,7 +1509,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
1511
1509
  }
1512
1510
  case "color":
1513
1511
  return /* @__PURE__ */ jsxs7("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1514
- /* @__PURE__ */ jsx7("input", { type: "color", "aria-label": label, value: c.value, disabled: model.readOnly, onChange: (e) => change(effectId, c, e.target.value) }),
1512
+ /* @__PURE__ */ jsx7(ImageColor, { label, value: c.value, disabled: model.readOnly, onChange: (v) => change(effectId, c, v) }),
1515
1513
  label
1516
1514
  ] }, c.key);
1517
1515
  case "checkbox":
@@ -2084,10 +2082,26 @@ function ImageParameterSelect({ value, options, label, disabled, className, onCh
2084
2082
  }
2085
2083
  );
2086
2084
  }
2085
+ function ImageParameterColor({ value, alpha, label, disabled, className, onChange, onGestureStart, onGestureEnd }) {
2086
+ return /* @__PURE__ */ jsx9(
2087
+ ImageColor,
2088
+ {
2089
+ value,
2090
+ alpha,
2091
+ label,
2092
+ disabled,
2093
+ className,
2094
+ onChange,
2095
+ onStart: onGestureStart,
2096
+ onEnd: onGestureEnd
2097
+ }
2098
+ );
2099
+ }
2087
2100
  function imageEditorParameterComponents(controls) {
2088
2101
  return {
2089
2102
  slider: controls.Range ? ImageParameterSlider : void 0,
2090
- select: controls.Select ? ImageParameterSelect : void 0
2103
+ select: controls.Select ? ImageParameterSelect : void 0,
2104
+ color: controls.Color ? ImageParameterColor : void 0
2091
2105
  };
2092
2106
  }
2093
2107
 
@@ -2278,29 +2292,11 @@ var BrushOptionsBar = ({ controller, className }) => {
2278
2292
  )) }),
2279
2293
  /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", role: "group", "aria-label": "Colours", children: [
2280
2294
  /* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1", children: [
2281
- /* @__PURE__ */ jsx13(
2282
- "input",
2283
- {
2284
- type: "color",
2285
- "aria-label": "Foreground colour",
2286
- value: foreground,
2287
- onChange: (e) => controller.setPaintOptions({ foreground: e.target.value }),
2288
- className: imageColorInputClass
2289
- }
2290
- ),
2295
+ /* @__PURE__ */ jsx13(ImageColor, { label: "Foreground colour", value: foreground, onChange: (fg) => controller.setPaintOptions({ foreground: fg }) }),
2291
2296
  /* @__PURE__ */ jsx13("span", { className: "text-muted-foreground", children: "FG" })
2292
2297
  ] }),
2293
2298
  /* @__PURE__ */ jsxs11("label", { className: "flex items-center gap-1", children: [
2294
- /* @__PURE__ */ jsx13(
2295
- "input",
2296
- {
2297
- type: "color",
2298
- "aria-label": "Background colour",
2299
- value: background,
2300
- onChange: (e) => controller.setPaintOptions({ background: e.target.value }),
2301
- className: imageColorInputClass
2302
- }
2303
- ),
2299
+ /* @__PURE__ */ jsx13(ImageColor, { label: "Background colour", value: background, onChange: (bg) => controller.setPaintOptions({ background: bg }) }),
2304
2300
  /* @__PURE__ */ jsx13("span", { className: "text-muted-foreground", children: "BG" })
2305
2301
  ] }),
2306
2302
  /* @__PURE__ */ jsx13("button", { type: "button", title: "Swap colours (X)", className: imageChipClass(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
@@ -2920,32 +2916,12 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
2920
2916
  /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
2921
2917
  /* @__PURE__ */ jsx18(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
2922
2918
  "Fill",
2923
- /* @__PURE__ */ jsx18(
2924
- "input",
2925
- {
2926
- type: "color",
2927
- "aria-label": "Fill colour",
2928
- disabled: options.fill === null,
2929
- value: options.fill ?? "#4f46e5",
2930
- onChange: (e) => set({ fill: e.target.value }),
2931
- className: imageColorInputClass
2932
- }
2933
- )
2919
+ /* @__PURE__ */ jsx18(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
2934
2920
  ] }),
2935
2921
  /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
2936
2922
  /* @__PURE__ */ jsx18(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
2937
2923
  "Stroke",
2938
- /* @__PURE__ */ jsx18(
2939
- "input",
2940
- {
2941
- type: "color",
2942
- "aria-label": "Stroke colour",
2943
- disabled: options.stroke === null,
2944
- value: options.stroke ?? "#000000",
2945
- onChange: (e) => set({ stroke: e.target.value }),
2946
- className: imageColorInputClass
2947
- }
2948
- )
2924
+ /* @__PURE__ */ jsx18(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
2949
2925
  ] }),
2950
2926
  /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
2951
2927
  "Width",
@@ -3072,7 +3048,7 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
3072
3048
  ] }),
3073
3049
  /* @__PURE__ */ jsx19("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${imageChipClass(shown.fontWeight >= 600)} font-bold`, onClick: () => style({ fontWeight: shown.fontWeight >= 600 ? 400 : 700 }), children: "B" }),
3074
3050
  /* @__PURE__ */ jsx19("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
3075
- /* @__PURE__ */ jsx19("input", { type: "color", "aria-label": "Text colour", value: shown.color, onChange: (e) => style({ color: e.target.value }), className: imageColorInputClass })
3051
+ /* @__PURE__ */ jsx19(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
3076
3052
  ] }),
3077
3053
  /* @__PURE__ */ jsx19("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: TEXT_ALIGNS.map((a) => /* @__PURE__ */ jsx19("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
3078
3054
  /* @__PURE__ */ jsx19("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text, drag for a paragraph box, click text to edit it. Esc finishes." }),
@@ -3727,15 +3703,7 @@ var ImageEditor = ({
3727
3703
  )) }),
3728
3704
  /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2 mt-2", children: [
3729
3705
  /* @__PURE__ */ jsx20("label", { className: "text-muted-foreground", children: "Color:" }),
3730
- /* @__PURE__ */ jsx20(
3731
- "input",
3732
- {
3733
- type: "color",
3734
- value: activeColor,
3735
- onChange: (e) => setActiveColor(e.target.value),
3736
- className: "w-8 h-8 rounded border border-border cursor-pointer bg-transparent"
3737
- }
3738
- ),
3706
+ /* @__PURE__ */ jsx20(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
3739
3707
  /* @__PURE__ */ jsxs18("div", { className: "flex-1 ml-2", children: [
3740
3708
  /* @__PURE__ */ jsxs18("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
3741
3709
  /* @__PURE__ */ jsx20("span", { children: "Width:" }),
@@ -4129,6 +4097,7 @@ export {
4129
4097
  ImageCheckbox,
4130
4098
  ImageRange,
4131
4099
  ImageSelect,
4100
+ ImageColor,
4132
4101
  ControlSlider,
4133
4102
  Histogram,
4134
4103
  useImageHistogram,
@@ -16,7 +16,8 @@ function resolveParameterComponents(explicit, context) {
16
16
  return {
17
17
  input: explicit?.input ?? context?.input,
18
18
  slider: explicit?.slider ?? context?.slider,
19
- select: explicit?.select ?? context?.select
19
+ select: explicit?.select ?? context?.select,
20
+ color: explicit?.color ?? context?.color
20
21
  };
21
22
  }
22
23
 
@@ -266,7 +267,8 @@ function ParameterSelect(props) {
266
267
  }
267
268
  );
268
269
  }
269
- function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id }) {
270
+ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id, components }) {
271
+ const CustomColor = resolveParameterComponents(components, useParameterComponents()).color;
270
272
  const [open, setOpen] = useState(false);
271
273
  const containerRef = useRef(null);
272
274
  const buttonRef = useRef(null);
@@ -298,6 +300,22 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
298
300
  window.removeEventListener("keydown", onKeyDown, true);
299
301
  };
300
302
  }, [open]);
303
+ if (CustomColor) {
304
+ return /* @__PURE__ */ jsx2(
305
+ CustomColor,
306
+ {
307
+ id,
308
+ value: shown,
309
+ alpha,
310
+ swatches: field.swatches,
311
+ disabled: off,
312
+ label: name,
313
+ onChange,
314
+ onGestureStart,
315
+ onGestureEnd
316
+ }
317
+ );
318
+ }
301
319
  return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: "relative space-y-1.5", children: [
302
320
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
303
321
  /* @__PURE__ */ jsx2(
@@ -3,7 +3,7 @@ import {
3
3
  parameterSelectStyle,
4
4
  resolveParameterComponents,
5
5
  useParameterComponents
6
- } from "./chunk-354TA5QV.js";
6
+ } from "./chunk-5RPB4WGT.js";
7
7
 
8
8
  // src/effects/useEffects.ts
9
9
  import { useEffect, useState } from "react";
@@ -1236,7 +1236,8 @@ function resolveParameterComponents(explicit, context) {
1236
1236
  return {
1237
1237
  input: explicit?.input ?? context?.input,
1238
1238
  slider: explicit?.slider ?? context?.slider,
1239
- select: explicit?.select ?? context?.select
1239
+ select: explicit?.select ?? context?.select,
1240
+ color: explicit?.color ?? context?.color
1240
1241
  };
1241
1242
  }
1242
1243
 
@@ -1470,7 +1471,8 @@ function ParameterSelect(props) {
1470
1471
  }
1471
1472
  );
1472
1473
  }
1473
- function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id }) {
1474
+ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id, components }) {
1475
+ const CustomColor = resolveParameterComponents(components, useParameterComponents()).color;
1474
1476
  const [open, setOpen] = (0, import_react8.useState)(false);
1475
1477
  const containerRef = (0, import_react8.useRef)(null);
1476
1478
  const buttonRef = (0, import_react8.useRef)(null);
@@ -1502,6 +1504,22 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
1502
1504
  window.removeEventListener("keydown", onKeyDown, true);
1503
1505
  };
1504
1506
  }, [open]);
1507
+ if (CustomColor) {
1508
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1509
+ CustomColor,
1510
+ {
1511
+ id,
1512
+ value: shown,
1513
+ alpha,
1514
+ swatches: field.swatches,
1515
+ disabled: off,
1516
+ label: name,
1517
+ onChange,
1518
+ onGestureStart,
1519
+ onGestureEnd
1520
+ }
1521
+ );
1522
+ }
1505
1523
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
1506
1524
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-2", children: [
1507
1525
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
@@ -6,8 +6,8 @@ import {
6
6
  useEffectAuthoring,
7
7
  useEffectDescription,
8
8
  useEffects
9
- } from "../chunk-TOGMXZM4.js";
10
- import "../chunk-354TA5QV.js";
9
+ } from "../chunk-6BWTJ3EE.js";
10
+ import "../chunk-5RPB4WGT.js";
11
11
  import "../chunk-KIRIU53A.js";
12
12
  import "../chunk-3I7FOSLF.js";
13
13
  export {
@@ -42,6 +42,22 @@ export interface ImageSelectProps {
42
42
  onChange: (value: string) => void;
43
43
  className?: string;
44
44
  }
45
+ /** A colour well in the image editor's panels. */
46
+ export interface ImageColorProps {
47
+ /** `#rrggbb`, or `#rrggbbaa` with `alpha`. */
48
+ value: string;
49
+ /** The accessible name. */
50
+ label: string;
51
+ /** Whether the colour has an alpha channel. */
52
+ alpha?: boolean;
53
+ disabled?: boolean;
54
+ /** Every change while the colour is picked. */
55
+ onChange: (value: string) => void;
56
+ /** A pick (e.g. a drag in the picker) starts: changes until `onEnd` merge into one undo step. */
57
+ onStart?: () => void;
58
+ onEnd?: () => void;
59
+ className?: string;
60
+ }
45
61
  /**
46
62
  * The host's own form controls for the image editor's panels. Any left out fall back to the
47
63
  * editor's plain inputs.
@@ -50,6 +66,7 @@ export interface ImageEditorControls {
50
66
  Checkbox?: ComponentType<ImageCheckboxProps>;
51
67
  Range?: ComponentType<ImageRangeProps>;
52
68
  Select?: ComponentType<ImageSelectProps>;
69
+ Color?: ComponentType<ImageColorProps>;
53
70
  }
54
71
  /** Makes the image editor's panels inside it use the host's controls. */
55
72
  export declare function ImageEditorControlsProvider({ controls, children }: {
@@ -64,3 +81,5 @@ export declare function ImageCheckbox(props: ImageCheckboxProps): import("react"
64
81
  export declare function ImageRange(props: ImageRangeProps): import("react").JSX.Element;
65
82
  /** A dropdown: the host's, or a plain select. */
66
83
  export declare function ImageSelect(props: ImageSelectProps): import("react").JSX.Element;
84
+ /** A colour well: the host's, or a plain colour input (which keeps the stored alpha). */
85
+ export declare function ImageColor(props: ImageColorProps): import("react").JSX.Element;
@@ -42,6 +42,22 @@ export interface ImageSelectProps {
42
42
  onChange: (value: string) => void;
43
43
  className?: string;
44
44
  }
45
+ /** A colour well in the image editor's panels. */
46
+ export interface ImageColorProps {
47
+ /** `#rrggbb`, or `#rrggbbaa` with `alpha`. */
48
+ value: string;
49
+ /** The accessible name. */
50
+ label: string;
51
+ /** Whether the colour has an alpha channel. */
52
+ alpha?: boolean;
53
+ disabled?: boolean;
54
+ /** Every change while the colour is picked. */
55
+ onChange: (value: string) => void;
56
+ /** A pick (e.g. a drag in the picker) starts: changes until `onEnd` merge into one undo step. */
57
+ onStart?: () => void;
58
+ onEnd?: () => void;
59
+ className?: string;
60
+ }
45
61
  /**
46
62
  * The host's own form controls for the image editor's panels. Any left out fall back to the
47
63
  * editor's plain inputs.
@@ -50,6 +66,7 @@ export interface ImageEditorControls {
50
66
  Checkbox?: ComponentType<ImageCheckboxProps>;
51
67
  Range?: ComponentType<ImageRangeProps>;
52
68
  Select?: ComponentType<ImageSelectProps>;
69
+ Color?: ComponentType<ImageColorProps>;
53
70
  }
54
71
  /** Makes the image editor's panels inside it use the host's controls. */
55
72
  export declare function ImageEditorControlsProvider({ controls, children }: {
@@ -64,3 +81,5 @@ export declare function ImageCheckbox(props: ImageCheckboxProps): import("react"
64
81
  export declare function ImageRange(props: ImageRangeProps): import("react").JSX.Element;
65
82
  /** A dropdown: the host's, or a plain select. */
66
83
  export declare function ImageSelect(props: ImageSelectProps): import("react").JSX.Element;
84
+ /** A colour well: the host's, or a plain colour input (which keeps the stored alpha). */
85
+ export declare function ImageColor(props: ImageColorProps): import("react").JSX.Element;
@@ -1,4 +1,4 @@
1
1
  import type { ParameterComponents } from '../../parameters/controls.cjs';
2
2
  import { type ImageEditorControls } from './controls.cjs';
3
- /** The host's image-editor `Range` and `Select` as parameter controls (only the ones it set). */
3
+ /** The host's image-editor `Range`, `Select` and `Color` as parameter controls (only the ones it set). */
4
4
  export declare function imageEditorParameterComponents(controls: ImageEditorControls): ParameterComponents;
@@ -1,4 +1,4 @@
1
1
  import type { ParameterComponents } from '../../parameters/controls.js';
2
2
  import { type ImageEditorControls } from './controls.js';
3
- /** The host's image-editor `Range` and `Select` as parameter controls (only the ones it set). */
3
+ /** The host's image-editor `Range`, `Select` and `Color` as parameter controls (only the ones it set). */
4
4
  export declare function imageEditorParameterComponents(controls: ImageEditorControls): ParameterComponents;