@pixerate/editor-react 0.172.0 → 0.173.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/animation-editor/index.cjs +1 -1
  2. package/dist/animation-editor/index.js +1 -1
  3. package/dist/{paint-editor → brushes}/BrushLibraryBrowser.d.cts +2 -2
  4. package/dist/{paint-editor → brushes}/BrushLibraryBrowser.d.ts +2 -2
  5. package/dist/brushes/index.cjs +102 -0
  6. package/dist/brushes/index.d.cts +2 -0
  7. package/dist/brushes/index.d.ts +2 -0
  8. package/dist/brushes/index.js +10 -0
  9. package/dist/brushes/useBrushLibrary.d.cts +7 -0
  10. package/dist/brushes/useBrushLibrary.d.ts +7 -0
  11. package/dist/canvas/index.cjs +8 -3
  12. package/dist/canvas/index.js +8 -3
  13. package/dist/canvas/useCanvasDraw.d.cts +4 -2
  14. package/dist/canvas/useCanvasDraw.d.ts +4 -2
  15. package/dist/canvas/useShapeBrushstroke.d.cts +6 -2
  16. package/dist/canvas/useShapeBrushstroke.d.ts +6 -2
  17. package/dist/chunk-62FMEDGG.js +54 -0
  18. package/dist/chunk-PQK2UMAY.js +23 -0
  19. package/dist/{chunk-2UD3JH4W.js → chunk-UR4KL7WE.js} +29 -1
  20. package/dist/{chunk-TOYSB4DK.js → chunk-W6UZ7PVT.js} +1 -1
  21. package/dist/effects/index.cjs +1 -1
  22. package/dist/effects/index.js +1 -1
  23. package/dist/image-editor/BrushOptionsBar.d.cts +2 -1
  24. package/dist/image-editor/BrushOptionsBar.d.ts +2 -1
  25. package/dist/image-editor/index.cjs +965 -870
  26. package/dist/image-editor/index.js +4 -2
  27. package/dist/index.cjs +1485 -1390
  28. package/dist/index.js +13 -11
  29. package/dist/paint-editor/index.cjs +18 -3
  30. package/dist/paint-editor/index.d.cts +1 -1
  31. package/dist/paint-editor/index.d.ts +1 -1
  32. package/dist/paint-editor/index.js +326 -359
  33. package/dist/vector/index.cjs +3 -3
  34. package/dist/vector/index.js +4 -5
  35. package/dist/video-editor/index.cjs +1 -1
  36. package/dist/video-editor/index.js +1 -1
  37. package/package.json +16 -3
@@ -9,7 +9,7 @@ import {
9
9
  EffectParameters,
10
10
  EffectsBrowser,
11
11
  useEffectDescription
12
- } from "../chunk-TOYSB4DK.js";
12
+ } from "../chunk-W6UZ7PVT.js";
13
13
  import "../chunk-5RPB4WGT.js";
14
14
  import "../chunk-KIRIU53A.js";
15
15
  import "../chunk-3I7FOSLF.js";
@@ -18,6 +18,9 @@ import {
18
18
  useAgentPlayback,
19
19
  usePlaybackSurface
20
20
  } from "../chunk-W5CMGX3I.js";
21
+ import {
22
+ BrushLibraryBrowser
23
+ } from "../chunk-62FMEDGG.js";
21
24
 
22
25
  // src/paint-editor/usePaintEditor.ts
23
26
  import { useEffect, useMemo, useState, useSyncExternalStore } from "react";
@@ -574,7 +577,7 @@ var PaintToolbar = ({ controller, tool, onToolChange, fileName = "painting", cla
574
577
  };
575
578
 
576
579
  // src/paint-editor/BrushPanel.tsx
577
- import { useMemo as useMemo5, useRef as useRef4 } from "react";
580
+ import { useMemo as useMemo4, useRef as useRef4 } from "react";
578
581
  import { brushLoadColor, brushTakesPaint, downloadBytes as downloadBytes2, toggleStickerRef, DEFAULT_PAINT_GRADIENT } from "@pixerate/editor/paint-editor";
579
582
  import { PAINT_PROFILE as PAINT_PROFILE2 } from "@pixerate/editor/brushes";
580
583
 
@@ -668,62 +671,26 @@ var EditorControl = ({ control: c, onSet }) => {
668
671
  }
669
672
  };
670
673
 
671
- // src/paint-editor/BrushLibraryBrowser.tsx
672
- import { useMemo as useMemo4, useState as useState6 } from "react";
673
- import { brushLibraryGroups } from "@pixerate/editor/brushes";
674
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
675
- var BrushLibraryBrowser = ({ entries, activeId, onSelect, profile, thumbnail, thumbnailWidth = 112, thumbnailHeight = 32, className }) => {
676
- const [text, setText] = useState6("");
677
- const groups = useMemo4(() => brushLibraryGroups(entries, { text, profile }), [entries, text, profile]);
678
- return /* @__PURE__ */ jsxs5("div", { className: `flex flex-col gap-1 ${className ?? ""}`, "data-testid": "brush-library", children: [
679
- /* @__PURE__ */ jsx5("input", { type: "search", value: text, placeholder: "Find a brush", "aria-label": "Find a brush", onChange: (e) => setText(e.target.value), className: "rounded bg-slate-800 px-1.5 py-0.5" }),
680
- /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-1.5", role: "listbox", "aria-label": "Brushes", children: [
681
- groups.map((g) => /* @__PURE__ */ jsxs5("div", { role: "group", "aria-label": g.title, className: "flex flex-col gap-0.5", children: [
682
- /* @__PURE__ */ jsx5("span", { className: "text-[10px] uppercase tracking-wide text-slate-500", children: g.title }),
683
- /* @__PURE__ */ jsx5("div", { className: "grid grid-cols-2 gap-1", children: g.varieties.flatMap(
684
- (v) => v.entries.map((e) => /* @__PURE__ */ jsxs5(
685
- "button",
686
- {
687
- type: "button",
688
- role: "option",
689
- "aria-selected": activeId === e.brush.id,
690
- title: [e.brush.name, v.title.toLowerCase() === e.brush.name.toLowerCase() ? "" : v.title, e.builtin ? "" : "saved"].filter(Boolean).join(" \xB7 "),
691
- className: `flex flex-col items-start gap-0.5 rounded p-1 text-left ${activeId === e.brush.id ? "bg-indigo-600/30 ring-1 ring-indigo-500" : "bg-slate-900 hover:bg-slate-800"}`,
692
- onClick: () => onSelect(e.brush.id),
693
- children: [
694
- thumbnail && /* @__PURE__ */ jsx5(PixelCanvas, { pixels: thumbnail(e.brush.id), label: `${e.brush.name} thumbnail`, className: "rounded", style: { width: "100%", aspectRatio: `${thumbnailWidth} / ${thumbnailHeight}` } }),
695
- /* @__PURE__ */ jsx5("span", { className: "truncate text-[10px] text-slate-300", children: e.brush.name })
696
- ]
697
- },
698
- e.brush.id
699
- ))
700
- ) })
701
- ] }, g.id)),
702
- !groups.length && /* @__PURE__ */ jsx5("span", { className: "text-slate-500", children: "No brush matches." })
703
- ] })
704
- ] });
705
- };
706
-
707
674
  // src/paint-editor/PaintGradientEditor.tsx
708
675
  import { PAINT_GRADIENT_KIT } from "@pixerate/editor/paint-editor";
709
- import { jsx as jsx6 } from "react/jsx-runtime";
710
- var PaintGradientEditor = (props) => /* @__PURE__ */ jsx6(PaintGradientEditorView, { ...props, kit: PAINT_GRADIENT_KIT });
676
+ import { jsx as jsx5 } from "react/jsx-runtime";
677
+ var PaintGradientEditor = (props) => /* @__PURE__ */ jsx5(PaintGradientEditorView, { ...props, kit: PAINT_GRADIENT_KIT });
711
678
 
712
679
  // src/paint-editor/StickerPicker.tsx
713
- import { useEffect as useEffect4, useState as useState7 } from "react";
714
- import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
680
+ import { useEffect as useEffect4, useState as useState6 } from "react";
681
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
715
682
  var StickerPicker = ({ controller, selected, onPick, label = "Stickers" }) => {
716
- const [provider, setProvider] = useState7(() => controller.stickersProvider);
683
+ const [provider, setProvider] = useState6(() => controller.stickersProvider);
717
684
  useEffect4(() => controller.stickers.subscribe(setProvider), [controller]);
718
685
  const failed = selected.map((ref) => ({ ref, ...controller.stickerArtStatus(ref) })).filter((x) => x.status === "failed");
719
- return /* @__PURE__ */ jsx7(
686
+ return /* @__PURE__ */ jsx6(
720
687
  StickerLibraryPicker,
721
688
  {
722
689
  provider,
723
690
  selected,
724
691
  label,
725
692
  onPick: (it) => onPick(it.ref),
726
- footer: failed.map((f) => /* @__PURE__ */ jsxs6("p", { role: "alert", className: "text-[11px] text-rose-400", children: [
693
+ footer: failed.map((f) => /* @__PURE__ */ jsxs5("p", { role: "alert", className: "text-[11px] text-rose-400", children: [
727
694
  f.ref,
728
695
  ": ",
729
696
  f.error
@@ -733,29 +700,29 @@ var StickerPicker = ({ controller, selected, onPick, label = "Stickers" }) => {
733
700
  };
734
701
 
735
702
  // src/paint-editor/BrushPanel.tsx
736
- import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
703
+ import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
737
704
  var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, className }) => {
738
705
  const state = usePaintEditorState(controller);
739
706
  const [error, attempt] = useAttempt();
740
707
  const fileRef = useRef4(null);
741
708
  const { brush, brushes } = state;
742
709
  const paper = state.document.paper;
743
- const thumbs = useMemo5(
710
+ const thumbs = useMemo4(
744
711
  () => new Map(brushes.map((b) => [b.id, controller.brushThumbnail(b.id, { width: thumbnailWidth, height: thumbnailHeight, color: "#26324a" })])),
745
712
  // Thumbnails follow the library and the paper.
746
713
  // eslint-disable-next-line react-hooks/exhaustive-deps
747
714
  [controller, brushes, paper, thumbnailWidth, thumbnailHeight]
748
715
  );
749
- const entries = useMemo5(() => brushes.map((b) => ({ brush: controller.getBrushSpec(b.id), builtin: Boolean(b.builtin) })), [controller, brushes]);
750
- const spec = useMemo5(() => controller.getBrushSpec(), [controller, brush]);
716
+ const entries = useMemo4(() => brushes.map((b) => ({ brush: controller.getBrushSpec(b.id), builtin: Boolean(b.builtin) })), [controller, brushes]);
717
+ const spec = useMemo4(() => controller.getBrushSpec(), [controller, brush]);
751
718
  const own = typeof spec.colour?.default === "string" && /^#[0-9a-f]{6}/i.test(spec.colour.default) ? spec.colour.default.slice(0, 7) : void 0;
752
- const preview = useMemo5(() => controller.brushThumbnail(brush.id, { width: 240, height: 64, color: own }), [controller, brush, paper, state.color, own]);
719
+ const preview = useMemo4(() => controller.brushThumbnail(brush.id, { width: 240, height: 64, color: own }), [controller, brush, paper, state.color, own]);
753
720
  const carried = brushLoadColor(state.mixerLoad);
754
721
  const slug = (name) => name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || "brush";
755
722
  const loads = ["dab", "mixer", "impasto"].includes(brush.engine) || brush.engine === "wet" && brush.wet.tool === "paint";
756
- return /* @__PURE__ */ jsxs7("div", { className: `${panel} ${className ?? ""}`, "data-testid": "brush-panel", children: [
757
- /* @__PURE__ */ jsx8(BrushLibraryBrowser, { entries, activeId: brush.id, onSelect: (id) => controller.setBrush({ id }), thumbnail: (id) => thumbs.get(id) ?? null, thumbnailWidth, thumbnailHeight }),
758
- /* @__PURE__ */ jsx8(
723
+ return /* @__PURE__ */ jsxs6("div", { className: `${panel} ${className ?? ""}`, "data-testid": "brush-panel", children: [
724
+ /* @__PURE__ */ jsx7(BrushLibraryBrowser, { entries, activeId: brush.id, onSelect: (id) => controller.setBrush({ id }), thumbnail: (id) => thumbs.get(id) ?? null, thumbnailWidth, thumbnailHeight }),
725
+ /* @__PURE__ */ jsx7(
759
726
  BrushEditor,
760
727
  {
761
728
  brush: spec,
@@ -765,30 +732,30 @@ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, clas
765
732
  onSaveAs: (name) => controller.saveBrush({ id: slug(name), name }),
766
733
  renderExtra: (section) => {
767
734
  if (section === "shape" && brush.engine === "sticker")
768
- return /* @__PURE__ */ jsx8(StickerPicker, { controller, label: "Sticker stamps", selected: brush.sticker.stamps, onPick: (ref) => controller.setBrush({ sticker: { stamps: toggleStickerRef(brush.sticker.stamps, ref) } }) });
735
+ return /* @__PURE__ */ jsx7(StickerPicker, { controller, label: "Sticker stamps", selected: brush.sticker.stamps, onPick: (ref) => controller.setBrush({ sticker: { stamps: toggleStickerRef(brush.sticker.stamps, ref) } }) });
769
736
  if (section === "behaviour" && loads)
770
- return /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-1", children: [
771
- /* @__PURE__ */ jsx8("span", { className: "text-slate-400", children: "Carries" }),
772
- /* @__PURE__ */ jsx8("span", { "aria-label": "Brush load", title: carried ?? "Clean", className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: carried ?? "transparent" } }),
773
- brush.engine === "mixer" && /* @__PURE__ */ jsx8("button", { type: "button", className: button, onClick: () => controller.loadMixerBrush(), children: "Load" }),
774
- /* @__PURE__ */ jsx8("button", { type: "button", className: button, onClick: () => controller.cleanMixerBrush(brush.engine === "mixer"), children: "Clean" })
737
+ return /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1", children: [
738
+ /* @__PURE__ */ jsx7("span", { className: "text-slate-400", children: "Carries" }),
739
+ /* @__PURE__ */ jsx7("span", { "aria-label": "Brush load", title: carried ?? "Clean", className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: carried ?? "transparent" } }),
740
+ brush.engine === "mixer" && /* @__PURE__ */ jsx7("button", { type: "button", className: button, onClick: () => controller.loadMixerBrush(), children: "Load" }),
741
+ /* @__PURE__ */ jsx7("button", { type: "button", className: button, onClick: () => controller.cleanMixerBrush(brush.engine === "mixer"), children: "Clean" })
775
742
  ] });
776
743
  if (section === "colour" && brushTakesPaint(brush))
777
- return /* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-1.5", "data-testid": "brush-gradient", children: [
778
- /* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between gap-2", children: [
779
- /* @__PURE__ */ jsx8("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" }),
780
- /* @__PURE__ */ jsx8("button", { type: "button", "aria-pressed": brush.paint !== null, className: chip(brush.paint !== null), onClick: () => attempt(() => controller.setBrush({ paint: brush.paint ? null : DEFAULT_PAINT_GRADIENT })), children: brush.paint ? "On" : "Off" })
744
+ return /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-1.5", "data-testid": "brush-gradient", children: [
745
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-2", children: [
746
+ /* @__PURE__ */ jsx7("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" }),
747
+ /* @__PURE__ */ jsx7("button", { type: "button", "aria-pressed": brush.paint !== null, className: chip(brush.paint !== null), onClick: () => attempt(() => controller.setBrush({ paint: brush.paint ? null : DEFAULT_PAINT_GRADIENT })), children: brush.paint ? "On" : "Off" })
781
748
  ] }),
782
- brush.paint && /* @__PURE__ */ jsx8(PaintGradientEditor, { value: brush.paint, colors: { paint: state.color, secondary: state.secondaryColor }, onChange: (g) => attempt(() => controller.setBrush({ paint: g })) })
749
+ brush.paint && /* @__PURE__ */ jsx7(PaintGradientEditor, { value: brush.paint, colors: { paint: state.color, secondary: state.secondaryColor }, onChange: (g) => attempt(() => controller.setBrush({ paint: g })) })
783
750
  ] });
784
751
  return null;
785
752
  }
786
753
  }
787
754
  ),
788
- /* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap items-center gap-1", children: [
789
- /* @__PURE__ */ jsx8("button", { type: "button", className: button, onClick: () => attempt(async () => downloadBytes2(JSON.stringify(await controller.exportBrushes(), null, 2), "brushes.json", "application/json")), children: "Export" }),
790
- /* @__PURE__ */ jsx8("button", { type: "button", className: button, onClick: () => fileRef.current?.click(), children: "Import\u2026" }),
791
- /* @__PURE__ */ jsx8(
755
+ /* @__PURE__ */ jsxs6("div", { className: "flex flex-wrap items-center gap-1", children: [
756
+ /* @__PURE__ */ jsx7("button", { type: "button", className: button, onClick: () => attempt(async () => downloadBytes2(JSON.stringify(await controller.exportBrushes(), null, 2), "brushes.json", "application/json")), children: "Export" }),
757
+ /* @__PURE__ */ jsx7("button", { type: "button", className: button, onClick: () => fileRef.current?.click(), children: "Import\u2026" }),
758
+ /* @__PURE__ */ jsx7(
792
759
  "input",
793
760
  {
794
761
  ref: fileRef,
@@ -804,24 +771,24 @@ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, clas
804
771
  }
805
772
  )
806
773
  ] }),
807
- /* @__PURE__ */ jsx8(ErrorLine, { error })
774
+ /* @__PURE__ */ jsx7(ErrorLine, { error })
808
775
  ] });
809
776
  };
810
777
 
811
778
  // src/paint-editor/PaperPanel.tsx
812
- import { useMemo as useMemo6 } from "react";
779
+ import { useMemo as useMemo5 } from "react";
813
780
  import { DEFAULT_BACKLIGHT_COLOR, LIGHT_SLIDERS, PAPER_FAMILIES, PAPER_LIBRARY, PAPER_SLIDERS, patchPath, readPath, renderPaper } from "@pixerate/editor/paint-editor";
814
- import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
781
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
815
782
  var SWATCH = { x: 0, y: 0, width: 64, height: 40 };
816
783
  var PaperPanel = ({ controller, className }) => {
817
784
  const state = usePaintEditorState(controller);
818
785
  const [error, attempt] = useAttempt();
819
786
  const paper = state.document.paper;
820
- const previews = useMemo6(() => new Map(PAPER_LIBRARY.map((p) => [p.preset, { ...SWATCH, data: renderPaper({ ...p, shading: Math.max(0.8, p.shading) }, SWATCH) }])), []);
821
- return /* @__PURE__ */ jsxs8("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paper-panel", children: [
822
- PAPER_FAMILIES.map((family) => /* @__PURE__ */ jsxs8("div", { children: [
823
- /* @__PURE__ */ jsx9("div", { className: "mb-0.5 text-[10px] uppercase tracking-wide text-slate-500", children: family }),
824
- /* @__PURE__ */ jsx9("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": `${family} papers`, children: PAPER_LIBRARY.filter((p) => p.family === family).map((p) => /* @__PURE__ */ jsx9(
787
+ const previews = useMemo5(() => new Map(PAPER_LIBRARY.map((p) => [p.preset, { ...SWATCH, data: renderPaper({ ...p, shading: Math.max(0.8, p.shading) }, SWATCH) }])), []);
788
+ return /* @__PURE__ */ jsxs7("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paper-panel", children: [
789
+ PAPER_FAMILIES.map((family) => /* @__PURE__ */ jsxs7("div", { children: [
790
+ /* @__PURE__ */ jsx8("div", { className: "mb-0.5 text-[10px] uppercase tracking-wide text-slate-500", children: family }),
791
+ /* @__PURE__ */ jsx8("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": `${family} papers`, children: PAPER_LIBRARY.filter((p) => p.family === family).map((p) => /* @__PURE__ */ jsx8(
825
792
  "button",
826
793
  {
827
794
  type: "button",
@@ -830,37 +797,37 @@ var PaperPanel = ({ controller, className }) => {
830
797
  title: p.name,
831
798
  className: `rounded p-0.5 ${paper.preset === p.preset ? "ring-2 ring-indigo-500" : "ring-1 ring-slate-700 hover:ring-slate-500"}`,
832
799
  onClick: () => attempt(() => controller.setPaper({ preset: p.preset })),
833
- children: /* @__PURE__ */ jsx9(PixelCanvas, { pixels: previews.get(p.preset) ?? null, label: p.name, style: { width: 48, height: 30 } })
800
+ children: /* @__PURE__ */ jsx8(PixelCanvas, { pixels: previews.get(p.preset) ?? null, label: p.name, style: { width: 48, height: 30 } })
834
801
  },
835
802
  p.preset
836
803
  )) })
837
804
  ] }, family)),
838
- /* @__PURE__ */ jsx9("div", { className: "text-slate-300", children: paper.name }),
839
- /* @__PURE__ */ jsxs8("label", { className: "flex items-center justify-between", children: [
840
- /* @__PURE__ */ jsx9("span", { className: "text-slate-400", children: "Colour" }),
841
- /* @__PURE__ */ jsx9(CommitColorInput, { label: "Paper colour", value: paper.color, onCommit: (v) => attempt(() => controller.setPaper({ color: v })), className: "h-6 w-10 rounded bg-transparent" })
805
+ /* @__PURE__ */ jsx8("div", { className: "text-slate-300", children: paper.name }),
806
+ /* @__PURE__ */ jsxs7("label", { className: "flex items-center justify-between", children: [
807
+ /* @__PURE__ */ jsx8("span", { className: "text-slate-400", children: "Colour" }),
808
+ /* @__PURE__ */ jsx8(CommitColorInput, { label: "Paper colour", value: paper.color, onCommit: (v) => attempt(() => controller.setPaper({ color: v })), className: "h-6 w-10 rounded bg-transparent" })
842
809
  ] }),
843
- PAPER_SLIDERS.map((c) => /* @__PURE__ */ jsx9(PaintSlider, { control: c, value: readPath(paper, c.path), onCommit: (v) => attempt(() => controller.setPaper(patchPath(paper, c.path, v))) }, c.path)),
844
- /* @__PURE__ */ jsxs8("label", { className: "flex items-center justify-between", children: [
845
- /* @__PURE__ */ jsx9("span", { className: "text-slate-400", children: "Backlight colour" }),
846
- /* @__PURE__ */ jsx9(CommitColorInput, { label: "Backlight colour", value: paper.backlightColor ?? DEFAULT_BACKLIGHT_COLOR, onCommit: (v) => attempt(() => controller.setPaper({ backlightColor: v })), className: "h-6 w-10 rounded bg-transparent" })
810
+ PAPER_SLIDERS.map((c) => /* @__PURE__ */ jsx8(PaintSlider, { control: c, value: readPath(paper, c.path), onCommit: (v) => attempt(() => controller.setPaper(patchPath(paper, c.path, v))) }, c.path)),
811
+ /* @__PURE__ */ jsxs7("label", { className: "flex items-center justify-between", children: [
812
+ /* @__PURE__ */ jsx8("span", { className: "text-slate-400", children: "Backlight colour" }),
813
+ /* @__PURE__ */ jsx8(CommitColorInput, { label: "Backlight colour", value: paper.backlightColor ?? DEFAULT_BACKLIGHT_COLOR, onCommit: (v) => attempt(() => controller.setPaper({ backlightColor: v })), className: "h-6 w-10 rounded bg-transparent" })
847
814
  ] }),
848
- /* @__PURE__ */ jsxs8("label", { className: "flex items-center gap-2", children: [
849
- /* @__PURE__ */ jsx9("input", { type: "checkbox", checked: paper.tiling === "mirror", onChange: (e) => attempt(() => controller.setPaper({ tiling: e.target.checked ? "mirror" : "repeat" })) }),
815
+ /* @__PURE__ */ jsxs7("label", { className: "flex items-center gap-2", children: [
816
+ /* @__PURE__ */ jsx8("input", { type: "checkbox", checked: paper.tiling === "mirror", onChange: (e) => attempt(() => controller.setPaper({ tiling: e.target.checked ? "mirror" : "repeat" })) }),
850
817
  " Mirror tiling"
851
818
  ] }),
852
- /* @__PURE__ */ jsx9("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" }),
853
- /* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-1.5", "data-testid": "light-panel", children: [
854
- /* @__PURE__ */ jsx9("span", { className: "font-medium text-slate-300", children: "Light (thick paint, metallic paper)" }),
855
- LIGHT_SLIDERS.map((c) => /* @__PURE__ */ jsx9(PaintSlider, { control: c, value: readPath(controller.getLighting(), c.path), onChange: (v) => attempt(() => controller.setLighting({ [c.path]: v })) }, c.path)),
856
- /* @__PURE__ */ jsx9("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" })
819
+ /* @__PURE__ */ jsx8("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" }),
820
+ /* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-1.5", "data-testid": "light-panel", children: [
821
+ /* @__PURE__ */ jsx8("span", { className: "font-medium text-slate-300", children: "Light (thick paint, metallic paper)" }),
822
+ LIGHT_SLIDERS.map((c) => /* @__PURE__ */ jsx8(PaintSlider, { control: c, value: readPath(controller.getLighting(), c.path), onChange: (v) => attempt(() => controller.setLighting({ [c.path]: v })) }, c.path)),
823
+ /* @__PURE__ */ jsx8("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" })
857
824
  ] }),
858
- /* @__PURE__ */ jsx9(ErrorLine, { error })
825
+ /* @__PURE__ */ jsx8(ErrorLine, { error })
859
826
  ] });
860
827
  };
861
828
 
862
829
  // src/paint-editor/ColorPanel.tsx
863
- import { useMemo as useMemo7, useRef as useRef5, useState as useState8 } from "react";
830
+ import { useMemo as useMemo6, useRef as useRef5, useState as useState7 } from "react";
864
831
  import {
865
832
  HARMONY_KINDS,
866
833
  MIXING_PAD_HEIGHT,
@@ -877,24 +844,24 @@ import {
877
844
  wheelPoint
878
845
  } from "@pixerate/editor/paint-editor";
879
846
  import { DEFAULT_PAINT_GRADIENT as DEFAULT_PAINT_GRADIENT2, paintSourceCss } from "@pixerate/editor/paint-editor";
880
- import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
847
+ import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
881
848
  var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className }) => {
882
849
  const state = usePaintEditorState(controller);
883
850
  const [error, attempt] = useAttempt();
884
- const [wheel, setWheel] = useState8("ryb");
885
- const [kind, setKind] = useState8("complementary");
886
- const [padTool, setPadTool] = useState8("paint");
887
- const [sample, setSample] = useState8(3);
888
- const [parts, setParts] = useState8([1, 1]);
889
- const [padName, setPadName] = useState8("");
851
+ const [wheel, setWheel] = useState7("ryb");
852
+ const [kind, setKind] = useState7("complementary");
853
+ const [padTool, setPadTool] = useState7("paint");
854
+ const [sample, setSample] = useState7(3);
855
+ const [parts, setParts] = useState7([1, 1]);
856
+ const [padName, setPadName] = useState7("");
890
857
  const padPoints = useRef5(null);
891
- const ring = useMemo7(() => renderColorWheel(wheelSize, wheel), [wheelSize, wheel]);
858
+ const ring = useMemo6(() => renderColorWheel(wheelSize, wheel), [wheelSize, wheel]);
892
859
  const color = state.color;
893
- const harmony = useMemo7(() => controller.harmony(kind, { color, wheel }), [controller, kind, color, wheel]);
860
+ const harmony = useMemo6(() => controller.harmony(kind, { color, wheel }), [controller, kind, color, wheel]);
894
861
  const [r, g, b] = parseHexColor(color);
895
862
  const hsv = rgbToHsv(r, g, b);
896
- const effectWell = useMemo7(() => state.effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(64) : null, [controller, state.effectPaint, state.effectPaintRendering]);
897
- const pad = useMemo7(() => ({ width: MIXING_PAD_WIDTH, height: MIXING_PAD_HEIGHT, data: controller.mixingPad.pixels() }), [controller, state.mixingPadVersion]);
863
+ const effectWell = useMemo6(() => state.effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(64) : null, [controller, state.effectPaint, state.effectPaintRendering]);
864
+ const pad = useMemo6(() => ({ width: MIXING_PAD_WIDTH, height: MIXING_PAD_HEIGHT, data: controller.mixingPad.pixels() }), [controller, state.mixingPadVersion]);
898
865
  const R = wheelSize / 2;
899
866
  const mid = R * 0.82;
900
867
  const setHsv = (s, v) => controller.setColor(rgbToHexColor(...hsvToRgb(hsv.h, s, v)));
@@ -906,9 +873,9 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
906
873
  const y = Math.min(MIXING_PAD_HEIGHT, Math.max(0, (e.clientY - rect.top) * ky));
907
874
  return e.pointerType === "pen" && e.pressure > 0 ? { x, y, pressure: e.pressure } : { x, y };
908
875
  };
909
- return /* @__PURE__ */ jsxs9("div", { className: `${panel} ${className ?? ""}`, "data-testid": "color-panel", children: [
910
- /* @__PURE__ */ jsxs9("div", { className: "relative self-center", style: { width: wheelSize, height: wheelSize }, children: [
911
- /* @__PURE__ */ jsx10(
876
+ return /* @__PURE__ */ jsxs8("div", { className: `${panel} ${className ?? ""}`, "data-testid": "color-panel", children: [
877
+ /* @__PURE__ */ jsxs8("div", { className: "relative self-center", style: { width: wheelSize, height: wheelSize }, children: [
878
+ /* @__PURE__ */ jsx9(
912
879
  "div",
913
880
  {
914
881
  role: "slider",
@@ -922,20 +889,20 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
922
889
  const rect = e.currentTarget.getBoundingClientRect();
923
890
  controller.setColor(wheelPick(e.clientX - rect.left - R, e.clientY - rect.top - R, wheel, color));
924
891
  },
925
- children: /* @__PURE__ */ jsx10(PixelCanvas, { pixels: ring, label: "Colour wheel", style: { width: wheelSize, height: wheelSize } })
892
+ children: /* @__PURE__ */ jsx9(PixelCanvas, { pixels: ring, label: "Colour wheel", style: { width: wheelSize, height: wheelSize } })
926
893
  }
927
894
  ),
928
- /* @__PURE__ */ jsx10("svg", { className: "pointer-events-none absolute inset-0", width: wheelSize, height: wheelSize, "aria-hidden": "true", children: harmony.map((h, i) => {
895
+ /* @__PURE__ */ jsx9("svg", { className: "pointer-events-none absolute inset-0", width: wheelSize, height: wheelSize, "aria-hidden": "true", children: harmony.map((h, i) => {
929
896
  const p = wheelPoint(h.angle, mid);
930
- return /* @__PURE__ */ jsx10("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);
897
+ return /* @__PURE__ */ jsx9("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);
931
898
  }) }),
932
- /* @__PURE__ */ jsx10("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 } })
899
+ /* @__PURE__ */ jsx9("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 } })
933
900
  ] }),
934
- /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
935
- /* @__PURE__ */ jsx10("input", { type: "color", "aria-label": "Paint colour", value: color, onChange: (e) => controller.setColor(e.target.value), className: "h-7 w-9 rounded bg-transparent" }),
936
- /* @__PURE__ */ jsx10("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" }),
937
- /* @__PURE__ */ jsx10("button", { type: "button", className: button, title: "Swap colours (X)", onClick: () => controller.swapColors(), children: "Swap" }),
938
- /* @__PURE__ */ jsx10(
901
+ /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
902
+ /* @__PURE__ */ jsx9("input", { type: "color", "aria-label": "Paint colour", value: color, onChange: (e) => controller.setColor(e.target.value), className: "h-7 w-9 rounded bg-transparent" }),
903
+ /* @__PURE__ */ jsx9("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" }),
904
+ /* @__PURE__ */ jsx9("button", { type: "button", className: button, title: "Swap colours (X)", onClick: () => controller.swapColors(), children: "Swap" }),
905
+ /* @__PURE__ */ jsx9(
939
906
  "input",
940
907
  {
941
908
  "aria-label": "Hex colour",
@@ -946,8 +913,8 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
946
913
  color
947
914
  )
948
915
  ] }),
949
- /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", "data-testid": "paint-source", children: [
950
- /* @__PURE__ */ jsx10(
916
+ /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", "data-testid": "paint-source", children: [
917
+ /* @__PURE__ */ jsx9(
951
918
  "span",
952
919
  {
953
920
  className: "h-5 flex-1 rounded ring-1 ring-slate-700",
@@ -957,7 +924,7 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
957
924
  style: { background: effectWell ? `center / cover no-repeat url("${effectWell}")` : paintSourceCss(state.paint, { paint: color, secondary: state.secondaryColor }) }
958
925
  }
959
926
  ),
960
- /* @__PURE__ */ jsx10(
927
+ /* @__PURE__ */ jsx9(
961
928
  "button",
962
929
  {
963
930
  type: "button",
@@ -969,26 +936,26 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
969
936
  }
970
937
  )
971
938
  ] }),
972
- state.paint.type === "gradient" && /* @__PURE__ */ jsx10(PaintGradientEditor, { value: state.paint, colors: { paint: color, secondary: state.secondaryColor }, onChange: (g2) => attempt(() => controller.setPaint(g2)) }),
973
- /* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-2", children: [
974
- /* @__PURE__ */ jsx10("span", { className: "w-16 text-slate-400", children: "Saturation" }),
975
- /* @__PURE__ */ jsx10("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" })
939
+ state.paint.type === "gradient" && /* @__PURE__ */ jsx9(PaintGradientEditor, { value: state.paint, colors: { paint: color, secondary: state.secondaryColor }, onChange: (g2) => attempt(() => controller.setPaint(g2)) }),
940
+ /* @__PURE__ */ jsxs8("label", { className: "flex items-center gap-2", children: [
941
+ /* @__PURE__ */ jsx9("span", { className: "w-16 text-slate-400", children: "Saturation" }),
942
+ /* @__PURE__ */ jsx9("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" })
976
943
  ] }),
977
- /* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-2", children: [
978
- /* @__PURE__ */ jsx10("span", { className: "w-16 text-slate-400", children: "Value" }),
979
- /* @__PURE__ */ jsx10("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" })
944
+ /* @__PURE__ */ jsxs8("label", { className: "flex items-center gap-2", children: [
945
+ /* @__PURE__ */ jsx9("span", { className: "w-16 text-slate-400", children: "Value" }),
946
+ /* @__PURE__ */ jsx9("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" })
980
947
  ] }),
981
- /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1", children: [
982
- /* @__PURE__ */ jsx10("select", { "aria-label": "Harmony", value: kind, onChange: (e) => setKind(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: HARMONY_KINDS.map((k) => /* @__PURE__ */ jsx10("option", { value: k, children: k }, k)) }),
983
- /* @__PURE__ */ jsx10("button", { type: "button", className: chip(wheel === "ryb"), "aria-pressed": wheel === "ryb", onClick: () => setWheel("ryb"), children: "RYB" }),
984
- /* @__PURE__ */ jsx10("button", { type: "button", className: chip(wheel === "rgb"), "aria-pressed": wheel === "rgb", onClick: () => setWheel("rgb"), children: "RGB" })
948
+ /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-1", children: [
949
+ /* @__PURE__ */ jsx9("select", { "aria-label": "Harmony", value: kind, onChange: (e) => setKind(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: HARMONY_KINDS.map((k) => /* @__PURE__ */ jsx9("option", { value: k, children: k }, k)) }),
950
+ /* @__PURE__ */ jsx9("button", { type: "button", className: chip(wheel === "ryb"), "aria-pressed": wheel === "ryb", onClick: () => setWheel("ryb"), children: "RYB" }),
951
+ /* @__PURE__ */ jsx9("button", { type: "button", className: chip(wheel === "rgb"), "aria-pressed": wheel === "rgb", onClick: () => setWheel("rgb"), children: "RGB" })
985
952
  ] }),
986
- /* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap gap-1", "aria-label": "Harmony colours", children: [
987
- harmony.map((h, i) => /* @__PURE__ */ jsx10("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)),
988
- /* @__PURE__ */ jsx10("button", { type: "button", className: button, onClick: () => harmony.forEach((h) => controller.addSwatch(h.color)), children: "+ swatches" })
953
+ /* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap gap-1", "aria-label": "Harmony colours", children: [
954
+ harmony.map((h, i) => /* @__PURE__ */ jsx9("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)),
955
+ /* @__PURE__ */ jsx9("button", { type: "button", className: button, onClick: () => harmony.forEach((h) => controller.addSwatch(h.color)), children: "+ swatches" })
989
956
  ] }),
990
- /* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": "Swatches", children: [
991
- state.swatches.map((s, i) => /* @__PURE__ */ jsx10(
957
+ /* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": "Swatches", children: [
958
+ state.swatches.map((s, i) => /* @__PURE__ */ jsx9(
992
959
  "button",
993
960
  {
994
961
  type: "button",
@@ -1006,15 +973,15 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1006
973
  },
1007
974
  i
1008
975
  )),
1009
- /* @__PURE__ */ jsx10("button", { type: "button", className: button, "aria-label": "Add swatch", onClick: () => attempt(() => controller.addSwatch(state.paint)), children: "+" })
976
+ /* @__PURE__ */ jsx9("button", { type: "button", className: button, "aria-label": "Add swatch", onClick: () => attempt(() => controller.addSwatch(state.paint)), children: "+" })
1010
977
  ] }),
1011
- mixingPad && /* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-1", "data-testid": "mixing-pad", children: [
1012
- /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1", children: [
1013
- /* @__PURE__ */ jsx10("span", { className: "text-slate-400", children: "Mixing pad" }),
1014
- ["paint", "knife", "pick"].map((t) => /* @__PURE__ */ jsx10("button", { type: "button", "aria-pressed": padTool === t, className: chip(padTool === t), onClick: () => setPadTool(t), children: t === "paint" ? "Paint" : t === "knife" ? "Knife" : "Pick" }, t)),
1015
- /* @__PURE__ */ jsx10("button", { type: "button", className: button, onClick: () => controller.clearMixingPad(), children: "Clear" })
978
+ mixingPad && /* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-1", "data-testid": "mixing-pad", children: [
979
+ /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-1", children: [
980
+ /* @__PURE__ */ jsx9("span", { className: "text-slate-400", children: "Mixing pad" }),
981
+ ["paint", "knife", "pick"].map((t) => /* @__PURE__ */ jsx9("button", { type: "button", "aria-pressed": padTool === t, className: chip(padTool === t), onClick: () => setPadTool(t), children: t === "paint" ? "Paint" : t === "knife" ? "Knife" : "Pick" }, t)),
982
+ /* @__PURE__ */ jsx9("button", { type: "button", className: button, onClick: () => controller.clearMixingPad(), children: "Clear" })
1016
983
  ] }),
1017
- /* @__PURE__ */ jsx10(
984
+ /* @__PURE__ */ jsx9(
1018
985
  "div",
1019
986
  {
1020
987
  role: "application",
@@ -1035,20 +1002,20 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1035
1002
  padPoints.current = null;
1036
1003
  if (pts?.length) attempt(() => controller.mixingPadStroke(pts, { tool: padTool === "knife" ? "knife" : "paint" }));
1037
1004
  },
1038
- children: /* @__PURE__ */ jsx10(PixelCanvas, { pixels: pad, label: "Mixing pad pixels", className: "w-full rounded", style: { aspectRatio: `${MIXING_PAD_WIDTH} / ${MIXING_PAD_HEIGHT}` } })
1005
+ children: /* @__PURE__ */ jsx9(PixelCanvas, { pixels: pad, label: "Mixing pad pixels", className: "w-full rounded", style: { aspectRatio: `${MIXING_PAD_WIDTH} / ${MIXING_PAD_HEIGHT}` } })
1039
1006
  }
1040
1007
  ),
1041
- /* @__PURE__ */ jsx10("div", { className: "flex flex-wrap items-center gap-1", children: /* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-1", children: [
1042
- /* @__PURE__ */ jsx10("span", { className: "text-slate-400", children: "Sample" }),
1043
- /* @__PURE__ */ jsx10("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: PAD_SAMPLE_SIZES.map((n) => /* @__PURE__ */ jsx10("option", { value: n, children: n === 1 ? "1 px" : `${n}\xD7${n}` }, n)) })
1008
+ /* @__PURE__ */ jsx9("div", { className: "flex flex-wrap items-center gap-1", children: /* @__PURE__ */ jsxs8("label", { className: "flex items-center gap-1", children: [
1009
+ /* @__PURE__ */ jsx9("span", { className: "text-slate-400", children: "Sample" }),
1010
+ /* @__PURE__ */ jsx9("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: PAD_SAMPLE_SIZES.map((n) => /* @__PURE__ */ jsx9("option", { value: n, children: n === 1 ? "1 px" : `${n}\xD7${n}` }, n)) })
1044
1011
  ] }) }),
1045
- /* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap items-center gap-1", children: [
1046
- /* @__PURE__ */ jsx10("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: color } }),
1047
- /* @__PURE__ */ jsx10("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" }),
1048
- /* @__PURE__ */ jsx10("span", { className: "text-slate-500", children: ":" }),
1049
- /* @__PURE__ */ jsx10("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" }),
1050
- /* @__PURE__ */ jsx10("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: state.secondaryColor } }),
1051
- /* @__PURE__ */ jsx10(
1012
+ /* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap items-center gap-1", children: [
1013
+ /* @__PURE__ */ jsx9("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: color } }),
1014
+ /* @__PURE__ */ jsx9("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" }),
1015
+ /* @__PURE__ */ jsx9("span", { className: "text-slate-500", children: ":" }),
1016
+ /* @__PURE__ */ jsx9("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" }),
1017
+ /* @__PURE__ */ jsx9("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: state.secondaryColor } }),
1018
+ /* @__PURE__ */ jsx9(
1052
1019
  "button",
1053
1020
  {
1054
1021
  type: "button",
@@ -1067,23 +1034,23 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1067
1034
  }
1068
1035
  )
1069
1036
  ] }),
1070
- /* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap items-center gap-1", children: [
1071
- /* @__PURE__ */ jsx10("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" }),
1072
- /* @__PURE__ */ jsx10("button", { type: "button", className: button, onClick: () => attempt(() => (controller.saveMixingPad(padName || void 0), setPadName(""))), children: "Keep pad" })
1037
+ /* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap items-center gap-1", children: [
1038
+ /* @__PURE__ */ jsx9("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" }),
1039
+ /* @__PURE__ */ jsx9("button", { type: "button", className: button, onClick: () => attempt(() => (controller.saveMixingPad(padName || void 0), setPadName(""))), children: "Keep pad" })
1073
1040
  ] }),
1074
- state.savedMixingPads.length > 0 && /* @__PURE__ */ jsx10("ul", { className: "flex flex-col gap-0.5", "aria-label": "Kept pads", children: state.savedMixingPads.map((p) => /* @__PURE__ */ jsxs9("li", { className: "flex items-center gap-1", children: [
1075
- /* @__PURE__ */ jsx10("button", { type: "button", className: `${button} flex-1 text-left`, onClick: () => attempt(() => controller.loadMixingPad(p.id)), children: p.name }),
1076
- /* @__PURE__ */ jsx10("button", { type: "button", className: button, "aria-label": `Remove ${p.name}`, onClick: () => attempt(() => controller.removeMixingPad(p.id)), children: "\xD7" })
1041
+ state.savedMixingPads.length > 0 && /* @__PURE__ */ jsx9("ul", { className: "flex flex-col gap-0.5", "aria-label": "Kept pads", children: state.savedMixingPads.map((p) => /* @__PURE__ */ jsxs8("li", { className: "flex items-center gap-1", children: [
1042
+ /* @__PURE__ */ jsx9("button", { type: "button", className: `${button} flex-1 text-left`, onClick: () => attempt(() => controller.loadMixingPad(p.id)), children: p.name }),
1043
+ /* @__PURE__ */ jsx9("button", { type: "button", className: button, "aria-label": `Remove ${p.name}`, onClick: () => attempt(() => controller.removeMixingPad(p.id)), children: "\xD7" })
1077
1044
  ] }, p.id)) })
1078
1045
  ] }),
1079
- /* @__PURE__ */ jsx10(ErrorLine, { error })
1046
+ /* @__PURE__ */ jsx9(ErrorLine, { error })
1080
1047
  ] });
1081
1048
  };
1082
1049
 
1083
1050
  // src/paint-editor/PaintLayersPanel.tsx
1084
- import { useState as useState9 } from "react";
1051
+ import { useState as useState8 } from "react";
1085
1052
  import { BLEND_MENU_GROUPS } from "@pixerate/editor/paint-editor";
1086
- import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
1053
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
1087
1054
  function siblingIndex(layers, l) {
1088
1055
  const sibs = layers.filter((x) => x.parentId === l.parentId).reverse();
1089
1056
  return { index: sibs.findIndex((x) => x.id === l.id), count: sibs.length };
@@ -1091,7 +1058,7 @@ function siblingIndex(layers, l) {
1091
1058
  var PaintLayersPanel = ({ controller, className }) => {
1092
1059
  usePaintEditorState(controller);
1093
1060
  const [error, attempt] = useAttempt();
1094
- const [renaming, setRenaming] = useState9(null);
1061
+ const [renaming, setRenaming] = useState8(null);
1095
1062
  const layers = controller.listLayers();
1096
1063
  const active = layers.find((l) => l.active) ?? null;
1097
1064
  const light = active?.type === "pixel" ? controller.lightOf(active.id) : null;
@@ -1101,18 +1068,18 @@ var PaintLayersPanel = ({ controller, className }) => {
1101
1068
  const to = Math.min(count - 1, Math.max(0, index + delta));
1102
1069
  if (to !== index) attempt(() => controller.moveLayer(active.id, to));
1103
1070
  };
1104
- return /* @__PURE__ */ jsxs10("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-layers-panel", children: [
1105
- /* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap gap-1", children: [
1106
- /* @__PURE__ */ jsx11("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer()), children: "New layer" }),
1107
- /* @__PURE__ */ jsx11("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer({ type: "group" })), children: "New group" }),
1108
- /* @__PURE__ */ jsx11("button", { type: "button", className: button, title: "A layer whose strokes stay editable", onClick: () => attempt(() => controller.addLayer({ type: "strokes" })), children: "New stroke layer" }),
1109
- /* @__PURE__ */ jsx11("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.duplicateLayer(active.id)), children: "Duplicate" }),
1110
- /* @__PURE__ */ jsx11("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer up", onClick: () => move(1), children: "\u2191" }),
1111
- /* @__PURE__ */ jsx11("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer down", onClick: () => move(-1), children: "\u2193" }),
1112
- /* @__PURE__ */ jsx11("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.mergeDown(active.id)), children: "Merge down" }),
1113
- /* @__PURE__ */ jsx11("button", { type: "button", className: button, disabled: !active || layers.length < 2, onClick: () => active && attempt(() => controller.removeLayer(active.id)), children: "Delete" })
1071
+ return /* @__PURE__ */ jsxs9("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-layers-panel", children: [
1072
+ /* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap gap-1", children: [
1073
+ /* @__PURE__ */ jsx10("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer()), children: "New layer" }),
1074
+ /* @__PURE__ */ jsx10("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer({ type: "group" })), children: "New group" }),
1075
+ /* @__PURE__ */ jsx10("button", { type: "button", className: button, title: "A layer whose strokes stay editable", onClick: () => attempt(() => controller.addLayer({ type: "strokes" })), children: "New stroke layer" }),
1076
+ /* @__PURE__ */ jsx10("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.duplicateLayer(active.id)), children: "Duplicate" }),
1077
+ /* @__PURE__ */ jsx10("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer up", onClick: () => move(1), children: "\u2191" }),
1078
+ /* @__PURE__ */ jsx10("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer down", onClick: () => move(-1), children: "\u2193" }),
1079
+ /* @__PURE__ */ jsx10("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.mergeDown(active.id)), children: "Merge down" }),
1080
+ /* @__PURE__ */ jsx10("button", { type: "button", className: button, disabled: !active || layers.length < 2, onClick: () => active && attempt(() => controller.removeLayer(active.id)), children: "Delete" })
1114
1081
  ] }),
1115
- /* @__PURE__ */ jsx11("ul", { role: "tree", "aria-label": "Layers", className: "flex flex-col gap-0.5", children: layers.map((l) => /* @__PURE__ */ jsxs10(
1082
+ /* @__PURE__ */ jsx10("ul", { role: "tree", "aria-label": "Layers", className: "flex flex-col gap-0.5", children: layers.map((l) => /* @__PURE__ */ jsxs9(
1116
1083
  "li",
1117
1084
  {
1118
1085
  role: "treeitem",
@@ -1121,7 +1088,7 @@ var PaintLayersPanel = ({ controller, className }) => {
1121
1088
  style: { paddingLeft: 6 + l.depth * 12 },
1122
1089
  onClick: () => controller.setActiveLayer(l.id),
1123
1090
  children: [
1124
- /* @__PURE__ */ jsx11(
1091
+ /* @__PURE__ */ jsx10(
1125
1092
  "button",
1126
1093
  {
1127
1094
  type: "button",
@@ -1134,7 +1101,7 @@ var PaintLayersPanel = ({ controller, className }) => {
1134
1101
  children: l.visible ? "\u25CF" : "\u25CB"
1135
1102
  }
1136
1103
  ),
1137
- renaming === l.id ? /* @__PURE__ */ jsx11(
1104
+ renaming === l.id ? /* @__PURE__ */ jsx10(
1138
1105
  "input",
1139
1106
  {
1140
1107
  autoFocus: true,
@@ -1151,23 +1118,23 @@ var PaintLayersPanel = ({ controller, className }) => {
1151
1118
  if (e.key === "Escape") setRenaming(null);
1152
1119
  }
1153
1120
  }
1154
- ) : /* @__PURE__ */ jsxs10("span", { className: "flex-1 truncate", onDoubleClick: () => setRenaming(l.id), children: [
1121
+ ) : /* @__PURE__ */ jsxs9("span", { className: "flex-1 truncate", onDoubleClick: () => setRenaming(l.id), children: [
1155
1122
  l.type === "group" ? "\u25B8 " : "",
1156
- l.liveStrokes !== void 0 && /* @__PURE__ */ jsxs10("span", { "aria-label": "Stroke layer", title: `Stroke layer: ${l.liveStrokes} editable strokes`, children: [
1123
+ l.liveStrokes !== void 0 && /* @__PURE__ */ jsxs9("span", { "aria-label": "Stroke layer", title: `Stroke layer: ${l.liveStrokes} editable strokes`, children: [
1157
1124
  "\u270E",
1158
1125
  " "
1159
1126
  ] }),
1160
1127
  l.name
1161
1128
  ] }),
1162
- l.locks.pixels || l.locks.all ? /* @__PURE__ */ jsx11("span", { title: "Locked", children: "\u{1F512}" }) : null
1129
+ l.locks.pixels || l.locks.all ? /* @__PURE__ */ jsx10("span", { title: "Locked", children: "\u{1F512}" }) : null
1163
1130
  ]
1164
1131
  },
1165
1132
  l.id
1166
1133
  )) }),
1167
- active && /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-1.5", children: [
1168
- /* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-2", children: [
1169
- /* @__PURE__ */ jsx11("span", { className: "w-14 text-slate-400", children: "Opacity" }),
1170
- /* @__PURE__ */ jsx11(
1134
+ active && /* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-1.5", children: [
1135
+ /* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-2", children: [
1136
+ /* @__PURE__ */ jsx10("span", { className: "w-14 text-slate-400", children: "Opacity" }),
1137
+ /* @__PURE__ */ jsx10(
1171
1138
  "input",
1172
1139
  {
1173
1140
  type: "range",
@@ -1181,40 +1148,40 @@ var PaintLayersPanel = ({ controller, className }) => {
1181
1148
  }
1182
1149
  )
1183
1150
  ] }),
1184
- /* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-2", children: [
1185
- /* @__PURE__ */ jsx11("span", { className: "w-14 text-slate-400", children: "Blend" }),
1186
- /* @__PURE__ */ jsxs10("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: [
1187
- active.type === "group" && /* @__PURE__ */ jsx11("option", { value: "pass-through", children: "Pass through" }),
1188
- BLEND_MENU_GROUPS.map((g) => /* @__PURE__ */ jsx11("optgroup", { label: g.label, children: g.modes.map((m) => /* @__PURE__ */ jsx11("option", { value: m.id, title: m.description, children: m.label }, m.id)) }, g.label))
1151
+ /* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-2", children: [
1152
+ /* @__PURE__ */ jsx10("span", { className: "w-14 text-slate-400", children: "Blend" }),
1153
+ /* @__PURE__ */ jsxs9("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: [
1154
+ active.type === "group" && /* @__PURE__ */ jsx10("option", { value: "pass-through", children: "Pass through" }),
1155
+ BLEND_MENU_GROUPS.map((g) => /* @__PURE__ */ jsx10("optgroup", { label: g.label, children: g.modes.map((m) => /* @__PURE__ */ jsx10("option", { value: m.id, title: m.description, children: m.label }, m.id)) }, g.label))
1189
1156
  ] })
1190
1157
  ] }),
1191
- /* @__PURE__ */ jsxs10("div", { className: "flex gap-1", children: [
1192
- ["pixels", "transparency"].map((k) => /* @__PURE__ */ jsx11("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)),
1193
- /* @__PURE__ */ jsx11("button", { type: "button", "aria-pressed": active.clipped, className: chip(active.clipped), onClick: () => attempt(() => controller.updateLayer(active.id, { clipped: !active.clipped })), children: "Clip" })
1158
+ /* @__PURE__ */ jsxs9("div", { className: "flex gap-1", children: [
1159
+ ["pixels", "transparency"].map((k) => /* @__PURE__ */ jsx10("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)),
1160
+ /* @__PURE__ */ jsx10("button", { type: "button", "aria-pressed": active.clipped, className: chip(active.clipped), onClick: () => attempt(() => controller.updateLayer(active.id, { clipped: !active.clipped })), children: "Clip" })
1194
1161
  ] }),
1195
- light?.hasLight && /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-1.5 border-t border-slate-800 pt-1.5", "data-testid": "layer-light", children: [
1196
- /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between", children: [
1197
- /* @__PURE__ */ jsx11("span", { className: "font-medium text-slate-300", title: "This layer's paint gives off light", children: "Light" }),
1198
- /* @__PURE__ */ jsx11("button", { type: "button", className: button, onClick: () => attempt(() => controller.clearLight(active.id)), children: "Clear light" })
1162
+ light?.hasLight && /* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-1.5 border-t border-slate-800 pt-1.5", "data-testid": "layer-light", children: [
1163
+ /* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-between", children: [
1164
+ /* @__PURE__ */ jsx10("span", { className: "font-medium text-slate-300", title: "This layer's paint gives off light", children: "Light" }),
1165
+ /* @__PURE__ */ jsx10("button", { type: "button", className: button, onClick: () => attempt(() => controller.clearLight(active.id)), children: "Clear light" })
1199
1166
  ] }),
1200
- /* @__PURE__ */ jsxs10("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: [
1201
- /* @__PURE__ */ jsx11("span", { className: "w-14 text-slate-400", children: "Spill" }),
1202
- /* @__PURE__ */ jsx11("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" })
1167
+ /* @__PURE__ */ jsxs9("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: [
1168
+ /* @__PURE__ */ jsx10("span", { className: "w-14 text-slate-400", children: "Spill" }),
1169
+ /* @__PURE__ */ jsx10("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" })
1203
1170
  ] }),
1204
- /* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-2", children: [
1205
- /* @__PURE__ */ jsx11("span", { className: "w-14 text-slate-400", children: "Strength" }),
1206
- /* @__PURE__ */ jsx11("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" })
1171
+ /* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-2", children: [
1172
+ /* @__PURE__ */ jsx10("span", { className: "w-14 text-slate-400", children: "Strength" }),
1173
+ /* @__PURE__ */ jsx10("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" })
1207
1174
  ] })
1208
1175
  ] }),
1209
- /* @__PURE__ */ jsx11("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__ */ jsx11(LayerEffectsPanel, { controller, layerId: active.id }) })
1176
+ /* @__PURE__ */ jsx10("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__ */ jsx10(LayerEffectsPanel, { controller, layerId: active.id }) })
1210
1177
  ] }),
1211
- /* @__PURE__ */ jsx11(ErrorLine, { error })
1178
+ /* @__PURE__ */ jsx10(ErrorLine, { error })
1212
1179
  ] });
1213
1180
  };
1214
1181
 
1215
1182
  // src/paint-editor/WetPanel.tsx
1216
1183
  import { WET_FLOW_KINDS, WET_GPU_OPTIONS, WET_PARAM_SLIDERS, WET_SPEED_SLIDER, WET_TILT_SLIDERS, readPath as readPath2, wetEngineSummary } from "@pixerate/editor/paint-editor";
1217
- import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
1184
+ import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
1218
1185
  var FLOW_LABELS = { none: "None", linear: "One way", swirl: "Swirl", radial: "Outwards", turbulent: "Eddies" };
1219
1186
  var WetPanel = ({ controller, className }) => {
1220
1187
  const state = usePaintEditorState(controller);
@@ -1223,31 +1190,31 @@ var WetPanel = ({ controller, className }) => {
1223
1190
  const layerId = state.document.activeLayerId;
1224
1191
  const info = layerId ? controller.wetLayerInfo(layerId) : null;
1225
1192
  const backend = controller.wetState();
1226
- return /* @__PURE__ */ jsxs11("div", { className: `${panel} ${className ?? ""}`, "data-testid": "wet-panel", children: [
1227
- /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between", children: [
1228
- /* @__PURE__ */ jsx12("span", { className: wet.wet ? "text-sky-300" : "text-slate-400", "data-testid": "wet-status", children: wet.wet ? wet.paused ? "Wet (paused)" : "Wet" : "Dry" }),
1229
- /* @__PURE__ */ jsxs11("span", { className: "text-[10px] text-slate-500", children: [
1193
+ return /* @__PURE__ */ jsxs10("div", { className: `${panel} ${className ?? ""}`, "data-testid": "wet-panel", children: [
1194
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between", children: [
1195
+ /* @__PURE__ */ jsx11("span", { className: wet.wet ? "text-sky-300" : "text-slate-400", "data-testid": "wet-status", children: wet.wet ? wet.paused ? "Wet (paused)" : "Wet" : "Dry" }),
1196
+ /* @__PURE__ */ jsxs10("span", { className: "text-[10px] text-slate-500", children: [
1230
1197
  "step ",
1231
1198
  wet.clock
1232
1199
  ] })
1233
1200
  ] }),
1234
- /* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap gap-1", children: [
1235
- /* @__PURE__ */ jsx12("button", { type: "button", className: button, disabled: !wet.layerIds.length, onClick: () => attempt(async () => (await controller.wetIdle(), controller.dryPaint())), children: "Dry now" }),
1236
- /* @__PURE__ */ jsx12("button", { type: "button", className: chip(wet.paused), "aria-pressed": wet.paused, onClick: () => controller.setWetPaused(!wet.paused), children: wet.paused ? "Resume" : "Pause" }),
1237
- /* @__PURE__ */ jsx12("button", { type: "button", className: chip(wet.overlay), "aria-pressed": wet.overlay, onClick: () => controller.setWaterOverlay(!wet.overlay), children: "Water" }),
1238
- /* @__PURE__ */ jsx12("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" }),
1239
- /* @__PURE__ */ jsx12("button", { type: "button", className: button, disabled: !layerId, onClick: () => attempt(async () => (await controller.wetIdle(), controller.wetPaper({}))), children: "Wet paper" })
1201
+ /* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap gap-1", children: [
1202
+ /* @__PURE__ */ jsx11("button", { type: "button", className: button, disabled: !wet.layerIds.length, onClick: () => attempt(async () => (await controller.wetIdle(), controller.dryPaint())), children: "Dry now" }),
1203
+ /* @__PURE__ */ jsx11("button", { type: "button", className: chip(wet.paused), "aria-pressed": wet.paused, onClick: () => controller.setWetPaused(!wet.paused), children: wet.paused ? "Resume" : "Pause" }),
1204
+ /* @__PURE__ */ jsx11("button", { type: "button", className: chip(wet.overlay), "aria-pressed": wet.overlay, onClick: () => controller.setWaterOverlay(!wet.overlay), children: "Water" }),
1205
+ /* @__PURE__ */ jsx11("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" }),
1206
+ /* @__PURE__ */ jsx11("button", { type: "button", className: button, disabled: !layerId, onClick: () => attempt(async () => (await controller.wetIdle(), controller.wetPaper({}))), children: "Wet paper" })
1240
1207
  ] }),
1241
- /* @__PURE__ */ jsx12(PaintSlider, { control: WET_SPEED_SLIDER, value: wet.speed, onChange: (v) => controller.setWetSpeed(v) }),
1242
- WET_TILT_SLIDERS.map((c) => /* @__PURE__ */ jsx12(PaintSlider, { control: c, value: readPath2(wet.tilt, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setCanvasTilt({ [c.path]: v }))) }, c.path)),
1243
- info && /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-layer", children: [
1244
- /* @__PURE__ */ jsx12("span", { className: "font-medium text-slate-300", children: "This layer" }),
1245
- WET_PARAM_SLIDERS.map((c) => /* @__PURE__ */ jsx12(PaintSlider, { control: c, value: readPath2(info.params, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setWetParams(layerId, { [c.path]: v }))) }, c.path)),
1246
- /* @__PURE__ */ jsxs11("label", { className: "flex items-center justify-between gap-2", children: [
1247
- /* @__PURE__ */ jsx12("span", { className: "text-slate-400", children: "Flow map" }),
1248
- /* @__PURE__ */ jsx12("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: WET_FLOW_KINDS.map((k) => /* @__PURE__ */ jsx12("option", { value: k, children: FLOW_LABELS[k] }, k)) })
1208
+ /* @__PURE__ */ jsx11(PaintSlider, { control: WET_SPEED_SLIDER, value: wet.speed, onChange: (v) => controller.setWetSpeed(v) }),
1209
+ WET_TILT_SLIDERS.map((c) => /* @__PURE__ */ jsx11(PaintSlider, { control: c, value: readPath2(wet.tilt, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setCanvasTilt({ [c.path]: v }))) }, c.path)),
1210
+ info && /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-layer", children: [
1211
+ /* @__PURE__ */ jsx11("span", { className: "font-medium text-slate-300", children: "This layer" }),
1212
+ WET_PARAM_SLIDERS.map((c) => /* @__PURE__ */ jsx11(PaintSlider, { control: c, value: readPath2(info.params, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setWetParams(layerId, { [c.path]: v }))) }, c.path)),
1213
+ /* @__PURE__ */ jsxs10("label", { className: "flex items-center justify-between gap-2", children: [
1214
+ /* @__PURE__ */ jsx11("span", { className: "text-slate-400", children: "Flow map" }),
1215
+ /* @__PURE__ */ jsx11("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: WET_FLOW_KINDS.map((k) => /* @__PURE__ */ jsx11("option", { value: k, children: FLOW_LABELS[k] }, k)) })
1249
1216
  ] }),
1250
- info.flow.kind !== "none" && /* @__PURE__ */ jsx12(
1217
+ info.flow.kind !== "none" && /* @__PURE__ */ jsx11(
1251
1218
  PaintSlider,
1252
1219
  {
1253
1220
  control: { path: "strength", label: "Flow strength", min: 0, max: 1, step: 0.01 },
@@ -1256,20 +1223,20 @@ var WetPanel = ({ controller, className }) => {
1256
1223
  }
1257
1224
  )
1258
1225
  ] }),
1259
- backend.message && /* @__PURE__ */ jsx12("p", { className: "text-[10px] text-amber-300", "data-testid": "wet-message", children: backend.message }),
1260
- backend.backend && /* @__PURE__ */ jsx12("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" }),
1261
- /* @__PURE__ */ jsxs11("label", { className: "flex items-center justify-between gap-2", children: [
1262
- /* @__PURE__ */ jsx12("span", { className: "text-slate-400", children: "Engine" }),
1263
- /* @__PURE__ */ jsx12("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: WET_GPU_OPTIONS.map((o) => /* @__PURE__ */ jsx12("option", { value: o.value, children: o.label }, o.value)) })
1226
+ backend.message && /* @__PURE__ */ jsx11("p", { className: "text-[10px] text-amber-300", "data-testid": "wet-message", children: backend.message }),
1227
+ backend.backend && /* @__PURE__ */ jsx11("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" }),
1228
+ /* @__PURE__ */ jsxs10("label", { className: "flex items-center justify-between gap-2", children: [
1229
+ /* @__PURE__ */ jsx11("span", { className: "text-slate-400", children: "Engine" }),
1230
+ /* @__PURE__ */ jsx11("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: WET_GPU_OPTIONS.map((o) => /* @__PURE__ */ jsx11("option", { value: o.value, children: o.label }, o.value)) })
1264
1231
  ] }),
1265
- /* @__PURE__ */ jsx12("p", { className: `text-[10px] ${backend.engine.state === "active" ? "text-emerald-300" : "text-slate-500"}`, "data-testid": "wet-engine", children: wetEngineSummary(backend.engine) }),
1266
- /* @__PURE__ */ jsx12(ErrorLine, { error })
1232
+ /* @__PURE__ */ jsx11("p", { className: `text-[10px] ${backend.engine.state === "active" ? "text-emerald-300" : "text-slate-500"}`, "data-testid": "wet-engine", children: wetEngineSummary(backend.engine) }),
1233
+ /* @__PURE__ */ jsx11(ErrorLine, { error })
1267
1234
  ] });
1268
1235
  };
1269
1236
 
1270
1237
  // src/paint-editor/StickerPanel.tsx
1271
1238
  import { STICKER_SLIDERS, readPath as readPath3, stickerRefLabel } from "@pixerate/editor/paint-editor";
1272
- import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
1239
+ import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
1273
1240
  var StickerPanel = ({ controller, className }) => {
1274
1241
  const state = usePaintEditorState(controller);
1275
1242
  const [error, attempt] = useAttempt();
@@ -1279,16 +1246,16 @@ var StickerPanel = ({ controller, className }) => {
1279
1246
  const stickers = layerId ? state.document.stickers?.[layerId] ?? [] : [];
1280
1247
  if (!stickers.length) return null;
1281
1248
  const sel = stickers.find((s) => s.id === picked) ?? null;
1282
- return /* @__PURE__ */ jsxs12("div", { className: `${panel} ${className ?? ""}`, "data-testid": "sticker-panel", children: [
1283
- /* @__PURE__ */ jsxs12("span", { className: "font-medium text-slate-300", children: [
1249
+ return /* @__PURE__ */ jsxs11("div", { className: `${panel} ${className ?? ""}`, "data-testid": "sticker-panel", children: [
1250
+ /* @__PURE__ */ jsxs11("span", { className: "font-medium text-slate-300", children: [
1284
1251
  "Stickers (",
1285
1252
  stickers.length,
1286
1253
  ")"
1287
1254
  ] }),
1288
- /* @__PURE__ */ jsx13("div", { className: "flex max-h-24 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Stickers", children: stickers.map((s) => /* @__PURE__ */ jsx13("button", { type: "button", role: "option", "aria-selected": s.id === picked, title: `${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)) }),
1289
- sel && /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-1.5", "data-testid": "sticker-edit", children: [
1290
- /* @__PURE__ */ jsx13("span", { className: "text-slate-400", children: "Sticker" }),
1291
- /* @__PURE__ */ jsx13(
1255
+ /* @__PURE__ */ jsx12("div", { className: "flex max-h-24 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Stickers", children: stickers.map((s) => /* @__PURE__ */ jsx12("button", { type: "button", role: "option", "aria-selected": s.id === picked, title: `${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)) }),
1256
+ sel && /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-1.5", "data-testid": "sticker-edit", children: [
1257
+ /* @__PURE__ */ jsx12("span", { className: "text-slate-400", children: "Sticker" }),
1258
+ /* @__PURE__ */ jsx12(
1292
1259
  StickerPicker,
1293
1260
  {
1294
1261
  controller,
@@ -1302,9 +1269,9 @@ var StickerPanel = ({ controller, className }) => {
1302
1269
  )
1303
1270
  }
1304
1271
  ),
1305
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center justify-between gap-2", children: [
1306
- /* @__PURE__ */ jsx13("span", { className: "text-slate-400", children: "Position" }),
1307
- /* @__PURE__ */ jsx13("span", { className: "flex gap-1", children: ["x", "y"].map((k) => /* @__PURE__ */ jsx13(
1272
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between gap-2", children: [
1273
+ /* @__PURE__ */ jsx12("span", { className: "text-slate-400", children: "Position" }),
1274
+ /* @__PURE__ */ jsx12("span", { className: "flex gap-1", children: ["x", "y"].map((k) => /* @__PURE__ */ jsx12(
1308
1275
  "input",
1309
1276
  {
1310
1277
  type: "number",
@@ -1318,24 +1285,24 @@ var StickerPanel = ({ controller, className }) => {
1318
1285
  `${sel.id}-${k}-${sel[k]}`
1319
1286
  )) })
1320
1287
  ] }),
1321
- STICKER_SLIDERS.map((c) => /* @__PURE__ */ jsx13(PaintSlider, { control: c, value: readPath3(sel, c.path), onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { [c.path]: v })) }, c.path)),
1322
- /* @__PURE__ */ jsxs12("label", { className: "flex items-center justify-between", children: [
1323
- /* @__PURE__ */ jsx13("span", { className: "text-slate-400", children: "Colour" }),
1324
- /* @__PURE__ */ jsx13(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" })
1288
+ STICKER_SLIDERS.map((c) => /* @__PURE__ */ jsx12(PaintSlider, { control: c, value: readPath3(sel, c.path), onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { [c.path]: v })) }, c.path)),
1289
+ /* @__PURE__ */ jsxs11("label", { className: "flex items-center justify-between", children: [
1290
+ /* @__PURE__ */ jsx12("span", { className: "text-slate-400", children: "Colour" }),
1291
+ /* @__PURE__ */ jsx12(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" })
1325
1292
  ] }),
1326
- /* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap gap-1", children: [
1327
- /* @__PURE__ */ jsx13("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "front")), children: "To front" }),
1328
- /* @__PURE__ */ jsx13("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "back")), children: "To back" }),
1329
- /* @__PURE__ */ jsx13("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStickers(layerId, [sel.id]), setPicked(null))), children: "Delete" })
1293
+ /* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap gap-1", children: [
1294
+ /* @__PURE__ */ jsx12("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "front")), children: "To front" }),
1295
+ /* @__PURE__ */ jsx12("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "back")), children: "To back" }),
1296
+ /* @__PURE__ */ jsx12("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStickers(layerId, [sel.id]), setPicked(null))), children: "Delete" })
1330
1297
  ] })
1331
1298
  ] }),
1332
- /* @__PURE__ */ jsx13(ErrorLine, { error })
1299
+ /* @__PURE__ */ jsx12(ErrorLine, { error })
1333
1300
  ] });
1334
1301
  };
1335
1302
 
1336
1303
  // src/paint-editor/StrokePanel.tsx
1337
1304
  import { STROKE_SLIDERS, liveStrokeRefusal, readPath as readPath4 } from "@pixerate/editor/paint-editor";
1338
- import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
1305
+ import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
1339
1306
  var StrokePanel = ({ controller, className }) => {
1340
1307
  const state = usePaintEditorState(controller);
1341
1308
  const [error, attempt] = useAttempt();
@@ -1345,16 +1312,16 @@ var StrokePanel = ({ controller, className }) => {
1345
1312
  const index = strokes.findIndex((s) => s.id === state.selectedStroke);
1346
1313
  const sel = index >= 0 ? strokes[index] : null;
1347
1314
  const brushes = state.brushes.filter((b) => !liveStrokeRefusal(b));
1348
- return /* @__PURE__ */ jsxs13("div", { className: `${panel} ${className ?? ""}`, "data-testid": "stroke-panel", children: [
1349
- /* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between", children: [
1350
- /* @__PURE__ */ jsxs13("span", { className: "font-medium text-slate-300", children: [
1315
+ return /* @__PURE__ */ jsxs12("div", { className: `${panel} ${className ?? ""}`, "data-testid": "stroke-panel", children: [
1316
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-center justify-between", children: [
1317
+ /* @__PURE__ */ jsxs12("span", { className: "font-medium text-slate-300", children: [
1351
1318
  "Strokes (",
1352
1319
  strokes.length,
1353
1320
  ")"
1354
1321
  ] }),
1355
- /* @__PURE__ */ jsx14("button", { type: "button", className: button, onClick: () => attempt(() => controller.rasterizeLiveStrokes(layerId)), children: "Rasterize" })
1322
+ /* @__PURE__ */ jsx13("button", { type: "button", className: button, onClick: () => attempt(() => controller.rasterizeLiveStrokes(layerId)), children: "Rasterize" })
1356
1323
  ] }),
1357
- /* @__PURE__ */ jsx14("div", { className: "flex max-h-24 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Strokes", children: strokes.map((s, i) => /* @__PURE__ */ jsx14(
1324
+ /* @__PURE__ */ jsx13("div", { className: "flex max-h-24 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Strokes", children: strokes.map((s, i) => /* @__PURE__ */ jsx13(
1358
1325
  "button",
1359
1326
  {
1360
1327
  type: "button",
@@ -1367,10 +1334,10 @@ var StrokePanel = ({ controller, className }) => {
1367
1334
  },
1368
1335
  s.id
1369
1336
  )) }),
1370
- sel && /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-1.5", "data-testid": "stroke-edit", children: [
1371
- /* @__PURE__ */ jsxs13("label", { className: "flex items-center justify-between gap-2", children: [
1372
- /* @__PURE__ */ jsx14("span", { className: "text-slate-400", children: "Brush" }),
1373
- /* @__PURE__ */ jsxs13(
1337
+ sel && /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-1.5", "data-testid": "stroke-edit", children: [
1338
+ /* @__PURE__ */ jsxs12("label", { className: "flex items-center justify-between gap-2", children: [
1339
+ /* @__PURE__ */ jsx13("span", { className: "text-slate-400", children: "Brush" }),
1340
+ /* @__PURE__ */ jsxs12(
1374
1341
  "select",
1375
1342
  {
1376
1343
  "aria-label": "Stroke brush",
@@ -1378,38 +1345,38 @@ var StrokePanel = ({ controller, className }) => {
1378
1345
  onChange: (e) => e.target.value && attempt(() => controller.updateStroke(sel.id, { brushId: e.target.value })),
1379
1346
  className: "max-w-[10rem] rounded bg-slate-800 px-1 py-0.5",
1380
1347
  children: [
1381
- !brushes.some((b) => b.id === sel.brush.id) && /* @__PURE__ */ jsx14("option", { value: "", children: sel.brush.name }),
1382
- brushes.map((b) => /* @__PURE__ */ jsx14("option", { value: b.id, children: b.name }, b.id))
1348
+ !brushes.some((b) => b.id === sel.brush.id) && /* @__PURE__ */ jsx13("option", { value: "", children: sel.brush.name }),
1349
+ brushes.map((b) => /* @__PURE__ */ jsx13("option", { value: b.id, children: b.name }, b.id))
1383
1350
  ]
1384
1351
  }
1385
1352
  )
1386
1353
  ] }),
1387
- STROKE_SLIDERS.map((c) => /* @__PURE__ */ jsx14(PaintSlider, { control: c, value: readPath4(sel.brush, c.path), onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { brush: { tip: { [c.path.split(".")[1]]: v } } })) }, c.path)),
1388
- /* @__PURE__ */ jsxs13("label", { className: "flex items-center justify-between", children: [
1389
- /* @__PURE__ */ jsx14("span", { className: "text-slate-400", children: "Colour" }),
1390
- /* @__PURE__ */ jsx14(CommitColorInput, { label: "Stroke colour", value: sel.color, onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { color: v })), className: "h-6 w-10 rounded bg-transparent" })
1354
+ STROKE_SLIDERS.map((c) => /* @__PURE__ */ jsx13(PaintSlider, { control: c, value: readPath4(sel.brush, c.path), onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { brush: { tip: { [c.path.split(".")[1]]: v } } })) }, c.path)),
1355
+ /* @__PURE__ */ jsxs12("label", { className: "flex items-center justify-between", children: [
1356
+ /* @__PURE__ */ jsx13("span", { className: "text-slate-400", children: "Colour" }),
1357
+ /* @__PURE__ */ jsx13(CommitColorInput, { label: "Stroke colour", value: sel.color, onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { color: v })), className: "h-6 w-10 rounded bg-transparent" })
1391
1358
  ] }),
1392
- /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap gap-1", children: [
1393
- /* @__PURE__ */ jsx14("button", { type: "button", className: button, onClick: () => attempt(() => controller.updateStroke(sel.id, { seed: (sel.seed + 1) % 2147483647 })), children: "New seed" }),
1394
- /* @__PURE__ */ jsx14("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" }),
1395
- /* @__PURE__ */ jsx14("button", { type: "button", className: button, disabled: index === 0, "aria-label": "Move stroke down", onClick: () => attempt(() => controller.reorderStroke(sel.id, index - 1)), children: "\u2193" }),
1396
- /* @__PURE__ */ jsx14("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStrokes([sel.id]), controller.selectStroke(null))), children: "Delete" })
1359
+ /* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap gap-1", children: [
1360
+ /* @__PURE__ */ jsx13("button", { type: "button", className: button, onClick: () => attempt(() => controller.updateStroke(sel.id, { seed: (sel.seed + 1) % 2147483647 })), children: "New seed" }),
1361
+ /* @__PURE__ */ jsx13("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" }),
1362
+ /* @__PURE__ */ jsx13("button", { type: "button", className: button, disabled: index === 0, "aria-label": "Move stroke down", onClick: () => attempt(() => controller.reorderStroke(sel.id, index - 1)), children: "\u2193" }),
1363
+ /* @__PURE__ */ jsx13("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStrokes([sel.id]), controller.selectStroke(null))), children: "Delete" })
1397
1364
  ] })
1398
1365
  ] }),
1399
- /* @__PURE__ */ jsx14(ErrorLine, { error })
1366
+ /* @__PURE__ */ jsx13(ErrorLine, { error })
1400
1367
  ] });
1401
1368
  };
1402
1369
 
1403
1370
  // src/paint-editor/PaintEditor.tsx
1404
- import { useRef as useRef7, useState as useState11 } from "react";
1371
+ import { useRef as useRef7, useState as useState10 } from "react";
1405
1372
  import { PaintPresence as PaintPresence2, documentToScreen as documentToScreen2, screenToDocument } from "@pixerate/editor/paint-editor";
1406
1373
 
1407
1374
  // src/paint-editor/PaintEffectsPanel.tsx
1408
- import { useEffect as useEffect5, useMemo as useMemo8, useRef as useRef6, useState as useState10 } from "react";
1375
+ import { useEffect as useEffect5, useMemo as useMemo7, useRef as useRef6, useState as useState9 } from "react";
1409
1376
  import { createPaintEffectsToolProvider, PAPER_EFFECT_BLENDS } from "@pixerate/editor/paint-editor";
1410
- import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
1377
+ import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
1411
1378
  function usePaintEffectsProvider(controller) {
1412
- const [provider, setProvider] = useState10(controller.effectsProvider);
1379
+ const [provider, setProvider] = useState9(controller.effectsProvider);
1413
1380
  useEffect5(() => {
1414
1381
  setProvider(controller.effectsProvider);
1415
1382
  return controller.effects.subscribe(setProvider);
@@ -1426,19 +1393,19 @@ function usePaintEffectsTools(registry, controller, options = {}) {
1426
1393
  function Controls({ provider, effect, name, values, apply }) {
1427
1394
  const { description, error } = useEffectDescription(provider, effect);
1428
1395
  const drags = useRef6(/* @__PURE__ */ new Set());
1429
- if (!provider) return /* @__PURE__ */ jsxs14("p", { className: "text-[11px] text-slate-400", children: [
1396
+ if (!provider) return /* @__PURE__ */ jsxs13("p", { className: "text-[11px] text-slate-400", children: [
1430
1397
  'No effects provider: "',
1431
1398
  name ?? effect,
1432
1399
  '" is kept as it was drawn.'
1433
1400
  ] });
1434
- if (error) return /* @__PURE__ */ jsx15("p", { className: "text-[11px] text-amber-400", children: error });
1435
- if (!description) return /* @__PURE__ */ jsx15("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
1401
+ if (error) return /* @__PURE__ */ jsx14("p", { className: "text-[11px] text-amber-400", children: error });
1402
+ if (!description) return /* @__PURE__ */ jsx14("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
1436
1403
  const commit = (gesture) => {
1437
1404
  if (!gesture || drags.current.has(gesture)) return !gesture;
1438
1405
  drags.current.add(gesture);
1439
1406
  return true;
1440
1407
  };
1441
- return /* @__PURE__ */ jsx15(
1408
+ return /* @__PURE__ */ jsx14(
1442
1409
  EffectParameters,
1443
1410
  {
1444
1411
  description,
@@ -1460,8 +1427,8 @@ var PaintEffectsPanel = ({ controller, className }) => {
1460
1427
  const state = usePaintEditorState(controller);
1461
1428
  const provider = usePaintEffectsProvider(controller);
1462
1429
  const [error, attempt] = useAttempt();
1463
- const [browse, setBrowse] = useState10(null);
1464
- const [busy, setBusy] = useState10(false);
1430
+ const [browse, setBrowse] = useState9(null);
1431
+ const [busy, setBusy] = useState9(false);
1465
1432
  const paper = controller.getPaperEffect();
1466
1433
  const activeId = state.document.activeLayerId;
1467
1434
  const layerEffect = activeId ? controller.getEffectLayer(activeId) : void 0;
@@ -1473,7 +1440,7 @@ var PaintEffectsPanel = ({ controller, className }) => {
1473
1440
  if (!effectPaint) return;
1474
1441
  run(() => controller.setEffectPaint({ effect: effectPaint.effect, values: effectPaint.values, time: effectPaint.time, map: effectPaint.map, live: effectPaint.live, ...patch }));
1475
1442
  };
1476
- const thumbnail = useMemo8(() => effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(48) : null, [controller, effectPaint, state.effectPaintRendering]);
1443
+ const thumbnail = useMemo7(() => effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(48) : null, [controller, effectPaint, state.effectPaintRendering]);
1477
1444
  const run = (work) => attempt(() => {
1478
1445
  setBusy(true);
1479
1446
  return work().finally(() => setBusy(false));
@@ -1489,28 +1456,28 @@ var PaintEffectsPanel = ({ controller, className }) => {
1489
1456
  };
1490
1457
  const toggle = (b) => setBrowse(browse === b ? null : b);
1491
1458
  const pixel = active?.type === "pixel";
1492
- return /* @__PURE__ */ jsxs14("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
1493
- /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center gap-1", children: [
1494
- /* @__PURE__ */ jsx15("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
1495
- /* @__PURE__ */ jsx15("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
1496
- /* @__PURE__ */ jsx15("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
1497
- /* @__PURE__ */ jsx15("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
1498
- /* @__PURE__ */ jsx15("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" }),
1499
- /* @__PURE__ */ jsx15("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" })
1459
+ return /* @__PURE__ */ jsxs13("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
1460
+ /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-1", children: [
1461
+ /* @__PURE__ */ jsx14("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
1462
+ /* @__PURE__ */ jsx14("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
1463
+ /* @__PURE__ */ jsx14("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
1464
+ /* @__PURE__ */ jsx14("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
1465
+ /* @__PURE__ */ jsx14("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" }),
1466
+ /* @__PURE__ */ jsx14("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" })
1500
1467
  ] }),
1501
- !provider && /* @__PURE__ */ jsx15("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
1502
- browse && /* @__PURE__ */ jsx15(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
1503
- paper && /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
1504
- /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-1", children: [
1505
- /* @__PURE__ */ jsxs14("span", { className: "flex-1 truncate", children: [
1468
+ !provider && /* @__PURE__ */ jsx14("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
1469
+ browse && /* @__PURE__ */ jsx14(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
1470
+ paper && /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
1471
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1", children: [
1472
+ /* @__PURE__ */ jsxs13("span", { className: "flex-1 truncate", children: [
1506
1473
  "Paper: ",
1507
1474
  paper.name ?? paper.effect
1508
1475
  ] }),
1509
- /* @__PURE__ */ jsx15("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
1476
+ /* @__PURE__ */ jsx14("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
1510
1477
  ] }),
1511
- /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1", children: [
1512
- /* @__PURE__ */ jsx15("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
1513
- /* @__PURE__ */ jsx15(
1478
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", children: [
1479
+ /* @__PURE__ */ jsx14("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
1480
+ /* @__PURE__ */ jsx14(
1514
1481
  "input",
1515
1482
  {
1516
1483
  type: "range",
@@ -1532,39 +1499,39 @@ var PaintEffectsPanel = ({ controller, className }) => {
1532
1499
  `o${paper.opacity}`
1533
1500
  )
1534
1501
  ] }),
1535
- /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1", children: [
1536
- /* @__PURE__ */ jsx15("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
1537
- /* @__PURE__ */ jsx15("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) => {
1502
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", children: [
1503
+ /* @__PURE__ */ jsx14("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
1504
+ /* @__PURE__ */ jsx14("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) => {
1538
1505
  const blend = e.currentTarget.value;
1539
1506
  run(() => controller.updatePaperEffect({ blend }));
1540
- }, children: PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ jsx15("option", { value: b, children: b }, b)) })
1507
+ }, children: PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ jsx14("option", { value: b, children: b }, b)) })
1541
1508
  ] }),
1542
- /* @__PURE__ */ jsx15(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
1509
+ /* @__PURE__ */ jsx14(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
1543
1510
  ] }),
1544
- effectPaint && /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paint", children: [
1545
- /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-1", children: [
1546
- thumbnail ? /* @__PURE__ */ jsx15("img", { src: thumbnail, alt: "", className: "h-5 w-8 rounded object-cover ring-1 ring-slate-700", "data-testid": "effect-paint-thumbnail" }) : null,
1547
- /* @__PURE__ */ jsxs14("span", { className: "flex-1 truncate", children: [
1511
+ effectPaint && /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paint", children: [
1512
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1", children: [
1513
+ thumbnail ? /* @__PURE__ */ jsx14("img", { src: thumbnail, alt: "", className: "h-5 w-8 rounded object-cover ring-1 ring-slate-700", "data-testid": "effect-paint-thumbnail" }) : null,
1514
+ /* @__PURE__ */ jsxs13("span", { className: "flex-1 truncate", children: [
1548
1515
  "Paint: ",
1549
1516
  effectPaint.effect,
1550
1517
  state.effectPaintRendering ? " (rendering\u2026)" : ""
1551
1518
  ] }),
1552
- /* @__PURE__ */ jsx15("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
1519
+ /* @__PURE__ */ jsx14("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
1553
1520
  ] }),
1554
- /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
1555
- /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1", title: "Lay the effect along each stroke instead of fixing it to the canvas", children: [
1556
- /* @__PURE__ */ jsx15("input", { type: "checkbox", checked: Boolean(effectPaint.map), onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
1521
+ /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
1522
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", title: "Lay the effect along each stroke instead of fixing it to the canvas", children: [
1523
+ /* @__PURE__ */ jsx14("input", { type: "checkbox", checked: Boolean(effectPaint.map), onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
1557
1524
  "Along the stroke"
1558
1525
  ] }),
1559
- /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
1560
- /* @__PURE__ */ jsx15("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
1526
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
1527
+ /* @__PURE__ */ jsx14("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
1561
1528
  "Live"
1562
1529
  ] })
1563
1530
  ] }),
1564
- effectPaint.map && /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center gap-2", children: [
1565
- /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1", children: [
1566
- /* @__PURE__ */ jsx15("span", { className: "text-slate-400", children: "Length" }),
1567
- /* @__PURE__ */ jsx15(
1531
+ effectPaint.map && /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-2", children: [
1532
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", children: [
1533
+ /* @__PURE__ */ jsx14("span", { className: "text-slate-400", children: "Length" }),
1534
+ /* @__PURE__ */ jsx14(
1568
1535
  "input",
1569
1536
  {
1570
1537
  type: "number",
@@ -1578,55 +1545,55 @@ var PaintEffectsPanel = ({ controller, className }) => {
1578
1545
  effectPaint.map.length
1579
1546
  )
1580
1547
  ] }),
1581
- /* @__PURE__ */ jsxs14("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: [
1582
- /* @__PURE__ */ jsx15("option", { value: "repeat", children: "Repeat" }),
1583
- /* @__PURE__ */ jsx15("option", { value: "mirror", children: "Mirror" }),
1584
- /* @__PURE__ */ jsx15("option", { value: "clamp", children: "Clamp" })
1548
+ /* @__PURE__ */ jsxs13("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: [
1549
+ /* @__PURE__ */ jsx14("option", { value: "repeat", children: "Repeat" }),
1550
+ /* @__PURE__ */ jsx14("option", { value: "mirror", children: "Mirror" }),
1551
+ /* @__PURE__ */ jsx14("option", { value: "clamp", children: "Clamp" })
1585
1552
  ] })
1586
1553
  ] }),
1587
- /* @__PURE__ */ jsx15(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
1554
+ /* @__PURE__ */ jsx14(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
1588
1555
  ] }),
1589
- animation && /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2 rounded border border-slate-700 p-1", "data-effect-part": "playback", children: [
1590
- /* @__PURE__ */ jsxs14("span", { className: "flex-1 truncate", children: [
1556
+ animation && /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2 rounded border border-slate-700 p-1", "data-effect-part": "playback", children: [
1557
+ /* @__PURE__ */ jsxs13("span", { className: "flex-1 truncate", children: [
1591
1558
  "Live paint: ",
1592
1559
  animation.strokes,
1593
1560
  " ",
1594
1561
  animation.strokes === 1 ? "stroke" : "strokes"
1595
1562
  ] }),
1596
- /* @__PURE__ */ jsx15("button", { type: "button", className: button, "aria-pressed": playback.playing, onClick: () => attempt(() => controller.setEffectPlayback({ playing: !playback.playing })), children: playback.playing ? "Pause" : "Play" }),
1597
- /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1", children: [
1598
- /* @__PURE__ */ jsx15("span", { className: "text-slate-400", children: "fps" }),
1599
- /* @__PURE__ */ jsx15("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" })
1563
+ /* @__PURE__ */ jsx14("button", { type: "button", className: button, "aria-pressed": playback.playing, onClick: () => attempt(() => controller.setEffectPlayback({ playing: !playback.playing })), children: playback.playing ? "Pause" : "Play" }),
1564
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", children: [
1565
+ /* @__PURE__ */ jsx14("span", { className: "text-slate-400", children: "fps" }),
1566
+ /* @__PURE__ */ jsx14("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" })
1600
1567
  ] })
1601
1568
  ] }),
1602
- layerEffect && activeId && /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "layer", children: [
1603
- /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-1", children: [
1604
- /* @__PURE__ */ jsxs14("span", { className: "flex-1 truncate", children: [
1569
+ layerEffect && activeId && /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "layer", children: [
1570
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1", children: [
1571
+ /* @__PURE__ */ jsxs13("span", { className: "flex-1 truncate", children: [
1605
1572
  "Layer: ",
1606
1573
  layerEffect.name ?? layerEffect.effect
1607
1574
  ] }),
1608
- /* @__PURE__ */ jsx15("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
1575
+ /* @__PURE__ */ jsx14("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
1609
1576
  ] }),
1610
- /* @__PURE__ */ jsx15(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
1577
+ /* @__PURE__ */ jsx14(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
1611
1578
  ] }),
1612
- /* @__PURE__ */ jsx15(ErrorLine, { error })
1579
+ /* @__PURE__ */ jsx14(ErrorLine, { error })
1613
1580
  ] });
1614
1581
  };
1615
1582
 
1616
1583
  // src/paint-editor/PaintEditor.tsx
1617
- import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
1584
+ import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
1618
1585
  var PAINT_CONTROLS = {
1619
1586
  "mixing-pad": '[data-testid="mixing-pad"]',
1620
1587
  lighting: '[data-testid="light-panel"]',
1621
1588
  symmetry: '[aria-label="Symmetry"]'
1622
1589
  };
1623
1590
  var PaintEditor = ({ controller, fileName, height = 720, presence, className, playback, playbackId = "paint", onPlaybackReveal }) => {
1624
- const [tool, setTool] = useState11("brush");
1625
- const [tab, setTab] = useState11("color");
1591
+ const [tool, setTool] = useState10("brush");
1592
+ const [tab, setTab] = useState10("color");
1626
1593
  const tabRef = useRef7(tab);
1627
1594
  tabRef.current = tab;
1628
1595
  const rootRef = useRef7(null);
1629
- const [ownPresence] = useState11(() => new PaintPresence2());
1596
+ const [ownPresence] = useState10(() => new PaintPresence2());
1630
1597
  const ambientPlayback = useAgentPlayback();
1631
1598
  const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
1632
1599
  const viewBox = () => {
@@ -1682,28 +1649,28 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, className, pl
1682
1649
  const box = rootRef.current?.getBoundingClientRect();
1683
1650
  return c && box ? { x: c.x - box.left, y: c.y - box.top } : p;
1684
1651
  };
1685
- const [error, setError] = useState11(null);
1652
+ const [error, setError] = useState10(null);
1686
1653
  const effects = usePaintEffectsProvider(controller);
1687
1654
  const tabs = effects ? ["color", "wet", "paper", "layers", "effects"] : ["color", "wet", "paper", "layers"];
1688
- return /* @__PURE__ */ jsxs15("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: [
1689
- playing && /* @__PURE__ */ jsx16(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
1690
- /* @__PURE__ */ jsx16(PaintToolbar, { controller, tool, onToolChange: setTool, fileName }),
1691
- /* @__PURE__ */ jsxs15("div", { className: "flex min-h-0 flex-1 gap-2", children: [
1692
- /* @__PURE__ */ jsx16(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
1693
- /* @__PURE__ */ jsxs15("div", { className: "flex min-w-0 flex-1 flex-col", children: [
1694
- /* @__PURE__ */ jsx16(PaintCanvas, { controller, tool, onError: setError, presence: playing ? void 0 : presence, className: "flex-1 rounded-lg" }),
1695
- error && /* @__PURE__ */ jsx16("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
1655
+ return /* @__PURE__ */ jsxs14("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: [
1656
+ playing && /* @__PURE__ */ jsx15(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
1657
+ /* @__PURE__ */ jsx15(PaintToolbar, { controller, tool, onToolChange: setTool, fileName }),
1658
+ /* @__PURE__ */ jsxs14("div", { className: "flex min-h-0 flex-1 gap-2", children: [
1659
+ /* @__PURE__ */ jsx15(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
1660
+ /* @__PURE__ */ jsxs14("div", { className: "flex min-w-0 flex-1 flex-col", children: [
1661
+ /* @__PURE__ */ jsx15(PaintCanvas, { controller, tool, onError: setError, presence: playing ? void 0 : presence, className: "flex-1 rounded-lg" }),
1662
+ error && /* @__PURE__ */ jsx15("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
1696
1663
  ] }),
1697
- /* @__PURE__ */ jsxs15("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
1698
- /* @__PURE__ */ jsx16("div", { className: "flex gap-1", role: "tablist", "aria-label": "Paint panels", children: tabs.map((t) => /* @__PURE__ */ jsx16("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)) }),
1699
- /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
1700
- tab === "color" && /* @__PURE__ */ jsx16(ColorPanel, { controller }),
1701
- tab === "wet" && /* @__PURE__ */ jsx16(WetPanel, { controller }),
1702
- tab === "paper" && /* @__PURE__ */ jsx16(PaperPanel, { controller }),
1703
- tab === "layers" && /* @__PURE__ */ jsx16(PaintLayersPanel, { controller }),
1704
- tab === "layers" && /* @__PURE__ */ jsx16(StrokePanel, { controller }),
1705
- tab === "layers" && /* @__PURE__ */ jsx16(StickerPanel, { controller }),
1706
- tab === "effects" && effects && /* @__PURE__ */ jsx16(PaintEffectsPanel, { controller })
1664
+ /* @__PURE__ */ jsxs14("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
1665
+ /* @__PURE__ */ jsx15("div", { className: "flex gap-1", role: "tablist", "aria-label": "Paint panels", children: tabs.map((t) => /* @__PURE__ */ jsx15("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)) }),
1666
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
1667
+ tab === "color" && /* @__PURE__ */ jsx15(ColorPanel, { controller }),
1668
+ tab === "wet" && /* @__PURE__ */ jsx15(WetPanel, { controller }),
1669
+ tab === "paper" && /* @__PURE__ */ jsx15(PaperPanel, { controller }),
1670
+ tab === "layers" && /* @__PURE__ */ jsx15(PaintLayersPanel, { controller }),
1671
+ tab === "layers" && /* @__PURE__ */ jsx15(StrokePanel, { controller }),
1672
+ tab === "layers" && /* @__PURE__ */ jsx15(StickerPanel, { controller }),
1673
+ tab === "effects" && effects && /* @__PURE__ */ jsx15(PaintEffectsPanel, { controller })
1707
1674
  ] })
1708
1675
  ] })
1709
1676
  ] })