@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
@@ -39,6 +39,7 @@ __export(image_editor_exports, {
39
39
  FreeTransformOptionsBar: () => FreeTransformOptionsBar,
40
40
  Histogram: () => Histogram,
41
41
  ImageCheckbox: () => ImageCheckbox,
42
+ ImageColor: () => ImageColor,
42
43
  ImageEditor: () => ImageEditor,
43
44
  ImageEditorCanvas: () => ImageEditorCanvas,
44
45
  ImageEditorControlsProvider: () => ImageEditorControlsProvider,
@@ -1140,6 +1141,22 @@ function ImageSelect(props) {
1140
1141
  options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: o.value, children: o.label }, o.value))
1141
1142
  ] });
1142
1143
  }
1144
+ function ImageColor(props) {
1145
+ const Host = useImageEditorControls().Color;
1146
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Host, { ...props });
1147
+ const { value, label, alpha, disabled, onChange, className = "" } = props;
1148
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1149
+ "input",
1150
+ {
1151
+ type: "color",
1152
+ "aria-label": label,
1153
+ value: value.slice(0, 7),
1154
+ disabled,
1155
+ onChange: (e) => onChange(e.target.value + (alpha ? value.slice(7, 9) : "")),
1156
+ className: `${imageColorInputClass} ${className}`
1157
+ }
1158
+ );
1159
+ }
1143
1160
 
1144
1161
  // src/image-editor/ControlSlider.tsx
1145
1162
  var import_jsx_runtime5 = require("react/jsx-runtime");
@@ -1380,32 +1397,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
1380
1397
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
1381
1398
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ImageCheckbox, { label: "Tint", checked: layer.params.tint !== null, onChange: (on) => setParam(layer, "tint", on ? "#e1d3b3" : null) }),
1382
1399
  "Tint",
1383
- layer.params.tint && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1384
- "input",
1385
- {
1386
- type: "color",
1387
- "aria-label": "Tint colour",
1388
- value: layer.params.tint,
1389
- onChange: (e) => setParam(layer, "tint", e.target.value),
1390
- className: "h-5 w-8 bg-transparent"
1391
- }
1392
- )
1400
+ layer.params.tint && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ImageColor, { label: "Tint colour", value: layer.params.tint, onChange: (v) => setParam(layer, "tint", v) })
1393
1401
  ] })
1394
1402
  ] });
1395
1403
  case "photoFilter":
1396
1404
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col gap-2", children: [
1397
1405
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
1398
1406
  "Filter colour",
1399
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1400
- "input",
1401
- {
1402
- type: "color",
1403
- "aria-label": "Filter colour",
1404
- value: layer.params.color,
1405
- onChange: (e) => setParam(layer, "color", e.target.value),
1406
- className: "h-5 w-8 bg-transparent"
1407
- }
1408
- )
1407
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ImageColor, { label: "Filter colour", value: layer.params.color, onChange: (v) => setParam(layer, "color", v) })
1409
1408
  ] }),
1410
1409
  controlsOf(layer).map((s) => slider(layer, s)),
1411
1410
  checkbox(layer, "preserveLuminosity", "Preserve luminosity")
@@ -1537,7 +1536,7 @@ var import_react11 = require("react");
1537
1536
  var import_react10 = require("react");
1538
1537
  var import_image_editor7 = require("@pixerate/editor/image-editor");
1539
1538
  var import_jsx_runtime9 = require("react/jsx-runtime");
1540
- var LayerEffectsPanel = ({ controller, layerId, className }) => {
1539
+ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) => {
1541
1540
  const [, setTick] = (0, import_react10.useState)(0);
1542
1541
  (0, import_react10.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
1543
1542
  const [open, setOpen] = (0, import_react10.useState)(null);
@@ -1595,7 +1594,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
1595
1594
  }
1596
1595
  case "color":
1597
1596
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1598
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", { type: "color", "aria-label": label, value: c.value, disabled: model.readOnly, onChange: (e) => change(effectId, c, e.target.value) }),
1597
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ImageColor, { label, value: c.value, disabled: model.readOnly, onChange: (v) => change(effectId, c, v) }),
1599
1598
  label
1600
1599
  ] }, c.key);
1601
1600
  case "checkbox":
@@ -1621,7 +1620,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
1621
1620
  };
1622
1621
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-foreground ${className ?? ""}`, "data-testid": "layer-effects", "aria-label": "Layer effects", role: "group", children: [
1623
1622
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
1624
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "font-semibold text-foreground", children: "fx Effects" }),
1623
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "font-semibold text-foreground", children: heading ? "fx Effects" : "Styles" }),
1625
1624
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
1626
1625
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ImageCheckbox, { label: "Effects on", checked: model.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.setLayerEffectsEnabled(id, on)) }),
1627
1626
  "On"
@@ -1647,7 +1646,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
1647
1646
  ),
1648
1647
  "%"
1649
1648
  ] }),
1650
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1649
+ heading && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1651
1650
  ImageSelect,
1652
1651
  {
1653
1652
  label: "Add effect",
@@ -2117,7 +2116,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
2117
2116
  };
2118
2117
 
2119
2118
  // src/image-editor/ImageProviderEffectsPanel.tsx
2120
- var import_react21 = __toESM(require("react"), 1);
2119
+ var import_react21 = require("react");
2121
2120
  var import_image_editor9 = require("@pixerate/editor/image-editor");
2122
2121
 
2123
2122
  // src/effects/useEffects.ts
@@ -3315,7 +3314,8 @@ function resolveParameterComponents(explicit, context) {
3315
3314
  return {
3316
3315
  input: explicit?.input ?? context?.input,
3317
3316
  slider: explicit?.slider ?? context?.slider,
3318
- select: explicit?.select ?? context?.select
3317
+ select: explicit?.select ?? context?.select,
3318
+ color: explicit?.color ?? context?.color
3319
3319
  };
3320
3320
  }
3321
3321
 
@@ -3549,7 +3549,8 @@ function ParameterSelect(props) {
3549
3549
  }
3550
3550
  );
3551
3551
  }
3552
- function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id }) {
3552
+ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id, components }) {
3553
+ const CustomColor = resolveParameterComponents(components, useParameterComponents()).color;
3553
3554
  const [open, setOpen] = (0, import_react19.useState)(false);
3554
3555
  const containerRef = (0, import_react19.useRef)(null);
3555
3556
  const buttonRef = (0, import_react19.useRef)(null);
@@ -3581,6 +3582,22 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3581
3582
  window.removeEventListener("keydown", onKeyDown, true);
3582
3583
  };
3583
3584
  }, [open]);
3585
+ if (CustomColor) {
3586
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3587
+ CustomColor,
3588
+ {
3589
+ id,
3590
+ value: shown,
3591
+ alpha,
3592
+ swatches: field.swatches,
3593
+ disabled: off,
3594
+ label: name,
3595
+ onChange,
3596
+ onGestureStart,
3597
+ onGestureEnd
3598
+ }
3599
+ );
3600
+ }
3584
3601
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
3585
3602
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
3586
3603
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
@@ -3901,10 +3918,26 @@ function ImageParameterSelect({ value, options, label, disabled, className, onCh
3901
3918
  }
3902
3919
  );
3903
3920
  }
3921
+ function ImageParameterColor({ value, alpha, label, disabled, className, onChange, onGestureStart, onGestureEnd }) {
3922
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3923
+ ImageColor,
3924
+ {
3925
+ value,
3926
+ alpha,
3927
+ label,
3928
+ disabled,
3929
+ className,
3930
+ onChange,
3931
+ onStart: onGestureStart,
3932
+ onEnd: onGestureEnd
3933
+ }
3934
+ );
3935
+ }
3904
3936
  function imageEditorParameterComponents(controls) {
3905
3937
  return {
3906
3938
  slider: controls.Range ? ImageParameterSlider : void 0,
3907
- select: controls.Select ? ImageParameterSelect : void 0
3939
+ select: controls.Select ? ImageParameterSelect : void 0,
3940
+ color: controls.Color ? ImageParameterColor : void 0
3908
3941
  };
3909
3942
  }
3910
3943
 
@@ -3928,12 +3961,14 @@ function ImageEffectControls({ provider, effect, name, values, onChange, onPrese
3928
3961
 
3929
3962
  // src/image-editor/ImageProviderEffectsPanel.tsx
3930
3963
  var import_jsx_runtime20 = require("react/jsx-runtime");
3964
+ var fmt = (ms) => `${(ms / 1e3).toFixed(ms < 1e4 ? 2 : 1)} s`;
3931
3965
  function ImageProviderEffectsPanel({ controller, className = "", components }) {
3932
3966
  const [, setTick] = (0, import_react21.useState)(0);
3933
3967
  (0, import_react21.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
3934
3968
  const [browse, setBrowse] = (0, import_react21.useState)(null);
3935
3969
  const [message, setMessage] = (0, import_react21.useState)(null);
3936
3970
  const [open, setOpen] = (0, import_react21.useState)(null);
3971
+ const [scrubbed, setScrubbed] = (0, import_react21.useState)(null);
3937
3972
  const provider = controller.effectsProvider;
3938
3973
  const state = controller.getState();
3939
3974
  const layer = state.activeLayerId ? (0, import_image_editor9.findLayer)(state.layers, state.activeLayerId)?.layer ?? null : null;
@@ -3941,7 +3976,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
3941
3976
  setMessage(null);
3942
3977
  Promise.resolve().then(work).catch((e) => setMessage(e instanceof Error ? e.message : String(e)));
3943
3978
  };
3944
- const drags = import_react21.default.useRef(/* @__PURE__ */ new Set());
3979
+ const drags = (0, import_react21.useRef)(/* @__PURE__ */ new Set());
3945
3980
  const commit = (gesture) => {
3946
3981
  if (gesture) {
3947
3982
  if (!drags.current.has(gesture)) {
@@ -3955,20 +3990,114 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
3955
3990
  const filters = layer?.type === "smart" ? (layer.smartFilters?.filters ?? []).filter((f) => f.kind === "effect") : [];
3956
3991
  const generator = layer?.type === "pixel" ? layer.generator : void 0;
3957
3992
  const canFilter = !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
3958
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Provider effects", "data-image-provider-effects": "", children: [
3959
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1", children: [
3960
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Effects" }),
3961
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider || !canFilter, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Apply effect\u2026" }),
3962
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => setBrowse(browse === "layer" ? null : "layer"), children: "Effect layer\u2026" })
3963
- ] }),
3993
+ const styles = (0, import_image_editor9.layerEffectsPanel)(layer);
3994
+ const { description } = useEffectDescription(provider, generator?.effect);
3995
+ const timing = generator ? (0, import_image_editor9.effectLayerTiming)(generator, description) : null;
3996
+ const addOptions = [
3997
+ ...provider && canFilter ? [{ value: "filter", label: "Filter\u2026" }] : [],
3998
+ ...styles.available && !styles.readOnly ? import_image_editor9.LAYER_EFFECT_MENU.map((m) => ({ value: `style:${m.kind}`, label: m.label })) : []
3999
+ ];
4000
+ const add = (value) => {
4001
+ if (!value || !layer) return;
4002
+ if (value === "filter") setBrowse(browse === "filter" ? null : "filter");
4003
+ else run(() => controller.addLayerEffect(layer.id, value.slice("style:".length)));
4004
+ };
4005
+ const scrub = (0, import_react21.useRef)({ next: null, busy: false, gesture: null });
4006
+ const scrubTo = (layerId, time) => {
4007
+ const s = scrub.current;
4008
+ setScrubbed(time);
4009
+ s.next = { layerId, time, commit: commit(s.gesture) };
4010
+ if (s.busy) return;
4011
+ s.busy = true;
4012
+ const step = () => {
4013
+ const n = s.next;
4014
+ s.next = null;
4015
+ if (!n) return Promise.resolve();
4016
+ return controller.updateEffectLayer(n.layerId, { time: n.time }, n.commit).then(step);
4017
+ };
4018
+ step().catch((e) => setMessage(e instanceof Error ? e.message : String(e))).finally(() => {
4019
+ s.busy = false;
4020
+ setScrubbed(null);
4021
+ });
4022
+ };
4023
+ const shown = scrubbed ?? timing?.time ?? 0;
4024
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Effects", "data-image-provider-effects": "", children: [
3964
4025
  !provider && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the document are kept." }),
3965
- browse === "filter" && layer && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id))) }),
3966
- browse === "layer" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EffectsBrowser, { provider, uses: import_image_editor9.EFFECT_LAYER_USES, title: "Generators and overlays", onPick: (e) => (setBrowse(null), run(() => controller.addEffectLayer(e.id))) }),
3967
- generator && layer && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1", "data-effect-part": "generator", children: [
4026
+ generator && layer && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-2", "data-effect-part": "generator", children: [
3968
4027
  /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1", children: [
3969
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "flex-1 font-medium text-foreground", children: generator.name ?? generator.effect }),
4028
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "min-w-0 flex-1 truncate font-medium text-foreground", title: generator.name ?? generator.effect, children: generator.name ?? generator.effect }),
4029
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider, "aria-pressed": browse === "change", onClick: () => setBrowse(browse === "change" ? null : "change"), children: "Change\u2026" }),
3970
4030
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: imageOutlineButtonClass, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
3971
4031
  ] }),
4032
+ browse === "change" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EffectsBrowser, { provider, uses: import_image_editor9.EFFECT_LAYER_USES, title: "Change the effect to", onPick: (e) => (setBrowse(null), run(() => controller.updateEffectLayer(layer.id, { effect: e.id }))) }),
4033
+ timing && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1.5 rounded border border-border p-1.5", "data-effect-part": "timing", role: "group", "aria-label": "Frames", children: [
4034
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex gap-1", role: "radiogroup", "aria-label": "Output", children: [
4035
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4036
+ "button",
4037
+ {
4038
+ type: "button",
4039
+ role: "radio",
4040
+ "aria-checked": timing.mode === "still",
4041
+ className: `${imageOutlineButtonClass} flex-1 ${timing.mode === "still" ? "bg-accent text-accent-foreground" : ""}`,
4042
+ onClick: () => run(() => controller.updateEffectLayer(layer.id, { animate: null })),
4043
+ children: "Still frame"
4044
+ }
4045
+ ),
4046
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4047
+ "button",
4048
+ {
4049
+ type: "button",
4050
+ role: "radio",
4051
+ "aria-checked": timing.mode === "animate",
4052
+ className: `${imageOutlineButtonClass} flex-1 ${timing.mode === "animate" ? "bg-accent text-accent-foreground" : ""}`,
4053
+ onClick: () => run(() => controller.updateEffectLayer(layer.id, { animate: { duration: timing.duration } })),
4054
+ children: "Animate"
4055
+ }
4056
+ )
4057
+ ] }),
4058
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1.5", children: [
4059
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "w-16 shrink-0 text-[11px] text-foreground", children: timing.mode === "still" ? "Frame" : "Starts at" }),
4060
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4061
+ ImageRange,
4062
+ {
4063
+ min: 0,
4064
+ max: timing.range,
4065
+ step: Math.max(1, Math.round(timing.range / 200)),
4066
+ className: "flex-1",
4067
+ value: shown,
4068
+ label: timing.mode === "still" ? "Frame" : "Starts at",
4069
+ onStart: () => scrub.current.gesture = `time:${Date.now()}`,
4070
+ onEnd: () => scrub.current.gesture = null,
4071
+ onChange: (t) => scrubTo(layer.id, t)
4072
+ }
4073
+ ),
4074
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "w-12 shrink-0 text-right tabular-nums text-muted-foreground", children: fmt(shown) })
4075
+ ] }),
4076
+ timing.mode === "animate" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1.5", children: [
4077
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "w-16 shrink-0 text-[11px] text-foreground", children: "Length" }),
4078
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4079
+ "input",
4080
+ {
4081
+ type: "number",
4082
+ "aria-label": "Animation length in seconds",
4083
+ min: 0.1,
4084
+ max: 60,
4085
+ step: 0.1,
4086
+ defaultValue: Math.round(timing.duration / 100) / 10,
4087
+ className: "w-16 rounded border border-border bg-muted px-1 text-foreground",
4088
+ onBlur: (e) => {
4089
+ const s = Number(e.currentTarget.value);
4090
+ if (s > 0 && s * 1e3 !== timing.duration) run(() => controller.updateEffectLayer(layer.id, { animate: { duration: Math.min(60, s) * 1e3 } }));
4091
+ }
4092
+ },
4093
+ timing.duration
4094
+ ),
4095
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "text-muted-foreground", children: [
4096
+ "s",
4097
+ timing.loops ? ` \xB7 loops every ${fmt(timing.range)}` : ""
4098
+ ] })
4099
+ ] })
4100
+ ] }),
3972
4101
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3973
4102
  ImageEffectControls,
3974
4103
  {
@@ -3982,7 +4111,12 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
3982
4111
  }
3983
4112
  )
3984
4113
  ] }),
3985
- filters.length > 0 && layer && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("ol", { className: "space-y-1", "data-effect-part": "filters", children: filters.map((f) => {
4114
+ layer && canFilter && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1", "data-effect-part": "applied", children: [
4115
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: generator ? "On this layer" : "Effects" }),
4116
+ addOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ImageSelect, { label: "Add effect", value: "", placeholder: "Add\u2026", options: addOptions, onChange: add })
4117
+ ] }),
4118
+ browse === "filter" && layer && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id))) }),
4119
+ filters.length > 0 && layer && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("ol", { className: "space-y-1", "data-effect-part": "filters", "aria-label": "Filters", children: filters.map((f) => {
3986
4120
  const label = f.kind === "effect" ? f.name ?? f.effect : f.kind;
3987
4121
  const all = layer.smartFilters.filters;
3988
4122
  const index = all.indexOf(f);
@@ -4033,6 +4167,8 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
4033
4167
  ] })
4034
4168
  ] }, f.id);
4035
4169
  }) }),
4170
+ layer && styles.available && styles.rows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(LayerEffectsPanel, { controller, layerId: layer.id, heading: false }),
4171
+ layer && canFilter && !generator && filters.length === 0 && styles.rows.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("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." }),
4036
4172
  !layer && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
4037
4173
  message && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
4038
4174
  ] });
@@ -4204,29 +4340,11 @@ var BrushOptionsBar = ({ controller, className }) => {
4204
4340
  )) }),
4205
4341
  /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2", role: "group", "aria-label": "Colours", children: [
4206
4342
  /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1", children: [
4207
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4208
- "input",
4209
- {
4210
- type: "color",
4211
- "aria-label": "Foreground colour",
4212
- value: foreground,
4213
- onChange: (e) => controller.setPaintOptions({ foreground: e.target.value }),
4214
- className: imageColorInputClass
4215
- }
4216
- ),
4343
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageColor, { label: "Foreground colour", value: foreground, onChange: (fg) => controller.setPaintOptions({ foreground: fg }) }),
4217
4344
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-muted-foreground", children: "FG" })
4218
4345
  ] }),
4219
4346
  /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1", children: [
4220
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4221
- "input",
4222
- {
4223
- type: "color",
4224
- "aria-label": "Background colour",
4225
- value: background,
4226
- onChange: (e) => controller.setPaintOptions({ background: e.target.value }),
4227
- className: imageColorInputClass
4228
- }
4229
- ),
4347
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageColor, { label: "Background colour", value: background, onChange: (bg) => controller.setPaintOptions({ background: bg }) }),
4230
4348
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-muted-foreground", children: "BG" })
4231
4349
  ] }),
4232
4350
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", title: "Swap colours (X)", className: imageChipClass(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
@@ -4836,32 +4954,12 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4836
4954
  /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
4837
4955
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
4838
4956
  "Fill",
4839
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4840
- "input",
4841
- {
4842
- type: "color",
4843
- "aria-label": "Fill colour",
4844
- disabled: options.fill === null,
4845
- value: options.fill ?? "#4f46e5",
4846
- onChange: (e) => set({ fill: e.target.value }),
4847
- className: imageColorInputClass
4848
- }
4849
- )
4957
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
4850
4958
  ] }),
4851
4959
  /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
4852
4960
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
4853
4961
  "Stroke",
4854
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4855
- "input",
4856
- {
4857
- type: "color",
4858
- "aria-label": "Stroke colour",
4859
- disabled: options.stroke === null,
4860
- value: options.stroke ?? "#000000",
4861
- onChange: (e) => set({ stroke: e.target.value }),
4862
- className: imageColorInputClass
4863
- }
4864
- )
4962
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
4865
4963
  ] }),
4866
4964
  /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
4867
4965
  "Width",
@@ -4988,7 +5086,7 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
4988
5086
  ] }),
4989
5087
  /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("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" }),
4990
5088
  /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
4991
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("input", { type: "color", "aria-label": "Text colour", value: shown.color, onChange: (e) => style({ color: e.target.value }), className: imageColorInputClass })
5089
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
4992
5090
  ] }),
4993
5091
  /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor18.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
4994
5092
  /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("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." }),
@@ -5643,15 +5741,7 @@ var ImageEditor = ({
5643
5741
  )) }),
5644
5742
  /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
5645
5743
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
5646
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5647
- "input",
5648
- {
5649
- type: "color",
5650
- value: activeColor,
5651
- onChange: (e) => setActiveColor(e.target.value),
5652
- className: "w-8 h-8 rounded border border-border cursor-pointer bg-transparent"
5653
- }
5654
- ),
5744
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
5655
5745
  /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex-1 ml-2", children: [
5656
5746
  /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
5657
5747
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Width:" }),
@@ -6045,6 +6135,7 @@ var ImageEditor = ({
6045
6135
  FreeTransformOptionsBar,
6046
6136
  Histogram,
6047
6137
  ImageCheckbox,
6138
+ ImageColor,
6048
6139
  ImageEditor,
6049
6140
  ImageEditorCanvas,
6050
6141
  ImageEditorControlsProvider,
@@ -17,4 +17,4 @@ export * from './TypeOptionsBar.cjs';
17
17
  export * from './ImageProviderEffectsPanel.cjs';
18
18
  export * from './ImageEffectControls.cjs';
19
19
  export * from './PaintGradientEditor.cjs';
20
- export { ImageEditorControlsProvider, useImageEditorControls, ImageCheckbox, ImageRange, ImageSelect, type ImageEditorControls, type ImageCheckboxProps, type ImageRangeProps, type ImageSelectProps, type ImageSelectOption, } from './controls/controls.cjs';
20
+ export { ImageEditorControlsProvider, useImageEditorControls, ImageCheckbox, ImageRange, ImageSelect, ImageColor, type ImageEditorControls, type ImageCheckboxProps, type ImageRangeProps, type ImageSelectProps, type ImageSelectOption, type ImageColorProps, } from './controls/controls.cjs';
@@ -17,4 +17,4 @@ export * from './TypeOptionsBar.js';
17
17
  export * from './ImageProviderEffectsPanel.js';
18
18
  export * from './ImageEffectControls.js';
19
19
  export * from './PaintGradientEditor.js';
20
- export { ImageEditorControlsProvider, useImageEditorControls, ImageCheckbox, ImageRange, ImageSelect, type ImageEditorControls, type ImageCheckboxProps, type ImageRangeProps, type ImageSelectProps, type ImageSelectOption, } from './controls/controls.js';
20
+ export { ImageEditorControlsProvider, useImageEditorControls, ImageCheckbox, ImageRange, ImageSelect, ImageColor, type ImageEditorControls, type ImageCheckboxProps, type ImageRangeProps, type ImageSelectProps, type ImageSelectOption, type ImageColorProps, } from './controls/controls.js';
@@ -7,6 +7,7 @@ import {
7
7
  FreeTransformOptionsBar,
8
8
  Histogram,
9
9
  ImageCheckbox,
10
+ ImageColor,
10
11
  ImageEditor,
11
12
  ImageEditorCanvas,
12
13
  ImageEditorControlsProvider,
@@ -25,10 +26,10 @@ import {
25
26
  useImageEditorControls,
26
27
  useImageEffectsTools,
27
28
  useImageHistogram
28
- } from "../chunk-SH63DFOO.js";
29
+ } from "../chunk-ZQ54FEXL.js";
29
30
  import "../chunk-AJCWF6SN.js";
30
- import "../chunk-TOGMXZM4.js";
31
- import "../chunk-354TA5QV.js";
31
+ import "../chunk-6BWTJ3EE.js";
32
+ import "../chunk-5RPB4WGT.js";
32
33
  import "../chunk-KIRIU53A.js";
33
34
  import "../chunk-3I7FOSLF.js";
34
35
  import "../chunk-GNO54NFG.js";
@@ -41,6 +42,7 @@ export {
41
42
  FreeTransformOptionsBar,
42
43
  Histogram,
43
44
  ImageCheckbox,
45
+ ImageColor,
44
46
  ImageEditor,
45
47
  ImageEditorCanvas,
46
48
  ImageEditorControlsProvider,