@pixerate/editor-react 0.114.3 → 0.116.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.
Files changed (36) hide show
  1. package/dist/animation-editor/index.cjs +20 -2
  2. package/dist/animation-editor/index.js +2 -2
  3. package/dist/canvas/index.cjs +20 -2
  4. package/dist/canvas/index.js +2 -2
  5. package/dist/{chunk-354TA5QV.js → chunk-5RPB4WGT.js} +20 -2
  6. package/dist/{chunk-TOGMXZM4.js → chunk-6BWTJ3EE.js} +1 -1
  7. package/dist/{chunk-SH63DFOO.js → chunk-ZQ54FEXL.js} +170 -98
  8. package/dist/effects/index.cjs +20 -2
  9. package/dist/effects/index.js +2 -2
  10. package/dist/image-editor/ImageProviderEffectsPanel.d.cts +5 -4
  11. package/dist/image-editor/ImageProviderEffectsPanel.d.ts +5 -4
  12. package/dist/image-editor/LayerEffectsPanel.d.cts +5 -0
  13. package/dist/image-editor/LayerEffectsPanel.d.ts +5 -0
  14. package/dist/image-editor/controls/controls.d.cts +19 -0
  15. package/dist/image-editor/controls/controls.d.ts +19 -0
  16. package/dist/image-editor/controls/parameterControls.d.cts +1 -1
  17. package/dist/image-editor/controls/parameterControls.d.ts +1 -1
  18. package/dist/image-editor/index.cjs +183 -92
  19. package/dist/image-editor/index.d.cts +1 -1
  20. package/dist/image-editor/index.d.ts +1 -1
  21. package/dist/image-editor/index.js +5 -3
  22. package/dist/index.cjs +183 -92
  23. package/dist/index.js +5 -3
  24. package/dist/paint-editor/index.cjs +20 -2
  25. package/dist/paint-editor/index.js +2 -2
  26. package/dist/parameters/controls.d.cts +20 -0
  27. package/dist/parameters/controls.d.ts +20 -0
  28. package/dist/parameters/fields.d.cts +1 -1
  29. package/dist/parameters/fields.d.ts +1 -1
  30. package/dist/parameters/index.cjs +20 -2
  31. package/dist/parameters/index.js +1 -1
  32. package/dist/vector/index.cjs +20 -2
  33. package/dist/vector/index.js +2 -2
  34. package/dist/video-editor/index.cjs +20 -2
  35. package/dist/video-editor/index.js +2 -2
  36. package/package.json +3 -3
@@ -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 {
@@ -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";
@@ -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,
@@ -190,7 +190,7 @@ function useImageEffectsTools(registry, controller, options = {}) {
190
190
  }
191
191
 
192
192
  // src/image-editor/ImageEditor.tsx
193
- import React15, { useRef as useRef6, useEffect as useEffect13, useState as useState16 } from "react";
193
+ import React15, { useRef as useRef7, useEffect as useEffect13, useState as useState16 } from "react";
194
194
  import {
195
195
  normalizeProcessVersion,
196
196
  LATEST_PROCESS_VERSION,
@@ -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")
@@ -1453,7 +1451,7 @@ import { useEffect as useEffect6, useRef as useRef5, useState as useState7 } fro
1453
1451
  import { useEffect as useEffect5, useRef as useRef4, useState as useState6 } from "react";
1454
1452
  import { LAYER_EFFECT_MENU, effectControlChange, layerEffectControls, layerEffectsPanel } from "@pixerate/editor/image-editor";
1455
1453
  import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
1456
- var LayerEffectsPanel = ({ controller, layerId, className }) => {
1454
+ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) => {
1457
1455
  const [, setTick] = useState6(0);
1458
1456
  useEffect5(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
1459
1457
  const [open, setOpen] = useState6(null);
@@ -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":
@@ -1537,7 +1535,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
1537
1535
  };
1538
1536
  return /* @__PURE__ */ jsxs7("div", { className: `flex flex-col gap-1.5 text-xs text-foreground ${className ?? ""}`, "data-testid": "layer-effects", "aria-label": "Layer effects", role: "group", children: [
1539
1537
  /* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap items-center gap-2", children: [
1540
- /* @__PURE__ */ jsx7("span", { className: "font-semibold text-foreground", children: "fx Effects" }),
1538
+ /* @__PURE__ */ jsx7("span", { className: "font-semibold text-foreground", children: heading ? "fx Effects" : "Styles" }),
1541
1539
  /* @__PURE__ */ jsxs7("label", { className: "flex items-center gap-1 text-foreground", children: [
1542
1540
  /* @__PURE__ */ jsx7(ImageCheckbox, { label: "Effects on", checked: model.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.setLayerEffectsEnabled(id, on)) }),
1543
1541
  "On"
@@ -1563,7 +1561,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
1563
1561
  ),
1564
1562
  "%"
1565
1563
  ] }),
1566
- /* @__PURE__ */ jsx7(
1564
+ heading && /* @__PURE__ */ jsx7(
1567
1565
  ImageSelect,
1568
1566
  {
1569
1567
  label: "Add effect",
@@ -2048,8 +2046,8 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2048
2046
  };
2049
2047
 
2050
2048
  // src/image-editor/ImageProviderEffectsPanel.tsx
2051
- import React7, { useEffect as useEffect7, useState as useState8 } from "react";
2052
- import { EFFECT_LAYER_USES, findLayer } from "@pixerate/editor/image-editor";
2049
+ import { useEffect as useEffect7, useRef as useRef6, useState as useState8 } from "react";
2050
+ import { EFFECT_LAYER_USES, LAYER_EFFECT_MENU as LAYER_EFFECT_MENU2, effectLayerTiming, findLayer, layerEffectsPanel as layerEffectsPanel2 } from "@pixerate/editor/image-editor";
2053
2051
 
2054
2052
  // src/image-editor/controls/parameterControls.tsx
2055
2053
  import { matchParameterOptionValue } from "@pixerate/editor/parameters";
@@ -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
 
@@ -2111,12 +2125,14 @@ function ImageEffectControls({ provider, effect, name, values, onChange, onPrese
2111
2125
 
2112
2126
  // src/image-editor/ImageProviderEffectsPanel.tsx
2113
2127
  import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
2128
+ var fmt = (ms) => `${(ms / 1e3).toFixed(ms < 1e4 ? 2 : 1)} s`;
2114
2129
  function ImageProviderEffectsPanel({ controller, className = "", components }) {
2115
2130
  const [, setTick] = useState8(0);
2116
2131
  useEffect7(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
2117
2132
  const [browse, setBrowse] = useState8(null);
2118
2133
  const [message, setMessage] = useState8(null);
2119
2134
  const [open, setOpen] = useState8(null);
2135
+ const [scrubbed, setScrubbed] = useState8(null);
2120
2136
  const provider = controller.effectsProvider;
2121
2137
  const state = controller.getState();
2122
2138
  const layer = state.activeLayerId ? findLayer(state.layers, state.activeLayerId)?.layer ?? null : null;
@@ -2124,7 +2140,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
2124
2140
  setMessage(null);
2125
2141
  Promise.resolve().then(work).catch((e) => setMessage(e instanceof Error ? e.message : String(e)));
2126
2142
  };
2127
- const drags = React7.useRef(/* @__PURE__ */ new Set());
2143
+ const drags = useRef6(/* @__PURE__ */ new Set());
2128
2144
  const commit = (gesture) => {
2129
2145
  if (gesture) {
2130
2146
  if (!drags.current.has(gesture)) {
@@ -2138,20 +2154,114 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
2138
2154
  const filters = layer?.type === "smart" ? (layer.smartFilters?.filters ?? []).filter((f) => f.kind === "effect") : [];
2139
2155
  const generator = layer?.type === "pixel" ? layer.generator : void 0;
2140
2156
  const canFilter = !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
2141
- return /* @__PURE__ */ jsxs10("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Provider effects", "data-image-provider-effects": "", children: [
2142
- /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
2143
- /* @__PURE__ */ jsx11("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Effects" }),
2144
- /* @__PURE__ */ jsx11("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider || !canFilter, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Apply effect\u2026" }),
2145
- /* @__PURE__ */ jsx11("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => setBrowse(browse === "layer" ? null : "layer"), children: "Effect layer\u2026" })
2146
- ] }),
2157
+ const styles = layerEffectsPanel2(layer);
2158
+ const { description } = useEffectDescription(provider, generator?.effect);
2159
+ const timing = generator ? effectLayerTiming(generator, description) : null;
2160
+ const addOptions = [
2161
+ ...provider && canFilter ? [{ value: "filter", label: "Filter\u2026" }] : [],
2162
+ ...styles.available && !styles.readOnly ? LAYER_EFFECT_MENU2.map((m) => ({ value: `style:${m.kind}`, label: m.label })) : []
2163
+ ];
2164
+ const add = (value) => {
2165
+ if (!value || !layer) return;
2166
+ if (value === "filter") setBrowse(browse === "filter" ? null : "filter");
2167
+ else run(() => controller.addLayerEffect(layer.id, value.slice("style:".length)));
2168
+ };
2169
+ const scrub = useRef6({ next: null, busy: false, gesture: null });
2170
+ const scrubTo = (layerId, time) => {
2171
+ const s = scrub.current;
2172
+ setScrubbed(time);
2173
+ s.next = { layerId, time, commit: commit(s.gesture) };
2174
+ if (s.busy) return;
2175
+ s.busy = true;
2176
+ const step = () => {
2177
+ const n = s.next;
2178
+ s.next = null;
2179
+ if (!n) return Promise.resolve();
2180
+ return controller.updateEffectLayer(n.layerId, { time: n.time }, n.commit).then(step);
2181
+ };
2182
+ step().catch((e) => setMessage(e instanceof Error ? e.message : String(e))).finally(() => {
2183
+ s.busy = false;
2184
+ setScrubbed(null);
2185
+ });
2186
+ };
2187
+ const shown = scrubbed ?? timing?.time ?? 0;
2188
+ return /* @__PURE__ */ jsxs10("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Effects", "data-image-provider-effects": "", children: [
2147
2189
  !provider && /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the document are kept." }),
2148
- browse === "filter" && layer && /* @__PURE__ */ jsx11(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id))) }),
2149
- browse === "layer" && /* @__PURE__ */ jsx11(EffectsBrowser, { provider, uses: EFFECT_LAYER_USES, title: "Generators and overlays", onPick: (e) => (setBrowse(null), run(() => controller.addEffectLayer(e.id))) }),
2150
- generator && layer && /* @__PURE__ */ jsxs10("div", { className: "space-y-1", "data-effect-part": "generator", children: [
2190
+ generator && layer && /* @__PURE__ */ jsxs10("div", { className: "space-y-2", "data-effect-part": "generator", children: [
2151
2191
  /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
2152
- /* @__PURE__ */ jsx11("span", { className: "flex-1 font-medium text-foreground", children: generator.name ?? generator.effect }),
2192
+ /* @__PURE__ */ jsx11("span", { className: "min-w-0 flex-1 truncate font-medium text-foreground", title: generator.name ?? generator.effect, children: generator.name ?? generator.effect }),
2193
+ /* @__PURE__ */ jsx11("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider, "aria-pressed": browse === "change", onClick: () => setBrowse(browse === "change" ? null : "change"), children: "Change\u2026" }),
2153
2194
  /* @__PURE__ */ jsx11("button", { type: "button", className: imageOutlineButtonClass, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
2154
2195
  ] }),
2196
+ browse === "change" && /* @__PURE__ */ jsx11(EffectsBrowser, { provider, uses: EFFECT_LAYER_USES, title: "Change the effect to", onPick: (e) => (setBrowse(null), run(() => controller.updateEffectLayer(layer.id, { effect: e.id }))) }),
2197
+ timing && /* @__PURE__ */ jsxs10("div", { className: "space-y-1.5 rounded border border-border p-1.5", "data-effect-part": "timing", role: "group", "aria-label": "Frames", children: [
2198
+ /* @__PURE__ */ jsxs10("div", { className: "flex gap-1", role: "radiogroup", "aria-label": "Output", children: [
2199
+ /* @__PURE__ */ jsx11(
2200
+ "button",
2201
+ {
2202
+ type: "button",
2203
+ role: "radio",
2204
+ "aria-checked": timing.mode === "still",
2205
+ className: `${imageOutlineButtonClass} flex-1 ${timing.mode === "still" ? "bg-accent text-accent-foreground" : ""}`,
2206
+ onClick: () => run(() => controller.updateEffectLayer(layer.id, { animate: null })),
2207
+ children: "Still frame"
2208
+ }
2209
+ ),
2210
+ /* @__PURE__ */ jsx11(
2211
+ "button",
2212
+ {
2213
+ type: "button",
2214
+ role: "radio",
2215
+ "aria-checked": timing.mode === "animate",
2216
+ className: `${imageOutlineButtonClass} flex-1 ${timing.mode === "animate" ? "bg-accent text-accent-foreground" : ""}`,
2217
+ onClick: () => run(() => controller.updateEffectLayer(layer.id, { animate: { duration: timing.duration } })),
2218
+ children: "Animate"
2219
+ }
2220
+ )
2221
+ ] }),
2222
+ /* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-1.5", children: [
2223
+ /* @__PURE__ */ jsx11("span", { className: "w-16 shrink-0 text-[11px] text-foreground", children: timing.mode === "still" ? "Frame" : "Starts at" }),
2224
+ /* @__PURE__ */ jsx11(
2225
+ ImageRange,
2226
+ {
2227
+ min: 0,
2228
+ max: timing.range,
2229
+ step: Math.max(1, Math.round(timing.range / 200)),
2230
+ className: "flex-1",
2231
+ value: shown,
2232
+ label: timing.mode === "still" ? "Frame" : "Starts at",
2233
+ onStart: () => scrub.current.gesture = `time:${Date.now()}`,
2234
+ onEnd: () => scrub.current.gesture = null,
2235
+ onChange: (t) => scrubTo(layer.id, t)
2236
+ }
2237
+ ),
2238
+ /* @__PURE__ */ jsx11("span", { className: "w-12 shrink-0 text-right tabular-nums text-muted-foreground", children: fmt(shown) })
2239
+ ] }),
2240
+ timing.mode === "animate" && /* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-1.5", children: [
2241
+ /* @__PURE__ */ jsx11("span", { className: "w-16 shrink-0 text-[11px] text-foreground", children: "Length" }),
2242
+ /* @__PURE__ */ jsx11(
2243
+ "input",
2244
+ {
2245
+ type: "number",
2246
+ "aria-label": "Animation length in seconds",
2247
+ min: 0.1,
2248
+ max: 60,
2249
+ step: 0.1,
2250
+ defaultValue: Math.round(timing.duration / 100) / 10,
2251
+ className: "w-16 rounded border border-border bg-muted px-1 text-foreground",
2252
+ onBlur: (e) => {
2253
+ const s = Number(e.currentTarget.value);
2254
+ if (s > 0 && s * 1e3 !== timing.duration) run(() => controller.updateEffectLayer(layer.id, { animate: { duration: Math.min(60, s) * 1e3 } }));
2255
+ }
2256
+ },
2257
+ timing.duration
2258
+ ),
2259
+ /* @__PURE__ */ jsxs10("span", { className: "text-muted-foreground", children: [
2260
+ "s",
2261
+ timing.loops ? ` \xB7 loops every ${fmt(timing.range)}` : ""
2262
+ ] })
2263
+ ] })
2264
+ ] }),
2155
2265
  /* @__PURE__ */ jsx11(
2156
2266
  ImageEffectControls,
2157
2267
  {
@@ -2165,7 +2275,12 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
2165
2275
  }
2166
2276
  )
2167
2277
  ] }),
2168
- filters.length > 0 && layer && /* @__PURE__ */ jsx11("ol", { className: "space-y-1", "data-effect-part": "filters", children: filters.map((f) => {
2278
+ layer && canFilter && /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", "data-effect-part": "applied", children: [
2279
+ /* @__PURE__ */ jsx11("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: generator ? "On this layer" : "Effects" }),
2280
+ addOptions.length > 0 && /* @__PURE__ */ jsx11(ImageSelect, { label: "Add effect", value: "", placeholder: "Add\u2026", options: addOptions, onChange: add })
2281
+ ] }),
2282
+ browse === "filter" && layer && /* @__PURE__ */ jsx11(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id))) }),
2283
+ filters.length > 0 && layer && /* @__PURE__ */ jsx11("ol", { className: "space-y-1", "data-effect-part": "filters", "aria-label": "Filters", children: filters.map((f) => {
2169
2284
  const label = f.kind === "effect" ? f.name ?? f.effect : f.kind;
2170
2285
  const all = layer.smartFilters.filters;
2171
2286
  const index = all.indexOf(f);
@@ -2216,6 +2331,8 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
2216
2331
  ] })
2217
2332
  ] }, f.id);
2218
2333
  }) }),
2334
+ layer && styles.available && styles.rows.length > 0 && /* @__PURE__ */ jsx11(LayerEffectsPanel, { controller, layerId: layer.id, heading: false }),
2335
+ layer && canFilter && !generator && filters.length === 0 && styles.rows.length === 0 && /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-muted-foreground", children: "No effects yet. Add a filter, or a style such as a drop shadow. New effect layers are added from the layers panel." }),
2219
2336
  !layer && /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
2220
2337
  message && /* @__PURE__ */ jsx11("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
2221
2338
  ] });
@@ -2278,29 +2395,11 @@ var BrushOptionsBar = ({ controller, className }) => {
2278
2395
  )) }),
2279
2396
  /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", role: "group", "aria-label": "Colours", children: [
2280
2397
  /* @__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
- ),
2398
+ /* @__PURE__ */ jsx13(ImageColor, { label: "Foreground colour", value: foreground, onChange: (fg) => controller.setPaintOptions({ foreground: fg }) }),
2291
2399
  /* @__PURE__ */ jsx13("span", { className: "text-muted-foreground", children: "FG" })
2292
2400
  ] }),
2293
2401
  /* @__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
- ),
2402
+ /* @__PURE__ */ jsx13(ImageColor, { label: "Background colour", value: background, onChange: (bg) => controller.setPaintOptions({ background: bg }) }),
2304
2403
  /* @__PURE__ */ jsx13("span", { className: "text-muted-foreground", children: "BG" })
2305
2404
  ] }),
2306
2405
  /* @__PURE__ */ jsx13("button", { type: "button", title: "Swap colours (X)", className: imageChipClass(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
@@ -2920,32 +3019,12 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
2920
3019
  /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
2921
3020
  /* @__PURE__ */ jsx18(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
2922
3021
  "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
- )
3022
+ /* @__PURE__ */ jsx18(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
2934
3023
  ] }),
2935
3024
  /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
2936
3025
  /* @__PURE__ */ jsx18(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
2937
3026
  "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
- )
3027
+ /* @__PURE__ */ jsx18(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
2949
3028
  ] }),
2950
3029
  /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
2951
3030
  "Width",
@@ -3072,7 +3151,7 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
3072
3151
  ] }),
3073
3152
  /* @__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
3153
  /* @__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 })
3154
+ /* @__PURE__ */ jsx19(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
3076
3155
  ] }),
3077
3156
  /* @__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
3157
  /* @__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." }),
@@ -3113,9 +3192,9 @@ var ImageEditor = ({
3113
3192
  });
3114
3193
  const legacyProcess = normalizeProcessVersion(state.adjustments.process) < LATEST_PROCESS_VERSION;
3115
3194
  const [activeTab, setActiveTab] = useState16("crop");
3116
- const rootRef = useRef6(null);
3195
+ const rootRef = useRef7(null);
3117
3196
  const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
3118
- const activeTabRef = useRef6(activeTab);
3197
+ const activeTabRef = useRef7(activeTab);
3119
3198
  activeTabRef.current = activeTab;
3120
3199
  const openPanel = async (ref) => {
3121
3200
  if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
@@ -3136,8 +3215,8 @@ var ImageEditor = ({
3136
3215
  else setShapeTypeError(message);
3137
3216
  };
3138
3217
  const finishTyping = () => setTypeSession(null);
3139
- const transformToolRef = useRef6(null);
3140
- const transformControllerRef = useRef6(controller);
3218
+ const transformToolRef = useRef7(null);
3219
+ const transformControllerRef = useRef7(controller);
3141
3220
  if (!transformToolRef.current || transformControllerRef.current !== controller) {
3142
3221
  transformToolRef.current?.cancel();
3143
3222
  transformToolRef.current = new FreeTransformTool2(controller, {
@@ -3727,15 +3806,7 @@ var ImageEditor = ({
3727
3806
  )) }),
3728
3807
  /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2 mt-2", children: [
3729
3808
  /* @__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
- ),
3809
+ /* @__PURE__ */ jsx20(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
3739
3810
  /* @__PURE__ */ jsxs18("div", { className: "flex-1 ml-2", children: [
3740
3811
  /* @__PURE__ */ jsxs18("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
3741
3812
  /* @__PURE__ */ jsx20("span", { children: "Width:" }),
@@ -4129,6 +4200,7 @@ export {
4129
4200
  ImageCheckbox,
4130
4201
  ImageRange,
4131
4202
  ImageSelect,
4203
+ ImageColor,
4132
4204
  ControlSlider,
4133
4205
  Histogram,
4134
4206
  useImageHistogram,