@pixerate/editor-react 0.170.0 → 0.172.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.
@@ -1,3 +1,6 @@
1
+ import {
2
+ StickerLibraryPicker
3
+ } from "../chunk-KYMDNWSX.js";
1
4
  import {
2
5
  LayerEffectsPanel,
3
6
  PaintGradientEditorView
@@ -571,259 +574,221 @@ var PaintToolbar = ({ controller, tool, onToolChange, fileName = "painting", cla
571
574
  };
572
575
 
573
576
  // src/paint-editor/BrushPanel.tsx
574
- import { useMemo as useMemo4, useRef as useRef4, useState as useState6 } from "react";
575
- import {
576
- BLEND_MENU_GROUPS,
577
- BRUSH_ROTATIONS,
578
- BRUSH_SLIDERS,
579
- brushEngineControls,
580
- brushLoadColor,
581
- downloadBytes as downloadBytes2,
582
- brushTakesPaint,
583
- patchBrushValue,
584
- patchPath,
585
- readPath,
586
- WET_TOOLS,
587
- WET_TOOL_LABELS,
588
- WET_MEDIA,
589
- WET_MEDIUM_LABELS,
590
- IMPASTO_TOOLS,
591
- IMPASTO_TOOL_LABELS,
592
- PARTICLE_KINDS,
593
- PARTICLE_KIND_LABELS,
594
- PARTICLE_RENDERS,
595
- PARTICLE_RENDER_LABELS,
596
- RIBBON_PAIRS,
597
- RIBBON_PAIR_LABELS,
598
- DOT_TEXTURE_ORDERS,
599
- DOT_TEXTURE_ORDER_LABELS,
600
- DOT_ROTATIONS,
601
- DOT_ROTATION_LABELS,
602
- toggleDotTexture,
603
- STAMP_KINDS,
604
- STAMP_LABELS,
605
- toggleStickerRef
606
- } from "@pixerate/editor/paint-editor";
607
- import { DEFAULT_PAINT_GRADIENT } from "@pixerate/editor/paint-editor";
577
+ import { useMemo as useMemo5, useRef as useRef4 } from "react";
578
+ import { brushLoadColor, brushTakesPaint, downloadBytes as downloadBytes2, toggleStickerRef, DEFAULT_PAINT_GRADIENT } from "@pixerate/editor/paint-editor";
579
+ import { PAINT_PROFILE as PAINT_PROFILE2 } from "@pixerate/editor/brushes";
580
+
581
+ // src/paint-editor/BrushEditor.tsx
582
+ import { useMemo as useMemo3, useState as useState5 } from "react";
583
+ import { brushEditorSections, PAINT_PROFILE, setBrushEditorValue } from "@pixerate/editor/brushes";
584
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
585
+ var BrushEditor = ({ brush, profile = PAINT_PROFILE, onChange, preview, onSaveAs, renderExtra, className }) => {
586
+ const sections = useMemo3(() => brushEditorSections(brush, profile), [brush, profile]);
587
+ const [problems, setProblems] = useState5(null);
588
+ const [name, setName] = useState5("");
589
+ const set = (path, value) => {
590
+ const r = setBrushEditorValue(brush, path, value);
591
+ setProblems(r.problems.length ? r.problems.join(" ") : null);
592
+ if (r.brush !== brush) onChange(r.brush);
593
+ };
594
+ return /* @__PURE__ */ jsxs4("div", { className: `flex flex-col gap-2 ${className ?? ""}`, "data-testid": "brush-editor", children: [
595
+ preview !== void 0 && /* @__PURE__ */ jsx4(PixelCanvas, { pixels: preview, label: "Brush preview", className: "rounded", style: { width: "100%", aspectRatio: preview ? `${preview.width} / ${preview.height}` : "4 / 1" } }),
596
+ sections.map((s) => /* @__PURE__ */ jsxs4("section", { className: "flex flex-col gap-1.5", "data-section": s.id, ...s.id === "behaviour" ? { "data-testid": "brush-engine" } : {}, children: [
597
+ /* @__PURE__ */ jsx4("span", { className: "font-medium text-slate-300", children: s.title }),
598
+ s.controls.map((c) => /* @__PURE__ */ jsx4(EditorControl, { control: c, onSet: set }, c.path)),
599
+ renderExtra?.(s.id)
600
+ ] }, s.id)),
601
+ onSaveAs && /* @__PURE__ */ jsxs4("div", { className: "flex flex-wrap items-center gap-1", children: [
602
+ /* @__PURE__ */ jsx4("input", { value: name, placeholder: "Brush name", "aria-label": "Brush name", onChange: (e) => setName(e.target.value), className: "w-28 rounded bg-slate-800 px-1.5 py-0.5" }),
603
+ /* @__PURE__ */ jsx4(
604
+ "button",
605
+ {
606
+ type: "button",
607
+ className: button,
608
+ disabled: !name.trim(),
609
+ onClick: async () => {
610
+ try {
611
+ await onSaveAs(name.trim());
612
+ setName("");
613
+ setProblems(null);
614
+ } catch (e) {
615
+ setProblems(e.message);
616
+ }
617
+ },
618
+ children: "Save brush"
619
+ }
620
+ )
621
+ ] }),
622
+ /* @__PURE__ */ jsx4(ErrorLine, { error: problems })
623
+ ] });
624
+ };
625
+ var EditorControl = ({ control: c, onSet }) => {
626
+ const note = c.note ? /* @__PURE__ */ jsx4("span", { className: "text-[10px] text-amber-400", children: c.note }) : null;
627
+ switch (c.kind) {
628
+ case "slider":
629
+ return /* @__PURE__ */ jsxs4("div", { title: c.note, children: [
630
+ /* @__PURE__ */ jsx4(PaintSlider, { control: c, value: c.value, onChange: (v) => onSet(c.path, v) }),
631
+ note
632
+ ] });
633
+ case "choice":
634
+ return /* @__PURE__ */ jsxs4("label", { className: "flex items-center justify-between gap-2", title: c.note, children: [
635
+ /* @__PURE__ */ jsx4("span", { className: "text-slate-400", children: c.label }),
636
+ /* @__PURE__ */ jsx4("select", { "aria-label": c.ariaLabel, value: c.value, onChange: (e) => onSet(c.path, e.target.value), className: "max-w-[60%] rounded bg-slate-800 px-1 py-0.5", children: c.options.map((o) => /* @__PURE__ */ jsx4("option", { value: o.value, children: o.label }, o.value)) })
637
+ ] });
638
+ case "toggle":
639
+ return /* @__PURE__ */ jsxs4("label", { className: "flex items-center gap-2", title: c.note, children: [
640
+ /* @__PURE__ */ jsx4("input", { type: "checkbox", "aria-label": c.ariaLabel, checked: c.value, onChange: (e) => onSet(c.path, e.target.checked) }),
641
+ " ",
642
+ c.label
643
+ ] });
644
+ case "text":
645
+ return /* @__PURE__ */ jsxs4("label", { className: "flex items-center justify-between gap-2", children: [
646
+ /* @__PURE__ */ jsx4("span", { className: "text-slate-400", children: c.label }),
647
+ /* @__PURE__ */ jsx4("input", { "aria-label": c.ariaLabel, defaultValue: c.value, placeholder: c.placeholder, onBlur: (e) => e.target.value !== c.value && onSet(c.path, e.target.value.trim().toLowerCase()), className: "w-28 rounded bg-slate-800 px-1.5 py-0.5" }, c.value)
648
+ ] });
649
+ case "colour":
650
+ return /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between gap-2", children: [
651
+ /* @__PURE__ */ jsx4("span", { className: "text-slate-400", children: c.label }),
652
+ /* @__PURE__ */ jsxs4("span", { className: "flex items-center gap-1", children: [
653
+ /* @__PURE__ */ jsx4("input", { type: "color", "aria-label": c.ariaLabel, value: c.value ?? "#000000", onChange: (e) => onSet(c.path, e.target.value), className: "h-5 w-8" }),
654
+ c.value && /* @__PURE__ */ jsx4("button", { type: "button", className: button, onClick: () => onSet(c.path, void 0), children: "None" })
655
+ ] })
656
+ ] });
657
+ case "palette":
658
+ return /* @__PURE__ */ jsxs4("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": c.ariaLabel, children: [
659
+ /* @__PURE__ */ jsx4("span", { className: "text-slate-400", children: c.label }),
660
+ c.value.map((col, i) => /* @__PURE__ */ jsx4("button", { type: "button", title: `Remove ${col}`, "aria-label": `Remove ${col}`, className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: col }, onClick: () => onSet(c.path, c.value.filter((_, j) => j !== i)) }, `${col}-${i}`)),
661
+ c.value.length < c.max && /* @__PURE__ */ jsx4("input", { type: "color", "aria-label": "Add a palette colour", onChange: (e) => onSet(c.path, [...c.value, e.target.value]), className: "h-4 w-6" })
662
+ ] });
663
+ case "stamps":
664
+ return /* @__PURE__ */ jsx4("div", { className: "flex flex-wrap gap-1", role: "group", "aria-label": c.ariaLabel, title: `Up to ${c.max}`, children: c.options.map((o) => {
665
+ const on = c.value.includes(o.value);
666
+ return /* @__PURE__ */ jsx4("button", { type: "button", "aria-pressed": on, className: chip(on), onClick: () => onSet(c.path, on ? c.value.filter((v) => v !== o.value) : [...c.value, o.value].slice(-c.max)), children: o.label }, o.value);
667
+ }) });
668
+ }
669
+ };
670
+
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
+ };
608
706
 
609
707
  // src/paint-editor/PaintGradientEditor.tsx
610
708
  import { PAINT_GRADIENT_KIT } from "@pixerate/editor/paint-editor";
611
- import { jsx as jsx4 } from "react/jsx-runtime";
612
- var PaintGradientEditor = (props) => /* @__PURE__ */ jsx4(PaintGradientEditorView, { ...props, kit: PAINT_GRADIENT_KIT });
709
+ import { jsx as jsx6 } from "react/jsx-runtime";
710
+ var PaintGradientEditor = (props) => /* @__PURE__ */ jsx6(PaintGradientEditorView, { ...props, kit: PAINT_GRADIENT_KIT });
613
711
 
614
712
  // src/paint-editor/StickerPicker.tsx
615
- import { useEffect as useEffect4, useMemo as useMemo3, useState as useState5 } from "react";
616
- import { StickerBrowser } from "@pixerate/editor/paint-editor";
617
- import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
713
+ import { useEffect as useEffect4, useState as useState7 } from "react";
714
+ import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
618
715
  var StickerPicker = ({ controller, selected, onPick, label = "Stickers" }) => {
619
- const browser = useMemo3(() => new StickerBrowser(() => controller.stickersProvider), [controller]);
620
- const [, setTick] = useState5(0);
621
- useEffect4(() => browser.subscribe(() => setTick((n) => n + 1)), [browser]);
622
- useEffect4(() => {
623
- void browser.refresh();
624
- return controller.stickers.subscribe(() => void browser.refresh());
625
- }, [browser, controller]);
626
- const s = browser.state;
716
+ const [provider, setProvider] = useState7(() => controller.stickersProvider);
717
+ useEffect4(() => controller.stickers.subscribe(setProvider), [controller]);
627
718
  const failed = selected.map((ref) => ({ ref, ...controller.stickerArtStatus(ref) })).filter((x) => x.status === "failed");
628
- return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-1", "data-testid": "sticker-picker", children: [
629
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1", children: [
630
- /* @__PURE__ */ jsx5("input", { type: "search", "aria-label": `Search ${label.toLowerCase()}`, placeholder: `Search ${s.provider}`, value: s.query, onChange: (e) => void browser.setQuery(e.target.value), className: "min-w-0 flex-1 rounded bg-slate-800 px-1 py-0.5" }),
631
- s.categories.length > 1 && /* @__PURE__ */ jsxs4("select", { "aria-label": "Sticker category", value: s.category, onChange: (e) => void browser.setCategory(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: [
632
- /* @__PURE__ */ jsx5("option", { value: "", children: "All" }),
633
- s.categories.map((c) => /* @__PURE__ */ jsx5("option", { value: c.id, children: c.name }, c.id))
634
- ] })
635
- ] }),
636
- /* @__PURE__ */ jsx5("div", { className: "flex max-h-32 flex-wrap gap-1 overflow-y-auto", role: "group", "aria-label": label, children: s.items.map((it) => {
637
- const on = selected.includes(it.ref);
638
- return /* @__PURE__ */ jsxs4(
639
- "button",
640
- {
641
- type: "button",
642
- "aria-pressed": on,
643
- title: `${it.name} (${it.ref}) \xB7 ${it.licence.name}`,
644
- className: `flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] ${on ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300"}`,
645
- onClick: () => onPick(it.ref),
646
- children: [
647
- it.thumbnail && /* @__PURE__ */ jsx5("img", { src: it.thumbnail, alt: "", className: "h-4 w-4" }),
648
- it.name
649
- ]
650
- },
651
- it.ref
652
- );
653
- }) }),
654
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between text-[10px] text-slate-500", children: [
655
- /* @__PURE__ */ jsx5("span", { children: s.loading ? "Loading\u2026" : `${s.items.length} of ${s.total}` }),
656
- s.hasMore && /* @__PURE__ */ jsx5("button", { type: "button", className: "text-indigo-300", onClick: () => void browser.more(), children: "More" })
657
- ] }),
658
- s.error && /* @__PURE__ */ jsx5("p", { role: "alert", className: "text-[11px] text-rose-400", children: s.error }),
659
- failed.map((f) => /* @__PURE__ */ jsxs4("p", { role: "alert", className: "text-[11px] text-rose-400", children: [
660
- f.ref,
661
- ": ",
662
- f.error
663
- ] }, f.ref))
664
- ] });
719
+ return /* @__PURE__ */ jsx7(
720
+ StickerLibraryPicker,
721
+ {
722
+ provider,
723
+ selected,
724
+ label,
725
+ onPick: (it) => onPick(it.ref),
726
+ footer: failed.map((f) => /* @__PURE__ */ jsxs6("p", { role: "alert", className: "text-[11px] text-rose-400", children: [
727
+ f.ref,
728
+ ": ",
729
+ f.error
730
+ ] }, f.ref))
731
+ }
732
+ );
665
733
  };
666
734
 
667
735
  // src/paint-editor/BrushPanel.tsx
668
- import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
736
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
669
737
  var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, className }) => {
670
738
  const state = usePaintEditorState(controller);
671
739
  const [error, attempt] = useAttempt();
672
- const [saveName, setSaveName] = useState6("");
673
740
  const fileRef = useRef4(null);
674
741
  const { brush, brushes } = state;
675
742
  const paper = state.document.paper;
676
- const thumbs = useMemo4(
743
+ const thumbs = useMemo5(
677
744
  () => new Map(brushes.map((b) => [b.id, controller.brushThumbnail(b.id, { width: thumbnailWidth, height: thumbnailHeight, color: "#26324a" })])),
678
745
  // Thumbnails follow the library and the paper.
679
746
  // eslint-disable-next-line react-hooks/exhaustive-deps
680
747
  [controller, brushes, paper, thumbnailWidth, thumbnailHeight]
681
748
  );
682
- const engine = brushEngineControls(brush);
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]);
751
+ 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]);
683
753
  const carried = brushLoadColor(state.mixerLoad);
684
754
  const slug = (name) => name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || "brush";
685
- return /* @__PURE__ */ jsxs5("div", { className: `${panel} ${className ?? ""}`, "data-testid": "brush-panel", children: [
686
- /* @__PURE__ */ jsx6("div", { className: "grid grid-cols-2 gap-1", role: "listbox", "aria-label": "Brushes", children: brushes.map((b) => /* @__PURE__ */ jsxs5(
687
- "button",
755
+ 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(
759
+ BrushEditor,
688
760
  {
689
- type: "button",
690
- role: "option",
691
- "aria-selected": brush.id === b.id,
692
- title: `${b.name} (${b.category})`,
693
- className: `flex flex-col items-start gap-0.5 rounded p-1 text-left ${brush.id === b.id ? "bg-indigo-600/30 ring-1 ring-indigo-500" : "bg-slate-900 hover:bg-slate-800"}`,
694
- onClick: () => controller.setBrush({ id: b.id }),
695
- children: [
696
- /* @__PURE__ */ jsx6(PixelCanvas, { pixels: thumbs.get(b.id) ?? null, label: `${b.name} thumbnail`, className: "rounded", style: { width: "100%", aspectRatio: `${thumbnailWidth} / ${thumbnailHeight}` } }),
697
- /* @__PURE__ */ jsx6("span", { className: "truncate text-[10px] text-slate-300", children: b.name })
698
- ]
699
- },
700
- b.id
701
- )) }),
702
- /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-1.5", children: [
703
- BRUSH_SLIDERS.map((c) => /* @__PURE__ */ jsx6(PaintSlider, { control: c, value: readPath(brush, c.path), onChange: (v) => controller.setBrush(patchPath(brush, c.path, v)) }, c.path)),
704
- /* @__PURE__ */ jsxs5("label", { className: "flex items-center justify-between gap-2", children: [
705
- /* @__PURE__ */ jsx6("span", { className: "text-slate-400", children: "Rotation" }),
706
- /* @__PURE__ */ jsx6("select", { "aria-label": "Brush rotation", value: brush.rotation, onChange: (e) => controller.setBrush({ rotation: e.target.value }), className: "rounded bg-slate-800 px-1 py-0.5", children: BRUSH_ROTATIONS.map((r) => /* @__PURE__ */ jsx6("option", { value: r, children: r === "stroke" ? "Follow stroke" : r === "barrel" ? "Pen barrel" : "Fixed" }, r)) })
707
- ] }),
708
- /* @__PURE__ */ jsxs5("label", { className: "flex items-center gap-2", children: [
709
- /* @__PURE__ */ jsx6("input", { type: "checkbox", checked: brush.tip.pressureSize, onChange: (e) => controller.setBrush({ tip: { pressureSize: e.target.checked } }) }),
710
- " Pressure \u2192 size"
711
- ] }),
712
- /* @__PURE__ */ jsxs5("label", { className: "flex items-center gap-2", children: [
713
- /* @__PURE__ */ jsx6("input", { type: "checkbox", checked: brush.tip.pressureOpacity, onChange: (e) => controller.setBrush({ tip: { pressureOpacity: e.target.checked } }) }),
714
- " Pressure \u2192 opacity"
715
- ] }),
716
- brush.engine === "dab" && /* @__PURE__ */ jsxs5("label", { className: "flex items-center justify-between gap-2", children: [
717
- /* @__PURE__ */ jsx6("span", { className: "text-slate-400", children: "Blend" }),
718
- /* @__PURE__ */ jsx6("select", { "aria-label": "Brush blend", value: brush.tip.blend, onChange: (e) => controller.setBrush({ tip: { blend: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: BLEND_MENU_GROUPS.map((g) => /* @__PURE__ */ jsx6("optgroup", { label: g.label, children: g.modes.map((m) => /* @__PURE__ */ jsx6("option", { value: m.id, title: m.description, children: m.label }, m.id)) }, g.label)) })
719
- ] })
720
- ] }),
721
- engine && /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-1.5", "data-testid": "brush-engine", children: [
722
- /* @__PURE__ */ jsx6("span", { className: "font-medium text-slate-300", children: engine.title }),
723
- engine.wetTool && /* @__PURE__ */ jsxs5("label", { className: "flex items-center justify-between gap-2", children: [
724
- /* @__PURE__ */ jsx6("span", { className: "text-slate-400", children: "Wet tool" }),
725
- /* @__PURE__ */ jsx6("select", { "aria-label": "Wet tool", value: brush.wet.tool, onChange: (e) => controller.setBrush({ wet: { tool: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: WET_TOOLS.map((t) => /* @__PURE__ */ jsx6("option", { value: t, children: WET_TOOL_LABELS[t] }, t)) })
726
- ] }),
727
- engine.wetTool && /* @__PURE__ */ jsxs5("label", { className: "flex items-center justify-between gap-2", children: [
728
- /* @__PURE__ */ jsx6("span", { className: "text-slate-400", children: "Medium" }),
729
- /* @__PURE__ */ jsx6("select", { "aria-label": "Wet medium", value: brush.wet.medium, onChange: (e) => controller.setBrush({ wet: { medium: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: WET_MEDIA.map((m) => /* @__PURE__ */ jsx6("option", { value: m, children: WET_MEDIUM_LABELS[m] }, m)) })
730
- ] }),
731
- engine.particleMenus && /* @__PURE__ */ jsxs5(Fragment2, { children: [
732
- /* @__PURE__ */ jsxs5("label", { className: "flex items-center justify-between gap-2", children: [
733
- /* @__PURE__ */ jsx6("span", { className: "text-slate-400", children: "Particles" }),
734
- /* @__PURE__ */ jsx6("select", { "aria-label": "Particle kind", value: brush.particle.kind, onChange: (e) => controller.setBrush({ particle: { kind: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: PARTICLE_KINDS.map((k) => /* @__PURE__ */ jsx6("option", { value: k, children: PARTICLE_KIND_LABELS[k] }, k)) })
735
- ] }),
736
- /* @__PURE__ */ jsxs5("label", { className: "flex items-center justify-between gap-2", children: [
737
- /* @__PURE__ */ jsx6("span", { className: "text-slate-400", children: "Drawn as" }),
738
- /* @__PURE__ */ jsx6("select", { "aria-label": "Particle render", value: brush.particle.render, onChange: (e) => controller.setBrush({ particle: { render: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: PARTICLE_RENDERS.map((k) => /* @__PURE__ */ jsx6("option", { value: k, children: PARTICLE_RENDER_LABELS[k] }, k)) })
739
- ] }),
740
- brush.particle.render === "ribbon" && /* @__PURE__ */ jsxs5("label", { className: "flex items-center justify-between gap-2", children: [
741
- /* @__PURE__ */ jsx6("span", { className: "text-slate-400", children: "Ribbon joins" }),
742
- /* @__PURE__ */ jsx6("select", { "aria-label": "Ribbon pairs", value: brush.particle.ribbonPairs, onChange: (e) => controller.setBrush({ particle: { ribbonPairs: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: RIBBON_PAIRS.map((k) => /* @__PURE__ */ jsx6("option", { value: k, children: RIBBON_PAIR_LABELS[k] }, k)) })
743
- ] }),
744
- (brush.particle.render === "dot" || brush.particle.render === "sequence") && /* @__PURE__ */ jsxs5(Fragment2, { children: [
745
- /* @__PURE__ */ jsx6("div", { className: "flex flex-wrap gap-1", role: "group", "aria-label": "Dot textures", title: "Stamps drawn instead of round dots (up to 4; none: round)", children: STAMP_KINDS.map((k) => /* @__PURE__ */ jsx6(
746
- "button",
747
- {
748
- type: "button",
749
- "aria-pressed": brush.particle.dotTextures.includes(k),
750
- className: `px-1.5 py-0.5 rounded text-[10px] ${brush.particle.dotTextures.includes(k) ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300"}`,
751
- onClick: () => controller.setBrush({ particle: { dotTextures: toggleDotTexture(brush.particle.dotTextures, k) } }),
752
- children: STAMP_LABELS[k]
753
- },
754
- k
755
- )) }),
756
- brush.particle.dotTextures.length > 0 && /* @__PURE__ */ jsxs5(Fragment2, { children: [
757
- /* @__PURE__ */ jsxs5("label", { className: "flex items-center justify-between gap-2", children: [
758
- /* @__PURE__ */ jsx6("span", { className: "text-slate-400", children: "Texture order" }),
759
- /* @__PURE__ */ jsx6("select", { "aria-label": "Dot texture order", value: brush.particle.dotTextureOrder, onChange: (e) => controller.setBrush({ particle: { dotTextureOrder: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: DOT_TEXTURE_ORDERS.map((k) => /* @__PURE__ */ jsx6("option", { value: k, children: DOT_TEXTURE_ORDER_LABELS[k] }, k)) })
760
- ] }),
761
- /* @__PURE__ */ jsxs5("label", { className: "flex items-center justify-between gap-2", children: [
762
- /* @__PURE__ */ jsx6("span", { className: "text-slate-400", children: "Texture turn" }),
763
- /* @__PURE__ */ jsx6("select", { "aria-label": "Dot rotation", value: brush.particle.dotRotation, onChange: (e) => controller.setBrush({ particle: { dotRotation: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: DOT_ROTATIONS.map((k) => /* @__PURE__ */ jsx6("option", { value: k, children: DOT_ROTATION_LABELS[k] }, k)) })
764
- ] })
765
- ] })
766
- ] })
767
- ] }),
768
- engine.stickerStamps && /* @__PURE__ */ jsx6(StickerPicker, { controller, label: "Sticker stamps", selected: brush.sticker.stamps, onPick: (ref) => controller.setBrush({ sticker: { stamps: toggleStickerRef(brush.sticker.stamps, ref) } }) }),
769
- engine.impastoTool && /* @__PURE__ */ jsxs5("label", { className: "flex items-center justify-between gap-2", children: [
770
- /* @__PURE__ */ jsx6("span", { className: "text-slate-400", children: "Tool" }),
771
- /* @__PURE__ */ jsx6("select", { "aria-label": "Impasto tool", value: brush.impasto.tool, onChange: (e) => controller.setBrush({ impasto: { tool: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: IMPASTO_TOOLS.map((t) => /* @__PURE__ */ jsx6("option", { value: t, children: IMPASTO_TOOL_LABELS[t] }, t)) })
772
- ] }),
773
- engine.sliders.map((c) => /* @__PURE__ */ jsx6(PaintSlider, { control: c, value: readPath(brush, c.path), onChange: (v) => controller.setBrush(patchPath(brush, c.path, v)) }, c.path)),
774
- engine.mixingPath && /* @__PURE__ */ jsxs5("label", { className: "flex items-center justify-between gap-2", children: [
775
- /* @__PURE__ */ jsx6("span", { className: "text-slate-400", children: "Mixing" }),
776
- /* @__PURE__ */ jsxs5(
777
- "select",
778
- {
779
- "aria-label": "Brush mixing",
780
- value: engine.mixingPath === "blender.mixing" ? brush.blender.mixing : engine.mixingPath === "smudge.mixing" ? brush.smudge.mixing : brush.behavior.mixing,
781
- onChange: (e) => controller.setBrush(patchBrushValue(brush, engine.mixingPath, e.target.value)),
782
- className: "rounded bg-slate-800 px-1 py-0.5",
783
- children: [
784
- /* @__PURE__ */ jsx6("option", { value: "pigment", children: "Pigment" }),
785
- /* @__PURE__ */ jsx6("option", { value: "rgb", children: "RGB" })
786
- ]
787
- }
788
- )
789
- ] }),
790
- engine.light && brush.light.amount > 0 && /* @__PURE__ */ jsxs5("label", { className: "flex items-center gap-2", title: "Pressure scales the light the brush lays", children: [
791
- /* @__PURE__ */ jsx6("input", { type: "checkbox", "aria-label": "Light follows pressure", checked: brush.light.pressure, onChange: (e) => controller.setBrush({ light: { pressure: e.target.checked } }) }),
792
- " Light follows pressure"
793
- ] }),
794
- engine.dirty && /* @__PURE__ */ jsxs5("label", { className: "flex items-center gap-2", title: "Keep the colour the brush picked up for the next stroke (needs Pick-up above 0)", children: [
795
- /* @__PURE__ */ jsx6("input", { type: "checkbox", "aria-label": "Dirty brush", checked: brush.behavior.dirty, onChange: (e) => controller.setBrush({ behavior: { dirty: e.target.checked } }) }),
796
- " Dirty brush"
797
- ] }),
798
- brushTakesPaint(brush) && /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-1.5", "data-testid": "brush-gradient", children: [
799
- /* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between gap-2", children: [
800
- /* @__PURE__ */ jsx6("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" }),
801
- /* @__PURE__ */ jsx6(
802
- "button",
803
- {
804
- type: "button",
805
- "aria-pressed": brush.paint !== null,
806
- className: chip(brush.paint !== null),
807
- onClick: () => attempt(() => controller.setBrush({ paint: brush.paint ? null : DEFAULT_PAINT_GRADIENT })),
808
- children: brush.paint ? "On" : "Off"
809
- }
810
- )
811
- ] }),
812
- brush.paint && /* @__PURE__ */ jsx6(PaintGradientEditor, { value: brush.paint, colors: { paint: state.color, secondary: state.secondaryColor }, onChange: (g) => attempt(() => controller.setBrush({ paint: g })) })
813
- ] }),
814
- engine.load && /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-1", children: [
815
- /* @__PURE__ */ jsx6("span", { className: "text-slate-400", children: "Carries" }),
816
- /* @__PURE__ */ jsx6("span", { "aria-label": "Brush load", title: carried ?? "Clean", className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: carried ?? "transparent" } }),
817
- brush.engine === "mixer" && /* @__PURE__ */ jsx6("button", { type: "button", className: button, onClick: () => controller.loadMixerBrush(), children: "Load" }),
818
- /* @__PURE__ */ jsx6("button", { type: "button", className: button, onClick: () => controller.cleanMixerBrush(brush.engine === "mixer"), children: "Clean" })
819
- ] })
820
- ] }),
821
- /* @__PURE__ */ jsxs5("div", { className: "flex flex-wrap items-center gap-1", children: [
822
- /* @__PURE__ */ jsx6("input", { value: saveName, placeholder: "Brush name", "aria-label": "Brush name", onChange: (e) => setSaveName(e.target.value), className: "w-28 rounded bg-slate-800 px-1.5 py-0.5" }),
823
- /* @__PURE__ */ jsx6("button", { type: "button", className: button, disabled: !saveName.trim(), onClick: () => attempt(() => (controller.saveBrush({ id: slug(saveName), name: saveName.trim() }), setSaveName(""))), children: "Save brush" }),
824
- /* @__PURE__ */ jsx6("button", { type: "button", className: button, onClick: () => attempt(() => downloadBytes2(JSON.stringify(controller.exportBrushes(), null, 2), "brushes.json", "application/json")), children: "Export" }),
825
- /* @__PURE__ */ jsx6("button", { type: "button", className: button, onClick: () => fileRef.current?.click(), children: "Import\u2026" }),
826
- /* @__PURE__ */ jsx6(
761
+ brush: spec,
762
+ profile: PAINT_PROFILE2,
763
+ preview,
764
+ onChange: (next) => attempt(() => controller.setBrushSpec(next)),
765
+ onSaveAs: (name) => controller.saveBrush({ id: slug(name), name }),
766
+ renderExtra: (section) => {
767
+ 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) } }) });
769
+ 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" })
775
+ ] });
776
+ 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" })
781
+ ] }),
782
+ brush.paint && /* @__PURE__ */ jsx8(PaintGradientEditor, { value: brush.paint, colors: { paint: state.color, secondary: state.secondaryColor }, onChange: (g) => attempt(() => controller.setBrush({ paint: g })) })
783
+ ] });
784
+ return null;
785
+ }
786
+ }
787
+ ),
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(
827
792
  "input",
828
793
  {
829
794
  ref: fileRef,
@@ -839,24 +804,24 @@ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, clas
839
804
  }
840
805
  )
841
806
  ] }),
842
- /* @__PURE__ */ jsx6(ErrorLine, { error })
807
+ /* @__PURE__ */ jsx8(ErrorLine, { error })
843
808
  ] });
844
809
  };
845
810
 
846
811
  // src/paint-editor/PaperPanel.tsx
847
- import { useMemo as useMemo5 } from "react";
848
- import { DEFAULT_BACKLIGHT_COLOR, LIGHT_SLIDERS, PAPER_FAMILIES, PAPER_LIBRARY, PAPER_SLIDERS, patchPath as patchPath2, readPath as readPath2, renderPaper } from "@pixerate/editor/paint-editor";
849
- import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
812
+ import { useMemo as useMemo6 } from "react";
813
+ 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";
850
815
  var SWATCH = { x: 0, y: 0, width: 64, height: 40 };
851
816
  var PaperPanel = ({ controller, className }) => {
852
817
  const state = usePaintEditorState(controller);
853
818
  const [error, attempt] = useAttempt();
854
819
  const paper = state.document.paper;
855
- const previews = useMemo5(() => new Map(PAPER_LIBRARY.map((p) => [p.preset, { ...SWATCH, data: renderPaper({ ...p, shading: Math.max(0.8, p.shading) }, SWATCH) }])), []);
856
- return /* @__PURE__ */ jsxs6("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paper-panel", children: [
857
- PAPER_FAMILIES.map((family) => /* @__PURE__ */ jsxs6("div", { children: [
858
- /* @__PURE__ */ jsx7("div", { className: "mb-0.5 text-[10px] uppercase tracking-wide text-slate-500", children: family }),
859
- /* @__PURE__ */ jsx7("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": `${family} papers`, children: PAPER_LIBRARY.filter((p) => p.family === family).map((p) => /* @__PURE__ */ jsx7(
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(
860
825
  "button",
861
826
  {
862
827
  type: "button",
@@ -865,37 +830,37 @@ var PaperPanel = ({ controller, className }) => {
865
830
  title: p.name,
866
831
  className: `rounded p-0.5 ${paper.preset === p.preset ? "ring-2 ring-indigo-500" : "ring-1 ring-slate-700 hover:ring-slate-500"}`,
867
832
  onClick: () => attempt(() => controller.setPaper({ preset: p.preset })),
868
- children: /* @__PURE__ */ jsx7(PixelCanvas, { pixels: previews.get(p.preset) ?? null, label: p.name, style: { width: 48, height: 30 } })
833
+ children: /* @__PURE__ */ jsx9(PixelCanvas, { pixels: previews.get(p.preset) ?? null, label: p.name, style: { width: 48, height: 30 } })
869
834
  },
870
835
  p.preset
871
836
  )) })
872
837
  ] }, family)),
873
- /* @__PURE__ */ jsx7("div", { className: "text-slate-300", children: paper.name }),
874
- /* @__PURE__ */ jsxs6("label", { className: "flex items-center justify-between", children: [
875
- /* @__PURE__ */ jsx7("span", { className: "text-slate-400", children: "Colour" }),
876
- /* @__PURE__ */ jsx7(CommitColorInput, { label: "Paper colour", value: paper.color, onCommit: (v) => attempt(() => controller.setPaper({ color: v })), className: "h-6 w-10 rounded bg-transparent" })
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" })
877
842
  ] }),
878
- PAPER_SLIDERS.map((c) => /* @__PURE__ */ jsx7(PaintSlider, { control: c, value: readPath2(paper, c.path), onCommit: (v) => attempt(() => controller.setPaper(patchPath2(paper, c.path, v))) }, c.path)),
879
- /* @__PURE__ */ jsxs6("label", { className: "flex items-center justify-between", children: [
880
- /* @__PURE__ */ jsx7("span", { className: "text-slate-400", children: "Backlight colour" }),
881
- /* @__PURE__ */ jsx7(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" })
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" })
882
847
  ] }),
883
- /* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-2", children: [
884
- /* @__PURE__ */ jsx7("input", { type: "checkbox", checked: paper.tiling === "mirror", onChange: (e) => attempt(() => controller.setPaper({ tiling: e.target.checked ? "mirror" : "repeat" })) }),
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" })) }),
885
850
  " Mirror tiling"
886
851
  ] }),
887
- /* @__PURE__ */ jsx7("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" }),
888
- /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-1.5", "data-testid": "light-panel", children: [
889
- /* @__PURE__ */ jsx7("span", { className: "font-medium text-slate-300", children: "Light (thick paint, metallic paper)" }),
890
- LIGHT_SLIDERS.map((c) => /* @__PURE__ */ jsx7(PaintSlider, { control: c, value: readPath2(controller.getLighting(), c.path), onChange: (v) => attempt(() => controller.setLighting({ [c.path]: v })) }, c.path)),
891
- /* @__PURE__ */ jsx7("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" })
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" })
892
857
  ] }),
893
- /* @__PURE__ */ jsx7(ErrorLine, { error })
858
+ /* @__PURE__ */ jsx9(ErrorLine, { error })
894
859
  ] });
895
860
  };
896
861
 
897
862
  // src/paint-editor/ColorPanel.tsx
898
- import { useMemo as useMemo6, useRef as useRef5, useState as useState7 } from "react";
863
+ import { useMemo as useMemo7, useRef as useRef5, useState as useState8 } from "react";
899
864
  import {
900
865
  HARMONY_KINDS,
901
866
  MIXING_PAD_HEIGHT,
@@ -912,24 +877,24 @@ import {
912
877
  wheelPoint
913
878
  } from "@pixerate/editor/paint-editor";
914
879
  import { DEFAULT_PAINT_GRADIENT as DEFAULT_PAINT_GRADIENT2, paintSourceCss } from "@pixerate/editor/paint-editor";
915
- import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
880
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
916
881
  var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className }) => {
917
882
  const state = usePaintEditorState(controller);
918
883
  const [error, attempt] = useAttempt();
919
- const [wheel, setWheel] = useState7("ryb");
920
- const [kind, setKind] = useState7("complementary");
921
- const [padTool, setPadTool] = useState7("paint");
922
- const [sample, setSample] = useState7(3);
923
- const [parts, setParts] = useState7([1, 1]);
924
- const [padName, setPadName] = useState7("");
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("");
925
890
  const padPoints = useRef5(null);
926
- const ring = useMemo6(() => renderColorWheel(wheelSize, wheel), [wheelSize, wheel]);
891
+ const ring = useMemo7(() => renderColorWheel(wheelSize, wheel), [wheelSize, wheel]);
927
892
  const color = state.color;
928
- const harmony = useMemo6(() => controller.harmony(kind, { color, wheel }), [controller, kind, color, wheel]);
893
+ const harmony = useMemo7(() => controller.harmony(kind, { color, wheel }), [controller, kind, color, wheel]);
929
894
  const [r, g, b] = parseHexColor(color);
930
895
  const hsv = rgbToHsv(r, g, b);
931
- const effectWell = useMemo6(() => state.effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(64) : null, [controller, state.effectPaint, state.effectPaintRendering]);
932
- const pad = useMemo6(() => ({ width: MIXING_PAD_WIDTH, height: MIXING_PAD_HEIGHT, data: controller.mixingPad.pixels() }), [controller, state.mixingPadVersion]);
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]);
933
898
  const R = wheelSize / 2;
934
899
  const mid = R * 0.82;
935
900
  const setHsv = (s, v) => controller.setColor(rgbToHexColor(...hsvToRgb(hsv.h, s, v)));
@@ -941,9 +906,9 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
941
906
  const y = Math.min(MIXING_PAD_HEIGHT, Math.max(0, (e.clientY - rect.top) * ky));
942
907
  return e.pointerType === "pen" && e.pressure > 0 ? { x, y, pressure: e.pressure } : { x, y };
943
908
  };
944
- return /* @__PURE__ */ jsxs7("div", { className: `${panel} ${className ?? ""}`, "data-testid": "color-panel", children: [
945
- /* @__PURE__ */ jsxs7("div", { className: "relative self-center", style: { width: wheelSize, height: wheelSize }, children: [
946
- /* @__PURE__ */ jsx8(
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(
947
912
  "div",
948
913
  {
949
914
  role: "slider",
@@ -957,20 +922,20 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
957
922
  const rect = e.currentTarget.getBoundingClientRect();
958
923
  controller.setColor(wheelPick(e.clientX - rect.left - R, e.clientY - rect.top - R, wheel, color));
959
924
  },
960
- children: /* @__PURE__ */ jsx8(PixelCanvas, { pixels: ring, label: "Colour wheel", style: { width: wheelSize, height: wheelSize } })
925
+ children: /* @__PURE__ */ jsx10(PixelCanvas, { pixels: ring, label: "Colour wheel", style: { width: wheelSize, height: wheelSize } })
961
926
  }
962
927
  ),
963
- /* @__PURE__ */ jsx8("svg", { className: "pointer-events-none absolute inset-0", width: wheelSize, height: wheelSize, "aria-hidden": "true", children: harmony.map((h, i) => {
928
+ /* @__PURE__ */ jsx10("svg", { className: "pointer-events-none absolute inset-0", width: wheelSize, height: wheelSize, "aria-hidden": "true", children: harmony.map((h, i) => {
964
929
  const p = wheelPoint(h.angle, mid);
965
- return /* @__PURE__ */ jsx8("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);
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);
966
931
  }) }),
967
- /* @__PURE__ */ jsx8("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 } })
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 } })
968
933
  ] }),
969
- /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2", children: [
970
- /* @__PURE__ */ jsx8("input", { type: "color", "aria-label": "Paint colour", value: color, onChange: (e) => controller.setColor(e.target.value), className: "h-7 w-9 rounded bg-transparent" }),
971
- /* @__PURE__ */ jsx8("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" }),
972
- /* @__PURE__ */ jsx8("button", { type: "button", className: button, title: "Swap colours (X)", onClick: () => controller.swapColors(), children: "Swap" }),
973
- /* @__PURE__ */ jsx8(
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(
974
939
  "input",
975
940
  {
976
941
  "aria-label": "Hex colour",
@@ -981,8 +946,8 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
981
946
  color
982
947
  )
983
948
  ] }),
984
- /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2", "data-testid": "paint-source", children: [
985
- /* @__PURE__ */ jsx8(
949
+ /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", "data-testid": "paint-source", children: [
950
+ /* @__PURE__ */ jsx10(
986
951
  "span",
987
952
  {
988
953
  className: "h-5 flex-1 rounded ring-1 ring-slate-700",
@@ -992,7 +957,7 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
992
957
  style: { background: effectWell ? `center / cover no-repeat url("${effectWell}")` : paintSourceCss(state.paint, { paint: color, secondary: state.secondaryColor }) }
993
958
  }
994
959
  ),
995
- /* @__PURE__ */ jsx8(
960
+ /* @__PURE__ */ jsx10(
996
961
  "button",
997
962
  {
998
963
  type: "button",
@@ -1004,26 +969,26 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1004
969
  }
1005
970
  )
1006
971
  ] }),
1007
- state.paint.type === "gradient" && /* @__PURE__ */ jsx8(PaintGradientEditor, { value: state.paint, colors: { paint: color, secondary: state.secondaryColor }, onChange: (g2) => attempt(() => controller.setPaint(g2)) }),
1008
- /* @__PURE__ */ jsxs7("label", { className: "flex items-center gap-2", children: [
1009
- /* @__PURE__ */ jsx8("span", { className: "w-16 text-slate-400", children: "Saturation" }),
1010
- /* @__PURE__ */ jsx8("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" })
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" })
1011
976
  ] }),
1012
- /* @__PURE__ */ jsxs7("label", { className: "flex items-center gap-2", children: [
1013
- /* @__PURE__ */ jsx8("span", { className: "w-16 text-slate-400", children: "Value" }),
1014
- /* @__PURE__ */ jsx8("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" })
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" })
1015
980
  ] }),
1016
- /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-1", children: [
1017
- /* @__PURE__ */ jsx8("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__ */ jsx8("option", { value: k, children: k }, k)) }),
1018
- /* @__PURE__ */ jsx8("button", { type: "button", className: chip(wheel === "ryb"), "aria-pressed": wheel === "ryb", onClick: () => setWheel("ryb"), children: "RYB" }),
1019
- /* @__PURE__ */ jsx8("button", { type: "button", className: chip(wheel === "rgb"), "aria-pressed": wheel === "rgb", onClick: () => setWheel("rgb"), children: "RGB" })
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" })
1020
985
  ] }),
1021
- /* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap gap-1", "aria-label": "Harmony colours", children: [
1022
- harmony.map((h, i) => /* @__PURE__ */ jsx8("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)),
1023
- /* @__PURE__ */ jsx8("button", { type: "button", className: button, onClick: () => harmony.forEach((h) => controller.addSwatch(h.color)), children: "+ swatches" })
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" })
1024
989
  ] }),
1025
- /* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": "Swatches", children: [
1026
- state.swatches.map((s, i) => /* @__PURE__ */ jsx8(
990
+ /* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": "Swatches", children: [
991
+ state.swatches.map((s, i) => /* @__PURE__ */ jsx10(
1027
992
  "button",
1028
993
  {
1029
994
  type: "button",
@@ -1041,15 +1006,15 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1041
1006
  },
1042
1007
  i
1043
1008
  )),
1044
- /* @__PURE__ */ jsx8("button", { type: "button", className: button, "aria-label": "Add swatch", onClick: () => attempt(() => controller.addSwatch(state.paint)), children: "+" })
1009
+ /* @__PURE__ */ jsx10("button", { type: "button", className: button, "aria-label": "Add swatch", onClick: () => attempt(() => controller.addSwatch(state.paint)), children: "+" })
1045
1010
  ] }),
1046
- mixingPad && /* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-1", "data-testid": "mixing-pad", children: [
1047
- /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-1", children: [
1048
- /* @__PURE__ */ jsx8("span", { className: "text-slate-400", children: "Mixing pad" }),
1049
- ["paint", "knife", "pick"].map((t) => /* @__PURE__ */ jsx8("button", { type: "button", "aria-pressed": padTool === t, className: chip(padTool === t), onClick: () => setPadTool(t), children: t === "paint" ? "Paint" : t === "knife" ? "Knife" : "Pick" }, t)),
1050
- /* @__PURE__ */ jsx8("button", { type: "button", className: button, onClick: () => controller.clearMixingPad(), children: "Clear" })
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" })
1051
1016
  ] }),
1052
- /* @__PURE__ */ jsx8(
1017
+ /* @__PURE__ */ jsx10(
1053
1018
  "div",
1054
1019
  {
1055
1020
  role: "application",
@@ -1070,20 +1035,20 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1070
1035
  padPoints.current = null;
1071
1036
  if (pts?.length) attempt(() => controller.mixingPadStroke(pts, { tool: padTool === "knife" ? "knife" : "paint" }));
1072
1037
  },
1073
- children: /* @__PURE__ */ jsx8(PixelCanvas, { pixels: pad, label: "Mixing pad pixels", className: "w-full rounded", style: { aspectRatio: `${MIXING_PAD_WIDTH} / ${MIXING_PAD_HEIGHT}` } })
1038
+ children: /* @__PURE__ */ jsx10(PixelCanvas, { pixels: pad, label: "Mixing pad pixels", className: "w-full rounded", style: { aspectRatio: `${MIXING_PAD_WIDTH} / ${MIXING_PAD_HEIGHT}` } })
1074
1039
  }
1075
1040
  ),
1076
- /* @__PURE__ */ jsx8("div", { className: "flex flex-wrap items-center gap-1", children: /* @__PURE__ */ jsxs7("label", { className: "flex items-center gap-1", children: [
1077
- /* @__PURE__ */ jsx8("span", { className: "text-slate-400", children: "Sample" }),
1078
- /* @__PURE__ */ jsx8("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__ */ jsx8("option", { value: n, children: n === 1 ? "1 px" : `${n}\xD7${n}` }, n)) })
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)) })
1079
1044
  ] }) }),
1080
- /* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap items-center gap-1", children: [
1081
- /* @__PURE__ */ jsx8("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: color } }),
1082
- /* @__PURE__ */ jsx8("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" }),
1083
- /* @__PURE__ */ jsx8("span", { className: "text-slate-500", children: ":" }),
1084
- /* @__PURE__ */ jsx8("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" }),
1085
- /* @__PURE__ */ jsx8("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: state.secondaryColor } }),
1086
- /* @__PURE__ */ jsx8(
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(
1087
1052
  "button",
1088
1053
  {
1089
1054
  type: "button",
@@ -1102,23 +1067,23 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1102
1067
  }
1103
1068
  )
1104
1069
  ] }),
1105
- /* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap items-center gap-1", children: [
1106
- /* @__PURE__ */ jsx8("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" }),
1107
- /* @__PURE__ */ jsx8("button", { type: "button", className: button, onClick: () => attempt(() => (controller.saveMixingPad(padName || void 0), setPadName(""))), children: "Keep pad" })
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" })
1108
1073
  ] }),
1109
- state.savedMixingPads.length > 0 && /* @__PURE__ */ jsx8("ul", { className: "flex flex-col gap-0.5", "aria-label": "Kept pads", children: state.savedMixingPads.map((p) => /* @__PURE__ */ jsxs7("li", { className: "flex items-center gap-1", children: [
1110
- /* @__PURE__ */ jsx8("button", { type: "button", className: `${button} flex-1 text-left`, onClick: () => attempt(() => controller.loadMixingPad(p.id)), children: p.name }),
1111
- /* @__PURE__ */ jsx8("button", { type: "button", className: button, "aria-label": `Remove ${p.name}`, onClick: () => attempt(() => controller.removeMixingPad(p.id)), children: "\xD7" })
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" })
1112
1077
  ] }, p.id)) })
1113
1078
  ] }),
1114
- /* @__PURE__ */ jsx8(ErrorLine, { error })
1079
+ /* @__PURE__ */ jsx10(ErrorLine, { error })
1115
1080
  ] });
1116
1081
  };
1117
1082
 
1118
1083
  // src/paint-editor/PaintLayersPanel.tsx
1119
- import { useState as useState8 } from "react";
1120
- import { BLEND_MENU_GROUPS as BLEND_MENU_GROUPS2 } from "@pixerate/editor/paint-editor";
1121
- import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1084
+ import { useState as useState9 } from "react";
1085
+ import { BLEND_MENU_GROUPS } from "@pixerate/editor/paint-editor";
1086
+ import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
1122
1087
  function siblingIndex(layers, l) {
1123
1088
  const sibs = layers.filter((x) => x.parentId === l.parentId).reverse();
1124
1089
  return { index: sibs.findIndex((x) => x.id === l.id), count: sibs.length };
@@ -1126,7 +1091,7 @@ function siblingIndex(layers, l) {
1126
1091
  var PaintLayersPanel = ({ controller, className }) => {
1127
1092
  usePaintEditorState(controller);
1128
1093
  const [error, attempt] = useAttempt();
1129
- const [renaming, setRenaming] = useState8(null);
1094
+ const [renaming, setRenaming] = useState9(null);
1130
1095
  const layers = controller.listLayers();
1131
1096
  const active = layers.find((l) => l.active) ?? null;
1132
1097
  const light = active?.type === "pixel" ? controller.lightOf(active.id) : null;
@@ -1136,18 +1101,18 @@ var PaintLayersPanel = ({ controller, className }) => {
1136
1101
  const to = Math.min(count - 1, Math.max(0, index + delta));
1137
1102
  if (to !== index) attempt(() => controller.moveLayer(active.id, to));
1138
1103
  };
1139
- return /* @__PURE__ */ jsxs8("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-layers-panel", children: [
1140
- /* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap gap-1", children: [
1141
- /* @__PURE__ */ jsx9("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer()), children: "New layer" }),
1142
- /* @__PURE__ */ jsx9("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer({ type: "group" })), children: "New group" }),
1143
- /* @__PURE__ */ jsx9("button", { type: "button", className: button, title: "A layer whose strokes stay editable", onClick: () => attempt(() => controller.addLayer({ type: "strokes" })), children: "New stroke layer" }),
1144
- /* @__PURE__ */ jsx9("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.duplicateLayer(active.id)), children: "Duplicate" }),
1145
- /* @__PURE__ */ jsx9("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer up", onClick: () => move(1), children: "\u2191" }),
1146
- /* @__PURE__ */ jsx9("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer down", onClick: () => move(-1), children: "\u2193" }),
1147
- /* @__PURE__ */ jsx9("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.mergeDown(active.id)), children: "Merge down" }),
1148
- /* @__PURE__ */ jsx9("button", { type: "button", className: button, disabled: !active || layers.length < 2, onClick: () => active && attempt(() => controller.removeLayer(active.id)), children: "Delete" })
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" })
1149
1114
  ] }),
1150
- /* @__PURE__ */ jsx9("ul", { role: "tree", "aria-label": "Layers", className: "flex flex-col gap-0.5", children: layers.map((l) => /* @__PURE__ */ jsxs8(
1115
+ /* @__PURE__ */ jsx11("ul", { role: "tree", "aria-label": "Layers", className: "flex flex-col gap-0.5", children: layers.map((l) => /* @__PURE__ */ jsxs10(
1151
1116
  "li",
1152
1117
  {
1153
1118
  role: "treeitem",
@@ -1156,7 +1121,7 @@ var PaintLayersPanel = ({ controller, className }) => {
1156
1121
  style: { paddingLeft: 6 + l.depth * 12 },
1157
1122
  onClick: () => controller.setActiveLayer(l.id),
1158
1123
  children: [
1159
- /* @__PURE__ */ jsx9(
1124
+ /* @__PURE__ */ jsx11(
1160
1125
  "button",
1161
1126
  {
1162
1127
  type: "button",
@@ -1169,7 +1134,7 @@ var PaintLayersPanel = ({ controller, className }) => {
1169
1134
  children: l.visible ? "\u25CF" : "\u25CB"
1170
1135
  }
1171
1136
  ),
1172
- renaming === l.id ? /* @__PURE__ */ jsx9(
1137
+ renaming === l.id ? /* @__PURE__ */ jsx11(
1173
1138
  "input",
1174
1139
  {
1175
1140
  autoFocus: true,
@@ -1186,23 +1151,23 @@ var PaintLayersPanel = ({ controller, className }) => {
1186
1151
  if (e.key === "Escape") setRenaming(null);
1187
1152
  }
1188
1153
  }
1189
- ) : /* @__PURE__ */ jsxs8("span", { className: "flex-1 truncate", onDoubleClick: () => setRenaming(l.id), children: [
1154
+ ) : /* @__PURE__ */ jsxs10("span", { className: "flex-1 truncate", onDoubleClick: () => setRenaming(l.id), children: [
1190
1155
  l.type === "group" ? "\u25B8 " : "",
1191
- l.liveStrokes !== void 0 && /* @__PURE__ */ jsxs8("span", { "aria-label": "Stroke layer", title: `Stroke layer: ${l.liveStrokes} editable strokes`, children: [
1156
+ l.liveStrokes !== void 0 && /* @__PURE__ */ jsxs10("span", { "aria-label": "Stroke layer", title: `Stroke layer: ${l.liveStrokes} editable strokes`, children: [
1192
1157
  "\u270E",
1193
1158
  " "
1194
1159
  ] }),
1195
1160
  l.name
1196
1161
  ] }),
1197
- l.locks.pixels || l.locks.all ? /* @__PURE__ */ jsx9("span", { title: "Locked", children: "\u{1F512}" }) : null
1162
+ l.locks.pixels || l.locks.all ? /* @__PURE__ */ jsx11("span", { title: "Locked", children: "\u{1F512}" }) : null
1198
1163
  ]
1199
1164
  },
1200
1165
  l.id
1201
1166
  )) }),
1202
- active && /* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-1.5", children: [
1203
- /* @__PURE__ */ jsxs8("label", { className: "flex items-center gap-2", children: [
1204
- /* @__PURE__ */ jsx9("span", { className: "w-14 text-slate-400", children: "Opacity" }),
1205
- /* @__PURE__ */ jsx9(
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(
1206
1171
  "input",
1207
1172
  {
1208
1173
  type: "range",
@@ -1216,40 +1181,40 @@ var PaintLayersPanel = ({ controller, className }) => {
1216
1181
  }
1217
1182
  )
1218
1183
  ] }),
1219
- /* @__PURE__ */ jsxs8("label", { className: "flex items-center gap-2", children: [
1220
- /* @__PURE__ */ jsx9("span", { className: "w-14 text-slate-400", children: "Blend" }),
1221
- /* @__PURE__ */ jsxs8("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: [
1222
- active.type === "group" && /* @__PURE__ */ jsx9("option", { value: "pass-through", children: "Pass through" }),
1223
- BLEND_MENU_GROUPS2.map((g) => /* @__PURE__ */ jsx9("optgroup", { label: g.label, children: g.modes.map((m) => /* @__PURE__ */ jsx9("option", { value: m.id, title: m.description, children: m.label }, m.id)) }, g.label))
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))
1224
1189
  ] })
1225
1190
  ] }),
1226
- /* @__PURE__ */ jsxs8("div", { className: "flex gap-1", children: [
1227
- ["pixels", "transparency"].map((k) => /* @__PURE__ */ jsx9("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)),
1228
- /* @__PURE__ */ jsx9("button", { type: "button", "aria-pressed": active.clipped, className: chip(active.clipped), onClick: () => attempt(() => controller.updateLayer(active.id, { clipped: !active.clipped })), children: "Clip" })
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" })
1229
1194
  ] }),
1230
- light?.hasLight && /* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-1.5 border-t border-slate-800 pt-1.5", "data-testid": "layer-light", children: [
1231
- /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between", children: [
1232
- /* @__PURE__ */ jsx9("span", { className: "font-medium text-slate-300", title: "This layer's paint gives off light", children: "Light" }),
1233
- /* @__PURE__ */ jsx9("button", { type: "button", className: button, onClick: () => attempt(() => controller.clearLight(active.id)), children: "Clear light" })
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" })
1234
1199
  ] }),
1235
- /* @__PURE__ */ jsxs8("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: [
1236
- /* @__PURE__ */ jsx9("span", { className: "w-14 text-slate-400", children: "Spill" }),
1237
- /* @__PURE__ */ jsx9("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" })
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" })
1238
1203
  ] }),
1239
- /* @__PURE__ */ jsxs8("label", { className: "flex items-center gap-2", children: [
1240
- /* @__PURE__ */ jsx9("span", { className: "w-14 text-slate-400", children: "Strength" }),
1241
- /* @__PURE__ */ jsx9("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" })
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" })
1242
1207
  ] })
1243
1208
  ] }),
1244
- /* @__PURE__ */ jsx9("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__ */ jsx9(LayerEffectsPanel, { controller, layerId: active.id }) })
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 }) })
1245
1210
  ] }),
1246
- /* @__PURE__ */ jsx9(ErrorLine, { error })
1211
+ /* @__PURE__ */ jsx11(ErrorLine, { error })
1247
1212
  ] });
1248
1213
  };
1249
1214
 
1250
1215
  // src/paint-editor/WetPanel.tsx
1251
- import { WET_FLOW_KINDS, WET_GPU_OPTIONS, WET_PARAM_SLIDERS, WET_SPEED_SLIDER, WET_TILT_SLIDERS, readPath as readPath3, wetEngineSummary } from "@pixerate/editor/paint-editor";
1252
- import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
1216
+ 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";
1253
1218
  var FLOW_LABELS = { none: "None", linear: "One way", swirl: "Swirl", radial: "Outwards", turbulent: "Eddies" };
1254
1219
  var WetPanel = ({ controller, className }) => {
1255
1220
  const state = usePaintEditorState(controller);
@@ -1258,31 +1223,31 @@ var WetPanel = ({ controller, className }) => {
1258
1223
  const layerId = state.document.activeLayerId;
1259
1224
  const info = layerId ? controller.wetLayerInfo(layerId) : null;
1260
1225
  const backend = controller.wetState();
1261
- return /* @__PURE__ */ jsxs9("div", { className: `${panel} ${className ?? ""}`, "data-testid": "wet-panel", children: [
1262
- /* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-between", children: [
1263
- /* @__PURE__ */ jsx10("span", { className: wet.wet ? "text-sky-300" : "text-slate-400", "data-testid": "wet-status", children: wet.wet ? wet.paused ? "Wet (paused)" : "Wet" : "Dry" }),
1264
- /* @__PURE__ */ jsxs9("span", { className: "text-[10px] text-slate-500", children: [
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: [
1265
1230
  "step ",
1266
1231
  wet.clock
1267
1232
  ] })
1268
1233
  ] }),
1269
- /* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap gap-1", children: [
1270
- /* @__PURE__ */ jsx10("button", { type: "button", className: button, disabled: !wet.layerIds.length, onClick: () => attempt(async () => (await controller.wetIdle(), controller.dryPaint())), children: "Dry now" }),
1271
- /* @__PURE__ */ jsx10("button", { type: "button", className: chip(wet.paused), "aria-pressed": wet.paused, onClick: () => controller.setWetPaused(!wet.paused), children: wet.paused ? "Resume" : "Pause" }),
1272
- /* @__PURE__ */ jsx10("button", { type: "button", className: chip(wet.overlay), "aria-pressed": wet.overlay, onClick: () => controller.setWaterOverlay(!wet.overlay), children: "Water" }),
1273
- /* @__PURE__ */ jsx10("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" }),
1274
- /* @__PURE__ */ jsx10("button", { type: "button", className: button, disabled: !layerId, onClick: () => attempt(async () => (await controller.wetIdle(), controller.wetPaper({}))), children: "Wet paper" })
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" })
1275
1240
  ] }),
1276
- /* @__PURE__ */ jsx10(PaintSlider, { control: WET_SPEED_SLIDER, value: wet.speed, onChange: (v) => controller.setWetSpeed(v) }),
1277
- WET_TILT_SLIDERS.map((c) => /* @__PURE__ */ jsx10(PaintSlider, { control: c, value: readPath3(wet.tilt, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setCanvasTilt({ [c.path]: v }))) }, c.path)),
1278
- info && /* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-layer", children: [
1279
- /* @__PURE__ */ jsx10("span", { className: "font-medium text-slate-300", children: "This layer" }),
1280
- WET_PARAM_SLIDERS.map((c) => /* @__PURE__ */ jsx10(PaintSlider, { control: c, value: readPath3(info.params, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setWetParams(layerId, { [c.path]: v }))) }, c.path)),
1281
- /* @__PURE__ */ jsxs9("label", { className: "flex items-center justify-between gap-2", children: [
1282
- /* @__PURE__ */ jsx10("span", { className: "text-slate-400", children: "Flow map" }),
1283
- /* @__PURE__ */ jsx10("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__ */ jsx10("option", { value: k, children: FLOW_LABELS[k] }, k)) })
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)) })
1284
1249
  ] }),
1285
- info.flow.kind !== "none" && /* @__PURE__ */ jsx10(
1250
+ info.flow.kind !== "none" && /* @__PURE__ */ jsx12(
1286
1251
  PaintSlider,
1287
1252
  {
1288
1253
  control: { path: "strength", label: "Flow strength", min: 0, max: 1, step: 0.01 },
@@ -1291,20 +1256,20 @@ var WetPanel = ({ controller, className }) => {
1291
1256
  }
1292
1257
  )
1293
1258
  ] }),
1294
- backend.message && /* @__PURE__ */ jsx10("p", { className: "text-[10px] text-amber-300", "data-testid": "wet-message", children: backend.message }),
1295
- backend.backend && /* @__PURE__ */ jsx10("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" }),
1296
- /* @__PURE__ */ jsxs9("label", { className: "flex items-center justify-between gap-2", children: [
1297
- /* @__PURE__ */ jsx10("span", { className: "text-slate-400", children: "Engine" }),
1298
- /* @__PURE__ */ jsx10("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__ */ jsx10("option", { value: o.value, children: o.label }, o.value)) })
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)) })
1299
1264
  ] }),
1300
- /* @__PURE__ */ jsx10("p", { className: `text-[10px] ${backend.engine.state === "active" ? "text-emerald-300" : "text-slate-500"}`, "data-testid": "wet-engine", children: wetEngineSummary(backend.engine) }),
1301
- /* @__PURE__ */ jsx10(ErrorLine, { error })
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 })
1302
1267
  ] });
1303
1268
  };
1304
1269
 
1305
1270
  // src/paint-editor/StickerPanel.tsx
1306
- import { STICKER_SLIDERS, readPath as readPath4, stickerRefLabel } from "@pixerate/editor/paint-editor";
1307
- import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
1271
+ import { STICKER_SLIDERS, readPath as readPath3, stickerRefLabel } from "@pixerate/editor/paint-editor";
1272
+ import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
1308
1273
  var StickerPanel = ({ controller, className }) => {
1309
1274
  const state = usePaintEditorState(controller);
1310
1275
  const [error, attempt] = useAttempt();
@@ -1314,16 +1279,16 @@ var StickerPanel = ({ controller, className }) => {
1314
1279
  const stickers = layerId ? state.document.stickers?.[layerId] ?? [] : [];
1315
1280
  if (!stickers.length) return null;
1316
1281
  const sel = stickers.find((s) => s.id === picked) ?? null;
1317
- return /* @__PURE__ */ jsxs10("div", { className: `${panel} ${className ?? ""}`, "data-testid": "sticker-panel", children: [
1318
- /* @__PURE__ */ jsxs10("span", { className: "font-medium text-slate-300", children: [
1282
+ return /* @__PURE__ */ jsxs12("div", { className: `${panel} ${className ?? ""}`, "data-testid": "sticker-panel", children: [
1283
+ /* @__PURE__ */ jsxs12("span", { className: "font-medium text-slate-300", children: [
1319
1284
  "Stickers (",
1320
1285
  stickers.length,
1321
1286
  ")"
1322
1287
  ] }),
1323
- /* @__PURE__ */ jsx11("div", { className: "flex max-h-24 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Stickers", children: stickers.map((s) => /* @__PURE__ */ jsx11("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)) }),
1324
- sel && /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-1.5", "data-testid": "sticker-edit", children: [
1325
- /* @__PURE__ */ jsx11("span", { className: "text-slate-400", children: "Sticker" }),
1326
- /* @__PURE__ */ jsx11(
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(
1327
1292
  StickerPicker,
1328
1293
  {
1329
1294
  controller,
@@ -1337,9 +1302,9 @@ var StickerPanel = ({ controller, className }) => {
1337
1302
  )
1338
1303
  }
1339
1304
  ),
1340
- /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between gap-2", children: [
1341
- /* @__PURE__ */ jsx11("span", { className: "text-slate-400", children: "Position" }),
1342
- /* @__PURE__ */ jsx11("span", { className: "flex gap-1", children: ["x", "y"].map((k) => /* @__PURE__ */ jsx11(
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(
1343
1308
  "input",
1344
1309
  {
1345
1310
  type: "number",
@@ -1353,24 +1318,24 @@ var StickerPanel = ({ controller, className }) => {
1353
1318
  `${sel.id}-${k}-${sel[k]}`
1354
1319
  )) })
1355
1320
  ] }),
1356
- STICKER_SLIDERS.map((c) => /* @__PURE__ */ jsx11(PaintSlider, { control: c, value: readPath4(sel, c.path), onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { [c.path]: v })) }, c.path)),
1357
- /* @__PURE__ */ jsxs10("label", { className: "flex items-center justify-between", children: [
1358
- /* @__PURE__ */ jsx11("span", { className: "text-slate-400", children: "Colour" }),
1359
- /* @__PURE__ */ jsx11(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" })
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" })
1360
1325
  ] }),
1361
- /* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap gap-1", children: [
1362
- /* @__PURE__ */ jsx11("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "front")), children: "To front" }),
1363
- /* @__PURE__ */ jsx11("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "back")), children: "To back" }),
1364
- /* @__PURE__ */ jsx11("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStickers(layerId, [sel.id]), setPicked(null))), children: "Delete" })
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" })
1365
1330
  ] })
1366
1331
  ] }),
1367
- /* @__PURE__ */ jsx11(ErrorLine, { error })
1332
+ /* @__PURE__ */ jsx13(ErrorLine, { error })
1368
1333
  ] });
1369
1334
  };
1370
1335
 
1371
1336
  // src/paint-editor/StrokePanel.tsx
1372
- import { STROKE_SLIDERS, liveStrokeRefusal, readPath as readPath5 } from "@pixerate/editor/paint-editor";
1373
- import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
1337
+ import { STROKE_SLIDERS, liveStrokeRefusal, readPath as readPath4 } from "@pixerate/editor/paint-editor";
1338
+ import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
1374
1339
  var StrokePanel = ({ controller, className }) => {
1375
1340
  const state = usePaintEditorState(controller);
1376
1341
  const [error, attempt] = useAttempt();
@@ -1380,16 +1345,16 @@ var StrokePanel = ({ controller, className }) => {
1380
1345
  const index = strokes.findIndex((s) => s.id === state.selectedStroke);
1381
1346
  const sel = index >= 0 ? strokes[index] : null;
1382
1347
  const brushes = state.brushes.filter((b) => !liveStrokeRefusal(b));
1383
- return /* @__PURE__ */ jsxs11("div", { className: `${panel} ${className ?? ""}`, "data-testid": "stroke-panel", children: [
1384
- /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between", children: [
1385
- /* @__PURE__ */ jsxs11("span", { className: "font-medium text-slate-300", children: [
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: [
1386
1351
  "Strokes (",
1387
1352
  strokes.length,
1388
1353
  ")"
1389
1354
  ] }),
1390
- /* @__PURE__ */ jsx12("button", { type: "button", className: button, onClick: () => attempt(() => controller.rasterizeLiveStrokes(layerId)), children: "Rasterize" })
1355
+ /* @__PURE__ */ jsx14("button", { type: "button", className: button, onClick: () => attempt(() => controller.rasterizeLiveStrokes(layerId)), children: "Rasterize" })
1391
1356
  ] }),
1392
- /* @__PURE__ */ jsx12("div", { className: "flex max-h-24 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Strokes", children: strokes.map((s, i) => /* @__PURE__ */ jsx12(
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(
1393
1358
  "button",
1394
1359
  {
1395
1360
  type: "button",
@@ -1402,10 +1367,10 @@ var StrokePanel = ({ controller, className }) => {
1402
1367
  },
1403
1368
  s.id
1404
1369
  )) }),
1405
- sel && /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-1.5", "data-testid": "stroke-edit", children: [
1406
- /* @__PURE__ */ jsxs11("label", { className: "flex items-center justify-between gap-2", children: [
1407
- /* @__PURE__ */ jsx12("span", { className: "text-slate-400", children: "Brush" }),
1408
- /* @__PURE__ */ jsxs11(
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(
1409
1374
  "select",
1410
1375
  {
1411
1376
  "aria-label": "Stroke brush",
@@ -1413,38 +1378,38 @@ var StrokePanel = ({ controller, className }) => {
1413
1378
  onChange: (e) => e.target.value && attempt(() => controller.updateStroke(sel.id, { brushId: e.target.value })),
1414
1379
  className: "max-w-[10rem] rounded bg-slate-800 px-1 py-0.5",
1415
1380
  children: [
1416
- !brushes.some((b) => b.id === sel.brush.id) && /* @__PURE__ */ jsx12("option", { value: "", children: sel.brush.name }),
1417
- brushes.map((b) => /* @__PURE__ */ jsx12("option", { value: b.id, children: b.name }, b.id))
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))
1418
1383
  ]
1419
1384
  }
1420
1385
  )
1421
1386
  ] }),
1422
- STROKE_SLIDERS.map((c) => /* @__PURE__ */ jsx12(PaintSlider, { control: c, value: readPath5(sel.brush, c.path), onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { brush: { tip: { [c.path.split(".")[1]]: v } } })) }, c.path)),
1423
- /* @__PURE__ */ jsxs11("label", { className: "flex items-center justify-between", children: [
1424
- /* @__PURE__ */ jsx12("span", { className: "text-slate-400", children: "Colour" }),
1425
- /* @__PURE__ */ jsx12(CommitColorInput, { label: "Stroke colour", value: sel.color, onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { color: v })), className: "h-6 w-10 rounded bg-transparent" })
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" })
1426
1391
  ] }),
1427
- /* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap gap-1", children: [
1428
- /* @__PURE__ */ jsx12("button", { type: "button", className: button, onClick: () => attempt(() => controller.updateStroke(sel.id, { seed: (sel.seed + 1) % 2147483647 })), children: "New seed" }),
1429
- /* @__PURE__ */ jsx12("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" }),
1430
- /* @__PURE__ */ jsx12("button", { type: "button", className: button, disabled: index === 0, "aria-label": "Move stroke down", onClick: () => attempt(() => controller.reorderStroke(sel.id, index - 1)), children: "\u2193" }),
1431
- /* @__PURE__ */ jsx12("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStrokes([sel.id]), controller.selectStroke(null))), children: "Delete" })
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" })
1432
1397
  ] })
1433
1398
  ] }),
1434
- /* @__PURE__ */ jsx12(ErrorLine, { error })
1399
+ /* @__PURE__ */ jsx14(ErrorLine, { error })
1435
1400
  ] });
1436
1401
  };
1437
1402
 
1438
1403
  // src/paint-editor/PaintEditor.tsx
1439
- import { useRef as useRef7, useState as useState10 } from "react";
1404
+ import { useRef as useRef7, useState as useState11 } from "react";
1440
1405
  import { PaintPresence as PaintPresence2, documentToScreen as documentToScreen2, screenToDocument } from "@pixerate/editor/paint-editor";
1441
1406
 
1442
1407
  // src/paint-editor/PaintEffectsPanel.tsx
1443
- import { useEffect as useEffect5, useMemo as useMemo7, useRef as useRef6, useState as useState9 } from "react";
1408
+ import { useEffect as useEffect5, useMemo as useMemo8, useRef as useRef6, useState as useState10 } from "react";
1444
1409
  import { createPaintEffectsToolProvider, PAPER_EFFECT_BLENDS } from "@pixerate/editor/paint-editor";
1445
- import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
1410
+ import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
1446
1411
  function usePaintEffectsProvider(controller) {
1447
- const [provider, setProvider] = useState9(controller.effectsProvider);
1412
+ const [provider, setProvider] = useState10(controller.effectsProvider);
1448
1413
  useEffect5(() => {
1449
1414
  setProvider(controller.effectsProvider);
1450
1415
  return controller.effects.subscribe(setProvider);
@@ -1461,19 +1426,19 @@ function usePaintEffectsTools(registry, controller, options = {}) {
1461
1426
  function Controls({ provider, effect, name, values, apply }) {
1462
1427
  const { description, error } = useEffectDescription(provider, effect);
1463
1428
  const drags = useRef6(/* @__PURE__ */ new Set());
1464
- if (!provider) return /* @__PURE__ */ jsxs12("p", { className: "text-[11px] text-slate-400", children: [
1429
+ if (!provider) return /* @__PURE__ */ jsxs14("p", { className: "text-[11px] text-slate-400", children: [
1465
1430
  'No effects provider: "',
1466
1431
  name ?? effect,
1467
1432
  '" is kept as it was drawn.'
1468
1433
  ] });
1469
- if (error) return /* @__PURE__ */ jsx13("p", { className: "text-[11px] text-amber-400", children: error });
1470
- if (!description) return /* @__PURE__ */ jsx13("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
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" });
1471
1436
  const commit = (gesture) => {
1472
1437
  if (!gesture || drags.current.has(gesture)) return !gesture;
1473
1438
  drags.current.add(gesture);
1474
1439
  return true;
1475
1440
  };
1476
- return /* @__PURE__ */ jsx13(
1441
+ return /* @__PURE__ */ jsx15(
1477
1442
  EffectParameters,
1478
1443
  {
1479
1444
  description,
@@ -1495,8 +1460,8 @@ var PaintEffectsPanel = ({ controller, className }) => {
1495
1460
  const state = usePaintEditorState(controller);
1496
1461
  const provider = usePaintEffectsProvider(controller);
1497
1462
  const [error, attempt] = useAttempt();
1498
- const [browse, setBrowse] = useState9(null);
1499
- const [busy, setBusy] = useState9(false);
1463
+ const [browse, setBrowse] = useState10(null);
1464
+ const [busy, setBusy] = useState10(false);
1500
1465
  const paper = controller.getPaperEffect();
1501
1466
  const activeId = state.document.activeLayerId;
1502
1467
  const layerEffect = activeId ? controller.getEffectLayer(activeId) : void 0;
@@ -1508,7 +1473,7 @@ var PaintEffectsPanel = ({ controller, className }) => {
1508
1473
  if (!effectPaint) return;
1509
1474
  run(() => controller.setEffectPaint({ effect: effectPaint.effect, values: effectPaint.values, time: effectPaint.time, map: effectPaint.map, live: effectPaint.live, ...patch }));
1510
1475
  };
1511
- const thumbnail = useMemo7(() => effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(48) : null, [controller, effectPaint, state.effectPaintRendering]);
1476
+ const thumbnail = useMemo8(() => effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(48) : null, [controller, effectPaint, state.effectPaintRendering]);
1512
1477
  const run = (work) => attempt(() => {
1513
1478
  setBusy(true);
1514
1479
  return work().finally(() => setBusy(false));
@@ -1524,28 +1489,28 @@ var PaintEffectsPanel = ({ controller, className }) => {
1524
1489
  };
1525
1490
  const toggle = (b) => setBrowse(browse === b ? null : b);
1526
1491
  const pixel = active?.type === "pixel";
1527
- return /* @__PURE__ */ jsxs12("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
1528
- /* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap items-center gap-1", children: [
1529
- /* @__PURE__ */ jsx13("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
1530
- /* @__PURE__ */ jsx13("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
1531
- /* @__PURE__ */ jsx13("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
1532
- /* @__PURE__ */ jsx13("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
1533
- /* @__PURE__ */ jsx13("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" }),
1534
- /* @__PURE__ */ jsx13("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" })
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" })
1535
1500
  ] }),
1536
- !provider && /* @__PURE__ */ jsx13("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
1537
- browse && /* @__PURE__ */ jsx13(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
1538
- paper && /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
1539
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1", children: [
1540
- /* @__PURE__ */ jsxs12("span", { className: "flex-1 truncate", children: [
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: [
1541
1506
  "Paper: ",
1542
1507
  paper.name ?? paper.effect
1543
1508
  ] }),
1544
- /* @__PURE__ */ jsx13("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
1509
+ /* @__PURE__ */ jsx15("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
1545
1510
  ] }),
1546
- /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", children: [
1547
- /* @__PURE__ */ jsx13("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
1548
- /* @__PURE__ */ jsx13(
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(
1549
1514
  "input",
1550
1515
  {
1551
1516
  type: "range",
@@ -1567,39 +1532,39 @@ var PaintEffectsPanel = ({ controller, className }) => {
1567
1532
  `o${paper.opacity}`
1568
1533
  )
1569
1534
  ] }),
1570
- /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", children: [
1571
- /* @__PURE__ */ jsx13("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
1572
- /* @__PURE__ */ jsx13("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) => {
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) => {
1573
1538
  const blend = e.currentTarget.value;
1574
1539
  run(() => controller.updatePaperEffect({ blend }));
1575
- }, children: PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ jsx13("option", { value: b, children: b }, b)) })
1540
+ }, children: PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ jsx15("option", { value: b, children: b }, b)) })
1576
1541
  ] }),
1577
- /* @__PURE__ */ jsx13(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
1542
+ /* @__PURE__ */ jsx15(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
1578
1543
  ] }),
1579
- effectPaint && /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paint", children: [
1580
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1", children: [
1581
- thumbnail ? /* @__PURE__ */ jsx13("img", { src: thumbnail, alt: "", className: "h-5 w-8 rounded object-cover ring-1 ring-slate-700", "data-testid": "effect-paint-thumbnail" }) : null,
1582
- /* @__PURE__ */ jsxs12("span", { className: "flex-1 truncate", children: [
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: [
1583
1548
  "Paint: ",
1584
1549
  effectPaint.effect,
1585
1550
  state.effectPaintRendering ? " (rendering\u2026)" : ""
1586
1551
  ] }),
1587
- /* @__PURE__ */ jsx13("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
1552
+ /* @__PURE__ */ jsx15("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
1588
1553
  ] }),
1589
- /* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
1590
- /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", title: "Lay the effect along each stroke instead of fixing it to the canvas", children: [
1591
- /* @__PURE__ */ jsx13("input", { type: "checkbox", checked: Boolean(effectPaint.map), onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
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" } }) }),
1592
1557
  "Along the stroke"
1593
1558
  ] }),
1594
- /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
1595
- /* @__PURE__ */ jsx13("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
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 }) }),
1596
1561
  "Live"
1597
1562
  ] })
1598
1563
  ] }),
1599
- effectPaint.map && /* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap items-center gap-2", children: [
1600
- /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", children: [
1601
- /* @__PURE__ */ jsx13("span", { className: "text-slate-400", children: "Length" }),
1602
- /* @__PURE__ */ jsx13(
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(
1603
1568
  "input",
1604
1569
  {
1605
1570
  type: "number",
@@ -1613,55 +1578,55 @@ var PaintEffectsPanel = ({ controller, className }) => {
1613
1578
  effectPaint.map.length
1614
1579
  )
1615
1580
  ] }),
1616
- /* @__PURE__ */ jsxs12("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: [
1617
- /* @__PURE__ */ jsx13("option", { value: "repeat", children: "Repeat" }),
1618
- /* @__PURE__ */ jsx13("option", { value: "mirror", children: "Mirror" }),
1619
- /* @__PURE__ */ jsx13("option", { value: "clamp", children: "Clamp" })
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" })
1620
1585
  ] })
1621
1586
  ] }),
1622
- /* @__PURE__ */ jsx13(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
1587
+ /* @__PURE__ */ jsx15(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
1623
1588
  ] }),
1624
- animation && /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2 rounded border border-slate-700 p-1", "data-effect-part": "playback", children: [
1625
- /* @__PURE__ */ jsxs12("span", { className: "flex-1 truncate", children: [
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: [
1626
1591
  "Live paint: ",
1627
1592
  animation.strokes,
1628
1593
  " ",
1629
1594
  animation.strokes === 1 ? "stroke" : "strokes"
1630
1595
  ] }),
1631
- /* @__PURE__ */ jsx13("button", { type: "button", className: button, "aria-pressed": playback.playing, onClick: () => attempt(() => controller.setEffectPlayback({ playing: !playback.playing })), children: playback.playing ? "Pause" : "Play" }),
1632
- /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", children: [
1633
- /* @__PURE__ */ jsx13("span", { className: "text-slate-400", children: "fps" }),
1634
- /* @__PURE__ */ jsx13("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" })
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" })
1635
1600
  ] })
1636
1601
  ] }),
1637
- layerEffect && activeId && /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "layer", children: [
1638
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1", children: [
1639
- /* @__PURE__ */ jsxs12("span", { className: "flex-1 truncate", children: [
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: [
1640
1605
  "Layer: ",
1641
1606
  layerEffect.name ?? layerEffect.effect
1642
1607
  ] }),
1643
- /* @__PURE__ */ jsx13("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
1608
+ /* @__PURE__ */ jsx15("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
1644
1609
  ] }),
1645
- /* @__PURE__ */ jsx13(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
1610
+ /* @__PURE__ */ jsx15(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
1646
1611
  ] }),
1647
- /* @__PURE__ */ jsx13(ErrorLine, { error })
1612
+ /* @__PURE__ */ jsx15(ErrorLine, { error })
1648
1613
  ] });
1649
1614
  };
1650
1615
 
1651
1616
  // src/paint-editor/PaintEditor.tsx
1652
- import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
1617
+ import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
1653
1618
  var PAINT_CONTROLS = {
1654
1619
  "mixing-pad": '[data-testid="mixing-pad"]',
1655
1620
  lighting: '[data-testid="light-panel"]',
1656
1621
  symmetry: '[aria-label="Symmetry"]'
1657
1622
  };
1658
1623
  var PaintEditor = ({ controller, fileName, height = 720, presence, className, playback, playbackId = "paint", onPlaybackReveal }) => {
1659
- const [tool, setTool] = useState10("brush");
1660
- const [tab, setTab] = useState10("color");
1624
+ const [tool, setTool] = useState11("brush");
1625
+ const [tab, setTab] = useState11("color");
1661
1626
  const tabRef = useRef7(tab);
1662
1627
  tabRef.current = tab;
1663
1628
  const rootRef = useRef7(null);
1664
- const [ownPresence] = useState10(() => new PaintPresence2());
1629
+ const [ownPresence] = useState11(() => new PaintPresence2());
1665
1630
  const ambientPlayback = useAgentPlayback();
1666
1631
  const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
1667
1632
  const viewBox = () => {
@@ -1717,34 +1682,36 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, className, pl
1717
1682
  const box = rootRef.current?.getBoundingClientRect();
1718
1683
  return c && box ? { x: c.x - box.left, y: c.y - box.top } : p;
1719
1684
  };
1720
- const [error, setError] = useState10(null);
1685
+ const [error, setError] = useState11(null);
1721
1686
  const effects = usePaintEffectsProvider(controller);
1722
1687
  const tabs = effects ? ["color", "wet", "paper", "layers", "effects"] : ["color", "wet", "paper", "layers"];
1723
- return /* @__PURE__ */ jsxs13("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: [
1724
- playing && /* @__PURE__ */ jsx14(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
1725
- /* @__PURE__ */ jsx14(PaintToolbar, { controller, tool, onToolChange: setTool, fileName }),
1726
- /* @__PURE__ */ jsxs13("div", { className: "flex min-h-0 flex-1 gap-2", children: [
1727
- /* @__PURE__ */ jsx14(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
1728
- /* @__PURE__ */ jsxs13("div", { className: "flex min-w-0 flex-1 flex-col", children: [
1729
- /* @__PURE__ */ jsx14(PaintCanvas, { controller, tool, onError: setError, presence: playing ? void 0 : presence, className: "flex-1 rounded-lg" }),
1730
- error && /* @__PURE__ */ jsx14("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
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 })
1731
1696
  ] }),
1732
- /* @__PURE__ */ jsxs13("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
1733
- /* @__PURE__ */ jsx14("div", { className: "flex gap-1", role: "tablist", "aria-label": "Paint panels", children: tabs.map((t) => /* @__PURE__ */ jsx14("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)) }),
1734
- /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
1735
- tab === "color" && /* @__PURE__ */ jsx14(ColorPanel, { controller }),
1736
- tab === "wet" && /* @__PURE__ */ jsx14(WetPanel, { controller }),
1737
- tab === "paper" && /* @__PURE__ */ jsx14(PaperPanel, { controller }),
1738
- tab === "layers" && /* @__PURE__ */ jsx14(PaintLayersPanel, { controller }),
1739
- tab === "layers" && /* @__PURE__ */ jsx14(StrokePanel, { controller }),
1740
- tab === "layers" && /* @__PURE__ */ jsx14(StickerPanel, { controller }),
1741
- tab === "effects" && effects && /* @__PURE__ */ jsx14(PaintEffectsPanel, { controller })
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 })
1742
1707
  ] })
1743
1708
  ] })
1744
1709
  ] })
1745
1710
  ] });
1746
1711
  };
1747
1712
  export {
1713
+ BrushEditor,
1714
+ BrushLibraryBrowser,
1748
1715
  BrushPanel,
1749
1716
  ColorPanel,
1750
1717
  PaintCanvas,