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