@pixerate/editor-react 0.171.0 → 0.172.1

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.
@@ -31,6 +31,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  // src/paint-editor/index.ts
32
32
  var paint_editor_exports = {};
33
33
  __export(paint_editor_exports, {
34
+ BrushEditor: () => BrushEditor,
35
+ BrushLibraryBrowser: () => BrushLibraryBrowser,
34
36
  BrushPanel: () => BrushPanel,
35
37
  ColorPanel: () => ColorPanel,
36
38
  PaintCanvas: () => PaintCanvas,
@@ -599,16 +601,142 @@ var PaintToolbar = ({ controller, tool, onToolChange, fileName = "painting", cla
599
601
  };
600
602
 
601
603
  // src/paint-editor/BrushPanel.tsx
602
- var import_react8 = require("react");
604
+ var import_react10 = require("react");
603
605
  var import_paint_editor5 = require("@pixerate/editor/paint-editor");
604
- var import_paint_editor6 = require("@pixerate/editor/paint-editor");
606
+ var import_brushes3 = require("@pixerate/editor/brushes");
607
+
608
+ // src/paint-editor/BrushEditor.tsx
609
+ var import_react5 = require("react");
610
+ var import_brushes = require("@pixerate/editor/brushes");
611
+ var import_jsx_runtime4 = require("react/jsx-runtime");
612
+ var BrushEditor = ({ brush, profile = import_brushes.PAINT_PROFILE, onChange, preview, onSaveAs, renderExtra, className }) => {
613
+ const sections = (0, import_react5.useMemo)(() => (0, import_brushes.brushEditorSections)(brush, profile), [brush, profile]);
614
+ const [problems, setProblems] = (0, import_react5.useState)(null);
615
+ const [name, setName] = (0, import_react5.useState)("");
616
+ const set = (path, value) => {
617
+ const r = (0, import_brushes.setBrushEditorValue)(brush, path, value);
618
+ setProblems(r.problems.length ? r.problems.join(" ") : null);
619
+ if (r.brush !== brush) onChange(r.brush);
620
+ };
621
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: `flex flex-col gap-2 ${className ?? ""}`, "data-testid": "brush-editor", children: [
622
+ preview !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PixelCanvas, { pixels: preview, label: "Brush preview", className: "rounded", style: { width: "100%", aspectRatio: preview ? `${preview.width} / ${preview.height}` : "4 / 1" } }),
623
+ sections.map((s) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: "flex flex-col gap-1.5", "data-section": s.id, ...s.id === "behaviour" ? { "data-testid": "brush-engine" } : {}, children: [
624
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "font-medium text-slate-300", children: s.title }),
625
+ s.controls.map((c) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(EditorControl, { control: c, onSet: set }, c.path)),
626
+ renderExtra?.(s.id)
627
+ ] }, s.id)),
628
+ onSaveAs && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
629
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { value: name, placeholder: "Brush name", "aria-label": "Brush name", onChange: (e) => setName(e.target.value), className: "w-28 rounded bg-slate-800 px-1.5 py-0.5" }),
630
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
631
+ "button",
632
+ {
633
+ type: "button",
634
+ className: button,
635
+ disabled: !name.trim(),
636
+ onClick: async () => {
637
+ try {
638
+ await onSaveAs(name.trim());
639
+ setName("");
640
+ setProblems(null);
641
+ } catch (e) {
642
+ setProblems(e.message);
643
+ }
644
+ },
645
+ children: "Save brush"
646
+ }
647
+ )
648
+ ] }),
649
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ErrorLine, { error: problems })
650
+ ] });
651
+ };
652
+ var EditorControl = ({ control: c, onSet }) => {
653
+ const note = c.note ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-[10px] text-amber-400", children: c.note }) : null;
654
+ switch (c.kind) {
655
+ case "slider":
656
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { title: c.note, children: [
657
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PaintSlider, { control: c, value: c.value, onChange: (v) => onSet(c.path, v) }),
658
+ note
659
+ ] });
660
+ case "choice":
661
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "flex items-center justify-between gap-2", title: c.note, children: [
662
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-slate-400", children: c.label }),
663
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("select", { "aria-label": c.ariaLabel, value: c.value, onChange: (e) => onSet(c.path, e.target.value), className: "max-w-[60%] rounded bg-slate-800 px-1 py-0.5", children: c.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: o.value, children: o.label }, o.value)) })
664
+ ] });
665
+ case "toggle":
666
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "flex items-center gap-2", title: c.note, children: [
667
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "checkbox", "aria-label": c.ariaLabel, checked: c.value, onChange: (e) => onSet(c.path, e.target.checked) }),
668
+ " ",
669
+ c.label
670
+ ] });
671
+ case "text":
672
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
673
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-slate-400", children: c.label }),
674
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { "aria-label": c.ariaLabel, defaultValue: c.value, placeholder: c.placeholder, onBlur: (e) => e.target.value !== c.value && onSet(c.path, e.target.value.trim().toLowerCase()), className: "w-28 rounded bg-slate-800 px-1.5 py-0.5" }, c.value)
675
+ ] });
676
+ case "colour":
677
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
678
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-slate-400", children: c.label }),
679
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "flex items-center gap-1", children: [
680
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "color", "aria-label": c.ariaLabel, value: c.value ?? "#000000", onChange: (e) => onSet(c.path, e.target.value), className: "h-5 w-8" }),
681
+ c.value && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: button, onClick: () => onSet(c.path, void 0), children: "None" })
682
+ ] })
683
+ ] });
684
+ case "palette":
685
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": c.ariaLabel, children: [
686
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-slate-400", children: c.label }),
687
+ c.value.map((col, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", title: `Remove ${col}`, "aria-label": `Remove ${col}`, className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: col }, onClick: () => onSet(c.path, c.value.filter((_, j) => j !== i)) }, `${col}-${i}`)),
688
+ c.value.length < c.max && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "color", "aria-label": "Add a palette colour", onChange: (e) => onSet(c.path, [...c.value, e.target.value]), className: "h-4 w-6" })
689
+ ] });
690
+ case "stamps":
691
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex flex-wrap gap-1", role: "group", "aria-label": c.ariaLabel, title: `Up to ${c.max}`, children: c.options.map((o) => {
692
+ const on = c.value.includes(o.value);
693
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", "aria-pressed": on, className: chip(on), onClick: () => onSet(c.path, on ? c.value.filter((v) => v !== o.value) : [...c.value, o.value].slice(-c.max)), children: o.label }, o.value);
694
+ }) });
695
+ }
696
+ };
697
+
698
+ // src/paint-editor/BrushLibraryBrowser.tsx
699
+ var import_react6 = require("react");
700
+ var import_brushes2 = require("@pixerate/editor/brushes");
701
+ var import_jsx_runtime5 = require("react/jsx-runtime");
702
+ var BrushLibraryBrowser = ({ entries, activeId, onSelect, profile, thumbnail, thumbnailWidth = 112, thumbnailHeight = 32, className }) => {
703
+ const [text, setText] = (0, import_react6.useState)("");
704
+ const groups = (0, import_react6.useMemo)(() => (0, import_brushes2.brushLibraryGroups)(entries, { text, profile }), [entries, text, profile]);
705
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: `flex flex-col gap-1 ${className ?? ""}`, "data-testid": "brush-library", children: [
706
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "search", value: text, placeholder: "Find a brush", "aria-label": "Find a brush", onChange: (e) => setText(e.target.value), className: "rounded bg-slate-800 px-1.5 py-0.5" }),
707
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-col gap-1.5", role: "listbox", "aria-label": "Brushes", children: [
708
+ groups.map((g) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { role: "group", "aria-label": g.title, className: "flex flex-col gap-0.5", children: [
709
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-[10px] uppercase tracking-wide text-slate-500", children: g.title }),
710
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "grid grid-cols-2 gap-1", children: g.varieties.flatMap(
711
+ (v) => v.entries.map((e) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
712
+ "button",
713
+ {
714
+ type: "button",
715
+ role: "option",
716
+ "aria-selected": activeId === e.brush.id,
717
+ title: [e.brush.name, v.title.toLowerCase() === e.brush.name.toLowerCase() ? "" : v.title, e.builtin ? "" : "saved"].filter(Boolean).join(" \xB7 "),
718
+ className: `flex flex-col items-start gap-0.5 rounded p-1 text-left ${activeId === e.brush.id ? "bg-indigo-600/30 ring-1 ring-indigo-500" : "bg-slate-900 hover:bg-slate-800"}`,
719
+ onClick: () => onSelect(e.brush.id),
720
+ children: [
721
+ thumbnail && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PixelCanvas, { pixels: thumbnail(e.brush.id), label: `${e.brush.name} thumbnail`, className: "rounded", style: { width: "100%", aspectRatio: `${thumbnailWidth} / ${thumbnailHeight}` } }),
722
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "truncate text-[10px] text-slate-300", children: e.brush.name })
723
+ ]
724
+ },
725
+ e.brush.id
726
+ ))
727
+ ) })
728
+ ] }, g.id)),
729
+ !groups.length && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-slate-500", children: "No brush matches." })
730
+ ] })
731
+ ] });
732
+ };
605
733
 
606
734
  // src/paint-editor/PaintGradientEditor.tsx
607
735
  var import_paint_editor4 = require("@pixerate/editor/paint-editor");
608
736
 
609
737
  // src/paint-editor/PaintGradientEditorView.tsx
610
- var import_react5 = require("react");
611
- var import_jsx_runtime4 = require("react/jsx-runtime");
738
+ var import_react7 = require("react");
739
+ var import_jsx_runtime6 = require("react/jsx-runtime");
612
740
  var button2 = "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700 disabled:opacity-40";
613
741
  var select = "rounded bg-slate-800 px-1 py-0.5 text-[11px]";
614
742
  var number = "w-16 rounded bg-slate-800 px-1 py-0.5 text-[11px]";
@@ -629,7 +757,7 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
629
757
  reversePaintGradient,
630
758
  updatePaintGradientStop
631
759
  } = kit;
632
- const [selected, setSelected] = (0, import_react5.useState)(0);
760
+ const [selected, setSelected] = (0, import_react7.useState)(0);
633
761
  const sel = Math.min(selected, value.stops.length - 1);
634
762
  const stop = value.stops[sel];
635
763
  const map = value.map;
@@ -639,15 +767,15 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
639
767
  setSelected(r.index);
640
768
  onChange(r.paint);
641
769
  };
642
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "paint-gradient-editor", "aria-label": "Gradient paint", children: [
643
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-center gap-1", children: [
644
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("select", { "aria-label": "Gradient preset", className: select, value: "", onChange: (e) => e.target.value && (setSelected(0), onChange(PAINT_GRADIENT_PRESETS[Number(e.target.value)].paint)), children: [
645
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "", children: "Presets\u2026" }),
646
- PAINT_GRADIENT_PRESETS.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: i, children: p.name }, p.name))
770
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "paint-gradient-editor", "aria-label": "Gradient paint", children: [
771
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-1", children: [
772
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("select", { "aria-label": "Gradient preset", className: select, value: "", onChange: (e) => e.target.value && (setSelected(0), onChange(PAINT_GRADIENT_PRESETS[Number(e.target.value)].paint)), children: [
773
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "", children: "Presets\u2026" }),
774
+ PAINT_GRADIENT_PRESETS.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: i, children: p.name }, p.name))
647
775
  ] }),
648
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: button2, onClick: () => onChange(reversePaintGradient(value)), children: "Reverse" })
776
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: button2, onClick: () => onChange(reversePaintGradient(value)), children: "Reverse" })
649
777
  ] }),
650
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
778
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
651
779
  "div",
652
780
  {
653
781
  role: "slider",
@@ -669,7 +797,7 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
669
797
  }
670
798
  }
671
799
  ),
672
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "relative h-4", "aria-label": "Stops", children: value.stops.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
800
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "relative h-4", "aria-label": "Stops", children: value.stops.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
673
801
  "button",
674
802
  {
675
803
  type: "button",
@@ -681,84 +809,84 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
681
809
  },
682
810
  i
683
811
  )) }),
684
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-stop", children: [
685
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("select", { "aria-label": "Stop colour source", className: select, value: stop.color === "paint" || stop.color === "secondary" ? stop.color : "color", onChange: (e) => patchStop({ color: e.target.value === "color" ? stopHex(stop.color) : e.target.value }), children: [
686
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "color", children: "Colour" }),
687
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "paint", children: "Paint colour" }),
688
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "secondary", children: "Second colour" })
812
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-stop", children: [
813
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("select", { "aria-label": "Stop colour source", className: select, value: stop.color === "paint" || stop.color === "secondary" ? stop.color : "color", onChange: (e) => patchStop({ color: e.target.value === "color" ? stopHex(stop.color) : e.target.value }), children: [
814
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "color", children: "Colour" }),
815
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "paint", children: "Paint colour" }),
816
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "secondary", children: "Second colour" })
689
817
  ] }),
690
- stop.color !== "paint" && stop.color !== "secondary" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "color", "aria-label": "Stop colour", value: stop.color, onChange: (e) => patchStop({ color: e.target.value }), className: "h-6 w-8 rounded bg-transparent" }),
691
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "flex items-center gap-1", children: [
818
+ stop.color !== "paint" && stop.color !== "secondary" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "color", "aria-label": "Stop colour", value: stop.color, onChange: (e) => patchStop({ color: e.target.value }), className: "h-6 w-8 rounded bg-transparent" }),
819
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex items-center gap-1", children: [
692
820
  "At",
693
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "number", "aria-label": "Stop position", min: 0, max: 100, step: 1, value: pct(stop.offset), onChange: (e) => patchStop({ offset: Number(e.target.value) / 100 }), className: number }),
821
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "number", "aria-label": "Stop position", min: 0, max: 100, step: 1, value: pct(stop.offset), onChange: (e) => patchStop({ offset: Number(e.target.value) / 100 }), className: number }),
694
822
  "%"
695
823
  ] }),
696
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "flex items-center gap-1", children: [
824
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex items-center gap-1", children: [
697
825
  "Opacity",
698
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "number", "aria-label": "Stop opacity", min: 0, max: 100, step: 5, value: pct(stop.opacity ?? 1), onChange: (e) => patchStop({ opacity: Number(e.target.value) / 100 }), className: number }),
826
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "number", "aria-label": "Stop opacity", min: 0, max: 100, step: 5, value: pct(stop.opacity ?? 1), onChange: (e) => patchStop({ opacity: Number(e.target.value) / 100 }), className: number }),
699
827
  "%"
700
828
  ] }),
701
- sel < value.stops.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "flex items-center gap-1", children: [
829
+ sel < value.stops.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex items-center gap-1", children: [
702
830
  "Midpoint",
703
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "number", "aria-label": "Stop midpoint", min: 5, max: 95, step: 1, value: pct(stop.midpoint ?? 0.5), onChange: (e) => patchStop({ midpoint: Number(e.target.value) / 100 }), className: number }),
831
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "number", "aria-label": "Stop midpoint", min: 5, max: 95, step: 1, value: pct(stop.midpoint ?? 0.5), onChange: (e) => patchStop({ midpoint: Number(e.target.value) / 100 }), className: number }),
704
832
  "%"
705
833
  ] }),
706
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: button2, disabled: value.stops.length <= 2, onClick: () => (setSelected(Math.max(0, sel - 1)), onChange(removePaintGradientStop(value, sel))), children: "Remove stop" })
834
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: button2, disabled: value.stops.length <= 2, onClick: () => (setSelected(Math.max(0, sel - 1)), onChange(removePaintGradientStop(value, sel))), children: "Remove stop" })
707
835
  ] }),
708
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-mapping", children: [
709
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("select", { "aria-label": "Gradient follows", className: select, value: map.by, onChange: (e) => onChange({ ...value, map: paintGradientMappingFor(e.target.value, map) }), children: PAINT_GRADIENT_MAPPINGS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: m, children: PAINT_GRADIENT_MAPPING_LABELS[m] }, m)) }),
710
- map.by === "distance" && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
711
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "number", "aria-label": "Gradient length", min: 1, max: 1e5, value: map.length, onChange: (e) => onChange({ ...value, map: { ...map, length: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
712
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("select", { "aria-label": "Gradient length unit", className: select, value: map.unit ?? "px", onChange: (e) => onChange({ ...value, map: { ...map, unit: e.target.value } }), children: [
713
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "px", children: "px" }),
714
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "dabs", children: "dabs" })
836
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-mapping", children: [
837
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("select", { "aria-label": "Gradient follows", className: select, value: map.by, onChange: (e) => onChange({ ...value, map: paintGradientMappingFor(e.target.value, map) }), children: PAINT_GRADIENT_MAPPINGS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: m, children: PAINT_GRADIENT_MAPPING_LABELS[m] }, m)) }),
838
+ map.by === "distance" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
839
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "number", "aria-label": "Gradient length", min: 1, max: 1e5, value: map.length, onChange: (e) => onChange({ ...value, map: { ...map, length: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
840
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("select", { "aria-label": "Gradient length unit", className: select, value: map.unit ?? "px", onChange: (e) => onChange({ ...value, map: { ...map, unit: e.target.value } }), children: [
841
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "px", children: "px" }),
842
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "dabs", children: "dabs" })
715
843
  ] })
716
844
  ] }),
717
- map.by === "time" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "number", "aria-label": "Gradient duration", min: 1, max: 6e5, value: map.duration, onChange: (e) => onChange({ ...value, map: { ...map, duration: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
718
- map.by === "random" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "number", "aria-label": "Dabs per pick", min: 1, max: 500, value: map.every ?? 1, onChange: (e) => onChange({ ...value, map: { ...map, every: Math.max(1, Math.round(Number(e.target.value) || 1)) } }), className: number }),
719
- (map.by === "distance" || map.by === "time") && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("select", { "aria-label": "Gradient repeat", className: select, value: map.repeat ?? "clamp", onChange: (e) => onChange({ ...value, map: { ...map, repeat: e.target.value } }), children: PAINT_GRADIENT_REPEATS.map((r) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: r, children: PAINT_GRADIENT_REPEAT_LABELS[r] }, r)) })
845
+ map.by === "time" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "number", "aria-label": "Gradient duration", min: 1, max: 6e5, value: map.duration, onChange: (e) => onChange({ ...value, map: { ...map, duration: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
846
+ map.by === "random" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "number", "aria-label": "Dabs per pick", min: 1, max: 500, value: map.every ?? 1, onChange: (e) => onChange({ ...value, map: { ...map, every: Math.max(1, Math.round(Number(e.target.value) || 1)) } }), className: number }),
847
+ (map.by === "distance" || map.by === "time") && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("select", { "aria-label": "Gradient repeat", className: select, value: map.repeat ?? "clamp", onChange: (e) => onChange({ ...value, map: { ...map, repeat: e.target.value } }), children: PAINT_GRADIENT_REPEATS.map((r) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: r, children: PAINT_GRADIENT_REPEAT_LABELS[r] }, r)) })
720
848
  ] }),
721
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-center gap-1", children: [
722
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("select", { "aria-label": "Gradient mixing", className: select, value: value.space, onChange: (e) => onChange({ ...value, space: e.target.value }), children: PAINT_GRADIENT_SPACES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: s, children: PAINT_GRADIENT_SPACE_LABELS[s] }, s)) }),
723
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "flex flex-1 items-center gap-1", children: [
849
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-1", children: [
850
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("select", { "aria-label": "Gradient mixing", className: select, value: value.space, onChange: (e) => onChange({ ...value, space: e.target.value }), children: PAINT_GRADIENT_SPACES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: s, children: PAINT_GRADIENT_SPACE_LABELS[s] }, s)) }),
851
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex flex-1 items-center gap-1", children: [
724
852
  "Softness",
725
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { type: "range", "aria-label": "Gradient softness", min: 0, max: 1, step: 0.05, value: value.softness ?? 1, onChange: (e) => onChange({ ...value, softness: Number(e.target.value) }), className: "flex-1 accent-indigo-500" })
853
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "range", "aria-label": "Gradient softness", min: 0, max: 1, step: 0.05, value: value.softness ?? 1, onChange: (e) => onChange({ ...value, softness: Number(e.target.value) }), className: "flex-1 accent-indigo-500" })
726
854
  ] })
727
855
  ] })
728
856
  ] });
729
857
  };
730
858
 
731
859
  // src/paint-editor/PaintGradientEditor.tsx
732
- var import_jsx_runtime5 = require("react/jsx-runtime");
733
- var PaintGradientEditor = (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PaintGradientEditorView, { ...props, kit: import_paint_editor4.PAINT_GRADIENT_KIT });
860
+ var import_jsx_runtime7 = require("react/jsx-runtime");
861
+ var PaintGradientEditor = (props) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PaintGradientEditorView, { ...props, kit: import_paint_editor4.PAINT_GRADIENT_KIT });
734
862
 
735
863
  // src/paint-editor/StickerPicker.tsx
736
- var import_react7 = require("react");
864
+ var import_react9 = require("react");
737
865
 
738
866
  // src/stickers/StickerLibraryPicker.tsx
739
- var import_react6 = require("react");
867
+ var import_react8 = require("react");
740
868
  var import_stickers = require("@pixerate/editor/stickers");
741
- var import_jsx_runtime6 = require("react/jsx-runtime");
869
+ var import_jsx_runtime8 = require("react/jsx-runtime");
742
870
  var StickerLibraryPicker = ({ provider, selected = [], onPick, label = "Stickers", footer, className }) => {
743
- const browser = (0, import_react6.useMemo)(() => new import_stickers.StickerBrowser(() => provider), [provider]);
744
- const [, setTick] = (0, import_react6.useState)(0);
745
- (0, import_react6.useEffect)(() => {
871
+ const browser = (0, import_react8.useMemo)(() => new import_stickers.StickerBrowser(() => provider), [provider]);
872
+ const [, setTick] = (0, import_react8.useState)(0);
873
+ (0, import_react8.useEffect)(() => {
746
874
  const off = browser.subscribe(() => setTick((n) => n + 1));
747
875
  void browser.refresh();
748
876
  return off;
749
877
  }, [browser]);
750
878
  const s = browser.state;
751
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: `flex flex-col gap-1 ${className ?? ""}`, "data-testid": "sticker-picker", children: [
752
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-1", children: [
753
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "search", "aria-label": `Search ${label.toLowerCase()}`, placeholder: `Search ${s.provider}`, value: s.query, onChange: (e) => void browser.setQuery(e.target.value), className: "min-w-0 flex-1 rounded bg-slate-800 px-1 py-0.5" }),
754
- s.categories.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("select", { "aria-label": "Sticker category", value: s.category, onChange: (e) => void browser.setCategory(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: [
755
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "", children: "All" }),
756
- s.categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: c.id, children: c.name }, c.id))
879
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `flex flex-col gap-1 ${className ?? ""}`, "data-testid": "sticker-picker", children: [
880
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-1", children: [
881
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { type: "search", "aria-label": `Search ${label.toLowerCase()}`, placeholder: `Search ${s.provider}`, value: s.query, onChange: (e) => void browser.setQuery(e.target.value), className: "min-w-0 flex-1 rounded bg-slate-800 px-1 py-0.5" }),
882
+ s.categories.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("select", { "aria-label": "Sticker category", value: s.category, onChange: (e) => void browser.setCategory(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: [
883
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "", children: "All" }),
884
+ s.categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: c.id, children: c.name }, c.id))
757
885
  ] })
758
886
  ] }),
759
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex max-h-32 flex-wrap gap-1 overflow-y-auto", role: "group", "aria-label": label, children: s.items.map((it) => {
887
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex max-h-32 flex-wrap gap-1 overflow-y-auto", role: "group", "aria-label": label, children: s.items.map((it) => {
760
888
  const on = selected.includes(it.ref);
761
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
889
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
762
890
  "button",
763
891
  {
764
892
  type: "button",
@@ -767,36 +895,36 @@ var StickerLibraryPicker = ({ provider, selected = [], onPick, label = "Stickers
767
895
  className: `flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] ${on ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300"}`,
768
896
  onClick: () => onPick(it),
769
897
  children: [
770
- it.thumbnail && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("img", { src: it.thumbnail, alt: "", className: "h-4 w-4" }),
898
+ it.thumbnail && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("img", { src: it.thumbnail, alt: "", className: "h-4 w-4" }),
771
899
  it.name
772
900
  ]
773
901
  },
774
902
  it.ref
775
903
  );
776
904
  }) }),
777
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center justify-between text-[10px] text-slate-500", children: [
778
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: s.loading ? "Loading\u2026" : `${s.items.length} of ${s.total}` }),
779
- s.hasMore && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "text-indigo-300", onClick: () => void browser.more(), children: "More" })
905
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center justify-between text-[10px] text-slate-500", children: [
906
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: s.loading ? "Loading\u2026" : `${s.items.length} of ${s.total}` }),
907
+ s.hasMore && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: "text-indigo-300", onClick: () => void browser.more(), children: "More" })
780
908
  ] }),
781
- s.error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { role: "alert", className: "text-[11px] text-rose-400", children: s.error }),
909
+ s.error && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { role: "alert", className: "text-[11px] text-rose-400", children: s.error }),
782
910
  footer
783
911
  ] });
784
912
  };
785
913
 
786
914
  // src/paint-editor/StickerPicker.tsx
787
- var import_jsx_runtime7 = require("react/jsx-runtime");
915
+ var import_jsx_runtime9 = require("react/jsx-runtime");
788
916
  var StickerPicker = ({ controller, selected, onPick, label = "Stickers" }) => {
789
- const [provider, setProvider] = (0, import_react7.useState)(() => controller.stickersProvider);
790
- (0, import_react7.useEffect)(() => controller.stickers.subscribe(setProvider), [controller]);
917
+ const [provider, setProvider] = (0, import_react9.useState)(() => controller.stickersProvider);
918
+ (0, import_react9.useEffect)(() => controller.stickers.subscribe(setProvider), [controller]);
791
919
  const failed = selected.map((ref) => ({ ref, ...controller.stickerArtStatus(ref) })).filter((x) => x.status === "failed");
792
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
920
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
793
921
  StickerLibraryPicker,
794
922
  {
795
923
  provider,
796
924
  selected,
797
925
  label,
798
926
  onPick: (it) => onPick(it.ref),
799
- footer: failed.map((f) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("p", { role: "alert", className: "text-[11px] text-rose-400", children: [
927
+ footer: failed.map((f) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("p", { role: "alert", className: "text-[11px] text-rose-400", children: [
800
928
  f.ref,
801
929
  ": ",
802
930
  f.error
@@ -806,165 +934,62 @@ var StickerPicker = ({ controller, selected, onPick, label = "Stickers" }) => {
806
934
  };
807
935
 
808
936
  // src/paint-editor/BrushPanel.tsx
809
- var import_jsx_runtime8 = require("react/jsx-runtime");
937
+ var import_jsx_runtime10 = require("react/jsx-runtime");
810
938
  var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, className }) => {
811
939
  const state = usePaintEditorState(controller);
812
940
  const [error, attempt] = useAttempt();
813
- const [saveName, setSaveName] = (0, import_react8.useState)("");
814
- const fileRef = (0, import_react8.useRef)(null);
941
+ const fileRef = (0, import_react10.useRef)(null);
815
942
  const { brush, brushes } = state;
816
943
  const paper = state.document.paper;
817
- const thumbs = (0, import_react8.useMemo)(
944
+ const thumbs = (0, import_react10.useMemo)(
818
945
  () => new Map(brushes.map((b) => [b.id, controller.brushThumbnail(b.id, { width: thumbnailWidth, height: thumbnailHeight, color: "#26324a" })])),
819
946
  // Thumbnails follow the library and the paper.
820
947
  // eslint-disable-next-line react-hooks/exhaustive-deps
821
948
  [controller, brushes, paper, thumbnailWidth, thumbnailHeight]
822
949
  );
823
- const engine = (0, import_paint_editor5.brushEngineControls)(brush);
950
+ const entries = (0, import_react10.useMemo)(() => brushes.map((b) => ({ brush: controller.getBrushSpec(b.id), builtin: Boolean(b.builtin) })), [controller, brushes]);
951
+ const spec = (0, import_react10.useMemo)(() => controller.getBrushSpec(), [controller, brush]);
952
+ const own = typeof spec.colour?.default === "string" && /^#[0-9a-f]{6}/i.test(spec.colour.default) ? spec.colour.default.slice(0, 7) : void 0;
953
+ const preview = (0, import_react10.useMemo)(() => controller.brushThumbnail(brush.id, { width: 240, height: 64, color: own }), [controller, brush, paper, state.color, own]);
824
954
  const carried = (0, import_paint_editor5.brushLoadColor)(state.mixerLoad);
825
955
  const slug = (name) => name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || "brush";
826
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "brush-panel", children: [
827
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "grid grid-cols-2 gap-1", role: "listbox", "aria-label": "Brushes", children: brushes.map((b) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
828
- "button",
956
+ const loads = ["dab", "mixer", "impasto"].includes(brush.engine) || brush.engine === "wet" && brush.wet.tool === "paint";
957
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "brush-panel", children: [
958
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(BrushLibraryBrowser, { entries, activeId: brush.id, onSelect: (id) => controller.setBrush({ id }), thumbnail: (id) => thumbs.get(id) ?? null, thumbnailWidth, thumbnailHeight }),
959
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
960
+ BrushEditor,
829
961
  {
830
- type: "button",
831
- role: "option",
832
- "aria-selected": brush.id === b.id,
833
- title: `${b.name} (${b.category})`,
834
- className: `flex flex-col items-start gap-0.5 rounded p-1 text-left ${brush.id === b.id ? "bg-indigo-600/30 ring-1 ring-indigo-500" : "bg-slate-900 hover:bg-slate-800"}`,
835
- onClick: () => controller.setBrush({ id: b.id }),
836
- children: [
837
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PixelCanvas, { pixels: thumbs.get(b.id) ?? null, label: `${b.name} thumbnail`, className: "rounded", style: { width: "100%", aspectRatio: `${thumbnailWidth} / ${thumbnailHeight}` } }),
838
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "truncate text-[10px] text-slate-300", children: b.name })
839
- ]
840
- },
841
- b.id
842
- )) }),
843
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
844
- import_paint_editor5.BRUSH_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor5.readPath)(brush, c.path), onChange: (v) => controller.setBrush((0, import_paint_editor5.patchPath)(brush, c.path, v)) }, c.path)),
845
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
846
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-slate-400", children: "Rotation" }),
847
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("select", { "aria-label": "Brush rotation", value: brush.rotation, onChange: (e) => controller.setBrush({ rotation: e.target.value }), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor5.BRUSH_ROTATIONS.map((r) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: r, children: r === "stroke" ? "Follow stroke" : r === "barrel" ? "Pen barrel" : "Fixed" }, r)) })
848
- ] }),
849
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-2", children: [
850
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { type: "checkbox", checked: brush.tip.pressureSize, onChange: (e) => controller.setBrush({ tip: { pressureSize: e.target.checked } }) }),
851
- " Pressure \u2192 size"
852
- ] }),
853
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-2", children: [
854
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { type: "checkbox", checked: brush.tip.pressureOpacity, onChange: (e) => controller.setBrush({ tip: { pressureOpacity: e.target.checked } }) }),
855
- " Pressure \u2192 opacity"
856
- ] }),
857
- brush.engine === "dab" && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
858
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-slate-400", children: "Blend" }),
859
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("select", { "aria-label": "Brush blend", value: brush.tip.blend, onChange: (e) => controller.setBrush({ tip: { blend: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor5.BLEND_MENU_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("optgroup", { label: g.label, children: g.modes.map((m) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: m.id, title: m.description, children: m.label }, m.id)) }, g.label)) })
860
- ] })
861
- ] }),
862
- engine && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "brush-engine", children: [
863
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "font-medium text-slate-300", children: engine.title }),
864
- engine.wetTool && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
865
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-slate-400", children: "Wet tool" }),
866
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("select", { "aria-label": "Wet tool", value: brush.wet.tool, onChange: (e) => controller.setBrush({ wet: { tool: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor5.WET_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: t, children: import_paint_editor5.WET_TOOL_LABELS[t] }, t)) })
867
- ] }),
868
- engine.wetTool && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
869
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-slate-400", children: "Medium" }),
870
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("select", { "aria-label": "Wet medium", value: brush.wet.medium, onChange: (e) => controller.setBrush({ wet: { medium: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor5.WET_MEDIA.map((m) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: m, children: import_paint_editor5.WET_MEDIUM_LABELS[m] }, m)) })
871
- ] }),
872
- engine.particleMenus && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
873
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
874
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-slate-400", children: "Particles" }),
875
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("select", { "aria-label": "Particle kind", value: brush.particle.kind, onChange: (e) => controller.setBrush({ particle: { kind: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor5.PARTICLE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: k, children: import_paint_editor5.PARTICLE_KIND_LABELS[k] }, k)) })
876
- ] }),
877
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
878
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-slate-400", children: "Drawn as" }),
879
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("select", { "aria-label": "Particle render", value: brush.particle.render, onChange: (e) => controller.setBrush({ particle: { render: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor5.PARTICLE_RENDERS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: k, children: import_paint_editor5.PARTICLE_RENDER_LABELS[k] }, k)) })
880
- ] }),
881
- brush.particle.render === "ribbon" && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
882
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-slate-400", children: "Ribbon joins" }),
883
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("select", { "aria-label": "Ribbon pairs", value: brush.particle.ribbonPairs, onChange: (e) => controller.setBrush({ particle: { ribbonPairs: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor5.RIBBON_PAIRS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: k, children: import_paint_editor5.RIBBON_PAIR_LABELS[k] }, k)) })
884
- ] }),
885
- (brush.particle.render === "dot" || brush.particle.render === "sequence") && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
886
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex flex-wrap gap-1", role: "group", "aria-label": "Dot textures", title: "Stamps drawn instead of round dots (up to 4; none: round)", children: import_paint_editor5.STAMP_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
887
- "button",
888
- {
889
- type: "button",
890
- "aria-pressed": brush.particle.dotTextures.includes(k),
891
- className: `px-1.5 py-0.5 rounded text-[10px] ${brush.particle.dotTextures.includes(k) ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300"}`,
892
- onClick: () => controller.setBrush({ particle: { dotTextures: (0, import_paint_editor5.toggleDotTexture)(brush.particle.dotTextures, k) } }),
893
- children: import_paint_editor5.STAMP_LABELS[k]
894
- },
895
- k
896
- )) }),
897
- brush.particle.dotTextures.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
898
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
899
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-slate-400", children: "Texture order" }),
900
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("select", { "aria-label": "Dot texture order", value: brush.particle.dotTextureOrder, onChange: (e) => controller.setBrush({ particle: { dotTextureOrder: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor5.DOT_TEXTURE_ORDERS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: k, children: import_paint_editor5.DOT_TEXTURE_ORDER_LABELS[k] }, k)) })
901
- ] }),
902
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
903
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-slate-400", children: "Texture turn" }),
904
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("select", { "aria-label": "Dot rotation", value: brush.particle.dotRotation, onChange: (e) => controller.setBrush({ particle: { dotRotation: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor5.DOT_ROTATIONS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: k, children: import_paint_editor5.DOT_ROTATION_LABELS[k] }, k)) })
905
- ] })
906
- ] })
907
- ] })
908
- ] }),
909
- engine.stickerStamps && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(StickerPicker, { controller, label: "Sticker stamps", selected: brush.sticker.stamps, onPick: (ref) => controller.setBrush({ sticker: { stamps: (0, import_paint_editor5.toggleStickerRef)(brush.sticker.stamps, ref) } }) }),
910
- engine.impastoTool && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
911
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-slate-400", children: "Tool" }),
912
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("select", { "aria-label": "Impasto tool", value: brush.impasto.tool, onChange: (e) => controller.setBrush({ impasto: { tool: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor5.IMPASTO_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: t, children: import_paint_editor5.IMPASTO_TOOL_LABELS[t] }, t)) })
913
- ] }),
914
- engine.sliders.map((c) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor5.readPath)(brush, c.path), onChange: (v) => controller.setBrush((0, import_paint_editor5.patchPath)(brush, c.path, v)) }, c.path)),
915
- engine.mixingPath && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
916
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-slate-400", children: "Mixing" }),
917
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
918
- "select",
919
- {
920
- "aria-label": "Brush mixing",
921
- value: engine.mixingPath === "blender.mixing" ? brush.blender.mixing : engine.mixingPath === "smudge.mixing" ? brush.smudge.mixing : brush.behavior.mixing,
922
- onChange: (e) => controller.setBrush((0, import_paint_editor5.patchBrushValue)(brush, engine.mixingPath, e.target.value)),
923
- className: "rounded bg-slate-800 px-1 py-0.5",
924
- children: [
925
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "pigment", children: "Pigment" }),
926
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "rgb", children: "RGB" })
927
- ]
928
- }
929
- )
930
- ] }),
931
- engine.light && brush.light.amount > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-2", title: "Pressure scales the light the brush lays", children: [
932
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { type: "checkbox", "aria-label": "Light follows pressure", checked: brush.light.pressure, onChange: (e) => controller.setBrush({ light: { pressure: e.target.checked } }) }),
933
- " Light follows pressure"
934
- ] }),
935
- engine.dirty && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-2", title: "Keep the colour the brush picked up for the next stroke (needs Pick-up above 0)", children: [
936
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { type: "checkbox", "aria-label": "Dirty brush", checked: brush.behavior.dirty, onChange: (e) => controller.setBrush({ behavior: { dirty: e.target.checked } }) }),
937
- " Dirty brush"
938
- ] }),
939
- (0, import_paint_editor5.brushTakesPaint)(brush) && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "brush-gradient", children: [
940
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
941
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-slate-400", title: "A gradient of the brush's own, used instead of the paint (the multi-colour brush)", children: "Brush gradient" }),
942
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
943
- "button",
944
- {
945
- type: "button",
946
- "aria-pressed": brush.paint !== null,
947
- className: chip(brush.paint !== null),
948
- onClick: () => attempt(() => controller.setBrush({ paint: brush.paint ? null : import_paint_editor6.DEFAULT_PAINT_GRADIENT })),
949
- children: brush.paint ? "On" : "Off"
950
- }
951
- )
952
- ] }),
953
- brush.paint && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PaintGradientEditor, { value: brush.paint, colors: { paint: state.color, secondary: state.secondaryColor }, onChange: (g) => attempt(() => controller.setBrush({ paint: g })) })
954
- ] }),
955
- engine.load && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-1", children: [
956
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-slate-400", children: "Carries" }),
957
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { "aria-label": "Brush load", title: carried ?? "Clean", className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: carried ?? "transparent" } }),
958
- brush.engine === "mixer" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: button, onClick: () => controller.loadMixerBrush(), children: "Load" }),
959
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: button, onClick: () => controller.cleanMixerBrush(brush.engine === "mixer"), children: "Clean" })
960
- ] })
961
- ] }),
962
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
963
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { value: saveName, placeholder: "Brush name", "aria-label": "Brush name", onChange: (e) => setSaveName(e.target.value), className: "w-28 rounded bg-slate-800 px-1.5 py-0.5" }),
964
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: button, disabled: !saveName.trim(), onClick: () => attempt(() => (controller.saveBrush({ id: slug(saveName), name: saveName.trim() }), setSaveName(""))), children: "Save brush" }),
965
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (0, import_paint_editor5.downloadBytes)(JSON.stringify(controller.exportBrushes(), null, 2), "brushes.json", "application/json")), children: "Export" }),
966
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: button, onClick: () => fileRef.current?.click(), children: "Import\u2026" }),
967
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
962
+ brush: spec,
963
+ profile: import_brushes3.PAINT_PROFILE,
964
+ preview,
965
+ onChange: (next) => attempt(() => controller.setBrushSpec(next)),
966
+ onSaveAs: (name) => controller.saveBrush({ id: slug(name), name }),
967
+ renderExtra: (section) => {
968
+ if (section === "shape" && brush.engine === "sticker")
969
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(StickerPicker, { controller, label: "Sticker stamps", selected: brush.sticker.stamps, onPick: (ref) => controller.setBrush({ sticker: { stamps: (0, import_paint_editor5.toggleStickerRef)(brush.sticker.stamps, ref) } }) });
970
+ if (section === "behaviour" && loads)
971
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", children: [
972
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-slate-400", children: "Carries" }),
973
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-label": "Brush load", title: carried ?? "Clean", className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: carried ?? "transparent" } }),
974
+ brush.engine === "mixer" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: button, onClick: () => controller.loadMixerBrush(), children: "Load" }),
975
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: button, onClick: () => controller.cleanMixerBrush(brush.engine === "mixer"), children: "Clean" })
976
+ ] });
977
+ if (section === "colour" && (0, import_paint_editor5.brushTakesPaint)(brush))
978
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "brush-gradient", children: [
979
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
980
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-slate-400", title: "A gradient of the brush's own, used instead of the paint (the multi-colour brush)", children: "Brush gradient" }),
981
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", "aria-pressed": brush.paint !== null, className: chip(brush.paint !== null), onClick: () => attempt(() => controller.setBrush({ paint: brush.paint ? null : import_paint_editor5.DEFAULT_PAINT_GRADIENT })), children: brush.paint ? "On" : "Off" })
982
+ ] }),
983
+ brush.paint && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaintGradientEditor, { value: brush.paint, colors: { paint: state.color, secondary: state.secondaryColor }, onChange: (g) => attempt(() => controller.setBrush({ paint: g })) })
984
+ ] });
985
+ return null;
986
+ }
987
+ }
988
+ ),
989
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
990
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: button, onClick: () => attempt(async () => (0, import_paint_editor5.downloadBytes)(JSON.stringify(await controller.exportBrushes(), null, 2), "brushes.json", "application/json")), children: "Export" }),
991
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: button, onClick: () => fileRef.current?.click(), children: "Import\u2026" }),
992
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
968
993
  "input",
969
994
  {
970
995
  ref: fileRef,
@@ -980,24 +1005,24 @@ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, clas
980
1005
  }
981
1006
  )
982
1007
  ] }),
983
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ErrorLine, { error })
1008
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ErrorLine, { error })
984
1009
  ] });
985
1010
  };
986
1011
 
987
1012
  // src/paint-editor/PaperPanel.tsx
988
- var import_react9 = require("react");
989
- var import_paint_editor7 = require("@pixerate/editor/paint-editor");
990
- var import_jsx_runtime9 = require("react/jsx-runtime");
1013
+ var import_react11 = require("react");
1014
+ var import_paint_editor6 = require("@pixerate/editor/paint-editor");
1015
+ var import_jsx_runtime11 = require("react/jsx-runtime");
991
1016
  var SWATCH = { x: 0, y: 0, width: 64, height: 40 };
992
1017
  var PaperPanel = ({ controller, className }) => {
993
1018
  const state = usePaintEditorState(controller);
994
1019
  const [error, attempt] = useAttempt();
995
1020
  const paper = state.document.paper;
996
- const previews = (0, import_react9.useMemo)(() => new Map(import_paint_editor7.PAPER_LIBRARY.map((p) => [p.preset, { ...SWATCH, data: (0, import_paint_editor7.renderPaper)({ ...p, shading: Math.max(0.8, p.shading) }, SWATCH) }])), []);
997
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paper-panel", children: [
998
- import_paint_editor7.PAPER_FAMILIES.map((family) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
999
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mb-0.5 text-[10px] uppercase tracking-wide text-slate-500", children: family }),
1000
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": `${family} papers`, children: import_paint_editor7.PAPER_LIBRARY.filter((p) => p.family === family).map((p) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1021
+ const previews = (0, import_react11.useMemo)(() => new Map(import_paint_editor6.PAPER_LIBRARY.map((p) => [p.preset, { ...SWATCH, data: (0, import_paint_editor6.renderPaper)({ ...p, shading: Math.max(0.8, p.shading) }, SWATCH) }])), []);
1022
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paper-panel", children: [
1023
+ import_paint_editor6.PAPER_FAMILIES.map((family) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
1024
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "mb-0.5 text-[10px] uppercase tracking-wide text-slate-500", children: family }),
1025
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": `${family} papers`, children: import_paint_editor6.PAPER_LIBRARY.filter((p) => p.family === family).map((p) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1001
1026
  "button",
1002
1027
  {
1003
1028
  type: "button",
@@ -1006,98 +1031,98 @@ var PaperPanel = ({ controller, className }) => {
1006
1031
  title: p.name,
1007
1032
  className: `rounded p-0.5 ${paper.preset === p.preset ? "ring-2 ring-indigo-500" : "ring-1 ring-slate-700 hover:ring-slate-500"}`,
1008
1033
  onClick: () => attempt(() => controller.setPaper({ preset: p.preset })),
1009
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PixelCanvas, { pixels: previews.get(p.preset) ?? null, label: p.name, style: { width: 48, height: 30 } })
1034
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PixelCanvas, { pixels: previews.get(p.preset) ?? null, label: p.name, style: { width: 48, height: 30 } })
1010
1035
  },
1011
1036
  p.preset
1012
1037
  )) })
1013
1038
  ] }, family)),
1014
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "text-slate-300", children: paper.name }),
1015
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center justify-between", children: [
1016
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-slate-400", children: "Colour" }),
1017
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CommitColorInput, { label: "Paper colour", value: paper.color, onCommit: (v) => attempt(() => controller.setPaper({ color: v })), className: "h-6 w-10 rounded bg-transparent" })
1039
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "text-slate-300", children: paper.name }),
1040
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex items-center justify-between", children: [
1041
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-slate-400", children: "Colour" }),
1042
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CommitColorInput, { label: "Paper colour", value: paper.color, onCommit: (v) => attempt(() => controller.setPaper({ color: v })), className: "h-6 w-10 rounded bg-transparent" })
1018
1043
  ] }),
1019
- import_paint_editor7.PAPER_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor7.readPath)(paper, c.path), onCommit: (v) => attempt(() => controller.setPaper((0, import_paint_editor7.patchPath)(paper, c.path, v))) }, c.path)),
1020
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center justify-between", children: [
1021
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-slate-400", children: "Backlight colour" }),
1022
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CommitColorInput, { label: "Backlight colour", value: paper.backlightColor ?? import_paint_editor7.DEFAULT_BACKLIGHT_COLOR, onCommit: (v) => attempt(() => controller.setPaper({ backlightColor: v })), className: "h-6 w-10 rounded bg-transparent" })
1044
+ import_paint_editor6.PAPER_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor6.readPath)(paper, c.path), onCommit: (v) => attempt(() => controller.setPaper((0, import_paint_editor6.patchPath)(paper, c.path, v))) }, c.path)),
1045
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex items-center justify-between", children: [
1046
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-slate-400", children: "Backlight colour" }),
1047
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CommitColorInput, { label: "Backlight colour", value: paper.backlightColor ?? import_paint_editor6.DEFAULT_BACKLIGHT_COLOR, onCommit: (v) => attempt(() => controller.setPaper({ backlightColor: v })), className: "h-6 w-10 rounded bg-transparent" })
1023
1048
  ] }),
1024
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-2", children: [
1025
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", { type: "checkbox", checked: paper.tiling === "mirror", onChange: (e) => attempt(() => controller.setPaper({ tiling: e.target.checked ? "mirror" : "repeat" })) }),
1049
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex items-center gap-2", children: [
1050
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { type: "checkbox", checked: paper.tiling === "mirror", onChange: (e) => attempt(() => controller.setPaper({ tiling: e.target.checked ? "mirror" : "repeat" })) }),
1026
1051
  " Mirror tiling"
1027
1052
  ] }),
1028
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: "self-start px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.setPaper({ seed: paper.seed + 1 })), children: "New sheet" }),
1029
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "light-panel", children: [
1030
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "font-medium text-slate-300", children: "Light (thick paint, metallic paper)" }),
1031
- import_paint_editor7.LIGHT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor7.readPath)(controller.getLighting(), c.path), onChange: (v) => attempt(() => controller.setLighting({ [c.path]: v })) }, c.path)),
1032
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: "self-start px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.flattenRelief()), children: "Flatten relief" })
1053
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: "self-start px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.setPaper({ seed: paper.seed + 1 })), children: "New sheet" }),
1054
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "light-panel", children: [
1055
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "font-medium text-slate-300", children: "Light (thick paint, metallic paper)" }),
1056
+ import_paint_editor6.LIGHT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor6.readPath)(controller.getLighting(), c.path), onChange: (v) => attempt(() => controller.setLighting({ [c.path]: v })) }, c.path)),
1057
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: "self-start px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.flattenRelief()), children: "Flatten relief" })
1033
1058
  ] }),
1034
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ErrorLine, { error })
1059
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ErrorLine, { error })
1035
1060
  ] });
1036
1061
  };
1037
1062
 
1038
1063
  // src/paint-editor/ColorPanel.tsx
1039
- var import_react10 = require("react");
1064
+ var import_react12 = require("react");
1065
+ var import_paint_editor7 = require("@pixerate/editor/paint-editor");
1040
1066
  var import_paint_editor8 = require("@pixerate/editor/paint-editor");
1041
- var import_paint_editor9 = require("@pixerate/editor/paint-editor");
1042
- var import_jsx_runtime10 = require("react/jsx-runtime");
1067
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1043
1068
  var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className }) => {
1044
1069
  const state = usePaintEditorState(controller);
1045
1070
  const [error, attempt] = useAttempt();
1046
- const [wheel, setWheel] = (0, import_react10.useState)("ryb");
1047
- const [kind, setKind] = (0, import_react10.useState)("complementary");
1048
- const [padTool, setPadTool] = (0, import_react10.useState)("paint");
1049
- const [sample, setSample] = (0, import_react10.useState)(3);
1050
- const [parts, setParts] = (0, import_react10.useState)([1, 1]);
1051
- const [padName, setPadName] = (0, import_react10.useState)("");
1052
- const padPoints = (0, import_react10.useRef)(null);
1053
- const ring = (0, import_react10.useMemo)(() => (0, import_paint_editor8.renderColorWheel)(wheelSize, wheel), [wheelSize, wheel]);
1071
+ const [wheel, setWheel] = (0, import_react12.useState)("ryb");
1072
+ const [kind, setKind] = (0, import_react12.useState)("complementary");
1073
+ const [padTool, setPadTool] = (0, import_react12.useState)("paint");
1074
+ const [sample, setSample] = (0, import_react12.useState)(3);
1075
+ const [parts, setParts] = (0, import_react12.useState)([1, 1]);
1076
+ const [padName, setPadName] = (0, import_react12.useState)("");
1077
+ const padPoints = (0, import_react12.useRef)(null);
1078
+ const ring = (0, import_react12.useMemo)(() => (0, import_paint_editor7.renderColorWheel)(wheelSize, wheel), [wheelSize, wheel]);
1054
1079
  const color = state.color;
1055
- const harmony = (0, import_react10.useMemo)(() => controller.harmony(kind, { color, wheel }), [controller, kind, color, wheel]);
1056
- const [r, g, b] = (0, import_paint_editor8.parseHexColor)(color);
1057
- const hsv = (0, import_paint_editor8.rgbToHsv)(r, g, b);
1058
- const effectWell = (0, import_react10.useMemo)(() => state.effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(64) : null, [controller, state.effectPaint, state.effectPaintRendering]);
1059
- const pad = (0, import_react10.useMemo)(() => ({ width: import_paint_editor8.MIXING_PAD_WIDTH, height: import_paint_editor8.MIXING_PAD_HEIGHT, data: controller.mixingPad.pixels() }), [controller, state.mixingPadVersion]);
1080
+ const harmony = (0, import_react12.useMemo)(() => controller.harmony(kind, { color, wheel }), [controller, kind, color, wheel]);
1081
+ const [r, g, b] = (0, import_paint_editor7.parseHexColor)(color);
1082
+ const hsv = (0, import_paint_editor7.rgbToHsv)(r, g, b);
1083
+ const effectWell = (0, import_react12.useMemo)(() => state.effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(64) : null, [controller, state.effectPaint, state.effectPaintRendering]);
1084
+ const pad = (0, import_react12.useMemo)(() => ({ width: import_paint_editor7.MIXING_PAD_WIDTH, height: import_paint_editor7.MIXING_PAD_HEIGHT, data: controller.mixingPad.pixels() }), [controller, state.mixingPadVersion]);
1060
1085
  const R = wheelSize / 2;
1061
1086
  const mid = R * 0.82;
1062
- const setHsv = (s, v) => controller.setColor((0, import_paint_editor8.rgbToHexColor)(...(0, import_paint_editor8.hsvToRgb)(hsv.h, s, v)));
1087
+ const setHsv = (s, v) => controller.setColor((0, import_paint_editor7.rgbToHexColor)(...(0, import_paint_editor7.hsvToRgb)(hsv.h, s, v)));
1063
1088
  const padPoint = (e) => {
1064
1089
  const rect = e.currentTarget.getBoundingClientRect();
1065
- const kx = import_paint_editor8.MIXING_PAD_WIDTH / (rect.width || import_paint_editor8.MIXING_PAD_WIDTH);
1066
- const ky = import_paint_editor8.MIXING_PAD_HEIGHT / (rect.height || import_paint_editor8.MIXING_PAD_HEIGHT);
1067
- const x = Math.min(import_paint_editor8.MIXING_PAD_WIDTH, Math.max(0, (e.clientX - rect.left) * kx));
1068
- const y = Math.min(import_paint_editor8.MIXING_PAD_HEIGHT, Math.max(0, (e.clientY - rect.top) * ky));
1090
+ const kx = import_paint_editor7.MIXING_PAD_WIDTH / (rect.width || import_paint_editor7.MIXING_PAD_WIDTH);
1091
+ const ky = import_paint_editor7.MIXING_PAD_HEIGHT / (rect.height || import_paint_editor7.MIXING_PAD_HEIGHT);
1092
+ const x = Math.min(import_paint_editor7.MIXING_PAD_WIDTH, Math.max(0, (e.clientX - rect.left) * kx));
1093
+ const y = Math.min(import_paint_editor7.MIXING_PAD_HEIGHT, Math.max(0, (e.clientY - rect.top) * ky));
1069
1094
  return e.pointerType === "pen" && e.pressure > 0 ? { x, y, pressure: e.pressure } : { x, y };
1070
1095
  };
1071
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "color-panel", children: [
1072
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "relative self-center", style: { width: wheelSize, height: wheelSize }, children: [
1073
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1096
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "color-panel", children: [
1097
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative self-center", style: { width: wheelSize, height: wheelSize }, children: [
1098
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1074
1099
  "div",
1075
1100
  {
1076
1101
  role: "slider",
1077
1102
  "aria-label": "Hue wheel",
1078
1103
  "aria-valuemin": 0,
1079
1104
  "aria-valuemax": 360,
1080
- "aria-valuenow": Math.round((0, import_paint_editor8.hueToWheel)(hsv.h, wheel)),
1105
+ "aria-valuenow": Math.round((0, import_paint_editor7.hueToWheel)(hsv.h, wheel)),
1081
1106
  tabIndex: 0,
1082
1107
  className: "absolute inset-0 cursor-crosshair",
1083
1108
  onPointerDown: (e) => {
1084
1109
  const rect = e.currentTarget.getBoundingClientRect();
1085
- controller.setColor((0, import_paint_editor8.wheelPick)(e.clientX - rect.left - R, e.clientY - rect.top - R, wheel, color));
1110
+ controller.setColor((0, import_paint_editor7.wheelPick)(e.clientX - rect.left - R, e.clientY - rect.top - R, wheel, color));
1086
1111
  },
1087
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PixelCanvas, { pixels: ring, label: "Colour wheel", style: { width: wheelSize, height: wheelSize } })
1112
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PixelCanvas, { pixels: ring, label: "Colour wheel", style: { width: wheelSize, height: wheelSize } })
1088
1113
  }
1089
1114
  ),
1090
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { className: "pointer-events-none absolute inset-0", width: wheelSize, height: wheelSize, "aria-hidden": "true", children: harmony.map((h, i) => {
1091
- const p = (0, import_paint_editor8.wheelPoint)(h.angle, mid);
1092
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: R + p.x, cy: R + p.y, r: i === 0 ? 7 : 5, fill: h.color, stroke: "#fff", strokeWidth: i === 0 ? 2 : 1 }, i);
1115
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { className: "pointer-events-none absolute inset-0", width: wheelSize, height: wheelSize, "aria-hidden": "true", children: harmony.map((h, i) => {
1116
+ const p = (0, import_paint_editor7.wheelPoint)(h.angle, mid);
1117
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("circle", { cx: R + p.x, cy: R + p.y, r: i === 0 ? 7 : 5, fill: h.color, stroke: "#fff", strokeWidth: i === 0 ? 2 : 1 }, i);
1093
1118
  }) }),
1094
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "absolute rounded-full border border-slate-700", style: { left: R - R * 0.45, top: R - R * 0.45, width: R * 0.9, height: R * 0.9, background: color } })
1119
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "absolute rounded-full border border-slate-700", style: { left: R - R * 0.45, top: R - R * 0.45, width: R * 0.9, height: R * 0.9, background: color } })
1095
1120
  ] }),
1096
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2", children: [
1097
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "color", "aria-label": "Paint colour", value: color, onChange: (e) => controller.setColor(e.target.value), className: "h-7 w-9 rounded bg-transparent" }),
1098
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "color", "aria-label": "Second colour", value: state.secondaryColor, onChange: (e) => controller.setSecondaryColor(e.target.value), className: "h-5 w-7 rounded bg-transparent" }),
1099
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: button, title: "Swap colours (X)", onClick: () => controller.swapColors(), children: "Swap" }),
1100
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1121
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
1122
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { type: "color", "aria-label": "Paint colour", value: color, onChange: (e) => controller.setColor(e.target.value), className: "h-7 w-9 rounded bg-transparent" }),
1123
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { type: "color", "aria-label": "Second colour", value: state.secondaryColor, onChange: (e) => controller.setSecondaryColor(e.target.value), className: "h-5 w-7 rounded bg-transparent" }),
1124
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, title: "Swap colours (X)", onClick: () => controller.swapColors(), children: "Swap" }),
1125
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1101
1126
  "input",
1102
1127
  {
1103
1128
  "aria-label": "Hex colour",
@@ -1108,49 +1133,49 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1108
1133
  color
1109
1134
  )
1110
1135
  ] }),
1111
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2", "data-testid": "paint-source", children: [
1112
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1136
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", "data-testid": "paint-source", children: [
1137
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1113
1138
  "span",
1114
1139
  {
1115
1140
  className: "h-5 flex-1 rounded ring-1 ring-slate-700",
1116
1141
  "aria-label": state.effectPaint ? `Effect paint: ${state.effectPaint.effect}` : state.paint.type === "gradient" ? "Gradient paint" : "Paint colour",
1117
1142
  "data-testid": "paint-well",
1118
1143
  "data-effect-paint": state.effectPaint ? state.effectPaint.effect : void 0,
1119
- style: { background: effectWell ? `center / cover no-repeat url("${effectWell}")` : (0, import_paint_editor9.paintSourceCss)(state.paint, { paint: color, secondary: state.secondaryColor }) }
1144
+ style: { background: effectWell ? `center / cover no-repeat url("${effectWell}")` : (0, import_paint_editor8.paintSourceCss)(state.paint, { paint: color, secondary: state.secondaryColor }) }
1120
1145
  }
1121
1146
  ),
1122
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1147
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1123
1148
  "button",
1124
1149
  {
1125
1150
  type: "button",
1126
1151
  className: chip(state.paint.type === "gradient"),
1127
1152
  "aria-pressed": state.paint.type === "gradient",
1128
1153
  title: "Paint that changes colour as the stroke goes",
1129
- onClick: () => attempt(() => state.paint.type === "gradient" ? controller.setColor(color) : controller.setPaint(import_paint_editor9.DEFAULT_PAINT_GRADIENT)),
1154
+ onClick: () => attempt(() => state.paint.type === "gradient" ? controller.setColor(color) : controller.setPaint(import_paint_editor8.DEFAULT_PAINT_GRADIENT)),
1130
1155
  children: "Gradient"
1131
1156
  }
1132
1157
  )
1133
1158
  ] }),
1134
- state.paint.type === "gradient" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaintGradientEditor, { value: state.paint, colors: { paint: color, secondary: state.secondaryColor }, onChange: (g2) => attempt(() => controller.setPaint(g2)) }),
1135
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex items-center gap-2", children: [
1136
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "w-16 text-slate-400", children: "Saturation" }),
1137
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "range", "aria-label": "Saturation", min: 0, max: 1, step: 0.01, value: hsv.s, onChange: (e) => setHsv(Number(e.target.value), hsv.v), className: "flex-1 accent-indigo-500" })
1159
+ state.paint.type === "gradient" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PaintGradientEditor, { value: state.paint, colors: { paint: color, secondary: state.secondaryColor }, onChange: (g2) => attempt(() => controller.setPaint(g2)) }),
1160
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center gap-2", children: [
1161
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w-16 text-slate-400", children: "Saturation" }),
1162
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { type: "range", "aria-label": "Saturation", min: 0, max: 1, step: 0.01, value: hsv.s, onChange: (e) => setHsv(Number(e.target.value), hsv.v), className: "flex-1 accent-indigo-500" })
1138
1163
  ] }),
1139
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex items-center gap-2", children: [
1140
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "w-16 text-slate-400", children: "Value" }),
1141
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "range", "aria-label": "Value", min: 0, max: 1, step: 0.01, value: hsv.v, onChange: (e) => setHsv(hsv.s, Number(e.target.value)), className: "flex-1 accent-indigo-500" })
1164
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center gap-2", children: [
1165
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w-16 text-slate-400", children: "Value" }),
1166
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { type: "range", "aria-label": "Value", min: 0, max: 1, step: 0.01, value: hsv.v, onChange: (e) => setHsv(hsv.s, Number(e.target.value)), className: "flex-1 accent-indigo-500" })
1142
1167
  ] }),
1143
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", children: [
1144
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("select", { "aria-label": "Harmony", value: kind, onChange: (e) => setKind(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor8.HARMONY_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: k, children: k }, k)) }),
1145
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: chip(wheel === "ryb"), "aria-pressed": wheel === "ryb", onClick: () => setWheel("ryb"), children: "RYB" }),
1146
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: chip(wheel === "rgb"), "aria-pressed": wheel === "rgb", onClick: () => setWheel("rgb"), children: "RGB" })
1168
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1", children: [
1169
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("select", { "aria-label": "Harmony", value: kind, onChange: (e) => setKind(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor7.HARMONY_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: k, children: k }, k)) }),
1170
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: chip(wheel === "ryb"), "aria-pressed": wheel === "ryb", onClick: () => setWheel("ryb"), children: "RYB" }),
1171
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: chip(wheel === "rgb"), "aria-pressed": wheel === "rgb", onClick: () => setWheel("rgb"), children: "RGB" })
1147
1172
  ] }),
1148
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-wrap gap-1", "aria-label": "Harmony colours", children: [
1149
- harmony.map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", "aria-label": `Use ${h.color}`, title: h.color, className: "h-6 w-6 rounded ring-1 ring-slate-700", style: { background: h.color }, onClick: () => controller.setColor(h.color) }, i)),
1150
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: button, onClick: () => harmony.forEach((h) => controller.addSwatch(h.color)), children: "+ swatches" })
1173
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap gap-1", "aria-label": "Harmony colours", children: [
1174
+ harmony.map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", "aria-label": `Use ${h.color}`, title: h.color, className: "h-6 w-6 rounded ring-1 ring-slate-700", style: { background: h.color }, onClick: () => controller.setColor(h.color) }, i)),
1175
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, onClick: () => harmony.forEach((h) => controller.addSwatch(h.color)), children: "+ swatches" })
1151
1176
  ] }),
1152
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": "Swatches", children: [
1153
- state.swatches.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1177
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": "Swatches", children: [
1178
+ state.swatches.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1154
1179
  "button",
1155
1180
  {
1156
1181
  type: "button",
@@ -1159,7 +1184,7 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1159
1184
  "aria-label": s.name ?? (s.paint ? "Gradient" : s.color),
1160
1185
  title: `${s.name ?? (s.paint ? "Gradient" : s.color)} (right-click to remove)`,
1161
1186
  className: "h-5 w-5 rounded ring-1 ring-slate-700",
1162
- style: { background: s.paint ? (0, import_paint_editor9.paintSourceCss)(s.paint, { paint: color, secondary: state.secondaryColor }) : s.color },
1187
+ style: { background: s.paint ? (0, import_paint_editor8.paintSourceCss)(s.paint, { paint: color, secondary: state.secondaryColor }) : s.color },
1163
1188
  onClick: () => attempt(() => s.paint ? controller.setPaint(s.paint) : controller.setColor(s.color)),
1164
1189
  onContextMenu: (e) => {
1165
1190
  e.preventDefault();
@@ -1168,15 +1193,15 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1168
1193
  },
1169
1194
  i
1170
1195
  )),
1171
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: button, "aria-label": "Add swatch", onClick: () => attempt(() => controller.addSwatch(state.paint)), children: "+" })
1196
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, "aria-label": "Add swatch", onClick: () => attempt(() => controller.addSwatch(state.paint)), children: "+" })
1172
1197
  ] }),
1173
- mixingPad && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col gap-1", "data-testid": "mixing-pad", children: [
1174
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", children: [
1175
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-slate-400", children: "Mixing pad" }),
1176
- ["paint", "knife", "pick"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", "aria-pressed": padTool === t, className: chip(padTool === t), onClick: () => setPadTool(t), children: t === "paint" ? "Paint" : t === "knife" ? "Knife" : "Pick" }, t)),
1177
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: button, onClick: () => controller.clearMixingPad(), children: "Clear" })
1198
+ mixingPad && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-col gap-1", "data-testid": "mixing-pad", children: [
1199
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1", children: [
1200
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-slate-400", children: "Mixing pad" }),
1201
+ ["paint", "knife", "pick"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", "aria-pressed": padTool === t, className: chip(padTool === t), onClick: () => setPadTool(t), children: t === "paint" ? "Paint" : t === "knife" ? "Knife" : "Pick" }, t)),
1202
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, onClick: () => controller.clearMixingPad(), children: "Clear" })
1178
1203
  ] }),
1179
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1204
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1180
1205
  "div",
1181
1206
  {
1182
1207
  role: "application",
@@ -1185,7 +1210,7 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1185
1210
  onPointerDown: (e) => {
1186
1211
  const p = padPoint(e);
1187
1212
  if (padTool === "pick") {
1188
- attempt(() => controller.mixingPadPick(p.x, p.y, { setColor: true, radius: (0, import_paint_editor8.padSampleRadius)(sample) }));
1213
+ attempt(() => controller.mixingPadPick(p.x, p.y, { setColor: true, radius: (0, import_paint_editor7.padSampleRadius)(sample) }));
1189
1214
  return;
1190
1215
  }
1191
1216
  padPoints.current = [p];
@@ -1197,20 +1222,20 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1197
1222
  padPoints.current = null;
1198
1223
  if (pts?.length) attempt(() => controller.mixingPadStroke(pts, { tool: padTool === "knife" ? "knife" : "paint" }));
1199
1224
  },
1200
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PixelCanvas, { pixels: pad, label: "Mixing pad pixels", className: "w-full rounded", style: { aspectRatio: `${import_paint_editor8.MIXING_PAD_WIDTH} / ${import_paint_editor8.MIXING_PAD_HEIGHT}` } })
1225
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PixelCanvas, { pixels: pad, label: "Mixing pad pixels", className: "w-full rounded", style: { aspectRatio: `${import_paint_editor7.MIXING_PAD_WIDTH} / ${import_paint_editor7.MIXING_PAD_HEIGHT}` } })
1201
1226
  }
1202
1227
  ),
1203
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-wrap items-center gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex items-center gap-1", children: [
1204
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-slate-400", children: "Sample" }),
1205
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("select", { "aria-label": "Pick sample size", value: sample, onChange: (e) => setSample(Number(e.target.value)), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor8.PAD_SAMPLE_SIZES.map((n) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: n, children: n === 1 ? "1 px" : `${n}\xD7${n}` }, n)) })
1228
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex flex-wrap items-center gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center gap-1", children: [
1229
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-slate-400", children: "Sample" }),
1230
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("select", { "aria-label": "Pick sample size", value: sample, onChange: (e) => setSample(Number(e.target.value)), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor7.PAD_SAMPLE_SIZES.map((n) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: n, children: n === 1 ? "1 px" : `${n}\xD7${n}` }, n)) })
1206
1231
  ] }) }),
1207
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1208
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: color } }),
1209
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "number", "aria-label": "Paint colour parts", min: 0, max: 20, value: parts[0], onChange: (e) => setParts([Number(e.target.value), parts[1]]), className: "w-10 rounded bg-slate-800 px-1 py-0.5" }),
1210
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-slate-500", children: ":" }),
1211
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "number", "aria-label": "Second colour parts", min: 0, max: 20, value: parts[1], onChange: (e) => setParts([parts[0], Number(e.target.value)]), className: "w-10 rounded bg-slate-800 px-1 py-0.5" }),
1212
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: state.secondaryColor } }),
1213
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1232
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1233
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: color } }),
1234
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { type: "number", "aria-label": "Paint colour parts", min: 0, max: 20, value: parts[0], onChange: (e) => setParts([Number(e.target.value), parts[1]]), className: "w-10 rounded bg-slate-800 px-1 py-0.5" }),
1235
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-slate-500", children: ":" }),
1236
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { type: "number", "aria-label": "Second colour parts", min: 0, max: 20, value: parts[1], onChange: (e) => setParts([parts[0], Number(e.target.value)]), className: "w-10 rounded bg-slate-800 px-1 py-0.5" }),
1237
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: state.secondaryColor } }),
1238
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1214
1239
  "button",
1215
1240
  {
1216
1241
  type: "button",
@@ -1229,25 +1254,25 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1229
1254
  }
1230
1255
  )
1231
1256
  ] }),
1232
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1233
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { value: padName, placeholder: "Pad name", "aria-label": "Pad name", onChange: (e) => setPadName(e.target.value), className: "w-24 rounded bg-slate-800 px-1.5 py-0.5" }),
1234
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.saveMixingPad(padName || void 0), setPadName(""))), children: "Keep pad" })
1257
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1258
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { value: padName, placeholder: "Pad name", "aria-label": "Pad name", onChange: (e) => setPadName(e.target.value), className: "w-24 rounded bg-slate-800 px-1.5 py-0.5" }),
1259
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.saveMixingPad(padName || void 0), setPadName(""))), children: "Keep pad" })
1235
1260
  ] }),
1236
- state.savedMixingPads.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { className: "flex flex-col gap-0.5", "aria-label": "Kept pads", children: state.savedMixingPads.map((p) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("li", { className: "flex items-center gap-1", children: [
1237
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: `${button} flex-1 text-left`, onClick: () => attempt(() => controller.loadMixingPad(p.id)), children: p.name }),
1238
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: button, "aria-label": `Remove ${p.name}`, onClick: () => attempt(() => controller.removeMixingPad(p.id)), children: "\xD7" })
1261
+ state.savedMixingPads.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { className: "flex flex-col gap-0.5", "aria-label": "Kept pads", children: state.savedMixingPads.map((p) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("li", { className: "flex items-center gap-1", children: [
1262
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: `${button} flex-1 text-left`, onClick: () => attempt(() => controller.loadMixingPad(p.id)), children: p.name }),
1263
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, "aria-label": `Remove ${p.name}`, onClick: () => attempt(() => controller.removeMixingPad(p.id)), children: "\xD7" })
1239
1264
  ] }, p.id)) })
1240
1265
  ] }),
1241
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ErrorLine, { error })
1266
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ErrorLine, { error })
1242
1267
  ] });
1243
1268
  };
1244
1269
 
1245
1270
  // src/paint-editor/PaintLayersPanel.tsx
1246
- var import_react13 = require("react");
1247
- var import_paint_editor10 = require("@pixerate/editor/paint-editor");
1271
+ var import_react15 = require("react");
1272
+ var import_paint_editor9 = require("@pixerate/editor/paint-editor");
1248
1273
 
1249
1274
  // src/image-editor/LayerEffectsPanel.tsx
1250
- var import_react12 = require("react");
1275
+ var import_react14 = require("react");
1251
1276
  var import_raster = require("@pixerate/editor/raster");
1252
1277
 
1253
1278
  // src/image-editor/styles.ts
@@ -1256,17 +1281,17 @@ var imageSelectClass = "rounded border border-input bg-background px-1.5 py-1 te
1256
1281
  var imageColorInputClass = "h-6 w-8 rounded border border-border bg-transparent";
1257
1282
 
1258
1283
  // src/image-editor/controls/controls.tsx
1259
- var import_react11 = require("react");
1260
- var import_jsx_runtime11 = require("react/jsx-runtime");
1261
- var ControlsContext = (0, import_react11.createContext)({});
1284
+ var import_react13 = require("react");
1285
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1286
+ var ControlsContext = (0, import_react13.createContext)({});
1262
1287
  function useImageEditorControls() {
1263
- return (0, import_react11.useContext)(ControlsContext);
1288
+ return (0, import_react13.useContext)(ControlsContext);
1264
1289
  }
1265
1290
  function ImageCheckbox(props) {
1266
1291
  const Host = useImageEditorControls().Checkbox;
1267
- if (Host) return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Host, { ...props });
1292
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Host, { ...props });
1268
1293
  const { checked, label, disabled, onChange, className = "" } = props;
1269
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1294
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1270
1295
  "input",
1271
1296
  {
1272
1297
  type: "checkbox",
@@ -1280,9 +1305,9 @@ function ImageCheckbox(props) {
1280
1305
  }
1281
1306
  function ImageRange(props) {
1282
1307
  const Host = useImageEditorControls().Range;
1283
- if (Host) return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Host, { ...props });
1308
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Host, { ...props });
1284
1309
  const { value, min, max, step, label, disabled, onChange, onStart, onEnd, className = "" } = props;
1285
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1310
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1286
1311
  "input",
1287
1312
  {
1288
1313
  type: "range",
@@ -1303,18 +1328,18 @@ function ImageRange(props) {
1303
1328
  }
1304
1329
  function ImageSelect(props) {
1305
1330
  const Host = useImageEditorControls().Select;
1306
- if (Host) return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Host, { ...props });
1331
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Host, { ...props });
1307
1332
  const { value, options, label, placeholder, disabled, onChange, className = "" } = props;
1308
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("select", { "aria-label": label, value, disabled, onChange: (e) => onChange(e.target.value), className: `${imageSelectClass} ${className}`, children: [
1309
- placeholder !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "", children: placeholder }),
1310
- options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: o.value, children: o.label }, o.value))
1333
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("select", { "aria-label": label, value, disabled, onChange: (e) => onChange(e.target.value), className: `${imageSelectClass} ${className}`, children: [
1334
+ placeholder !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "", children: placeholder }),
1335
+ options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: o.value, children: o.label }, o.value))
1311
1336
  ] });
1312
1337
  }
1313
1338
  function ImageColor(props) {
1314
1339
  const Host = useImageEditorControls().Color;
1315
- if (Host) return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Host, { ...props });
1340
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Host, { ...props });
1316
1341
  const { value, label, alpha, disabled, onChange, className = "" } = props;
1317
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1342
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1318
1343
  "input",
1319
1344
  {
1320
1345
  type: "color",
@@ -1328,13 +1353,13 @@ function ImageColor(props) {
1328
1353
  }
1329
1354
 
1330
1355
  // src/image-editor/LayerEffectsPanel.tsx
1331
- var import_jsx_runtime12 = require("react/jsx-runtime");
1356
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1332
1357
  var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) => {
1333
- const [, setTick] = (0, import_react12.useState)(0);
1334
- (0, import_react12.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
1335
- const [open, setOpen] = (0, import_react12.useState)(null);
1336
- const [error, setError] = (0, import_react12.useState)(null);
1337
- const commitNext = (0, import_react12.useRef)(true);
1358
+ const [, setTick] = (0, import_react14.useState)(0);
1359
+ (0, import_react14.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
1360
+ const [open, setOpen] = (0, import_react14.useState)(null);
1361
+ const [error, setError] = (0, import_react14.useState)(null);
1362
+ const commitNext = (0, import_react14.useRef)(true);
1338
1363
  const layer = layerId ? controller.getLayer(layerId) : controller.getActiveLayer();
1339
1364
  const model = (0, import_raster.layerEffectsPanel)(layer);
1340
1365
  const id = layer?.id;
@@ -1347,7 +1372,7 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1347
1372
  }
1348
1373
  };
1349
1374
  if (!model.available || !id) {
1350
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `text-xs text-muted-foreground ${className ?? ""}`, "data-testid": "layer-effects", children: model.reason });
1375
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: `text-xs text-muted-foreground ${className ?? ""}`, "data-testid": "layer-effects", children: model.reason });
1351
1376
  }
1352
1377
  const effects = controller.getLayerEffects(id);
1353
1378
  const patterns = controller.getDocumentPatterns();
@@ -1362,14 +1387,14 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1362
1387
  case "range": {
1363
1388
  const k = c.percent ? 100 : 1;
1364
1389
  const shown = Math.round(c.value * k * 100) / 100;
1365
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1366
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "text-muted-foreground", children: [
1390
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1391
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "text-muted-foreground", children: [
1367
1392
  label,
1368
1393
  " ",
1369
1394
  shown,
1370
1395
  c.unit
1371
1396
  ] }),
1372
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1397
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1373
1398
  ImageRange,
1374
1399
  {
1375
1400
  label,
@@ -1386,19 +1411,19 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1386
1411
  ] }, c.key);
1387
1412
  }
1388
1413
  case "color":
1389
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1390
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ImageColor, { label, value: c.value, disabled: model.readOnly, onChange: (v) => change(effectId, c, v) }),
1414
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1415
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ImageColor, { label, value: c.value, disabled: model.readOnly, onChange: (v) => change(effectId, c, v) }),
1391
1416
  label
1392
1417
  ] }, c.key);
1393
1418
  case "checkbox":
1394
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1395
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ImageCheckbox, { label, checked: c.value, disabled: model.readOnly, onChange: (on) => change(effectId, c, on) }),
1419
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1420
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ImageCheckbox, { label, checked: c.value, disabled: model.readOnly, onChange: (on) => change(effectId, c, on) }),
1396
1421
  label
1397
1422
  ] }, c.key);
1398
1423
  case "select":
1399
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1400
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-muted-foreground", children: label }),
1401
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1424
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1425
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-muted-foreground", children: label }),
1426
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1402
1427
  ImageSelect,
1403
1428
  {
1404
1429
  label,
@@ -1411,16 +1436,16 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1411
1436
  ] }, c.key);
1412
1437
  }
1413
1438
  };
1414
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-foreground ${className ?? ""}`, "data-testid": "layer-effects", "aria-label": "Layer style", role: "group", children: [
1415
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
1416
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "font-semibold text-foreground", children: heading ? "Layer Style" : "Styles" }),
1417
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
1418
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ImageCheckbox, { label: "Effects on", checked: model.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.setLayerEffectsEnabled(id, on)) }),
1439
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-foreground ${className ?? ""}`, "data-testid": "layer-effects", "aria-label": "Layer style", role: "group", children: [
1440
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
1441
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "font-semibold text-foreground", children: heading ? "Layer Style" : "Styles" }),
1442
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
1443
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ImageCheckbox, { label: "Effects on", checked: model.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.setLayerEffectsEnabled(id, on)) }),
1419
1444
  "On"
1420
1445
  ] }),
1421
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
1446
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
1422
1447
  "Scale",
1423
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1448
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1424
1449
  "input",
1425
1450
  {
1426
1451
  type: "number",
@@ -1439,7 +1464,7 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1439
1464
  ),
1440
1465
  "%"
1441
1466
  ] }),
1442
- heading && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1467
+ heading && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1443
1468
  ImageSelect,
1444
1469
  {
1445
1470
  label: "Add style",
@@ -1455,14 +1480,14 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1455
1480
  }
1456
1481
  )
1457
1482
  ] }),
1458
- model.readOnly && model.reason && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-muted-foreground", children: model.reason }),
1459
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Effects", children: model.rows.map((row) => {
1483
+ model.readOnly && model.reason && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-muted-foreground", children: model.reason }),
1484
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Effects", children: model.rows.map((row) => {
1460
1485
  const effect = effects.items.find((e) => e.id === row.id);
1461
1486
  const expanded = open === row.id;
1462
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("li", { "data-effect-id": row.id, className: "rounded bg-background/60 ring-1 ring-border", children: [
1463
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1.5 px-1.5 py-1", children: [
1464
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ImageCheckbox, { label: `${row.label} on`, checked: row.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.updateLayerEffect(id, row.id, { enabled: on })) }),
1465
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1487
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("li", { "data-effect-id": row.id, className: "rounded bg-background/60 ring-1 ring-border", children: [
1488
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1.5 px-1.5 py-1", children: [
1489
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ImageCheckbox, { label: `${row.label} on`, checked: row.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.updateLayerEffect(id, row.id, { enabled: on })) }),
1490
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1466
1491
  "button",
1467
1492
  {
1468
1493
  type: "button",
@@ -1472,17 +1497,17 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1472
1497
  children: row.label
1473
1498
  }
1474
1499
  ),
1475
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: imageIconButtonClass, "aria-label": `Remove ${row.label}`, disabled: model.readOnly, onClick: () => attempt(() => controller.removeLayerEffect(id, row.id)), children: "\u2715" })
1500
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: imageIconButtonClass, "aria-label": `Remove ${row.label}`, disabled: model.readOnly, onClick: () => attempt(() => controller.removeLayerEffect(id, row.id)), children: "\u2715" })
1476
1501
  ] }),
1477
- expanded && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 px-1.5 pb-1.5", "data-testid": "effect-settings", children: (0, import_raster.layerEffectControls)(effect, patterns).map((c) => renderControl(row.id, c)) })
1502
+ expanded && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 px-1.5 pb-1.5", "data-testid": "effect-settings", children: (0, import_raster.layerEffectControls)(effect, patterns).map((c) => renderControl(row.id, c)) })
1478
1503
  ] }, row.id);
1479
1504
  }) }),
1480
- error && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { role: "alert", className: "text-destructive", children: error })
1505
+ error && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { role: "alert", className: "text-destructive", children: error })
1481
1506
  ] });
1482
1507
  };
1483
1508
 
1484
1509
  // src/paint-editor/PaintLayersPanel.tsx
1485
- var import_jsx_runtime13 = require("react/jsx-runtime");
1510
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1486
1511
  function siblingIndex(layers, l) {
1487
1512
  const sibs = layers.filter((x) => x.parentId === l.parentId).reverse();
1488
1513
  return { index: sibs.findIndex((x) => x.id === l.id), count: sibs.length };
@@ -1490,7 +1515,7 @@ function siblingIndex(layers, l) {
1490
1515
  var PaintLayersPanel = ({ controller, className }) => {
1491
1516
  usePaintEditorState(controller);
1492
1517
  const [error, attempt] = useAttempt();
1493
- const [renaming, setRenaming] = (0, import_react13.useState)(null);
1518
+ const [renaming, setRenaming] = (0, import_react15.useState)(null);
1494
1519
  const layers = controller.listLayers();
1495
1520
  const active = layers.find((l) => l.active) ?? null;
1496
1521
  const light = active?.type === "pixel" ? controller.lightOf(active.id) : null;
@@ -1500,18 +1525,18 @@ var PaintLayersPanel = ({ controller, className }) => {
1500
1525
  const to = Math.min(count - 1, Math.max(0, index + delta));
1501
1526
  if (to !== index) attempt(() => controller.moveLayer(active.id, to));
1502
1527
  };
1503
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-layers-panel", children: [
1504
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1505
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer()), children: "New layer" }),
1506
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer({ type: "group" })), children: "New group" }),
1507
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: button, title: "A layer whose strokes stay editable", onClick: () => attempt(() => controller.addLayer({ type: "strokes" })), children: "New stroke layer" }),
1508
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.duplicateLayer(active.id)), children: "Duplicate" }),
1509
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer up", onClick: () => move(1), children: "\u2191" }),
1510
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer down", onClick: () => move(-1), children: "\u2193" }),
1511
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.mergeDown(active.id)), children: "Merge down" }),
1512
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: button, disabled: !active || layers.length < 2, onClick: () => active && attempt(() => controller.removeLayer(active.id)), children: "Delete" })
1528
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-layers-panel", children: [
1529
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1530
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer()), children: "New layer" }),
1531
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer({ type: "group" })), children: "New group" }),
1532
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, title: "A layer whose strokes stay editable", onClick: () => attempt(() => controller.addLayer({ type: "strokes" })), children: "New stroke layer" }),
1533
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.duplicateLayer(active.id)), children: "Duplicate" }),
1534
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer up", onClick: () => move(1), children: "\u2191" }),
1535
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer down", onClick: () => move(-1), children: "\u2193" }),
1536
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.mergeDown(active.id)), children: "Merge down" }),
1537
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, disabled: !active || layers.length < 2, onClick: () => active && attempt(() => controller.removeLayer(active.id)), children: "Delete" })
1513
1538
  ] }),
1514
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ul", { role: "tree", "aria-label": "Layers", className: "flex flex-col gap-0.5", children: layers.map((l) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1539
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ul", { role: "tree", "aria-label": "Layers", className: "flex flex-col gap-0.5", children: layers.map((l) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1515
1540
  "li",
1516
1541
  {
1517
1542
  role: "treeitem",
@@ -1520,7 +1545,7 @@ var PaintLayersPanel = ({ controller, className }) => {
1520
1545
  style: { paddingLeft: 6 + l.depth * 12 },
1521
1546
  onClick: () => controller.setActiveLayer(l.id),
1522
1547
  children: [
1523
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1548
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1524
1549
  "button",
1525
1550
  {
1526
1551
  type: "button",
@@ -1533,7 +1558,7 @@ var PaintLayersPanel = ({ controller, className }) => {
1533
1558
  children: l.visible ? "\u25CF" : "\u25CB"
1534
1559
  }
1535
1560
  ),
1536
- renaming === l.id ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1561
+ renaming === l.id ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1537
1562
  "input",
1538
1563
  {
1539
1564
  autoFocus: true,
@@ -1550,23 +1575,23 @@ var PaintLayersPanel = ({ controller, className }) => {
1550
1575
  if (e.key === "Escape") setRenaming(null);
1551
1576
  }
1552
1577
  }
1553
- ) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "flex-1 truncate", onDoubleClick: () => setRenaming(l.id), children: [
1578
+ ) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "flex-1 truncate", onDoubleClick: () => setRenaming(l.id), children: [
1554
1579
  l.type === "group" ? "\u25B8 " : "",
1555
- l.liveStrokes !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { "aria-label": "Stroke layer", title: `Stroke layer: ${l.liveStrokes} editable strokes`, children: [
1580
+ l.liveStrokes !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { "aria-label": "Stroke layer", title: `Stroke layer: ${l.liveStrokes} editable strokes`, children: [
1556
1581
  "\u270E",
1557
1582
  " "
1558
1583
  ] }),
1559
1584
  l.name
1560
1585
  ] }),
1561
- l.locks.pixels || l.locks.all ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { title: "Locked", children: "\u{1F512}" }) : null
1586
+ l.locks.pixels || l.locks.all ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { title: "Locked", children: "\u{1F512}" }) : null
1562
1587
  ]
1563
1588
  },
1564
1589
  l.id
1565
1590
  )) }),
1566
- active && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
1567
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center gap-2", children: [
1568
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "w-14 text-slate-400", children: "Opacity" }),
1569
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1591
+ active && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
1592
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-2", children: [
1593
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-14 text-slate-400", children: "Opacity" }),
1594
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1570
1595
  "input",
1571
1596
  {
1572
1597
  type: "range",
@@ -1580,40 +1605,40 @@ var PaintLayersPanel = ({ controller, className }) => {
1580
1605
  }
1581
1606
  )
1582
1607
  ] }),
1583
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center gap-2", children: [
1584
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "w-14 text-slate-400", children: "Blend" }),
1585
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("select", { "aria-label": "Layer blend", value: active.blend, onChange: (e) => attempt(() => controller.updateLayer(active.id, { blend: e.target.value })), className: "flex-1 rounded bg-slate-800 px-1 py-0.5", children: [
1586
- active.type === "group" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "pass-through", children: "Pass through" }),
1587
- import_paint_editor10.BLEND_MENU_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("optgroup", { label: g.label, children: g.modes.map((m) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: m.id, title: m.description, children: m.label }, m.id)) }, g.label))
1608
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-2", children: [
1609
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-14 text-slate-400", children: "Blend" }),
1610
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("select", { "aria-label": "Layer blend", value: active.blend, onChange: (e) => attempt(() => controller.updateLayer(active.id, { blend: e.target.value })), className: "flex-1 rounded bg-slate-800 px-1 py-0.5", children: [
1611
+ active.type === "group" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "pass-through", children: "Pass through" }),
1612
+ import_paint_editor9.BLEND_MENU_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("optgroup", { label: g.label, children: g.modes.map((m) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: m.id, title: m.description, children: m.label }, m.id)) }, g.label))
1588
1613
  ] })
1589
1614
  ] }),
1590
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex gap-1", children: [
1591
- ["pixels", "transparency"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", "aria-pressed": Boolean(active.locks[k]), className: chip(Boolean(active.locks[k])), onClick: () => attempt(() => controller.updateLayer(active.id, { locks: { [k]: !active.locks[k] } })), children: k === "pixels" ? "Lock pixels" : "Lock transparency" }, k)),
1592
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", "aria-pressed": active.clipped, className: chip(active.clipped), onClick: () => attempt(() => controller.updateLayer(active.id, { clipped: !active.clipped })), children: "Clip" })
1615
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex gap-1", children: [
1616
+ ["pixels", "transparency"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", "aria-pressed": Boolean(active.locks[k]), className: chip(Boolean(active.locks[k])), onClick: () => attempt(() => controller.updateLayer(active.id, { locks: { [k]: !active.locks[k] } })), children: k === "pixels" ? "Lock pixels" : "Lock transparency" }, k)),
1617
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", "aria-pressed": active.clipped, className: chip(active.clipped), onClick: () => attempt(() => controller.updateLayer(active.id, { clipped: !active.clipped })), children: "Clip" })
1593
1618
  ] }),
1594
- light?.hasLight && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col gap-1.5 border-t border-slate-800 pt-1.5", "data-testid": "layer-light", children: [
1595
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center justify-between", children: [
1596
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "font-medium text-slate-300", title: "This layer's paint gives off light", children: "Light" }),
1597
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.clearLight(active.id)), children: "Clear light" })
1619
+ light?.hasLight && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-col gap-1.5 border-t border-slate-800 pt-1.5", "data-testid": "layer-light", children: [
1620
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center justify-between", children: [
1621
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "font-medium text-slate-300", title: "This layer's paint gives off light", children: "Light" }),
1622
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.clearLight(active.id)), children: "Clear light" })
1598
1623
  ] }),
1599
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center gap-2", title: "How far the light spills onto the paint and paper around it (0 turns it off)", children: [
1600
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "w-14 text-slate-400", children: "Spill" }),
1601
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "range", "aria-label": "Light spill radius", min: 0, max: 120, step: 1, value: light.spill.radius, onChange: (e) => attempt(() => controller.setLightSpill(active.id, { radius: Number(e.target.value) })), className: "flex-1 accent-indigo-500" })
1624
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-2", title: "How far the light spills onto the paint and paper around it (0 turns it off)", children: [
1625
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-14 text-slate-400", children: "Spill" }),
1626
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "range", "aria-label": "Light spill radius", min: 0, max: 120, step: 1, value: light.spill.radius, onChange: (e) => attempt(() => controller.setLightSpill(active.id, { radius: Number(e.target.value) })), className: "flex-1 accent-indigo-500" })
1602
1627
  ] }),
1603
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center gap-2", children: [
1604
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "w-14 text-slate-400", children: "Strength" }),
1605
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "range", "aria-label": "Light spill strength", min: 0, max: 2, step: 0.05, value: light.spill.strength, onChange: (e) => attempt(() => controller.setLightSpill(active.id, { strength: Number(e.target.value) })), className: "flex-1 accent-indigo-500" })
1628
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-2", children: [
1629
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-14 text-slate-400", children: "Strength" }),
1630
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "range", "aria-label": "Light spill strength", min: 0, max: 2, step: 0.05, value: light.spill.strength, onChange: (e) => attempt(() => controller.setLightSpill(active.id, { strength: Number(e.target.value) })), className: "flex-1 accent-indigo-500" })
1606
1631
  ] })
1607
1632
  ] }),
1608
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "border-t border-slate-800 pt-1.5", "data-testid": "paint-layer-effects", title: "Live layer styles drawn from this layer's paint: glows, shadows, strokes", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LayerEffectsPanel, { controller, layerId: active.id }) })
1633
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "border-t border-slate-800 pt-1.5", "data-testid": "paint-layer-effects", title: "Live layer styles drawn from this layer's paint: glows, shadows, strokes", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(LayerEffectsPanel, { controller, layerId: active.id }) })
1609
1634
  ] }),
1610
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ErrorLine, { error })
1635
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ErrorLine, { error })
1611
1636
  ] });
1612
1637
  };
1613
1638
 
1614
1639
  // src/paint-editor/WetPanel.tsx
1615
- var import_paint_editor11 = require("@pixerate/editor/paint-editor");
1616
- var import_jsx_runtime14 = require("react/jsx-runtime");
1640
+ var import_paint_editor10 = require("@pixerate/editor/paint-editor");
1641
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1617
1642
  var FLOW_LABELS = { none: "None", linear: "One way", swirl: "Swirl", radial: "Outwards", turbulent: "Eddies" };
1618
1643
  var WetPanel = ({ controller, className }) => {
1619
1644
  const state = usePaintEditorState(controller);
@@ -1622,31 +1647,31 @@ var WetPanel = ({ controller, className }) => {
1622
1647
  const layerId = state.document.activeLayerId;
1623
1648
  const info = layerId ? controller.wetLayerInfo(layerId) : null;
1624
1649
  const backend = controller.wetState();
1625
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "wet-panel", children: [
1626
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center justify-between", children: [
1627
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: wet.wet ? "text-sky-300" : "text-slate-400", "data-testid": "wet-status", children: wet.wet ? wet.paused ? "Wet (paused)" : "Wet" : "Dry" }),
1628
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "text-[10px] text-slate-500", children: [
1650
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "wet-panel", children: [
1651
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center justify-between", children: [
1652
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: wet.wet ? "text-sky-300" : "text-slate-400", "data-testid": "wet-status", children: wet.wet ? wet.paused ? "Wet (paused)" : "Wet" : "Dry" }),
1653
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "text-[10px] text-slate-500", children: [
1629
1654
  "step ",
1630
1655
  wet.clock
1631
1656
  ] })
1632
1657
  ] }),
1633
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1634
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, disabled: !wet.layerIds.length, onClick: () => attempt(async () => (await controller.wetIdle(), controller.dryPaint())), children: "Dry now" }),
1635
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: chip(wet.paused), "aria-pressed": wet.paused, onClick: () => controller.setWetPaused(!wet.paused), children: wet.paused ? "Resume" : "Pause" }),
1636
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: chip(wet.overlay), "aria-pressed": wet.overlay, onClick: () => controller.setWaterOverlay(!wet.overlay), children: "Water" }),
1637
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: chip(wet.instantDry), "aria-pressed": wet.instantDry, title: "Each wet stroke dries as soon as it ends", onClick: () => controller.setInstantDry(!wet.instantDry), children: "Instant dry" }),
1638
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, disabled: !layerId, onClick: () => attempt(async () => (await controller.wetIdle(), controller.wetPaper({}))), children: "Wet paper" })
1658
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1659
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: button, disabled: !wet.layerIds.length, onClick: () => attempt(async () => (await controller.wetIdle(), controller.dryPaint())), children: "Dry now" }),
1660
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: chip(wet.paused), "aria-pressed": wet.paused, onClick: () => controller.setWetPaused(!wet.paused), children: wet.paused ? "Resume" : "Pause" }),
1661
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: chip(wet.overlay), "aria-pressed": wet.overlay, onClick: () => controller.setWaterOverlay(!wet.overlay), children: "Water" }),
1662
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: chip(wet.instantDry), "aria-pressed": wet.instantDry, title: "Each wet stroke dries as soon as it ends", onClick: () => controller.setInstantDry(!wet.instantDry), children: "Instant dry" }),
1663
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: button, disabled: !layerId, onClick: () => attempt(async () => (await controller.wetIdle(), controller.wetPaper({}))), children: "Wet paper" })
1639
1664
  ] }),
1640
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PaintSlider, { control: import_paint_editor11.WET_SPEED_SLIDER, value: wet.speed, onChange: (v) => controller.setWetSpeed(v) }),
1641
- import_paint_editor11.WET_TILT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor11.readPath)(wet.tilt, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setCanvasTilt({ [c.path]: v }))) }, c.path)),
1642
- info && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-layer", children: [
1643
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "font-medium text-slate-300", children: "This layer" }),
1644
- import_paint_editor11.WET_PARAM_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor11.readPath)(info.params, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setWetParams(layerId, { [c.path]: v }))) }, c.path)),
1645
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
1646
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-slate-400", children: "Flow map" }),
1647
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("select", { "aria-label": "Flow map", value: info.flow.kind, onChange: (e) => attempt(async () => (await controller.wetIdle(), controller.setFlowMap(layerId, { kind: e.target.value }))), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor11.WET_FLOW_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: k, children: FLOW_LABELS[k] }, k)) })
1665
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PaintSlider, { control: import_paint_editor10.WET_SPEED_SLIDER, value: wet.speed, onChange: (v) => controller.setWetSpeed(v) }),
1666
+ import_paint_editor10.WET_TILT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor10.readPath)(wet.tilt, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setCanvasTilt({ [c.path]: v }))) }, c.path)),
1667
+ info && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-layer", children: [
1668
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "font-medium text-slate-300", children: "This layer" }),
1669
+ import_paint_editor10.WET_PARAM_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor10.readPath)(info.params, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setWetParams(layerId, { [c.path]: v }))) }, c.path)),
1670
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
1671
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-slate-400", children: "Flow map" }),
1672
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("select", { "aria-label": "Flow map", value: info.flow.kind, onChange: (e) => attempt(async () => (await controller.wetIdle(), controller.setFlowMap(layerId, { kind: e.target.value }))), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor10.WET_FLOW_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: k, children: FLOW_LABELS[k] }, k)) })
1648
1673
  ] }),
1649
- info.flow.kind !== "none" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1674
+ info.flow.kind !== "none" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1650
1675
  PaintSlider,
1651
1676
  {
1652
1677
  control: { path: "strength", label: "Flow strength", min: 0, max: 1, step: 0.01 },
@@ -1655,20 +1680,20 @@ var WetPanel = ({ controller, className }) => {
1655
1680
  }
1656
1681
  )
1657
1682
  ] }),
1658
- backend.message && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[10px] text-amber-300", "data-testid": "wet-message", children: backend.message }),
1659
- backend.backend && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[10px] text-slate-500", children: backend.backend.kind === "wasm-threads" ? `WebAssembly, ${backend.backend.threads} threads` : backend.backend.kind === "wasm" ? "WebAssembly, one thread" : "JavaScript" }),
1660
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
1661
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-slate-400", children: "Engine" }),
1662
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("select", { "aria-label": "Wet engine", value: wet.gpu, onChange: (e) => attempt(() => controller.setWetEngine({ gpu: e.target.value })), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor11.WET_GPU_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: o.value, children: o.label }, o.value)) })
1683
+ backend.message && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[10px] text-amber-300", "data-testid": "wet-message", children: backend.message }),
1684
+ backend.backend && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[10px] text-slate-500", children: backend.backend.kind === "wasm-threads" ? `WebAssembly, ${backend.backend.threads} threads` : backend.backend.kind === "wasm" ? "WebAssembly, one thread" : "JavaScript" }),
1685
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
1686
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-slate-400", children: "Engine" }),
1687
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("select", { "aria-label": "Wet engine", value: wet.gpu, onChange: (e) => attempt(() => controller.setWetEngine({ gpu: e.target.value })), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor10.WET_GPU_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: o.value, children: o.label }, o.value)) })
1663
1688
  ] }),
1664
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: `text-[10px] ${backend.engine.state === "active" ? "text-emerald-300" : "text-slate-500"}`, "data-testid": "wet-engine", children: (0, import_paint_editor11.wetEngineSummary)(backend.engine) }),
1665
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ErrorLine, { error })
1689
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: `text-[10px] ${backend.engine.state === "active" ? "text-emerald-300" : "text-slate-500"}`, "data-testid": "wet-engine", children: (0, import_paint_editor10.wetEngineSummary)(backend.engine) }),
1690
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ErrorLine, { error })
1666
1691
  ] });
1667
1692
  };
1668
1693
 
1669
1694
  // src/paint-editor/StickerPanel.tsx
1670
- var import_paint_editor12 = require("@pixerate/editor/paint-editor");
1671
- var import_jsx_runtime15 = require("react/jsx-runtime");
1695
+ var import_paint_editor11 = require("@pixerate/editor/paint-editor");
1696
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1672
1697
  var StickerPanel = ({ controller, className }) => {
1673
1698
  const state = usePaintEditorState(controller);
1674
1699
  const [error, attempt] = useAttempt();
@@ -1678,16 +1703,16 @@ var StickerPanel = ({ controller, className }) => {
1678
1703
  const stickers = layerId ? state.document.stickers?.[layerId] ?? [] : [];
1679
1704
  if (!stickers.length) return null;
1680
1705
  const sel = stickers.find((s) => s.id === picked) ?? null;
1681
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "sticker-panel", children: [
1682
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "font-medium text-slate-300", children: [
1706
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "sticker-panel", children: [
1707
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "font-medium text-slate-300", children: [
1683
1708
  "Stickers (",
1684
1709
  stickers.length,
1685
1710
  ")"
1686
1711
  ] }),
1687
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex max-h-24 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Stickers", children: stickers.map((s) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", role: "option", "aria-selected": s.id === picked, title: `${(0, import_paint_editor12.stickerRefLabel)(s.ref)} ${s.id}`, className: `h-5 w-5 rounded ring-1 ${s.id === picked ? "ring-indigo-400" : "ring-slate-700"}`, style: { background: s.color }, onClick: () => setPicked(s.id) }, s.id)) }),
1688
- sel && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "sticker-edit", children: [
1689
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-slate-400", children: "Sticker" }),
1690
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1712
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex max-h-24 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Stickers", children: stickers.map((s) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", role: "option", "aria-selected": s.id === picked, title: `${(0, import_paint_editor11.stickerRefLabel)(s.ref)} ${s.id}`, className: `h-5 w-5 rounded ring-1 ${s.id === picked ? "ring-indigo-400" : "ring-slate-700"}`, style: { background: s.color }, onClick: () => setPicked(s.id) }, s.id)) }),
1713
+ sel && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "sticker-edit", children: [
1714
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-slate-400", children: "Sticker" }),
1715
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1691
1716
  StickerPicker,
1692
1717
  {
1693
1718
  controller,
@@ -1701,9 +1726,9 @@ var StickerPanel = ({ controller, className }) => {
1701
1726
  )
1702
1727
  }
1703
1728
  ),
1704
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
1705
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-slate-400", children: "Position" }),
1706
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "flex gap-1", children: ["x", "y"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1729
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
1730
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-slate-400", children: "Position" }),
1731
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "flex gap-1", children: ["x", "y"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1707
1732
  "input",
1708
1733
  {
1709
1734
  type: "number",
@@ -1717,24 +1742,24 @@ var StickerPanel = ({ controller, className }) => {
1717
1742
  `${sel.id}-${k}-${sel[k]}`
1718
1743
  )) })
1719
1744
  ] }),
1720
- import_paint_editor12.STICKER_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor12.readPath)(sel, c.path), onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { [c.path]: v })) }, c.path)),
1721
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center justify-between", children: [
1722
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-slate-400", children: "Colour" }),
1723
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CommitColorInput, { label: "Sticker colour", value: sel.color, onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { color: v })), className: "h-6 w-10 rounded bg-transparent" })
1745
+ import_paint_editor11.STICKER_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor11.readPath)(sel, c.path), onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { [c.path]: v })) }, c.path)),
1746
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center justify-between", children: [
1747
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-slate-400", children: "Colour" }),
1748
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CommitColorInput, { label: "Sticker colour", value: sel.color, onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { color: v })), className: "h-6 w-10 rounded bg-transparent" })
1724
1749
  ] }),
1725
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1726
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "front")), children: "To front" }),
1727
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "back")), children: "To back" }),
1728
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStickers(layerId, [sel.id]), setPicked(null))), children: "Delete" })
1750
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1751
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "front")), children: "To front" }),
1752
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "back")), children: "To back" }),
1753
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStickers(layerId, [sel.id]), setPicked(null))), children: "Delete" })
1729
1754
  ] })
1730
1755
  ] }),
1731
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ErrorLine, { error })
1756
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ErrorLine, { error })
1732
1757
  ] });
1733
1758
  };
1734
1759
 
1735
1760
  // src/paint-editor/StrokePanel.tsx
1736
- var import_paint_editor13 = require("@pixerate/editor/paint-editor");
1737
- var import_jsx_runtime16 = require("react/jsx-runtime");
1761
+ var import_paint_editor12 = require("@pixerate/editor/paint-editor");
1762
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1738
1763
  var StrokePanel = ({ controller, className }) => {
1739
1764
  const state = usePaintEditorState(controller);
1740
1765
  const [error, attempt] = useAttempt();
@@ -1743,17 +1768,17 @@ var StrokePanel = ({ controller, className }) => {
1743
1768
  if (!layerId || !strokes) return null;
1744
1769
  const index = strokes.findIndex((s) => s.id === state.selectedStroke);
1745
1770
  const sel = index >= 0 ? strokes[index] : null;
1746
- const brushes = state.brushes.filter((b) => !(0, import_paint_editor13.liveStrokeRefusal)(b));
1747
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "stroke-panel", children: [
1748
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center justify-between", children: [
1749
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "font-medium text-slate-300", children: [
1771
+ const brushes = state.brushes.filter((b) => !(0, import_paint_editor12.liveStrokeRefusal)(b));
1772
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "stroke-panel", children: [
1773
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center justify-between", children: [
1774
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "font-medium text-slate-300", children: [
1750
1775
  "Strokes (",
1751
1776
  strokes.length,
1752
1777
  ")"
1753
1778
  ] }),
1754
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.rasterizeLiveStrokes(layerId)), children: "Rasterize" })
1779
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.rasterizeLiveStrokes(layerId)), children: "Rasterize" })
1755
1780
  ] }),
1756
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex max-h-24 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Strokes", children: strokes.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1781
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex max-h-24 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Strokes", children: strokes.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1757
1782
  "button",
1758
1783
  {
1759
1784
  type: "button",
@@ -1766,10 +1791,10 @@ var StrokePanel = ({ controller, className }) => {
1766
1791
  },
1767
1792
  s.id
1768
1793
  )) }),
1769
- sel && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "stroke-edit", children: [
1770
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
1771
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-slate-400", children: "Brush" }),
1772
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
1794
+ sel && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "stroke-edit", children: [
1795
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
1796
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-slate-400", children: "Brush" }),
1797
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1773
1798
  "select",
1774
1799
  {
1775
1800
  "aria-label": "Stroke brush",
@@ -1777,51 +1802,51 @@ var StrokePanel = ({ controller, className }) => {
1777
1802
  onChange: (e) => e.target.value && attempt(() => controller.updateStroke(sel.id, { brushId: e.target.value })),
1778
1803
  className: "max-w-[10rem] rounded bg-slate-800 px-1 py-0.5",
1779
1804
  children: [
1780
- !brushes.some((b) => b.id === sel.brush.id) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "", children: sel.brush.name }),
1781
- brushes.map((b) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: b.id, children: b.name }, b.id))
1805
+ !brushes.some((b) => b.id === sel.brush.id) && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "", children: sel.brush.name }),
1806
+ brushes.map((b) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: b.id, children: b.name }, b.id))
1782
1807
  ]
1783
1808
  }
1784
1809
  )
1785
1810
  ] }),
1786
- import_paint_editor13.STROKE_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor13.readPath)(sel.brush, c.path), onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { brush: { tip: { [c.path.split(".")[1]]: v } } })) }, c.path)),
1787
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center justify-between", children: [
1788
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-slate-400", children: "Colour" }),
1789
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CommitColorInput, { label: "Stroke colour", value: sel.color, onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { color: v })), className: "h-6 w-10 rounded bg-transparent" })
1811
+ import_paint_editor12.STROKE_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor12.readPath)(sel.brush, c.path), onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { brush: { tip: { [c.path.split(".")[1]]: v } } })) }, c.path)),
1812
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center justify-between", children: [
1813
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-slate-400", children: "Colour" }),
1814
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CommitColorInput, { label: "Stroke colour", value: sel.color, onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { color: v })), className: "h-6 w-10 rounded bg-transparent" })
1790
1815
  ] }),
1791
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1792
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.updateStroke(sel.id, { seed: (sel.seed + 1) % 2147483647 })), children: "New seed" }),
1793
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: button, disabled: index === strokes.length - 1, "aria-label": "Move stroke up", onClick: () => attempt(() => controller.reorderStroke(sel.id, index + 1)), children: "\u2191" }),
1794
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: button, disabled: index === 0, "aria-label": "Move stroke down", onClick: () => attempt(() => controller.reorderStroke(sel.id, index - 1)), children: "\u2193" }),
1795
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStrokes([sel.id]), controller.selectStroke(null))), children: "Delete" })
1816
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1817
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.updateStroke(sel.id, { seed: (sel.seed + 1) % 2147483647 })), children: "New seed" }),
1818
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, disabled: index === strokes.length - 1, "aria-label": "Move stroke up", onClick: () => attempt(() => controller.reorderStroke(sel.id, index + 1)), children: "\u2191" }),
1819
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, disabled: index === 0, "aria-label": "Move stroke down", onClick: () => attempt(() => controller.reorderStroke(sel.id, index - 1)), children: "\u2193" }),
1820
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStrokes([sel.id]), controller.selectStroke(null))), children: "Delete" })
1796
1821
  ] })
1797
1822
  ] }),
1798
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ErrorLine, { error })
1823
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ErrorLine, { error })
1799
1824
  ] });
1800
1825
  };
1801
1826
 
1802
1827
  // src/paint-editor/PaintEditor.tsx
1803
- var import_react27 = require("react");
1804
- var import_paint_editor15 = require("@pixerate/editor/paint-editor");
1828
+ var import_react29 = require("react");
1829
+ var import_paint_editor14 = require("@pixerate/editor/paint-editor");
1805
1830
 
1806
1831
  // src/playback/AgentPlaybackContext.tsx
1807
- var import_react14 = require("react");
1808
- var import_jsx_runtime17 = require("react/jsx-runtime");
1809
- var AgentPlaybackContext = (0, import_react14.createContext)(null);
1832
+ var import_react16 = require("react");
1833
+ var import_jsx_runtime19 = require("react/jsx-runtime");
1834
+ var AgentPlaybackContext = (0, import_react16.createContext)(null);
1810
1835
  function useAgentPlayback() {
1811
- return (0, import_react14.useContext)(AgentPlaybackContext);
1836
+ return (0, import_react16.useContext)(AgentPlaybackContext);
1812
1837
  }
1813
1838
 
1814
1839
  // src/playback/usePlaybackSurface.ts
1815
- var import_react15 = require("react");
1840
+ var import_react17 = require("react");
1816
1841
  var import_tools = require("@pixerate/editor/tools");
1817
1842
  function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
1818
1843
  const ambient = useAgentPlayback();
1819
1844
  const target = playback === void 0 ? ambient : playback;
1820
- const [ownPresence] = (0, import_react15.useState)(() => new import_tools.PresenceStore());
1845
+ const [ownPresence] = (0, import_react17.useState)(() => new import_tools.PresenceStore());
1821
1846
  const presence = sharedPresence ?? ownPresence;
1822
- const latest = (0, import_react15.useRef)(options);
1847
+ const latest = (0, import_react17.useRef)(options);
1823
1848
  latest.current = options;
1824
- (0, import_react15.useEffect)(() => {
1849
+ (0, import_react17.useEffect)(() => {
1825
1850
  if (!target || !id) return;
1826
1851
  const o = () => latest.current;
1827
1852
  const surface = {
@@ -1853,13 +1878,13 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
1853
1878
  }
1854
1879
 
1855
1880
  // src/playback/PresenceLayer.tsx
1856
- var import_react16 = __toESM(require("react"), 1);
1857
- var import_jsx_runtime18 = require("react/jsx-runtime");
1881
+ var import_react18 = __toESM(require("react"), 1);
1882
+ var import_jsx_runtime20 = require("react/jsx-runtime");
1858
1883
  function PresenceLayer({ presence, viewport, clip = true, renderCursor, className = "" }) {
1859
- const { actors } = (0, import_react16.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
1884
+ const { actors } = (0, import_react18.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
1860
1885
  if (!actors.length) return null;
1861
1886
  const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
1862
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1887
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1863
1888
  "div",
1864
1889
  {
1865
1890
  className: `pixerate-presence ${className}`.trim(),
@@ -1873,19 +1898,19 @@ function PresenceLayer({ presence, viewport, clip = true, renderCursor, classNam
1873
1898
  const br = map({ x: a.focus.x + a.focus.width, y: a.focus.y + a.focus.height });
1874
1899
  return { left: tl.x - 4, top: tl.y - 4, width: br.x - tl.x + 8, height: br.y - tl.y + 8 };
1875
1900
  })();
1876
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react16.default.Fragment, { children: [
1877
- ring && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1901
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react18.default.Fragment, { children: [
1902
+ ring && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1878
1903
  "div",
1879
1904
  {
1880
1905
  "data-actor-focus": a.id,
1881
1906
  style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
1882
1907
  }
1883
1908
  ),
1884
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: renderCursor ? renderCursor(a) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
1885
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", { width: "18", height: "20", viewBox: "0 0 12 18", style: { display: "block", transform: a.pressed ? "scale(0.85)" : void 0, transformOrigin: "0 0", filter: "drop-shadow(0 1px 2px rgba(0,0,0,.35))" }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M0,0 L0,14 L4,10.5 L7,17 L9.5,16 L6.5,9.5 L11.5,9.5 Z", style: { fill: a.color, stroke: "#ffffff", strokeWidth: 1 } }) }),
1886
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
1887
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
1888
- a.message && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { "data-actor-message": a.id, style: { width: "max-content", maxWidth: 240, borderRadius: 8, borderTopLeftRadius: 0, padding: "4px 8px", fontSize: 12, color: "#1e293b", background: "#ffffff", boxShadow: "0 4px 12px rgba(15,23,42,.18)" }, children: a.message })
1909
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: renderCursor ? renderCursor(a) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
1910
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("svg", { width: "18", height: "20", viewBox: "0 0 12 18", style: { display: "block", transform: a.pressed ? "scale(0.85)" : void 0, transformOrigin: "0 0", filter: "drop-shadow(0 1px 2px rgba(0,0,0,.35))" }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("path", { d: "M0,0 L0,14 L4,10.5 L7,17 L9.5,16 L6.5,9.5 L11.5,9.5 Z", style: { fill: a.color, stroke: "#ffffff", strokeWidth: 1 } }) }),
1911
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
1912
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
1913
+ a.message && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { "data-actor-message": a.id, style: { width: "max-content", maxWidth: 240, borderRadius: 8, borderTopLeftRadius: 0, padding: "4px 8px", fontSize: 12, color: "#1e293b", background: "#ffffff", boxShadow: "0 4px 12px rgba(15,23,42,.18)" }, children: a.message })
1889
1914
  ] })
1890
1915
  ] }) })
1891
1916
  ] }, a.id);
@@ -1895,15 +1920,15 @@ function PresenceLayer({ presence, viewport, clip = true, renderCursor, classNam
1895
1920
  }
1896
1921
 
1897
1922
  // src/paint-editor/PaintEffectsPanel.tsx
1898
- var import_react26 = require("react");
1899
- var import_paint_editor14 = require("@pixerate/editor/paint-editor");
1923
+ var import_react28 = require("react");
1924
+ var import_paint_editor13 = require("@pixerate/editor/paint-editor");
1900
1925
 
1901
1926
  // src/effects/useEffects.ts
1902
- var import_react17 = require("react");
1927
+ var import_react19 = require("react");
1903
1928
  function useEffectDescription(provider, effect) {
1904
- const [state, setState] = (0, import_react17.useState)({ key: "", description: null, error: null });
1929
+ const [state, setState] = (0, import_react19.useState)({ key: "", description: null, error: null });
1905
1930
  const key = provider && effect ? `${provider.id}:${effect}` : "";
1906
- (0, import_react17.useEffect)(() => {
1931
+ (0, import_react19.useEffect)(() => {
1907
1932
  if (!provider || !effect) return;
1908
1933
  let live = true;
1909
1934
  Promise.resolve().then(() => provider.describe(effect)).then(
@@ -1918,14 +1943,14 @@ function useEffectDescription(provider, effect) {
1918
1943
  }
1919
1944
 
1920
1945
  // src/effects/EffectThumbnail.tsx
1921
- var import_react18 = require("react");
1946
+ var import_react20 = require("react");
1922
1947
  var import_effects = require("@pixerate/editor/effects");
1923
- var import_jsx_runtime19 = require("react/jsx-runtime");
1924
- var LABELS = { motion: "Motion", camera: "Camera" };
1948
+ var import_jsx_runtime21 = require("react/jsx-runtime");
1949
+ var LABELS = { motion: "Motion", camera: "Camera", timing: "Timing" };
1925
1950
  function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
1926
- const ref = (0, import_react18.useRef)(null);
1927
- const [failed, setFailed] = (0, import_react18.useState)(effect.kind in LABELS);
1928
- (0, import_react18.useEffect)(() => {
1951
+ const ref = (0, import_react20.useRef)(null);
1952
+ const [failed, setFailed] = (0, import_react20.useState)(effect.kind in LABELS);
1953
+ (0, import_react20.useEffect)(() => {
1929
1954
  if (effect.kind in LABELS) return;
1930
1955
  let live = true;
1931
1956
  (0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
@@ -1940,28 +1965,28 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
1940
1965
  live = false;
1941
1966
  };
1942
1967
  }, [provider, effect, width, height]);
1943
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1968
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1944
1969
  "div",
1945
1970
  {
1946
1971
  className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
1947
1972
  style: { aspectRatio: `${width} / ${height}` },
1948
1973
  "data-effect-thumbnail": effect.id,
1949
- children: failed ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: LABELS[effect.kind] ?? "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
1974
+ children: failed ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: LABELS[effect.kind] ?? "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
1950
1975
  }
1951
1976
  );
1952
1977
  }
1953
1978
 
1954
1979
  // src/effects/EffectsBrowser.tsx
1955
- var import_react19 = require("react");
1980
+ var import_react21 = require("react");
1956
1981
  var import_effects2 = require("@pixerate/editor/effects");
1957
- var import_jsx_runtime20 = require("react/jsx-runtime");
1982
+ var import_jsx_runtime22 = require("react/jsx-runtime");
1958
1983
  function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
1959
- const [all, setAll] = (0, import_react19.useState)([]);
1960
- const [query, setQuery] = (0, import_react19.useState)("");
1961
- const [category, setCategory] = (0, import_react19.useState)("");
1962
- const [use, setUse] = (0, import_react19.useState)("");
1963
- const [error, setError] = (0, import_react19.useState)(null);
1964
- (0, import_react19.useEffect)(() => {
1984
+ const [all, setAll] = (0, import_react21.useState)([]);
1985
+ const [query, setQuery] = (0, import_react21.useState)("");
1986
+ const [category, setCategory] = (0, import_react21.useState)("");
1987
+ const [use, setUse] = (0, import_react21.useState)("");
1988
+ const [error, setError] = (0, import_react21.useState)(null);
1989
+ (0, import_react21.useEffect)(() => {
1965
1990
  if (!provider) return setAll([]);
1966
1991
  let live = true;
1967
1992
  Promise.resolve().then(() => provider.list()).then(
@@ -1972,8 +1997,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1972
1997
  live = false;
1973
1998
  };
1974
1999
  }, [provider]);
1975
- const [found, setFound] = (0, import_react19.useState)([]);
1976
- (0, import_react19.useEffect)(() => {
2000
+ const [found, setFound] = (0, import_react21.useState)([]);
2001
+ (0, import_react21.useEffect)(() => {
1977
2002
  if (!provider) return setFound([]);
1978
2003
  let live = true;
1979
2004
  Promise.resolve().then(() => provider.search(query, { ...category ? { category } : {}, ...use ? { use } : {} })).then((list) => live && setFound(list), () => live && setFound([]));
@@ -1982,14 +2007,14 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1982
2007
  };
1983
2008
  }, [provider, query, category, use]);
1984
2009
  const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses);
1985
- const categories = (0, import_react19.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
2010
+ const categories = (0, import_react21.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
1986
2011
  const shown = found.filter(allowed);
1987
2012
  if (!provider)
1988
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: `rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground ${className}`, "data-effects-browser": "", "data-effects-unavailable": "", children: "No effects provider is registered, so effects cannot be added. Effects already in the document are kept." });
1989
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
1990
- title && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("h3", { className: "text-xs font-semibold", children: title }),
1991
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1992
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2013
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: `rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground ${className}`, "data-effects-browser": "", "data-effects-unavailable": "", children: "No effects provider is registered, so effects cannot be added. Effects already in the document are kept." });
2014
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
2015
+ title && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h3", { className: "text-xs font-semibold", children: title }),
2016
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2017
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1993
2018
  "input",
1994
2019
  {
1995
2020
  type: "search",
@@ -2000,17 +2025,17 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2000
2025
  onChange: (e) => setQuery(e.currentTarget.value)
2001
2026
  }
2002
2027
  ),
2003
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Category", value: category, onChange: (e) => setCategory(e.currentTarget.value), children: [
2004
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "", children: "All categories" }),
2005
- categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: c, children: c }, c))
2028
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Category", value: category, onChange: (e) => setCategory(e.currentTarget.value), children: [
2029
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "", children: "All categories" }),
2030
+ categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: c, children: c }, c))
2006
2031
  ] }),
2007
- uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Use", value: use, onChange: (e) => setUse(e.currentTarget.value), children: [
2008
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "", children: "Any use" }),
2009
- uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
2032
+ uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Use", value: use, onChange: (e) => setUse(e.currentTarget.value), children: [
2033
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "", children: "Any use" }),
2034
+ uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
2010
2035
  ] })
2011
2036
  ] }),
2012
- error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
2013
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("ul", { className: "grid max-h-96 grid-cols-[repeat(auto-fill,minmax(6.5rem,1fr))] gap-1.5 overflow-y-auto", role: "list", children: shown.map((e) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2037
+ error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
2038
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("ul", { className: "grid max-h-96 grid-cols-[repeat(auto-fill,minmax(6.5rem,1fr))] gap-1.5 overflow-y-auto", role: "list", children: shown.map((e) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2014
2039
  "button",
2015
2040
  {
2016
2041
  type: "button",
@@ -2019,23 +2044,23 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2019
2044
  "data-effect-id": e.id,
2020
2045
  onClick: () => onPick(e),
2021
2046
  children: [
2022
- thumbnails && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EffectThumbnail, { provider, effect: e }),
2023
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
2024
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
2047
+ thumbnails && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EffectThumbnail, { provider, effect: e }),
2048
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
2049
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
2025
2050
  ]
2026
2051
  }
2027
2052
  ) }, e.id)) }),
2028
- !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
2053
+ !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
2029
2054
  ] });
2030
2055
  }
2031
2056
 
2032
2057
  // src/effects/EffectParameters.tsx
2033
- var import_react25 = __toESM(require("react"), 1);
2058
+ var import_react27 = __toESM(require("react"), 1);
2034
2059
  var import_effects3 = require("@pixerate/editor/effects");
2035
2060
  var import_parameters2 = require("@pixerate/editor/parameters");
2036
2061
 
2037
2062
  // src/parameters/fields.tsx
2038
- var import_react24 = require("react");
2063
+ var import_react26 = require("react");
2039
2064
  var import_parameters = require("@pixerate/editor/parameters");
2040
2065
 
2041
2066
  // src/color/index.ts
@@ -2048,9 +2073,9 @@ __export(color_exports, {
2048
2073
  });
2049
2074
 
2050
2075
  // src/color/ColorPicker.tsx
2051
- var import_react20 = require("react");
2076
+ var import_react22 = require("react");
2052
2077
  var import_color = require("@pixerate/editor/color");
2053
- var import_jsx_runtime21 = require("react/jsx-runtime");
2078
+ var import_jsx_runtime23 = require("react/jsx-runtime");
2054
2079
  var LOCAL_STORAGE_KEY = "pixerate:color:recent";
2055
2080
  function readLocalRecents() {
2056
2081
  try {
@@ -2088,24 +2113,24 @@ var ColorPicker = ({
2088
2113
  id,
2089
2114
  "aria-label": ariaLabel = "Color picker"
2090
2115
  }) => {
2091
- const generatedId = (0, import_react20.useId)();
2116
+ const generatedId = (0, import_react22.useId)();
2092
2117
  const pickerId = id || generatedId;
2093
- const [pickerState, setPickerState] = (0, import_react20.useState)(
2118
+ const [pickerState, setPickerState] = (0, import_react22.useState)(
2094
2119
  () => (0, import_color.pickerStateFromColor)(value) ?? DEFAULT_PICKER_STATE
2095
2120
  );
2096
- const stateRef = (0, import_react20.useRef)(pickerState);
2121
+ const stateRef = (0, import_react22.useRef)(pickerState);
2097
2122
  stateRef.current = pickerState;
2098
- (0, import_react20.useEffect)(() => {
2123
+ (0, import_react22.useEffect)(() => {
2099
2124
  const next = (0, import_color.pickerStateFromColor)(value, stateRef.current);
2100
2125
  if (next) {
2101
2126
  setPickerState(next);
2102
2127
  }
2103
2128
  }, [value]);
2104
- const [internalRecent, setInternalRecent] = (0, import_react20.useState)(
2129
+ const [internalRecent, setInternalRecent] = (0, import_react22.useState)(
2105
2130
  () => controlledRecent ? [] : readLocalRecents()
2106
2131
  );
2107
2132
  const activeRecent = controlledRecent ?? internalRecent;
2108
- const recordRecent = (0, import_react20.useCallback)(
2133
+ const recordRecent = (0, import_react22.useCallback)(
2109
2134
  (color) => {
2110
2135
  const updated = (0, import_color.pushRecentColor)(activeRecent, color, 12);
2111
2136
  if (!controlledRecent) {
@@ -2116,11 +2141,11 @@ var ColorPicker = ({
2116
2141
  },
2117
2142
  [activeRecent, controlledRecent, onRecentChange]
2118
2143
  );
2119
- const [textDraft, setTextDraft] = (0, import_react20.useState)(value);
2120
- const [isInvalid, setIsInvalid] = (0, import_react20.useState)(false);
2121
- const [isClipped, setIsClipped] = (0, import_react20.useState)(false);
2122
- const isTypingRef = (0, import_react20.useRef)(false);
2123
- (0, import_react20.useEffect)(() => {
2144
+ const [textDraft, setTextDraft] = (0, import_react22.useState)(value);
2145
+ const [isInvalid, setIsInvalid] = (0, import_react22.useState)(false);
2146
+ const [isClipped, setIsClipped] = (0, import_react22.useState)(false);
2147
+ const isTypingRef = (0, import_react22.useRef)(false);
2148
+ (0, import_react22.useEffect)(() => {
2124
2149
  if (!isTypingRef.current) {
2125
2150
  setTextDraft(value);
2126
2151
  setIsInvalid(false);
@@ -2128,11 +2153,11 @@ var ColorPicker = ({
2128
2153
  setIsClipped(Boolean(parsed && !(0, import_color.inSrgbGamut)(parsed)));
2129
2154
  }
2130
2155
  }, [value]);
2131
- const [hasEyeDropper, setHasEyeDropper] = (0, import_react20.useState)(false);
2132
- (0, import_react20.useEffect)(() => {
2156
+ const [hasEyeDropper, setHasEyeDropper] = (0, import_react22.useState)(false);
2157
+ (0, import_react22.useEffect)(() => {
2133
2158
  setHasEyeDropper(typeof window !== "undefined" && "EyeDropper" in window);
2134
2159
  }, []);
2135
- const emitColorChange = (0, import_react20.useCallback)(
2160
+ const emitColorChange = (0, import_react22.useCallback)(
2136
2161
  (nextState) => {
2137
2162
  setPickerState(nextState);
2138
2163
  const hex = (0, import_color.pickerStateToHex)(nextState, alpha);
@@ -2140,10 +2165,10 @@ var ColorPicker = ({
2140
2165
  },
2141
2166
  [alpha, onChange]
2142
2167
  );
2143
- const latest = (0, import_react20.useRef)({ emitColorChange, recordRecent, onGestureEnd, alpha });
2168
+ const latest = (0, import_react22.useRef)({ emitColorChange, recordRecent, onGestureEnd, alpha });
2144
2169
  latest.current = { emitColorChange, recordRecent, onGestureEnd, alpha };
2145
- const endDragRef = (0, import_react20.useRef)(null);
2146
- (0, import_react20.useEffect)(() => () => endDragRef.current?.(), []);
2170
+ const endDragRef = (0, import_react22.useRef)(null);
2171
+ (0, import_react22.useEffect)(() => () => endDragRef.current?.(), []);
2147
2172
  const startDrag = (e, next) => {
2148
2173
  if (disabled) return;
2149
2174
  e.preventDefault();
@@ -2245,7 +2270,7 @@ var ColorPicker = ({
2245
2270
  } catch {
2246
2271
  }
2247
2272
  };
2248
- const contrastResult = (0, import_react20.useMemo)(() => {
2273
+ const contrastResult = (0, import_react22.useMemo)(() => {
2249
2274
  if (!contrastAgainst) return null;
2250
2275
  const fg = (0, import_color.parseColor)(value);
2251
2276
  const bg = (0, import_color.parseColor)(contrastAgainst);
@@ -2257,7 +2282,7 @@ var ColorPicker = ({
2257
2282
  }, [value, contrastAgainst]);
2258
2283
  const currentHex = (0, import_color.pickerStateToHex)(pickerState, alpha);
2259
2284
  const liveDescription = `Selected color: ${value}${contrastResult ? `, contrast ${contrastResult.ratio.toFixed(1)}:1 against ${contrastAgainst}, ${contrastResult.aa ? "passes AA" : "fails AA"}` : ""}`;
2260
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2285
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2261
2286
  "div",
2262
2287
  {
2263
2288
  id: pickerId,
@@ -2281,7 +2306,7 @@ var ColorPicker = ({
2281
2306
  pointerEvents: disabled ? "none" : "auto"
2282
2307
  },
2283
2308
  children: [
2284
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2309
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2285
2310
  "span",
2286
2311
  {
2287
2312
  role: "status",
@@ -2300,7 +2325,7 @@ var ColorPicker = ({
2300
2325
  children: liveDescription
2301
2326
  }
2302
2327
  ),
2303
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2328
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2304
2329
  "div",
2305
2330
  {
2306
2331
  role: "slider",
@@ -2322,7 +2347,7 @@ var ColorPicker = ({
2322
2347
  touchAction: "none",
2323
2348
  outline: "none"
2324
2349
  },
2325
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2350
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2326
2351
  "div",
2327
2352
  {
2328
2353
  style: {
@@ -2342,7 +2367,7 @@ var ColorPicker = ({
2342
2367
  )
2343
2368
  }
2344
2369
  ),
2345
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2370
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2346
2371
  "div",
2347
2372
  {
2348
2373
  role: "slider",
@@ -2365,7 +2390,7 @@ var ColorPicker = ({
2365
2390
  touchAction: "none",
2366
2391
  outline: "none"
2367
2392
  },
2368
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2393
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2369
2394
  "div",
2370
2395
  {
2371
2396
  style: {
@@ -2385,7 +2410,7 @@ var ColorPicker = ({
2385
2410
  )
2386
2411
  }
2387
2412
  ),
2388
- alpha && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2413
+ alpha && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2389
2414
  "div",
2390
2415
  {
2391
2416
  role: "slider",
@@ -2411,7 +2436,7 @@ var ColorPicker = ({
2411
2436
  overflow: "hidden"
2412
2437
  },
2413
2438
  children: [
2414
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2439
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2415
2440
  "div",
2416
2441
  {
2417
2442
  style: {
@@ -2421,7 +2446,7 @@ var ColorPicker = ({
2421
2446
  }
2422
2447
  }
2423
2448
  ),
2424
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2449
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2425
2450
  "div",
2426
2451
  {
2427
2452
  style: {
@@ -2442,8 +2467,8 @@ var ColorPicker = ({
2442
2467
  ]
2443
2468
  }
2444
2469
  ),
2445
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
2446
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2470
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
2471
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2447
2472
  "div",
2448
2473
  {
2449
2474
  style: {
@@ -2457,7 +2482,7 @@ var ColorPicker = ({
2457
2482
  flexShrink: 0,
2458
2483
  border: "1px solid rgba(255,255,255,0.15)"
2459
2484
  },
2460
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2485
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2461
2486
  "div",
2462
2487
  {
2463
2488
  style: {
@@ -2469,7 +2494,7 @@ var ColorPicker = ({
2469
2494
  )
2470
2495
  }
2471
2496
  ),
2472
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2497
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2473
2498
  "input",
2474
2499
  {
2475
2500
  type: "text",
@@ -2499,7 +2524,7 @@ var ColorPicker = ({
2499
2524
  }
2500
2525
  }
2501
2526
  ),
2502
- hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2527
+ hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2503
2528
  "button",
2504
2529
  {
2505
2530
  type: "button",
@@ -2519,7 +2544,7 @@ var ColorPicker = ({
2519
2544
  color: "inherit",
2520
2545
  cursor: disabled ? "default" : "pointer"
2521
2546
  },
2522
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2547
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2523
2548
  "svg",
2524
2549
  {
2525
2550
  width: "14",
@@ -2531,16 +2556,16 @@ var ColorPicker = ({
2531
2556
  strokeLinecap: "round",
2532
2557
  strokeLinejoin: "round",
2533
2558
  children: [
2534
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "m19 11-8-8-8.5 8.5a2.12 2.12 0 0 0 0 3l2.5 2.5 1.5-1.5" }),
2535
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
2536
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "m14 6 4 4" })
2559
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "m19 11-8-8-8.5 8.5a2.12 2.12 0 0 0 0 3l2.5 2.5 1.5-1.5" }),
2560
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
2561
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "m14 6 4 4" })
2537
2562
  ]
2538
2563
  }
2539
2564
  )
2540
2565
  }
2541
2566
  )
2542
2567
  ] }),
2543
- isClipped && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2568
+ isClipped && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2544
2569
  "div",
2545
2570
  {
2546
2571
  role: "note",
@@ -2556,10 +2581,10 @@ var ColorPicker = ({
2556
2581
  borderRadius: "4px",
2557
2582
  alignSelf: "flex-start"
2558
2583
  },
2559
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
2584
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
2560
2585
  }
2561
2586
  ),
2562
- contrastResult && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2587
+ contrastResult && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2563
2588
  "div",
2564
2589
  {
2565
2590
  style: {
@@ -2573,15 +2598,15 @@ var ColorPicker = ({
2573
2598
  border: "1px solid rgba(255,255,255,0.1)"
2574
2599
  },
2575
2600
  children: [
2576
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { children: [
2601
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { children: [
2577
2602
  "Contrast: ",
2578
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("strong", { children: [
2603
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("strong", { children: [
2579
2604
  contrastResult.ratio.toFixed(2),
2580
2605
  ":1"
2581
2606
  ] })
2582
2607
  ] }),
2583
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
2584
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2608
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
2609
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2585
2610
  "span",
2586
2611
  {
2587
2612
  style: {
@@ -2594,7 +2619,7 @@ var ColorPicker = ({
2594
2619
  ]
2595
2620
  }
2596
2621
  ),
2597
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2622
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2598
2623
  "span",
2599
2624
  {
2600
2625
  style: {
@@ -2611,9 +2636,9 @@ var ColorPicker = ({
2611
2636
  ]
2612
2637
  }
2613
2638
  ),
2614
- swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2615
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
2616
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2639
+ swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2640
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
2641
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2617
2642
  "button",
2618
2643
  {
2619
2644
  type: "button",
@@ -2639,9 +2664,9 @@ var ColorPicker = ({
2639
2664
  `${color}-${idx}`
2640
2665
  )) })
2641
2666
  ] }),
2642
- activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2643
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
2644
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2667
+ activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2668
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
2669
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2645
2670
  "button",
2646
2671
  {
2647
2672
  type: "button",
@@ -2672,9 +2697,9 @@ var ColorPicker = ({
2672
2697
  };
2673
2698
 
2674
2699
  // src/color/DualColorPicker.tsx
2675
- var import_react21 = require("react");
2700
+ var import_react23 = require("react");
2676
2701
  var import_color2 = require("@pixerate/editor/color");
2677
- var import_jsx_runtime22 = require("react/jsx-runtime");
2702
+ var import_jsx_runtime24 = require("react/jsx-runtime");
2678
2703
  function DualColorPicker({
2679
2704
  value,
2680
2705
  onChange,
@@ -2689,8 +2714,8 @@ function DualColorPicker({
2689
2714
  disabled = false,
2690
2715
  className = ""
2691
2716
  }) {
2692
- const sameId = (0, import_react21.useId)();
2693
- const [internalScheme, setInternalScheme] = (0, import_react21.useState)("light");
2717
+ const sameId = (0, import_react23.useId)();
2718
+ const [internalScheme, setInternalScheme] = (0, import_react23.useState)("light");
2694
2719
  const activeScheme = controlledScheme ?? internalScheme;
2695
2720
  const handleSchemeSelect = (nextScheme) => {
2696
2721
  if (onSchemeChange) {
@@ -2701,7 +2726,7 @@ function DualColorPicker({
2701
2726
  };
2702
2727
  const dual = (0, import_color2.normalizeDualColor)(value) ?? { light: "#000000", dark: "#000000" };
2703
2728
  const isSame = dual.light.toLowerCase() === dual.dark.toLowerCase();
2704
- const [sameInBoth, setSameInBoth] = (0, import_react21.useState)(isSame);
2729
+ const [sameInBoth, setSameInBoth] = (0, import_react23.useState)(isSame);
2705
2730
  const handleSameToggle = (e) => {
2706
2731
  const nextSame = e.target.checked;
2707
2732
  setSameInBoth(nextSame);
@@ -2733,7 +2758,7 @@ function DualColorPicker({
2733
2758
  const activeColor = activeScheme === "dark" ? dual.dark : dual.light;
2734
2759
  const activeContrastTarget = contrastAgainst ? (0, import_color2.resolveColor)(contrastAgainst, activeScheme) ?? void 0 : void 0;
2735
2760
  const dualContrast = contrastAgainst && (0, import_color2.normalizeDualColor)(contrastAgainst) ? (0, import_color2.checkDualColorContrast)(dual, contrastAgainst) : null;
2736
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2761
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2737
2762
  "div",
2738
2763
  {
2739
2764
  className: `pixerate-dual-color-picker ${className}`,
@@ -2752,7 +2777,7 @@ function DualColorPicker({
2752
2777
  boxSizing: "border-box"
2753
2778
  },
2754
2779
  children: [
2755
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2780
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2756
2781
  "div",
2757
2782
  {
2758
2783
  role: "tablist",
@@ -2765,7 +2790,7 @@ function DualColorPicker({
2765
2790
  gap: "2px"
2766
2791
  },
2767
2792
  children: [
2768
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2793
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2769
2794
  "button",
2770
2795
  {
2771
2796
  type: "button",
@@ -2788,7 +2813,7 @@ function DualColorPicker({
2788
2813
  children: "Light"
2789
2814
  }
2790
2815
  ),
2791
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2816
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2792
2817
  "button",
2793
2818
  {
2794
2819
  type: "button",
@@ -2814,8 +2839,8 @@ function DualColorPicker({
2814
2839
  ]
2815
2840
  }
2816
2841
  ),
2817
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
2818
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2842
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
2843
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2819
2844
  "button",
2820
2845
  {
2821
2846
  type: "button",
@@ -2837,7 +2862,7 @@ function DualColorPicker({
2837
2862
  outline: "none"
2838
2863
  },
2839
2864
  children: [
2840
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2865
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2841
2866
  "span",
2842
2867
  {
2843
2868
  style: {
@@ -2849,11 +2874,11 @@ function DualColorPicker({
2849
2874
  }
2850
2875
  }
2851
2876
  ),
2852
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
2877
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
2853
2878
  ]
2854
2879
  }
2855
2880
  ),
2856
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2881
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2857
2882
  "button",
2858
2883
  {
2859
2884
  type: "button",
@@ -2875,7 +2900,7 @@ function DualColorPicker({
2875
2900
  outline: "none"
2876
2901
  },
2877
2902
  children: [
2878
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2903
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2879
2904
  "span",
2880
2905
  {
2881
2906
  style: {
@@ -2887,12 +2912,12 @@ function DualColorPicker({
2887
2912
  }
2888
2913
  }
2889
2914
  ),
2890
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
2915
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
2891
2916
  ]
2892
2917
  }
2893
2918
  )
2894
2919
  ] }),
2895
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2920
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2896
2921
  "div",
2897
2922
  {
2898
2923
  style: {
@@ -2903,7 +2928,7 @@ function DualColorPicker({
2903
2928
  padding: "2px 0"
2904
2929
  },
2905
2930
  children: [
2906
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2931
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2907
2932
  "label",
2908
2933
  {
2909
2934
  htmlFor: sameId,
@@ -2917,7 +2942,7 @@ function DualColorPicker({
2917
2942
  color: "#c4cad4"
2918
2943
  },
2919
2944
  children: [
2920
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2945
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2921
2946
  "input",
2922
2947
  {
2923
2948
  id: sameId,
@@ -2928,11 +2953,11 @@ function DualColorPicker({
2928
2953
  style: { cursor: disabled ? "not-allowed" : "pointer" }
2929
2954
  }
2930
2955
  ),
2931
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: "Same in both" })
2956
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "Same in both" })
2932
2957
  ]
2933
2958
  }
2934
2959
  ),
2935
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2960
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2936
2961
  "button",
2937
2962
  {
2938
2963
  type: "button",
@@ -2954,7 +2979,7 @@ function DualColorPicker({
2954
2979
  ]
2955
2980
  }
2956
2981
  ),
2957
- dualContrast && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2982
+ dualContrast && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2958
2983
  "div",
2959
2984
  {
2960
2985
  "data-testid": "dual-contrast-summary",
@@ -2968,20 +2993,20 @@ function DualColorPicker({
2968
2993
  color: "#8c95a6"
2969
2994
  },
2970
2995
  children: [
2971
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { children: [
2996
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { children: [
2972
2997
  "Light:",
2973
2998
  " ",
2974
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
2999
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
2975
3000
  dualContrast.light.ratio.toFixed(2),
2976
3001
  " (",
2977
3002
  dualContrast.light.level,
2978
3003
  ")"
2979
3004
  ] })
2980
3005
  ] }),
2981
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { children: [
3006
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { children: [
2982
3007
  "Dark:",
2983
3008
  " ",
2984
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3009
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
2985
3010
  dualContrast.dark.ratio.toFixed(2),
2986
3011
  " (",
2987
3012
  dualContrast.dark.level,
@@ -2991,7 +3016,7 @@ function DualColorPicker({
2991
3016
  ]
2992
3017
  }
2993
3018
  ),
2994
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3019
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2995
3020
  ColorPicker,
2996
3021
  {
2997
3022
  value: activeColor,
@@ -3010,7 +3035,7 @@ function DualColorPicker({
3010
3035
  }
3011
3036
 
3012
3037
  // src/color/useColorScheme.ts
3013
- var import_react22 = require("react");
3038
+ var import_react24 = require("react");
3014
3039
  var import_color3 = require("@pixerate/editor/color");
3015
3040
  function getSnapshot(attribute) {
3016
3041
  if (typeof window === "undefined" || typeof document === "undefined") {
@@ -3035,7 +3060,7 @@ function getServerSnapshot() {
3035
3060
  function useColorScheme(options) {
3036
3061
  const override = options?.override;
3037
3062
  const attribute = options?.attribute;
3038
- const subscribe = (0, import_react22.useMemo)(() => {
3063
+ const subscribe = (0, import_react24.useMemo)(() => {
3039
3064
  return (callback) => {
3040
3065
  if (typeof window === "undefined" || typeof document === "undefined") {
3041
3066
  return () => {
@@ -3061,7 +3086,7 @@ function useColorScheme(options) {
3061
3086
  };
3062
3087
  };
3063
3088
  }, [attribute]);
3064
- const detected = (0, import_react22.useSyncExternalStore)(
3089
+ const detected = (0, import_react24.useSyncExternalStore)(
3065
3090
  subscribe,
3066
3091
  () => getSnapshot(attribute),
3067
3092
  getServerSnapshot
@@ -3078,11 +3103,11 @@ function useResolvedColor(value, scheme) {
3078
3103
  __reExport(color_exports, require("@pixerate/editor/color"));
3079
3104
 
3080
3105
  // src/parameters/controls.tsx
3081
- var import_react23 = require("react");
3082
- var import_jsx_runtime23 = require("react/jsx-runtime");
3083
- var ParameterComponentsContext = (0, import_react23.createContext)({});
3106
+ var import_react25 = require("react");
3107
+ var import_jsx_runtime25 = require("react/jsx-runtime");
3108
+ var ParameterComponentsContext = (0, import_react25.createContext)({});
3084
3109
  function useParameterComponents() {
3085
- return (0, import_react23.useContext)(ParameterComponentsContext);
3110
+ return (0, import_react25.useContext)(ParameterComponentsContext);
3086
3111
  }
3087
3112
  function resolveParameterComponents(explicit, context) {
3088
3113
  return {
@@ -3094,7 +3119,7 @@ function resolveParameterComponents(explicit, context) {
3094
3119
  }
3095
3120
 
3096
3121
  // src/parameters/fields.tsx
3097
- var import_jsx_runtime24 = require("react/jsx-runtime");
3122
+ var import_jsx_runtime26 = require("react/jsx-runtime");
3098
3123
  var parameterInputStyle = import_parameters.parameterThemeStyles.input;
3099
3124
  var parameterSelectStyle = import_parameters.parameterThemeStyles.select;
3100
3125
  var parameterButtonStyle = import_parameters.parameterThemeStyles.button;
@@ -3103,9 +3128,9 @@ var parameterInputClass = "h-7 w-full min-w-0 rounded-md border border-input bg-
3103
3128
  var parameterButtonClass = "inline-flex h-7 items-center justify-center gap-1 rounded-md border border-input bg-background px-2 text-xs text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:pointer-events-none disabled:opacity-50";
3104
3129
  var rangeClass = "h-4 w-full min-w-0 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50";
3105
3130
  function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown, style, ...rest }) {
3106
- const inputRef = (0, import_react24.useRef)(null);
3107
- const lastCommitted = (0, import_react24.useRef)(null);
3108
- (0, import_react24.useLayoutEffect)(() => {
3131
+ const inputRef = (0, import_react26.useRef)(null);
3132
+ const lastCommitted = (0, import_react26.useRef)(null);
3133
+ (0, import_react26.useLayoutEffect)(() => {
3109
3134
  lastCommitted.current = null;
3110
3135
  const el = inputRef.current;
3111
3136
  if (el && el.value !== value) el.value = value;
@@ -3116,9 +3141,9 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
3116
3141
  onCommit(text, el);
3117
3142
  lastCommitted.current = el.value === text ? text : null;
3118
3143
  };
3119
- const commitRef = (0, import_react24.useRef)(commit);
3144
+ const commitRef = (0, import_react26.useRef)(commit);
3120
3145
  commitRef.current = commit;
3121
- (0, import_react24.useEffect)(() => {
3146
+ (0, import_react26.useEffect)(() => {
3122
3147
  const el = inputRef.current;
3123
3148
  if (!el) return;
3124
3149
  const change = () => commitRef.current(el);
@@ -3149,7 +3174,7 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
3149
3174
  if (typeof forwarded === "function") forwarded(el);
3150
3175
  else if (forwarded) forwarded.current = el;
3151
3176
  };
3152
- return multiline ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("textarea", { ...props, ref: setRef, className: `${props.className} h-auto min-h-[3.5rem] py-1` }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("input", { type: "text", ...props, ref: setRef });
3177
+ return multiline ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("textarea", { ...props, ref: setRef, className: `${props.className} h-auto min-h-[3.5rem] py-1` }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "text", ...props, ref: setRef });
3153
3178
  }
3154
3179
  var plainNumber = (field, value) => (0, import_parameters.formatParameterNumber)({ ...field, unit: void 0 }, value);
3155
3180
  function ParameterNumberInput(props) {
@@ -3183,9 +3208,9 @@ function ParameterNumberInput(props) {
3183
3208
  onCommit: handleCommit,
3184
3209
  onKeyDown: handleKeyDown
3185
3210
  };
3186
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
3187
- CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field) }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ParameterCommitInput, { ...inputProps }),
3188
- field.unit && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
3211
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
3212
+ CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field) }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ParameterCommitInput, { ...inputProps }),
3213
+ field.unit && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
3189
3214
  ] });
3190
3215
  }
3191
3216
  function ParameterSlider(props) {
@@ -3193,7 +3218,7 @@ function ParameterSlider(props) {
3193
3218
  const ctx = useParameterComponents();
3194
3219
  const resolved = resolveParameterComponents(components, ctx);
3195
3220
  const CustomSlider = resolved.slider;
3196
- const dragging = (0, import_react24.useRef)(false);
3221
+ const dragging = (0, import_react26.useRef)(false);
3197
3222
  const start = () => {
3198
3223
  if (dragging.current) return;
3199
3224
  dragging.current = true;
@@ -3204,7 +3229,7 @@ function ParameterSlider(props) {
3204
3229
  dragging.current = false;
3205
3230
  onGestureEnd?.();
3206
3231
  };
3207
- if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ParameterNumberInput, { ...props });
3232
+ if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ParameterNumberInput, { ...props });
3208
3233
  const step = (0, import_parameters.parameterStep)(field);
3209
3234
  const sliderProps = {
3210
3235
  "aria-label": (0, import_parameters.parameterLabel)(field),
@@ -3218,8 +3243,8 @@ function ParameterSlider(props) {
3218
3243
  className: rangeClass,
3219
3244
  style: parameterRangeStyle
3220
3245
  };
3221
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-2", children: [
3222
- CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3246
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-2", children: [
3247
+ CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3223
3248
  CustomSlider,
3224
3249
  {
3225
3250
  ...sliderProps,
@@ -3229,7 +3254,7 @@ function ParameterSlider(props) {
3229
3254
  onGestureStart: start,
3230
3255
  onGestureEnd: end
3231
3256
  }
3232
- ) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3257
+ ) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3233
3258
  "input",
3234
3259
  {
3235
3260
  type: "range",
@@ -3241,11 +3266,11 @@ function ParameterSlider(props) {
3241
3266
  onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field, Number(e.target.value)))
3242
3267
  }
3243
3268
  ),
3244
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
3269
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
3245
3270
  ] });
3246
3271
  }
3247
3272
  function ParameterToggle({ field, value, onChange, disabled, id }) {
3248
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3273
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3249
3274
  "button",
3250
3275
  {
3251
3276
  type: "button",
@@ -3256,7 +3281,7 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
3256
3281
  disabled: disabled || field.readOnly,
3257
3282
  onClick: () => onChange(!value),
3258
3283
  className: `relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:opacity-50 ${value ? "bg-primary" : "bg-muted"}`,
3259
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3284
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3260
3285
  "span",
3261
3286
  {
3262
3287
  className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
@@ -3273,7 +3298,7 @@ function ParameterSelect(props) {
3273
3298
  const options = (0, import_parameters.getChoiceOptions)(field);
3274
3299
  const off = disabled || field.readOnly;
3275
3300
  if (field.control === "segmented") {
3276
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { role: "radiogroup", "aria-label": (0, import_parameters.parameterLabel)(field), className: "inline-flex flex-wrap rounded-md border border-input bg-muted p-0.5", children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3301
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { role: "radiogroup", "aria-label": (0, import_parameters.parameterLabel)(field), className: "inline-flex flex-wrap rounded-md border border-input bg-muted p-0.5", children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3277
3302
  "button",
3278
3303
  {
3279
3304
  type: "button",
@@ -3290,7 +3315,7 @@ function ParameterSelect(props) {
3290
3315
  }
3291
3316
  if (CustomSelect) {
3292
3317
  const customOptions = options.map((o) => ({ value: o.value, label: (0, import_parameters.choiceOptionLabel)(o), description: o.description }));
3293
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3318
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3294
3319
  CustomSelect,
3295
3320
  {
3296
3321
  id,
@@ -3306,7 +3331,7 @@ function ParameterSelect(props) {
3306
3331
  );
3307
3332
  }
3308
3333
  const index = options.findIndex((o) => o.value === value);
3309
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3334
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3310
3335
  "select",
3311
3336
  {
3312
3337
  id,
@@ -3319,23 +3344,23 @@ function ParameterSelect(props) {
3319
3344
  },
3320
3345
  className: parameterInputClass,
3321
3346
  style: parameterSelectStyle,
3322
- children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: String(i), title: o.description, style: parameterSelectStyle, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
3347
+ children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: String(i), title: o.description, style: parameterSelectStyle, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
3323
3348
  }
3324
3349
  );
3325
3350
  }
3326
3351
  function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id, components }) {
3327
3352
  const CustomColor = resolveParameterComponents(components, useParameterComponents()).color;
3328
- const [open, setOpen] = (0, import_react24.useState)(false);
3329
- const containerRef = (0, import_react24.useRef)(null);
3330
- const buttonRef = (0, import_react24.useRef)(null);
3331
- const popoverRef = (0, import_react24.useRef)(null);
3353
+ const [open, setOpen] = (0, import_react26.useState)(false);
3354
+ const containerRef = (0, import_react26.useRef)(null);
3355
+ const buttonRef = (0, import_react26.useRef)(null);
3356
+ const popoverRef = (0, import_react26.useRef)(null);
3332
3357
  const alpha = !!field.alpha;
3333
3358
  const hex = (0, import_parameters.normalizeHexColor)(value, true) ?? "#000000ff";
3334
3359
  const rgb = hex.slice(0, 7);
3335
3360
  const shown = alpha ? hex : rgb;
3336
3361
  const off = disabled || field.readOnly;
3337
3362
  const name = (0, import_parameters.parameterLabel)(field);
3338
- (0, import_react24.useEffect)(() => {
3363
+ (0, import_react26.useEffect)(() => {
3339
3364
  if (!open) return;
3340
3365
  const onPointerDown = (e) => {
3341
3366
  if (containerRef.current && !containerRef.current.contains(e.target)) {
@@ -3357,7 +3382,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3357
3382
  };
3358
3383
  }, [open]);
3359
3384
  if (CustomColor) {
3360
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3385
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3361
3386
  CustomColor,
3362
3387
  {
3363
3388
  id,
@@ -3372,9 +3397,9 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3372
3397
  }
3373
3398
  );
3374
3399
  }
3375
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
3376
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-2", children: [
3377
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3400
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
3401
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-2", children: [
3402
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3378
3403
  "button",
3379
3404
  {
3380
3405
  ref: buttonRef,
@@ -3385,10 +3410,10 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3385
3410
  disabled: off,
3386
3411
  onClick: () => setOpen((prev) => !prev),
3387
3412
  className: "relative h-7 w-9 shrink-0 overflow-hidden rounded-md border border-input bg-[repeating-conic-gradient(#d4d4d8_0_25%,#fff_0_50%)] bg-[length:8px_8px] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50",
3388
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
3413
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
3389
3414
  }
3390
3415
  ),
3391
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3416
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3392
3417
  ParameterCommitInput,
3393
3418
  {
3394
3419
  id,
@@ -3404,7 +3429,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3404
3429
  }
3405
3430
  )
3406
3431
  ] }),
3407
- open && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3432
+ open && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3408
3433
  "div",
3409
3434
  {
3410
3435
  ref: popoverRef,
@@ -3418,7 +3443,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3418
3443
  },
3419
3444
  className: "absolute left-0 top-full z-50 mt-1 w-64 rounded-lg border border-border bg-popover p-2 text-popover-foreground shadow-xl",
3420
3445
  style: { background: "var(--popover, var(--background, #fff))" },
3421
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3446
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3422
3447
  ColorPicker,
3423
3448
  {
3424
3449
  value: shown,
@@ -3436,11 +3461,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3436
3461
  }
3437
3462
  function ParameterVector({ field, value, onChange, disabled, id, components }) {
3438
3463
  const size = (0, import_parameters.vectorSize)(field);
3439
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
3464
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
3440
3465
  const component = (0, import_parameters.vectorComponentField)(field, i);
3441
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
3442
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
3443
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3466
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
3467
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
3468
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3444
3469
  ParameterNumberInput,
3445
3470
  {
3446
3471
  field: component,
@@ -3458,11 +3483,11 @@ function ParameterVector({ field, value, onChange, disabled, id, components }) {
3458
3483
  function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3459
3484
  const off = disabled || field.readOnly;
3460
3485
  const name = (0, import_parameters.parameterLabel)(field);
3461
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "space-y-1.5", children: [
3462
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-2", children: [
3463
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex h-12 w-16 shrink-0 items-center justify-center overflow-hidden rounded-md border border-input bg-muted", children: value ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
3464
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
3465
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3486
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "space-y-1.5", children: [
3487
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-2", children: [
3488
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex h-12 w-16 shrink-0 items-center justify-center overflow-hidden rounded-md border border-input bg-muted", children: value ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
3489
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
3490
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3466
3491
  ParameterCommitInput,
3467
3492
  {
3468
3493
  id,
@@ -3473,15 +3498,15 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3473
3498
  onCommit: (text) => onChange(text.trim())
3474
3499
  }
3475
3500
  ),
3476
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex gap-1", children: [
3477
- resolveFile && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
3501
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex gap-1", children: [
3502
+ resolveFile && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3478
3503
  "label",
3479
3504
  {
3480
3505
  style: parameterButtonStyle,
3481
3506
  className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`,
3482
3507
  children: [
3483
3508
  "Choose file\u2026",
3484
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3509
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3485
3510
  "input",
3486
3511
  {
3487
3512
  type: "file",
@@ -3499,7 +3524,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3499
3524
  ]
3500
3525
  }
3501
3526
  ),
3502
- value && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3527
+ value && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3503
3528
  "button",
3504
3529
  {
3505
3530
  type: "button",
@@ -3514,7 +3539,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3514
3539
  ] })
3515
3540
  ] })
3516
3541
  ] }),
3517
- field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3542
+ field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3518
3543
  "button",
3519
3544
  {
3520
3545
  type: "button",
@@ -3524,14 +3549,14 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3524
3549
  disabled: off,
3525
3550
  onClick: () => onChange(o.url),
3526
3551
  className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
3527
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
3552
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
3528
3553
  },
3529
3554
  o.url
3530
3555
  )) })
3531
3556
  ] });
3532
3557
  }
3533
3558
  function ParameterText({ field, value, onChange, disabled, id }) {
3534
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3559
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3535
3560
  ParameterCommitInput,
3536
3561
  {
3537
3562
  id,
@@ -3550,24 +3575,24 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
3550
3575
  switch (field.type) {
3551
3576
  case "number":
3552
3577
  case "int":
3553
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
3578
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
3554
3579
  case "boolean":
3555
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
3580
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
3556
3581
  case "choice":
3557
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
3582
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
3558
3583
  case "color":
3559
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
3584
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
3560
3585
  case "vector":
3561
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
3586
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
3562
3587
  case "image":
3563
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
3588
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
3564
3589
  case "text":
3565
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ParameterText, { field, value, onChange: set, ...rest });
3590
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ParameterText, { field, value, onChange: set, ...rest });
3566
3591
  }
3567
3592
  }
3568
3593
 
3569
3594
  // src/effects/EffectParameters.tsx
3570
- var import_jsx_runtime25 = require("react/jsx-runtime");
3595
+ var import_jsx_runtime27 = require("react/jsx-runtime");
3571
3596
  function EffectParameters({
3572
3597
  description,
3573
3598
  values,
@@ -3582,10 +3607,10 @@ function EffectParameters({
3582
3607
  className = "",
3583
3608
  components
3584
3609
  }) {
3585
- const fields = (0, import_react25.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
3586
- const idBase = (0, import_react25.useId)();
3587
- const gesture = import_react25.default.useRef(null);
3588
- const count = import_react25.default.useRef(0);
3610
+ const fields = (0, import_react27.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
3611
+ const idBase = (0, import_react27.useId)();
3612
+ const gesture = import_react27.default.useRef(null);
3613
+ const count = import_react27.default.useRef(0);
3589
3614
  const CustomPresetSelect = resolveParameterComponents(components, useParameterComponents()).select;
3590
3615
  const handlePresetSelect = (name) => {
3591
3616
  if (!name) return;
@@ -3596,8 +3621,8 @@ function EffectParameters({
3596
3621
  if (preset) onPreset({ ...description.defaults, ...preset.values });
3597
3622
  }
3598
3623
  };
3599
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
3600
- (onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3624
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
3625
+ (onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3601
3626
  CustomPresetSelect,
3602
3627
  {
3603
3628
  "aria-label": `${description.name} presets`,
@@ -3612,7 +3637,7 @@ function EffectParameters({
3612
3637
  ],
3613
3638
  onChange: (name) => handlePresetSelect(String(name))
3614
3639
  }
3615
- ) : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3640
+ ) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3616
3641
  "select",
3617
3642
  {
3618
3643
  className: "w-full rounded border border-border px-1 py-0.5 text-xs",
@@ -3622,8 +3647,8 @@ function EffectParameters({
3622
3647
  disabled,
3623
3648
  onChange: (e) => handlePresetSelect(e.currentTarget.value),
3624
3649
  children: [
3625
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
3626
- description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
3650
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
3651
+ description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
3627
3652
  ]
3628
3653
  }
3629
3654
  )),
@@ -3633,14 +3658,14 @@ function EffectParameters({
3633
3658
  const keyed = keyframed?.has(field.id) ?? false;
3634
3659
  const value = (0, import_effects3.effectFieldValue)(field, values[field.id]);
3635
3660
  const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field.default);
3636
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
3637
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-1.5", children: [
3638
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
3639
- keyed && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
3661
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
3662
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-1.5", children: [
3663
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
3664
+ keyed && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
3640
3665
  renderControlAddon?.(field.id),
3641
- onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: "rounded px-1 text-[11px] text-muted-foreground hover:text-foreground", "aria-label": `Reset ${label}`, onClick: () => onReset(field.id), children: "\u21BA" })
3666
+ onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", className: "rounded px-1 text-[11px] text-muted-foreground hover:text-foreground", "aria-label": `Reset ${label}`, onClick: () => onReset(field.id), children: "\u21BA" })
3642
3667
  ] }),
3643
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3668
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3644
3669
  ParameterFieldControl,
3645
3670
  {
3646
3671
  field,
@@ -3655,15 +3680,15 @@ function EffectParameters({
3655
3680
  )
3656
3681
  ] }, field.id);
3657
3682
  }),
3658
- !fields.length && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
3683
+ !fields.length && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
3659
3684
  ] });
3660
3685
  }
3661
3686
 
3662
3687
  // src/paint-editor/PaintEffectsPanel.tsx
3663
- var import_jsx_runtime26 = require("react/jsx-runtime");
3688
+ var import_jsx_runtime28 = require("react/jsx-runtime");
3664
3689
  function usePaintEffectsProvider(controller) {
3665
- const [provider, setProvider] = (0, import_react26.useState)(controller.effectsProvider);
3666
- (0, import_react26.useEffect)(() => {
3690
+ const [provider, setProvider] = (0, import_react28.useState)(controller.effectsProvider);
3691
+ (0, import_react28.useEffect)(() => {
3667
3692
  setProvider(controller.effectsProvider);
3668
3693
  return controller.effects.subscribe(setProvider);
3669
3694
  }, [controller]);
@@ -3671,27 +3696,27 @@ function usePaintEffectsProvider(controller) {
3671
3696
  }
3672
3697
  function usePaintEffectsTools(registry, controller, options = {}) {
3673
3698
  const { id, namespace, readOnly, playbackSurface } = options;
3674
- (0, import_react26.useEffect)(() => {
3699
+ (0, import_react28.useEffect)(() => {
3675
3700
  if (!registry) return;
3676
- return registry.register((0, import_paint_editor14.createPaintEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
3701
+ return registry.register((0, import_paint_editor13.createPaintEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
3677
3702
  }, [registry, controller, id, namespace, readOnly, playbackSurface]);
3678
3703
  }
3679
3704
  function Controls({ provider, effect, name, values, apply }) {
3680
3705
  const { description, error } = useEffectDescription(provider, effect);
3681
- const drags = (0, import_react26.useRef)(/* @__PURE__ */ new Set());
3682
- if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
3706
+ const drags = (0, import_react28.useRef)(/* @__PURE__ */ new Set());
3707
+ if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
3683
3708
  'No effects provider: "',
3684
3709
  name ?? effect,
3685
3710
  '" is kept as it was drawn.'
3686
3711
  ] });
3687
- if (error) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
3688
- if (!description) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
3712
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
3713
+ if (!description) return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
3689
3714
  const commit = (gesture) => {
3690
3715
  if (!gesture || drags.current.has(gesture)) return !gesture;
3691
3716
  drags.current.add(gesture);
3692
3717
  return true;
3693
3718
  };
3694
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3719
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3695
3720
  EffectParameters,
3696
3721
  {
3697
3722
  description,
@@ -3713,8 +3738,8 @@ var PaintEffectsPanel = ({ controller, className }) => {
3713
3738
  const state = usePaintEditorState(controller);
3714
3739
  const provider = usePaintEffectsProvider(controller);
3715
3740
  const [error, attempt] = useAttempt();
3716
- const [browse, setBrowse] = (0, import_react26.useState)(null);
3717
- const [busy, setBusy] = (0, import_react26.useState)(false);
3741
+ const [browse, setBrowse] = (0, import_react28.useState)(null);
3742
+ const [busy, setBusy] = (0, import_react28.useState)(false);
3718
3743
  const paper = controller.getPaperEffect();
3719
3744
  const activeId = state.document.activeLayerId;
3720
3745
  const layerEffect = activeId ? controller.getEffectLayer(activeId) : void 0;
@@ -3726,7 +3751,7 @@ var PaintEffectsPanel = ({ controller, className }) => {
3726
3751
  if (!effectPaint) return;
3727
3752
  run(() => controller.setEffectPaint({ effect: effectPaint.effect, values: effectPaint.values, time: effectPaint.time, map: effectPaint.map, live: effectPaint.live, ...patch }));
3728
3753
  };
3729
- const thumbnail = (0, import_react26.useMemo)(() => effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(48) : null, [controller, effectPaint, state.effectPaintRendering]);
3754
+ const thumbnail = (0, import_react28.useMemo)(() => effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(48) : null, [controller, effectPaint, state.effectPaintRendering]);
3730
3755
  const run = (work) => attempt(() => {
3731
3756
  setBusy(true);
3732
3757
  return work().finally(() => setBusy(false));
@@ -3742,28 +3767,28 @@ var PaintEffectsPanel = ({ controller, className }) => {
3742
3767
  };
3743
3768
  const toggle = (b) => setBrowse(browse === b ? null : b);
3744
3769
  const pixel = active?.type === "pixel";
3745
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
3746
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
3747
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
3748
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
3749
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
3750
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
3751
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "light", onClick: () => toggle("light"), title: "Bake a light, glow or grade into the active layer's dried paint", children: "Light\u2026" }),
3752
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paint", onClick: () => toggle("paint"), title: "Paint with an effect: brushes take each pixel's colour from it", children: "Paint\u2026" })
3770
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
3771
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
3772
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
3773
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
3774
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
3775
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
3776
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "light", onClick: () => toggle("light"), title: "Bake a light, glow or grade into the active layer's dried paint", children: "Light\u2026" }),
3777
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paint", onClick: () => toggle("paint"), title: "Paint with an effect: brushes take each pixel's colour from it", children: "Paint\u2026" })
3753
3778
  ] }),
3754
- !provider && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
3755
- browse && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
3756
- paper && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
3757
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-1", children: [
3758
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex-1 truncate", children: [
3779
+ !provider && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
3780
+ browse && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
3781
+ paper && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
3782
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-1", children: [
3783
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "flex-1 truncate", children: [
3759
3784
  "Paper: ",
3760
3785
  paper.name ?? paper.effect
3761
3786
  ] }),
3762
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
3787
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
3763
3788
  ] }),
3764
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
3765
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
3766
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3789
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
3790
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
3791
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3767
3792
  "input",
3768
3793
  {
3769
3794
  type: "range",
@@ -3785,39 +3810,39 @@ var PaintEffectsPanel = ({ controller, className }) => {
3785
3810
  `o${paper.opacity}`
3786
3811
  )
3787
3812
  ] }),
3788
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
3789
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
3790
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("select", { className: "flex-1 rounded bg-slate-800 px-1 py-0.5 text-[11px]", "aria-label": "Effect paper blend", value: paper.blend, onChange: (e) => {
3813
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
3814
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
3815
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("select", { className: "flex-1 rounded bg-slate-800 px-1 py-0.5 text-[11px]", "aria-label": "Effect paper blend", value: paper.blend, onChange: (e) => {
3791
3816
  const blend = e.currentTarget.value;
3792
3817
  run(() => controller.updatePaperEffect({ blend }));
3793
- }, children: import_paint_editor14.PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: b, children: b }, b)) })
3818
+ }, children: import_paint_editor13.PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: b, children: b }, b)) })
3794
3819
  ] }),
3795
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
3820
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
3796
3821
  ] }),
3797
- effectPaint && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paint", children: [
3798
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-1", children: [
3799
- thumbnail ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("img", { src: thumbnail, alt: "", className: "h-5 w-8 rounded object-cover ring-1 ring-slate-700", "data-testid": "effect-paint-thumbnail" }) : null,
3800
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex-1 truncate", children: [
3822
+ effectPaint && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paint", children: [
3823
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-1", children: [
3824
+ thumbnail ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("img", { src: thumbnail, alt: "", className: "h-5 w-8 rounded object-cover ring-1 ring-slate-700", "data-testid": "effect-paint-thumbnail" }) : null,
3825
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "flex-1 truncate", children: [
3801
3826
  "Paint: ",
3802
3827
  effectPaint.effect,
3803
3828
  state.effectPaintRendering ? " (rendering\u2026)" : ""
3804
3829
  ] }),
3805
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
3830
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
3806
3831
  ] }),
3807
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
3808
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", title: "Lay the effect along each stroke instead of fixing it to the canvas", children: [
3809
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.map), onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
3832
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
3833
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", title: "Lay the effect along each stroke instead of fixing it to the canvas", children: [
3834
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.map), onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
3810
3835
  "Along the stroke"
3811
3836
  ] }),
3812
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
3813
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
3837
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
3838
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
3814
3839
  "Live"
3815
3840
  ] })
3816
3841
  ] }),
3817
- effectPaint.map && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
3818
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
3819
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-slate-400", children: "Length" }),
3820
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3842
+ effectPaint.map && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
3843
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
3844
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-slate-400", children: "Length" }),
3845
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3821
3846
  "input",
3822
3847
  {
3823
3848
  type: "number",
@@ -3831,55 +3856,55 @@ var PaintEffectsPanel = ({ controller, className }) => {
3831
3856
  effectPaint.map.length
3832
3857
  )
3833
3858
  ] }),
3834
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("select", { "aria-label": "Effect repeat", value: effectPaint.map.repeat, onChange: (e) => repaint({ map: { ...effectPaint.map, repeat: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: [
3835
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: "repeat", children: "Repeat" }),
3836
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: "mirror", children: "Mirror" }),
3837
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: "clamp", children: "Clamp" })
3859
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("select", { "aria-label": "Effect repeat", value: effectPaint.map.repeat, onChange: (e) => repaint({ map: { ...effectPaint.map, repeat: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: [
3860
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "repeat", children: "Repeat" }),
3861
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "mirror", children: "Mirror" }),
3862
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "clamp", children: "Clamp" })
3838
3863
  ] })
3839
3864
  ] }),
3840
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
3865
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
3841
3866
  ] }),
3842
- animation && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-2 rounded border border-slate-700 p-1", "data-effect-part": "playback", children: [
3843
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex-1 truncate", children: [
3867
+ animation && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-2 rounded border border-slate-700 p-1", "data-effect-part": "playback", children: [
3868
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "flex-1 truncate", children: [
3844
3869
  "Live paint: ",
3845
3870
  animation.strokes,
3846
3871
  " ",
3847
3872
  animation.strokes === 1 ? "stroke" : "strokes"
3848
3873
  ] }),
3849
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button, "aria-pressed": playback.playing, onClick: () => attempt(() => controller.setEffectPlayback({ playing: !playback.playing })), children: playback.playing ? "Pause" : "Play" }),
3850
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-1", children: [
3851
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-slate-400", children: "fps" }),
3852
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "number", "aria-label": "Live paint frame rate", min: 1, max: 60, value: playback.fps, onChange: (e) => attempt(() => controller.setEffectPlayback({ fps: Math.round(Number(e.target.value)) })), className: "w-12 rounded bg-slate-800 px-1 py-0.5" })
3874
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button, "aria-pressed": playback.playing, onClick: () => attempt(() => controller.setEffectPlayback({ playing: !playback.playing })), children: playback.playing ? "Pause" : "Play" }),
3875
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
3876
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-slate-400", children: "fps" }),
3877
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("input", { type: "number", "aria-label": "Live paint frame rate", min: 1, max: 60, value: playback.fps, onChange: (e) => attempt(() => controller.setEffectPlayback({ fps: Math.round(Number(e.target.value)) })), className: "w-12 rounded bg-slate-800 px-1 py-0.5" })
3853
3878
  ] })
3854
3879
  ] }),
3855
- layerEffect && activeId && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "layer", children: [
3856
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-1", children: [
3857
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex-1 truncate", children: [
3880
+ layerEffect && activeId && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "layer", children: [
3881
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-1", children: [
3882
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "flex-1 truncate", children: [
3858
3883
  "Layer: ",
3859
3884
  layerEffect.name ?? layerEffect.effect
3860
3885
  ] }),
3861
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
3886
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
3862
3887
  ] }),
3863
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
3888
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
3864
3889
  ] }),
3865
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ErrorLine, { error })
3890
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ErrorLine, { error })
3866
3891
  ] });
3867
3892
  };
3868
3893
 
3869
3894
  // src/paint-editor/PaintEditor.tsx
3870
- var import_jsx_runtime27 = require("react/jsx-runtime");
3895
+ var import_jsx_runtime29 = require("react/jsx-runtime");
3871
3896
  var PAINT_CONTROLS = {
3872
3897
  "mixing-pad": '[data-testid="mixing-pad"]',
3873
3898
  lighting: '[data-testid="light-panel"]',
3874
3899
  symmetry: '[aria-label="Symmetry"]'
3875
3900
  };
3876
3901
  var PaintEditor = ({ controller, fileName, height = 720, presence, className, playback, playbackId = "paint", onPlaybackReveal }) => {
3877
- const [tool, setTool] = (0, import_react27.useState)("brush");
3878
- const [tab, setTab] = (0, import_react27.useState)("color");
3879
- const tabRef = (0, import_react27.useRef)(tab);
3902
+ const [tool, setTool] = (0, import_react29.useState)("brush");
3903
+ const [tab, setTab] = (0, import_react29.useState)("color");
3904
+ const tabRef = (0, import_react29.useRef)(tab);
3880
3905
  tabRef.current = tab;
3881
- const rootRef = (0, import_react27.useRef)(null);
3882
- const [ownPresence] = (0, import_react27.useState)(() => new import_paint_editor15.PaintPresence());
3906
+ const rootRef = (0, import_react29.useRef)(null);
3907
+ const [ownPresence] = (0, import_react29.useState)(() => new import_paint_editor14.PaintPresence());
3883
3908
  const ambientPlayback = useAgentPlayback();
3884
3909
  const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
3885
3910
  const viewBox = () => {
@@ -3890,12 +3915,12 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, className, pl
3890
3915
  const docToClient = (p) => {
3891
3916
  const r = viewBox();
3892
3917
  if (!r) return null;
3893
- const q = (0, import_paint_editor15.documentToScreen)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x, p.y);
3918
+ const q = (0, import_paint_editor14.documentToScreen)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x, p.y);
3894
3919
  return { x: r.left + q.x, y: r.top + q.y };
3895
3920
  };
3896
3921
  const clientToDoc = (p) => {
3897
3922
  const r = viewBox();
3898
- return r ? (0, import_paint_editor15.screenToDocument)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x - r.left, p.y - r.top) : null;
3923
+ return r ? (0, import_paint_editor14.screenToDocument)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x - r.left, p.y - r.top) : null;
3899
3924
  };
3900
3925
  const elementRect = (selector) => {
3901
3926
  const r = rootRef.current?.querySelector(selector)?.getBoundingClientRect();
@@ -3935,28 +3960,28 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, className, pl
3935
3960
  const box = rootRef.current?.getBoundingClientRect();
3936
3961
  return c && box ? { x: c.x - box.left, y: c.y - box.top } : p;
3937
3962
  };
3938
- const [error, setError] = (0, import_react27.useState)(null);
3963
+ const [error, setError] = (0, import_react29.useState)(null);
3939
3964
  const effects = usePaintEffectsProvider(controller);
3940
3965
  const tabs = effects ? ["color", "wet", "paper", "layers", "effects"] : ["color", "wet", "paper", "layers"];
3941
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { ref: rootRef, className: `relative flex flex-col gap-2 rounded-xl border border-slate-800 bg-slate-900 p-2 ${className ?? ""}`, style: { height }, "data-testid": "paint-editor", children: [
3942
- playing && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
3943
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PaintToolbar, { controller, tool, onToolChange: setTool, fileName }),
3944
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex min-h-0 flex-1 gap-2", children: [
3945
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
3946
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
3947
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PaintCanvas, { controller, tool, onError: setError, presence: playing ? void 0 : presence, className: "flex-1 rounded-lg" }),
3948
- error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
3966
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { ref: rootRef, className: `relative flex flex-col gap-2 rounded-xl border border-slate-800 bg-slate-900 p-2 ${className ?? ""}`, style: { height }, "data-testid": "paint-editor", children: [
3967
+ playing && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
3968
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PaintToolbar, { controller, tool, onToolChange: setTool, fileName }),
3969
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex min-h-0 flex-1 gap-2", children: [
3970
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
3971
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
3972
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PaintCanvas, { controller, tool, onError: setError, presence: playing ? void 0 : presence, className: "flex-1 rounded-lg" }),
3973
+ error && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
3949
3974
  ] }),
3950
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
3951
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex gap-1", role: "tablist", "aria-label": "Paint panels", children: tabs.map((t) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", role: "tab", "aria-selected": tab === t, "data-paint-tab": t, className: chip(tab === t), onClick: () => setTab(t), children: t === "color" ? "Colour" : t === "wet" ? "Wet" : t === "paper" ? "Paper" : t === "layers" ? "Layers" : "Effects" }, t)) }),
3952
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
3953
- tab === "color" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ColorPanel, { controller }),
3954
- tab === "wet" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(WetPanel, { controller }),
3955
- tab === "paper" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PaperPanel, { controller }),
3956
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PaintLayersPanel, { controller }),
3957
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StrokePanel, { controller }),
3958
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StickerPanel, { controller }),
3959
- tab === "effects" && effects && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PaintEffectsPanel, { controller })
3975
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
3976
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex gap-1", role: "tablist", "aria-label": "Paint panels", children: tabs.map((t) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", role: "tab", "aria-selected": tab === t, "data-paint-tab": t, className: chip(tab === t), onClick: () => setTab(t), children: t === "color" ? "Colour" : t === "wet" ? "Wet" : t === "paper" ? "Paper" : t === "layers" ? "Layers" : "Effects" }, t)) }),
3977
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
3978
+ tab === "color" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ColorPanel, { controller }),
3979
+ tab === "wet" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(WetPanel, { controller }),
3980
+ tab === "paper" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PaperPanel, { controller }),
3981
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PaintLayersPanel, { controller }),
3982
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(StrokePanel, { controller }),
3983
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(StickerPanel, { controller }),
3984
+ tab === "effects" && effects && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PaintEffectsPanel, { controller })
3960
3985
  ] })
3961
3986
  ] })
3962
3987
  ] })
@@ -3964,6 +3989,8 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, className, pl
3964
3989
  };
3965
3990
  // Annotate the CommonJS export names for ESM import in node:
3966
3991
  0 && (module.exports = {
3992
+ BrushEditor,
3993
+ BrushLibraryBrowser,
3967
3994
  BrushPanel,
3968
3995
  ColorPanel,
3969
3996
  PaintCanvas,