@pixerate/editor-react 0.170.0 → 0.171.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -599,9 +599,9 @@ var PaintToolbar = ({ controller, tool, onToolChange, fileName = "painting", cla
599
599
  };
600
600
 
601
601
  // src/paint-editor/BrushPanel.tsx
602
- var import_react7 = require("react");
602
+ var import_react8 = require("react");
603
+ var import_paint_editor5 = require("@pixerate/editor/paint-editor");
603
604
  var import_paint_editor6 = require("@pixerate/editor/paint-editor");
604
- var import_paint_editor7 = require("@pixerate/editor/paint-editor");
605
605
 
606
606
  // src/paint-editor/PaintGradientEditor.tsx
607
607
  var import_paint_editor4 = require("@pixerate/editor/paint-editor");
@@ -733,20 +733,22 @@ var import_jsx_runtime5 = require("react/jsx-runtime");
733
733
  var PaintGradientEditor = (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PaintGradientEditorView, { ...props, kit: import_paint_editor4.PAINT_GRADIENT_KIT });
734
734
 
735
735
  // src/paint-editor/StickerPicker.tsx
736
+ var import_react7 = require("react");
737
+
738
+ // src/stickers/StickerLibraryPicker.tsx
736
739
  var import_react6 = require("react");
737
- var import_paint_editor5 = require("@pixerate/editor/paint-editor");
740
+ var import_stickers = require("@pixerate/editor/stickers");
738
741
  var import_jsx_runtime6 = require("react/jsx-runtime");
739
- var StickerPicker = ({ controller, selected, onPick, label = "Stickers" }) => {
740
- const browser = (0, import_react6.useMemo)(() => new import_paint_editor5.StickerBrowser(() => controller.stickersProvider), [controller]);
742
+ var StickerLibraryPicker = ({ provider, selected = [], onPick, label = "Stickers", footer, className }) => {
743
+ const browser = (0, import_react6.useMemo)(() => new import_stickers.StickerBrowser(() => provider), [provider]);
741
744
  const [, setTick] = (0, import_react6.useState)(0);
742
- (0, import_react6.useEffect)(() => browser.subscribe(() => setTick((n) => n + 1)), [browser]);
743
745
  (0, import_react6.useEffect)(() => {
746
+ const off = browser.subscribe(() => setTick((n) => n + 1));
744
747
  void browser.refresh();
745
- return controller.stickers.subscribe(() => void browser.refresh());
746
- }, [browser, controller]);
748
+ return off;
749
+ }, [browser]);
747
750
  const s = browser.state;
748
- const failed = selected.map((ref) => ({ ref, ...controller.stickerArtStatus(ref) })).filter((x) => x.status === "failed");
749
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col gap-1", "data-testid": "sticker-picker", children: [
751
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: `flex flex-col gap-1 ${className ?? ""}`, "data-testid": "sticker-picker", children: [
750
752
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-1", children: [
751
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" }),
752
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: [
@@ -761,9 +763,9 @@ var StickerPicker = ({ controller, selected, onPick, label = "Stickers" }) => {
761
763
  {
762
764
  type: "button",
763
765
  "aria-pressed": on,
764
- title: `${it.name} (${it.ref}) \xB7 ${it.licence.name}`,
766
+ title: `${it.name} (${it.ref}) \xB7 ${it.licence.name}${it.licence.attribution ? ` \xB7 ${it.licence.attribution}` : ""}`,
765
767
  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"}`,
766
- onClick: () => onPick(it.ref),
768
+ onClick: () => onPick(it),
767
769
  children: [
768
770
  it.thumbnail && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("img", { src: it.thumbnail, alt: "", className: "h-4 w-4" }),
769
771
  it.name
@@ -777,34 +779,52 @@ var StickerPicker = ({ controller, selected, onPick, label = "Stickers" }) => {
777
779
  s.hasMore && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "text-indigo-300", onClick: () => void browser.more(), children: "More" })
778
780
  ] }),
779
781
  s.error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { role: "alert", className: "text-[11px] text-rose-400", children: s.error }),
780
- failed.map((f) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { role: "alert", className: "text-[11px] text-rose-400", children: [
781
- f.ref,
782
- ": ",
783
- f.error
784
- ] }, f.ref))
782
+ footer
785
783
  ] });
786
784
  };
787
785
 
788
- // src/paint-editor/BrushPanel.tsx
786
+ // src/paint-editor/StickerPicker.tsx
789
787
  var import_jsx_runtime7 = require("react/jsx-runtime");
788
+ 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]);
791
+ const failed = selected.map((ref) => ({ ref, ...controller.stickerArtStatus(ref) })).filter((x) => x.status === "failed");
792
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
793
+ StickerLibraryPicker,
794
+ {
795
+ provider,
796
+ selected,
797
+ label,
798
+ 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: [
800
+ f.ref,
801
+ ": ",
802
+ f.error
803
+ ] }, f.ref))
804
+ }
805
+ );
806
+ };
807
+
808
+ // src/paint-editor/BrushPanel.tsx
809
+ var import_jsx_runtime8 = require("react/jsx-runtime");
790
810
  var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, className }) => {
791
811
  const state = usePaintEditorState(controller);
792
812
  const [error, attempt] = useAttempt();
793
- const [saveName, setSaveName] = (0, import_react7.useState)("");
794
- const fileRef = (0, import_react7.useRef)(null);
813
+ const [saveName, setSaveName] = (0, import_react8.useState)("");
814
+ const fileRef = (0, import_react8.useRef)(null);
795
815
  const { brush, brushes } = state;
796
816
  const paper = state.document.paper;
797
- const thumbs = (0, import_react7.useMemo)(
817
+ const thumbs = (0, import_react8.useMemo)(
798
818
  () => new Map(brushes.map((b) => [b.id, controller.brushThumbnail(b.id, { width: thumbnailWidth, height: thumbnailHeight, color: "#26324a" })])),
799
819
  // Thumbnails follow the library and the paper.
800
820
  // eslint-disable-next-line react-hooks/exhaustive-deps
801
821
  [controller, brushes, paper, thumbnailWidth, thumbnailHeight]
802
822
  );
803
- const engine = (0, import_paint_editor6.brushEngineControls)(brush);
804
- const carried = (0, import_paint_editor6.brushLoadColor)(state.mixerLoad);
823
+ const engine = (0, import_paint_editor5.brushEngineControls)(brush);
824
+ const carried = (0, import_paint_editor5.brushLoadColor)(state.mixerLoad);
805
825
  const slug = (name) => name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || "brush";
806
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "brush-panel", children: [
807
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "grid grid-cols-2 gap-1", role: "listbox", "aria-label": "Brushes", children: brushes.map((b) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
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)(
808
828
  "button",
809
829
  {
810
830
  type: "button",
@@ -814,137 +834,137 @@ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, clas
814
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"}`,
815
835
  onClick: () => controller.setBrush({ id: b.id }),
816
836
  children: [
817
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PixelCanvas, { pixels: thumbs.get(b.id) ?? null, label: `${b.name} thumbnail`, className: "rounded", style: { width: "100%", aspectRatio: `${thumbnailWidth} / ${thumbnailHeight}` } }),
818
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "truncate text-[10px] text-slate-300", children: b.name })
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 })
819
839
  ]
820
840
  },
821
841
  b.id
822
842
  )) }),
823
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
824
- import_paint_editor6.BRUSH_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor6.readPath)(brush, c.path), onChange: (v) => controller.setBrush((0, import_paint_editor6.patchPath)(brush, c.path, v)) }, c.path)),
825
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
826
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-slate-400", children: "Rotation" }),
827
- /* @__PURE__ */ (0, import_jsx_runtime7.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_editor6.BRUSH_ROTATIONS.map((r) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: r, children: r === "stroke" ? "Follow stroke" : r === "barrel" ? "Pen barrel" : "Fixed" }, r)) })
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)) })
828
848
  ] }),
829
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-2", children: [
830
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "checkbox", checked: brush.tip.pressureSize, onChange: (e) => controller.setBrush({ tip: { pressureSize: e.target.checked } }) }),
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 } }) }),
831
851
  " Pressure \u2192 size"
832
852
  ] }),
833
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-2", children: [
834
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "checkbox", checked: brush.tip.pressureOpacity, onChange: (e) => controller.setBrush({ tip: { pressureOpacity: e.target.checked } }) }),
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 } }) }),
835
855
  " Pressure \u2192 opacity"
836
856
  ] }),
837
- brush.engine === "dab" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
838
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-slate-400", children: "Blend" }),
839
- /* @__PURE__ */ (0, import_jsx_runtime7.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_editor6.BLEND_MENU_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("optgroup", { label: g.label, children: g.modes.map((m) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: m.id, title: m.description, children: m.label }, m.id)) }, g.label)) })
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)) })
840
860
  ] })
841
861
  ] }),
842
- engine && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "brush-engine", children: [
843
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "font-medium text-slate-300", children: engine.title }),
844
- engine.wetTool && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
845
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-slate-400", children: "Wet tool" }),
846
- /* @__PURE__ */ (0, import_jsx_runtime7.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_editor6.WET_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: t, children: import_paint_editor6.WET_TOOL_LABELS[t] }, t)) })
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)) })
847
867
  ] }),
848
- engine.wetTool && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
849
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-slate-400", children: "Medium" }),
850
- /* @__PURE__ */ (0, import_jsx_runtime7.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_editor6.WET_MEDIA.map((m) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: m, children: import_paint_editor6.WET_MEDIUM_LABELS[m] }, m)) })
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)) })
851
871
  ] }),
852
- engine.particleMenus && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
853
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
854
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-slate-400", children: "Particles" }),
855
- /* @__PURE__ */ (0, import_jsx_runtime7.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_editor6.PARTICLE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: k, children: import_paint_editor6.PARTICLE_KIND_LABELS[k] }, k)) })
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)) })
856
876
  ] }),
857
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
858
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-slate-400", children: "Drawn as" }),
859
- /* @__PURE__ */ (0, import_jsx_runtime7.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_editor6.PARTICLE_RENDERS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: k, children: import_paint_editor6.PARTICLE_RENDER_LABELS[k] }, k)) })
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)) })
860
880
  ] }),
861
- brush.particle.render === "ribbon" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
862
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-slate-400", children: "Ribbon joins" }),
863
- /* @__PURE__ */ (0, import_jsx_runtime7.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_editor6.RIBBON_PAIRS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: k, children: import_paint_editor6.RIBBON_PAIR_LABELS[k] }, k)) })
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)) })
864
884
  ] }),
865
- (brush.particle.render === "dot" || brush.particle.render === "sequence") && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
866
- /* @__PURE__ */ (0, import_jsx_runtime7.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_editor6.STAMP_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
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)(
867
887
  "button",
868
888
  {
869
889
  type: "button",
870
890
  "aria-pressed": brush.particle.dotTextures.includes(k),
871
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"}`,
872
- onClick: () => controller.setBrush({ particle: { dotTextures: (0, import_paint_editor6.toggleDotTexture)(brush.particle.dotTextures, k) } }),
873
- children: import_paint_editor6.STAMP_LABELS[k]
892
+ onClick: () => controller.setBrush({ particle: { dotTextures: (0, import_paint_editor5.toggleDotTexture)(brush.particle.dotTextures, k) } }),
893
+ children: import_paint_editor5.STAMP_LABELS[k]
874
894
  },
875
895
  k
876
896
  )) }),
877
- brush.particle.dotTextures.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
878
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
879
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-slate-400", children: "Texture order" }),
880
- /* @__PURE__ */ (0, import_jsx_runtime7.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_editor6.DOT_TEXTURE_ORDERS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: k, children: import_paint_editor6.DOT_TEXTURE_ORDER_LABELS[k] }, k)) })
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)) })
881
901
  ] }),
882
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
883
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-slate-400", children: "Texture turn" }),
884
- /* @__PURE__ */ (0, import_jsx_runtime7.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_editor6.DOT_ROTATIONS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: k, children: import_paint_editor6.DOT_ROTATION_LABELS[k] }, k)) })
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)) })
885
905
  ] })
886
906
  ] })
887
907
  ] })
888
908
  ] }),
889
- engine.stickerStamps && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StickerPicker, { controller, label: "Sticker stamps", selected: brush.sticker.stamps, onPick: (ref) => controller.setBrush({ sticker: { stamps: (0, import_paint_editor6.toggleStickerRef)(brush.sticker.stamps, ref) } }) }),
890
- engine.impastoTool && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
891
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-slate-400", children: "Tool" }),
892
- /* @__PURE__ */ (0, import_jsx_runtime7.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_editor6.IMPASTO_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: t, children: import_paint_editor6.IMPASTO_TOOL_LABELS[t] }, t)) })
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)) })
893
913
  ] }),
894
- engine.sliders.map((c) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor6.readPath)(brush, c.path), onChange: (v) => controller.setBrush((0, import_paint_editor6.patchPath)(brush, c.path, v)) }, c.path)),
895
- engine.mixingPath && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
896
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-slate-400", children: "Mixing" }),
897
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
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)(
898
918
  "select",
899
919
  {
900
920
  "aria-label": "Brush mixing",
901
921
  value: engine.mixingPath === "blender.mixing" ? brush.blender.mixing : engine.mixingPath === "smudge.mixing" ? brush.smudge.mixing : brush.behavior.mixing,
902
- onChange: (e) => controller.setBrush((0, import_paint_editor6.patchBrushValue)(brush, engine.mixingPath, e.target.value)),
922
+ onChange: (e) => controller.setBrush((0, import_paint_editor5.patchBrushValue)(brush, engine.mixingPath, e.target.value)),
903
923
  className: "rounded bg-slate-800 px-1 py-0.5",
904
924
  children: [
905
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "pigment", children: "Pigment" }),
906
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "rgb", children: "RGB" })
925
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "pigment", children: "Pigment" }),
926
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "rgb", children: "RGB" })
907
927
  ]
908
928
  }
909
929
  )
910
930
  ] }),
911
- engine.light && brush.light.amount > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex items-center gap-2", title: "Pressure scales the light the brush lays", children: [
912
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "checkbox", "aria-label": "Light follows pressure", checked: brush.light.pressure, onChange: (e) => controller.setBrush({ light: { pressure: e.target.checked } }) }),
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 } }) }),
913
933
  " Light follows pressure"
914
934
  ] }),
915
- engine.dirty && /* @__PURE__ */ (0, import_jsx_runtime7.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: [
916
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "checkbox", "aria-label": "Dirty brush", checked: brush.behavior.dirty, onChange: (e) => controller.setBrush({ behavior: { dirty: e.target.checked } }) }),
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 } }) }),
917
937
  " Dirty brush"
918
938
  ] }),
919
- (0, import_paint_editor6.brushTakesPaint)(brush) && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "brush-gradient", children: [
920
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
921
- /* @__PURE__ */ (0, import_jsx_runtime7.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" }),
922
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
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)(
923
943
  "button",
924
944
  {
925
945
  type: "button",
926
946
  "aria-pressed": brush.paint !== null,
927
947
  className: chip(brush.paint !== null),
928
- onClick: () => attempt(() => controller.setBrush({ paint: brush.paint ? null : import_paint_editor7.DEFAULT_PAINT_GRADIENT })),
948
+ onClick: () => attempt(() => controller.setBrush({ paint: brush.paint ? null : import_paint_editor6.DEFAULT_PAINT_GRADIENT })),
929
949
  children: brush.paint ? "On" : "Off"
930
950
  }
931
951
  )
932
952
  ] }),
933
- brush.paint && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PaintGradientEditor, { value: brush.paint, colors: { paint: state.color, secondary: state.secondaryColor }, onChange: (g) => attempt(() => controller.setBrush({ paint: g })) })
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 })) })
934
954
  ] }),
935
- engine.load && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-1", children: [
936
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-slate-400", children: "Carries" }),
937
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { "aria-label": "Brush load", title: carried ?? "Clean", className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: carried ?? "transparent" } }),
938
- brush.engine === "mixer" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: button, onClick: () => controller.loadMixerBrush(), children: "Load" }),
939
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: button, onClick: () => controller.cleanMixerBrush(brush.engine === "mixer"), children: "Clean" })
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" })
940
960
  ] })
941
961
  ] }),
942
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
943
- /* @__PURE__ */ (0, import_jsx_runtime7.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" }),
944
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: button, disabled: !saveName.trim(), onClick: () => attempt(() => (controller.saveBrush({ id: slug(saveName), name: saveName.trim() }), setSaveName(""))), children: "Save brush" }),
945
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (0, import_paint_editor6.downloadBytes)(JSON.stringify(controller.exportBrushes(), null, 2), "brushes.json", "application/json")), children: "Export" }),
946
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: button, onClick: () => fileRef.current?.click(), children: "Import\u2026" }),
947
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
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)(
948
968
  "input",
949
969
  {
950
970
  ref: fileRef,
@@ -960,24 +980,24 @@ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, clas
960
980
  }
961
981
  )
962
982
  ] }),
963
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ErrorLine, { error })
983
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ErrorLine, { error })
964
984
  ] });
965
985
  };
966
986
 
967
987
  // src/paint-editor/PaperPanel.tsx
968
- var import_react8 = require("react");
969
- var import_paint_editor8 = require("@pixerate/editor/paint-editor");
970
- var import_jsx_runtime8 = require("react/jsx-runtime");
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");
971
991
  var SWATCH = { x: 0, y: 0, width: 64, height: 40 };
972
992
  var PaperPanel = ({ controller, className }) => {
973
993
  const state = usePaintEditorState(controller);
974
994
  const [error, attempt] = useAttempt();
975
995
  const paper = state.document.paper;
976
- const previews = (0, import_react8.useMemo)(() => new Map(import_paint_editor8.PAPER_LIBRARY.map((p) => [p.preset, { ...SWATCH, data: (0, import_paint_editor8.renderPaper)({ ...p, shading: Math.max(0.8, p.shading) }, SWATCH) }])), []);
977
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paper-panel", children: [
978
- import_paint_editor8.PAPER_FAMILIES.map((family) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
979
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "mb-0.5 text-[10px] uppercase tracking-wide text-slate-500", children: family }),
980
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": `${family} papers`, children: import_paint_editor8.PAPER_LIBRARY.filter((p) => p.family === family).map((p) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
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)(
981
1001
  "button",
982
1002
  {
983
1003
  type: "button",
@@ -986,98 +1006,98 @@ var PaperPanel = ({ controller, className }) => {
986
1006
  title: p.name,
987
1007
  className: `rounded p-0.5 ${paper.preset === p.preset ? "ring-2 ring-indigo-500" : "ring-1 ring-slate-700 hover:ring-slate-500"}`,
988
1008
  onClick: () => attempt(() => controller.setPaper({ preset: p.preset })),
989
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PixelCanvas, { pixels: previews.get(p.preset) ?? null, label: p.name, style: { width: 48, height: 30 } })
1009
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PixelCanvas, { pixels: previews.get(p.preset) ?? null, label: p.name, style: { width: 48, height: 30 } })
990
1010
  },
991
1011
  p.preset
992
1012
  )) })
993
1013
  ] }, family)),
994
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "text-slate-300", children: paper.name }),
995
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center justify-between", children: [
996
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-slate-400", children: "Colour" }),
997
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CommitColorInput, { label: "Paper colour", value: paper.color, onCommit: (v) => attempt(() => controller.setPaper({ color: v })), className: "h-6 w-10 rounded bg-transparent" })
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" })
998
1018
  ] }),
999
- import_paint_editor8.PAPER_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor8.readPath)(paper, c.path), onCommit: (v) => attempt(() => controller.setPaper((0, import_paint_editor8.patchPath)(paper, c.path, v))) }, c.path)),
1000
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center justify-between", children: [
1001
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-slate-400", children: "Backlight colour" }),
1002
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CommitColorInput, { label: "Backlight colour", value: paper.backlightColor ?? import_paint_editor8.DEFAULT_BACKLIGHT_COLOR, onCommit: (v) => attempt(() => controller.setPaper({ backlightColor: v })), className: "h-6 w-10 rounded bg-transparent" })
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" })
1003
1023
  ] }),
1004
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "flex items-center gap-2", children: [
1005
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { type: "checkbox", checked: paper.tiling === "mirror", onChange: (e) => attempt(() => controller.setPaper({ tiling: e.target.checked ? "mirror" : "repeat" })) }),
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" })) }),
1006
1026
  " Mirror tiling"
1007
1027
  ] }),
1008
- /* @__PURE__ */ (0, import_jsx_runtime8.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" }),
1009
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "light-panel", children: [
1010
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "font-medium text-slate-300", children: "Light (thick paint, metallic paper)" }),
1011
- import_paint_editor8.LIGHT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor8.readPath)(controller.getLighting(), c.path), onChange: (v) => attempt(() => controller.setLighting({ [c.path]: v })) }, c.path)),
1012
- /* @__PURE__ */ (0, import_jsx_runtime8.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" })
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" })
1013
1033
  ] }),
1014
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ErrorLine, { error })
1034
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ErrorLine, { error })
1015
1035
  ] });
1016
1036
  };
1017
1037
 
1018
1038
  // src/paint-editor/ColorPanel.tsx
1019
- var import_react9 = require("react");
1039
+ var import_react10 = require("react");
1040
+ var import_paint_editor8 = require("@pixerate/editor/paint-editor");
1020
1041
  var import_paint_editor9 = require("@pixerate/editor/paint-editor");
1021
- var import_paint_editor10 = require("@pixerate/editor/paint-editor");
1022
- var import_jsx_runtime9 = require("react/jsx-runtime");
1042
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1023
1043
  var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className }) => {
1024
1044
  const state = usePaintEditorState(controller);
1025
1045
  const [error, attempt] = useAttempt();
1026
- const [wheel, setWheel] = (0, import_react9.useState)("ryb");
1027
- const [kind, setKind] = (0, import_react9.useState)("complementary");
1028
- const [padTool, setPadTool] = (0, import_react9.useState)("paint");
1029
- const [sample, setSample] = (0, import_react9.useState)(3);
1030
- const [parts, setParts] = (0, import_react9.useState)([1, 1]);
1031
- const [padName, setPadName] = (0, import_react9.useState)("");
1032
- const padPoints = (0, import_react9.useRef)(null);
1033
- const ring = (0, import_react9.useMemo)(() => (0, import_paint_editor9.renderColorWheel)(wheelSize, wheel), [wheelSize, wheel]);
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]);
1034
1054
  const color = state.color;
1035
- const harmony = (0, import_react9.useMemo)(() => controller.harmony(kind, { color, wheel }), [controller, kind, color, wheel]);
1036
- const [r, g, b] = (0, import_paint_editor9.parseHexColor)(color);
1037
- const hsv = (0, import_paint_editor9.rgbToHsv)(r, g, b);
1038
- const effectWell = (0, import_react9.useMemo)(() => state.effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(64) : null, [controller, state.effectPaint, state.effectPaintRendering]);
1039
- const pad = (0, import_react9.useMemo)(() => ({ width: import_paint_editor9.MIXING_PAD_WIDTH, height: import_paint_editor9.MIXING_PAD_HEIGHT, data: controller.mixingPad.pixels() }), [controller, state.mixingPadVersion]);
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]);
1040
1060
  const R = wheelSize / 2;
1041
1061
  const mid = R * 0.82;
1042
- const setHsv = (s, v) => controller.setColor((0, import_paint_editor9.rgbToHexColor)(...(0, import_paint_editor9.hsvToRgb)(hsv.h, s, v)));
1062
+ const setHsv = (s, v) => controller.setColor((0, import_paint_editor8.rgbToHexColor)(...(0, import_paint_editor8.hsvToRgb)(hsv.h, s, v)));
1043
1063
  const padPoint = (e) => {
1044
1064
  const rect = e.currentTarget.getBoundingClientRect();
1045
- const kx = import_paint_editor9.MIXING_PAD_WIDTH / (rect.width || import_paint_editor9.MIXING_PAD_WIDTH);
1046
- const ky = import_paint_editor9.MIXING_PAD_HEIGHT / (rect.height || import_paint_editor9.MIXING_PAD_HEIGHT);
1047
- const x = Math.min(import_paint_editor9.MIXING_PAD_WIDTH, Math.max(0, (e.clientX - rect.left) * kx));
1048
- const y = Math.min(import_paint_editor9.MIXING_PAD_HEIGHT, Math.max(0, (e.clientY - rect.top) * ky));
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));
1049
1069
  return e.pointerType === "pen" && e.pressure > 0 ? { x, y, pressure: e.pressure } : { x, y };
1050
1070
  };
1051
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "color-panel", children: [
1052
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative self-center", style: { width: wheelSize, height: wheelSize }, children: [
1053
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
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)(
1054
1074
  "div",
1055
1075
  {
1056
1076
  role: "slider",
1057
1077
  "aria-label": "Hue wheel",
1058
1078
  "aria-valuemin": 0,
1059
1079
  "aria-valuemax": 360,
1060
- "aria-valuenow": Math.round((0, import_paint_editor9.hueToWheel)(hsv.h, wheel)),
1080
+ "aria-valuenow": Math.round((0, import_paint_editor8.hueToWheel)(hsv.h, wheel)),
1061
1081
  tabIndex: 0,
1062
1082
  className: "absolute inset-0 cursor-crosshair",
1063
1083
  onPointerDown: (e) => {
1064
1084
  const rect = e.currentTarget.getBoundingClientRect();
1065
- controller.setColor((0, import_paint_editor9.wheelPick)(e.clientX - rect.left - R, e.clientY - rect.top - R, wheel, color));
1085
+ controller.setColor((0, import_paint_editor8.wheelPick)(e.clientX - rect.left - R, e.clientY - rect.top - R, wheel, color));
1066
1086
  },
1067
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PixelCanvas, { pixels: ring, label: "Colour wheel", style: { width: wheelSize, height: wheelSize } })
1087
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PixelCanvas, { pixels: ring, label: "Colour wheel", style: { width: wheelSize, height: wheelSize } })
1068
1088
  }
1069
1089
  ),
1070
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("svg", { className: "pointer-events-none absolute inset-0", width: wheelSize, height: wheelSize, "aria-hidden": "true", children: harmony.map((h, i) => {
1071
- const p = (0, import_paint_editor9.wheelPoint)(h.angle, mid);
1072
- return /* @__PURE__ */ (0, import_jsx_runtime9.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);
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);
1073
1093
  }) }),
1074
- /* @__PURE__ */ (0, import_jsx_runtime9.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 } })
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 } })
1075
1095
  ] }),
1076
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2", children: [
1077
- /* @__PURE__ */ (0, import_jsx_runtime9.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" }),
1078
- /* @__PURE__ */ (0, import_jsx_runtime9.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" }),
1079
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: button, title: "Swap colours (X)", onClick: () => controller.swapColors(), children: "Swap" }),
1080
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
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)(
1081
1101
  "input",
1082
1102
  {
1083
1103
  "aria-label": "Hex colour",
@@ -1088,49 +1108,49 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1088
1108
  color
1089
1109
  )
1090
1110
  ] }),
1091
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2", "data-testid": "paint-source", children: [
1092
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
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)(
1093
1113
  "span",
1094
1114
  {
1095
1115
  className: "h-5 flex-1 rounded ring-1 ring-slate-700",
1096
1116
  "aria-label": state.effectPaint ? `Effect paint: ${state.effectPaint.effect}` : state.paint.type === "gradient" ? "Gradient paint" : "Paint colour",
1097
1117
  "data-testid": "paint-well",
1098
1118
  "data-effect-paint": state.effectPaint ? state.effectPaint.effect : void 0,
1099
- style: { background: effectWell ? `center / cover no-repeat url("${effectWell}")` : (0, import_paint_editor10.paintSourceCss)(state.paint, { paint: color, secondary: state.secondaryColor }) }
1119
+ style: { background: effectWell ? `center / cover no-repeat url("${effectWell}")` : (0, import_paint_editor9.paintSourceCss)(state.paint, { paint: color, secondary: state.secondaryColor }) }
1100
1120
  }
1101
1121
  ),
1102
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1122
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1103
1123
  "button",
1104
1124
  {
1105
1125
  type: "button",
1106
1126
  className: chip(state.paint.type === "gradient"),
1107
1127
  "aria-pressed": state.paint.type === "gradient",
1108
1128
  title: "Paint that changes colour as the stroke goes",
1109
- onClick: () => attempt(() => state.paint.type === "gradient" ? controller.setColor(color) : controller.setPaint(import_paint_editor10.DEFAULT_PAINT_GRADIENT)),
1129
+ onClick: () => attempt(() => state.paint.type === "gradient" ? controller.setColor(color) : controller.setPaint(import_paint_editor9.DEFAULT_PAINT_GRADIENT)),
1110
1130
  children: "Gradient"
1111
1131
  }
1112
1132
  )
1113
1133
  ] }),
1114
- state.paint.type === "gradient" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PaintGradientEditor, { value: state.paint, colors: { paint: color, secondary: state.secondaryColor }, onChange: (g2) => attempt(() => controller.setPaint(g2)) }),
1115
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-2", children: [
1116
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "w-16 text-slate-400", children: "Saturation" }),
1117
- /* @__PURE__ */ (0, import_jsx_runtime9.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" })
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" })
1118
1138
  ] }),
1119
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-2", children: [
1120
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "w-16 text-slate-400", children: "Value" }),
1121
- /* @__PURE__ */ (0, import_jsx_runtime9.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" })
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" })
1122
1142
  ] }),
1123
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-1", children: [
1124
- /* @__PURE__ */ (0, import_jsx_runtime9.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_editor9.HARMONY_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: k, children: k }, k)) }),
1125
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: chip(wheel === "ryb"), "aria-pressed": wheel === "ryb", onClick: () => setWheel("ryb"), children: "RYB" }),
1126
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: chip(wheel === "rgb"), "aria-pressed": wheel === "rgb", onClick: () => setWheel("rgb"), children: "RGB" })
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" })
1127
1147
  ] }),
1128
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-wrap gap-1", "aria-label": "Harmony colours", children: [
1129
- harmony.map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime9.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)),
1130
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: button, onClick: () => harmony.forEach((h) => controller.addSwatch(h.color)), children: "+ swatches" })
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" })
1131
1151
  ] }),
1132
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": "Swatches", children: [
1133
- state.swatches.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
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)(
1134
1154
  "button",
1135
1155
  {
1136
1156
  type: "button",
@@ -1139,7 +1159,7 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1139
1159
  "aria-label": s.name ?? (s.paint ? "Gradient" : s.color),
1140
1160
  title: `${s.name ?? (s.paint ? "Gradient" : s.color)} (right-click to remove)`,
1141
1161
  className: "h-5 w-5 rounded ring-1 ring-slate-700",
1142
- style: { background: s.paint ? (0, import_paint_editor10.paintSourceCss)(s.paint, { paint: color, secondary: state.secondaryColor }) : s.color },
1162
+ style: { background: s.paint ? (0, import_paint_editor9.paintSourceCss)(s.paint, { paint: color, secondary: state.secondaryColor }) : s.color },
1143
1163
  onClick: () => attempt(() => s.paint ? controller.setPaint(s.paint) : controller.setColor(s.color)),
1144
1164
  onContextMenu: (e) => {
1145
1165
  e.preventDefault();
@@ -1148,15 +1168,15 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1148
1168
  },
1149
1169
  i
1150
1170
  )),
1151
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: button, "aria-label": "Add swatch", onClick: () => attempt(() => controller.addSwatch(state.paint)), children: "+" })
1171
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: button, "aria-label": "Add swatch", onClick: () => attempt(() => controller.addSwatch(state.paint)), children: "+" })
1152
1172
  ] }),
1153
- mixingPad && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col gap-1", "data-testid": "mixing-pad", children: [
1154
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-1", children: [
1155
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-slate-400", children: "Mixing pad" }),
1156
- ["paint", "knife", "pick"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", "aria-pressed": padTool === t, className: chip(padTool === t), onClick: () => setPadTool(t), children: t === "paint" ? "Paint" : t === "knife" ? "Knife" : "Pick" }, t)),
1157
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: button, onClick: () => controller.clearMixingPad(), children: "Clear" })
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" })
1158
1178
  ] }),
1159
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1179
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1160
1180
  "div",
1161
1181
  {
1162
1182
  role: "application",
@@ -1165,7 +1185,7 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1165
1185
  onPointerDown: (e) => {
1166
1186
  const p = padPoint(e);
1167
1187
  if (padTool === "pick") {
1168
- attempt(() => controller.mixingPadPick(p.x, p.y, { setColor: true, radius: (0, import_paint_editor9.padSampleRadius)(sample) }));
1188
+ attempt(() => controller.mixingPadPick(p.x, p.y, { setColor: true, radius: (0, import_paint_editor8.padSampleRadius)(sample) }));
1169
1189
  return;
1170
1190
  }
1171
1191
  padPoints.current = [p];
@@ -1177,20 +1197,20 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1177
1197
  padPoints.current = null;
1178
1198
  if (pts?.length) attempt(() => controller.mixingPadStroke(pts, { tool: padTool === "knife" ? "knife" : "paint" }));
1179
1199
  },
1180
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PixelCanvas, { pixels: pad, label: "Mixing pad pixels", className: "w-full rounded", style: { aspectRatio: `${import_paint_editor9.MIXING_PAD_WIDTH} / ${import_paint_editor9.MIXING_PAD_HEIGHT}` } })
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}` } })
1181
1201
  }
1182
1202
  ),
1183
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex flex-wrap items-center gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-1", children: [
1184
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-slate-400", children: "Sample" }),
1185
- /* @__PURE__ */ (0, import_jsx_runtime9.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_editor9.PAD_SAMPLE_SIZES.map((n) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: n, children: n === 1 ? "1 px" : `${n}\xD7${n}` }, n)) })
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)) })
1186
1206
  ] }) }),
1187
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1188
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: color } }),
1189
- /* @__PURE__ */ (0, import_jsx_runtime9.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" }),
1190
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-slate-500", children: ":" }),
1191
- /* @__PURE__ */ (0, import_jsx_runtime9.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" }),
1192
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: state.secondaryColor } }),
1193
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
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)(
1194
1214
  "button",
1195
1215
  {
1196
1216
  type: "button",
@@ -1209,25 +1229,25 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1209
1229
  }
1210
1230
  )
1211
1231
  ] }),
1212
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1213
- /* @__PURE__ */ (0, import_jsx_runtime9.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" }),
1214
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.saveMixingPad(padName || void 0), setPadName(""))), children: "Keep pad" })
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" })
1215
1235
  ] }),
1216
- state.savedMixingPads.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { className: "flex flex-col gap-0.5", "aria-label": "Kept pads", children: state.savedMixingPads.map((p) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("li", { className: "flex items-center gap-1", children: [
1217
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: `${button} flex-1 text-left`, onClick: () => attempt(() => controller.loadMixingPad(p.id)), children: p.name }),
1218
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: button, "aria-label": `Remove ${p.name}`, onClick: () => attempt(() => controller.removeMixingPad(p.id)), children: "\xD7" })
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" })
1219
1239
  ] }, p.id)) })
1220
1240
  ] }),
1221
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ErrorLine, { error })
1241
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ErrorLine, { error })
1222
1242
  ] });
1223
1243
  };
1224
1244
 
1225
1245
  // src/paint-editor/PaintLayersPanel.tsx
1226
- var import_react12 = require("react");
1227
- var import_paint_editor11 = require("@pixerate/editor/paint-editor");
1246
+ var import_react13 = require("react");
1247
+ var import_paint_editor10 = require("@pixerate/editor/paint-editor");
1228
1248
 
1229
1249
  // src/image-editor/LayerEffectsPanel.tsx
1230
- var import_react11 = require("react");
1250
+ var import_react12 = require("react");
1231
1251
  var import_raster = require("@pixerate/editor/raster");
1232
1252
 
1233
1253
  // src/image-editor/styles.ts
@@ -1236,17 +1256,17 @@ var imageSelectClass = "rounded border border-input bg-background px-1.5 py-1 te
1236
1256
  var imageColorInputClass = "h-6 w-8 rounded border border-border bg-transparent";
1237
1257
 
1238
1258
  // src/image-editor/controls/controls.tsx
1239
- var import_react10 = require("react");
1240
- var import_jsx_runtime10 = require("react/jsx-runtime");
1241
- var ControlsContext = (0, import_react10.createContext)({});
1259
+ var import_react11 = require("react");
1260
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1261
+ var ControlsContext = (0, import_react11.createContext)({});
1242
1262
  function useImageEditorControls() {
1243
- return (0, import_react10.useContext)(ControlsContext);
1263
+ return (0, import_react11.useContext)(ControlsContext);
1244
1264
  }
1245
1265
  function ImageCheckbox(props) {
1246
1266
  const Host = useImageEditorControls().Checkbox;
1247
- if (Host) return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Host, { ...props });
1267
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Host, { ...props });
1248
1268
  const { checked, label, disabled, onChange, className = "" } = props;
1249
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1269
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1250
1270
  "input",
1251
1271
  {
1252
1272
  type: "checkbox",
@@ -1260,9 +1280,9 @@ function ImageCheckbox(props) {
1260
1280
  }
1261
1281
  function ImageRange(props) {
1262
1282
  const Host = useImageEditorControls().Range;
1263
- if (Host) return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Host, { ...props });
1283
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Host, { ...props });
1264
1284
  const { value, min, max, step, label, disabled, onChange, onStart, onEnd, className = "" } = props;
1265
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1285
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1266
1286
  "input",
1267
1287
  {
1268
1288
  type: "range",
@@ -1283,18 +1303,18 @@ function ImageRange(props) {
1283
1303
  }
1284
1304
  function ImageSelect(props) {
1285
1305
  const Host = useImageEditorControls().Select;
1286
- if (Host) return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Host, { ...props });
1306
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Host, { ...props });
1287
1307
  const { value, options, label, placeholder, disabled, onChange, className = "" } = props;
1288
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("select", { "aria-label": label, value, disabled, onChange: (e) => onChange(e.target.value), className: `${imageSelectClass} ${className}`, children: [
1289
- placeholder !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "", children: placeholder }),
1290
- options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: o.value, children: o.label }, o.value))
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))
1291
1311
  ] });
1292
1312
  }
1293
1313
  function ImageColor(props) {
1294
1314
  const Host = useImageEditorControls().Color;
1295
- if (Host) return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Host, { ...props });
1315
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Host, { ...props });
1296
1316
  const { value, label, alpha, disabled, onChange, className = "" } = props;
1297
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1317
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1298
1318
  "input",
1299
1319
  {
1300
1320
  type: "color",
@@ -1308,13 +1328,13 @@ function ImageColor(props) {
1308
1328
  }
1309
1329
 
1310
1330
  // src/image-editor/LayerEffectsPanel.tsx
1311
- var import_jsx_runtime11 = require("react/jsx-runtime");
1331
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1312
1332
  var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) => {
1313
- const [, setTick] = (0, import_react11.useState)(0);
1314
- (0, import_react11.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
1315
- const [open, setOpen] = (0, import_react11.useState)(null);
1316
- const [error, setError] = (0, import_react11.useState)(null);
1317
- const commitNext = (0, import_react11.useRef)(true);
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);
1318
1338
  const layer = layerId ? controller.getLayer(layerId) : controller.getActiveLayer();
1319
1339
  const model = (0, import_raster.layerEffectsPanel)(layer);
1320
1340
  const id = layer?.id;
@@ -1327,7 +1347,7 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1327
1347
  }
1328
1348
  };
1329
1349
  if (!model.available || !id) {
1330
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: `text-xs text-muted-foreground ${className ?? ""}`, "data-testid": "layer-effects", children: model.reason });
1350
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `text-xs text-muted-foreground ${className ?? ""}`, "data-testid": "layer-effects", children: model.reason });
1331
1351
  }
1332
1352
  const effects = controller.getLayerEffects(id);
1333
1353
  const patterns = controller.getDocumentPatterns();
@@ -1342,14 +1362,14 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1342
1362
  case "range": {
1343
1363
  const k = c.percent ? 100 : 1;
1344
1364
  const shown = Math.round(c.value * k * 100) / 100;
1345
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1346
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "text-muted-foreground", children: [
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: [
1347
1367
  label,
1348
1368
  " ",
1349
1369
  shown,
1350
1370
  c.unit
1351
1371
  ] }),
1352
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1372
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1353
1373
  ImageRange,
1354
1374
  {
1355
1375
  label,
@@ -1366,19 +1386,19 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1366
1386
  ] }, c.key);
1367
1387
  }
1368
1388
  case "color":
1369
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1370
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ImageColor, { label, value: c.value, disabled: model.readOnly, onChange: (v) => change(effectId, c, v) }),
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) }),
1371
1391
  label
1372
1392
  ] }, c.key);
1373
1393
  case "checkbox":
1374
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1375
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ImageCheckbox, { label, checked: c.value, disabled: model.readOnly, onChange: (on) => change(effectId, c, on) }),
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) }),
1376
1396
  label
1377
1397
  ] }, c.key);
1378
1398
  case "select":
1379
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1380
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-muted-foreground", children: label }),
1381
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
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)(
1382
1402
  ImageSelect,
1383
1403
  {
1384
1404
  label,
@@ -1391,16 +1411,16 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1391
1411
  ] }, c.key);
1392
1412
  }
1393
1413
  };
1394
- return /* @__PURE__ */ (0, import_jsx_runtime11.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: [
1395
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
1396
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "font-semibold text-foreground", children: heading ? "Layer Style" : "Styles" }),
1397
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
1398
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ImageCheckbox, { label: "Effects on", checked: model.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.setLayerEffectsEnabled(id, on)) }),
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)) }),
1399
1419
  "On"
1400
1420
  ] }),
1401
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
1421
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
1402
1422
  "Scale",
1403
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1423
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1404
1424
  "input",
1405
1425
  {
1406
1426
  type: "number",
@@ -1419,7 +1439,7 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1419
1439
  ),
1420
1440
  "%"
1421
1441
  ] }),
1422
- heading && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1442
+ heading && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1423
1443
  ImageSelect,
1424
1444
  {
1425
1445
  label: "Add style",
@@ -1435,14 +1455,14 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1435
1455
  }
1436
1456
  )
1437
1457
  ] }),
1438
- model.readOnly && model.reason && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-muted-foreground", children: model.reason }),
1439
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Effects", children: model.rows.map((row) => {
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) => {
1440
1460
  const effect = effects.items.find((e) => e.id === row.id);
1441
1461
  const expanded = open === row.id;
1442
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("li", { "data-effect-id": row.id, className: "rounded bg-background/60 ring-1 ring-border", children: [
1443
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-1.5 px-1.5 py-1", children: [
1444
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ImageCheckbox, { label: `${row.label} on`, checked: row.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.updateLayerEffect(id, row.id, { enabled: on })) }),
1445
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
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)(
1446
1466
  "button",
1447
1467
  {
1448
1468
  type: "button",
@@ -1452,17 +1472,17 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1452
1472
  children: row.label
1453
1473
  }
1454
1474
  ),
1455
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: imageIconButtonClass, "aria-label": `Remove ${row.label}`, disabled: model.readOnly, onClick: () => attempt(() => controller.removeLayerEffect(id, row.id)), children: "\u2715" })
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" })
1456
1476
  ] }),
1457
- expanded && /* @__PURE__ */ (0, import_jsx_runtime11.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)) })
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)) })
1458
1478
  ] }, row.id);
1459
1479
  }) }),
1460
- error && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { role: "alert", className: "text-destructive", children: error })
1480
+ error && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { role: "alert", className: "text-destructive", children: error })
1461
1481
  ] });
1462
1482
  };
1463
1483
 
1464
1484
  // src/paint-editor/PaintLayersPanel.tsx
1465
- var import_jsx_runtime12 = require("react/jsx-runtime");
1485
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1466
1486
  function siblingIndex(layers, l) {
1467
1487
  const sibs = layers.filter((x) => x.parentId === l.parentId).reverse();
1468
1488
  return { index: sibs.findIndex((x) => x.id === l.id), count: sibs.length };
@@ -1470,7 +1490,7 @@ function siblingIndex(layers, l) {
1470
1490
  var PaintLayersPanel = ({ controller, className }) => {
1471
1491
  usePaintEditorState(controller);
1472
1492
  const [error, attempt] = useAttempt();
1473
- const [renaming, setRenaming] = (0, import_react12.useState)(null);
1493
+ const [renaming, setRenaming] = (0, import_react13.useState)(null);
1474
1494
  const layers = controller.listLayers();
1475
1495
  const active = layers.find((l) => l.active) ?? null;
1476
1496
  const light = active?.type === "pixel" ? controller.lightOf(active.id) : null;
@@ -1480,18 +1500,18 @@ var PaintLayersPanel = ({ controller, className }) => {
1480
1500
  const to = Math.min(count - 1, Math.max(0, index + delta));
1481
1501
  if (to !== index) attempt(() => controller.moveLayer(active.id, to));
1482
1502
  };
1483
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-layers-panel", children: [
1484
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1485
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer()), children: "New layer" }),
1486
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer({ type: "group" })), children: "New group" }),
1487
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, title: "A layer whose strokes stay editable", onClick: () => attempt(() => controller.addLayer({ type: "strokes" })), children: "New stroke layer" }),
1488
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.duplicateLayer(active.id)), children: "Duplicate" }),
1489
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer up", onClick: () => move(1), children: "\u2191" }),
1490
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer down", onClick: () => move(-1), children: "\u2193" }),
1491
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.mergeDown(active.id)), children: "Merge down" }),
1492
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, disabled: !active || layers.length < 2, onClick: () => active && attempt(() => controller.removeLayer(active.id)), children: "Delete" })
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" })
1493
1513
  ] }),
1494
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { role: "tree", "aria-label": "Layers", className: "flex flex-col gap-0.5", children: layers.map((l) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
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)(
1495
1515
  "li",
1496
1516
  {
1497
1517
  role: "treeitem",
@@ -1500,7 +1520,7 @@ var PaintLayersPanel = ({ controller, className }) => {
1500
1520
  style: { paddingLeft: 6 + l.depth * 12 },
1501
1521
  onClick: () => controller.setActiveLayer(l.id),
1502
1522
  children: [
1503
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1523
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1504
1524
  "button",
1505
1525
  {
1506
1526
  type: "button",
@@ -1513,7 +1533,7 @@ var PaintLayersPanel = ({ controller, className }) => {
1513
1533
  children: l.visible ? "\u25CF" : "\u25CB"
1514
1534
  }
1515
1535
  ),
1516
- renaming === l.id ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1536
+ renaming === l.id ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1517
1537
  "input",
1518
1538
  {
1519
1539
  autoFocus: true,
@@ -1530,23 +1550,23 @@ var PaintLayersPanel = ({ controller, className }) => {
1530
1550
  if (e.key === "Escape") setRenaming(null);
1531
1551
  }
1532
1552
  }
1533
- ) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "flex-1 truncate", onDoubleClick: () => setRenaming(l.id), children: [
1553
+ ) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "flex-1 truncate", onDoubleClick: () => setRenaming(l.id), children: [
1534
1554
  l.type === "group" ? "\u25B8 " : "",
1535
- l.liveStrokes !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { "aria-label": "Stroke layer", title: `Stroke layer: ${l.liveStrokes} editable strokes`, children: [
1555
+ l.liveStrokes !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { "aria-label": "Stroke layer", title: `Stroke layer: ${l.liveStrokes} editable strokes`, children: [
1536
1556
  "\u270E",
1537
1557
  " "
1538
1558
  ] }),
1539
1559
  l.name
1540
1560
  ] }),
1541
- l.locks.pixels || l.locks.all ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { title: "Locked", children: "\u{1F512}" }) : null
1561
+ l.locks.pixels || l.locks.all ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { title: "Locked", children: "\u{1F512}" }) : null
1542
1562
  ]
1543
1563
  },
1544
1564
  l.id
1545
1565
  )) }),
1546
- active && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
1547
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center gap-2", children: [
1548
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w-14 text-slate-400", children: "Opacity" }),
1549
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
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)(
1550
1570
  "input",
1551
1571
  {
1552
1572
  type: "range",
@@ -1560,40 +1580,40 @@ var PaintLayersPanel = ({ controller, className }) => {
1560
1580
  }
1561
1581
  )
1562
1582
  ] }),
1563
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center gap-2", children: [
1564
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w-14 text-slate-400", children: "Blend" }),
1565
- /* @__PURE__ */ (0, import_jsx_runtime12.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: [
1566
- active.type === "group" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "pass-through", children: "Pass through" }),
1567
- import_paint_editor11.BLEND_MENU_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("optgroup", { label: g.label, children: g.modes.map((m) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: m.id, title: m.description, children: m.label }, m.id)) }, g.label))
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))
1568
1588
  ] })
1569
1589
  ] }),
1570
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex gap-1", children: [
1571
- ["pixels", "transparency"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime12.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)),
1572
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", "aria-pressed": active.clipped, className: chip(active.clipped), onClick: () => attempt(() => controller.updateLayer(active.id, { clipped: !active.clipped })), children: "Clip" })
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" })
1573
1593
  ] }),
1574
- light?.hasLight && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-col gap-1.5 border-t border-slate-800 pt-1.5", "data-testid": "layer-light", children: [
1575
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center justify-between", children: [
1576
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "font-medium text-slate-300", title: "This layer's paint gives off light", children: "Light" }),
1577
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.clearLight(active.id)), children: "Clear light" })
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" })
1578
1598
  ] }),
1579
- /* @__PURE__ */ (0, import_jsx_runtime12.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: [
1580
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w-14 text-slate-400", children: "Spill" }),
1581
- /* @__PURE__ */ (0, import_jsx_runtime12.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" })
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" })
1582
1602
  ] }),
1583
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center gap-2", children: [
1584
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w-14 text-slate-400", children: "Strength" }),
1585
- /* @__PURE__ */ (0, import_jsx_runtime12.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" })
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" })
1586
1606
  ] })
1587
1607
  ] }),
1588
- /* @__PURE__ */ (0, import_jsx_runtime12.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_runtime12.jsx)(LayerEffectsPanel, { controller, layerId: active.id }) })
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 }) })
1589
1609
  ] }),
1590
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ErrorLine, { error })
1610
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ErrorLine, { error })
1591
1611
  ] });
1592
1612
  };
1593
1613
 
1594
1614
  // src/paint-editor/WetPanel.tsx
1595
- var import_paint_editor12 = require("@pixerate/editor/paint-editor");
1596
- var import_jsx_runtime13 = require("react/jsx-runtime");
1615
+ var import_paint_editor11 = require("@pixerate/editor/paint-editor");
1616
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1597
1617
  var FLOW_LABELS = { none: "None", linear: "One way", swirl: "Swirl", radial: "Outwards", turbulent: "Eddies" };
1598
1618
  var WetPanel = ({ controller, className }) => {
1599
1619
  const state = usePaintEditorState(controller);
@@ -1602,31 +1622,31 @@ var WetPanel = ({ controller, className }) => {
1602
1622
  const layerId = state.document.activeLayerId;
1603
1623
  const info = layerId ? controller.wetLayerInfo(layerId) : null;
1604
1624
  const backend = controller.wetState();
1605
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "wet-panel", children: [
1606
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center justify-between", children: [
1607
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: wet.wet ? "text-sky-300" : "text-slate-400", "data-testid": "wet-status", children: wet.wet ? wet.paused ? "Wet (paused)" : "Wet" : "Dry" }),
1608
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "text-[10px] text-slate-500", children: [
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: [
1609
1629
  "step ",
1610
1630
  wet.clock
1611
1631
  ] })
1612
1632
  ] }),
1613
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1614
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: button, disabled: !wet.layerIds.length, onClick: () => attempt(async () => (await controller.wetIdle(), controller.dryPaint())), children: "Dry now" }),
1615
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: chip(wet.paused), "aria-pressed": wet.paused, onClick: () => controller.setWetPaused(!wet.paused), children: wet.paused ? "Resume" : "Pause" }),
1616
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: chip(wet.overlay), "aria-pressed": wet.overlay, onClick: () => controller.setWaterOverlay(!wet.overlay), children: "Water" }),
1617
- /* @__PURE__ */ (0, import_jsx_runtime13.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" }),
1618
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: button, disabled: !layerId, onClick: () => attempt(async () => (await controller.wetIdle(), controller.wetPaper({}))), children: "Wet paper" })
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" })
1619
1639
  ] }),
1620
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaintSlider, { control: import_paint_editor12.WET_SPEED_SLIDER, value: wet.speed, onChange: (v) => controller.setWetSpeed(v) }),
1621
- import_paint_editor12.WET_TILT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor12.readPath)(wet.tilt, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setCanvasTilt({ [c.path]: v }))) }, c.path)),
1622
- info && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-layer", children: [
1623
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "font-medium text-slate-300", children: "This layer" }),
1624
- import_paint_editor12.WET_PARAM_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor12.readPath)(info.params, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setWetParams(layerId, { [c.path]: v }))) }, c.path)),
1625
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
1626
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-slate-400", children: "Flow map" }),
1627
- /* @__PURE__ */ (0, import_jsx_runtime13.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_editor12.WET_FLOW_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: k, children: FLOW_LABELS[k] }, k)) })
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)) })
1628
1648
  ] }),
1629
- info.flow.kind !== "none" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1649
+ info.flow.kind !== "none" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1630
1650
  PaintSlider,
1631
1651
  {
1632
1652
  control: { path: "strength", label: "Flow strength", min: 0, max: 1, step: 0.01 },
@@ -1635,20 +1655,20 @@ var WetPanel = ({ controller, className }) => {
1635
1655
  }
1636
1656
  )
1637
1657
  ] }),
1638
- backend.message && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-[10px] text-amber-300", "data-testid": "wet-message", children: backend.message }),
1639
- backend.backend && /* @__PURE__ */ (0, import_jsx_runtime13.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" }),
1640
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
1641
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-slate-400", children: "Engine" }),
1642
- /* @__PURE__ */ (0, import_jsx_runtime13.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_editor12.WET_GPU_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: o.value, children: o.label }, o.value)) })
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)) })
1643
1663
  ] }),
1644
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: `text-[10px] ${backend.engine.state === "active" ? "text-emerald-300" : "text-slate-500"}`, "data-testid": "wet-engine", children: (0, import_paint_editor12.wetEngineSummary)(backend.engine) }),
1645
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ErrorLine, { error })
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 })
1646
1666
  ] });
1647
1667
  };
1648
1668
 
1649
1669
  // src/paint-editor/StickerPanel.tsx
1650
- var import_paint_editor13 = require("@pixerate/editor/paint-editor");
1651
- var import_jsx_runtime14 = require("react/jsx-runtime");
1670
+ var import_paint_editor12 = require("@pixerate/editor/paint-editor");
1671
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1652
1672
  var StickerPanel = ({ controller, className }) => {
1653
1673
  const state = usePaintEditorState(controller);
1654
1674
  const [error, attempt] = useAttempt();
@@ -1658,16 +1678,16 @@ var StickerPanel = ({ controller, className }) => {
1658
1678
  const stickers = layerId ? state.document.stickers?.[layerId] ?? [] : [];
1659
1679
  if (!stickers.length) return null;
1660
1680
  const sel = stickers.find((s) => s.id === picked) ?? null;
1661
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "sticker-panel", children: [
1662
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "font-medium text-slate-300", children: [
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: [
1663
1683
  "Stickers (",
1664
1684
  stickers.length,
1665
1685
  ")"
1666
1686
  ] }),
1667
- /* @__PURE__ */ (0, import_jsx_runtime14.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_runtime14.jsx)("button", { type: "button", role: "option", "aria-selected": s.id === picked, title: `${(0, import_paint_editor13.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)) }),
1668
- sel && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "sticker-edit", children: [
1669
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-slate-400", children: "Sticker" }),
1670
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
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)(
1671
1691
  StickerPicker,
1672
1692
  {
1673
1693
  controller,
@@ -1681,9 +1701,9 @@ var StickerPanel = ({ controller, className }) => {
1681
1701
  )
1682
1702
  }
1683
1703
  ),
1684
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
1685
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-slate-400", children: "Position" }),
1686
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "flex gap-1", children: ["x", "y"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
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)(
1687
1707
  "input",
1688
1708
  {
1689
1709
  type: "number",
@@ -1697,24 +1717,24 @@ var StickerPanel = ({ controller, className }) => {
1697
1717
  `${sel.id}-${k}-${sel[k]}`
1698
1718
  )) })
1699
1719
  ] }),
1700
- import_paint_editor13.STICKER_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor13.readPath)(sel, c.path), onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { [c.path]: v })) }, c.path)),
1701
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center justify-between", children: [
1702
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-slate-400", children: "Colour" }),
1703
- /* @__PURE__ */ (0, import_jsx_runtime14.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" })
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" })
1704
1724
  ] }),
1705
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1706
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "front")), children: "To front" }),
1707
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "back")), children: "To back" }),
1708
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStickers(layerId, [sel.id]), setPicked(null))), children: "Delete" })
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" })
1709
1729
  ] })
1710
1730
  ] }),
1711
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ErrorLine, { error })
1731
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ErrorLine, { error })
1712
1732
  ] });
1713
1733
  };
1714
1734
 
1715
1735
  // src/paint-editor/StrokePanel.tsx
1716
- var import_paint_editor14 = require("@pixerate/editor/paint-editor");
1717
- var import_jsx_runtime15 = require("react/jsx-runtime");
1736
+ var import_paint_editor13 = require("@pixerate/editor/paint-editor");
1737
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1718
1738
  var StrokePanel = ({ controller, className }) => {
1719
1739
  const state = usePaintEditorState(controller);
1720
1740
  const [error, attempt] = useAttempt();
@@ -1723,17 +1743,17 @@ var StrokePanel = ({ controller, className }) => {
1723
1743
  if (!layerId || !strokes) return null;
1724
1744
  const index = strokes.findIndex((s) => s.id === state.selectedStroke);
1725
1745
  const sel = index >= 0 ? strokes[index] : null;
1726
- const brushes = state.brushes.filter((b) => !(0, import_paint_editor14.liveStrokeRefusal)(b));
1727
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "stroke-panel", children: [
1728
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center justify-between", children: [
1729
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "font-medium text-slate-300", children: [
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: [
1730
1750
  "Strokes (",
1731
1751
  strokes.length,
1732
1752
  ")"
1733
1753
  ] }),
1734
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.rasterizeLiveStrokes(layerId)), children: "Rasterize" })
1754
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.rasterizeLiveStrokes(layerId)), children: "Rasterize" })
1735
1755
  ] }),
1736
- /* @__PURE__ */ (0, import_jsx_runtime15.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_runtime15.jsx)(
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)(
1737
1757
  "button",
1738
1758
  {
1739
1759
  type: "button",
@@ -1746,10 +1766,10 @@ var StrokePanel = ({ controller, className }) => {
1746
1766
  },
1747
1767
  s.id
1748
1768
  )) }),
1749
- sel && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "stroke-edit", children: [
1750
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
1751
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-slate-400", children: "Brush" }),
1752
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
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)(
1753
1773
  "select",
1754
1774
  {
1755
1775
  "aria-label": "Stroke brush",
@@ -1757,51 +1777,51 @@ var StrokePanel = ({ controller, className }) => {
1757
1777
  onChange: (e) => e.target.value && attempt(() => controller.updateStroke(sel.id, { brushId: e.target.value })),
1758
1778
  className: "max-w-[10rem] rounded bg-slate-800 px-1 py-0.5",
1759
1779
  children: [
1760
- !brushes.some((b) => b.id === sel.brush.id) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "", children: sel.brush.name }),
1761
- brushes.map((b) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: b.id, children: b.name }, b.id))
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))
1762
1782
  ]
1763
1783
  }
1764
1784
  )
1765
1785
  ] }),
1766
- import_paint_editor14.STROKE_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor14.readPath)(sel.brush, c.path), onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { brush: { tip: { [c.path.split(".")[1]]: v } } })) }, c.path)),
1767
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center justify-between", children: [
1768
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-slate-400", children: "Colour" }),
1769
- /* @__PURE__ */ (0, import_jsx_runtime15.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" })
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" })
1770
1790
  ] }),
1771
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1772
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.updateStroke(sel.id, { seed: (sel.seed + 1) % 2147483647 })), children: "New seed" }),
1773
- /* @__PURE__ */ (0, import_jsx_runtime15.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" }),
1774
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, disabled: index === 0, "aria-label": "Move stroke down", onClick: () => attempt(() => controller.reorderStroke(sel.id, index - 1)), children: "\u2193" }),
1775
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStrokes([sel.id]), controller.selectStroke(null))), children: "Delete" })
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" })
1776
1796
  ] })
1777
1797
  ] }),
1778
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ErrorLine, { error })
1798
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ErrorLine, { error })
1779
1799
  ] });
1780
1800
  };
1781
1801
 
1782
1802
  // src/paint-editor/PaintEditor.tsx
1783
- var import_react26 = require("react");
1784
- var import_paint_editor16 = require("@pixerate/editor/paint-editor");
1803
+ var import_react27 = require("react");
1804
+ var import_paint_editor15 = require("@pixerate/editor/paint-editor");
1785
1805
 
1786
1806
  // src/playback/AgentPlaybackContext.tsx
1787
- var import_react13 = require("react");
1788
- var import_jsx_runtime16 = require("react/jsx-runtime");
1789
- var AgentPlaybackContext = (0, import_react13.createContext)(null);
1807
+ var import_react14 = require("react");
1808
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1809
+ var AgentPlaybackContext = (0, import_react14.createContext)(null);
1790
1810
  function useAgentPlayback() {
1791
- return (0, import_react13.useContext)(AgentPlaybackContext);
1811
+ return (0, import_react14.useContext)(AgentPlaybackContext);
1792
1812
  }
1793
1813
 
1794
1814
  // src/playback/usePlaybackSurface.ts
1795
- var import_react14 = require("react");
1815
+ var import_react15 = require("react");
1796
1816
  var import_tools = require("@pixerate/editor/tools");
1797
1817
  function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
1798
1818
  const ambient = useAgentPlayback();
1799
1819
  const target = playback === void 0 ? ambient : playback;
1800
- const [ownPresence] = (0, import_react14.useState)(() => new import_tools.PresenceStore());
1820
+ const [ownPresence] = (0, import_react15.useState)(() => new import_tools.PresenceStore());
1801
1821
  const presence = sharedPresence ?? ownPresence;
1802
- const latest = (0, import_react14.useRef)(options);
1822
+ const latest = (0, import_react15.useRef)(options);
1803
1823
  latest.current = options;
1804
- (0, import_react14.useEffect)(() => {
1824
+ (0, import_react15.useEffect)(() => {
1805
1825
  if (!target || !id) return;
1806
1826
  const o = () => latest.current;
1807
1827
  const surface = {
@@ -1833,13 +1853,13 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
1833
1853
  }
1834
1854
 
1835
1855
  // src/playback/PresenceLayer.tsx
1836
- var import_react15 = __toESM(require("react"), 1);
1837
- var import_jsx_runtime17 = require("react/jsx-runtime");
1856
+ var import_react16 = __toESM(require("react"), 1);
1857
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1838
1858
  function PresenceLayer({ presence, viewport, clip = true, renderCursor, className = "" }) {
1839
- const { actors } = (0, import_react15.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
1859
+ const { actors } = (0, import_react16.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
1840
1860
  if (!actors.length) return null;
1841
1861
  const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
1842
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1862
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1843
1863
  "div",
1844
1864
  {
1845
1865
  className: `pixerate-presence ${className}`.trim(),
@@ -1853,19 +1873,19 @@ function PresenceLayer({ presence, viewport, clip = true, renderCursor, classNam
1853
1873
  const br = map({ x: a.focus.x + a.focus.width, y: a.focus.y + a.focus.height });
1854
1874
  return { left: tl.x - 4, top: tl.y - 4, width: br.x - tl.x + 8, height: br.y - tl.y + 8 };
1855
1875
  })();
1856
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react15.default.Fragment, { children: [
1857
- ring && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1876
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react16.default.Fragment, { children: [
1877
+ ring && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1858
1878
  "div",
1859
1879
  {
1860
1880
  "data-actor-focus": a.id,
1861
1881
  style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
1862
1882
  }
1863
1883
  ),
1864
- /* @__PURE__ */ (0, import_jsx_runtime17.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_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
1865
- /* @__PURE__ */ (0, import_jsx_runtime17.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_runtime17.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 } }) }),
1866
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
1867
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
1868
- a.message && /* @__PURE__ */ (0, import_jsx_runtime17.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 })
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 })
1869
1889
  ] })
1870
1890
  ] }) })
1871
1891
  ] }, a.id);
@@ -1875,15 +1895,15 @@ function PresenceLayer({ presence, viewport, clip = true, renderCursor, classNam
1875
1895
  }
1876
1896
 
1877
1897
  // src/paint-editor/PaintEffectsPanel.tsx
1878
- var import_react25 = require("react");
1879
- var import_paint_editor15 = require("@pixerate/editor/paint-editor");
1898
+ var import_react26 = require("react");
1899
+ var import_paint_editor14 = require("@pixerate/editor/paint-editor");
1880
1900
 
1881
1901
  // src/effects/useEffects.ts
1882
- var import_react16 = require("react");
1902
+ var import_react17 = require("react");
1883
1903
  function useEffectDescription(provider, effect) {
1884
- const [state, setState] = (0, import_react16.useState)({ key: "", description: null, error: null });
1904
+ const [state, setState] = (0, import_react17.useState)({ key: "", description: null, error: null });
1885
1905
  const key = provider && effect ? `${provider.id}:${effect}` : "";
1886
- (0, import_react16.useEffect)(() => {
1906
+ (0, import_react17.useEffect)(() => {
1887
1907
  if (!provider || !effect) return;
1888
1908
  let live = true;
1889
1909
  Promise.resolve().then(() => provider.describe(effect)).then(
@@ -1898,14 +1918,14 @@ function useEffectDescription(provider, effect) {
1898
1918
  }
1899
1919
 
1900
1920
  // src/effects/EffectThumbnail.tsx
1901
- var import_react17 = require("react");
1921
+ var import_react18 = require("react");
1902
1922
  var import_effects = require("@pixerate/editor/effects");
1903
- var import_jsx_runtime18 = require("react/jsx-runtime");
1923
+ var import_jsx_runtime19 = require("react/jsx-runtime");
1904
1924
  var LABELS = { motion: "Motion", camera: "Camera" };
1905
1925
  function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
1906
- const ref = (0, import_react17.useRef)(null);
1907
- const [failed, setFailed] = (0, import_react17.useState)(effect.kind in LABELS);
1908
- (0, import_react17.useEffect)(() => {
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)(() => {
1909
1929
  if (effect.kind in LABELS) return;
1910
1930
  let live = true;
1911
1931
  (0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
@@ -1920,28 +1940,28 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
1920
1940
  live = false;
1921
1941
  };
1922
1942
  }, [provider, effect, width, height]);
1923
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1943
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1924
1944
  "div",
1925
1945
  {
1926
1946
  className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
1927
1947
  style: { aspectRatio: `${width} / ${height}` },
1928
1948
  "data-effect-thumbnail": effect.id,
1929
- children: failed ? /* @__PURE__ */ (0, import_jsx_runtime18.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_runtime18.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
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" })
1930
1950
  }
1931
1951
  );
1932
1952
  }
1933
1953
 
1934
1954
  // src/effects/EffectsBrowser.tsx
1935
- var import_react18 = require("react");
1955
+ var import_react19 = require("react");
1936
1956
  var import_effects2 = require("@pixerate/editor/effects");
1937
- var import_jsx_runtime19 = require("react/jsx-runtime");
1957
+ var import_jsx_runtime20 = require("react/jsx-runtime");
1938
1958
  function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
1939
- const [all, setAll] = (0, import_react18.useState)([]);
1940
- const [query, setQuery] = (0, import_react18.useState)("");
1941
- const [category, setCategory] = (0, import_react18.useState)("");
1942
- const [use, setUse] = (0, import_react18.useState)("");
1943
- const [error, setError] = (0, import_react18.useState)(null);
1944
- (0, import_react18.useEffect)(() => {
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)(() => {
1945
1965
  if (!provider) return setAll([]);
1946
1966
  let live = true;
1947
1967
  Promise.resolve().then(() => provider.list()).then(
@@ -1952,8 +1972,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1952
1972
  live = false;
1953
1973
  };
1954
1974
  }, [provider]);
1955
- const [found, setFound] = (0, import_react18.useState)([]);
1956
- (0, import_react18.useEffect)(() => {
1975
+ const [found, setFound] = (0, import_react19.useState)([]);
1976
+ (0, import_react19.useEffect)(() => {
1957
1977
  if (!provider) return setFound([]);
1958
1978
  let live = true;
1959
1979
  Promise.resolve().then(() => provider.search(query, { ...category ? { category } : {}, ...use ? { use } : {} })).then((list) => live && setFound(list), () => live && setFound([]));
@@ -1962,14 +1982,14 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1962
1982
  };
1963
1983
  }, [provider, query, category, use]);
1964
1984
  const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses);
1965
- const categories = (0, import_react18.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
1985
+ const categories = (0, import_react19.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
1966
1986
  const shown = found.filter(allowed);
1967
1987
  if (!provider)
1968
- return /* @__PURE__ */ (0, import_jsx_runtime19.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." });
1969
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
1970
- title && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h3", { className: "text-xs font-semibold", children: title }),
1971
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1972
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
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)(
1973
1993
  "input",
1974
1994
  {
1975
1995
  type: "search",
@@ -1980,17 +2000,17 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1980
2000
  onChange: (e) => setQuery(e.currentTarget.value)
1981
2001
  }
1982
2002
  ),
1983
- /* @__PURE__ */ (0, import_jsx_runtime19.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: [
1984
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "", children: "All categories" }),
1985
- categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: c, children: c }, c))
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))
1986
2006
  ] }),
1987
- uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime19.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: [
1988
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "", children: "Any use" }),
1989
- uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
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))
1990
2010
  ] })
1991
2011
  ] }),
1992
- error && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
1993
- /* @__PURE__ */ (0, import_jsx_runtime19.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_runtime19.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
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)(
1994
2014
  "button",
1995
2015
  {
1996
2016
  type: "button",
@@ -1999,23 +2019,23 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1999
2019
  "data-effect-id": e.id,
2000
2020
  onClick: () => onPick(e),
2001
2021
  children: [
2002
- thumbnails && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(EffectThumbnail, { provider, effect: e }),
2003
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
2004
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
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 ") })
2005
2025
  ]
2006
2026
  }
2007
2027
  ) }, e.id)) }),
2008
- !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
2028
+ !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
2009
2029
  ] });
2010
2030
  }
2011
2031
 
2012
2032
  // src/effects/EffectParameters.tsx
2013
- var import_react24 = __toESM(require("react"), 1);
2033
+ var import_react25 = __toESM(require("react"), 1);
2014
2034
  var import_effects3 = require("@pixerate/editor/effects");
2015
2035
  var import_parameters2 = require("@pixerate/editor/parameters");
2016
2036
 
2017
2037
  // src/parameters/fields.tsx
2018
- var import_react23 = require("react");
2038
+ var import_react24 = require("react");
2019
2039
  var import_parameters = require("@pixerate/editor/parameters");
2020
2040
 
2021
2041
  // src/color/index.ts
@@ -2028,9 +2048,9 @@ __export(color_exports, {
2028
2048
  });
2029
2049
 
2030
2050
  // src/color/ColorPicker.tsx
2031
- var import_react19 = require("react");
2051
+ var import_react20 = require("react");
2032
2052
  var import_color = require("@pixerate/editor/color");
2033
- var import_jsx_runtime20 = require("react/jsx-runtime");
2053
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2034
2054
  var LOCAL_STORAGE_KEY = "pixerate:color:recent";
2035
2055
  function readLocalRecents() {
2036
2056
  try {
@@ -2068,24 +2088,24 @@ var ColorPicker = ({
2068
2088
  id,
2069
2089
  "aria-label": ariaLabel = "Color picker"
2070
2090
  }) => {
2071
- const generatedId = (0, import_react19.useId)();
2091
+ const generatedId = (0, import_react20.useId)();
2072
2092
  const pickerId = id || generatedId;
2073
- const [pickerState, setPickerState] = (0, import_react19.useState)(
2093
+ const [pickerState, setPickerState] = (0, import_react20.useState)(
2074
2094
  () => (0, import_color.pickerStateFromColor)(value) ?? DEFAULT_PICKER_STATE
2075
2095
  );
2076
- const stateRef = (0, import_react19.useRef)(pickerState);
2096
+ const stateRef = (0, import_react20.useRef)(pickerState);
2077
2097
  stateRef.current = pickerState;
2078
- (0, import_react19.useEffect)(() => {
2098
+ (0, import_react20.useEffect)(() => {
2079
2099
  const next = (0, import_color.pickerStateFromColor)(value, stateRef.current);
2080
2100
  if (next) {
2081
2101
  setPickerState(next);
2082
2102
  }
2083
2103
  }, [value]);
2084
- const [internalRecent, setInternalRecent] = (0, import_react19.useState)(
2104
+ const [internalRecent, setInternalRecent] = (0, import_react20.useState)(
2085
2105
  () => controlledRecent ? [] : readLocalRecents()
2086
2106
  );
2087
2107
  const activeRecent = controlledRecent ?? internalRecent;
2088
- const recordRecent = (0, import_react19.useCallback)(
2108
+ const recordRecent = (0, import_react20.useCallback)(
2089
2109
  (color) => {
2090
2110
  const updated = (0, import_color.pushRecentColor)(activeRecent, color, 12);
2091
2111
  if (!controlledRecent) {
@@ -2096,11 +2116,11 @@ var ColorPicker = ({
2096
2116
  },
2097
2117
  [activeRecent, controlledRecent, onRecentChange]
2098
2118
  );
2099
- const [textDraft, setTextDraft] = (0, import_react19.useState)(value);
2100
- const [isInvalid, setIsInvalid] = (0, import_react19.useState)(false);
2101
- const [isClipped, setIsClipped] = (0, import_react19.useState)(false);
2102
- const isTypingRef = (0, import_react19.useRef)(false);
2103
- (0, import_react19.useEffect)(() => {
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)(() => {
2104
2124
  if (!isTypingRef.current) {
2105
2125
  setTextDraft(value);
2106
2126
  setIsInvalid(false);
@@ -2108,11 +2128,11 @@ var ColorPicker = ({
2108
2128
  setIsClipped(Boolean(parsed && !(0, import_color.inSrgbGamut)(parsed)));
2109
2129
  }
2110
2130
  }, [value]);
2111
- const [hasEyeDropper, setHasEyeDropper] = (0, import_react19.useState)(false);
2112
- (0, import_react19.useEffect)(() => {
2131
+ const [hasEyeDropper, setHasEyeDropper] = (0, import_react20.useState)(false);
2132
+ (0, import_react20.useEffect)(() => {
2113
2133
  setHasEyeDropper(typeof window !== "undefined" && "EyeDropper" in window);
2114
2134
  }, []);
2115
- const emitColorChange = (0, import_react19.useCallback)(
2135
+ const emitColorChange = (0, import_react20.useCallback)(
2116
2136
  (nextState) => {
2117
2137
  setPickerState(nextState);
2118
2138
  const hex = (0, import_color.pickerStateToHex)(nextState, alpha);
@@ -2120,10 +2140,10 @@ var ColorPicker = ({
2120
2140
  },
2121
2141
  [alpha, onChange]
2122
2142
  );
2123
- const latest = (0, import_react19.useRef)({ emitColorChange, recordRecent, onGestureEnd, alpha });
2143
+ const latest = (0, import_react20.useRef)({ emitColorChange, recordRecent, onGestureEnd, alpha });
2124
2144
  latest.current = { emitColorChange, recordRecent, onGestureEnd, alpha };
2125
- const endDragRef = (0, import_react19.useRef)(null);
2126
- (0, import_react19.useEffect)(() => () => endDragRef.current?.(), []);
2145
+ const endDragRef = (0, import_react20.useRef)(null);
2146
+ (0, import_react20.useEffect)(() => () => endDragRef.current?.(), []);
2127
2147
  const startDrag = (e, next) => {
2128
2148
  if (disabled) return;
2129
2149
  e.preventDefault();
@@ -2225,7 +2245,7 @@ var ColorPicker = ({
2225
2245
  } catch {
2226
2246
  }
2227
2247
  };
2228
- const contrastResult = (0, import_react19.useMemo)(() => {
2248
+ const contrastResult = (0, import_react20.useMemo)(() => {
2229
2249
  if (!contrastAgainst) return null;
2230
2250
  const fg = (0, import_color.parseColor)(value);
2231
2251
  const bg = (0, import_color.parseColor)(contrastAgainst);
@@ -2237,7 +2257,7 @@ var ColorPicker = ({
2237
2257
  }, [value, contrastAgainst]);
2238
2258
  const currentHex = (0, import_color.pickerStateToHex)(pickerState, alpha);
2239
2259
  const liveDescription = `Selected color: ${value}${contrastResult ? `, contrast ${contrastResult.ratio.toFixed(1)}:1 against ${contrastAgainst}, ${contrastResult.aa ? "passes AA" : "fails AA"}` : ""}`;
2240
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2260
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2241
2261
  "div",
2242
2262
  {
2243
2263
  id: pickerId,
@@ -2261,7 +2281,7 @@ var ColorPicker = ({
2261
2281
  pointerEvents: disabled ? "none" : "auto"
2262
2282
  },
2263
2283
  children: [
2264
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2284
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2265
2285
  "span",
2266
2286
  {
2267
2287
  role: "status",
@@ -2280,7 +2300,7 @@ var ColorPicker = ({
2280
2300
  children: liveDescription
2281
2301
  }
2282
2302
  ),
2283
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2303
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2284
2304
  "div",
2285
2305
  {
2286
2306
  role: "slider",
@@ -2302,7 +2322,7 @@ var ColorPicker = ({
2302
2322
  touchAction: "none",
2303
2323
  outline: "none"
2304
2324
  },
2305
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2325
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2306
2326
  "div",
2307
2327
  {
2308
2328
  style: {
@@ -2322,7 +2342,7 @@ var ColorPicker = ({
2322
2342
  )
2323
2343
  }
2324
2344
  ),
2325
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2345
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2326
2346
  "div",
2327
2347
  {
2328
2348
  role: "slider",
@@ -2345,7 +2365,7 @@ var ColorPicker = ({
2345
2365
  touchAction: "none",
2346
2366
  outline: "none"
2347
2367
  },
2348
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2368
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2349
2369
  "div",
2350
2370
  {
2351
2371
  style: {
@@ -2365,7 +2385,7 @@ var ColorPicker = ({
2365
2385
  )
2366
2386
  }
2367
2387
  ),
2368
- alpha && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2388
+ alpha && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2369
2389
  "div",
2370
2390
  {
2371
2391
  role: "slider",
@@ -2391,7 +2411,7 @@ var ColorPicker = ({
2391
2411
  overflow: "hidden"
2392
2412
  },
2393
2413
  children: [
2394
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2414
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2395
2415
  "div",
2396
2416
  {
2397
2417
  style: {
@@ -2401,7 +2421,7 @@ var ColorPicker = ({
2401
2421
  }
2402
2422
  }
2403
2423
  ),
2404
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2424
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2405
2425
  "div",
2406
2426
  {
2407
2427
  style: {
@@ -2422,8 +2442,8 @@ var ColorPicker = ({
2422
2442
  ]
2423
2443
  }
2424
2444
  ),
2425
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
2426
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
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)(
2427
2447
  "div",
2428
2448
  {
2429
2449
  style: {
@@ -2437,7 +2457,7 @@ var ColorPicker = ({
2437
2457
  flexShrink: 0,
2438
2458
  border: "1px solid rgba(255,255,255,0.15)"
2439
2459
  },
2440
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2460
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2441
2461
  "div",
2442
2462
  {
2443
2463
  style: {
@@ -2449,7 +2469,7 @@ var ColorPicker = ({
2449
2469
  )
2450
2470
  }
2451
2471
  ),
2452
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2472
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2453
2473
  "input",
2454
2474
  {
2455
2475
  type: "text",
@@ -2479,7 +2499,7 @@ var ColorPicker = ({
2479
2499
  }
2480
2500
  }
2481
2501
  ),
2482
- hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2502
+ hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2483
2503
  "button",
2484
2504
  {
2485
2505
  type: "button",
@@ -2499,7 +2519,7 @@ var ColorPicker = ({
2499
2519
  color: "inherit",
2500
2520
  cursor: disabled ? "default" : "pointer"
2501
2521
  },
2502
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2522
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2503
2523
  "svg",
2504
2524
  {
2505
2525
  width: "14",
@@ -2511,16 +2531,16 @@ var ColorPicker = ({
2511
2531
  strokeLinecap: "round",
2512
2532
  strokeLinejoin: "round",
2513
2533
  children: [
2514
- /* @__PURE__ */ (0, import_jsx_runtime20.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" }),
2515
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
2516
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("path", { d: "m14 6 4 4" })
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" })
2517
2537
  ]
2518
2538
  }
2519
2539
  )
2520
2540
  }
2521
2541
  )
2522
2542
  ] }),
2523
- isClipped && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2543
+ isClipped && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2524
2544
  "div",
2525
2545
  {
2526
2546
  role: "note",
@@ -2536,10 +2556,10 @@ var ColorPicker = ({
2536
2556
  borderRadius: "4px",
2537
2557
  alignSelf: "flex-start"
2538
2558
  },
2539
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
2559
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
2540
2560
  }
2541
2561
  ),
2542
- contrastResult && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2562
+ contrastResult && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2543
2563
  "div",
2544
2564
  {
2545
2565
  style: {
@@ -2553,15 +2573,15 @@ var ColorPicker = ({
2553
2573
  border: "1px solid rgba(255,255,255,0.1)"
2554
2574
  },
2555
2575
  children: [
2556
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { children: [
2576
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { children: [
2557
2577
  "Contrast: ",
2558
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("strong", { children: [
2578
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("strong", { children: [
2559
2579
  contrastResult.ratio.toFixed(2),
2560
2580
  ":1"
2561
2581
  ] })
2562
2582
  ] }),
2563
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
2564
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2583
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
2584
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2565
2585
  "span",
2566
2586
  {
2567
2587
  style: {
@@ -2574,7 +2594,7 @@ var ColorPicker = ({
2574
2594
  ]
2575
2595
  }
2576
2596
  ),
2577
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2597
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2578
2598
  "span",
2579
2599
  {
2580
2600
  style: {
@@ -2591,9 +2611,9 @@ var ColorPicker = ({
2591
2611
  ]
2592
2612
  }
2593
2613
  ),
2594
- swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2595
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
2596
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
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)(
2597
2617
  "button",
2598
2618
  {
2599
2619
  type: "button",
@@ -2619,9 +2639,9 @@ var ColorPicker = ({
2619
2639
  `${color}-${idx}`
2620
2640
  )) })
2621
2641
  ] }),
2622
- activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2623
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
2624
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
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)(
2625
2645
  "button",
2626
2646
  {
2627
2647
  type: "button",
@@ -2652,9 +2672,9 @@ var ColorPicker = ({
2652
2672
  };
2653
2673
 
2654
2674
  // src/color/DualColorPicker.tsx
2655
- var import_react20 = require("react");
2675
+ var import_react21 = require("react");
2656
2676
  var import_color2 = require("@pixerate/editor/color");
2657
- var import_jsx_runtime21 = require("react/jsx-runtime");
2677
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2658
2678
  function DualColorPicker({
2659
2679
  value,
2660
2680
  onChange,
@@ -2669,8 +2689,8 @@ function DualColorPicker({
2669
2689
  disabled = false,
2670
2690
  className = ""
2671
2691
  }) {
2672
- const sameId = (0, import_react20.useId)();
2673
- const [internalScheme, setInternalScheme] = (0, import_react20.useState)("light");
2692
+ const sameId = (0, import_react21.useId)();
2693
+ const [internalScheme, setInternalScheme] = (0, import_react21.useState)("light");
2674
2694
  const activeScheme = controlledScheme ?? internalScheme;
2675
2695
  const handleSchemeSelect = (nextScheme) => {
2676
2696
  if (onSchemeChange) {
@@ -2681,7 +2701,7 @@ function DualColorPicker({
2681
2701
  };
2682
2702
  const dual = (0, import_color2.normalizeDualColor)(value) ?? { light: "#000000", dark: "#000000" };
2683
2703
  const isSame = dual.light.toLowerCase() === dual.dark.toLowerCase();
2684
- const [sameInBoth, setSameInBoth] = (0, import_react20.useState)(isSame);
2704
+ const [sameInBoth, setSameInBoth] = (0, import_react21.useState)(isSame);
2685
2705
  const handleSameToggle = (e) => {
2686
2706
  const nextSame = e.target.checked;
2687
2707
  setSameInBoth(nextSame);
@@ -2713,7 +2733,7 @@ function DualColorPicker({
2713
2733
  const activeColor = activeScheme === "dark" ? dual.dark : dual.light;
2714
2734
  const activeContrastTarget = contrastAgainst ? (0, import_color2.resolveColor)(contrastAgainst, activeScheme) ?? void 0 : void 0;
2715
2735
  const dualContrast = contrastAgainst && (0, import_color2.normalizeDualColor)(contrastAgainst) ? (0, import_color2.checkDualColorContrast)(dual, contrastAgainst) : null;
2716
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2736
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2717
2737
  "div",
2718
2738
  {
2719
2739
  className: `pixerate-dual-color-picker ${className}`,
@@ -2732,7 +2752,7 @@ function DualColorPicker({
2732
2752
  boxSizing: "border-box"
2733
2753
  },
2734
2754
  children: [
2735
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2755
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2736
2756
  "div",
2737
2757
  {
2738
2758
  role: "tablist",
@@ -2745,7 +2765,7 @@ function DualColorPicker({
2745
2765
  gap: "2px"
2746
2766
  },
2747
2767
  children: [
2748
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2768
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2749
2769
  "button",
2750
2770
  {
2751
2771
  type: "button",
@@ -2768,7 +2788,7 @@ function DualColorPicker({
2768
2788
  children: "Light"
2769
2789
  }
2770
2790
  ),
2771
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2791
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2772
2792
  "button",
2773
2793
  {
2774
2794
  type: "button",
@@ -2794,8 +2814,8 @@ function DualColorPicker({
2794
2814
  ]
2795
2815
  }
2796
2816
  ),
2797
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
2798
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2817
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
2818
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2799
2819
  "button",
2800
2820
  {
2801
2821
  type: "button",
@@ -2817,7 +2837,7 @@ function DualColorPicker({
2817
2837
  outline: "none"
2818
2838
  },
2819
2839
  children: [
2820
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2840
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2821
2841
  "span",
2822
2842
  {
2823
2843
  style: {
@@ -2829,11 +2849,11 @@ function DualColorPicker({
2829
2849
  }
2830
2850
  }
2831
2851
  ),
2832
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
2852
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
2833
2853
  ]
2834
2854
  }
2835
2855
  ),
2836
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2856
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2837
2857
  "button",
2838
2858
  {
2839
2859
  type: "button",
@@ -2855,7 +2875,7 @@ function DualColorPicker({
2855
2875
  outline: "none"
2856
2876
  },
2857
2877
  children: [
2858
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2878
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2859
2879
  "span",
2860
2880
  {
2861
2881
  style: {
@@ -2867,12 +2887,12 @@ function DualColorPicker({
2867
2887
  }
2868
2888
  }
2869
2889
  ),
2870
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
2890
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
2871
2891
  ]
2872
2892
  }
2873
2893
  )
2874
2894
  ] }),
2875
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2895
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2876
2896
  "div",
2877
2897
  {
2878
2898
  style: {
@@ -2883,7 +2903,7 @@ function DualColorPicker({
2883
2903
  padding: "2px 0"
2884
2904
  },
2885
2905
  children: [
2886
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2906
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2887
2907
  "label",
2888
2908
  {
2889
2909
  htmlFor: sameId,
@@ -2897,7 +2917,7 @@ function DualColorPicker({
2897
2917
  color: "#c4cad4"
2898
2918
  },
2899
2919
  children: [
2900
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2920
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2901
2921
  "input",
2902
2922
  {
2903
2923
  id: sameId,
@@ -2908,11 +2928,11 @@ function DualColorPicker({
2908
2928
  style: { cursor: disabled ? "not-allowed" : "pointer" }
2909
2929
  }
2910
2930
  ),
2911
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "Same in both" })
2931
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: "Same in both" })
2912
2932
  ]
2913
2933
  }
2914
2934
  ),
2915
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2935
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2916
2936
  "button",
2917
2937
  {
2918
2938
  type: "button",
@@ -2934,7 +2954,7 @@ function DualColorPicker({
2934
2954
  ]
2935
2955
  }
2936
2956
  ),
2937
- dualContrast && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2957
+ dualContrast && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2938
2958
  "div",
2939
2959
  {
2940
2960
  "data-testid": "dual-contrast-summary",
@@ -2948,20 +2968,20 @@ function DualColorPicker({
2948
2968
  color: "#8c95a6"
2949
2969
  },
2950
2970
  children: [
2951
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { children: [
2971
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { children: [
2952
2972
  "Light:",
2953
2973
  " ",
2954
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
2974
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
2955
2975
  dualContrast.light.ratio.toFixed(2),
2956
2976
  " (",
2957
2977
  dualContrast.light.level,
2958
2978
  ")"
2959
2979
  ] })
2960
2980
  ] }),
2961
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { children: [
2981
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { children: [
2962
2982
  "Dark:",
2963
2983
  " ",
2964
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
2984
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
2965
2985
  dualContrast.dark.ratio.toFixed(2),
2966
2986
  " (",
2967
2987
  dualContrast.dark.level,
@@ -2971,7 +2991,7 @@ function DualColorPicker({
2971
2991
  ]
2972
2992
  }
2973
2993
  ),
2974
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2994
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2975
2995
  ColorPicker,
2976
2996
  {
2977
2997
  value: activeColor,
@@ -2990,7 +3010,7 @@ function DualColorPicker({
2990
3010
  }
2991
3011
 
2992
3012
  // src/color/useColorScheme.ts
2993
- var import_react21 = require("react");
3013
+ var import_react22 = require("react");
2994
3014
  var import_color3 = require("@pixerate/editor/color");
2995
3015
  function getSnapshot(attribute) {
2996
3016
  if (typeof window === "undefined" || typeof document === "undefined") {
@@ -3015,7 +3035,7 @@ function getServerSnapshot() {
3015
3035
  function useColorScheme(options) {
3016
3036
  const override = options?.override;
3017
3037
  const attribute = options?.attribute;
3018
- const subscribe = (0, import_react21.useMemo)(() => {
3038
+ const subscribe = (0, import_react22.useMemo)(() => {
3019
3039
  return (callback) => {
3020
3040
  if (typeof window === "undefined" || typeof document === "undefined") {
3021
3041
  return () => {
@@ -3041,7 +3061,7 @@ function useColorScheme(options) {
3041
3061
  };
3042
3062
  };
3043
3063
  }, [attribute]);
3044
- const detected = (0, import_react21.useSyncExternalStore)(
3064
+ const detected = (0, import_react22.useSyncExternalStore)(
3045
3065
  subscribe,
3046
3066
  () => getSnapshot(attribute),
3047
3067
  getServerSnapshot
@@ -3058,11 +3078,11 @@ function useResolvedColor(value, scheme) {
3058
3078
  __reExport(color_exports, require("@pixerate/editor/color"));
3059
3079
 
3060
3080
  // src/parameters/controls.tsx
3061
- var import_react22 = require("react");
3062
- var import_jsx_runtime22 = require("react/jsx-runtime");
3063
- var ParameterComponentsContext = (0, import_react22.createContext)({});
3081
+ var import_react23 = require("react");
3082
+ var import_jsx_runtime23 = require("react/jsx-runtime");
3083
+ var ParameterComponentsContext = (0, import_react23.createContext)({});
3064
3084
  function useParameterComponents() {
3065
- return (0, import_react22.useContext)(ParameterComponentsContext);
3085
+ return (0, import_react23.useContext)(ParameterComponentsContext);
3066
3086
  }
3067
3087
  function resolveParameterComponents(explicit, context) {
3068
3088
  return {
@@ -3074,7 +3094,7 @@ function resolveParameterComponents(explicit, context) {
3074
3094
  }
3075
3095
 
3076
3096
  // src/parameters/fields.tsx
3077
- var import_jsx_runtime23 = require("react/jsx-runtime");
3097
+ var import_jsx_runtime24 = require("react/jsx-runtime");
3078
3098
  var parameterInputStyle = import_parameters.parameterThemeStyles.input;
3079
3099
  var parameterSelectStyle = import_parameters.parameterThemeStyles.select;
3080
3100
  var parameterButtonStyle = import_parameters.parameterThemeStyles.button;
@@ -3083,9 +3103,9 @@ var parameterInputClass = "h-7 w-full min-w-0 rounded-md border border-input bg-
3083
3103
  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";
3084
3104
  var rangeClass = "h-4 w-full min-w-0 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50";
3085
3105
  function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown, style, ...rest }) {
3086
- const inputRef = (0, import_react23.useRef)(null);
3087
- const lastCommitted = (0, import_react23.useRef)(null);
3088
- (0, import_react23.useLayoutEffect)(() => {
3106
+ const inputRef = (0, import_react24.useRef)(null);
3107
+ const lastCommitted = (0, import_react24.useRef)(null);
3108
+ (0, import_react24.useLayoutEffect)(() => {
3089
3109
  lastCommitted.current = null;
3090
3110
  const el = inputRef.current;
3091
3111
  if (el && el.value !== value) el.value = value;
@@ -3096,9 +3116,9 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
3096
3116
  onCommit(text, el);
3097
3117
  lastCommitted.current = el.value === text ? text : null;
3098
3118
  };
3099
- const commitRef = (0, import_react23.useRef)(commit);
3119
+ const commitRef = (0, import_react24.useRef)(commit);
3100
3120
  commitRef.current = commit;
3101
- (0, import_react23.useEffect)(() => {
3121
+ (0, import_react24.useEffect)(() => {
3102
3122
  const el = inputRef.current;
3103
3123
  if (!el) return;
3104
3124
  const change = () => commitRef.current(el);
@@ -3129,7 +3149,7 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
3129
3149
  if (typeof forwarded === "function") forwarded(el);
3130
3150
  else if (forwarded) forwarded.current = el;
3131
3151
  };
3132
- return multiline ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("textarea", { ...props, ref: setRef, className: `${props.className} h-auto min-h-[3.5rem] py-1` }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("input", { type: "text", ...props, ref: setRef });
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 });
3133
3153
  }
3134
3154
  var plainNumber = (field, value) => (0, import_parameters.formatParameterNumber)({ ...field, unit: void 0 }, value);
3135
3155
  function ParameterNumberInput(props) {
@@ -3163,9 +3183,9 @@ function ParameterNumberInput(props) {
3163
3183
  onCommit: handleCommit,
3164
3184
  onKeyDown: handleKeyDown
3165
3185
  };
3166
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
3167
- CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field) }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ParameterCommitInput, { ...inputProps }),
3168
- field.unit && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
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 })
3169
3189
  ] });
3170
3190
  }
3171
3191
  function ParameterSlider(props) {
@@ -3173,7 +3193,7 @@ function ParameterSlider(props) {
3173
3193
  const ctx = useParameterComponents();
3174
3194
  const resolved = resolveParameterComponents(components, ctx);
3175
3195
  const CustomSlider = resolved.slider;
3176
- const dragging = (0, import_react23.useRef)(false);
3196
+ const dragging = (0, import_react24.useRef)(false);
3177
3197
  const start = () => {
3178
3198
  if (dragging.current) return;
3179
3199
  dragging.current = true;
@@ -3184,7 +3204,7 @@ function ParameterSlider(props) {
3184
3204
  dragging.current = false;
3185
3205
  onGestureEnd?.();
3186
3206
  };
3187
- if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ParameterNumberInput, { ...props });
3207
+ if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ParameterNumberInput, { ...props });
3188
3208
  const step = (0, import_parameters.parameterStep)(field);
3189
3209
  const sliderProps = {
3190
3210
  "aria-label": (0, import_parameters.parameterLabel)(field),
@@ -3198,8 +3218,8 @@ function ParameterSlider(props) {
3198
3218
  className: rangeClass,
3199
3219
  style: parameterRangeStyle
3200
3220
  };
3201
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2", children: [
3202
- CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3221
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-2", children: [
3222
+ CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3203
3223
  CustomSlider,
3204
3224
  {
3205
3225
  ...sliderProps,
@@ -3209,7 +3229,7 @@ function ParameterSlider(props) {
3209
3229
  onGestureStart: start,
3210
3230
  onGestureEnd: end
3211
3231
  }
3212
- ) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3232
+ ) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3213
3233
  "input",
3214
3234
  {
3215
3235
  type: "range",
@@ -3221,11 +3241,11 @@ function ParameterSlider(props) {
3221
3241
  onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field, Number(e.target.value)))
3222
3242
  }
3223
3243
  ),
3224
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
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` }) })
3225
3245
  ] });
3226
3246
  }
3227
3247
  function ParameterToggle({ field, value, onChange, disabled, id }) {
3228
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3248
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3229
3249
  "button",
3230
3250
  {
3231
3251
  type: "button",
@@ -3236,7 +3256,7 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
3236
3256
  disabled: disabled || field.readOnly,
3237
3257
  onClick: () => onChange(!value),
3238
3258
  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"}`,
3239
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3259
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3240
3260
  "span",
3241
3261
  {
3242
3262
  className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
@@ -3253,7 +3273,7 @@ function ParameterSelect(props) {
3253
3273
  const options = (0, import_parameters.getChoiceOptions)(field);
3254
3274
  const off = disabled || field.readOnly;
3255
3275
  if (field.control === "segmented") {
3256
- return /* @__PURE__ */ (0, import_jsx_runtime23.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_runtime23.jsx)(
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)(
3257
3277
  "button",
3258
3278
  {
3259
3279
  type: "button",
@@ -3270,7 +3290,7 @@ function ParameterSelect(props) {
3270
3290
  }
3271
3291
  if (CustomSelect) {
3272
3292
  const customOptions = options.map((o) => ({ value: o.value, label: (0, import_parameters.choiceOptionLabel)(o), description: o.description }));
3273
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3293
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3274
3294
  CustomSelect,
3275
3295
  {
3276
3296
  id,
@@ -3286,7 +3306,7 @@ function ParameterSelect(props) {
3286
3306
  );
3287
3307
  }
3288
3308
  const index = options.findIndex((o) => o.value === value);
3289
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3309
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3290
3310
  "select",
3291
3311
  {
3292
3312
  id,
@@ -3299,23 +3319,23 @@ function ParameterSelect(props) {
3299
3319
  },
3300
3320
  className: parameterInputClass,
3301
3321
  style: parameterSelectStyle,
3302
- children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: String(i), title: o.description, style: parameterSelectStyle, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
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)))
3303
3323
  }
3304
3324
  );
3305
3325
  }
3306
3326
  function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id, components }) {
3307
3327
  const CustomColor = resolveParameterComponents(components, useParameterComponents()).color;
3308
- const [open, setOpen] = (0, import_react23.useState)(false);
3309
- const containerRef = (0, import_react23.useRef)(null);
3310
- const buttonRef = (0, import_react23.useRef)(null);
3311
- const popoverRef = (0, import_react23.useRef)(null);
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);
3312
3332
  const alpha = !!field.alpha;
3313
3333
  const hex = (0, import_parameters.normalizeHexColor)(value, true) ?? "#000000ff";
3314
3334
  const rgb = hex.slice(0, 7);
3315
3335
  const shown = alpha ? hex : rgb;
3316
3336
  const off = disabled || field.readOnly;
3317
3337
  const name = (0, import_parameters.parameterLabel)(field);
3318
- (0, import_react23.useEffect)(() => {
3338
+ (0, import_react24.useEffect)(() => {
3319
3339
  if (!open) return;
3320
3340
  const onPointerDown = (e) => {
3321
3341
  if (containerRef.current && !containerRef.current.contains(e.target)) {
@@ -3337,7 +3357,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3337
3357
  };
3338
3358
  }, [open]);
3339
3359
  if (CustomColor) {
3340
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3360
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3341
3361
  CustomColor,
3342
3362
  {
3343
3363
  id,
@@ -3352,9 +3372,9 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3352
3372
  }
3353
3373
  );
3354
3374
  }
3355
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
3356
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2", children: [
3357
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
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)(
3358
3378
  "button",
3359
3379
  {
3360
3380
  ref: buttonRef,
@@ -3365,10 +3385,10 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3365
3385
  disabled: off,
3366
3386
  onClick: () => setOpen((prev) => !prev),
3367
3387
  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",
3368
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
3388
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
3369
3389
  }
3370
3390
  ),
3371
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3391
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3372
3392
  ParameterCommitInput,
3373
3393
  {
3374
3394
  id,
@@ -3384,7 +3404,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3384
3404
  }
3385
3405
  )
3386
3406
  ] }),
3387
- open && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3407
+ open && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3388
3408
  "div",
3389
3409
  {
3390
3410
  ref: popoverRef,
@@ -3398,7 +3418,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3398
3418
  },
3399
3419
  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",
3400
3420
  style: { background: "var(--popover, var(--background, #fff))" },
3401
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3421
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3402
3422
  ColorPicker,
3403
3423
  {
3404
3424
  value: shown,
@@ -3416,11 +3436,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3416
3436
  }
3417
3437
  function ParameterVector({ field, value, onChange, disabled, id, components }) {
3418
3438
  const size = (0, import_parameters.vectorSize)(field);
3419
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
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) => {
3420
3440
  const component = (0, import_parameters.vectorComponentField)(field, i);
3421
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
3422
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
3423
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
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)(
3424
3444
  ParameterNumberInput,
3425
3445
  {
3426
3446
  field: component,
@@ -3438,11 +3458,11 @@ function ParameterVector({ field, value, onChange, disabled, id, components }) {
3438
3458
  function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3439
3459
  const off = disabled || field.readOnly;
3440
3460
  const name = (0, import_parameters.parameterLabel)(field);
3441
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "space-y-1.5", children: [
3442
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2", children: [
3443
- /* @__PURE__ */ (0, import_jsx_runtime23.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_runtime23.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
3444
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
3445
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
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)(
3446
3466
  ParameterCommitInput,
3447
3467
  {
3448
3468
  id,
@@ -3453,15 +3473,15 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3453
3473
  onCommit: (text) => onChange(text.trim())
3454
3474
  }
3455
3475
  ),
3456
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-1", children: [
3457
- resolveFile && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
3476
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex gap-1", children: [
3477
+ resolveFile && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
3458
3478
  "label",
3459
3479
  {
3460
3480
  style: parameterButtonStyle,
3461
3481
  className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`,
3462
3482
  children: [
3463
3483
  "Choose file\u2026",
3464
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3484
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3465
3485
  "input",
3466
3486
  {
3467
3487
  type: "file",
@@ -3479,7 +3499,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3479
3499
  ]
3480
3500
  }
3481
3501
  ),
3482
- value && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3502
+ value && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3483
3503
  "button",
3484
3504
  {
3485
3505
  type: "button",
@@ -3494,7 +3514,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3494
3514
  ] })
3495
3515
  ] })
3496
3516
  ] }),
3497
- field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
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)(
3498
3518
  "button",
3499
3519
  {
3500
3520
  type: "button",
@@ -3504,14 +3524,14 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3504
3524
  disabled: off,
3505
3525
  onClick: () => onChange(o.url),
3506
3526
  className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
3507
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
3527
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
3508
3528
  },
3509
3529
  o.url
3510
3530
  )) })
3511
3531
  ] });
3512
3532
  }
3513
3533
  function ParameterText({ field, value, onChange, disabled, id }) {
3514
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3534
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3515
3535
  ParameterCommitInput,
3516
3536
  {
3517
3537
  id,
@@ -3530,24 +3550,24 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
3530
3550
  switch (field.type) {
3531
3551
  case "number":
3532
3552
  case "int":
3533
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
3553
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
3534
3554
  case "boolean":
3535
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
3555
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
3536
3556
  case "choice":
3537
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
3557
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
3538
3558
  case "color":
3539
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
3559
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
3540
3560
  case "vector":
3541
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
3561
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
3542
3562
  case "image":
3543
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
3563
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
3544
3564
  case "text":
3545
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ParameterText, { field, value, onChange: set, ...rest });
3565
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ParameterText, { field, value, onChange: set, ...rest });
3546
3566
  }
3547
3567
  }
3548
3568
 
3549
3569
  // src/effects/EffectParameters.tsx
3550
- var import_jsx_runtime24 = require("react/jsx-runtime");
3570
+ var import_jsx_runtime25 = require("react/jsx-runtime");
3551
3571
  function EffectParameters({
3552
3572
  description,
3553
3573
  values,
@@ -3562,10 +3582,10 @@ function EffectParameters({
3562
3582
  className = "",
3563
3583
  components
3564
3584
  }) {
3565
- const fields = (0, import_react24.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
3566
- const idBase = (0, import_react24.useId)();
3567
- const gesture = import_react24.default.useRef(null);
3568
- const count = import_react24.default.useRef(0);
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);
3569
3589
  const CustomPresetSelect = resolveParameterComponents(components, useParameterComponents()).select;
3570
3590
  const handlePresetSelect = (name) => {
3571
3591
  if (!name) return;
@@ -3576,8 +3596,8 @@ function EffectParameters({
3576
3596
  if (preset) onPreset({ ...description.defaults, ...preset.values });
3577
3597
  }
3578
3598
  };
3579
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
3580
- (onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
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)(
3581
3601
  CustomPresetSelect,
3582
3602
  {
3583
3603
  "aria-label": `${description.name} presets`,
@@ -3592,7 +3612,7 @@ function EffectParameters({
3592
3612
  ],
3593
3613
  onChange: (name) => handlePresetSelect(String(name))
3594
3614
  }
3595
- ) : /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
3615
+ ) : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3596
3616
  "select",
3597
3617
  {
3598
3618
  className: "w-full rounded border border-border px-1 py-0.5 text-xs",
@@ -3602,8 +3622,8 @@ function EffectParameters({
3602
3622
  disabled,
3603
3623
  onChange: (e) => handlePresetSelect(e.currentTarget.value),
3604
3624
  children: [
3605
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
3606
- description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
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))
3607
3627
  ]
3608
3628
  }
3609
3629
  )),
@@ -3613,14 +3633,14 @@ function EffectParameters({
3613
3633
  const keyed = keyframed?.has(field.id) ?? false;
3614
3634
  const value = (0, import_effects3.effectFieldValue)(field, values[field.id]);
3615
3635
  const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field.default);
3616
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
3617
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-1.5", children: [
3618
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
3619
- keyed && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
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" }),
3620
3640
  renderControlAddon?.(field.id),
3621
- onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime24.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" })
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" })
3622
3642
  ] }),
3623
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3643
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3624
3644
  ParameterFieldControl,
3625
3645
  {
3626
3646
  field,
@@ -3635,15 +3655,15 @@ function EffectParameters({
3635
3655
  )
3636
3656
  ] }, field.id);
3637
3657
  }),
3638
- !fields.length && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
3658
+ !fields.length && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
3639
3659
  ] });
3640
3660
  }
3641
3661
 
3642
3662
  // src/paint-editor/PaintEffectsPanel.tsx
3643
- var import_jsx_runtime25 = require("react/jsx-runtime");
3663
+ var import_jsx_runtime26 = require("react/jsx-runtime");
3644
3664
  function usePaintEffectsProvider(controller) {
3645
- const [provider, setProvider] = (0, import_react25.useState)(controller.effectsProvider);
3646
- (0, import_react25.useEffect)(() => {
3665
+ const [provider, setProvider] = (0, import_react26.useState)(controller.effectsProvider);
3666
+ (0, import_react26.useEffect)(() => {
3647
3667
  setProvider(controller.effectsProvider);
3648
3668
  return controller.effects.subscribe(setProvider);
3649
3669
  }, [controller]);
@@ -3651,27 +3671,27 @@ function usePaintEffectsProvider(controller) {
3651
3671
  }
3652
3672
  function usePaintEffectsTools(registry, controller, options = {}) {
3653
3673
  const { id, namespace, readOnly, playbackSurface } = options;
3654
- (0, import_react25.useEffect)(() => {
3674
+ (0, import_react26.useEffect)(() => {
3655
3675
  if (!registry) return;
3656
- return registry.register((0, import_paint_editor15.createPaintEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
3676
+ return registry.register((0, import_paint_editor14.createPaintEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
3657
3677
  }, [registry, controller, id, namespace, readOnly, playbackSurface]);
3658
3678
  }
3659
3679
  function Controls({ provider, effect, name, values, apply }) {
3660
3680
  const { description, error } = useEffectDescription(provider, effect);
3661
- const drags = (0, import_react25.useRef)(/* @__PURE__ */ new Set());
3662
- if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
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: [
3663
3683
  'No effects provider: "',
3664
3684
  name ?? effect,
3665
3685
  '" is kept as it was drawn.'
3666
3686
  ] });
3667
- if (error) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
3668
- if (!description) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
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" });
3669
3689
  const commit = (gesture) => {
3670
3690
  if (!gesture || drags.current.has(gesture)) return !gesture;
3671
3691
  drags.current.add(gesture);
3672
3692
  return true;
3673
3693
  };
3674
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3694
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3675
3695
  EffectParameters,
3676
3696
  {
3677
3697
  description,
@@ -3693,8 +3713,8 @@ var PaintEffectsPanel = ({ controller, className }) => {
3693
3713
  const state = usePaintEditorState(controller);
3694
3714
  const provider = usePaintEffectsProvider(controller);
3695
3715
  const [error, attempt] = useAttempt();
3696
- const [browse, setBrowse] = (0, import_react25.useState)(null);
3697
- const [busy, setBusy] = (0, import_react25.useState)(false);
3716
+ const [browse, setBrowse] = (0, import_react26.useState)(null);
3717
+ const [busy, setBusy] = (0, import_react26.useState)(false);
3698
3718
  const paper = controller.getPaperEffect();
3699
3719
  const activeId = state.document.activeLayerId;
3700
3720
  const layerEffect = activeId ? controller.getEffectLayer(activeId) : void 0;
@@ -3706,7 +3726,7 @@ var PaintEffectsPanel = ({ controller, className }) => {
3706
3726
  if (!effectPaint) return;
3707
3727
  run(() => controller.setEffectPaint({ effect: effectPaint.effect, values: effectPaint.values, time: effectPaint.time, map: effectPaint.map, live: effectPaint.live, ...patch }));
3708
3728
  };
3709
- const thumbnail = (0, import_react25.useMemo)(() => effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(48) : null, [controller, effectPaint, state.effectPaintRendering]);
3729
+ const thumbnail = (0, import_react26.useMemo)(() => effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(48) : null, [controller, effectPaint, state.effectPaintRendering]);
3710
3730
  const run = (work) => attempt(() => {
3711
3731
  setBusy(true);
3712
3732
  return work().finally(() => setBusy(false));
@@ -3722,28 +3742,28 @@ var PaintEffectsPanel = ({ controller, className }) => {
3722
3742
  };
3723
3743
  const toggle = (b) => setBrowse(browse === b ? null : b);
3724
3744
  const pixel = active?.type === "pixel";
3725
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
3726
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
3727
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
3728
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
3729
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
3730
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
3731
- /* @__PURE__ */ (0, import_jsx_runtime25.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" }),
3732
- /* @__PURE__ */ (0, import_jsx_runtime25.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" })
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" })
3733
3753
  ] }),
3734
- !provider && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
3735
- browse && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
3736
- paper && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
3737
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-1", children: [
3738
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "flex-1 truncate", children: [
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: [
3739
3759
  "Paper: ",
3740
3760
  paper.name ?? paper.effect
3741
3761
  ] }),
3742
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
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" })
3743
3763
  ] }),
3744
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
3745
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
3746
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
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)(
3747
3767
  "input",
3748
3768
  {
3749
3769
  type: "range",
@@ -3765,39 +3785,39 @@ var PaintEffectsPanel = ({ controller, className }) => {
3765
3785
  `o${paper.opacity}`
3766
3786
  )
3767
3787
  ] }),
3768
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
3769
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
3770
- /* @__PURE__ */ (0, import_jsx_runtime25.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) => {
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) => {
3771
3791
  const blend = e.currentTarget.value;
3772
3792
  run(() => controller.updatePaperEffect({ blend }));
3773
- }, children: import_paint_editor15.PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: b, children: b }, b)) })
3793
+ }, children: import_paint_editor14.PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: b, children: b }, b)) })
3774
3794
  ] }),
3775
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
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)) })
3776
3796
  ] }),
3777
- effectPaint && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paint", children: [
3778
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-1", children: [
3779
- thumbnail ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("img", { src: thumbnail, alt: "", className: "h-5 w-8 rounded object-cover ring-1 ring-slate-700", "data-testid": "effect-paint-thumbnail" }) : null,
3780
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "flex-1 truncate", children: [
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: [
3781
3801
  "Paint: ",
3782
3802
  effectPaint.effect,
3783
3803
  state.effectPaintRendering ? " (rendering\u2026)" : ""
3784
3804
  ] }),
3785
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
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" })
3786
3806
  ] }),
3787
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
3788
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", title: "Lay the effect along each stroke instead of fixing it to the canvas", children: [
3789
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.map), onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
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" } }) }),
3790
3810
  "Along the stroke"
3791
3811
  ] }),
3792
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
3793
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
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 }) }),
3794
3814
  "Live"
3795
3815
  ] })
3796
3816
  ] }),
3797
- effectPaint.map && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
3798
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
3799
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-slate-400", children: "Length" }),
3800
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
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)(
3801
3821
  "input",
3802
3822
  {
3803
3823
  type: "number",
@@ -3811,55 +3831,55 @@ var PaintEffectsPanel = ({ controller, className }) => {
3811
3831
  effectPaint.map.length
3812
3832
  )
3813
3833
  ] }),
3814
- /* @__PURE__ */ (0, import_jsx_runtime25.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: [
3815
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "repeat", children: "Repeat" }),
3816
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "mirror", children: "Mirror" }),
3817
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "clamp", children: "Clamp" })
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" })
3818
3838
  ] })
3819
3839
  ] }),
3820
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
3840
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
3821
3841
  ] }),
3822
- animation && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-2 rounded border border-slate-700 p-1", "data-effect-part": "playback", children: [
3823
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "flex-1 truncate", children: [
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: [
3824
3844
  "Live paint: ",
3825
3845
  animation.strokes,
3826
3846
  " ",
3827
3847
  animation.strokes === 1 ? "stroke" : "strokes"
3828
3848
  ] }),
3829
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: button, "aria-pressed": playback.playing, onClick: () => attempt(() => controller.setEffectPlayback({ playing: !playback.playing })), children: playback.playing ? "Pause" : "Play" }),
3830
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1", children: [
3831
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-slate-400", children: "fps" }),
3832
- /* @__PURE__ */ (0, import_jsx_runtime25.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" })
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" })
3833
3853
  ] })
3834
3854
  ] }),
3835
- layerEffect && activeId && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "layer", children: [
3836
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-1", children: [
3837
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "flex-1 truncate", children: [
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: [
3838
3858
  "Layer: ",
3839
3859
  layerEffect.name ?? layerEffect.effect
3840
3860
  ] }),
3841
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
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" })
3842
3862
  ] }),
3843
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
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)) })
3844
3864
  ] }),
3845
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ErrorLine, { error })
3865
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ErrorLine, { error })
3846
3866
  ] });
3847
3867
  };
3848
3868
 
3849
3869
  // src/paint-editor/PaintEditor.tsx
3850
- var import_jsx_runtime26 = require("react/jsx-runtime");
3870
+ var import_jsx_runtime27 = require("react/jsx-runtime");
3851
3871
  var PAINT_CONTROLS = {
3852
3872
  "mixing-pad": '[data-testid="mixing-pad"]',
3853
3873
  lighting: '[data-testid="light-panel"]',
3854
3874
  symmetry: '[aria-label="Symmetry"]'
3855
3875
  };
3856
3876
  var PaintEditor = ({ controller, fileName, height = 720, presence, className, playback, playbackId = "paint", onPlaybackReveal }) => {
3857
- const [tool, setTool] = (0, import_react26.useState)("brush");
3858
- const [tab, setTab] = (0, import_react26.useState)("color");
3859
- const tabRef = (0, import_react26.useRef)(tab);
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);
3860
3880
  tabRef.current = tab;
3861
- const rootRef = (0, import_react26.useRef)(null);
3862
- const [ownPresence] = (0, import_react26.useState)(() => new import_paint_editor16.PaintPresence());
3881
+ const rootRef = (0, import_react27.useRef)(null);
3882
+ const [ownPresence] = (0, import_react27.useState)(() => new import_paint_editor15.PaintPresence());
3863
3883
  const ambientPlayback = useAgentPlayback();
3864
3884
  const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
3865
3885
  const viewBox = () => {
@@ -3870,12 +3890,12 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, className, pl
3870
3890
  const docToClient = (p) => {
3871
3891
  const r = viewBox();
3872
3892
  if (!r) return null;
3873
- const q = (0, import_paint_editor16.documentToScreen)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x, p.y);
3893
+ const q = (0, import_paint_editor15.documentToScreen)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x, p.y);
3874
3894
  return { x: r.left + q.x, y: r.top + q.y };
3875
3895
  };
3876
3896
  const clientToDoc = (p) => {
3877
3897
  const r = viewBox();
3878
- return r ? (0, import_paint_editor16.screenToDocument)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x - r.left, p.y - r.top) : null;
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;
3879
3899
  };
3880
3900
  const elementRect = (selector) => {
3881
3901
  const r = rootRef.current?.querySelector(selector)?.getBoundingClientRect();
@@ -3915,28 +3935,28 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, className, pl
3915
3935
  const box = rootRef.current?.getBoundingClientRect();
3916
3936
  return c && box ? { x: c.x - box.left, y: c.y - box.top } : p;
3917
3937
  };
3918
- const [error, setError] = (0, import_react26.useState)(null);
3938
+ const [error, setError] = (0, import_react27.useState)(null);
3919
3939
  const effects = usePaintEffectsProvider(controller);
3920
3940
  const tabs = effects ? ["color", "wet", "paper", "layers", "effects"] : ["color", "wet", "paper", "layers"];
3921
- return /* @__PURE__ */ (0, import_jsx_runtime26.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: [
3922
- playing && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
3923
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PaintToolbar, { controller, tool, onToolChange: setTool, fileName }),
3924
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex min-h-0 flex-1 gap-2", children: [
3925
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
3926
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
3927
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PaintCanvas, { controller, tool, onError: setError, presence: playing ? void 0 : presence, className: "flex-1 rounded-lg" }),
3928
- error && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
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 })
3929
3949
  ] }),
3930
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
3931
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex gap-1", role: "tablist", "aria-label": "Paint panels", children: tabs.map((t) => /* @__PURE__ */ (0, import_jsx_runtime26.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)) }),
3932
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
3933
- tab === "color" && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ColorPanel, { controller }),
3934
- tab === "wet" && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(WetPanel, { controller }),
3935
- tab === "paper" && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PaperPanel, { controller }),
3936
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PaintLayersPanel, { controller }),
3937
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(StrokePanel, { controller }),
3938
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(StickerPanel, { controller }),
3939
- tab === "effects" && effects && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PaintEffectsPanel, { controller })
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 })
3940
3960
  ] })
3941
3961
  ] })
3942
3962
  ] })