@pixerate/editor-react 0.169.0 → 0.170.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.
- package/dist/paint-editor/StickerPanel.d.cts +1 -1
- package/dist/paint-editor/StickerPanel.d.ts +1 -1
- package/dist/paint-editor/StickerPicker.d.cts +17 -0
- package/dist/paint-editor/StickerPicker.d.ts +17 -0
- package/dist/paint-editor/index.cjs +745 -689
- package/dist/paint-editor/index.d.cts +1 -0
- package/dist/paint-editor/index.d.ts +1 -0
- package/dist/paint-editor/index.js +439 -384
- package/package.json +3 -3
|
@@ -571,7 +571,7 @@ var PaintToolbar = ({ controller, tool, onToolChange, fileName = "painting", cla
|
|
|
571
571
|
};
|
|
572
572
|
|
|
573
573
|
// src/paint-editor/BrushPanel.tsx
|
|
574
|
-
import { useMemo as
|
|
574
|
+
import { useMemo as useMemo4, useRef as useRef4, useState as useState6 } from "react";
|
|
575
575
|
import {
|
|
576
576
|
BLEND_MENU_GROUPS,
|
|
577
577
|
BRUSH_ROTATIONS,
|
|
@@ -602,7 +602,7 @@ import {
|
|
|
602
602
|
toggleDotTexture,
|
|
603
603
|
STAMP_KINDS,
|
|
604
604
|
STAMP_LABELS,
|
|
605
|
-
|
|
605
|
+
toggleStickerRef
|
|
606
606
|
} from "@pixerate/editor/paint-editor";
|
|
607
607
|
import { DEFAULT_PAINT_GRADIENT } from "@pixerate/editor/paint-editor";
|
|
608
608
|
|
|
@@ -611,16 +611,69 @@ import { PAINT_GRADIENT_KIT } from "@pixerate/editor/paint-editor";
|
|
|
611
611
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
612
612
|
var PaintGradientEditor = (props) => /* @__PURE__ */ jsx4(PaintGradientEditorView, { ...props, kit: PAINT_GRADIENT_KIT });
|
|
613
613
|
|
|
614
|
+
// 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";
|
|
618
|
+
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;
|
|
627
|
+
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
|
+
] });
|
|
665
|
+
};
|
|
666
|
+
|
|
614
667
|
// src/paint-editor/BrushPanel.tsx
|
|
615
|
-
import { Fragment as Fragment2, jsx as
|
|
668
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
616
669
|
var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, className }) => {
|
|
617
670
|
const state = usePaintEditorState(controller);
|
|
618
671
|
const [error, attempt] = useAttempt();
|
|
619
|
-
const [saveName, setSaveName] =
|
|
672
|
+
const [saveName, setSaveName] = useState6("");
|
|
620
673
|
const fileRef = useRef4(null);
|
|
621
674
|
const { brush, brushes } = state;
|
|
622
675
|
const paper = state.document.paper;
|
|
623
|
-
const thumbs =
|
|
676
|
+
const thumbs = useMemo4(
|
|
624
677
|
() => new Map(brushes.map((b) => [b.id, controller.brushThumbnail(b.id, { width: thumbnailWidth, height: thumbnailHeight, color: "#26324a" })])),
|
|
625
678
|
// Thumbnails follow the library and the paper.
|
|
626
679
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -629,8 +682,8 @@ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, clas
|
|
|
629
682
|
const engine = brushEngineControls(brush);
|
|
630
683
|
const carried = brushLoadColor(state.mixerLoad);
|
|
631
684
|
const slug = (name) => name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || "brush";
|
|
632
|
-
return /* @__PURE__ */
|
|
633
|
-
/* @__PURE__ */
|
|
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(
|
|
634
687
|
"button",
|
|
635
688
|
{
|
|
636
689
|
type: "button",
|
|
@@ -640,56 +693,56 @@ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, clas
|
|
|
640
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"}`,
|
|
641
694
|
onClick: () => controller.setBrush({ id: b.id }),
|
|
642
695
|
children: [
|
|
643
|
-
/* @__PURE__ */
|
|
644
|
-
/* @__PURE__ */
|
|
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 })
|
|
645
698
|
]
|
|
646
699
|
},
|
|
647
700
|
b.id
|
|
648
701
|
)) }),
|
|
649
|
-
/* @__PURE__ */
|
|
650
|
-
BRUSH_SLIDERS.map((c) => /* @__PURE__ */
|
|
651
|
-
/* @__PURE__ */
|
|
652
|
-
/* @__PURE__ */
|
|
653
|
-
/* @__PURE__ */
|
|
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)) })
|
|
654
707
|
] }),
|
|
655
|
-
/* @__PURE__ */
|
|
656
|
-
/* @__PURE__ */
|
|
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 } }) }),
|
|
657
710
|
" Pressure \u2192 size"
|
|
658
711
|
] }),
|
|
659
|
-
/* @__PURE__ */
|
|
660
|
-
/* @__PURE__ */
|
|
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 } }) }),
|
|
661
714
|
" Pressure \u2192 opacity"
|
|
662
715
|
] }),
|
|
663
|
-
brush.engine === "dab" && /* @__PURE__ */
|
|
664
|
-
/* @__PURE__ */
|
|
665
|
-
/* @__PURE__ */
|
|
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)) })
|
|
666
719
|
] })
|
|
667
720
|
] }),
|
|
668
|
-
engine && /* @__PURE__ */
|
|
669
|
-
/* @__PURE__ */
|
|
670
|
-
engine.wetTool && /* @__PURE__ */
|
|
671
|
-
/* @__PURE__ */
|
|
672
|
-
/* @__PURE__ */
|
|
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)) })
|
|
673
726
|
] }),
|
|
674
|
-
engine.wetTool && /* @__PURE__ */
|
|
675
|
-
/* @__PURE__ */
|
|
676
|
-
/* @__PURE__ */
|
|
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)) })
|
|
677
730
|
] }),
|
|
678
|
-
engine.particleMenus && /* @__PURE__ */
|
|
679
|
-
/* @__PURE__ */
|
|
680
|
-
/* @__PURE__ */
|
|
681
|
-
/* @__PURE__ */
|
|
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)) })
|
|
682
735
|
] }),
|
|
683
|
-
/* @__PURE__ */
|
|
684
|
-
/* @__PURE__ */
|
|
685
|
-
/* @__PURE__ */
|
|
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)) })
|
|
686
739
|
] }),
|
|
687
|
-
brush.particle.render === "ribbon" && /* @__PURE__ */
|
|
688
|
-
/* @__PURE__ */
|
|
689
|
-
/* @__PURE__ */
|
|
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)) })
|
|
690
743
|
] }),
|
|
691
|
-
(brush.particle.render === "dot" || brush.particle.render === "sequence") && /* @__PURE__ */
|
|
692
|
-
/* @__PURE__ */
|
|
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(
|
|
693
746
|
"button",
|
|
694
747
|
{
|
|
695
748
|
type: "button",
|
|
@@ -700,37 +753,27 @@ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, clas
|
|
|
700
753
|
},
|
|
701
754
|
k
|
|
702
755
|
)) }),
|
|
703
|
-
brush.particle.dotTextures.length > 0 && /* @__PURE__ */
|
|
704
|
-
/* @__PURE__ */
|
|
705
|
-
/* @__PURE__ */
|
|
706
|
-
/* @__PURE__ */
|
|
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)) })
|
|
707
760
|
] }),
|
|
708
|
-
/* @__PURE__ */
|
|
709
|
-
/* @__PURE__ */
|
|
710
|
-
/* @__PURE__ */
|
|
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)) })
|
|
711
764
|
] })
|
|
712
765
|
] })
|
|
713
766
|
] })
|
|
714
767
|
] }),
|
|
715
|
-
engine.stickerStamps && /* @__PURE__ */
|
|
716
|
-
|
|
717
|
-
{
|
|
718
|
-
|
|
719
|
-
"aria-pressed": brush.sticker.stamps.includes(k),
|
|
720
|
-
className: `px-1.5 py-0.5 rounded text-[10px] ${brush.sticker.stamps.includes(k) ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300"}`,
|
|
721
|
-
onClick: () => controller.setBrush({ sticker: { stamps: toggleStamp(brush.sticker.stamps, k) } }),
|
|
722
|
-
children: STAMP_LABELS[k]
|
|
723
|
-
},
|
|
724
|
-
k
|
|
725
|
-
)) }),
|
|
726
|
-
engine.impastoTool && /* @__PURE__ */ jsxs4("label", { className: "flex items-center justify-between gap-2", children: [
|
|
727
|
-
/* @__PURE__ */ jsx5("span", { className: "text-slate-400", children: "Tool" }),
|
|
728
|
-
/* @__PURE__ */ jsx5("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__ */ jsx5("option", { value: t, children: IMPASTO_TOOL_LABELS[t] }, t)) })
|
|
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)) })
|
|
729
772
|
] }),
|
|
730
|
-
engine.sliders.map((c) => /* @__PURE__ */
|
|
731
|
-
engine.mixingPath && /* @__PURE__ */
|
|
732
|
-
/* @__PURE__ */
|
|
733
|
-
/* @__PURE__ */
|
|
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(
|
|
734
777
|
"select",
|
|
735
778
|
{
|
|
736
779
|
"aria-label": "Brush mixing",
|
|
@@ -738,24 +781,24 @@ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, clas
|
|
|
738
781
|
onChange: (e) => controller.setBrush(patchBrushValue(brush, engine.mixingPath, e.target.value)),
|
|
739
782
|
className: "rounded bg-slate-800 px-1 py-0.5",
|
|
740
783
|
children: [
|
|
741
|
-
/* @__PURE__ */
|
|
742
|
-
/* @__PURE__ */
|
|
784
|
+
/* @__PURE__ */ jsx6("option", { value: "pigment", children: "Pigment" }),
|
|
785
|
+
/* @__PURE__ */ jsx6("option", { value: "rgb", children: "RGB" })
|
|
743
786
|
]
|
|
744
787
|
}
|
|
745
788
|
)
|
|
746
789
|
] }),
|
|
747
|
-
engine.light && brush.light.amount > 0 && /* @__PURE__ */
|
|
748
|
-
/* @__PURE__ */
|
|
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 } }) }),
|
|
749
792
|
" Light follows pressure"
|
|
750
793
|
] }),
|
|
751
|
-
engine.dirty && /* @__PURE__ */
|
|
752
|
-
/* @__PURE__ */
|
|
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 } }) }),
|
|
753
796
|
" Dirty brush"
|
|
754
797
|
] }),
|
|
755
|
-
brushTakesPaint(brush) && /* @__PURE__ */
|
|
756
|
-
/* @__PURE__ */
|
|
757
|
-
/* @__PURE__ */
|
|
758
|
-
/* @__PURE__ */
|
|
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(
|
|
759
802
|
"button",
|
|
760
803
|
{
|
|
761
804
|
type: "button",
|
|
@@ -766,21 +809,21 @@ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, clas
|
|
|
766
809
|
}
|
|
767
810
|
)
|
|
768
811
|
] }),
|
|
769
|
-
brush.paint && /* @__PURE__ */
|
|
812
|
+
brush.paint && /* @__PURE__ */ jsx6(PaintGradientEditor, { value: brush.paint, colors: { paint: state.color, secondary: state.secondaryColor }, onChange: (g) => attempt(() => controller.setBrush({ paint: g })) })
|
|
770
813
|
] }),
|
|
771
|
-
engine.load && /* @__PURE__ */
|
|
772
|
-
/* @__PURE__ */
|
|
773
|
-
/* @__PURE__ */
|
|
774
|
-
brush.engine === "mixer" && /* @__PURE__ */
|
|
775
|
-
/* @__PURE__ */
|
|
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" })
|
|
776
819
|
] })
|
|
777
820
|
] }),
|
|
778
|
-
/* @__PURE__ */
|
|
779
|
-
/* @__PURE__ */
|
|
780
|
-
/* @__PURE__ */
|
|
781
|
-
/* @__PURE__ */
|
|
782
|
-
/* @__PURE__ */
|
|
783
|
-
/* @__PURE__ */
|
|
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(
|
|
784
827
|
"input",
|
|
785
828
|
{
|
|
786
829
|
ref: fileRef,
|
|
@@ -796,24 +839,24 @@ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, clas
|
|
|
796
839
|
}
|
|
797
840
|
)
|
|
798
841
|
] }),
|
|
799
|
-
/* @__PURE__ */
|
|
842
|
+
/* @__PURE__ */ jsx6(ErrorLine, { error })
|
|
800
843
|
] });
|
|
801
844
|
};
|
|
802
845
|
|
|
803
846
|
// src/paint-editor/PaperPanel.tsx
|
|
804
|
-
import { useMemo as
|
|
847
|
+
import { useMemo as useMemo5 } from "react";
|
|
805
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";
|
|
806
|
-
import { jsx as
|
|
849
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
807
850
|
var SWATCH = { x: 0, y: 0, width: 64, height: 40 };
|
|
808
851
|
var PaperPanel = ({ controller, className }) => {
|
|
809
852
|
const state = usePaintEditorState(controller);
|
|
810
853
|
const [error, attempt] = useAttempt();
|
|
811
854
|
const paper = state.document.paper;
|
|
812
|
-
const previews =
|
|
813
|
-
return /* @__PURE__ */
|
|
814
|
-
PAPER_FAMILIES.map((family) => /* @__PURE__ */
|
|
815
|
-
/* @__PURE__ */
|
|
816
|
-
/* @__PURE__ */
|
|
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(
|
|
817
860
|
"button",
|
|
818
861
|
{
|
|
819
862
|
type: "button",
|
|
@@ -822,37 +865,37 @@ var PaperPanel = ({ controller, className }) => {
|
|
|
822
865
|
title: p.name,
|
|
823
866
|
className: `rounded p-0.5 ${paper.preset === p.preset ? "ring-2 ring-indigo-500" : "ring-1 ring-slate-700 hover:ring-slate-500"}`,
|
|
824
867
|
onClick: () => attempt(() => controller.setPaper({ preset: p.preset })),
|
|
825
|
-
children: /* @__PURE__ */
|
|
868
|
+
children: /* @__PURE__ */ jsx7(PixelCanvas, { pixels: previews.get(p.preset) ?? null, label: p.name, style: { width: 48, height: 30 } })
|
|
826
869
|
},
|
|
827
870
|
p.preset
|
|
828
871
|
)) })
|
|
829
872
|
] }, family)),
|
|
830
|
-
/* @__PURE__ */
|
|
831
|
-
/* @__PURE__ */
|
|
832
|
-
/* @__PURE__ */
|
|
833
|
-
/* @__PURE__ */
|
|
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" })
|
|
834
877
|
] }),
|
|
835
|
-
PAPER_SLIDERS.map((c) => /* @__PURE__ */
|
|
836
|
-
/* @__PURE__ */
|
|
837
|
-
/* @__PURE__ */
|
|
838
|
-
/* @__PURE__ */
|
|
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" })
|
|
839
882
|
] }),
|
|
840
|
-
/* @__PURE__ */
|
|
841
|
-
/* @__PURE__ */
|
|
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" })) }),
|
|
842
885
|
" Mirror tiling"
|
|
843
886
|
] }),
|
|
844
|
-
/* @__PURE__ */
|
|
845
|
-
/* @__PURE__ */
|
|
846
|
-
/* @__PURE__ */
|
|
847
|
-
LIGHT_SLIDERS.map((c) => /* @__PURE__ */
|
|
848
|
-
/* @__PURE__ */
|
|
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" })
|
|
849
892
|
] }),
|
|
850
|
-
/* @__PURE__ */
|
|
893
|
+
/* @__PURE__ */ jsx7(ErrorLine, { error })
|
|
851
894
|
] });
|
|
852
895
|
};
|
|
853
896
|
|
|
854
897
|
// src/paint-editor/ColorPanel.tsx
|
|
855
|
-
import { useMemo as
|
|
898
|
+
import { useMemo as useMemo6, useRef as useRef5, useState as useState7 } from "react";
|
|
856
899
|
import {
|
|
857
900
|
HARMONY_KINDS,
|
|
858
901
|
MIXING_PAD_HEIGHT,
|
|
@@ -869,24 +912,24 @@ import {
|
|
|
869
912
|
wheelPoint
|
|
870
913
|
} from "@pixerate/editor/paint-editor";
|
|
871
914
|
import { DEFAULT_PAINT_GRADIENT as DEFAULT_PAINT_GRADIENT2, paintSourceCss } from "@pixerate/editor/paint-editor";
|
|
872
|
-
import { jsx as
|
|
915
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
873
916
|
var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className }) => {
|
|
874
917
|
const state = usePaintEditorState(controller);
|
|
875
918
|
const [error, attempt] = useAttempt();
|
|
876
|
-
const [wheel, setWheel] =
|
|
877
|
-
const [kind, setKind] =
|
|
878
|
-
const [padTool, setPadTool] =
|
|
879
|
-
const [sample, setSample] =
|
|
880
|
-
const [parts, setParts] =
|
|
881
|
-
const [padName, setPadName] =
|
|
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("");
|
|
882
925
|
const padPoints = useRef5(null);
|
|
883
|
-
const ring =
|
|
926
|
+
const ring = useMemo6(() => renderColorWheel(wheelSize, wheel), [wheelSize, wheel]);
|
|
884
927
|
const color = state.color;
|
|
885
|
-
const harmony =
|
|
928
|
+
const harmony = useMemo6(() => controller.harmony(kind, { color, wheel }), [controller, kind, color, wheel]);
|
|
886
929
|
const [r, g, b] = parseHexColor(color);
|
|
887
930
|
const hsv = rgbToHsv(r, g, b);
|
|
888
|
-
const effectWell =
|
|
889
|
-
const pad =
|
|
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]);
|
|
890
933
|
const R = wheelSize / 2;
|
|
891
934
|
const mid = R * 0.82;
|
|
892
935
|
const setHsv = (s, v) => controller.setColor(rgbToHexColor(...hsvToRgb(hsv.h, s, v)));
|
|
@@ -898,9 +941,9 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
|
|
|
898
941
|
const y = Math.min(MIXING_PAD_HEIGHT, Math.max(0, (e.clientY - rect.top) * ky));
|
|
899
942
|
return e.pointerType === "pen" && e.pressure > 0 ? { x, y, pressure: e.pressure } : { x, y };
|
|
900
943
|
};
|
|
901
|
-
return /* @__PURE__ */
|
|
902
|
-
/* @__PURE__ */
|
|
903
|
-
/* @__PURE__ */
|
|
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(
|
|
904
947
|
"div",
|
|
905
948
|
{
|
|
906
949
|
role: "slider",
|
|
@@ -914,20 +957,20 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
|
|
|
914
957
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
915
958
|
controller.setColor(wheelPick(e.clientX - rect.left - R, e.clientY - rect.top - R, wheel, color));
|
|
916
959
|
},
|
|
917
|
-
children: /* @__PURE__ */
|
|
960
|
+
children: /* @__PURE__ */ jsx8(PixelCanvas, { pixels: ring, label: "Colour wheel", style: { width: wheelSize, height: wheelSize } })
|
|
918
961
|
}
|
|
919
962
|
),
|
|
920
|
-
/* @__PURE__ */
|
|
963
|
+
/* @__PURE__ */ jsx8("svg", { className: "pointer-events-none absolute inset-0", width: wheelSize, height: wheelSize, "aria-hidden": "true", children: harmony.map((h, i) => {
|
|
921
964
|
const p = wheelPoint(h.angle, mid);
|
|
922
|
-
return /* @__PURE__ */
|
|
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);
|
|
923
966
|
}) }),
|
|
924
|
-
/* @__PURE__ */
|
|
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 } })
|
|
925
968
|
] }),
|
|
926
|
-
/* @__PURE__ */
|
|
927
|
-
/* @__PURE__ */
|
|
928
|
-
/* @__PURE__ */
|
|
929
|
-
/* @__PURE__ */
|
|
930
|
-
/* @__PURE__ */
|
|
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(
|
|
931
974
|
"input",
|
|
932
975
|
{
|
|
933
976
|
"aria-label": "Hex colour",
|
|
@@ -938,8 +981,8 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
|
|
|
938
981
|
color
|
|
939
982
|
)
|
|
940
983
|
] }),
|
|
941
|
-
/* @__PURE__ */
|
|
942
|
-
/* @__PURE__ */
|
|
984
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2", "data-testid": "paint-source", children: [
|
|
985
|
+
/* @__PURE__ */ jsx8(
|
|
943
986
|
"span",
|
|
944
987
|
{
|
|
945
988
|
className: "h-5 flex-1 rounded ring-1 ring-slate-700",
|
|
@@ -949,7 +992,7 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
|
|
|
949
992
|
style: { background: effectWell ? `center / cover no-repeat url("${effectWell}")` : paintSourceCss(state.paint, { paint: color, secondary: state.secondaryColor }) }
|
|
950
993
|
}
|
|
951
994
|
),
|
|
952
|
-
/* @__PURE__ */
|
|
995
|
+
/* @__PURE__ */ jsx8(
|
|
953
996
|
"button",
|
|
954
997
|
{
|
|
955
998
|
type: "button",
|
|
@@ -961,26 +1004,26 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
|
|
|
961
1004
|
}
|
|
962
1005
|
)
|
|
963
1006
|
] }),
|
|
964
|
-
state.paint.type === "gradient" && /* @__PURE__ */
|
|
965
|
-
/* @__PURE__ */
|
|
966
|
-
/* @__PURE__ */
|
|
967
|
-
/* @__PURE__ */
|
|
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" })
|
|
968
1011
|
] }),
|
|
969
|
-
/* @__PURE__ */
|
|
970
|
-
/* @__PURE__ */
|
|
971
|
-
/* @__PURE__ */
|
|
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" })
|
|
972
1015
|
] }),
|
|
973
|
-
/* @__PURE__ */
|
|
974
|
-
/* @__PURE__ */
|
|
975
|
-
/* @__PURE__ */
|
|
976
|
-
/* @__PURE__ */
|
|
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" })
|
|
977
1020
|
] }),
|
|
978
|
-
/* @__PURE__ */
|
|
979
|
-
harmony.map((h, i) => /* @__PURE__ */
|
|
980
|
-
/* @__PURE__ */
|
|
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" })
|
|
981
1024
|
] }),
|
|
982
|
-
/* @__PURE__ */
|
|
983
|
-
state.swatches.map((s, i) => /* @__PURE__ */
|
|
1025
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": "Swatches", children: [
|
|
1026
|
+
state.swatches.map((s, i) => /* @__PURE__ */ jsx8(
|
|
984
1027
|
"button",
|
|
985
1028
|
{
|
|
986
1029
|
type: "button",
|
|
@@ -998,15 +1041,15 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
|
|
|
998
1041
|
},
|
|
999
1042
|
i
|
|
1000
1043
|
)),
|
|
1001
|
-
/* @__PURE__ */
|
|
1044
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: button, "aria-label": "Add swatch", onClick: () => attempt(() => controller.addSwatch(state.paint)), children: "+" })
|
|
1002
1045
|
] }),
|
|
1003
|
-
mixingPad && /* @__PURE__ */
|
|
1004
|
-
/* @__PURE__ */
|
|
1005
|
-
/* @__PURE__ */
|
|
1006
|
-
["paint", "knife", "pick"].map((t) => /* @__PURE__ */
|
|
1007
|
-
/* @__PURE__ */
|
|
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" })
|
|
1008
1051
|
] }),
|
|
1009
|
-
/* @__PURE__ */
|
|
1052
|
+
/* @__PURE__ */ jsx8(
|
|
1010
1053
|
"div",
|
|
1011
1054
|
{
|
|
1012
1055
|
role: "application",
|
|
@@ -1027,20 +1070,20 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
|
|
|
1027
1070
|
padPoints.current = null;
|
|
1028
1071
|
if (pts?.length) attempt(() => controller.mixingPadStroke(pts, { tool: padTool === "knife" ? "knife" : "paint" }));
|
|
1029
1072
|
},
|
|
1030
|
-
children: /* @__PURE__ */
|
|
1073
|
+
children: /* @__PURE__ */ jsx8(PixelCanvas, { pixels: pad, label: "Mixing pad pixels", className: "w-full rounded", style: { aspectRatio: `${MIXING_PAD_WIDTH} / ${MIXING_PAD_HEIGHT}` } })
|
|
1031
1074
|
}
|
|
1032
1075
|
),
|
|
1033
|
-
/* @__PURE__ */
|
|
1034
|
-
/* @__PURE__ */
|
|
1035
|
-
/* @__PURE__ */
|
|
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)) })
|
|
1036
1079
|
] }) }),
|
|
1037
|
-
/* @__PURE__ */
|
|
1038
|
-
/* @__PURE__ */
|
|
1039
|
-
/* @__PURE__ */
|
|
1040
|
-
/* @__PURE__ */
|
|
1041
|
-
/* @__PURE__ */
|
|
1042
|
-
/* @__PURE__ */
|
|
1043
|
-
/* @__PURE__ */
|
|
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(
|
|
1044
1087
|
"button",
|
|
1045
1088
|
{
|
|
1046
1089
|
type: "button",
|
|
@@ -1059,23 +1102,23 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
|
|
|
1059
1102
|
}
|
|
1060
1103
|
)
|
|
1061
1104
|
] }),
|
|
1062
|
-
/* @__PURE__ */
|
|
1063
|
-
/* @__PURE__ */
|
|
1064
|
-
/* @__PURE__ */
|
|
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" })
|
|
1065
1108
|
] }),
|
|
1066
|
-
state.savedMixingPads.length > 0 && /* @__PURE__ */
|
|
1067
|
-
/* @__PURE__ */
|
|
1068
|
-
/* @__PURE__ */
|
|
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" })
|
|
1069
1112
|
] }, p.id)) })
|
|
1070
1113
|
] }),
|
|
1071
|
-
/* @__PURE__ */
|
|
1114
|
+
/* @__PURE__ */ jsx8(ErrorLine, { error })
|
|
1072
1115
|
] });
|
|
1073
1116
|
};
|
|
1074
1117
|
|
|
1075
1118
|
// src/paint-editor/PaintLayersPanel.tsx
|
|
1076
|
-
import { useState as
|
|
1119
|
+
import { useState as useState8 } from "react";
|
|
1077
1120
|
import { BLEND_MENU_GROUPS as BLEND_MENU_GROUPS2 } from "@pixerate/editor/paint-editor";
|
|
1078
|
-
import { jsx as
|
|
1121
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1079
1122
|
function siblingIndex(layers, l) {
|
|
1080
1123
|
const sibs = layers.filter((x) => x.parentId === l.parentId).reverse();
|
|
1081
1124
|
return { index: sibs.findIndex((x) => x.id === l.id), count: sibs.length };
|
|
@@ -1083,7 +1126,7 @@ function siblingIndex(layers, l) {
|
|
|
1083
1126
|
var PaintLayersPanel = ({ controller, className }) => {
|
|
1084
1127
|
usePaintEditorState(controller);
|
|
1085
1128
|
const [error, attempt] = useAttempt();
|
|
1086
|
-
const [renaming, setRenaming] =
|
|
1129
|
+
const [renaming, setRenaming] = useState8(null);
|
|
1087
1130
|
const layers = controller.listLayers();
|
|
1088
1131
|
const active = layers.find((l) => l.active) ?? null;
|
|
1089
1132
|
const light = active?.type === "pixel" ? controller.lightOf(active.id) : null;
|
|
@@ -1093,18 +1136,18 @@ var PaintLayersPanel = ({ controller, className }) => {
|
|
|
1093
1136
|
const to = Math.min(count - 1, Math.max(0, index + delta));
|
|
1094
1137
|
if (to !== index) attempt(() => controller.moveLayer(active.id, to));
|
|
1095
1138
|
};
|
|
1096
|
-
return /* @__PURE__ */
|
|
1097
|
-
/* @__PURE__ */
|
|
1098
|
-
/* @__PURE__ */
|
|
1099
|
-
/* @__PURE__ */
|
|
1100
|
-
/* @__PURE__ */
|
|
1101
|
-
/* @__PURE__ */
|
|
1102
|
-
/* @__PURE__ */
|
|
1103
|
-
/* @__PURE__ */
|
|
1104
|
-
/* @__PURE__ */
|
|
1105
|
-
/* @__PURE__ */
|
|
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" })
|
|
1106
1149
|
] }),
|
|
1107
|
-
/* @__PURE__ */
|
|
1150
|
+
/* @__PURE__ */ jsx9("ul", { role: "tree", "aria-label": "Layers", className: "flex flex-col gap-0.5", children: layers.map((l) => /* @__PURE__ */ jsxs8(
|
|
1108
1151
|
"li",
|
|
1109
1152
|
{
|
|
1110
1153
|
role: "treeitem",
|
|
@@ -1113,7 +1156,7 @@ var PaintLayersPanel = ({ controller, className }) => {
|
|
|
1113
1156
|
style: { paddingLeft: 6 + l.depth * 12 },
|
|
1114
1157
|
onClick: () => controller.setActiveLayer(l.id),
|
|
1115
1158
|
children: [
|
|
1116
|
-
/* @__PURE__ */
|
|
1159
|
+
/* @__PURE__ */ jsx9(
|
|
1117
1160
|
"button",
|
|
1118
1161
|
{
|
|
1119
1162
|
type: "button",
|
|
@@ -1126,7 +1169,7 @@ var PaintLayersPanel = ({ controller, className }) => {
|
|
|
1126
1169
|
children: l.visible ? "\u25CF" : "\u25CB"
|
|
1127
1170
|
}
|
|
1128
1171
|
),
|
|
1129
|
-
renaming === l.id ? /* @__PURE__ */
|
|
1172
|
+
renaming === l.id ? /* @__PURE__ */ jsx9(
|
|
1130
1173
|
"input",
|
|
1131
1174
|
{
|
|
1132
1175
|
autoFocus: true,
|
|
@@ -1143,23 +1186,23 @@ var PaintLayersPanel = ({ controller, className }) => {
|
|
|
1143
1186
|
if (e.key === "Escape") setRenaming(null);
|
|
1144
1187
|
}
|
|
1145
1188
|
}
|
|
1146
|
-
) : /* @__PURE__ */
|
|
1189
|
+
) : /* @__PURE__ */ jsxs8("span", { className: "flex-1 truncate", onDoubleClick: () => setRenaming(l.id), children: [
|
|
1147
1190
|
l.type === "group" ? "\u25B8 " : "",
|
|
1148
|
-
l.liveStrokes !== void 0 && /* @__PURE__ */
|
|
1191
|
+
l.liveStrokes !== void 0 && /* @__PURE__ */ jsxs8("span", { "aria-label": "Stroke layer", title: `Stroke layer: ${l.liveStrokes} editable strokes`, children: [
|
|
1149
1192
|
"\u270E",
|
|
1150
1193
|
" "
|
|
1151
1194
|
] }),
|
|
1152
1195
|
l.name
|
|
1153
1196
|
] }),
|
|
1154
|
-
l.locks.pixels || l.locks.all ? /* @__PURE__ */
|
|
1197
|
+
l.locks.pixels || l.locks.all ? /* @__PURE__ */ jsx9("span", { title: "Locked", children: "\u{1F512}" }) : null
|
|
1155
1198
|
]
|
|
1156
1199
|
},
|
|
1157
1200
|
l.id
|
|
1158
1201
|
)) }),
|
|
1159
|
-
active && /* @__PURE__ */
|
|
1160
|
-
/* @__PURE__ */
|
|
1161
|
-
/* @__PURE__ */
|
|
1162
|
-
/* @__PURE__ */
|
|
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(
|
|
1163
1206
|
"input",
|
|
1164
1207
|
{
|
|
1165
1208
|
type: "range",
|
|
@@ -1173,40 +1216,40 @@ var PaintLayersPanel = ({ controller, className }) => {
|
|
|
1173
1216
|
}
|
|
1174
1217
|
)
|
|
1175
1218
|
] }),
|
|
1176
|
-
/* @__PURE__ */
|
|
1177
|
-
/* @__PURE__ */
|
|
1178
|
-
/* @__PURE__ */
|
|
1179
|
-
active.type === "group" && /* @__PURE__ */
|
|
1180
|
-
BLEND_MENU_GROUPS2.map((g) => /* @__PURE__ */
|
|
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))
|
|
1181
1224
|
] })
|
|
1182
1225
|
] }),
|
|
1183
|
-
/* @__PURE__ */
|
|
1184
|
-
["pixels", "transparency"].map((k) => /* @__PURE__ */
|
|
1185
|
-
/* @__PURE__ */
|
|
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" })
|
|
1186
1229
|
] }),
|
|
1187
|
-
light?.hasLight && /* @__PURE__ */
|
|
1188
|
-
/* @__PURE__ */
|
|
1189
|
-
/* @__PURE__ */
|
|
1190
|
-
/* @__PURE__ */
|
|
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" })
|
|
1191
1234
|
] }),
|
|
1192
|
-
/* @__PURE__ */
|
|
1193
|
-
/* @__PURE__ */
|
|
1194
|
-
/* @__PURE__ */
|
|
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" })
|
|
1195
1238
|
] }),
|
|
1196
|
-
/* @__PURE__ */
|
|
1197
|
-
/* @__PURE__ */
|
|
1198
|
-
/* @__PURE__ */
|
|
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" })
|
|
1199
1242
|
] })
|
|
1200
1243
|
] }),
|
|
1201
|
-
/* @__PURE__ */
|
|
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 }) })
|
|
1202
1245
|
] }),
|
|
1203
|
-
/* @__PURE__ */
|
|
1246
|
+
/* @__PURE__ */ jsx9(ErrorLine, { error })
|
|
1204
1247
|
] });
|
|
1205
1248
|
};
|
|
1206
1249
|
|
|
1207
1250
|
// src/paint-editor/WetPanel.tsx
|
|
1208
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";
|
|
1209
|
-
import { jsx as
|
|
1252
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1210
1253
|
var FLOW_LABELS = { none: "None", linear: "One way", swirl: "Swirl", radial: "Outwards", turbulent: "Eddies" };
|
|
1211
1254
|
var WetPanel = ({ controller, className }) => {
|
|
1212
1255
|
const state = usePaintEditorState(controller);
|
|
@@ -1215,31 +1258,31 @@ var WetPanel = ({ controller, className }) => {
|
|
|
1215
1258
|
const layerId = state.document.activeLayerId;
|
|
1216
1259
|
const info = layerId ? controller.wetLayerInfo(layerId) : null;
|
|
1217
1260
|
const backend = controller.wetState();
|
|
1218
|
-
return /* @__PURE__ */
|
|
1219
|
-
/* @__PURE__ */
|
|
1220
|
-
/* @__PURE__ */
|
|
1221
|
-
/* @__PURE__ */
|
|
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: [
|
|
1222
1265
|
"step ",
|
|
1223
1266
|
wet.clock
|
|
1224
1267
|
] })
|
|
1225
1268
|
] }),
|
|
1226
|
-
/* @__PURE__ */
|
|
1227
|
-
/* @__PURE__ */
|
|
1228
|
-
/* @__PURE__ */
|
|
1229
|
-
/* @__PURE__ */
|
|
1230
|
-
/* @__PURE__ */
|
|
1231
|
-
/* @__PURE__ */
|
|
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" })
|
|
1232
1275
|
] }),
|
|
1233
|
-
/* @__PURE__ */
|
|
1234
|
-
WET_TILT_SLIDERS.map((c) => /* @__PURE__ */
|
|
1235
|
-
info && /* @__PURE__ */
|
|
1236
|
-
/* @__PURE__ */
|
|
1237
|
-
WET_PARAM_SLIDERS.map((c) => /* @__PURE__ */
|
|
1238
|
-
/* @__PURE__ */
|
|
1239
|
-
/* @__PURE__ */
|
|
1240
|
-
/* @__PURE__ */
|
|
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
1284
|
] }),
|
|
1242
|
-
info.flow.kind !== "none" && /* @__PURE__ */
|
|
1285
|
+
info.flow.kind !== "none" && /* @__PURE__ */ jsx10(
|
|
1243
1286
|
PaintSlider,
|
|
1244
1287
|
{
|
|
1245
1288
|
control: { path: "strength", label: "Flow strength", min: 0, max: 1, step: 0.01 },
|
|
@@ -1248,20 +1291,20 @@ var WetPanel = ({ controller, className }) => {
|
|
|
1248
1291
|
}
|
|
1249
1292
|
)
|
|
1250
1293
|
] }),
|
|
1251
|
-
backend.message && /* @__PURE__ */
|
|
1252
|
-
backend.backend && /* @__PURE__ */
|
|
1253
|
-
/* @__PURE__ */
|
|
1254
|
-
/* @__PURE__ */
|
|
1255
|
-
/* @__PURE__ */
|
|
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)) })
|
|
1256
1299
|
] }),
|
|
1257
|
-
/* @__PURE__ */
|
|
1258
|
-
/* @__PURE__ */
|
|
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 })
|
|
1259
1302
|
] });
|
|
1260
1303
|
};
|
|
1261
1304
|
|
|
1262
1305
|
// src/paint-editor/StickerPanel.tsx
|
|
1263
|
-
import {
|
|
1264
|
-
import { jsx as
|
|
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";
|
|
1265
1308
|
var StickerPanel = ({ controller, className }) => {
|
|
1266
1309
|
const state = usePaintEditorState(controller);
|
|
1267
1310
|
const [error, attempt] = useAttempt();
|
|
@@ -1271,21 +1314,32 @@ var StickerPanel = ({ controller, className }) => {
|
|
|
1271
1314
|
const stickers = layerId ? state.document.stickers?.[layerId] ?? [] : [];
|
|
1272
1315
|
if (!stickers.length) return null;
|
|
1273
1316
|
const sel = stickers.find((s) => s.id === picked) ?? null;
|
|
1274
|
-
return /* @__PURE__ */
|
|
1275
|
-
/* @__PURE__ */
|
|
1317
|
+
return /* @__PURE__ */ jsxs10("div", { className: `${panel} ${className ?? ""}`, "data-testid": "sticker-panel", children: [
|
|
1318
|
+
/* @__PURE__ */ jsxs10("span", { className: "font-medium text-slate-300", children: [
|
|
1276
1319
|
"Stickers (",
|
|
1277
1320
|
stickers.length,
|
|
1278
1321
|
")"
|
|
1279
1322
|
] }),
|
|
1280
|
-
/* @__PURE__ */
|
|
1281
|
-
sel && /* @__PURE__ */
|
|
1282
|
-
/* @__PURE__ */
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
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(
|
|
1327
|
+
StickerPicker,
|
|
1328
|
+
{
|
|
1329
|
+
controller,
|
|
1330
|
+
label: "Sticker art",
|
|
1331
|
+
selected: [sel.ref],
|
|
1332
|
+
onPick: (ref) => (
|
|
1333
|
+
// The layer is redrawn, so the new sticker's art (and every other's) loads first.
|
|
1334
|
+
void controller.prepareStickers([ref, ...stickers.map((x) => x.ref)]).then(() => attempt(() => controller.updateSticker(layerId, sel.id, { ref }))).catch((e) => attempt(() => {
|
|
1335
|
+
throw e;
|
|
1336
|
+
}))
|
|
1337
|
+
)
|
|
1338
|
+
}
|
|
1339
|
+
),
|
|
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(
|
|
1289
1343
|
"input",
|
|
1290
1344
|
{
|
|
1291
1345
|
type: "number",
|
|
@@ -1299,24 +1353,24 @@ var StickerPanel = ({ controller, className }) => {
|
|
|
1299
1353
|
`${sel.id}-${k}-${sel[k]}`
|
|
1300
1354
|
)) })
|
|
1301
1355
|
] }),
|
|
1302
|
-
STICKER_SLIDERS.map((c) => /* @__PURE__ */
|
|
1303
|
-
/* @__PURE__ */
|
|
1304
|
-
/* @__PURE__ */
|
|
1305
|
-
/* @__PURE__ */
|
|
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" })
|
|
1306
1360
|
] }),
|
|
1307
|
-
/* @__PURE__ */
|
|
1308
|
-
/* @__PURE__ */
|
|
1309
|
-
/* @__PURE__ */
|
|
1310
|
-
/* @__PURE__ */
|
|
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" })
|
|
1311
1365
|
] })
|
|
1312
1366
|
] }),
|
|
1313
|
-
/* @__PURE__ */
|
|
1367
|
+
/* @__PURE__ */ jsx11(ErrorLine, { error })
|
|
1314
1368
|
] });
|
|
1315
1369
|
};
|
|
1316
1370
|
|
|
1317
1371
|
// src/paint-editor/StrokePanel.tsx
|
|
1318
1372
|
import { STROKE_SLIDERS, liveStrokeRefusal, readPath as readPath5 } from "@pixerate/editor/paint-editor";
|
|
1319
|
-
import { jsx as
|
|
1373
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1320
1374
|
var StrokePanel = ({ controller, className }) => {
|
|
1321
1375
|
const state = usePaintEditorState(controller);
|
|
1322
1376
|
const [error, attempt] = useAttempt();
|
|
@@ -1326,16 +1380,16 @@ var StrokePanel = ({ controller, className }) => {
|
|
|
1326
1380
|
const index = strokes.findIndex((s) => s.id === state.selectedStroke);
|
|
1327
1381
|
const sel = index >= 0 ? strokes[index] : null;
|
|
1328
1382
|
const brushes = state.brushes.filter((b) => !liveStrokeRefusal(b));
|
|
1329
|
-
return /* @__PURE__ */
|
|
1330
|
-
/* @__PURE__ */
|
|
1331
|
-
/* @__PURE__ */
|
|
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: [
|
|
1332
1386
|
"Strokes (",
|
|
1333
1387
|
strokes.length,
|
|
1334
1388
|
")"
|
|
1335
1389
|
] }),
|
|
1336
|
-
/* @__PURE__ */
|
|
1390
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: button, onClick: () => attempt(() => controller.rasterizeLiveStrokes(layerId)), children: "Rasterize" })
|
|
1337
1391
|
] }),
|
|
1338
|
-
/* @__PURE__ */
|
|
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(
|
|
1339
1393
|
"button",
|
|
1340
1394
|
{
|
|
1341
1395
|
type: "button",
|
|
@@ -1348,10 +1402,10 @@ var StrokePanel = ({ controller, className }) => {
|
|
|
1348
1402
|
},
|
|
1349
1403
|
s.id
|
|
1350
1404
|
)) }),
|
|
1351
|
-
sel && /* @__PURE__ */
|
|
1352
|
-
/* @__PURE__ */
|
|
1353
|
-
/* @__PURE__ */
|
|
1354
|
-
/* @__PURE__ */
|
|
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(
|
|
1355
1409
|
"select",
|
|
1356
1410
|
{
|
|
1357
1411
|
"aria-label": "Stroke brush",
|
|
@@ -1359,39 +1413,39 @@ var StrokePanel = ({ controller, className }) => {
|
|
|
1359
1413
|
onChange: (e) => e.target.value && attempt(() => controller.updateStroke(sel.id, { brushId: e.target.value })),
|
|
1360
1414
|
className: "max-w-[10rem] rounded bg-slate-800 px-1 py-0.5",
|
|
1361
1415
|
children: [
|
|
1362
|
-
!brushes.some((b) => b.id === sel.brush.id) && /* @__PURE__ */
|
|
1363
|
-
brushes.map((b) => /* @__PURE__ */
|
|
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))
|
|
1364
1418
|
]
|
|
1365
1419
|
}
|
|
1366
1420
|
)
|
|
1367
1421
|
] }),
|
|
1368
|
-
STROKE_SLIDERS.map((c) => /* @__PURE__ */
|
|
1369
|
-
/* @__PURE__ */
|
|
1370
|
-
/* @__PURE__ */
|
|
1371
|
-
/* @__PURE__ */
|
|
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" })
|
|
1372
1426
|
] }),
|
|
1373
|
-
/* @__PURE__ */
|
|
1374
|
-
/* @__PURE__ */
|
|
1375
|
-
/* @__PURE__ */
|
|
1376
|
-
/* @__PURE__ */
|
|
1377
|
-
/* @__PURE__ */
|
|
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" })
|
|
1378
1432
|
] })
|
|
1379
1433
|
] }),
|
|
1380
|
-
/* @__PURE__ */
|
|
1434
|
+
/* @__PURE__ */ jsx12(ErrorLine, { error })
|
|
1381
1435
|
] });
|
|
1382
1436
|
};
|
|
1383
1437
|
|
|
1384
1438
|
// src/paint-editor/PaintEditor.tsx
|
|
1385
|
-
import { useRef as useRef7, useState as
|
|
1439
|
+
import { useRef as useRef7, useState as useState10 } from "react";
|
|
1386
1440
|
import { PaintPresence as PaintPresence2, documentToScreen as documentToScreen2, screenToDocument } from "@pixerate/editor/paint-editor";
|
|
1387
1441
|
|
|
1388
1442
|
// src/paint-editor/PaintEffectsPanel.tsx
|
|
1389
|
-
import { useEffect as
|
|
1443
|
+
import { useEffect as useEffect5, useMemo as useMemo7, useRef as useRef6, useState as useState9 } from "react";
|
|
1390
1444
|
import { createPaintEffectsToolProvider, PAPER_EFFECT_BLENDS } from "@pixerate/editor/paint-editor";
|
|
1391
|
-
import { jsx as
|
|
1445
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1392
1446
|
function usePaintEffectsProvider(controller) {
|
|
1393
|
-
const [provider, setProvider] =
|
|
1394
|
-
|
|
1447
|
+
const [provider, setProvider] = useState9(controller.effectsProvider);
|
|
1448
|
+
useEffect5(() => {
|
|
1395
1449
|
setProvider(controller.effectsProvider);
|
|
1396
1450
|
return controller.effects.subscribe(setProvider);
|
|
1397
1451
|
}, [controller]);
|
|
@@ -1399,7 +1453,7 @@ function usePaintEffectsProvider(controller) {
|
|
|
1399
1453
|
}
|
|
1400
1454
|
function usePaintEffectsTools(registry, controller, options = {}) {
|
|
1401
1455
|
const { id, namespace, readOnly, playbackSurface } = options;
|
|
1402
|
-
|
|
1456
|
+
useEffect5(() => {
|
|
1403
1457
|
if (!registry) return;
|
|
1404
1458
|
return registry.register(createPaintEffectsToolProvider(controller, { id, namespace, readOnly, playbackSurface }));
|
|
1405
1459
|
}, [registry, controller, id, namespace, readOnly, playbackSurface]);
|
|
@@ -1407,19 +1461,19 @@ function usePaintEffectsTools(registry, controller, options = {}) {
|
|
|
1407
1461
|
function Controls({ provider, effect, name, values, apply }) {
|
|
1408
1462
|
const { description, error } = useEffectDescription(provider, effect);
|
|
1409
1463
|
const drags = useRef6(/* @__PURE__ */ new Set());
|
|
1410
|
-
if (!provider) return /* @__PURE__ */
|
|
1464
|
+
if (!provider) return /* @__PURE__ */ jsxs12("p", { className: "text-[11px] text-slate-400", children: [
|
|
1411
1465
|
'No effects provider: "',
|
|
1412
1466
|
name ?? effect,
|
|
1413
1467
|
'" is kept as it was drawn.'
|
|
1414
1468
|
] });
|
|
1415
|
-
if (error) return /* @__PURE__ */
|
|
1416
|
-
if (!description) return /* @__PURE__ */
|
|
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" });
|
|
1417
1471
|
const commit = (gesture) => {
|
|
1418
1472
|
if (!gesture || drags.current.has(gesture)) return !gesture;
|
|
1419
1473
|
drags.current.add(gesture);
|
|
1420
1474
|
return true;
|
|
1421
1475
|
};
|
|
1422
|
-
return /* @__PURE__ */
|
|
1476
|
+
return /* @__PURE__ */ jsx13(
|
|
1423
1477
|
EffectParameters,
|
|
1424
1478
|
{
|
|
1425
1479
|
description,
|
|
@@ -1441,8 +1495,8 @@ var PaintEffectsPanel = ({ controller, className }) => {
|
|
|
1441
1495
|
const state = usePaintEditorState(controller);
|
|
1442
1496
|
const provider = usePaintEffectsProvider(controller);
|
|
1443
1497
|
const [error, attempt] = useAttempt();
|
|
1444
|
-
const [browse, setBrowse] =
|
|
1445
|
-
const [busy, setBusy] =
|
|
1498
|
+
const [browse, setBrowse] = useState9(null);
|
|
1499
|
+
const [busy, setBusy] = useState9(false);
|
|
1446
1500
|
const paper = controller.getPaperEffect();
|
|
1447
1501
|
const activeId = state.document.activeLayerId;
|
|
1448
1502
|
const layerEffect = activeId ? controller.getEffectLayer(activeId) : void 0;
|
|
@@ -1454,7 +1508,7 @@ var PaintEffectsPanel = ({ controller, className }) => {
|
|
|
1454
1508
|
if (!effectPaint) return;
|
|
1455
1509
|
run(() => controller.setEffectPaint({ effect: effectPaint.effect, values: effectPaint.values, time: effectPaint.time, map: effectPaint.map, live: effectPaint.live, ...patch }));
|
|
1456
1510
|
};
|
|
1457
|
-
const thumbnail =
|
|
1511
|
+
const thumbnail = useMemo7(() => effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(48) : null, [controller, effectPaint, state.effectPaintRendering]);
|
|
1458
1512
|
const run = (work) => attempt(() => {
|
|
1459
1513
|
setBusy(true);
|
|
1460
1514
|
return work().finally(() => setBusy(false));
|
|
@@ -1470,28 +1524,28 @@ var PaintEffectsPanel = ({ controller, className }) => {
|
|
|
1470
1524
|
};
|
|
1471
1525
|
const toggle = (b) => setBrowse(browse === b ? null : b);
|
|
1472
1526
|
const pixel = active?.type === "pixel";
|
|
1473
|
-
return /* @__PURE__ */
|
|
1474
|
-
/* @__PURE__ */
|
|
1475
|
-
/* @__PURE__ */
|
|
1476
|
-
/* @__PURE__ */
|
|
1477
|
-
/* @__PURE__ */
|
|
1478
|
-
/* @__PURE__ */
|
|
1479
|
-
/* @__PURE__ */
|
|
1480
|
-
/* @__PURE__ */
|
|
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" })
|
|
1481
1535
|
] }),
|
|
1482
|
-
!provider && /* @__PURE__ */
|
|
1483
|
-
browse && /* @__PURE__ */
|
|
1484
|
-
paper && /* @__PURE__ */
|
|
1485
|
-
/* @__PURE__ */
|
|
1486
|
-
/* @__PURE__ */
|
|
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: [
|
|
1487
1541
|
"Paper: ",
|
|
1488
1542
|
paper.name ?? paper.effect
|
|
1489
1543
|
] }),
|
|
1490
|
-
/* @__PURE__ */
|
|
1544
|
+
/* @__PURE__ */ jsx13("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
|
|
1491
1545
|
] }),
|
|
1492
|
-
/* @__PURE__ */
|
|
1493
|
-
/* @__PURE__ */
|
|
1494
|
-
/* @__PURE__ */
|
|
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(
|
|
1495
1549
|
"input",
|
|
1496
1550
|
{
|
|
1497
1551
|
type: "range",
|
|
@@ -1513,39 +1567,39 @@ var PaintEffectsPanel = ({ controller, className }) => {
|
|
|
1513
1567
|
`o${paper.opacity}`
|
|
1514
1568
|
)
|
|
1515
1569
|
] }),
|
|
1516
|
-
/* @__PURE__ */
|
|
1517
|
-
/* @__PURE__ */
|
|
1518
|
-
/* @__PURE__ */
|
|
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) => {
|
|
1519
1573
|
const blend = e.currentTarget.value;
|
|
1520
1574
|
run(() => controller.updatePaperEffect({ blend }));
|
|
1521
|
-
}, children: PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */
|
|
1575
|
+
}, children: PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ jsx13("option", { value: b, children: b }, b)) })
|
|
1522
1576
|
] }),
|
|
1523
|
-
/* @__PURE__ */
|
|
1577
|
+
/* @__PURE__ */ jsx13(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
|
|
1524
1578
|
] }),
|
|
1525
|
-
effectPaint && /* @__PURE__ */
|
|
1526
|
-
/* @__PURE__ */
|
|
1527
|
-
thumbnail ? /* @__PURE__ */
|
|
1528
|
-
/* @__PURE__ */
|
|
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: [
|
|
1529
1583
|
"Paint: ",
|
|
1530
1584
|
effectPaint.effect,
|
|
1531
1585
|
state.effectPaintRendering ? " (rendering\u2026)" : ""
|
|
1532
1586
|
] }),
|
|
1533
|
-
/* @__PURE__ */
|
|
1587
|
+
/* @__PURE__ */ jsx13("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
|
|
1534
1588
|
] }),
|
|
1535
|
-
/* @__PURE__ */
|
|
1536
|
-
/* @__PURE__ */
|
|
1537
|
-
/* @__PURE__ */
|
|
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" } }) }),
|
|
1538
1592
|
"Along the stroke"
|
|
1539
1593
|
] }),
|
|
1540
|
-
/* @__PURE__ */
|
|
1541
|
-
/* @__PURE__ */
|
|
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 }) }),
|
|
1542
1596
|
"Live"
|
|
1543
1597
|
] })
|
|
1544
1598
|
] }),
|
|
1545
|
-
effectPaint.map && /* @__PURE__ */
|
|
1546
|
-
/* @__PURE__ */
|
|
1547
|
-
/* @__PURE__ */
|
|
1548
|
-
/* @__PURE__ */
|
|
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(
|
|
1549
1603
|
"input",
|
|
1550
1604
|
{
|
|
1551
1605
|
type: "number",
|
|
@@ -1559,55 +1613,55 @@ var PaintEffectsPanel = ({ controller, className }) => {
|
|
|
1559
1613
|
effectPaint.map.length
|
|
1560
1614
|
)
|
|
1561
1615
|
] }),
|
|
1562
|
-
/* @__PURE__ */
|
|
1563
|
-
/* @__PURE__ */
|
|
1564
|
-
/* @__PURE__ */
|
|
1565
|
-
/* @__PURE__ */
|
|
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" })
|
|
1566
1620
|
] })
|
|
1567
1621
|
] }),
|
|
1568
|
-
/* @__PURE__ */
|
|
1622
|
+
/* @__PURE__ */ jsx13(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
|
|
1569
1623
|
] }),
|
|
1570
|
-
animation && /* @__PURE__ */
|
|
1571
|
-
/* @__PURE__ */
|
|
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: [
|
|
1572
1626
|
"Live paint: ",
|
|
1573
1627
|
animation.strokes,
|
|
1574
1628
|
" ",
|
|
1575
1629
|
animation.strokes === 1 ? "stroke" : "strokes"
|
|
1576
1630
|
] }),
|
|
1577
|
-
/* @__PURE__ */
|
|
1578
|
-
/* @__PURE__ */
|
|
1579
|
-
/* @__PURE__ */
|
|
1580
|
-
/* @__PURE__ */
|
|
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" })
|
|
1581
1635
|
] })
|
|
1582
1636
|
] }),
|
|
1583
|
-
layerEffect && activeId && /* @__PURE__ */
|
|
1584
|
-
/* @__PURE__ */
|
|
1585
|
-
/* @__PURE__ */
|
|
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: [
|
|
1586
1640
|
"Layer: ",
|
|
1587
1641
|
layerEffect.name ?? layerEffect.effect
|
|
1588
1642
|
] }),
|
|
1589
|
-
/* @__PURE__ */
|
|
1643
|
+
/* @__PURE__ */ jsx13("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
|
|
1590
1644
|
] }),
|
|
1591
|
-
/* @__PURE__ */
|
|
1645
|
+
/* @__PURE__ */ jsx13(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
|
|
1592
1646
|
] }),
|
|
1593
|
-
/* @__PURE__ */
|
|
1647
|
+
/* @__PURE__ */ jsx13(ErrorLine, { error })
|
|
1594
1648
|
] });
|
|
1595
1649
|
};
|
|
1596
1650
|
|
|
1597
1651
|
// src/paint-editor/PaintEditor.tsx
|
|
1598
|
-
import { jsx as
|
|
1652
|
+
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1599
1653
|
var PAINT_CONTROLS = {
|
|
1600
1654
|
"mixing-pad": '[data-testid="mixing-pad"]',
|
|
1601
1655
|
lighting: '[data-testid="light-panel"]',
|
|
1602
1656
|
symmetry: '[aria-label="Symmetry"]'
|
|
1603
1657
|
};
|
|
1604
1658
|
var PaintEditor = ({ controller, fileName, height = 720, presence, className, playback, playbackId = "paint", onPlaybackReveal }) => {
|
|
1605
|
-
const [tool, setTool] =
|
|
1606
|
-
const [tab, setTab] =
|
|
1659
|
+
const [tool, setTool] = useState10("brush");
|
|
1660
|
+
const [tab, setTab] = useState10("color");
|
|
1607
1661
|
const tabRef = useRef7(tab);
|
|
1608
1662
|
tabRef.current = tab;
|
|
1609
1663
|
const rootRef = useRef7(null);
|
|
1610
|
-
const [ownPresence] =
|
|
1664
|
+
const [ownPresence] = useState10(() => new PaintPresence2());
|
|
1611
1665
|
const ambientPlayback = useAgentPlayback();
|
|
1612
1666
|
const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
|
|
1613
1667
|
const viewBox = () => {
|
|
@@ -1663,28 +1717,28 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, className, pl
|
|
|
1663
1717
|
const box = rootRef.current?.getBoundingClientRect();
|
|
1664
1718
|
return c && box ? { x: c.x - box.left, y: c.y - box.top } : p;
|
|
1665
1719
|
};
|
|
1666
|
-
const [error, setError] =
|
|
1720
|
+
const [error, setError] = useState10(null);
|
|
1667
1721
|
const effects = usePaintEffectsProvider(controller);
|
|
1668
1722
|
const tabs = effects ? ["color", "wet", "paper", "layers", "effects"] : ["color", "wet", "paper", "layers"];
|
|
1669
|
-
return /* @__PURE__ */
|
|
1670
|
-
playing && /* @__PURE__ */
|
|
1671
|
-
/* @__PURE__ */
|
|
1672
|
-
/* @__PURE__ */
|
|
1673
|
-
/* @__PURE__ */
|
|
1674
|
-
/* @__PURE__ */
|
|
1675
|
-
/* @__PURE__ */
|
|
1676
|
-
error && /* @__PURE__ */
|
|
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 })
|
|
1677
1731
|
] }),
|
|
1678
|
-
/* @__PURE__ */
|
|
1679
|
-
/* @__PURE__ */
|
|
1680
|
-
/* @__PURE__ */
|
|
1681
|
-
tab === "color" && /* @__PURE__ */
|
|
1682
|
-
tab === "wet" && /* @__PURE__ */
|
|
1683
|
-
tab === "paper" && /* @__PURE__ */
|
|
1684
|
-
tab === "layers" && /* @__PURE__ */
|
|
1685
|
-
tab === "layers" && /* @__PURE__ */
|
|
1686
|
-
tab === "layers" && /* @__PURE__ */
|
|
1687
|
-
tab === "effects" && effects && /* @__PURE__ */
|
|
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 })
|
|
1688
1742
|
] })
|
|
1689
1743
|
] })
|
|
1690
1744
|
] })
|
|
@@ -1703,6 +1757,7 @@ export {
|
|
|
1703
1757
|
PaintToolbar,
|
|
1704
1758
|
PaperPanel,
|
|
1705
1759
|
StickerPanel,
|
|
1760
|
+
StickerPicker,
|
|
1706
1761
|
StrokePanel,
|
|
1707
1762
|
WetPanel,
|
|
1708
1763
|
usePaintDirector,
|