@pixerate/editor-react 0.172.1 → 0.174.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{paint-editor → brushes}/BrushLibraryBrowser.d.cts +2 -2
- package/dist/{paint-editor → brushes}/BrushLibraryBrowser.d.ts +2 -2
- package/dist/brushes/index.cjs +102 -0
- package/dist/brushes/index.d.cts +2 -0
- package/dist/brushes/index.d.ts +2 -0
- package/dist/brushes/index.js +10 -0
- package/dist/brushes/useBrushLibrary.d.cts +7 -0
- package/dist/brushes/useBrushLibrary.d.ts +7 -0
- package/dist/canvas/index.cjs +7 -2
- package/dist/canvas/index.js +7 -2
- package/dist/canvas/useCanvasDraw.d.cts +4 -2
- package/dist/canvas/useCanvasDraw.d.ts +4 -2
- package/dist/canvas/useShapeBrushstroke.d.cts +6 -2
- package/dist/canvas/useShapeBrushstroke.d.ts +6 -2
- package/dist/chunk-62FMEDGG.js +54 -0
- package/dist/chunk-PQK2UMAY.js +23 -0
- package/dist/{chunk-NQ22NA7S.js → chunk-UR4KL7WE.js} +28 -0
- package/dist/image-editor/BrushOptionsBar.d.cts +2 -1
- package/dist/image-editor/BrushOptionsBar.d.ts +2 -1
- package/dist/image-editor/index.cjs +964 -869
- package/dist/image-editor/index.js +3 -1
- package/dist/index.cjs +1484 -1389
- package/dist/index.js +12 -10
- package/dist/paint-editor/PaintCanvas.d.cts +9 -1
- package/dist/paint-editor/PaintCanvas.d.ts +9 -1
- package/dist/paint-editor/PaintEditor.d.cts +3 -1
- package/dist/paint-editor/PaintEditor.d.ts +3 -1
- package/dist/paint-editor/index.cjs +77 -7
- package/dist/paint-editor/index.d.cts +1 -1
- package/dist/paint-editor/index.d.ts +1 -1
- package/dist/paint-editor/index.js +416 -389
- package/dist/paint-editor/usePaintEditor.d.cts +30 -1
- package/dist/paint-editor/usePaintEditor.d.ts +30 -1
- package/dist/vector/index.cjs +2 -2
- package/dist/vector/index.js +3 -4
- package/package.json +16 -3
|
@@ -18,10 +18,20 @@ import {
|
|
|
18
18
|
useAgentPlayback,
|
|
19
19
|
usePlaybackSurface
|
|
20
20
|
} from "../chunk-W5CMGX3I.js";
|
|
21
|
+
import {
|
|
22
|
+
BrushLibraryBrowser
|
|
23
|
+
} from "../chunk-62FMEDGG.js";
|
|
21
24
|
|
|
22
25
|
// src/paint-editor/usePaintEditor.ts
|
|
23
|
-
import { useEffect, useMemo, useState, useSyncExternalStore } from "react";
|
|
24
|
-
import {
|
|
26
|
+
import { useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
27
|
+
import {
|
|
28
|
+
PaintDirector,
|
|
29
|
+
PaintEditorController,
|
|
30
|
+
PaintPresence,
|
|
31
|
+
createPaintChangeFeed,
|
|
32
|
+
createPaintEditorDocument,
|
|
33
|
+
createPaintProposals
|
|
34
|
+
} from "@pixerate/editor/paint-editor";
|
|
25
35
|
function usePaintEditor(options = {}) {
|
|
26
36
|
const [controller] = useState(() => options instanceof PaintEditorController ? options : new PaintEditorController(options));
|
|
27
37
|
const state = usePaintEditorState(controller);
|
|
@@ -43,9 +53,30 @@ function usePaintDirector(controller, options = {}) {
|
|
|
43
53
|
});
|
|
44
54
|
return value;
|
|
45
55
|
}
|
|
56
|
+
function usePaintProposals(controller, options = {}) {
|
|
57
|
+
const [store] = useState(() => createPaintProposals({ ...options, controller }));
|
|
58
|
+
const state = useSyncExternalStore(store.subscribe, store.getState, store.getState);
|
|
59
|
+
return useMemo(() => ({ store, proposals: state.proposals, propose: store.propose, accept: store.accept, reject: store.reject, clear: store.clear }), [store, state]);
|
|
60
|
+
}
|
|
61
|
+
function usePaintChangeFeed(controller, options = {}) {
|
|
62
|
+
const onChange = useRef(options.onChange);
|
|
63
|
+
onChange.current = options.onChange;
|
|
64
|
+
const [last, setLast] = useState(null);
|
|
65
|
+
const [feed, setFeed] = useState(null);
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
const next = createPaintChangeFeed(controller);
|
|
68
|
+
next.subscribe((change) => {
|
|
69
|
+
setLast(change);
|
|
70
|
+
onChange.current?.(change);
|
|
71
|
+
});
|
|
72
|
+
setFeed(next);
|
|
73
|
+
return () => next.dispose();
|
|
74
|
+
}, [controller]);
|
|
75
|
+
return { feed, last };
|
|
76
|
+
}
|
|
46
77
|
|
|
47
78
|
// src/paint-editor/PaintCanvas.tsx
|
|
48
|
-
import { useEffect as useEffect2, useMemo as useMemo2, useRef, useState as useState2, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
79
|
+
import { useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2, useState as useState2, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
49
80
|
import {
|
|
50
81
|
PaintCanvasPresenter,
|
|
51
82
|
PaintGesture,
|
|
@@ -55,16 +86,17 @@ import {
|
|
|
55
86
|
fitZoom,
|
|
56
87
|
guideOverlay,
|
|
57
88
|
handlePaintShortcut,
|
|
58
|
-
viewCssTransform
|
|
89
|
+
viewCssTransform,
|
|
90
|
+
paintProposalGhost
|
|
59
91
|
} from "@pixerate/editor/paint-editor";
|
|
60
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
61
|
-
var PaintCanvas = ({ controller, tool = "brush", showGuides = true, fitOnMount = true, onError, presence, className }) => {
|
|
92
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
93
|
+
var PaintCanvas = ({ controller, tool = "brush", showGuides = true, fitOnMount = true, onError, presence, proposals, className }) => {
|
|
62
94
|
const state = usePaintEditorState(controller);
|
|
63
|
-
const viewport =
|
|
64
|
-
const canvas =
|
|
65
|
-
const water =
|
|
95
|
+
const viewport = useRef2(null);
|
|
96
|
+
const canvas = useRef2(null);
|
|
97
|
+
const water = useRef2(null);
|
|
66
98
|
const [size, setSize] = useState2({ width: 800, height: 600 });
|
|
67
|
-
const measured =
|
|
99
|
+
const measured = useRef2(false);
|
|
68
100
|
const [predicted, setPredicted] = useState2([]);
|
|
69
101
|
const [strokeDrag, setStrokeDrag] = useState2(null);
|
|
70
102
|
const presenter = useMemo2(() => new PaintCanvasPresenter(controller), [controller]);
|
|
@@ -90,7 +122,7 @@ var PaintCanvas = ({ controller, tool = "brush", showGuides = true, fitOnMount =
|
|
|
90
122
|
ro.observe(el);
|
|
91
123
|
return () => ro.disconnect();
|
|
92
124
|
}, []);
|
|
93
|
-
const fitted =
|
|
125
|
+
const fitted = useRef2(null);
|
|
94
126
|
useEffect2(() => {
|
|
95
127
|
const key = `${doc.width}x${doc.height}`;
|
|
96
128
|
if (!fitOnMount || fitted.current === key) return;
|
|
@@ -199,6 +231,7 @@ var PaintCanvas = ({ controller, tool = "brush", showGuides = true, fitOnMount =
|
|
|
199
231
|
predicted.length > 0 && /* @__PURE__ */ jsx("polyline", { points: predicted.map((p) => `${p.x},${p.y}`).join(" "), fill: "none", stroke: state.color, strokeOpacity: 0.5, strokeWidth: Math.max(1, state.brush.tip.size / 2), strokeLinecap: "round" })
|
|
200
232
|
] }),
|
|
201
233
|
state.guides.references.filter((r) => r.visible).map((r) => /* @__PURE__ */ jsx(ReferencePanel, { controller, id: r.id }, r.id)),
|
|
234
|
+
proposals && /* @__PURE__ */ jsx(PaintProposalGhosts, { proposals, transform, zoom: state.view.zoom }),
|
|
202
235
|
presence && /* @__PURE__ */ jsx(PaintPresenceLayer, { presence, view: state.view, canvas: doc, viewport: size }),
|
|
203
236
|
/* @__PURE__ */ jsxs("div", { className: "absolute bottom-1 right-2 text-[10px] text-slate-500 pointer-events-none", "data-testid": "paint-view-status", children: [
|
|
204
237
|
Math.round(state.view.zoom * 100),
|
|
@@ -224,7 +257,7 @@ var PaintPresenceLayer = ({ presence, view, canvas, viewport }) => {
|
|
|
224
257
|
var ReferencePanel = ({ controller, id }) => {
|
|
225
258
|
const state = usePaintEditorState(controller);
|
|
226
259
|
const ref = state.guides.references.find((r) => r.id === id);
|
|
227
|
-
const drag =
|
|
260
|
+
const drag = useRef2(null);
|
|
228
261
|
if (!ref) return null;
|
|
229
262
|
const h = ref.height / ref.width * ref.displayWidth;
|
|
230
263
|
return /* @__PURE__ */ jsxs(
|
|
@@ -274,19 +307,46 @@ var ReferencePanel = ({ controller, id }) => {
|
|
|
274
307
|
}
|
|
275
308
|
);
|
|
276
309
|
};
|
|
310
|
+
var PaintProposalGhosts = ({ proposals, transform, zoom }) => {
|
|
311
|
+
const { proposals: pending } = useSyncExternalStore2(proposals.subscribe, proposals.getState, proposals.getState);
|
|
312
|
+
return /* @__PURE__ */ jsx(Fragment, { children: pending.map((p) => /* @__PURE__ */ jsx(PaintProposalGhost, { proposal: p, transform, zoom }, p.id)) });
|
|
313
|
+
};
|
|
314
|
+
var PaintProposalGhost = ({ proposal, transform, zoom }) => {
|
|
315
|
+
const ref = useRef2(null);
|
|
316
|
+
const ghost = paintProposalGhost(proposal);
|
|
317
|
+
useEffect2(() => {
|
|
318
|
+
const ctx = ref.current?.getContext("2d");
|
|
319
|
+
if (!ctx || !ghost || typeof ImageData === "undefined") return;
|
|
320
|
+
ctx.putImageData(new ImageData(new Uint8ClampedArray(ghost.data), ghost.width, ghost.height), 0, 0);
|
|
321
|
+
}, [ghost?.data]);
|
|
322
|
+
if (!ghost) return null;
|
|
323
|
+
return /* @__PURE__ */ jsx(
|
|
324
|
+
"canvas",
|
|
325
|
+
{
|
|
326
|
+
ref,
|
|
327
|
+
width: ghost.width,
|
|
328
|
+
height: ghost.height,
|
|
329
|
+
"data-paint-proposal": proposal.id,
|
|
330
|
+
title: proposal.rationale ? `${proposal.title}: ${proposal.rationale}` : proposal.title,
|
|
331
|
+
"aria-label": `Suggested: ${proposal.title}`,
|
|
332
|
+
className: "absolute left-0 top-0 pointer-events-none",
|
|
333
|
+
style: { transform: `${transform} translate(${ghost.x}px, ${ghost.y}px)`, transformOrigin: "0 0", opacity: 0.7, outline: `${1.5 / zoom}px dashed #a78bfa`, outlineOffset: `${2 / zoom}px` }
|
|
334
|
+
}
|
|
335
|
+
);
|
|
336
|
+
};
|
|
277
337
|
|
|
278
338
|
// src/paint-editor/PaintToolbar.tsx
|
|
279
|
-
import { useRef as
|
|
339
|
+
import { useRef as useRef4, useState as useState4 } from "react";
|
|
280
340
|
import { PAINT_TOOLS, SYMMETRY_MODES, decodeImageBlob, downloadBytes, quickStencil, timeLapseZip } from "@pixerate/editor/paint-editor";
|
|
281
341
|
|
|
282
342
|
// src/paint-editor/shared.tsx
|
|
283
|
-
import { useEffect as useEffect3, useRef as
|
|
343
|
+
import { useEffect as useEffect3, useRef as useRef3, useState as useState3 } from "react";
|
|
284
344
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
285
345
|
var chip = (on) => `px-2 py-1 rounded text-[11px] ${on ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300 hover:text-white"}`;
|
|
286
346
|
var button = "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700 disabled:opacity-40";
|
|
287
347
|
var panel = "flex flex-col gap-2 text-xs text-slate-200";
|
|
288
348
|
var PixelCanvas = ({ pixels, label, className, style }) => {
|
|
289
|
-
const ref =
|
|
349
|
+
const ref = useRef3(null);
|
|
290
350
|
useEffect3(() => {
|
|
291
351
|
const canvas = ref.current;
|
|
292
352
|
const ctx = canvas?.getContext("2d");
|
|
@@ -302,8 +362,8 @@ var PixelCanvas = ({ pixels, label, className, style }) => {
|
|
|
302
362
|
var fmt = (c, v) => c.step >= 1 ? String(Math.round(v)) : v.toFixed(2);
|
|
303
363
|
var PaintSlider = ({ control, value, onChange, onCommit }) => {
|
|
304
364
|
const [draft, setDraft] = useState3(null);
|
|
305
|
-
const ref =
|
|
306
|
-
const commit =
|
|
365
|
+
const ref = useRef3(null);
|
|
366
|
+
const commit = useRef3(onCommit);
|
|
307
367
|
commit.current = onCommit;
|
|
308
368
|
useEffect3(() => {
|
|
309
369
|
const el = ref.current;
|
|
@@ -356,8 +416,8 @@ function useAttempt() {
|
|
|
356
416
|
}
|
|
357
417
|
var ErrorLine = ({ error }) => error ? /* @__PURE__ */ jsx2("p", { role: "alert", className: "text-[11px] text-rose-400", children: error }) : null;
|
|
358
418
|
var CommitColorInput = ({ value, label, onCommit, className }) => {
|
|
359
|
-
const ref =
|
|
360
|
-
const commit =
|
|
419
|
+
const ref = useRef3(null);
|
|
420
|
+
const commit = useRef3(onCommit);
|
|
361
421
|
commit.current = onCommit;
|
|
362
422
|
useEffect3(() => {
|
|
363
423
|
const el = ref.current;
|
|
@@ -370,15 +430,15 @@ var CommitColorInput = ({ value, label, onCommit, className }) => {
|
|
|
370
430
|
};
|
|
371
431
|
|
|
372
432
|
// src/paint-editor/PaintToolbar.tsx
|
|
373
|
-
import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
433
|
+
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
374
434
|
var PaintToolbar = ({ controller, tool, onToolChange, fileName = "painting", className }) => {
|
|
375
435
|
const state = usePaintEditorState(controller);
|
|
376
436
|
const [error, attempt] = useAttempt();
|
|
377
437
|
const [busy, setBusy] = useState4(null);
|
|
378
438
|
const [note, setNote] = useState4(null);
|
|
379
|
-
const openRef =
|
|
380
|
-
const tracingRef =
|
|
381
|
-
const refRef =
|
|
439
|
+
const openRef = useRef4(null);
|
|
440
|
+
const tracingRef = useRef4(null);
|
|
441
|
+
const refRef = useRef4(null);
|
|
382
442
|
const { symmetry, perspective, tracing } = state.guides;
|
|
383
443
|
const { canvas } = state.document;
|
|
384
444
|
const exportImage = (format) => attempt(async () => downloadBytes(await controller.exportImage({ format }), `${fileName}.${format === "image/png" ? "png" : "jpg"}`, format));
|
|
@@ -453,7 +513,7 @@ var PaintToolbar = ({ controller, tool, onToolChange, fileName = "painting", cla
|
|
|
453
513
|
),
|
|
454
514
|
/* @__PURE__ */ jsx3("span", { className: "mx-1 h-4 w-px bg-slate-700" }),
|
|
455
515
|
/* @__PURE__ */ jsx3("button", { type: "button", className: button, onClick: () => tracingRef.current?.click(), children: "Tracing image\u2026" }),
|
|
456
|
-
tracing && /* @__PURE__ */ jsxs3(
|
|
516
|
+
tracing && /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
457
517
|
/* @__PURE__ */ jsx3(
|
|
458
518
|
"input",
|
|
459
519
|
{
|
|
@@ -574,7 +634,7 @@ var PaintToolbar = ({ controller, tool, onToolChange, fileName = "painting", cla
|
|
|
574
634
|
};
|
|
575
635
|
|
|
576
636
|
// src/paint-editor/BrushPanel.tsx
|
|
577
|
-
import { useMemo as
|
|
637
|
+
import { useMemo as useMemo4, useRef as useRef5 } from "react";
|
|
578
638
|
import { brushLoadColor, brushTakesPaint, downloadBytes as downloadBytes2, toggleStickerRef, DEFAULT_PAINT_GRADIENT } from "@pixerate/editor/paint-editor";
|
|
579
639
|
import { PAINT_PROFILE as PAINT_PROFILE2 } from "@pixerate/editor/brushes";
|
|
580
640
|
|
|
@@ -668,62 +728,26 @@ var EditorControl = ({ control: c, onSet }) => {
|
|
|
668
728
|
}
|
|
669
729
|
};
|
|
670
730
|
|
|
671
|
-
// src/paint-editor/BrushLibraryBrowser.tsx
|
|
672
|
-
import { useMemo as useMemo4, useState as useState6 } from "react";
|
|
673
|
-
import { brushLibraryGroups } from "@pixerate/editor/brushes";
|
|
674
|
-
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
675
|
-
var BrushLibraryBrowser = ({ entries, activeId, onSelect, profile, thumbnail, thumbnailWidth = 112, thumbnailHeight = 32, className }) => {
|
|
676
|
-
const [text, setText] = useState6("");
|
|
677
|
-
const groups = useMemo4(() => brushLibraryGroups(entries, { text, profile }), [entries, text, profile]);
|
|
678
|
-
return /* @__PURE__ */ jsxs5("div", { className: `flex flex-col gap-1 ${className ?? ""}`, "data-testid": "brush-library", children: [
|
|
679
|
-
/* @__PURE__ */ jsx5("input", { type: "search", value: text, placeholder: "Find a brush", "aria-label": "Find a brush", onChange: (e) => setText(e.target.value), className: "rounded bg-slate-800 px-1.5 py-0.5" }),
|
|
680
|
-
/* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-1.5", role: "listbox", "aria-label": "Brushes", children: [
|
|
681
|
-
groups.map((g) => /* @__PURE__ */ jsxs5("div", { role: "group", "aria-label": g.title, className: "flex flex-col gap-0.5", children: [
|
|
682
|
-
/* @__PURE__ */ jsx5("span", { className: "text-[10px] uppercase tracking-wide text-slate-500", children: g.title }),
|
|
683
|
-
/* @__PURE__ */ jsx5("div", { className: "grid grid-cols-2 gap-1", children: g.varieties.flatMap(
|
|
684
|
-
(v) => v.entries.map((e) => /* @__PURE__ */ jsxs5(
|
|
685
|
-
"button",
|
|
686
|
-
{
|
|
687
|
-
type: "button",
|
|
688
|
-
role: "option",
|
|
689
|
-
"aria-selected": activeId === e.brush.id,
|
|
690
|
-
title: [e.brush.name, v.title.toLowerCase() === e.brush.name.toLowerCase() ? "" : v.title, e.builtin ? "" : "saved"].filter(Boolean).join(" \xB7 "),
|
|
691
|
-
className: `flex flex-col items-start gap-0.5 rounded p-1 text-left ${activeId === e.brush.id ? "bg-indigo-600/30 ring-1 ring-indigo-500" : "bg-slate-900 hover:bg-slate-800"}`,
|
|
692
|
-
onClick: () => onSelect(e.brush.id),
|
|
693
|
-
children: [
|
|
694
|
-
thumbnail && /* @__PURE__ */ jsx5(PixelCanvas, { pixels: thumbnail(e.brush.id), label: `${e.brush.name} thumbnail`, className: "rounded", style: { width: "100%", aspectRatio: `${thumbnailWidth} / ${thumbnailHeight}` } }),
|
|
695
|
-
/* @__PURE__ */ jsx5("span", { className: "truncate text-[10px] text-slate-300", children: e.brush.name })
|
|
696
|
-
]
|
|
697
|
-
},
|
|
698
|
-
e.brush.id
|
|
699
|
-
))
|
|
700
|
-
) })
|
|
701
|
-
] }, g.id)),
|
|
702
|
-
!groups.length && /* @__PURE__ */ jsx5("span", { className: "text-slate-500", children: "No brush matches." })
|
|
703
|
-
] })
|
|
704
|
-
] });
|
|
705
|
-
};
|
|
706
|
-
|
|
707
731
|
// src/paint-editor/PaintGradientEditor.tsx
|
|
708
732
|
import { PAINT_GRADIENT_KIT } from "@pixerate/editor/paint-editor";
|
|
709
|
-
import { jsx as
|
|
710
|
-
var PaintGradientEditor = (props) => /* @__PURE__ */
|
|
733
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
734
|
+
var PaintGradientEditor = (props) => /* @__PURE__ */ jsx5(PaintGradientEditorView, { ...props, kit: PAINT_GRADIENT_KIT });
|
|
711
735
|
|
|
712
736
|
// src/paint-editor/StickerPicker.tsx
|
|
713
|
-
import { useEffect as useEffect4, useState as
|
|
714
|
-
import { jsx as
|
|
737
|
+
import { useEffect as useEffect4, useState as useState6 } from "react";
|
|
738
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
715
739
|
var StickerPicker = ({ controller, selected, onPick, label = "Stickers" }) => {
|
|
716
|
-
const [provider, setProvider] =
|
|
740
|
+
const [provider, setProvider] = useState6(() => controller.stickersProvider);
|
|
717
741
|
useEffect4(() => controller.stickers.subscribe(setProvider), [controller]);
|
|
718
742
|
const failed = selected.map((ref) => ({ ref, ...controller.stickerArtStatus(ref) })).filter((x) => x.status === "failed");
|
|
719
|
-
return /* @__PURE__ */
|
|
743
|
+
return /* @__PURE__ */ jsx6(
|
|
720
744
|
StickerLibraryPicker,
|
|
721
745
|
{
|
|
722
746
|
provider,
|
|
723
747
|
selected,
|
|
724
748
|
label,
|
|
725
749
|
onPick: (it) => onPick(it.ref),
|
|
726
|
-
footer: failed.map((f) => /* @__PURE__ */
|
|
750
|
+
footer: failed.map((f) => /* @__PURE__ */ jsxs5("p", { role: "alert", className: "text-[11px] text-rose-400", children: [
|
|
727
751
|
f.ref,
|
|
728
752
|
": ",
|
|
729
753
|
f.error
|
|
@@ -733,29 +757,29 @@ var StickerPicker = ({ controller, selected, onPick, label = "Stickers" }) => {
|
|
|
733
757
|
};
|
|
734
758
|
|
|
735
759
|
// src/paint-editor/BrushPanel.tsx
|
|
736
|
-
import { jsx as
|
|
760
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
737
761
|
var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, className }) => {
|
|
738
762
|
const state = usePaintEditorState(controller);
|
|
739
763
|
const [error, attempt] = useAttempt();
|
|
740
|
-
const fileRef =
|
|
764
|
+
const fileRef = useRef5(null);
|
|
741
765
|
const { brush, brushes } = state;
|
|
742
766
|
const paper = state.document.paper;
|
|
743
|
-
const thumbs =
|
|
767
|
+
const thumbs = useMemo4(
|
|
744
768
|
() => new Map(brushes.map((b) => [b.id, controller.brushThumbnail(b.id, { width: thumbnailWidth, height: thumbnailHeight, color: "#26324a" })])),
|
|
745
769
|
// Thumbnails follow the library and the paper.
|
|
746
770
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
747
771
|
[controller, brushes, paper, thumbnailWidth, thumbnailHeight]
|
|
748
772
|
);
|
|
749
|
-
const entries =
|
|
750
|
-
const spec =
|
|
773
|
+
const entries = useMemo4(() => brushes.map((b) => ({ brush: controller.getBrushSpec(b.id), builtin: Boolean(b.builtin) })), [controller, brushes]);
|
|
774
|
+
const spec = useMemo4(() => controller.getBrushSpec(), [controller, brush]);
|
|
751
775
|
const own = typeof spec.colour?.default === "string" && /^#[0-9a-f]{6}/i.test(spec.colour.default) ? spec.colour.default.slice(0, 7) : void 0;
|
|
752
|
-
const preview =
|
|
776
|
+
const preview = useMemo4(() => controller.brushThumbnail(brush.id, { width: 240, height: 64, color: own }), [controller, brush, paper, state.color, own]);
|
|
753
777
|
const carried = brushLoadColor(state.mixerLoad);
|
|
754
778
|
const slug = (name) => name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || "brush";
|
|
755
779
|
const loads = ["dab", "mixer", "impasto"].includes(brush.engine) || brush.engine === "wet" && brush.wet.tool === "paint";
|
|
756
|
-
return /* @__PURE__ */
|
|
757
|
-
/* @__PURE__ */
|
|
758
|
-
/* @__PURE__ */
|
|
780
|
+
return /* @__PURE__ */ jsxs6("div", { className: `${panel} ${className ?? ""}`, "data-testid": "brush-panel", children: [
|
|
781
|
+
/* @__PURE__ */ jsx7(BrushLibraryBrowser, { entries, activeId: brush.id, onSelect: (id) => controller.setBrush({ id }), thumbnail: (id) => thumbs.get(id) ?? null, thumbnailWidth, thumbnailHeight }),
|
|
782
|
+
/* @__PURE__ */ jsx7(
|
|
759
783
|
BrushEditor,
|
|
760
784
|
{
|
|
761
785
|
brush: spec,
|
|
@@ -765,30 +789,30 @@ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, clas
|
|
|
765
789
|
onSaveAs: (name) => controller.saveBrush({ id: slug(name), name }),
|
|
766
790
|
renderExtra: (section) => {
|
|
767
791
|
if (section === "shape" && brush.engine === "sticker")
|
|
768
|
-
return /* @__PURE__ */
|
|
792
|
+
return /* @__PURE__ */ jsx7(StickerPicker, { controller, label: "Sticker stamps", selected: brush.sticker.stamps, onPick: (ref) => controller.setBrush({ sticker: { stamps: toggleStickerRef(brush.sticker.stamps, ref) } }) });
|
|
769
793
|
if (section === "behaviour" && loads)
|
|
770
|
-
return /* @__PURE__ */
|
|
771
|
-
/* @__PURE__ */
|
|
772
|
-
/* @__PURE__ */
|
|
773
|
-
brush.engine === "mixer" && /* @__PURE__ */
|
|
774
|
-
/* @__PURE__ */
|
|
794
|
+
return /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1", children: [
|
|
795
|
+
/* @__PURE__ */ jsx7("span", { className: "text-slate-400", children: "Carries" }),
|
|
796
|
+
/* @__PURE__ */ jsx7("span", { "aria-label": "Brush load", title: carried ?? "Clean", className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: carried ?? "transparent" } }),
|
|
797
|
+
brush.engine === "mixer" && /* @__PURE__ */ jsx7("button", { type: "button", className: button, onClick: () => controller.loadMixerBrush(), children: "Load" }),
|
|
798
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: button, onClick: () => controller.cleanMixerBrush(brush.engine === "mixer"), children: "Clean" })
|
|
775
799
|
] });
|
|
776
800
|
if (section === "colour" && brushTakesPaint(brush))
|
|
777
|
-
return /* @__PURE__ */
|
|
778
|
-
/* @__PURE__ */
|
|
779
|
-
/* @__PURE__ */
|
|
780
|
-
/* @__PURE__ */
|
|
801
|
+
return /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-1.5", "data-testid": "brush-gradient", children: [
|
|
802
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-2", children: [
|
|
803
|
+
/* @__PURE__ */ jsx7("span", { className: "text-slate-400", title: "A gradient of the brush's own, used instead of the paint (the multi-colour brush)", children: "Brush gradient" }),
|
|
804
|
+
/* @__PURE__ */ jsx7("button", { type: "button", "aria-pressed": brush.paint !== null, className: chip(brush.paint !== null), onClick: () => attempt(() => controller.setBrush({ paint: brush.paint ? null : DEFAULT_PAINT_GRADIENT })), children: brush.paint ? "On" : "Off" })
|
|
781
805
|
] }),
|
|
782
|
-
brush.paint && /* @__PURE__ */
|
|
806
|
+
brush.paint && /* @__PURE__ */ jsx7(PaintGradientEditor, { value: brush.paint, colors: { paint: state.color, secondary: state.secondaryColor }, onChange: (g) => attempt(() => controller.setBrush({ paint: g })) })
|
|
783
807
|
] });
|
|
784
808
|
return null;
|
|
785
809
|
}
|
|
786
810
|
}
|
|
787
811
|
),
|
|
788
|
-
/* @__PURE__ */
|
|
789
|
-
/* @__PURE__ */
|
|
790
|
-
/* @__PURE__ */
|
|
791
|
-
/* @__PURE__ */
|
|
812
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
813
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: button, onClick: () => attempt(async () => downloadBytes2(JSON.stringify(await controller.exportBrushes(), null, 2), "brushes.json", "application/json")), children: "Export" }),
|
|
814
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: button, onClick: () => fileRef.current?.click(), children: "Import\u2026" }),
|
|
815
|
+
/* @__PURE__ */ jsx7(
|
|
792
816
|
"input",
|
|
793
817
|
{
|
|
794
818
|
ref: fileRef,
|
|
@@ -804,24 +828,24 @@ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, clas
|
|
|
804
828
|
}
|
|
805
829
|
)
|
|
806
830
|
] }),
|
|
807
|
-
/* @__PURE__ */
|
|
831
|
+
/* @__PURE__ */ jsx7(ErrorLine, { error })
|
|
808
832
|
] });
|
|
809
833
|
};
|
|
810
834
|
|
|
811
835
|
// src/paint-editor/PaperPanel.tsx
|
|
812
|
-
import { useMemo as
|
|
836
|
+
import { useMemo as useMemo5 } from "react";
|
|
813
837
|
import { DEFAULT_BACKLIGHT_COLOR, LIGHT_SLIDERS, PAPER_FAMILIES, PAPER_LIBRARY, PAPER_SLIDERS, patchPath, readPath, renderPaper } from "@pixerate/editor/paint-editor";
|
|
814
|
-
import { jsx as
|
|
838
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
815
839
|
var SWATCH = { x: 0, y: 0, width: 64, height: 40 };
|
|
816
840
|
var PaperPanel = ({ controller, className }) => {
|
|
817
841
|
const state = usePaintEditorState(controller);
|
|
818
842
|
const [error, attempt] = useAttempt();
|
|
819
843
|
const paper = state.document.paper;
|
|
820
|
-
const previews =
|
|
821
|
-
return /* @__PURE__ */
|
|
822
|
-
PAPER_FAMILIES.map((family) => /* @__PURE__ */
|
|
823
|
-
/* @__PURE__ */
|
|
824
|
-
/* @__PURE__ */
|
|
844
|
+
const previews = useMemo5(() => new Map(PAPER_LIBRARY.map((p) => [p.preset, { ...SWATCH, data: renderPaper({ ...p, shading: Math.max(0.8, p.shading) }, SWATCH) }])), []);
|
|
845
|
+
return /* @__PURE__ */ jsxs7("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paper-panel", children: [
|
|
846
|
+
PAPER_FAMILIES.map((family) => /* @__PURE__ */ jsxs7("div", { children: [
|
|
847
|
+
/* @__PURE__ */ jsx8("div", { className: "mb-0.5 text-[10px] uppercase tracking-wide text-slate-500", children: family }),
|
|
848
|
+
/* @__PURE__ */ jsx8("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": `${family} papers`, children: PAPER_LIBRARY.filter((p) => p.family === family).map((p) => /* @__PURE__ */ jsx8(
|
|
825
849
|
"button",
|
|
826
850
|
{
|
|
827
851
|
type: "button",
|
|
@@ -830,37 +854,37 @@ var PaperPanel = ({ controller, className }) => {
|
|
|
830
854
|
title: p.name,
|
|
831
855
|
className: `rounded p-0.5 ${paper.preset === p.preset ? "ring-2 ring-indigo-500" : "ring-1 ring-slate-700 hover:ring-slate-500"}`,
|
|
832
856
|
onClick: () => attempt(() => controller.setPaper({ preset: p.preset })),
|
|
833
|
-
children: /* @__PURE__ */
|
|
857
|
+
children: /* @__PURE__ */ jsx8(PixelCanvas, { pixels: previews.get(p.preset) ?? null, label: p.name, style: { width: 48, height: 30 } })
|
|
834
858
|
},
|
|
835
859
|
p.preset
|
|
836
860
|
)) })
|
|
837
861
|
] }, family)),
|
|
838
|
-
/* @__PURE__ */
|
|
839
|
-
/* @__PURE__ */
|
|
840
|
-
/* @__PURE__ */
|
|
841
|
-
/* @__PURE__ */
|
|
862
|
+
/* @__PURE__ */ jsx8("div", { className: "text-slate-300", children: paper.name }),
|
|
863
|
+
/* @__PURE__ */ jsxs7("label", { className: "flex items-center justify-between", children: [
|
|
864
|
+
/* @__PURE__ */ jsx8("span", { className: "text-slate-400", children: "Colour" }),
|
|
865
|
+
/* @__PURE__ */ jsx8(CommitColorInput, { label: "Paper colour", value: paper.color, onCommit: (v) => attempt(() => controller.setPaper({ color: v })), className: "h-6 w-10 rounded bg-transparent" })
|
|
842
866
|
] }),
|
|
843
|
-
PAPER_SLIDERS.map((c) => /* @__PURE__ */
|
|
844
|
-
/* @__PURE__ */
|
|
845
|
-
/* @__PURE__ */
|
|
846
|
-
/* @__PURE__ */
|
|
867
|
+
PAPER_SLIDERS.map((c) => /* @__PURE__ */ jsx8(PaintSlider, { control: c, value: readPath(paper, c.path), onCommit: (v) => attempt(() => controller.setPaper(patchPath(paper, c.path, v))) }, c.path)),
|
|
868
|
+
/* @__PURE__ */ jsxs7("label", { className: "flex items-center justify-between", children: [
|
|
869
|
+
/* @__PURE__ */ jsx8("span", { className: "text-slate-400", children: "Backlight colour" }),
|
|
870
|
+
/* @__PURE__ */ jsx8(CommitColorInput, { label: "Backlight colour", value: paper.backlightColor ?? DEFAULT_BACKLIGHT_COLOR, onCommit: (v) => attempt(() => controller.setPaper({ backlightColor: v })), className: "h-6 w-10 rounded bg-transparent" })
|
|
847
871
|
] }),
|
|
848
|
-
/* @__PURE__ */
|
|
849
|
-
/* @__PURE__ */
|
|
872
|
+
/* @__PURE__ */ jsxs7("label", { className: "flex items-center gap-2", children: [
|
|
873
|
+
/* @__PURE__ */ jsx8("input", { type: "checkbox", checked: paper.tiling === "mirror", onChange: (e) => attempt(() => controller.setPaper({ tiling: e.target.checked ? "mirror" : "repeat" })) }),
|
|
850
874
|
" Mirror tiling"
|
|
851
875
|
] }),
|
|
852
|
-
/* @__PURE__ */
|
|
853
|
-
/* @__PURE__ */
|
|
854
|
-
/* @__PURE__ */
|
|
855
|
-
LIGHT_SLIDERS.map((c) => /* @__PURE__ */
|
|
856
|
-
/* @__PURE__ */
|
|
876
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: "self-start px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.setPaper({ seed: paper.seed + 1 })), children: "New sheet" }),
|
|
877
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-1.5", "data-testid": "light-panel", children: [
|
|
878
|
+
/* @__PURE__ */ jsx8("span", { className: "font-medium text-slate-300", children: "Light (thick paint, metallic paper)" }),
|
|
879
|
+
LIGHT_SLIDERS.map((c) => /* @__PURE__ */ jsx8(PaintSlider, { control: c, value: readPath(controller.getLighting(), c.path), onChange: (v) => attempt(() => controller.setLighting({ [c.path]: v })) }, c.path)),
|
|
880
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: "self-start px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.flattenRelief()), children: "Flatten relief" })
|
|
857
881
|
] }),
|
|
858
|
-
/* @__PURE__ */
|
|
882
|
+
/* @__PURE__ */ jsx8(ErrorLine, { error })
|
|
859
883
|
] });
|
|
860
884
|
};
|
|
861
885
|
|
|
862
886
|
// src/paint-editor/ColorPanel.tsx
|
|
863
|
-
import { useMemo as
|
|
887
|
+
import { useMemo as useMemo6, useRef as useRef6, useState as useState7 } from "react";
|
|
864
888
|
import {
|
|
865
889
|
HARMONY_KINDS,
|
|
866
890
|
MIXING_PAD_HEIGHT,
|
|
@@ -877,24 +901,24 @@ import {
|
|
|
877
901
|
wheelPoint
|
|
878
902
|
} from "@pixerate/editor/paint-editor";
|
|
879
903
|
import { DEFAULT_PAINT_GRADIENT as DEFAULT_PAINT_GRADIENT2, paintSourceCss } from "@pixerate/editor/paint-editor";
|
|
880
|
-
import { jsx as
|
|
904
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
881
905
|
var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className }) => {
|
|
882
906
|
const state = usePaintEditorState(controller);
|
|
883
907
|
const [error, attempt] = useAttempt();
|
|
884
|
-
const [wheel, setWheel] =
|
|
885
|
-
const [kind, setKind] =
|
|
886
|
-
const [padTool, setPadTool] =
|
|
887
|
-
const [sample, setSample] =
|
|
888
|
-
const [parts, setParts] =
|
|
889
|
-
const [padName, setPadName] =
|
|
890
|
-
const padPoints =
|
|
891
|
-
const ring =
|
|
908
|
+
const [wheel, setWheel] = useState7("ryb");
|
|
909
|
+
const [kind, setKind] = useState7("complementary");
|
|
910
|
+
const [padTool, setPadTool] = useState7("paint");
|
|
911
|
+
const [sample, setSample] = useState7(3);
|
|
912
|
+
const [parts, setParts] = useState7([1, 1]);
|
|
913
|
+
const [padName, setPadName] = useState7("");
|
|
914
|
+
const padPoints = useRef6(null);
|
|
915
|
+
const ring = useMemo6(() => renderColorWheel(wheelSize, wheel), [wheelSize, wheel]);
|
|
892
916
|
const color = state.color;
|
|
893
|
-
const harmony =
|
|
917
|
+
const harmony = useMemo6(() => controller.harmony(kind, { color, wheel }), [controller, kind, color, wheel]);
|
|
894
918
|
const [r, g, b] = parseHexColor(color);
|
|
895
919
|
const hsv = rgbToHsv(r, g, b);
|
|
896
|
-
const effectWell =
|
|
897
|
-
const pad =
|
|
920
|
+
const effectWell = useMemo6(() => state.effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(64) : null, [controller, state.effectPaint, state.effectPaintRendering]);
|
|
921
|
+
const pad = useMemo6(() => ({ width: MIXING_PAD_WIDTH, height: MIXING_PAD_HEIGHT, data: controller.mixingPad.pixels() }), [controller, state.mixingPadVersion]);
|
|
898
922
|
const R = wheelSize / 2;
|
|
899
923
|
const mid = R * 0.82;
|
|
900
924
|
const setHsv = (s, v) => controller.setColor(rgbToHexColor(...hsvToRgb(hsv.h, s, v)));
|
|
@@ -906,9 +930,9 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
|
|
|
906
930
|
const y = Math.min(MIXING_PAD_HEIGHT, Math.max(0, (e.clientY - rect.top) * ky));
|
|
907
931
|
return e.pointerType === "pen" && e.pressure > 0 ? { x, y, pressure: e.pressure } : { x, y };
|
|
908
932
|
};
|
|
909
|
-
return /* @__PURE__ */
|
|
910
|
-
/* @__PURE__ */
|
|
911
|
-
/* @__PURE__ */
|
|
933
|
+
return /* @__PURE__ */ jsxs8("div", { className: `${panel} ${className ?? ""}`, "data-testid": "color-panel", children: [
|
|
934
|
+
/* @__PURE__ */ jsxs8("div", { className: "relative self-center", style: { width: wheelSize, height: wheelSize }, children: [
|
|
935
|
+
/* @__PURE__ */ jsx9(
|
|
912
936
|
"div",
|
|
913
937
|
{
|
|
914
938
|
role: "slider",
|
|
@@ -922,20 +946,20 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
|
|
|
922
946
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
923
947
|
controller.setColor(wheelPick(e.clientX - rect.left - R, e.clientY - rect.top - R, wheel, color));
|
|
924
948
|
},
|
|
925
|
-
children: /* @__PURE__ */
|
|
949
|
+
children: /* @__PURE__ */ jsx9(PixelCanvas, { pixels: ring, label: "Colour wheel", style: { width: wheelSize, height: wheelSize } })
|
|
926
950
|
}
|
|
927
951
|
),
|
|
928
|
-
/* @__PURE__ */
|
|
952
|
+
/* @__PURE__ */ jsx9("svg", { className: "pointer-events-none absolute inset-0", width: wheelSize, height: wheelSize, "aria-hidden": "true", children: harmony.map((h, i) => {
|
|
929
953
|
const p = wheelPoint(h.angle, mid);
|
|
930
|
-
return /* @__PURE__ */
|
|
954
|
+
return /* @__PURE__ */ jsx9("circle", { cx: R + p.x, cy: R + p.y, r: i === 0 ? 7 : 5, fill: h.color, stroke: "#fff", strokeWidth: i === 0 ? 2 : 1 }, i);
|
|
931
955
|
}) }),
|
|
932
|
-
/* @__PURE__ */
|
|
956
|
+
/* @__PURE__ */ jsx9("div", { className: "absolute rounded-full border border-slate-700", style: { left: R - R * 0.45, top: R - R * 0.45, width: R * 0.9, height: R * 0.9, background: color } })
|
|
933
957
|
] }),
|
|
934
|
-
/* @__PURE__ */
|
|
935
|
-
/* @__PURE__ */
|
|
936
|
-
/* @__PURE__ */
|
|
937
|
-
/* @__PURE__ */
|
|
938
|
-
/* @__PURE__ */
|
|
958
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
|
|
959
|
+
/* @__PURE__ */ jsx9("input", { type: "color", "aria-label": "Paint colour", value: color, onChange: (e) => controller.setColor(e.target.value), className: "h-7 w-9 rounded bg-transparent" }),
|
|
960
|
+
/* @__PURE__ */ jsx9("input", { type: "color", "aria-label": "Second colour", value: state.secondaryColor, onChange: (e) => controller.setSecondaryColor(e.target.value), className: "h-5 w-7 rounded bg-transparent" }),
|
|
961
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: button, title: "Swap colours (X)", onClick: () => controller.swapColors(), children: "Swap" }),
|
|
962
|
+
/* @__PURE__ */ jsx9(
|
|
939
963
|
"input",
|
|
940
964
|
{
|
|
941
965
|
"aria-label": "Hex colour",
|
|
@@ -946,8 +970,8 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
|
|
|
946
970
|
color
|
|
947
971
|
)
|
|
948
972
|
] }),
|
|
949
|
-
/* @__PURE__ */
|
|
950
|
-
/* @__PURE__ */
|
|
973
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", "data-testid": "paint-source", children: [
|
|
974
|
+
/* @__PURE__ */ jsx9(
|
|
951
975
|
"span",
|
|
952
976
|
{
|
|
953
977
|
className: "h-5 flex-1 rounded ring-1 ring-slate-700",
|
|
@@ -957,7 +981,7 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
|
|
|
957
981
|
style: { background: effectWell ? `center / cover no-repeat url("${effectWell}")` : paintSourceCss(state.paint, { paint: color, secondary: state.secondaryColor }) }
|
|
958
982
|
}
|
|
959
983
|
),
|
|
960
|
-
/* @__PURE__ */
|
|
984
|
+
/* @__PURE__ */ jsx9(
|
|
961
985
|
"button",
|
|
962
986
|
{
|
|
963
987
|
type: "button",
|
|
@@ -969,26 +993,26 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
|
|
|
969
993
|
}
|
|
970
994
|
)
|
|
971
995
|
] }),
|
|
972
|
-
state.paint.type === "gradient" && /* @__PURE__ */
|
|
973
|
-
/* @__PURE__ */
|
|
974
|
-
/* @__PURE__ */
|
|
975
|
-
/* @__PURE__ */
|
|
996
|
+
state.paint.type === "gradient" && /* @__PURE__ */ jsx9(PaintGradientEditor, { value: state.paint, colors: { paint: color, secondary: state.secondaryColor }, onChange: (g2) => attempt(() => controller.setPaint(g2)) }),
|
|
997
|
+
/* @__PURE__ */ jsxs8("label", { className: "flex items-center gap-2", children: [
|
|
998
|
+
/* @__PURE__ */ jsx9("span", { className: "w-16 text-slate-400", children: "Saturation" }),
|
|
999
|
+
/* @__PURE__ */ jsx9("input", { type: "range", "aria-label": "Saturation", min: 0, max: 1, step: 0.01, value: hsv.s, onChange: (e) => setHsv(Number(e.target.value), hsv.v), className: "flex-1 accent-indigo-500" })
|
|
976
1000
|
] }),
|
|
977
|
-
/* @__PURE__ */
|
|
978
|
-
/* @__PURE__ */
|
|
979
|
-
/* @__PURE__ */
|
|
1001
|
+
/* @__PURE__ */ jsxs8("label", { className: "flex items-center gap-2", children: [
|
|
1002
|
+
/* @__PURE__ */ jsx9("span", { className: "w-16 text-slate-400", children: "Value" }),
|
|
1003
|
+
/* @__PURE__ */ jsx9("input", { type: "range", "aria-label": "Value", min: 0, max: 1, step: 0.01, value: hsv.v, onChange: (e) => setHsv(hsv.s, Number(e.target.value)), className: "flex-1 accent-indigo-500" })
|
|
980
1004
|
] }),
|
|
981
|
-
/* @__PURE__ */
|
|
982
|
-
/* @__PURE__ */
|
|
983
|
-
/* @__PURE__ */
|
|
984
|
-
/* @__PURE__ */
|
|
1005
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-1", children: [
|
|
1006
|
+
/* @__PURE__ */ jsx9("select", { "aria-label": "Harmony", value: kind, onChange: (e) => setKind(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: HARMONY_KINDS.map((k) => /* @__PURE__ */ jsx9("option", { value: k, children: k }, k)) }),
|
|
1007
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: chip(wheel === "ryb"), "aria-pressed": wheel === "ryb", onClick: () => setWheel("ryb"), children: "RYB" }),
|
|
1008
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: chip(wheel === "rgb"), "aria-pressed": wheel === "rgb", onClick: () => setWheel("rgb"), children: "RGB" })
|
|
985
1009
|
] }),
|
|
986
|
-
/* @__PURE__ */
|
|
987
|
-
harmony.map((h, i) => /* @__PURE__ */
|
|
988
|
-
/* @__PURE__ */
|
|
1010
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap gap-1", "aria-label": "Harmony colours", children: [
|
|
1011
|
+
harmony.map((h, i) => /* @__PURE__ */ jsx9("button", { type: "button", "aria-label": `Use ${h.color}`, title: h.color, className: "h-6 w-6 rounded ring-1 ring-slate-700", style: { background: h.color }, onClick: () => controller.setColor(h.color) }, i)),
|
|
1012
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: button, onClick: () => harmony.forEach((h) => controller.addSwatch(h.color)), children: "+ swatches" })
|
|
989
1013
|
] }),
|
|
990
|
-
/* @__PURE__ */
|
|
991
|
-
state.swatches.map((s, i) => /* @__PURE__ */
|
|
1014
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": "Swatches", children: [
|
|
1015
|
+
state.swatches.map((s, i) => /* @__PURE__ */ jsx9(
|
|
992
1016
|
"button",
|
|
993
1017
|
{
|
|
994
1018
|
type: "button",
|
|
@@ -1006,15 +1030,15 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
|
|
|
1006
1030
|
},
|
|
1007
1031
|
i
|
|
1008
1032
|
)),
|
|
1009
|
-
/* @__PURE__ */
|
|
1033
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: button, "aria-label": "Add swatch", onClick: () => attempt(() => controller.addSwatch(state.paint)), children: "+" })
|
|
1010
1034
|
] }),
|
|
1011
|
-
mixingPad && /* @__PURE__ */
|
|
1012
|
-
/* @__PURE__ */
|
|
1013
|
-
/* @__PURE__ */
|
|
1014
|
-
["paint", "knife", "pick"].map((t) => /* @__PURE__ */
|
|
1015
|
-
/* @__PURE__ */
|
|
1035
|
+
mixingPad && /* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-1", "data-testid": "mixing-pad", children: [
|
|
1036
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-1", children: [
|
|
1037
|
+
/* @__PURE__ */ jsx9("span", { className: "text-slate-400", children: "Mixing pad" }),
|
|
1038
|
+
["paint", "knife", "pick"].map((t) => /* @__PURE__ */ jsx9("button", { type: "button", "aria-pressed": padTool === t, className: chip(padTool === t), onClick: () => setPadTool(t), children: t === "paint" ? "Paint" : t === "knife" ? "Knife" : "Pick" }, t)),
|
|
1039
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: button, onClick: () => controller.clearMixingPad(), children: "Clear" })
|
|
1016
1040
|
] }),
|
|
1017
|
-
/* @__PURE__ */
|
|
1041
|
+
/* @__PURE__ */ jsx9(
|
|
1018
1042
|
"div",
|
|
1019
1043
|
{
|
|
1020
1044
|
role: "application",
|
|
@@ -1035,20 +1059,20 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
|
|
|
1035
1059
|
padPoints.current = null;
|
|
1036
1060
|
if (pts?.length) attempt(() => controller.mixingPadStroke(pts, { tool: padTool === "knife" ? "knife" : "paint" }));
|
|
1037
1061
|
},
|
|
1038
|
-
children: /* @__PURE__ */
|
|
1062
|
+
children: /* @__PURE__ */ jsx9(PixelCanvas, { pixels: pad, label: "Mixing pad pixels", className: "w-full rounded", style: { aspectRatio: `${MIXING_PAD_WIDTH} / ${MIXING_PAD_HEIGHT}` } })
|
|
1039
1063
|
}
|
|
1040
1064
|
),
|
|
1041
|
-
/* @__PURE__ */
|
|
1042
|
-
/* @__PURE__ */
|
|
1043
|
-
/* @__PURE__ */
|
|
1065
|
+
/* @__PURE__ */ jsx9("div", { className: "flex flex-wrap items-center gap-1", children: /* @__PURE__ */ jsxs8("label", { className: "flex items-center gap-1", children: [
|
|
1066
|
+
/* @__PURE__ */ jsx9("span", { className: "text-slate-400", children: "Sample" }),
|
|
1067
|
+
/* @__PURE__ */ jsx9("select", { "aria-label": "Pick sample size", value: sample, onChange: (e) => setSample(Number(e.target.value)), className: "rounded bg-slate-800 px-1 py-0.5", children: PAD_SAMPLE_SIZES.map((n) => /* @__PURE__ */ jsx9("option", { value: n, children: n === 1 ? "1 px" : `${n}\xD7${n}` }, n)) })
|
|
1044
1068
|
] }) }),
|
|
1045
|
-
/* @__PURE__ */
|
|
1046
|
-
/* @__PURE__ */
|
|
1047
|
-
/* @__PURE__ */
|
|
1048
|
-
/* @__PURE__ */
|
|
1049
|
-
/* @__PURE__ */
|
|
1050
|
-
/* @__PURE__ */
|
|
1051
|
-
/* @__PURE__ */
|
|
1069
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
1070
|
+
/* @__PURE__ */ jsx9("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: color } }),
|
|
1071
|
+
/* @__PURE__ */ jsx9("input", { type: "number", "aria-label": "Paint colour parts", min: 0, max: 20, value: parts[0], onChange: (e) => setParts([Number(e.target.value), parts[1]]), className: "w-10 rounded bg-slate-800 px-1 py-0.5" }),
|
|
1072
|
+
/* @__PURE__ */ jsx9("span", { className: "text-slate-500", children: ":" }),
|
|
1073
|
+
/* @__PURE__ */ jsx9("input", { type: "number", "aria-label": "Second colour parts", min: 0, max: 20, value: parts[1], onChange: (e) => setParts([parts[0], Number(e.target.value)]), className: "w-10 rounded bg-slate-800 px-1 py-0.5" }),
|
|
1074
|
+
/* @__PURE__ */ jsx9("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: state.secondaryColor } }),
|
|
1075
|
+
/* @__PURE__ */ jsx9(
|
|
1052
1076
|
"button",
|
|
1053
1077
|
{
|
|
1054
1078
|
type: "button",
|
|
@@ -1067,23 +1091,23 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
|
|
|
1067
1091
|
}
|
|
1068
1092
|
)
|
|
1069
1093
|
] }),
|
|
1070
|
-
/* @__PURE__ */
|
|
1071
|
-
/* @__PURE__ */
|
|
1072
|
-
/* @__PURE__ */
|
|
1094
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
1095
|
+
/* @__PURE__ */ jsx9("input", { value: padName, placeholder: "Pad name", "aria-label": "Pad name", onChange: (e) => setPadName(e.target.value), className: "w-24 rounded bg-slate-800 px-1.5 py-0.5" }),
|
|
1096
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: button, onClick: () => attempt(() => (controller.saveMixingPad(padName || void 0), setPadName(""))), children: "Keep pad" })
|
|
1073
1097
|
] }),
|
|
1074
|
-
state.savedMixingPads.length > 0 && /* @__PURE__ */
|
|
1075
|
-
/* @__PURE__ */
|
|
1076
|
-
/* @__PURE__ */
|
|
1098
|
+
state.savedMixingPads.length > 0 && /* @__PURE__ */ jsx9("ul", { className: "flex flex-col gap-0.5", "aria-label": "Kept pads", children: state.savedMixingPads.map((p) => /* @__PURE__ */ jsxs8("li", { className: "flex items-center gap-1", children: [
|
|
1099
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: `${button} flex-1 text-left`, onClick: () => attempt(() => controller.loadMixingPad(p.id)), children: p.name }),
|
|
1100
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: button, "aria-label": `Remove ${p.name}`, onClick: () => attempt(() => controller.removeMixingPad(p.id)), children: "\xD7" })
|
|
1077
1101
|
] }, p.id)) })
|
|
1078
1102
|
] }),
|
|
1079
|
-
/* @__PURE__ */
|
|
1103
|
+
/* @__PURE__ */ jsx9(ErrorLine, { error })
|
|
1080
1104
|
] });
|
|
1081
1105
|
};
|
|
1082
1106
|
|
|
1083
1107
|
// src/paint-editor/PaintLayersPanel.tsx
|
|
1084
|
-
import { useState as
|
|
1108
|
+
import { useState as useState8 } from "react";
|
|
1085
1109
|
import { BLEND_MENU_GROUPS } from "@pixerate/editor/paint-editor";
|
|
1086
|
-
import { jsx as
|
|
1110
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1087
1111
|
function siblingIndex(layers, l) {
|
|
1088
1112
|
const sibs = layers.filter((x) => x.parentId === l.parentId).reverse();
|
|
1089
1113
|
return { index: sibs.findIndex((x) => x.id === l.id), count: sibs.length };
|
|
@@ -1091,7 +1115,7 @@ function siblingIndex(layers, l) {
|
|
|
1091
1115
|
var PaintLayersPanel = ({ controller, className }) => {
|
|
1092
1116
|
usePaintEditorState(controller);
|
|
1093
1117
|
const [error, attempt] = useAttempt();
|
|
1094
|
-
const [renaming, setRenaming] =
|
|
1118
|
+
const [renaming, setRenaming] = useState8(null);
|
|
1095
1119
|
const layers = controller.listLayers();
|
|
1096
1120
|
const active = layers.find((l) => l.active) ?? null;
|
|
1097
1121
|
const light = active?.type === "pixel" ? controller.lightOf(active.id) : null;
|
|
@@ -1101,18 +1125,18 @@ var PaintLayersPanel = ({ controller, className }) => {
|
|
|
1101
1125
|
const to = Math.min(count - 1, Math.max(0, index + delta));
|
|
1102
1126
|
if (to !== index) attempt(() => controller.moveLayer(active.id, to));
|
|
1103
1127
|
};
|
|
1104
|
-
return /* @__PURE__ */
|
|
1105
|
-
/* @__PURE__ */
|
|
1106
|
-
/* @__PURE__ */
|
|
1107
|
-
/* @__PURE__ */
|
|
1108
|
-
/* @__PURE__ */
|
|
1109
|
-
/* @__PURE__ */
|
|
1110
|
-
/* @__PURE__ */
|
|
1111
|
-
/* @__PURE__ */
|
|
1112
|
-
/* @__PURE__ */
|
|
1113
|
-
/* @__PURE__ */
|
|
1128
|
+
return /* @__PURE__ */ jsxs9("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-layers-panel", children: [
|
|
1129
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap gap-1", children: [
|
|
1130
|
+
/* @__PURE__ */ jsx10("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer()), children: "New layer" }),
|
|
1131
|
+
/* @__PURE__ */ jsx10("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer({ type: "group" })), children: "New group" }),
|
|
1132
|
+
/* @__PURE__ */ jsx10("button", { type: "button", className: button, title: "A layer whose strokes stay editable", onClick: () => attempt(() => controller.addLayer({ type: "strokes" })), children: "New stroke layer" }),
|
|
1133
|
+
/* @__PURE__ */ jsx10("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.duplicateLayer(active.id)), children: "Duplicate" }),
|
|
1134
|
+
/* @__PURE__ */ jsx10("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer up", onClick: () => move(1), children: "\u2191" }),
|
|
1135
|
+
/* @__PURE__ */ jsx10("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer down", onClick: () => move(-1), children: "\u2193" }),
|
|
1136
|
+
/* @__PURE__ */ jsx10("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.mergeDown(active.id)), children: "Merge down" }),
|
|
1137
|
+
/* @__PURE__ */ jsx10("button", { type: "button", className: button, disabled: !active || layers.length < 2, onClick: () => active && attempt(() => controller.removeLayer(active.id)), children: "Delete" })
|
|
1114
1138
|
] }),
|
|
1115
|
-
/* @__PURE__ */
|
|
1139
|
+
/* @__PURE__ */ jsx10("ul", { role: "tree", "aria-label": "Layers", className: "flex flex-col gap-0.5", children: layers.map((l) => /* @__PURE__ */ jsxs9(
|
|
1116
1140
|
"li",
|
|
1117
1141
|
{
|
|
1118
1142
|
role: "treeitem",
|
|
@@ -1121,7 +1145,7 @@ var PaintLayersPanel = ({ controller, className }) => {
|
|
|
1121
1145
|
style: { paddingLeft: 6 + l.depth * 12 },
|
|
1122
1146
|
onClick: () => controller.setActiveLayer(l.id),
|
|
1123
1147
|
children: [
|
|
1124
|
-
/* @__PURE__ */
|
|
1148
|
+
/* @__PURE__ */ jsx10(
|
|
1125
1149
|
"button",
|
|
1126
1150
|
{
|
|
1127
1151
|
type: "button",
|
|
@@ -1134,7 +1158,7 @@ var PaintLayersPanel = ({ controller, className }) => {
|
|
|
1134
1158
|
children: l.visible ? "\u25CF" : "\u25CB"
|
|
1135
1159
|
}
|
|
1136
1160
|
),
|
|
1137
|
-
renaming === l.id ? /* @__PURE__ */
|
|
1161
|
+
renaming === l.id ? /* @__PURE__ */ jsx10(
|
|
1138
1162
|
"input",
|
|
1139
1163
|
{
|
|
1140
1164
|
autoFocus: true,
|
|
@@ -1151,23 +1175,23 @@ var PaintLayersPanel = ({ controller, className }) => {
|
|
|
1151
1175
|
if (e.key === "Escape") setRenaming(null);
|
|
1152
1176
|
}
|
|
1153
1177
|
}
|
|
1154
|
-
) : /* @__PURE__ */
|
|
1178
|
+
) : /* @__PURE__ */ jsxs9("span", { className: "flex-1 truncate", onDoubleClick: () => setRenaming(l.id), children: [
|
|
1155
1179
|
l.type === "group" ? "\u25B8 " : "",
|
|
1156
|
-
l.liveStrokes !== void 0 && /* @__PURE__ */
|
|
1180
|
+
l.liveStrokes !== void 0 && /* @__PURE__ */ jsxs9("span", { "aria-label": "Stroke layer", title: `Stroke layer: ${l.liveStrokes} editable strokes`, children: [
|
|
1157
1181
|
"\u270E",
|
|
1158
1182
|
" "
|
|
1159
1183
|
] }),
|
|
1160
1184
|
l.name
|
|
1161
1185
|
] }),
|
|
1162
|
-
l.locks.pixels || l.locks.all ? /* @__PURE__ */
|
|
1186
|
+
l.locks.pixels || l.locks.all ? /* @__PURE__ */ jsx10("span", { title: "Locked", children: "\u{1F512}" }) : null
|
|
1163
1187
|
]
|
|
1164
1188
|
},
|
|
1165
1189
|
l.id
|
|
1166
1190
|
)) }),
|
|
1167
|
-
active && /* @__PURE__ */
|
|
1168
|
-
/* @__PURE__ */
|
|
1169
|
-
/* @__PURE__ */
|
|
1170
|
-
/* @__PURE__ */
|
|
1191
|
+
active && /* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-1.5", children: [
|
|
1192
|
+
/* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-2", children: [
|
|
1193
|
+
/* @__PURE__ */ jsx10("span", { className: "w-14 text-slate-400", children: "Opacity" }),
|
|
1194
|
+
/* @__PURE__ */ jsx10(
|
|
1171
1195
|
"input",
|
|
1172
1196
|
{
|
|
1173
1197
|
type: "range",
|
|
@@ -1181,40 +1205,40 @@ var PaintLayersPanel = ({ controller, className }) => {
|
|
|
1181
1205
|
}
|
|
1182
1206
|
)
|
|
1183
1207
|
] }),
|
|
1184
|
-
/* @__PURE__ */
|
|
1185
|
-
/* @__PURE__ */
|
|
1186
|
-
/* @__PURE__ */
|
|
1187
|
-
active.type === "group" && /* @__PURE__ */
|
|
1188
|
-
BLEND_MENU_GROUPS.map((g) => /* @__PURE__ */
|
|
1208
|
+
/* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-2", children: [
|
|
1209
|
+
/* @__PURE__ */ jsx10("span", { className: "w-14 text-slate-400", children: "Blend" }),
|
|
1210
|
+
/* @__PURE__ */ jsxs9("select", { "aria-label": "Layer blend", value: active.blend, onChange: (e) => attempt(() => controller.updateLayer(active.id, { blend: e.target.value })), className: "flex-1 rounded bg-slate-800 px-1 py-0.5", children: [
|
|
1211
|
+
active.type === "group" && /* @__PURE__ */ jsx10("option", { value: "pass-through", children: "Pass through" }),
|
|
1212
|
+
BLEND_MENU_GROUPS.map((g) => /* @__PURE__ */ jsx10("optgroup", { label: g.label, children: g.modes.map((m) => /* @__PURE__ */ jsx10("option", { value: m.id, title: m.description, children: m.label }, m.id)) }, g.label))
|
|
1189
1213
|
] })
|
|
1190
1214
|
] }),
|
|
1191
|
-
/* @__PURE__ */
|
|
1192
|
-
["pixels", "transparency"].map((k) => /* @__PURE__ */
|
|
1193
|
-
/* @__PURE__ */
|
|
1215
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex gap-1", children: [
|
|
1216
|
+
["pixels", "transparency"].map((k) => /* @__PURE__ */ jsx10("button", { type: "button", "aria-pressed": Boolean(active.locks[k]), className: chip(Boolean(active.locks[k])), onClick: () => attempt(() => controller.updateLayer(active.id, { locks: { [k]: !active.locks[k] } })), children: k === "pixels" ? "Lock pixels" : "Lock transparency" }, k)),
|
|
1217
|
+
/* @__PURE__ */ jsx10("button", { type: "button", "aria-pressed": active.clipped, className: chip(active.clipped), onClick: () => attempt(() => controller.updateLayer(active.id, { clipped: !active.clipped })), children: "Clip" })
|
|
1194
1218
|
] }),
|
|
1195
|
-
light?.hasLight && /* @__PURE__ */
|
|
1196
|
-
/* @__PURE__ */
|
|
1197
|
-
/* @__PURE__ */
|
|
1198
|
-
/* @__PURE__ */
|
|
1219
|
+
light?.hasLight && /* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-1.5 border-t border-slate-800 pt-1.5", "data-testid": "layer-light", children: [
|
|
1220
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-between", children: [
|
|
1221
|
+
/* @__PURE__ */ jsx10("span", { className: "font-medium text-slate-300", title: "This layer's paint gives off light", children: "Light" }),
|
|
1222
|
+
/* @__PURE__ */ jsx10("button", { type: "button", className: button, onClick: () => attempt(() => controller.clearLight(active.id)), children: "Clear light" })
|
|
1199
1223
|
] }),
|
|
1200
|
-
/* @__PURE__ */
|
|
1201
|
-
/* @__PURE__ */
|
|
1202
|
-
/* @__PURE__ */
|
|
1224
|
+
/* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-2", title: "How far the light spills onto the paint and paper around it (0 turns it off)", children: [
|
|
1225
|
+
/* @__PURE__ */ jsx10("span", { className: "w-14 text-slate-400", children: "Spill" }),
|
|
1226
|
+
/* @__PURE__ */ jsx10("input", { type: "range", "aria-label": "Light spill radius", min: 0, max: 120, step: 1, value: light.spill.radius, onChange: (e) => attempt(() => controller.setLightSpill(active.id, { radius: Number(e.target.value) })), className: "flex-1 accent-indigo-500" })
|
|
1203
1227
|
] }),
|
|
1204
|
-
/* @__PURE__ */
|
|
1205
|
-
/* @__PURE__ */
|
|
1206
|
-
/* @__PURE__ */
|
|
1228
|
+
/* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-2", children: [
|
|
1229
|
+
/* @__PURE__ */ jsx10("span", { className: "w-14 text-slate-400", children: "Strength" }),
|
|
1230
|
+
/* @__PURE__ */ jsx10("input", { type: "range", "aria-label": "Light spill strength", min: 0, max: 2, step: 0.05, value: light.spill.strength, onChange: (e) => attempt(() => controller.setLightSpill(active.id, { strength: Number(e.target.value) })), className: "flex-1 accent-indigo-500" })
|
|
1207
1231
|
] })
|
|
1208
1232
|
] }),
|
|
1209
|
-
/* @__PURE__ */
|
|
1233
|
+
/* @__PURE__ */ jsx10("div", { className: "border-t border-slate-800 pt-1.5", "data-testid": "paint-layer-effects", title: "Live layer styles drawn from this layer's paint: glows, shadows, strokes", children: /* @__PURE__ */ jsx10(LayerEffectsPanel, { controller, layerId: active.id }) })
|
|
1210
1234
|
] }),
|
|
1211
|
-
/* @__PURE__ */
|
|
1235
|
+
/* @__PURE__ */ jsx10(ErrorLine, { error })
|
|
1212
1236
|
] });
|
|
1213
1237
|
};
|
|
1214
1238
|
|
|
1215
1239
|
// src/paint-editor/WetPanel.tsx
|
|
1216
1240
|
import { WET_FLOW_KINDS, WET_GPU_OPTIONS, WET_PARAM_SLIDERS, WET_SPEED_SLIDER, WET_TILT_SLIDERS, readPath as readPath2, wetEngineSummary } from "@pixerate/editor/paint-editor";
|
|
1217
|
-
import { jsx as
|
|
1241
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1218
1242
|
var FLOW_LABELS = { none: "None", linear: "One way", swirl: "Swirl", radial: "Outwards", turbulent: "Eddies" };
|
|
1219
1243
|
var WetPanel = ({ controller, className }) => {
|
|
1220
1244
|
const state = usePaintEditorState(controller);
|
|
@@ -1223,31 +1247,31 @@ var WetPanel = ({ controller, className }) => {
|
|
|
1223
1247
|
const layerId = state.document.activeLayerId;
|
|
1224
1248
|
const info = layerId ? controller.wetLayerInfo(layerId) : null;
|
|
1225
1249
|
const backend = controller.wetState();
|
|
1226
|
-
return /* @__PURE__ */
|
|
1227
|
-
/* @__PURE__ */
|
|
1228
|
-
/* @__PURE__ */
|
|
1229
|
-
/* @__PURE__ */
|
|
1250
|
+
return /* @__PURE__ */ jsxs10("div", { className: `${panel} ${className ?? ""}`, "data-testid": "wet-panel", children: [
|
|
1251
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between", children: [
|
|
1252
|
+
/* @__PURE__ */ jsx11("span", { className: wet.wet ? "text-sky-300" : "text-slate-400", "data-testid": "wet-status", children: wet.wet ? wet.paused ? "Wet (paused)" : "Wet" : "Dry" }),
|
|
1253
|
+
/* @__PURE__ */ jsxs10("span", { className: "text-[10px] text-slate-500", children: [
|
|
1230
1254
|
"step ",
|
|
1231
1255
|
wet.clock
|
|
1232
1256
|
] })
|
|
1233
1257
|
] }),
|
|
1234
|
-
/* @__PURE__ */
|
|
1235
|
-
/* @__PURE__ */
|
|
1236
|
-
/* @__PURE__ */
|
|
1237
|
-
/* @__PURE__ */
|
|
1238
|
-
/* @__PURE__ */
|
|
1239
|
-
/* @__PURE__ */
|
|
1258
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap gap-1", children: [
|
|
1259
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: button, disabled: !wet.layerIds.length, onClick: () => attempt(async () => (await controller.wetIdle(), controller.dryPaint())), children: "Dry now" }),
|
|
1260
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: chip(wet.paused), "aria-pressed": wet.paused, onClick: () => controller.setWetPaused(!wet.paused), children: wet.paused ? "Resume" : "Pause" }),
|
|
1261
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: chip(wet.overlay), "aria-pressed": wet.overlay, onClick: () => controller.setWaterOverlay(!wet.overlay), children: "Water" }),
|
|
1262
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: chip(wet.instantDry), "aria-pressed": wet.instantDry, title: "Each wet stroke dries as soon as it ends", onClick: () => controller.setInstantDry(!wet.instantDry), children: "Instant dry" }),
|
|
1263
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: button, disabled: !layerId, onClick: () => attempt(async () => (await controller.wetIdle(), controller.wetPaper({}))), children: "Wet paper" })
|
|
1240
1264
|
] }),
|
|
1241
|
-
/* @__PURE__ */
|
|
1242
|
-
WET_TILT_SLIDERS.map((c) => /* @__PURE__ */
|
|
1243
|
-
info && /* @__PURE__ */
|
|
1244
|
-
/* @__PURE__ */
|
|
1245
|
-
WET_PARAM_SLIDERS.map((c) => /* @__PURE__ */
|
|
1246
|
-
/* @__PURE__ */
|
|
1247
|
-
/* @__PURE__ */
|
|
1248
|
-
/* @__PURE__ */
|
|
1265
|
+
/* @__PURE__ */ jsx11(PaintSlider, { control: WET_SPEED_SLIDER, value: wet.speed, onChange: (v) => controller.setWetSpeed(v) }),
|
|
1266
|
+
WET_TILT_SLIDERS.map((c) => /* @__PURE__ */ jsx11(PaintSlider, { control: c, value: readPath2(wet.tilt, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setCanvasTilt({ [c.path]: v }))) }, c.path)),
|
|
1267
|
+
info && /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-layer", children: [
|
|
1268
|
+
/* @__PURE__ */ jsx11("span", { className: "font-medium text-slate-300", children: "This layer" }),
|
|
1269
|
+
WET_PARAM_SLIDERS.map((c) => /* @__PURE__ */ jsx11(PaintSlider, { control: c, value: readPath2(info.params, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setWetParams(layerId, { [c.path]: v }))) }, c.path)),
|
|
1270
|
+
/* @__PURE__ */ jsxs10("label", { className: "flex items-center justify-between gap-2", children: [
|
|
1271
|
+
/* @__PURE__ */ jsx11("span", { className: "text-slate-400", children: "Flow map" }),
|
|
1272
|
+
/* @__PURE__ */ jsx11("select", { "aria-label": "Flow map", value: info.flow.kind, onChange: (e) => attempt(async () => (await controller.wetIdle(), controller.setFlowMap(layerId, { kind: e.target.value }))), className: "rounded bg-slate-800 px-1 py-0.5", children: WET_FLOW_KINDS.map((k) => /* @__PURE__ */ jsx11("option", { value: k, children: FLOW_LABELS[k] }, k)) })
|
|
1249
1273
|
] }),
|
|
1250
|
-
info.flow.kind !== "none" && /* @__PURE__ */
|
|
1274
|
+
info.flow.kind !== "none" && /* @__PURE__ */ jsx11(
|
|
1251
1275
|
PaintSlider,
|
|
1252
1276
|
{
|
|
1253
1277
|
control: { path: "strength", label: "Flow strength", min: 0, max: 1, step: 0.01 },
|
|
@@ -1256,20 +1280,20 @@ var WetPanel = ({ controller, className }) => {
|
|
|
1256
1280
|
}
|
|
1257
1281
|
)
|
|
1258
1282
|
] }),
|
|
1259
|
-
backend.message && /* @__PURE__ */
|
|
1260
|
-
backend.backend && /* @__PURE__ */
|
|
1261
|
-
/* @__PURE__ */
|
|
1262
|
-
/* @__PURE__ */
|
|
1263
|
-
/* @__PURE__ */
|
|
1283
|
+
backend.message && /* @__PURE__ */ jsx11("p", { className: "text-[10px] text-amber-300", "data-testid": "wet-message", children: backend.message }),
|
|
1284
|
+
backend.backend && /* @__PURE__ */ jsx11("p", { className: "text-[10px] text-slate-500", children: backend.backend.kind === "wasm-threads" ? `WebAssembly, ${backend.backend.threads} threads` : backend.backend.kind === "wasm" ? "WebAssembly, one thread" : "JavaScript" }),
|
|
1285
|
+
/* @__PURE__ */ jsxs10("label", { className: "flex items-center justify-between gap-2", children: [
|
|
1286
|
+
/* @__PURE__ */ jsx11("span", { className: "text-slate-400", children: "Engine" }),
|
|
1287
|
+
/* @__PURE__ */ jsx11("select", { "aria-label": "Wet engine", value: wet.gpu, onChange: (e) => attempt(() => controller.setWetEngine({ gpu: e.target.value })), className: "rounded bg-slate-800 px-1 py-0.5", children: WET_GPU_OPTIONS.map((o) => /* @__PURE__ */ jsx11("option", { value: o.value, children: o.label }, o.value)) })
|
|
1264
1288
|
] }),
|
|
1265
|
-
/* @__PURE__ */
|
|
1266
|
-
/* @__PURE__ */
|
|
1289
|
+
/* @__PURE__ */ jsx11("p", { className: `text-[10px] ${backend.engine.state === "active" ? "text-emerald-300" : "text-slate-500"}`, "data-testid": "wet-engine", children: wetEngineSummary(backend.engine) }),
|
|
1290
|
+
/* @__PURE__ */ jsx11(ErrorLine, { error })
|
|
1267
1291
|
] });
|
|
1268
1292
|
};
|
|
1269
1293
|
|
|
1270
1294
|
// src/paint-editor/StickerPanel.tsx
|
|
1271
1295
|
import { STICKER_SLIDERS, readPath as readPath3, stickerRefLabel } from "@pixerate/editor/paint-editor";
|
|
1272
|
-
import { jsx as
|
|
1296
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1273
1297
|
var StickerPanel = ({ controller, className }) => {
|
|
1274
1298
|
const state = usePaintEditorState(controller);
|
|
1275
1299
|
const [error, attempt] = useAttempt();
|
|
@@ -1279,16 +1303,16 @@ var StickerPanel = ({ controller, className }) => {
|
|
|
1279
1303
|
const stickers = layerId ? state.document.stickers?.[layerId] ?? [] : [];
|
|
1280
1304
|
if (!stickers.length) return null;
|
|
1281
1305
|
const sel = stickers.find((s) => s.id === picked) ?? null;
|
|
1282
|
-
return /* @__PURE__ */
|
|
1283
|
-
/* @__PURE__ */
|
|
1306
|
+
return /* @__PURE__ */ jsxs11("div", { className: `${panel} ${className ?? ""}`, "data-testid": "sticker-panel", children: [
|
|
1307
|
+
/* @__PURE__ */ jsxs11("span", { className: "font-medium text-slate-300", children: [
|
|
1284
1308
|
"Stickers (",
|
|
1285
1309
|
stickers.length,
|
|
1286
1310
|
")"
|
|
1287
1311
|
] }),
|
|
1288
|
-
/* @__PURE__ */
|
|
1289
|
-
sel && /* @__PURE__ */
|
|
1290
|
-
/* @__PURE__ */
|
|
1291
|
-
/* @__PURE__ */
|
|
1312
|
+
/* @__PURE__ */ jsx12("div", { className: "flex max-h-24 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Stickers", children: stickers.map((s) => /* @__PURE__ */ jsx12("button", { type: "button", role: "option", "aria-selected": s.id === picked, title: `${stickerRefLabel(s.ref)} ${s.id}`, className: `h-5 w-5 rounded ring-1 ${s.id === picked ? "ring-indigo-400" : "ring-slate-700"}`, style: { background: s.color }, onClick: () => setPicked(s.id) }, s.id)) }),
|
|
1313
|
+
sel && /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-1.5", "data-testid": "sticker-edit", children: [
|
|
1314
|
+
/* @__PURE__ */ jsx12("span", { className: "text-slate-400", children: "Sticker" }),
|
|
1315
|
+
/* @__PURE__ */ jsx12(
|
|
1292
1316
|
StickerPicker,
|
|
1293
1317
|
{
|
|
1294
1318
|
controller,
|
|
@@ -1302,9 +1326,9 @@ var StickerPanel = ({ controller, className }) => {
|
|
|
1302
1326
|
)
|
|
1303
1327
|
}
|
|
1304
1328
|
),
|
|
1305
|
-
/* @__PURE__ */
|
|
1306
|
-
/* @__PURE__ */
|
|
1307
|
-
/* @__PURE__ */
|
|
1329
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between gap-2", children: [
|
|
1330
|
+
/* @__PURE__ */ jsx12("span", { className: "text-slate-400", children: "Position" }),
|
|
1331
|
+
/* @__PURE__ */ jsx12("span", { className: "flex gap-1", children: ["x", "y"].map((k) => /* @__PURE__ */ jsx12(
|
|
1308
1332
|
"input",
|
|
1309
1333
|
{
|
|
1310
1334
|
type: "number",
|
|
@@ -1318,24 +1342,24 @@ var StickerPanel = ({ controller, className }) => {
|
|
|
1318
1342
|
`${sel.id}-${k}-${sel[k]}`
|
|
1319
1343
|
)) })
|
|
1320
1344
|
] }),
|
|
1321
|
-
STICKER_SLIDERS.map((c) => /* @__PURE__ */
|
|
1322
|
-
/* @__PURE__ */
|
|
1323
|
-
/* @__PURE__ */
|
|
1324
|
-
/* @__PURE__ */
|
|
1345
|
+
STICKER_SLIDERS.map((c) => /* @__PURE__ */ jsx12(PaintSlider, { control: c, value: readPath3(sel, c.path), onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { [c.path]: v })) }, c.path)),
|
|
1346
|
+
/* @__PURE__ */ jsxs11("label", { className: "flex items-center justify-between", children: [
|
|
1347
|
+
/* @__PURE__ */ jsx12("span", { className: "text-slate-400", children: "Colour" }),
|
|
1348
|
+
/* @__PURE__ */ jsx12(CommitColorInput, { label: "Sticker colour", value: sel.color, onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { color: v })), className: "h-6 w-10 rounded bg-transparent" })
|
|
1325
1349
|
] }),
|
|
1326
|
-
/* @__PURE__ */
|
|
1327
|
-
/* @__PURE__ */
|
|
1328
|
-
/* @__PURE__ */
|
|
1329
|
-
/* @__PURE__ */
|
|
1350
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap gap-1", children: [
|
|
1351
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "front")), children: "To front" }),
|
|
1352
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "back")), children: "To back" }),
|
|
1353
|
+
/* @__PURE__ */ jsx12("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStickers(layerId, [sel.id]), setPicked(null))), children: "Delete" })
|
|
1330
1354
|
] })
|
|
1331
1355
|
] }),
|
|
1332
|
-
/* @__PURE__ */
|
|
1356
|
+
/* @__PURE__ */ jsx12(ErrorLine, { error })
|
|
1333
1357
|
] });
|
|
1334
1358
|
};
|
|
1335
1359
|
|
|
1336
1360
|
// src/paint-editor/StrokePanel.tsx
|
|
1337
1361
|
import { STROKE_SLIDERS, liveStrokeRefusal, readPath as readPath4 } from "@pixerate/editor/paint-editor";
|
|
1338
|
-
import { jsx as
|
|
1362
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1339
1363
|
var StrokePanel = ({ controller, className }) => {
|
|
1340
1364
|
const state = usePaintEditorState(controller);
|
|
1341
1365
|
const [error, attempt] = useAttempt();
|
|
@@ -1345,16 +1369,16 @@ var StrokePanel = ({ controller, className }) => {
|
|
|
1345
1369
|
const index = strokes.findIndex((s) => s.id === state.selectedStroke);
|
|
1346
1370
|
const sel = index >= 0 ? strokes[index] : null;
|
|
1347
1371
|
const brushes = state.brushes.filter((b) => !liveStrokeRefusal(b));
|
|
1348
|
-
return /* @__PURE__ */
|
|
1349
|
-
/* @__PURE__ */
|
|
1350
|
-
/* @__PURE__ */
|
|
1372
|
+
return /* @__PURE__ */ jsxs12("div", { className: `${panel} ${className ?? ""}`, "data-testid": "stroke-panel", children: [
|
|
1373
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center justify-between", children: [
|
|
1374
|
+
/* @__PURE__ */ jsxs12("span", { className: "font-medium text-slate-300", children: [
|
|
1351
1375
|
"Strokes (",
|
|
1352
1376
|
strokes.length,
|
|
1353
1377
|
")"
|
|
1354
1378
|
] }),
|
|
1355
|
-
/* @__PURE__ */
|
|
1379
|
+
/* @__PURE__ */ jsx13("button", { type: "button", className: button, onClick: () => attempt(() => controller.rasterizeLiveStrokes(layerId)), children: "Rasterize" })
|
|
1356
1380
|
] }),
|
|
1357
|
-
/* @__PURE__ */
|
|
1381
|
+
/* @__PURE__ */ jsx13("div", { className: "flex max-h-24 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Strokes", children: strokes.map((s, i) => /* @__PURE__ */ jsx13(
|
|
1358
1382
|
"button",
|
|
1359
1383
|
{
|
|
1360
1384
|
type: "button",
|
|
@@ -1367,10 +1391,10 @@ var StrokePanel = ({ controller, className }) => {
|
|
|
1367
1391
|
},
|
|
1368
1392
|
s.id
|
|
1369
1393
|
)) }),
|
|
1370
|
-
sel && /* @__PURE__ */
|
|
1371
|
-
/* @__PURE__ */
|
|
1372
|
-
/* @__PURE__ */
|
|
1373
|
-
/* @__PURE__ */
|
|
1394
|
+
sel && /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-1.5", "data-testid": "stroke-edit", children: [
|
|
1395
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center justify-between gap-2", children: [
|
|
1396
|
+
/* @__PURE__ */ jsx13("span", { className: "text-slate-400", children: "Brush" }),
|
|
1397
|
+
/* @__PURE__ */ jsxs12(
|
|
1374
1398
|
"select",
|
|
1375
1399
|
{
|
|
1376
1400
|
"aria-label": "Stroke brush",
|
|
@@ -1378,38 +1402,38 @@ var StrokePanel = ({ controller, className }) => {
|
|
|
1378
1402
|
onChange: (e) => e.target.value && attempt(() => controller.updateStroke(sel.id, { brushId: e.target.value })),
|
|
1379
1403
|
className: "max-w-[10rem] rounded bg-slate-800 px-1 py-0.5",
|
|
1380
1404
|
children: [
|
|
1381
|
-
!brushes.some((b) => b.id === sel.brush.id) && /* @__PURE__ */
|
|
1382
|
-
brushes.map((b) => /* @__PURE__ */
|
|
1405
|
+
!brushes.some((b) => b.id === sel.brush.id) && /* @__PURE__ */ jsx13("option", { value: "", children: sel.brush.name }),
|
|
1406
|
+
brushes.map((b) => /* @__PURE__ */ jsx13("option", { value: b.id, children: b.name }, b.id))
|
|
1383
1407
|
]
|
|
1384
1408
|
}
|
|
1385
1409
|
)
|
|
1386
1410
|
] }),
|
|
1387
|
-
STROKE_SLIDERS.map((c) => /* @__PURE__ */
|
|
1388
|
-
/* @__PURE__ */
|
|
1389
|
-
/* @__PURE__ */
|
|
1390
|
-
/* @__PURE__ */
|
|
1411
|
+
STROKE_SLIDERS.map((c) => /* @__PURE__ */ jsx13(PaintSlider, { control: c, value: readPath4(sel.brush, c.path), onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { brush: { tip: { [c.path.split(".")[1]]: v } } })) }, c.path)),
|
|
1412
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center justify-between", children: [
|
|
1413
|
+
/* @__PURE__ */ jsx13("span", { className: "text-slate-400", children: "Colour" }),
|
|
1414
|
+
/* @__PURE__ */ jsx13(CommitColorInput, { label: "Stroke colour", value: sel.color, onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { color: v })), className: "h-6 w-10 rounded bg-transparent" })
|
|
1391
1415
|
] }),
|
|
1392
|
-
/* @__PURE__ */
|
|
1393
|
-
/* @__PURE__ */
|
|
1394
|
-
/* @__PURE__ */
|
|
1395
|
-
/* @__PURE__ */
|
|
1396
|
-
/* @__PURE__ */
|
|
1416
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap gap-1", children: [
|
|
1417
|
+
/* @__PURE__ */ jsx13("button", { type: "button", className: button, onClick: () => attempt(() => controller.updateStroke(sel.id, { seed: (sel.seed + 1) % 2147483647 })), children: "New seed" }),
|
|
1418
|
+
/* @__PURE__ */ jsx13("button", { type: "button", className: button, disabled: index === strokes.length - 1, "aria-label": "Move stroke up", onClick: () => attempt(() => controller.reorderStroke(sel.id, index + 1)), children: "\u2191" }),
|
|
1419
|
+
/* @__PURE__ */ jsx13("button", { type: "button", className: button, disabled: index === 0, "aria-label": "Move stroke down", onClick: () => attempt(() => controller.reorderStroke(sel.id, index - 1)), children: "\u2193" }),
|
|
1420
|
+
/* @__PURE__ */ jsx13("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStrokes([sel.id]), controller.selectStroke(null))), children: "Delete" })
|
|
1397
1421
|
] })
|
|
1398
1422
|
] }),
|
|
1399
|
-
/* @__PURE__ */
|
|
1423
|
+
/* @__PURE__ */ jsx13(ErrorLine, { error })
|
|
1400
1424
|
] });
|
|
1401
1425
|
};
|
|
1402
1426
|
|
|
1403
1427
|
// src/paint-editor/PaintEditor.tsx
|
|
1404
|
-
import { useRef as
|
|
1428
|
+
import { useRef as useRef8, useState as useState10 } from "react";
|
|
1405
1429
|
import { PaintPresence as PaintPresence2, documentToScreen as documentToScreen2, screenToDocument } from "@pixerate/editor/paint-editor";
|
|
1406
1430
|
|
|
1407
1431
|
// src/paint-editor/PaintEffectsPanel.tsx
|
|
1408
|
-
import { useEffect as useEffect5, useMemo as
|
|
1432
|
+
import { useEffect as useEffect5, useMemo as useMemo7, useRef as useRef7, useState as useState9 } from "react";
|
|
1409
1433
|
import { createPaintEffectsToolProvider, PAPER_EFFECT_BLENDS } from "@pixerate/editor/paint-editor";
|
|
1410
|
-
import { jsx as
|
|
1434
|
+
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1411
1435
|
function usePaintEffectsProvider(controller) {
|
|
1412
|
-
const [provider, setProvider] =
|
|
1436
|
+
const [provider, setProvider] = useState9(controller.effectsProvider);
|
|
1413
1437
|
useEffect5(() => {
|
|
1414
1438
|
setProvider(controller.effectsProvider);
|
|
1415
1439
|
return controller.effects.subscribe(setProvider);
|
|
@@ -1425,20 +1449,20 @@ function usePaintEffectsTools(registry, controller, options = {}) {
|
|
|
1425
1449
|
}
|
|
1426
1450
|
function Controls({ provider, effect, name, values, apply }) {
|
|
1427
1451
|
const { description, error } = useEffectDescription(provider, effect);
|
|
1428
|
-
const drags =
|
|
1429
|
-
if (!provider) return /* @__PURE__ */
|
|
1452
|
+
const drags = useRef7(/* @__PURE__ */ new Set());
|
|
1453
|
+
if (!provider) return /* @__PURE__ */ jsxs13("p", { className: "text-[11px] text-slate-400", children: [
|
|
1430
1454
|
'No effects provider: "',
|
|
1431
1455
|
name ?? effect,
|
|
1432
1456
|
'" is kept as it was drawn.'
|
|
1433
1457
|
] });
|
|
1434
|
-
if (error) return /* @__PURE__ */
|
|
1435
|
-
if (!description) return /* @__PURE__ */
|
|
1458
|
+
if (error) return /* @__PURE__ */ jsx14("p", { className: "text-[11px] text-amber-400", children: error });
|
|
1459
|
+
if (!description) return /* @__PURE__ */ jsx14("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
|
|
1436
1460
|
const commit = (gesture) => {
|
|
1437
1461
|
if (!gesture || drags.current.has(gesture)) return !gesture;
|
|
1438
1462
|
drags.current.add(gesture);
|
|
1439
1463
|
return true;
|
|
1440
1464
|
};
|
|
1441
|
-
return /* @__PURE__ */
|
|
1465
|
+
return /* @__PURE__ */ jsx14(
|
|
1442
1466
|
EffectParameters,
|
|
1443
1467
|
{
|
|
1444
1468
|
description,
|
|
@@ -1460,8 +1484,8 @@ var PaintEffectsPanel = ({ controller, className }) => {
|
|
|
1460
1484
|
const state = usePaintEditorState(controller);
|
|
1461
1485
|
const provider = usePaintEffectsProvider(controller);
|
|
1462
1486
|
const [error, attempt] = useAttempt();
|
|
1463
|
-
const [browse, setBrowse] =
|
|
1464
|
-
const [busy, setBusy] =
|
|
1487
|
+
const [browse, setBrowse] = useState9(null);
|
|
1488
|
+
const [busy, setBusy] = useState9(false);
|
|
1465
1489
|
const paper = controller.getPaperEffect();
|
|
1466
1490
|
const activeId = state.document.activeLayerId;
|
|
1467
1491
|
const layerEffect = activeId ? controller.getEffectLayer(activeId) : void 0;
|
|
@@ -1473,7 +1497,7 @@ var PaintEffectsPanel = ({ controller, className }) => {
|
|
|
1473
1497
|
if (!effectPaint) return;
|
|
1474
1498
|
run(() => controller.setEffectPaint({ effect: effectPaint.effect, values: effectPaint.values, time: effectPaint.time, map: effectPaint.map, live: effectPaint.live, ...patch }));
|
|
1475
1499
|
};
|
|
1476
|
-
const thumbnail =
|
|
1500
|
+
const thumbnail = useMemo7(() => effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(48) : null, [controller, effectPaint, state.effectPaintRendering]);
|
|
1477
1501
|
const run = (work) => attempt(() => {
|
|
1478
1502
|
setBusy(true);
|
|
1479
1503
|
return work().finally(() => setBusy(false));
|
|
@@ -1489,28 +1513,28 @@ var PaintEffectsPanel = ({ controller, className }) => {
|
|
|
1489
1513
|
};
|
|
1490
1514
|
const toggle = (b) => setBrowse(browse === b ? null : b);
|
|
1491
1515
|
const pixel = active?.type === "pixel";
|
|
1492
|
-
return /* @__PURE__ */
|
|
1493
|
-
/* @__PURE__ */
|
|
1494
|
-
/* @__PURE__ */
|
|
1495
|
-
/* @__PURE__ */
|
|
1496
|
-
/* @__PURE__ */
|
|
1497
|
-
/* @__PURE__ */
|
|
1498
|
-
/* @__PURE__ */
|
|
1499
|
-
/* @__PURE__ */
|
|
1516
|
+
return /* @__PURE__ */ jsxs13("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
|
|
1517
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
1518
|
+
/* @__PURE__ */ jsx14("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
|
|
1519
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
|
|
1520
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
|
|
1521
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
|
|
1522
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "light", onClick: () => toggle("light"), title: "Bake a light, glow or grade into the active layer's dried paint", children: "Light\u2026" }),
|
|
1523
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paint", onClick: () => toggle("paint"), title: "Paint with an effect: brushes take each pixel's colour from it", children: "Paint\u2026" })
|
|
1500
1524
|
] }),
|
|
1501
|
-
!provider && /* @__PURE__ */
|
|
1502
|
-
browse && /* @__PURE__ */
|
|
1503
|
-
paper && /* @__PURE__ */
|
|
1504
|
-
/* @__PURE__ */
|
|
1505
|
-
/* @__PURE__ */
|
|
1525
|
+
!provider && /* @__PURE__ */ jsx14("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
|
|
1526
|
+
browse && /* @__PURE__ */ jsx14(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
|
|
1527
|
+
paper && /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
|
|
1528
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1", children: [
|
|
1529
|
+
/* @__PURE__ */ jsxs13("span", { className: "flex-1 truncate", children: [
|
|
1506
1530
|
"Paper: ",
|
|
1507
1531
|
paper.name ?? paper.effect
|
|
1508
1532
|
] }),
|
|
1509
|
-
/* @__PURE__ */
|
|
1533
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
|
|
1510
1534
|
] }),
|
|
1511
|
-
/* @__PURE__ */
|
|
1512
|
-
/* @__PURE__ */
|
|
1513
|
-
/* @__PURE__ */
|
|
1535
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", children: [
|
|
1536
|
+
/* @__PURE__ */ jsx14("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
|
|
1537
|
+
/* @__PURE__ */ jsx14(
|
|
1514
1538
|
"input",
|
|
1515
1539
|
{
|
|
1516
1540
|
type: "range",
|
|
@@ -1532,39 +1556,39 @@ var PaintEffectsPanel = ({ controller, className }) => {
|
|
|
1532
1556
|
`o${paper.opacity}`
|
|
1533
1557
|
)
|
|
1534
1558
|
] }),
|
|
1535
|
-
/* @__PURE__ */
|
|
1536
|
-
/* @__PURE__ */
|
|
1537
|
-
/* @__PURE__ */
|
|
1559
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", children: [
|
|
1560
|
+
/* @__PURE__ */ jsx14("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
|
|
1561
|
+
/* @__PURE__ */ jsx14("select", { className: "flex-1 rounded bg-slate-800 px-1 py-0.5 text-[11px]", "aria-label": "Effect paper blend", value: paper.blend, onChange: (e) => {
|
|
1538
1562
|
const blend = e.currentTarget.value;
|
|
1539
1563
|
run(() => controller.updatePaperEffect({ blend }));
|
|
1540
|
-
}, children: PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */
|
|
1564
|
+
}, children: PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ jsx14("option", { value: b, children: b }, b)) })
|
|
1541
1565
|
] }),
|
|
1542
|
-
/* @__PURE__ */
|
|
1566
|
+
/* @__PURE__ */ jsx14(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
|
|
1543
1567
|
] }),
|
|
1544
|
-
effectPaint && /* @__PURE__ */
|
|
1545
|
-
/* @__PURE__ */
|
|
1546
|
-
thumbnail ? /* @__PURE__ */
|
|
1547
|
-
/* @__PURE__ */
|
|
1568
|
+
effectPaint && /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paint", children: [
|
|
1569
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1", children: [
|
|
1570
|
+
thumbnail ? /* @__PURE__ */ jsx14("img", { src: thumbnail, alt: "", className: "h-5 w-8 rounded object-cover ring-1 ring-slate-700", "data-testid": "effect-paint-thumbnail" }) : null,
|
|
1571
|
+
/* @__PURE__ */ jsxs13("span", { className: "flex-1 truncate", children: [
|
|
1548
1572
|
"Paint: ",
|
|
1549
1573
|
effectPaint.effect,
|
|
1550
1574
|
state.effectPaintRendering ? " (rendering\u2026)" : ""
|
|
1551
1575
|
] }),
|
|
1552
|
-
/* @__PURE__ */
|
|
1576
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
|
|
1553
1577
|
] }),
|
|
1554
|
-
/* @__PURE__ */
|
|
1555
|
-
/* @__PURE__ */
|
|
1556
|
-
/* @__PURE__ */
|
|
1578
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
|
|
1579
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", title: "Lay the effect along each stroke instead of fixing it to the canvas", children: [
|
|
1580
|
+
/* @__PURE__ */ jsx14("input", { type: "checkbox", checked: Boolean(effectPaint.map), onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
|
|
1557
1581
|
"Along the stroke"
|
|
1558
1582
|
] }),
|
|
1559
|
-
/* @__PURE__ */
|
|
1560
|
-
/* @__PURE__ */
|
|
1583
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
|
|
1584
|
+
/* @__PURE__ */ jsx14("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
|
|
1561
1585
|
"Live"
|
|
1562
1586
|
] })
|
|
1563
1587
|
] }),
|
|
1564
|
-
effectPaint.map && /* @__PURE__ */
|
|
1565
|
-
/* @__PURE__ */
|
|
1566
|
-
/* @__PURE__ */
|
|
1567
|
-
/* @__PURE__ */
|
|
1588
|
+
effectPaint.map && /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
1589
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", children: [
|
|
1590
|
+
/* @__PURE__ */ jsx14("span", { className: "text-slate-400", children: "Length" }),
|
|
1591
|
+
/* @__PURE__ */ jsx14(
|
|
1568
1592
|
"input",
|
|
1569
1593
|
{
|
|
1570
1594
|
type: "number",
|
|
@@ -1578,55 +1602,55 @@ var PaintEffectsPanel = ({ controller, className }) => {
|
|
|
1578
1602
|
effectPaint.map.length
|
|
1579
1603
|
)
|
|
1580
1604
|
] }),
|
|
1581
|
-
/* @__PURE__ */
|
|
1582
|
-
/* @__PURE__ */
|
|
1583
|
-
/* @__PURE__ */
|
|
1584
|
-
/* @__PURE__ */
|
|
1605
|
+
/* @__PURE__ */ jsxs13("select", { "aria-label": "Effect repeat", value: effectPaint.map.repeat, onChange: (e) => repaint({ map: { ...effectPaint.map, repeat: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: [
|
|
1606
|
+
/* @__PURE__ */ jsx14("option", { value: "repeat", children: "Repeat" }),
|
|
1607
|
+
/* @__PURE__ */ jsx14("option", { value: "mirror", children: "Mirror" }),
|
|
1608
|
+
/* @__PURE__ */ jsx14("option", { value: "clamp", children: "Clamp" })
|
|
1585
1609
|
] })
|
|
1586
1610
|
] }),
|
|
1587
|
-
/* @__PURE__ */
|
|
1611
|
+
/* @__PURE__ */ jsx14(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
|
|
1588
1612
|
] }),
|
|
1589
|
-
animation && /* @__PURE__ */
|
|
1590
|
-
/* @__PURE__ */
|
|
1613
|
+
animation && /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2 rounded border border-slate-700 p-1", "data-effect-part": "playback", children: [
|
|
1614
|
+
/* @__PURE__ */ jsxs13("span", { className: "flex-1 truncate", children: [
|
|
1591
1615
|
"Live paint: ",
|
|
1592
1616
|
animation.strokes,
|
|
1593
1617
|
" ",
|
|
1594
1618
|
animation.strokes === 1 ? "stroke" : "strokes"
|
|
1595
1619
|
] }),
|
|
1596
|
-
/* @__PURE__ */
|
|
1597
|
-
/* @__PURE__ */
|
|
1598
|
-
/* @__PURE__ */
|
|
1599
|
-
/* @__PURE__ */
|
|
1620
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: button, "aria-pressed": playback.playing, onClick: () => attempt(() => controller.setEffectPlayback({ playing: !playback.playing })), children: playback.playing ? "Pause" : "Play" }),
|
|
1621
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1", children: [
|
|
1622
|
+
/* @__PURE__ */ jsx14("span", { className: "text-slate-400", children: "fps" }),
|
|
1623
|
+
/* @__PURE__ */ jsx14("input", { type: "number", "aria-label": "Live paint frame rate", min: 1, max: 60, value: playback.fps, onChange: (e) => attempt(() => controller.setEffectPlayback({ fps: Math.round(Number(e.target.value)) })), className: "w-12 rounded bg-slate-800 px-1 py-0.5" })
|
|
1600
1624
|
] })
|
|
1601
1625
|
] }),
|
|
1602
|
-
layerEffect && activeId && /* @__PURE__ */
|
|
1603
|
-
/* @__PURE__ */
|
|
1604
|
-
/* @__PURE__ */
|
|
1626
|
+
layerEffect && activeId && /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "layer", children: [
|
|
1627
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1", children: [
|
|
1628
|
+
/* @__PURE__ */ jsxs13("span", { className: "flex-1 truncate", children: [
|
|
1605
1629
|
"Layer: ",
|
|
1606
1630
|
layerEffect.name ?? layerEffect.effect
|
|
1607
1631
|
] }),
|
|
1608
|
-
/* @__PURE__ */
|
|
1632
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
|
|
1609
1633
|
] }),
|
|
1610
|
-
/* @__PURE__ */
|
|
1634
|
+
/* @__PURE__ */ jsx14(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
|
|
1611
1635
|
] }),
|
|
1612
|
-
/* @__PURE__ */
|
|
1636
|
+
/* @__PURE__ */ jsx14(ErrorLine, { error })
|
|
1613
1637
|
] });
|
|
1614
1638
|
};
|
|
1615
1639
|
|
|
1616
1640
|
// src/paint-editor/PaintEditor.tsx
|
|
1617
|
-
import { jsx as
|
|
1641
|
+
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1618
1642
|
var PAINT_CONTROLS = {
|
|
1619
1643
|
"mixing-pad": '[data-testid="mixing-pad"]',
|
|
1620
1644
|
lighting: '[data-testid="light-panel"]',
|
|
1621
1645
|
symmetry: '[aria-label="Symmetry"]'
|
|
1622
1646
|
};
|
|
1623
|
-
var PaintEditor = ({ controller, fileName, height = 720, presence, className, playback, playbackId = "paint", onPlaybackReveal }) => {
|
|
1624
|
-
const [tool, setTool] =
|
|
1625
|
-
const [tab, setTab] =
|
|
1626
|
-
const tabRef =
|
|
1647
|
+
var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, className, playback, playbackId = "paint", onPlaybackReveal }) => {
|
|
1648
|
+
const [tool, setTool] = useState10("brush");
|
|
1649
|
+
const [tab, setTab] = useState10("color");
|
|
1650
|
+
const tabRef = useRef8(tab);
|
|
1627
1651
|
tabRef.current = tab;
|
|
1628
|
-
const rootRef =
|
|
1629
|
-
const [ownPresence] =
|
|
1652
|
+
const rootRef = useRef8(null);
|
|
1653
|
+
const [ownPresence] = useState10(() => new PaintPresence2());
|
|
1630
1654
|
const ambientPlayback = useAgentPlayback();
|
|
1631
1655
|
const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
|
|
1632
1656
|
const viewBox = () => {
|
|
@@ -1682,28 +1706,28 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, className, pl
|
|
|
1682
1706
|
const box = rootRef.current?.getBoundingClientRect();
|
|
1683
1707
|
return c && box ? { x: c.x - box.left, y: c.y - box.top } : p;
|
|
1684
1708
|
};
|
|
1685
|
-
const [error, setError] =
|
|
1709
|
+
const [error, setError] = useState10(null);
|
|
1686
1710
|
const effects = usePaintEffectsProvider(controller);
|
|
1687
1711
|
const tabs = effects ? ["color", "wet", "paper", "layers", "effects"] : ["color", "wet", "paper", "layers"];
|
|
1688
|
-
return /* @__PURE__ */
|
|
1689
|
-
playing && /* @__PURE__ */
|
|
1690
|
-
/* @__PURE__ */
|
|
1691
|
-
/* @__PURE__ */
|
|
1692
|
-
/* @__PURE__ */
|
|
1693
|
-
/* @__PURE__ */
|
|
1694
|
-
/* @__PURE__ */
|
|
1695
|
-
error && /* @__PURE__ */
|
|
1712
|
+
return /* @__PURE__ */ jsxs14("div", { ref: rootRef, className: `relative flex flex-col gap-2 rounded-xl border border-slate-800 bg-slate-900 p-2 ${className ?? ""}`, style: { height }, "data-testid": "paint-editor", children: [
|
|
1713
|
+
playing && /* @__PURE__ */ jsx15(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
|
|
1714
|
+
/* @__PURE__ */ jsx15(PaintToolbar, { controller, tool, onToolChange: setTool, fileName }),
|
|
1715
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex min-h-0 flex-1 gap-2", children: [
|
|
1716
|
+
/* @__PURE__ */ jsx15(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
|
|
1717
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
1718
|
+
/* @__PURE__ */ jsx15(PaintCanvas, { controller, tool, onError: setError, presence: playing ? void 0 : presence, proposals, className: "flex-1 rounded-lg" }),
|
|
1719
|
+
error && /* @__PURE__ */ jsx15("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
|
|
1696
1720
|
] }),
|
|
1697
|
-
/* @__PURE__ */
|
|
1698
|
-
/* @__PURE__ */
|
|
1699
|
-
/* @__PURE__ */
|
|
1700
|
-
tab === "color" && /* @__PURE__ */
|
|
1701
|
-
tab === "wet" && /* @__PURE__ */
|
|
1702
|
-
tab === "paper" && /* @__PURE__ */
|
|
1703
|
-
tab === "layers" && /* @__PURE__ */
|
|
1704
|
-
tab === "layers" && /* @__PURE__ */
|
|
1705
|
-
tab === "layers" && /* @__PURE__ */
|
|
1706
|
-
tab === "effects" && effects && /* @__PURE__ */
|
|
1721
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
|
|
1722
|
+
/* @__PURE__ */ jsx15("div", { className: "flex gap-1", role: "tablist", "aria-label": "Paint panels", children: tabs.map((t) => /* @__PURE__ */ jsx15("button", { type: "button", role: "tab", "aria-selected": tab === t, "data-paint-tab": t, className: chip(tab === t), onClick: () => setTab(t), children: t === "color" ? "Colour" : t === "wet" ? "Wet" : t === "paper" ? "Paper" : t === "layers" ? "Layers" : "Effects" }, t)) }),
|
|
1723
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
|
|
1724
|
+
tab === "color" && /* @__PURE__ */ jsx15(ColorPanel, { controller }),
|
|
1725
|
+
tab === "wet" && /* @__PURE__ */ jsx15(WetPanel, { controller }),
|
|
1726
|
+
tab === "paper" && /* @__PURE__ */ jsx15(PaperPanel, { controller }),
|
|
1727
|
+
tab === "layers" && /* @__PURE__ */ jsx15(PaintLayersPanel, { controller }),
|
|
1728
|
+
tab === "layers" && /* @__PURE__ */ jsx15(StrokePanel, { controller }),
|
|
1729
|
+
tab === "layers" && /* @__PURE__ */ jsx15(StickerPanel, { controller }),
|
|
1730
|
+
tab === "effects" && effects && /* @__PURE__ */ jsx15(PaintEffectsPanel, { controller })
|
|
1707
1731
|
] })
|
|
1708
1732
|
] })
|
|
1709
1733
|
] })
|
|
@@ -1720,6 +1744,7 @@ export {
|
|
|
1720
1744
|
PaintGradientEditor,
|
|
1721
1745
|
PaintLayersPanel,
|
|
1722
1746
|
PaintPresenceLayer,
|
|
1747
|
+
PaintProposalGhosts,
|
|
1723
1748
|
PaintSlider,
|
|
1724
1749
|
PaintToolbar,
|
|
1725
1750
|
PaperPanel,
|
|
@@ -1727,9 +1752,11 @@ export {
|
|
|
1727
1752
|
StickerPicker,
|
|
1728
1753
|
StrokePanel,
|
|
1729
1754
|
WetPanel,
|
|
1755
|
+
usePaintChangeFeed,
|
|
1730
1756
|
usePaintDirector,
|
|
1731
1757
|
usePaintEditor,
|
|
1732
1758
|
usePaintEditorState,
|
|
1733
1759
|
usePaintEffectsProvider,
|
|
1734
|
-
usePaintEffectsTools
|
|
1760
|
+
usePaintEffectsTools,
|
|
1761
|
+
usePaintProposals
|
|
1735
1762
|
};
|