@pixerate/editor-react 0.187.0 → 0.189.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/EvolutionPanel.d.cts +15 -0
- package/dist/paint-editor/EvolutionPanel.d.ts +15 -0
- package/dist/paint-editor/PaintCanvas.d.cts +3 -1
- package/dist/paint-editor/PaintCanvas.d.ts +3 -1
- package/dist/paint-editor/PaintToolbar.d.cts +5 -2
- package/dist/paint-editor/PaintToolbar.d.ts +5 -2
- package/dist/paint-editor/index.cjs +565 -322
- package/dist/paint-editor/index.d.cts +1 -0
- package/dist/paint-editor/index.d.ts +1 -0
- package/dist/paint-editor/index.js +340 -91
- package/package.json +3 -3
|
@@ -35,6 +35,7 @@ __export(paint_editor_exports, {
|
|
|
35
35
|
BrushLibraryBrowser: () => BrushLibraryBrowser,
|
|
36
36
|
BrushPanel: () => BrushPanel,
|
|
37
37
|
ColorPanel: () => ColorPanel,
|
|
38
|
+
EvolutionPanel: () => EvolutionPanel,
|
|
38
39
|
PaintCanvas: () => PaintCanvas,
|
|
39
40
|
PaintEditor: () => PaintEditor,
|
|
40
41
|
PaintEffectsPanel: () => PaintEffectsPanel,
|
|
@@ -110,7 +111,7 @@ function usePaintChangeFeed(controller, options = {}) {
|
|
|
110
111
|
var import_react2 = require("react");
|
|
111
112
|
var import_paint_editor2 = require("@pixerate/editor/paint-editor");
|
|
112
113
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
113
|
-
var PaintCanvas = ({ controller, tool = "brush", showGuides = true, fitOnMount = true, onError, presence, proposals, agentStrokes, className }) => {
|
|
114
|
+
var PaintCanvas = ({ controller, tool = "brush", fillOptions, showGuides = true, fitOnMount = true, onError, presence, proposals, agentStrokes, className }) => {
|
|
114
115
|
const state = usePaintEditorState(controller);
|
|
115
116
|
const viewport = (0, import_react2.useRef)(null);
|
|
116
117
|
const canvas = (0, import_react2.useRef)(null);
|
|
@@ -130,6 +131,7 @@ var PaintCanvas = ({ controller, tool = "brush", showGuides = true, fitOnMount =
|
|
|
130
131
|
[controller]
|
|
131
132
|
);
|
|
132
133
|
gesture.tool = tool;
|
|
134
|
+
if (fillOptions) gesture.fillOptions = fillOptions;
|
|
133
135
|
const { canvas: doc } = state.document;
|
|
134
136
|
(0, import_react2.useEffect)(() => {
|
|
135
137
|
const el = viewport.current;
|
|
@@ -456,11 +458,19 @@ var CommitColorInput = ({ value, label, onCommit, className }) => {
|
|
|
456
458
|
|
|
457
459
|
// src/paint-editor/PaintToolbar.tsx
|
|
458
460
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
459
|
-
var PaintToolbar = ({ controller, tool, onToolChange, fileName = "painting", className }) => {
|
|
461
|
+
var PaintToolbar = ({ controller, tool, onToolChange, fillOptions: controlledFill, onFillOptionsChange, fileName = "painting", className }) => {
|
|
460
462
|
const state = usePaintEditorState(controller);
|
|
461
463
|
const [error, attempt] = useAttempt();
|
|
462
464
|
const [busy, setBusy] = (0, import_react4.useState)(null);
|
|
463
465
|
const [note, setNote] = (0, import_react4.useState)(null);
|
|
466
|
+
const [localFill, setLocalFill] = (0, import_react4.useState)({ reference: "all", tolerance: 32, closeGap: 4, expand: 1, antialias: true });
|
|
467
|
+
const fill = controlledFill ?? localFill;
|
|
468
|
+
const updateFill = (patch) => {
|
|
469
|
+
const next = { ...fill, ...patch };
|
|
470
|
+
setLocalFill(next);
|
|
471
|
+
onFillOptionsChange?.(next);
|
|
472
|
+
};
|
|
473
|
+
const layers = controller.listLayers().filter((l) => l.type === "pixel");
|
|
464
474
|
const openRef = (0, import_react4.useRef)(null);
|
|
465
475
|
const tracingRef = (0, import_react4.useRef)(null);
|
|
466
476
|
const refRef = (0, import_react4.useRef)(null);
|
|
@@ -469,6 +479,71 @@ var PaintToolbar = ({ controller, tool, onToolChange, fileName = "painting", cla
|
|
|
469
479
|
const exportImage = (format) => attempt(async () => (0, import_paint_editor3.downloadBytes)(await controller.exportImage({ format }), `${fileName}.${format === "image/png" ? "png" : "jpg"}`, format));
|
|
470
480
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: `flex flex-wrap items-center gap-1.5 text-xs text-slate-200 ${className ?? ""}`, role: "toolbar", "aria-label": "Paint toolbar", "data-testid": "paint-toolbar", children: [
|
|
471
481
|
import_paint_editor3.PAINT_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", "aria-pressed": tool === t.id, title: `${t.label} (${t.key.toUpperCase()})`, className: chip(tool === t.id), onClick: () => onToolChange(t.id), children: t.label }, t.id)),
|
|
482
|
+
tool === "fill" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex items-center gap-1.5 rounded border border-slate-700/80 bg-slate-900/60 px-2 py-0.5 text-[11px] text-slate-300", "data-testid": "paint-fill-options", children: [
|
|
483
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
484
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "Ref" }),
|
|
485
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
486
|
+
"select",
|
|
487
|
+
{
|
|
488
|
+
"aria-label": "Fill reference",
|
|
489
|
+
className: "rounded bg-slate-800 px-1 py-0.5 text-[11px]",
|
|
490
|
+
value: fill.reference ?? "all",
|
|
491
|
+
onChange: (e) => updateFill({ reference: e.target.value }),
|
|
492
|
+
children: [
|
|
493
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "all", children: "All layers" }),
|
|
494
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "layer", children: "Active layer" }),
|
|
495
|
+
layers.map((l) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: l.id, children: l.name }, l.id))
|
|
496
|
+
]
|
|
497
|
+
}
|
|
498
|
+
)
|
|
499
|
+
] }),
|
|
500
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
501
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "Tol" }),
|
|
502
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
503
|
+
"input",
|
|
504
|
+
{
|
|
505
|
+
type: "number",
|
|
506
|
+
"aria-label": "Fill tolerance",
|
|
507
|
+
min: 0,
|
|
508
|
+
max: 255,
|
|
509
|
+
value: fill.tolerance ?? 32,
|
|
510
|
+
onChange: (e) => updateFill({ tolerance: Math.max(0, Math.min(255, Number(e.target.value) || 0)) }),
|
|
511
|
+
className: "w-11 rounded bg-slate-800 px-1 py-0.5 text-[11px]"
|
|
512
|
+
}
|
|
513
|
+
)
|
|
514
|
+
] }),
|
|
515
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
516
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "Gap" }),
|
|
517
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
518
|
+
"input",
|
|
519
|
+
{
|
|
520
|
+
type: "number",
|
|
521
|
+
"aria-label": "Close gap",
|
|
522
|
+
min: 0,
|
|
523
|
+
max: 32,
|
|
524
|
+
value: fill.closeGap ?? 4,
|
|
525
|
+
onChange: (e) => updateFill({ closeGap: Math.max(0, Math.min(32, Number(e.target.value) || 0)) }),
|
|
526
|
+
className: "w-10 rounded bg-slate-800 px-1 py-0.5 text-[11px]"
|
|
527
|
+
}
|
|
528
|
+
)
|
|
529
|
+
] }),
|
|
530
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
531
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "Expand" }),
|
|
532
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
533
|
+
"input",
|
|
534
|
+
{
|
|
535
|
+
type: "number",
|
|
536
|
+
"aria-label": "Expand fill",
|
|
537
|
+
min: -16,
|
|
538
|
+
max: 16,
|
|
539
|
+
value: fill.expand ?? 1,
|
|
540
|
+
onChange: (e) => updateFill({ expand: Math.max(-16, Math.min(16, Number(e.target.value) || 0)) }),
|
|
541
|
+
className: "w-10 rounded bg-slate-800 px-1 py-0.5 text-[11px]"
|
|
542
|
+
}
|
|
543
|
+
)
|
|
544
|
+
] }),
|
|
545
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: chip(Boolean(fill.wet)), "aria-pressed": Boolean(fill.wet), onClick: () => updateFill({ wet: !fill.wet }), children: "Wet" })
|
|
546
|
+
] }),
|
|
472
547
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "mx-1 h-4 w-px bg-slate-700" }),
|
|
473
548
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: button, disabled: !state.canUndo, title: state.undoLabel ? `Undo ${state.undoLabel}` : "Undo", onClick: () => controller.undo(), children: "Undo" }),
|
|
474
549
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: button, disabled: !state.canRedo, title: state.redoLabel ? `Redo ${state.redoLabel}` : "Redo", onClick: () => controller.redo(), children: "Redo" }),
|
|
@@ -1999,29 +2074,194 @@ var PathStrokePanel = ({ controller, className }) => {
|
|
|
1999
2074
|
] });
|
|
2000
2075
|
};
|
|
2001
2076
|
|
|
2077
|
+
// src/paint-editor/EvolutionPanel.tsx
|
|
2078
|
+
var import_react17 = require("react");
|
|
2079
|
+
var import_paint_editor14 = require("@pixerate/editor/paint-editor");
|
|
2080
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2081
|
+
var EvolutionPanel = ({ controller, proposals, className }) => {
|
|
2082
|
+
const state = usePaintEditorState(controller);
|
|
2083
|
+
const store = proposals ?? controller.proposals;
|
|
2084
|
+
const proposalState = (0, import_react17.useSyncExternalStore)(store.subscribe, store.getState, store.getState);
|
|
2085
|
+
const [error, attempt] = useAttempt();
|
|
2086
|
+
const [selectedStrokes, setSelectedStrokes] = (0, import_react17.useState)([]);
|
|
2087
|
+
const [selectedProposals, setSelectedProposals] = (0, import_react17.useState)([]);
|
|
2088
|
+
const [count, setCount] = (0, import_react17.useState)(4);
|
|
2089
|
+
const [seed, setSeed] = (0, import_react17.useState)(1);
|
|
2090
|
+
const [mutation, setMutation] = (0, import_react17.useState)(() => (0, import_paint_editor14.normalizeMutationRates)());
|
|
2091
|
+
const [contactSheetUrl, setContactSheetUrl] = (0, import_react17.useState)(null);
|
|
2092
|
+
const eligibleStrokes = state.document.strokes.filter((s) => !(0, import_paint_editor14.liveStrokeRefusal)(s.brush));
|
|
2093
|
+
const activeStrokeIds = selectedStrokes.filter((id) => eligibleStrokes.some((s) => s.id === id));
|
|
2094
|
+
const effectiveStrokeIds = activeStrokeIds.length > 0 ? activeStrokeIds : state.selectedStroke && eligibleStrokes.some((s) => s.id === state.selectedStroke) ? [state.selectedStroke] : eligibleStrokes.length > 0 ? [eligibleStrokes[eligibleStrokes.length - 1].id] : [];
|
|
2095
|
+
const variants = proposalState.proposals.filter((p) => (0, import_paint_editor14.proposalGenomeStrokes)(p).length > 0);
|
|
2096
|
+
const activeProposalIds = selectedProposals.filter((id) => variants.some((v) => v.id === id));
|
|
2097
|
+
const toggleStroke = (id) => {
|
|
2098
|
+
setSelectedStrokes((prev) => prev.includes(id) ? prev.filter((x) => x !== id) : [...prev.slice(-15), id]);
|
|
2099
|
+
};
|
|
2100
|
+
const toggleProposal = (id) => {
|
|
2101
|
+
setSelectedProposals((prev) => prev.includes(id) ? prev.filter((x) => x !== id) : [...prev.slice(-1), id]);
|
|
2102
|
+
};
|
|
2103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "evolution-panel", children: [
|
|
2104
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
2105
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "font-medium text-slate-300", children: [
|
|
2106
|
+
"Evolution (",
|
|
2107
|
+
eligibleStrokes.length,
|
|
2108
|
+
")"
|
|
2109
|
+
] }),
|
|
2110
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1 text-[11px] text-slate-400", children: [
|
|
2111
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "Count" }),
|
|
2112
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2113
|
+
"input",
|
|
2114
|
+
{
|
|
2115
|
+
type: "number",
|
|
2116
|
+
"aria-label": "Variant count",
|
|
2117
|
+
min: 2,
|
|
2118
|
+
max: 12,
|
|
2119
|
+
value: count,
|
|
2120
|
+
onChange: (e) => setCount(Math.max(2, Math.min(12, Number(e.target.value) || 4))),
|
|
2121
|
+
className: "w-11 rounded bg-slate-800 px-1 py-0.5 text-right font-mono text-slate-200"
|
|
2122
|
+
}
|
|
2123
|
+
)
|
|
2124
|
+
] }) })
|
|
2125
|
+
] }),
|
|
2126
|
+
eligibleStrokes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex max-h-20 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Parent strokes", children: eligibleStrokes.map((s, i) => {
|
|
2127
|
+
const on = effectiveStrokeIds.includes(s.id);
|
|
2128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2129
|
+
"button",
|
|
2130
|
+
{
|
|
2131
|
+
type: "button",
|
|
2132
|
+
role: "option",
|
|
2133
|
+
"aria-selected": on,
|
|
2134
|
+
title: `${i + 1}. ${s.brush.name} (${s.id})`,
|
|
2135
|
+
className: `h-5 w-5 rounded ring-1 ${on ? "ring-indigo-400" : "ring-slate-700"}`,
|
|
2136
|
+
style: { background: s.color },
|
|
2137
|
+
onClick: () => toggleStroke(s.id)
|
|
2138
|
+
},
|
|
2139
|
+
s.id
|
|
2140
|
+
);
|
|
2141
|
+
}) }),
|
|
2142
|
+
import_paint_editor14.EVOLUTION_SLIDERS.map((c) => {
|
|
2143
|
+
const key = c.path;
|
|
2144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2145
|
+
PaintSlider,
|
|
2146
|
+
{
|
|
2147
|
+
control: c,
|
|
2148
|
+
value: mutation[key],
|
|
2149
|
+
onChange: (v) => setMutation((prev) => ({ ...prev, [key]: v }))
|
|
2150
|
+
},
|
|
2151
|
+
c.path
|
|
2152
|
+
);
|
|
2153
|
+
}),
|
|
2154
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
2155
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2156
|
+
"button",
|
|
2157
|
+
{
|
|
2158
|
+
type: "button",
|
|
2159
|
+
className: button,
|
|
2160
|
+
disabled: effectiveStrokeIds.length === 0 || state.stroking,
|
|
2161
|
+
onClick: () => attempt(() => {
|
|
2162
|
+
controller.breedStrokes({ strokeIds: effectiveStrokeIds, count, mutation, seed });
|
|
2163
|
+
setSeed((s) => s + 1);
|
|
2164
|
+
}),
|
|
2165
|
+
children: "Breed strokes"
|
|
2166
|
+
}
|
|
2167
|
+
),
|
|
2168
|
+
activeProposalIds.length === 2 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2169
|
+
"button",
|
|
2170
|
+
{
|
|
2171
|
+
type: "button",
|
|
2172
|
+
className: button,
|
|
2173
|
+
disabled: state.stroking,
|
|
2174
|
+
onClick: () => attempt(() => {
|
|
2175
|
+
controller.breedProposal({ proposalIds: activeProposalIds, count, mutation, seed });
|
|
2176
|
+
setSeed((s) => s + 1);
|
|
2177
|
+
}),
|
|
2178
|
+
children: "Cross over (2)"
|
|
2179
|
+
}
|
|
2180
|
+
),
|
|
2181
|
+
variants.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2182
|
+
"button",
|
|
2183
|
+
{
|
|
2184
|
+
type: "button",
|
|
2185
|
+
className: button,
|
|
2186
|
+
onClick: () => attempt(() => {
|
|
2187
|
+
const sheet = (0, import_paint_editor14.exportProposalContactSheetPng)(controller, variants);
|
|
2188
|
+
setContactSheetUrl(`data:image/png;base64,${sheet.base64}`);
|
|
2189
|
+
}),
|
|
2190
|
+
children: "Contact sheet"
|
|
2191
|
+
}
|
|
2192
|
+
)
|
|
2193
|
+
] }),
|
|
2194
|
+
variants.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "grid grid-cols-2 gap-1.5", "data-testid": "evolution-grid", children: variants.map((p) => {
|
|
2195
|
+
const g = (0, import_paint_editor14.paintProposalGhost)(p);
|
|
2196
|
+
const picked = activeProposalIds.includes(p.id);
|
|
2197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2198
|
+
"div",
|
|
2199
|
+
{
|
|
2200
|
+
"data-testid": `evolution-variant-${p.id}`,
|
|
2201
|
+
className: `flex flex-col gap-1 rounded border p-1.5 ${picked ? "border-indigo-500 bg-slate-800/90" : "border-slate-800 bg-slate-950/60"}`,
|
|
2202
|
+
children: [
|
|
2203
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex items-center justify-between gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2204
|
+
"button",
|
|
2205
|
+
{
|
|
2206
|
+
type: "button",
|
|
2207
|
+
"aria-pressed": picked,
|
|
2208
|
+
className: chip(picked),
|
|
2209
|
+
onClick: () => toggleProposal(p.id),
|
|
2210
|
+
children: p.title
|
|
2211
|
+
}
|
|
2212
|
+
) }),
|
|
2213
|
+
g && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex h-16 items-center justify-center overflow-hidden rounded bg-slate-900/80 p-1", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PixelCanvas, { pixels: g, label: p.title, className: "max-h-full max-w-full object-contain" }) }),
|
|
2214
|
+
p.rationale && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "line-clamp-2 text-[10px] text-slate-400", title: p.rationale, children: p.rationale }),
|
|
2215
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
2216
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2217
|
+
"button",
|
|
2218
|
+
{
|
|
2219
|
+
type: "button",
|
|
2220
|
+
className: button,
|
|
2221
|
+
disabled: state.stroking,
|
|
2222
|
+
onClick: () => attempt(() => {
|
|
2223
|
+
controller.breedProposal({ proposalIds: [p.id], count, mutation, seed });
|
|
2224
|
+
setSeed((s) => s + 1);
|
|
2225
|
+
}),
|
|
2226
|
+
children: "Breed from"
|
|
2227
|
+
}
|
|
2228
|
+
),
|
|
2229
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => store.accept(p.id)), children: "Accept" }),
|
|
2230
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => store.reject(p.id)), children: "Dismiss" })
|
|
2231
|
+
] })
|
|
2232
|
+
]
|
|
2233
|
+
},
|
|
2234
|
+
p.id
|
|
2235
|
+
);
|
|
2236
|
+
}) }),
|
|
2237
|
+
contactSheetUrl && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("img", { src: contactSheetUrl, alt: "Variant contact sheet", className: "w-full rounded border border-slate-800", "data-testid": "evolution-contact-sheet" }),
|
|
2238
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ErrorLine, { error })
|
|
2239
|
+
] });
|
|
2240
|
+
};
|
|
2241
|
+
|
|
2002
2242
|
// src/paint-editor/PaintEditor.tsx
|
|
2003
|
-
var
|
|
2004
|
-
var
|
|
2243
|
+
var import_react31 = require("react");
|
|
2244
|
+
var import_paint_editor16 = require("@pixerate/editor/paint-editor");
|
|
2005
2245
|
|
|
2006
2246
|
// src/playback/AgentPlaybackContext.tsx
|
|
2007
|
-
var
|
|
2008
|
-
var
|
|
2009
|
-
var AgentPlaybackContext = (0,
|
|
2247
|
+
var import_react18 = require("react");
|
|
2248
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2249
|
+
var AgentPlaybackContext = (0, import_react18.createContext)(null);
|
|
2010
2250
|
function useAgentPlayback() {
|
|
2011
|
-
return (0,
|
|
2251
|
+
return (0, import_react18.useContext)(AgentPlaybackContext);
|
|
2012
2252
|
}
|
|
2013
2253
|
|
|
2014
2254
|
// src/playback/usePlaybackSurface.ts
|
|
2015
|
-
var
|
|
2255
|
+
var import_react19 = require("react");
|
|
2016
2256
|
var import_tools = require("@pixerate/editor/tools");
|
|
2017
2257
|
function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
|
|
2018
2258
|
const ambient = useAgentPlayback();
|
|
2019
2259
|
const target = playback === void 0 ? ambient : playback;
|
|
2020
|
-
const [ownPresence] = (0,
|
|
2260
|
+
const [ownPresence] = (0, import_react19.useState)(() => new import_tools.PresenceStore());
|
|
2021
2261
|
const presence = sharedPresence ?? ownPresence;
|
|
2022
|
-
const latest = (0,
|
|
2262
|
+
const latest = (0, import_react19.useRef)(options);
|
|
2023
2263
|
latest.current = options;
|
|
2024
|
-
(0,
|
|
2264
|
+
(0, import_react19.useEffect)(() => {
|
|
2025
2265
|
if (!target || !id) return;
|
|
2026
2266
|
const o = () => latest.current;
|
|
2027
2267
|
const surface = {
|
|
@@ -2053,13 +2293,13 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
|
|
|
2053
2293
|
}
|
|
2054
2294
|
|
|
2055
2295
|
// src/playback/PresenceLayer.tsx
|
|
2056
|
-
var
|
|
2057
|
-
var
|
|
2296
|
+
var import_react20 = __toESM(require("react"), 1);
|
|
2297
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2058
2298
|
function PresenceLayer({ presence, viewport, clip = true, renderCursor, className = "" }) {
|
|
2059
|
-
const { actors } = (0,
|
|
2299
|
+
const { actors } = (0, import_react20.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
|
|
2060
2300
|
if (!actors.length) return null;
|
|
2061
2301
|
const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
|
|
2062
|
-
return /* @__PURE__ */ (0,
|
|
2302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2063
2303
|
"div",
|
|
2064
2304
|
{
|
|
2065
2305
|
className: `pixerate-presence ${className}`.trim(),
|
|
@@ -2073,19 +2313,19 @@ function PresenceLayer({ presence, viewport, clip = true, renderCursor, classNam
|
|
|
2073
2313
|
const br = map({ x: a.focus.x + a.focus.width, y: a.focus.y + a.focus.height });
|
|
2074
2314
|
return { left: tl.x - 4, top: tl.y - 4, width: br.x - tl.x + 8, height: br.y - tl.y + 8 };
|
|
2075
2315
|
})();
|
|
2076
|
-
return /* @__PURE__ */ (0,
|
|
2077
|
-
ring && /* @__PURE__ */ (0,
|
|
2316
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react20.default.Fragment, { children: [
|
|
2317
|
+
ring && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2078
2318
|
"div",
|
|
2079
2319
|
{
|
|
2080
2320
|
"data-actor-focus": a.id,
|
|
2081
2321
|
style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
|
|
2082
2322
|
}
|
|
2083
2323
|
),
|
|
2084
|
-
/* @__PURE__ */ (0,
|
|
2085
|
-
/* @__PURE__ */ (0,
|
|
2086
|
-
/* @__PURE__ */ (0,
|
|
2087
|
-
/* @__PURE__ */ (0,
|
|
2088
|
-
a.message && /* @__PURE__ */ (0,
|
|
2324
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: renderCursor ? renderCursor(a) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
2325
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("svg", { width: "18", height: "20", viewBox: "0 0 12 18", style: { display: "block", transform: a.pressed ? "scale(0.85)" : void 0, transformOrigin: "0 0", filter: "drop-shadow(0 1px 2px rgba(0,0,0,.35))" }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M0,0 L0,14 L4,10.5 L7,17 L9.5,16 L6.5,9.5 L11.5,9.5 Z", style: { fill: a.color, stroke: "#ffffff", strokeWidth: 1 } }) }),
|
|
2326
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
|
|
2327
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
|
|
2328
|
+
a.message && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "data-actor-message": a.id, style: { width: "max-content", maxWidth: 240, borderRadius: 8, borderTopLeftRadius: 0, padding: "4px 8px", fontSize: 12, color: "#1e293b", background: "#ffffff", boxShadow: "0 4px 12px rgba(15,23,42,.18)" }, children: a.message })
|
|
2089
2329
|
] })
|
|
2090
2330
|
] }) })
|
|
2091
2331
|
] }, a.id);
|
|
@@ -2095,16 +2335,16 @@ function PresenceLayer({ presence, viewport, clip = true, renderCursor, classNam
|
|
|
2095
2335
|
}
|
|
2096
2336
|
|
|
2097
2337
|
// src/paint-editor/PaintEffectsPanel.tsx
|
|
2098
|
-
var
|
|
2099
|
-
var
|
|
2338
|
+
var import_react30 = require("react");
|
|
2339
|
+
var import_paint_editor15 = require("@pixerate/editor/paint-editor");
|
|
2100
2340
|
var import_effects4 = require("@pixerate/editor/effects");
|
|
2101
2341
|
|
|
2102
2342
|
// src/effects/useEffects.ts
|
|
2103
|
-
var
|
|
2343
|
+
var import_react21 = require("react");
|
|
2104
2344
|
function useEffectDescription(provider, effect) {
|
|
2105
|
-
const [state, setState] = (0,
|
|
2345
|
+
const [state, setState] = (0, import_react21.useState)({ key: "", description: null, error: null });
|
|
2106
2346
|
const key = provider && effect ? `${provider.id}:${effect}` : "";
|
|
2107
|
-
(0,
|
|
2347
|
+
(0, import_react21.useEffect)(() => {
|
|
2108
2348
|
if (!provider || !effect) return;
|
|
2109
2349
|
let live = true;
|
|
2110
2350
|
Promise.resolve().then(() => provider.describe(effect)).then(
|
|
@@ -2119,14 +2359,14 @@ function useEffectDescription(provider, effect) {
|
|
|
2119
2359
|
}
|
|
2120
2360
|
|
|
2121
2361
|
// src/effects/EffectThumbnail.tsx
|
|
2122
|
-
var
|
|
2362
|
+
var import_react22 = require("react");
|
|
2123
2363
|
var import_effects = require("@pixerate/editor/effects");
|
|
2124
|
-
var
|
|
2364
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2125
2365
|
var LABELS = { motion: "Motion", camera: "Camera", timing: "Timing" };
|
|
2126
2366
|
function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
|
|
2127
|
-
const ref = (0,
|
|
2128
|
-
const [failed, setFailed] = (0,
|
|
2129
|
-
(0,
|
|
2367
|
+
const ref = (0, import_react22.useRef)(null);
|
|
2368
|
+
const [failed, setFailed] = (0, import_react22.useState)(effect.kind in LABELS);
|
|
2369
|
+
(0, import_react22.useEffect)(() => {
|
|
2130
2370
|
if (effect.kind in LABELS) return;
|
|
2131
2371
|
let live = true;
|
|
2132
2372
|
(0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
|
|
@@ -2141,28 +2381,28 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
|
|
|
2141
2381
|
live = false;
|
|
2142
2382
|
};
|
|
2143
2383
|
}, [provider, effect, width, height]);
|
|
2144
|
-
return /* @__PURE__ */ (0,
|
|
2384
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2145
2385
|
"div",
|
|
2146
2386
|
{
|
|
2147
2387
|
className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
|
|
2148
2388
|
style: { aspectRatio: `${width} / ${height}` },
|
|
2149
2389
|
"data-effect-thumbnail": effect.id,
|
|
2150
|
-
children: failed ? /* @__PURE__ */ (0,
|
|
2390
|
+
children: failed ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: LABELS[effect.kind] ?? "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
|
|
2151
2391
|
}
|
|
2152
2392
|
);
|
|
2153
2393
|
}
|
|
2154
2394
|
|
|
2155
2395
|
// src/effects/EffectsBrowser.tsx
|
|
2156
|
-
var
|
|
2396
|
+
var import_react23 = require("react");
|
|
2157
2397
|
var import_effects2 = require("@pixerate/editor/effects");
|
|
2158
|
-
var
|
|
2398
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2159
2399
|
function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
|
|
2160
|
-
const [all, setAll] = (0,
|
|
2161
|
-
const [query, setQuery] = (0,
|
|
2162
|
-
const [category, setCategory] = (0,
|
|
2163
|
-
const [use, setUse] = (0,
|
|
2164
|
-
const [error, setError] = (0,
|
|
2165
|
-
(0,
|
|
2400
|
+
const [all, setAll] = (0, import_react23.useState)([]);
|
|
2401
|
+
const [query, setQuery] = (0, import_react23.useState)("");
|
|
2402
|
+
const [category, setCategory] = (0, import_react23.useState)("");
|
|
2403
|
+
const [use, setUse] = (0, import_react23.useState)("");
|
|
2404
|
+
const [error, setError] = (0, import_react23.useState)(null);
|
|
2405
|
+
(0, import_react23.useEffect)(() => {
|
|
2166
2406
|
if (!provider) return setAll([]);
|
|
2167
2407
|
let live = true;
|
|
2168
2408
|
Promise.resolve().then(() => provider.list()).then(
|
|
@@ -2173,8 +2413,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
2173
2413
|
live = false;
|
|
2174
2414
|
};
|
|
2175
2415
|
}, [provider]);
|
|
2176
|
-
const [found, setFound] = (0,
|
|
2177
|
-
(0,
|
|
2416
|
+
const [found, setFound] = (0, import_react23.useState)([]);
|
|
2417
|
+
(0, import_react23.useEffect)(() => {
|
|
2178
2418
|
if (!provider) return setFound([]);
|
|
2179
2419
|
let live = true;
|
|
2180
2420
|
Promise.resolve().then(() => provider.search(query, { ...category ? { category } : {}, ...use ? { use } : {} })).then((list) => live && setFound(list), () => live && setFound([]));
|
|
@@ -2183,14 +2423,14 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
2183
2423
|
};
|
|
2184
2424
|
}, [provider, query, category, use]);
|
|
2185
2425
|
const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses);
|
|
2186
|
-
const categories = (0,
|
|
2426
|
+
const categories = (0, import_react23.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
|
|
2187
2427
|
const shown = found.filter(allowed);
|
|
2188
2428
|
if (!provider)
|
|
2189
|
-
return /* @__PURE__ */ (0,
|
|
2190
|
-
return /* @__PURE__ */ (0,
|
|
2191
|
-
title && /* @__PURE__ */ (0,
|
|
2192
|
-
/* @__PURE__ */ (0,
|
|
2193
|
-
/* @__PURE__ */ (0,
|
|
2429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground ${className}`, "data-effects-browser": "", "data-effects-unavailable": "", children: "No effects provider is registered, so effects cannot be added. Effects already in the document are kept." });
|
|
2430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
|
|
2431
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h3", { className: "text-xs font-semibold", children: title }),
|
|
2432
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
2433
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2194
2434
|
"input",
|
|
2195
2435
|
{
|
|
2196
2436
|
type: "search",
|
|
@@ -2201,17 +2441,17 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
2201
2441
|
onChange: (e) => setQuery(e.currentTarget.value)
|
|
2202
2442
|
}
|
|
2203
2443
|
),
|
|
2204
|
-
/* @__PURE__ */ (0,
|
|
2205
|
-
/* @__PURE__ */ (0,
|
|
2206
|
-
categories.map((c) => /* @__PURE__ */ (0,
|
|
2444
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Category", value: category, onChange: (e) => setCategory(e.currentTarget.value), children: [
|
|
2445
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "", children: "All categories" }),
|
|
2446
|
+
categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: c, children: c }, c))
|
|
2207
2447
|
] }),
|
|
2208
|
-
uses && uses.length > 1 && /* @__PURE__ */ (0,
|
|
2209
|
-
/* @__PURE__ */ (0,
|
|
2210
|
-
uses.map((u) => /* @__PURE__ */ (0,
|
|
2448
|
+
uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Use", value: use, onChange: (e) => setUse(e.currentTarget.value), children: [
|
|
2449
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "", children: "Any use" }),
|
|
2450
|
+
uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
|
|
2211
2451
|
] })
|
|
2212
2452
|
] }),
|
|
2213
|
-
error && /* @__PURE__ */ (0,
|
|
2214
|
-
/* @__PURE__ */ (0,
|
|
2453
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
|
|
2454
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("ul", { className: "grid max-h-96 grid-cols-[repeat(auto-fill,minmax(6.5rem,1fr))] gap-1.5 overflow-y-auto", role: "list", children: shown.map((e) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2215
2455
|
"button",
|
|
2216
2456
|
{
|
|
2217
2457
|
type: "button",
|
|
@@ -2220,23 +2460,23 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
2220
2460
|
"data-effect-id": e.id,
|
|
2221
2461
|
onClick: () => onPick(e),
|
|
2222
2462
|
children: [
|
|
2223
|
-
thumbnails && /* @__PURE__ */ (0,
|
|
2224
|
-
/* @__PURE__ */ (0,
|
|
2225
|
-
/* @__PURE__ */ (0,
|
|
2463
|
+
thumbnails && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(EffectThumbnail, { provider, effect: e }),
|
|
2464
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
|
|
2465
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
|
|
2226
2466
|
]
|
|
2227
2467
|
}
|
|
2228
2468
|
) }, e.id)) }),
|
|
2229
|
-
!shown.length && !error && /* @__PURE__ */ (0,
|
|
2469
|
+
!shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
|
|
2230
2470
|
] });
|
|
2231
2471
|
}
|
|
2232
2472
|
|
|
2233
2473
|
// src/effects/EffectParameters.tsx
|
|
2234
|
-
var
|
|
2474
|
+
var import_react29 = __toESM(require("react"), 1);
|
|
2235
2475
|
var import_effects3 = require("@pixerate/editor/effects");
|
|
2236
2476
|
var import_parameters2 = require("@pixerate/editor/parameters");
|
|
2237
2477
|
|
|
2238
2478
|
// src/parameters/fields.tsx
|
|
2239
|
-
var
|
|
2479
|
+
var import_react28 = require("react");
|
|
2240
2480
|
var import_parameters = require("@pixerate/editor/parameters");
|
|
2241
2481
|
|
|
2242
2482
|
// src/color/index.ts
|
|
@@ -2249,9 +2489,9 @@ __export(color_exports, {
|
|
|
2249
2489
|
});
|
|
2250
2490
|
|
|
2251
2491
|
// src/color/ColorPicker.tsx
|
|
2252
|
-
var
|
|
2492
|
+
var import_react24 = require("react");
|
|
2253
2493
|
var import_color = require("@pixerate/editor/color");
|
|
2254
|
-
var
|
|
2494
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2255
2495
|
var LOCAL_STORAGE_KEY = "pixerate:color:recent";
|
|
2256
2496
|
function readLocalRecents() {
|
|
2257
2497
|
try {
|
|
@@ -2289,24 +2529,24 @@ var ColorPicker = ({
|
|
|
2289
2529
|
id,
|
|
2290
2530
|
"aria-label": ariaLabel = "Color picker"
|
|
2291
2531
|
}) => {
|
|
2292
|
-
const generatedId = (0,
|
|
2532
|
+
const generatedId = (0, import_react24.useId)();
|
|
2293
2533
|
const pickerId = id || generatedId;
|
|
2294
|
-
const [pickerState, setPickerState] = (0,
|
|
2534
|
+
const [pickerState, setPickerState] = (0, import_react24.useState)(
|
|
2295
2535
|
() => (0, import_color.pickerStateFromColor)(value) ?? DEFAULT_PICKER_STATE
|
|
2296
2536
|
);
|
|
2297
|
-
const stateRef = (0,
|
|
2537
|
+
const stateRef = (0, import_react24.useRef)(pickerState);
|
|
2298
2538
|
stateRef.current = pickerState;
|
|
2299
|
-
(0,
|
|
2539
|
+
(0, import_react24.useEffect)(() => {
|
|
2300
2540
|
const next = (0, import_color.pickerStateFromColor)(value, stateRef.current);
|
|
2301
2541
|
if (next) {
|
|
2302
2542
|
setPickerState(next);
|
|
2303
2543
|
}
|
|
2304
2544
|
}, [value]);
|
|
2305
|
-
const [internalRecent, setInternalRecent] = (0,
|
|
2545
|
+
const [internalRecent, setInternalRecent] = (0, import_react24.useState)(
|
|
2306
2546
|
() => controlledRecent ? [] : readLocalRecents()
|
|
2307
2547
|
);
|
|
2308
2548
|
const activeRecent = controlledRecent ?? internalRecent;
|
|
2309
|
-
const recordRecent = (0,
|
|
2549
|
+
const recordRecent = (0, import_react24.useCallback)(
|
|
2310
2550
|
(color) => {
|
|
2311
2551
|
const updated = (0, import_color.pushRecentColor)(activeRecent, color, 12);
|
|
2312
2552
|
if (!controlledRecent) {
|
|
@@ -2317,11 +2557,11 @@ var ColorPicker = ({
|
|
|
2317
2557
|
},
|
|
2318
2558
|
[activeRecent, controlledRecent, onRecentChange]
|
|
2319
2559
|
);
|
|
2320
|
-
const [textDraft, setTextDraft] = (0,
|
|
2321
|
-
const [isInvalid, setIsInvalid] = (0,
|
|
2322
|
-
const [isClipped, setIsClipped] = (0,
|
|
2323
|
-
const isTypingRef = (0,
|
|
2324
|
-
(0,
|
|
2560
|
+
const [textDraft, setTextDraft] = (0, import_react24.useState)(value);
|
|
2561
|
+
const [isInvalid, setIsInvalid] = (0, import_react24.useState)(false);
|
|
2562
|
+
const [isClipped, setIsClipped] = (0, import_react24.useState)(false);
|
|
2563
|
+
const isTypingRef = (0, import_react24.useRef)(false);
|
|
2564
|
+
(0, import_react24.useEffect)(() => {
|
|
2325
2565
|
if (!isTypingRef.current) {
|
|
2326
2566
|
setTextDraft(value);
|
|
2327
2567
|
setIsInvalid(false);
|
|
@@ -2329,11 +2569,11 @@ var ColorPicker = ({
|
|
|
2329
2569
|
setIsClipped(Boolean(parsed && !(0, import_color.inSrgbGamut)(parsed)));
|
|
2330
2570
|
}
|
|
2331
2571
|
}, [value]);
|
|
2332
|
-
const [hasEyeDropper, setHasEyeDropper] = (0,
|
|
2333
|
-
(0,
|
|
2572
|
+
const [hasEyeDropper, setHasEyeDropper] = (0, import_react24.useState)(false);
|
|
2573
|
+
(0, import_react24.useEffect)(() => {
|
|
2334
2574
|
setHasEyeDropper(typeof window !== "undefined" && "EyeDropper" in window);
|
|
2335
2575
|
}, []);
|
|
2336
|
-
const emitColorChange = (0,
|
|
2576
|
+
const emitColorChange = (0, import_react24.useCallback)(
|
|
2337
2577
|
(nextState) => {
|
|
2338
2578
|
setPickerState(nextState);
|
|
2339
2579
|
const hex = (0, import_color.pickerStateToHex)(nextState, alpha);
|
|
@@ -2341,10 +2581,10 @@ var ColorPicker = ({
|
|
|
2341
2581
|
},
|
|
2342
2582
|
[alpha, onChange]
|
|
2343
2583
|
);
|
|
2344
|
-
const latest = (0,
|
|
2584
|
+
const latest = (0, import_react24.useRef)({ emitColorChange, recordRecent, onGestureEnd, alpha });
|
|
2345
2585
|
latest.current = { emitColorChange, recordRecent, onGestureEnd, alpha };
|
|
2346
|
-
const endDragRef = (0,
|
|
2347
|
-
(0,
|
|
2586
|
+
const endDragRef = (0, import_react24.useRef)(null);
|
|
2587
|
+
(0, import_react24.useEffect)(() => () => endDragRef.current?.(), []);
|
|
2348
2588
|
const startDrag = (e, next) => {
|
|
2349
2589
|
if (disabled) return;
|
|
2350
2590
|
e.preventDefault();
|
|
@@ -2446,7 +2686,7 @@ var ColorPicker = ({
|
|
|
2446
2686
|
} catch {
|
|
2447
2687
|
}
|
|
2448
2688
|
};
|
|
2449
|
-
const contrastResult = (0,
|
|
2689
|
+
const contrastResult = (0, import_react24.useMemo)(() => {
|
|
2450
2690
|
if (!contrastAgainst) return null;
|
|
2451
2691
|
const fg = (0, import_color.parseColor)(value);
|
|
2452
2692
|
const bg = (0, import_color.parseColor)(contrastAgainst);
|
|
@@ -2458,7 +2698,7 @@ var ColorPicker = ({
|
|
|
2458
2698
|
}, [value, contrastAgainst]);
|
|
2459
2699
|
const currentHex = (0, import_color.pickerStateToHex)(pickerState, alpha);
|
|
2460
2700
|
const liveDescription = `Selected color: ${value}${contrastResult ? `, contrast ${contrastResult.ratio.toFixed(1)}:1 against ${contrastAgainst}, ${contrastResult.aa ? "passes AA" : "fails AA"}` : ""}`;
|
|
2461
|
-
return /* @__PURE__ */ (0,
|
|
2701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2462
2702
|
"div",
|
|
2463
2703
|
{
|
|
2464
2704
|
id: pickerId,
|
|
@@ -2482,7 +2722,7 @@ var ColorPicker = ({
|
|
|
2482
2722
|
pointerEvents: disabled ? "none" : "auto"
|
|
2483
2723
|
},
|
|
2484
2724
|
children: [
|
|
2485
|
-
/* @__PURE__ */ (0,
|
|
2725
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2486
2726
|
"span",
|
|
2487
2727
|
{
|
|
2488
2728
|
role: "status",
|
|
@@ -2501,7 +2741,7 @@ var ColorPicker = ({
|
|
|
2501
2741
|
children: liveDescription
|
|
2502
2742
|
}
|
|
2503
2743
|
),
|
|
2504
|
-
/* @__PURE__ */ (0,
|
|
2744
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2505
2745
|
"div",
|
|
2506
2746
|
{
|
|
2507
2747
|
role: "slider",
|
|
@@ -2523,7 +2763,7 @@ var ColorPicker = ({
|
|
|
2523
2763
|
touchAction: "none",
|
|
2524
2764
|
outline: "none"
|
|
2525
2765
|
},
|
|
2526
|
-
children: /* @__PURE__ */ (0,
|
|
2766
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2527
2767
|
"div",
|
|
2528
2768
|
{
|
|
2529
2769
|
style: {
|
|
@@ -2543,7 +2783,7 @@ var ColorPicker = ({
|
|
|
2543
2783
|
)
|
|
2544
2784
|
}
|
|
2545
2785
|
),
|
|
2546
|
-
/* @__PURE__ */ (0,
|
|
2786
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2547
2787
|
"div",
|
|
2548
2788
|
{
|
|
2549
2789
|
role: "slider",
|
|
@@ -2566,7 +2806,7 @@ var ColorPicker = ({
|
|
|
2566
2806
|
touchAction: "none",
|
|
2567
2807
|
outline: "none"
|
|
2568
2808
|
},
|
|
2569
|
-
children: /* @__PURE__ */ (0,
|
|
2809
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2570
2810
|
"div",
|
|
2571
2811
|
{
|
|
2572
2812
|
style: {
|
|
@@ -2586,7 +2826,7 @@ var ColorPicker = ({
|
|
|
2586
2826
|
)
|
|
2587
2827
|
}
|
|
2588
2828
|
),
|
|
2589
|
-
alpha && /* @__PURE__ */ (0,
|
|
2829
|
+
alpha && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2590
2830
|
"div",
|
|
2591
2831
|
{
|
|
2592
2832
|
role: "slider",
|
|
@@ -2612,7 +2852,7 @@ var ColorPicker = ({
|
|
|
2612
2852
|
overflow: "hidden"
|
|
2613
2853
|
},
|
|
2614
2854
|
children: [
|
|
2615
|
-
/* @__PURE__ */ (0,
|
|
2855
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2616
2856
|
"div",
|
|
2617
2857
|
{
|
|
2618
2858
|
style: {
|
|
@@ -2622,7 +2862,7 @@ var ColorPicker = ({
|
|
|
2622
2862
|
}
|
|
2623
2863
|
}
|
|
2624
2864
|
),
|
|
2625
|
-
/* @__PURE__ */ (0,
|
|
2865
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2626
2866
|
"div",
|
|
2627
2867
|
{
|
|
2628
2868
|
style: {
|
|
@@ -2643,8 +2883,8 @@ var ColorPicker = ({
|
|
|
2643
2883
|
]
|
|
2644
2884
|
}
|
|
2645
2885
|
),
|
|
2646
|
-
/* @__PURE__ */ (0,
|
|
2647
|
-
/* @__PURE__ */ (0,
|
|
2886
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
|
|
2887
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2648
2888
|
"div",
|
|
2649
2889
|
{
|
|
2650
2890
|
style: {
|
|
@@ -2658,7 +2898,7 @@ var ColorPicker = ({
|
|
|
2658
2898
|
flexShrink: 0,
|
|
2659
2899
|
border: "1px solid rgba(255,255,255,0.15)"
|
|
2660
2900
|
},
|
|
2661
|
-
children: /* @__PURE__ */ (0,
|
|
2901
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2662
2902
|
"div",
|
|
2663
2903
|
{
|
|
2664
2904
|
style: {
|
|
@@ -2670,7 +2910,7 @@ var ColorPicker = ({
|
|
|
2670
2910
|
)
|
|
2671
2911
|
}
|
|
2672
2912
|
),
|
|
2673
|
-
/* @__PURE__ */ (0,
|
|
2913
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2674
2914
|
"input",
|
|
2675
2915
|
{
|
|
2676
2916
|
type: "text",
|
|
@@ -2700,7 +2940,7 @@ var ColorPicker = ({
|
|
|
2700
2940
|
}
|
|
2701
2941
|
}
|
|
2702
2942
|
),
|
|
2703
|
-
hasEyeDropper && /* @__PURE__ */ (0,
|
|
2943
|
+
hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2704
2944
|
"button",
|
|
2705
2945
|
{
|
|
2706
2946
|
type: "button",
|
|
@@ -2720,7 +2960,7 @@ var ColorPicker = ({
|
|
|
2720
2960
|
color: "inherit",
|
|
2721
2961
|
cursor: disabled ? "default" : "pointer"
|
|
2722
2962
|
},
|
|
2723
|
-
children: /* @__PURE__ */ (0,
|
|
2963
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2724
2964
|
"svg",
|
|
2725
2965
|
{
|
|
2726
2966
|
width: "14",
|
|
@@ -2732,16 +2972,16 @@ var ColorPicker = ({
|
|
|
2732
2972
|
strokeLinecap: "round",
|
|
2733
2973
|
strokeLinejoin: "round",
|
|
2734
2974
|
children: [
|
|
2735
|
-
/* @__PURE__ */ (0,
|
|
2736
|
-
/* @__PURE__ */ (0,
|
|
2737
|
-
/* @__PURE__ */ (0,
|
|
2975
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "m19 11-8-8-8.5 8.5a2.12 2.12 0 0 0 0 3l2.5 2.5 1.5-1.5" }),
|
|
2976
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
|
|
2977
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "m14 6 4 4" })
|
|
2738
2978
|
]
|
|
2739
2979
|
}
|
|
2740
2980
|
)
|
|
2741
2981
|
}
|
|
2742
2982
|
)
|
|
2743
2983
|
] }),
|
|
2744
|
-
isClipped && /* @__PURE__ */ (0,
|
|
2984
|
+
isClipped && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2745
2985
|
"div",
|
|
2746
2986
|
{
|
|
2747
2987
|
role: "note",
|
|
@@ -2757,10 +2997,10 @@ var ColorPicker = ({
|
|
|
2757
2997
|
borderRadius: "4px",
|
|
2758
2998
|
alignSelf: "flex-start"
|
|
2759
2999
|
},
|
|
2760
|
-
children: /* @__PURE__ */ (0,
|
|
3000
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
|
|
2761
3001
|
}
|
|
2762
3002
|
),
|
|
2763
|
-
contrastResult && /* @__PURE__ */ (0,
|
|
3003
|
+
contrastResult && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2764
3004
|
"div",
|
|
2765
3005
|
{
|
|
2766
3006
|
style: {
|
|
@@ -2774,15 +3014,15 @@ var ColorPicker = ({
|
|
|
2774
3014
|
border: "1px solid rgba(255,255,255,0.1)"
|
|
2775
3015
|
},
|
|
2776
3016
|
children: [
|
|
2777
|
-
/* @__PURE__ */ (0,
|
|
3017
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { children: [
|
|
2778
3018
|
"Contrast: ",
|
|
2779
|
-
/* @__PURE__ */ (0,
|
|
3019
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("strong", { children: [
|
|
2780
3020
|
contrastResult.ratio.toFixed(2),
|
|
2781
3021
|
":1"
|
|
2782
3022
|
] })
|
|
2783
3023
|
] }),
|
|
2784
|
-
/* @__PURE__ */ (0,
|
|
2785
|
-
/* @__PURE__ */ (0,
|
|
3024
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
|
|
3025
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2786
3026
|
"span",
|
|
2787
3027
|
{
|
|
2788
3028
|
style: {
|
|
@@ -2795,7 +3035,7 @@ var ColorPicker = ({
|
|
|
2795
3035
|
]
|
|
2796
3036
|
}
|
|
2797
3037
|
),
|
|
2798
|
-
/* @__PURE__ */ (0,
|
|
3038
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2799
3039
|
"span",
|
|
2800
3040
|
{
|
|
2801
3041
|
style: {
|
|
@@ -2812,9 +3052,9 @@ var ColorPicker = ({
|
|
|
2812
3052
|
]
|
|
2813
3053
|
}
|
|
2814
3054
|
),
|
|
2815
|
-
swatches && swatches.length > 0 && /* @__PURE__ */ (0,
|
|
2816
|
-
/* @__PURE__ */ (0,
|
|
2817
|
-
/* @__PURE__ */ (0,
|
|
3055
|
+
swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
|
|
3056
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
|
|
3057
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2818
3058
|
"button",
|
|
2819
3059
|
{
|
|
2820
3060
|
type: "button",
|
|
@@ -2840,9 +3080,9 @@ var ColorPicker = ({
|
|
|
2840
3080
|
`${color}-${idx}`
|
|
2841
3081
|
)) })
|
|
2842
3082
|
] }),
|
|
2843
|
-
activeRecent.length > 0 && /* @__PURE__ */ (0,
|
|
2844
|
-
/* @__PURE__ */ (0,
|
|
2845
|
-
/* @__PURE__ */ (0,
|
|
3083
|
+
activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
|
|
3084
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
|
|
3085
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2846
3086
|
"button",
|
|
2847
3087
|
{
|
|
2848
3088
|
type: "button",
|
|
@@ -2873,9 +3113,9 @@ var ColorPicker = ({
|
|
|
2873
3113
|
};
|
|
2874
3114
|
|
|
2875
3115
|
// src/color/DualColorPicker.tsx
|
|
2876
|
-
var
|
|
3116
|
+
var import_react25 = require("react");
|
|
2877
3117
|
var import_color2 = require("@pixerate/editor/color");
|
|
2878
|
-
var
|
|
3118
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2879
3119
|
function DualColorPicker({
|
|
2880
3120
|
value,
|
|
2881
3121
|
onChange,
|
|
@@ -2890,8 +3130,8 @@ function DualColorPicker({
|
|
|
2890
3130
|
disabled = false,
|
|
2891
3131
|
className = ""
|
|
2892
3132
|
}) {
|
|
2893
|
-
const sameId = (0,
|
|
2894
|
-
const [internalScheme, setInternalScheme] = (0,
|
|
3133
|
+
const sameId = (0, import_react25.useId)();
|
|
3134
|
+
const [internalScheme, setInternalScheme] = (0, import_react25.useState)("light");
|
|
2895
3135
|
const activeScheme = controlledScheme ?? internalScheme;
|
|
2896
3136
|
const handleSchemeSelect = (nextScheme) => {
|
|
2897
3137
|
if (onSchemeChange) {
|
|
@@ -2902,7 +3142,7 @@ function DualColorPicker({
|
|
|
2902
3142
|
};
|
|
2903
3143
|
const dual = (0, import_color2.normalizeDualColor)(value) ?? { light: "#000000", dark: "#000000" };
|
|
2904
3144
|
const isSame = dual.light.toLowerCase() === dual.dark.toLowerCase();
|
|
2905
|
-
const [sameInBoth, setSameInBoth] = (0,
|
|
3145
|
+
const [sameInBoth, setSameInBoth] = (0, import_react25.useState)(isSame);
|
|
2906
3146
|
const handleSameToggle = (e) => {
|
|
2907
3147
|
const nextSame = e.target.checked;
|
|
2908
3148
|
setSameInBoth(nextSame);
|
|
@@ -2934,7 +3174,7 @@ function DualColorPicker({
|
|
|
2934
3174
|
const activeColor = activeScheme === "dark" ? dual.dark : dual.light;
|
|
2935
3175
|
const activeContrastTarget = contrastAgainst ? (0, import_color2.resolveColor)(contrastAgainst, activeScheme) ?? void 0 : void 0;
|
|
2936
3176
|
const dualContrast = contrastAgainst && (0, import_color2.normalizeDualColor)(contrastAgainst) ? (0, import_color2.checkDualColorContrast)(dual, contrastAgainst) : null;
|
|
2937
|
-
return /* @__PURE__ */ (0,
|
|
3177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
2938
3178
|
"div",
|
|
2939
3179
|
{
|
|
2940
3180
|
className: `pixerate-dual-color-picker ${className}`,
|
|
@@ -2953,7 +3193,7 @@ function DualColorPicker({
|
|
|
2953
3193
|
boxSizing: "border-box"
|
|
2954
3194
|
},
|
|
2955
3195
|
children: [
|
|
2956
|
-
/* @__PURE__ */ (0,
|
|
3196
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
2957
3197
|
"div",
|
|
2958
3198
|
{
|
|
2959
3199
|
role: "tablist",
|
|
@@ -2966,7 +3206,7 @@ function DualColorPicker({
|
|
|
2966
3206
|
gap: "2px"
|
|
2967
3207
|
},
|
|
2968
3208
|
children: [
|
|
2969
|
-
/* @__PURE__ */ (0,
|
|
3209
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2970
3210
|
"button",
|
|
2971
3211
|
{
|
|
2972
3212
|
type: "button",
|
|
@@ -2989,7 +3229,7 @@ function DualColorPicker({
|
|
|
2989
3229
|
children: "Light"
|
|
2990
3230
|
}
|
|
2991
3231
|
),
|
|
2992
|
-
/* @__PURE__ */ (0,
|
|
3232
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2993
3233
|
"button",
|
|
2994
3234
|
{
|
|
2995
3235
|
type: "button",
|
|
@@ -3015,8 +3255,8 @@ function DualColorPicker({
|
|
|
3015
3255
|
]
|
|
3016
3256
|
}
|
|
3017
3257
|
),
|
|
3018
|
-
/* @__PURE__ */ (0,
|
|
3019
|
-
/* @__PURE__ */ (0,
|
|
3258
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
|
|
3259
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
3020
3260
|
"button",
|
|
3021
3261
|
{
|
|
3022
3262
|
type: "button",
|
|
@@ -3038,7 +3278,7 @@ function DualColorPicker({
|
|
|
3038
3278
|
outline: "none"
|
|
3039
3279
|
},
|
|
3040
3280
|
children: [
|
|
3041
|
-
/* @__PURE__ */ (0,
|
|
3281
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3042
3282
|
"span",
|
|
3043
3283
|
{
|
|
3044
3284
|
style: {
|
|
@@ -3050,11 +3290,11 @@ function DualColorPicker({
|
|
|
3050
3290
|
}
|
|
3051
3291
|
}
|
|
3052
3292
|
),
|
|
3053
|
-
/* @__PURE__ */ (0,
|
|
3293
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
|
|
3054
3294
|
]
|
|
3055
3295
|
}
|
|
3056
3296
|
),
|
|
3057
|
-
/* @__PURE__ */ (0,
|
|
3297
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
3058
3298
|
"button",
|
|
3059
3299
|
{
|
|
3060
3300
|
type: "button",
|
|
@@ -3076,7 +3316,7 @@ function DualColorPicker({
|
|
|
3076
3316
|
outline: "none"
|
|
3077
3317
|
},
|
|
3078
3318
|
children: [
|
|
3079
|
-
/* @__PURE__ */ (0,
|
|
3319
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3080
3320
|
"span",
|
|
3081
3321
|
{
|
|
3082
3322
|
style: {
|
|
@@ -3088,12 +3328,12 @@ function DualColorPicker({
|
|
|
3088
3328
|
}
|
|
3089
3329
|
}
|
|
3090
3330
|
),
|
|
3091
|
-
/* @__PURE__ */ (0,
|
|
3331
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
|
|
3092
3332
|
]
|
|
3093
3333
|
}
|
|
3094
3334
|
)
|
|
3095
3335
|
] }),
|
|
3096
|
-
/* @__PURE__ */ (0,
|
|
3336
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
3097
3337
|
"div",
|
|
3098
3338
|
{
|
|
3099
3339
|
style: {
|
|
@@ -3104,7 +3344,7 @@ function DualColorPicker({
|
|
|
3104
3344
|
padding: "2px 0"
|
|
3105
3345
|
},
|
|
3106
3346
|
children: [
|
|
3107
|
-
/* @__PURE__ */ (0,
|
|
3347
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
3108
3348
|
"label",
|
|
3109
3349
|
{
|
|
3110
3350
|
htmlFor: sameId,
|
|
@@ -3118,7 +3358,7 @@ function DualColorPicker({
|
|
|
3118
3358
|
color: "#c4cad4"
|
|
3119
3359
|
},
|
|
3120
3360
|
children: [
|
|
3121
|
-
/* @__PURE__ */ (0,
|
|
3361
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3122
3362
|
"input",
|
|
3123
3363
|
{
|
|
3124
3364
|
id: sameId,
|
|
@@ -3129,11 +3369,11 @@ function DualColorPicker({
|
|
|
3129
3369
|
style: { cursor: disabled ? "not-allowed" : "pointer" }
|
|
3130
3370
|
}
|
|
3131
3371
|
),
|
|
3132
|
-
/* @__PURE__ */ (0,
|
|
3372
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Same in both" })
|
|
3133
3373
|
]
|
|
3134
3374
|
}
|
|
3135
3375
|
),
|
|
3136
|
-
/* @__PURE__ */ (0,
|
|
3376
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3137
3377
|
"button",
|
|
3138
3378
|
{
|
|
3139
3379
|
type: "button",
|
|
@@ -3155,7 +3395,7 @@ function DualColorPicker({
|
|
|
3155
3395
|
]
|
|
3156
3396
|
}
|
|
3157
3397
|
),
|
|
3158
|
-
dualContrast && /* @__PURE__ */ (0,
|
|
3398
|
+
dualContrast && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
3159
3399
|
"div",
|
|
3160
3400
|
{
|
|
3161
3401
|
"data-testid": "dual-contrast-summary",
|
|
@@ -3169,20 +3409,20 @@ function DualColorPicker({
|
|
|
3169
3409
|
color: "#8c95a6"
|
|
3170
3410
|
},
|
|
3171
3411
|
children: [
|
|
3172
|
-
/* @__PURE__ */ (0,
|
|
3412
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { children: [
|
|
3173
3413
|
"Light:",
|
|
3174
3414
|
" ",
|
|
3175
|
-
/* @__PURE__ */ (0,
|
|
3415
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
|
|
3176
3416
|
dualContrast.light.ratio.toFixed(2),
|
|
3177
3417
|
" (",
|
|
3178
3418
|
dualContrast.light.level,
|
|
3179
3419
|
")"
|
|
3180
3420
|
] })
|
|
3181
3421
|
] }),
|
|
3182
|
-
/* @__PURE__ */ (0,
|
|
3422
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { children: [
|
|
3183
3423
|
"Dark:",
|
|
3184
3424
|
" ",
|
|
3185
|
-
/* @__PURE__ */ (0,
|
|
3425
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
|
|
3186
3426
|
dualContrast.dark.ratio.toFixed(2),
|
|
3187
3427
|
" (",
|
|
3188
3428
|
dualContrast.dark.level,
|
|
@@ -3192,7 +3432,7 @@ function DualColorPicker({
|
|
|
3192
3432
|
]
|
|
3193
3433
|
}
|
|
3194
3434
|
),
|
|
3195
|
-
/* @__PURE__ */ (0,
|
|
3435
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3196
3436
|
ColorPicker,
|
|
3197
3437
|
{
|
|
3198
3438
|
value: activeColor,
|
|
@@ -3211,7 +3451,7 @@ function DualColorPicker({
|
|
|
3211
3451
|
}
|
|
3212
3452
|
|
|
3213
3453
|
// src/color/useColorScheme.ts
|
|
3214
|
-
var
|
|
3454
|
+
var import_react26 = require("react");
|
|
3215
3455
|
var import_color3 = require("@pixerate/editor/color");
|
|
3216
3456
|
function getSnapshot(attribute) {
|
|
3217
3457
|
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
@@ -3236,7 +3476,7 @@ function getServerSnapshot() {
|
|
|
3236
3476
|
function useColorScheme(options) {
|
|
3237
3477
|
const override = options?.override;
|
|
3238
3478
|
const attribute = options?.attribute;
|
|
3239
|
-
const subscribe = (0,
|
|
3479
|
+
const subscribe = (0, import_react26.useMemo)(() => {
|
|
3240
3480
|
return (callback) => {
|
|
3241
3481
|
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
3242
3482
|
return () => {
|
|
@@ -3262,7 +3502,7 @@ function useColorScheme(options) {
|
|
|
3262
3502
|
};
|
|
3263
3503
|
};
|
|
3264
3504
|
}, [attribute]);
|
|
3265
|
-
const detected = (0,
|
|
3505
|
+
const detected = (0, import_react26.useSyncExternalStore)(
|
|
3266
3506
|
subscribe,
|
|
3267
3507
|
() => getSnapshot(attribute),
|
|
3268
3508
|
getServerSnapshot
|
|
@@ -3279,11 +3519,11 @@ function useResolvedColor(value, scheme) {
|
|
|
3279
3519
|
__reExport(color_exports, require("@pixerate/editor/color"));
|
|
3280
3520
|
|
|
3281
3521
|
// src/parameters/controls.tsx
|
|
3282
|
-
var
|
|
3283
|
-
var
|
|
3284
|
-
var ParameterComponentsContext = (0,
|
|
3522
|
+
var import_react27 = require("react");
|
|
3523
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3524
|
+
var ParameterComponentsContext = (0, import_react27.createContext)({});
|
|
3285
3525
|
function useParameterComponents() {
|
|
3286
|
-
return (0,
|
|
3526
|
+
return (0, import_react27.useContext)(ParameterComponentsContext);
|
|
3287
3527
|
}
|
|
3288
3528
|
function resolveParameterComponents(explicit, context) {
|
|
3289
3529
|
return {
|
|
@@ -3295,7 +3535,7 @@ function resolveParameterComponents(explicit, context) {
|
|
|
3295
3535
|
}
|
|
3296
3536
|
|
|
3297
3537
|
// src/parameters/fields.tsx
|
|
3298
|
-
var
|
|
3538
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3299
3539
|
var parameterInputStyle = import_parameters.parameterThemeStyles.input;
|
|
3300
3540
|
var parameterSelectStyle = import_parameters.parameterThemeStyles.select;
|
|
3301
3541
|
var parameterButtonStyle = import_parameters.parameterThemeStyles.button;
|
|
@@ -3304,9 +3544,9 @@ var parameterInputClass = "h-7 w-full min-w-0 rounded-md border border-input bg-
|
|
|
3304
3544
|
var parameterButtonClass = "inline-flex h-7 items-center justify-center gap-1 rounded-md border border-input bg-background px-2 text-xs text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:pointer-events-none disabled:opacity-50";
|
|
3305
3545
|
var rangeClass = "h-4 w-full min-w-0 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50";
|
|
3306
3546
|
function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown, style, ...rest }) {
|
|
3307
|
-
const inputRef = (0,
|
|
3308
|
-
const lastCommitted = (0,
|
|
3309
|
-
(0,
|
|
3547
|
+
const inputRef = (0, import_react28.useRef)(null);
|
|
3548
|
+
const lastCommitted = (0, import_react28.useRef)(null);
|
|
3549
|
+
(0, import_react28.useLayoutEffect)(() => {
|
|
3310
3550
|
lastCommitted.current = null;
|
|
3311
3551
|
const el = inputRef.current;
|
|
3312
3552
|
if (el && el.value !== value) el.value = value;
|
|
@@ -3317,9 +3557,9 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
|
|
|
3317
3557
|
onCommit(text, el);
|
|
3318
3558
|
lastCommitted.current = el.value === text ? text : null;
|
|
3319
3559
|
};
|
|
3320
|
-
const commitRef = (0,
|
|
3560
|
+
const commitRef = (0, import_react28.useRef)(commit);
|
|
3321
3561
|
commitRef.current = commit;
|
|
3322
|
-
(0,
|
|
3562
|
+
(0, import_react28.useEffect)(() => {
|
|
3323
3563
|
const el = inputRef.current;
|
|
3324
3564
|
if (!el) return;
|
|
3325
3565
|
const change = () => commitRef.current(el);
|
|
@@ -3350,7 +3590,7 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
|
|
|
3350
3590
|
if (typeof forwarded === "function") forwarded(el);
|
|
3351
3591
|
else if (forwarded) forwarded.current = el;
|
|
3352
3592
|
};
|
|
3353
|
-
return multiline ? /* @__PURE__ */ (0,
|
|
3593
|
+
return multiline ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("textarea", { ...props, ref: setRef, className: `${props.className} h-auto min-h-[3.5rem] py-1` }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("input", { type: "text", ...props, ref: setRef });
|
|
3354
3594
|
}
|
|
3355
3595
|
var plainNumber = (field, value) => (0, import_parameters.formatParameterNumber)({ ...field, unit: void 0 }, value);
|
|
3356
3596
|
function ParameterNumberInput(props) {
|
|
@@ -3384,9 +3624,9 @@ function ParameterNumberInput(props) {
|
|
|
3384
3624
|
onCommit: handleCommit,
|
|
3385
3625
|
onKeyDown: handleKeyDown
|
|
3386
3626
|
};
|
|
3387
|
-
return /* @__PURE__ */ (0,
|
|
3388
|
-
CustomInput ? /* @__PURE__ */ (0,
|
|
3389
|
-
field.unit && /* @__PURE__ */ (0,
|
|
3627
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
|
|
3628
|
+
CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field) }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterCommitInput, { ...inputProps }),
|
|
3629
|
+
field.unit && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
|
|
3390
3630
|
] });
|
|
3391
3631
|
}
|
|
3392
3632
|
function ParameterSlider(props) {
|
|
@@ -3394,7 +3634,7 @@ function ParameterSlider(props) {
|
|
|
3394
3634
|
const ctx = useParameterComponents();
|
|
3395
3635
|
const resolved = resolveParameterComponents(components, ctx);
|
|
3396
3636
|
const CustomSlider = resolved.slider;
|
|
3397
|
-
const dragging = (0,
|
|
3637
|
+
const dragging = (0, import_react28.useRef)(false);
|
|
3398
3638
|
const start = () => {
|
|
3399
3639
|
if (dragging.current) return;
|
|
3400
3640
|
dragging.current = true;
|
|
@@ -3405,7 +3645,7 @@ function ParameterSlider(props) {
|
|
|
3405
3645
|
dragging.current = false;
|
|
3406
3646
|
onGestureEnd?.();
|
|
3407
3647
|
};
|
|
3408
|
-
if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0,
|
|
3648
|
+
if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterNumberInput, { ...props });
|
|
3409
3649
|
const step = (0, import_parameters.parameterStep)(field);
|
|
3410
3650
|
const sliderProps = {
|
|
3411
3651
|
"aria-label": (0, import_parameters.parameterLabel)(field),
|
|
@@ -3419,8 +3659,8 @@ function ParameterSlider(props) {
|
|
|
3419
3659
|
className: rangeClass,
|
|
3420
3660
|
style: parameterRangeStyle
|
|
3421
3661
|
};
|
|
3422
|
-
return /* @__PURE__ */ (0,
|
|
3423
|
-
CustomSlider ? /* @__PURE__ */ (0,
|
|
3662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3663
|
+
CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3424
3664
|
CustomSlider,
|
|
3425
3665
|
{
|
|
3426
3666
|
...sliderProps,
|
|
@@ -3430,7 +3670,7 @@ function ParameterSlider(props) {
|
|
|
3430
3670
|
onGestureStart: start,
|
|
3431
3671
|
onGestureEnd: end
|
|
3432
3672
|
}
|
|
3433
|
-
) : /* @__PURE__ */ (0,
|
|
3673
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3434
3674
|
"input",
|
|
3435
3675
|
{
|
|
3436
3676
|
type: "range",
|
|
@@ -3442,11 +3682,11 @@ function ParameterSlider(props) {
|
|
|
3442
3682
|
onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field, Number(e.target.value)))
|
|
3443
3683
|
}
|
|
3444
3684
|
),
|
|
3445
|
-
/* @__PURE__ */ (0,
|
|
3685
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
|
|
3446
3686
|
] });
|
|
3447
3687
|
}
|
|
3448
3688
|
function ParameterToggle({ field, value, onChange, disabled, id }) {
|
|
3449
|
-
return /* @__PURE__ */ (0,
|
|
3689
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3450
3690
|
"button",
|
|
3451
3691
|
{
|
|
3452
3692
|
type: "button",
|
|
@@ -3457,7 +3697,7 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
|
|
|
3457
3697
|
disabled: disabled || field.readOnly,
|
|
3458
3698
|
onClick: () => onChange(!value),
|
|
3459
3699
|
className: `relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:opacity-50 ${value ? "bg-primary" : "bg-muted"}`,
|
|
3460
|
-
children: /* @__PURE__ */ (0,
|
|
3700
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3461
3701
|
"span",
|
|
3462
3702
|
{
|
|
3463
3703
|
className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
|
|
@@ -3474,7 +3714,7 @@ function ParameterSelect(props) {
|
|
|
3474
3714
|
const options = (0, import_parameters.getChoiceOptions)(field);
|
|
3475
3715
|
const off = disabled || field.readOnly;
|
|
3476
3716
|
if (field.control === "segmented") {
|
|
3477
|
-
return /* @__PURE__ */ (0,
|
|
3717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { role: "radiogroup", "aria-label": (0, import_parameters.parameterLabel)(field), className: "inline-flex flex-wrap rounded-md border border-input bg-muted p-0.5", children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3478
3718
|
"button",
|
|
3479
3719
|
{
|
|
3480
3720
|
type: "button",
|
|
@@ -3491,7 +3731,7 @@ function ParameterSelect(props) {
|
|
|
3491
3731
|
}
|
|
3492
3732
|
if (CustomSelect) {
|
|
3493
3733
|
const customOptions = options.map((o) => ({ value: o.value, label: (0, import_parameters.choiceOptionLabel)(o), description: o.description }));
|
|
3494
|
-
return /* @__PURE__ */ (0,
|
|
3734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3495
3735
|
CustomSelect,
|
|
3496
3736
|
{
|
|
3497
3737
|
id,
|
|
@@ -3507,7 +3747,7 @@ function ParameterSelect(props) {
|
|
|
3507
3747
|
);
|
|
3508
3748
|
}
|
|
3509
3749
|
const index = options.findIndex((o) => o.value === value);
|
|
3510
|
-
return /* @__PURE__ */ (0,
|
|
3750
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3511
3751
|
"select",
|
|
3512
3752
|
{
|
|
3513
3753
|
id,
|
|
@@ -3520,23 +3760,23 @@ function ParameterSelect(props) {
|
|
|
3520
3760
|
},
|
|
3521
3761
|
className: parameterInputClass,
|
|
3522
3762
|
style: parameterSelectStyle,
|
|
3523
|
-
children: options.map((o, i) => /* @__PURE__ */ (0,
|
|
3763
|
+
children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: String(i), title: o.description, style: parameterSelectStyle, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
|
|
3524
3764
|
}
|
|
3525
3765
|
);
|
|
3526
3766
|
}
|
|
3527
3767
|
function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id, components }) {
|
|
3528
3768
|
const CustomColor = resolveParameterComponents(components, useParameterComponents()).color;
|
|
3529
|
-
const [open, setOpen] = (0,
|
|
3530
|
-
const containerRef = (0,
|
|
3531
|
-
const buttonRef = (0,
|
|
3532
|
-
const popoverRef = (0,
|
|
3769
|
+
const [open, setOpen] = (0, import_react28.useState)(false);
|
|
3770
|
+
const containerRef = (0, import_react28.useRef)(null);
|
|
3771
|
+
const buttonRef = (0, import_react28.useRef)(null);
|
|
3772
|
+
const popoverRef = (0, import_react28.useRef)(null);
|
|
3533
3773
|
const alpha = !!field.alpha;
|
|
3534
3774
|
const hex = (0, import_parameters.normalizeHexColor)(value, true) ?? "#000000ff";
|
|
3535
3775
|
const rgb = hex.slice(0, 7);
|
|
3536
3776
|
const shown = alpha ? hex : rgb;
|
|
3537
3777
|
const off = disabled || field.readOnly;
|
|
3538
3778
|
const name = (0, import_parameters.parameterLabel)(field);
|
|
3539
|
-
(0,
|
|
3779
|
+
(0, import_react28.useEffect)(() => {
|
|
3540
3780
|
if (!open) return;
|
|
3541
3781
|
const onPointerDown = (e) => {
|
|
3542
3782
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -3558,7 +3798,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
3558
3798
|
};
|
|
3559
3799
|
}, [open]);
|
|
3560
3800
|
if (CustomColor) {
|
|
3561
|
-
return /* @__PURE__ */ (0,
|
|
3801
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3562
3802
|
CustomColor,
|
|
3563
3803
|
{
|
|
3564
3804
|
id,
|
|
@@ -3573,9 +3813,9 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
3573
3813
|
}
|
|
3574
3814
|
);
|
|
3575
3815
|
}
|
|
3576
|
-
return /* @__PURE__ */ (0,
|
|
3577
|
-
/* @__PURE__ */ (0,
|
|
3578
|
-
/* @__PURE__ */ (0,
|
|
3816
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
|
|
3817
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3818
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3579
3819
|
"button",
|
|
3580
3820
|
{
|
|
3581
3821
|
ref: buttonRef,
|
|
@@ -3586,10 +3826,10 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
3586
3826
|
disabled: off,
|
|
3587
3827
|
onClick: () => setOpen((prev) => !prev),
|
|
3588
3828
|
className: "relative h-7 w-9 shrink-0 overflow-hidden rounded-md border border-input bg-[repeating-conic-gradient(#d4d4d8_0_25%,#fff_0_50%)] bg-[length:8px_8px] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50",
|
|
3589
|
-
children: /* @__PURE__ */ (0,
|
|
3829
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
|
|
3590
3830
|
}
|
|
3591
3831
|
),
|
|
3592
|
-
/* @__PURE__ */ (0,
|
|
3832
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3593
3833
|
ParameterCommitInput,
|
|
3594
3834
|
{
|
|
3595
3835
|
id,
|
|
@@ -3605,7 +3845,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
3605
3845
|
}
|
|
3606
3846
|
)
|
|
3607
3847
|
] }),
|
|
3608
|
-
open && /* @__PURE__ */ (0,
|
|
3848
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3609
3849
|
"div",
|
|
3610
3850
|
{
|
|
3611
3851
|
ref: popoverRef,
|
|
@@ -3619,7 +3859,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
3619
3859
|
},
|
|
3620
3860
|
className: "absolute left-0 top-full z-50 mt-1 w-64 rounded-lg border border-border bg-popover p-2 text-popover-foreground shadow-xl",
|
|
3621
3861
|
style: { background: "var(--popover, var(--background, #fff))" },
|
|
3622
|
-
children: /* @__PURE__ */ (0,
|
|
3862
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3623
3863
|
ColorPicker,
|
|
3624
3864
|
{
|
|
3625
3865
|
value: shown,
|
|
@@ -3637,11 +3877,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
3637
3877
|
}
|
|
3638
3878
|
function ParameterVector({ field, value, onChange, disabled, id, components }) {
|
|
3639
3879
|
const size = (0, import_parameters.vectorSize)(field);
|
|
3640
|
-
return /* @__PURE__ */ (0,
|
|
3880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
|
|
3641
3881
|
const component = (0, import_parameters.vectorComponentField)(field, i);
|
|
3642
|
-
return /* @__PURE__ */ (0,
|
|
3643
|
-
/* @__PURE__ */ (0,
|
|
3644
|
-
/* @__PURE__ */ (0,
|
|
3882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
|
|
3883
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
|
|
3884
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3645
3885
|
ParameterNumberInput,
|
|
3646
3886
|
{
|
|
3647
3887
|
field: component,
|
|
@@ -3659,11 +3899,11 @@ function ParameterVector({ field, value, onChange, disabled, id, components }) {
|
|
|
3659
3899
|
function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
3660
3900
|
const off = disabled || field.readOnly;
|
|
3661
3901
|
const name = (0, import_parameters.parameterLabel)(field);
|
|
3662
|
-
return /* @__PURE__ */ (0,
|
|
3663
|
-
/* @__PURE__ */ (0,
|
|
3664
|
-
/* @__PURE__ */ (0,
|
|
3665
|
-
/* @__PURE__ */ (0,
|
|
3666
|
-
/* @__PURE__ */ (0,
|
|
3902
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "space-y-1.5", children: [
|
|
3903
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3904
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex h-12 w-16 shrink-0 items-center justify-center overflow-hidden rounded-md border border-input bg-muted", children: value ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
|
|
3905
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
3906
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3667
3907
|
ParameterCommitInput,
|
|
3668
3908
|
{
|
|
3669
3909
|
id,
|
|
@@ -3674,15 +3914,15 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
3674
3914
|
onCommit: (text) => onChange(text.trim())
|
|
3675
3915
|
}
|
|
3676
3916
|
),
|
|
3677
|
-
/* @__PURE__ */ (0,
|
|
3678
|
-
resolveFile && /* @__PURE__ */ (0,
|
|
3917
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex gap-1", children: [
|
|
3918
|
+
resolveFile && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
3679
3919
|
"label",
|
|
3680
3920
|
{
|
|
3681
3921
|
style: parameterButtonStyle,
|
|
3682
3922
|
className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`,
|
|
3683
3923
|
children: [
|
|
3684
3924
|
"Choose file\u2026",
|
|
3685
|
-
/* @__PURE__ */ (0,
|
|
3925
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3686
3926
|
"input",
|
|
3687
3927
|
{
|
|
3688
3928
|
type: "file",
|
|
@@ -3700,7 +3940,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
3700
3940
|
]
|
|
3701
3941
|
}
|
|
3702
3942
|
),
|
|
3703
|
-
value && /* @__PURE__ */ (0,
|
|
3943
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3704
3944
|
"button",
|
|
3705
3945
|
{
|
|
3706
3946
|
type: "button",
|
|
@@ -3715,7 +3955,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
3715
3955
|
] })
|
|
3716
3956
|
] })
|
|
3717
3957
|
] }),
|
|
3718
|
-
field.options && field.options.length > 0 && /* @__PURE__ */ (0,
|
|
3958
|
+
field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3719
3959
|
"button",
|
|
3720
3960
|
{
|
|
3721
3961
|
type: "button",
|
|
@@ -3725,14 +3965,14 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
3725
3965
|
disabled: off,
|
|
3726
3966
|
onClick: () => onChange(o.url),
|
|
3727
3967
|
className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
|
|
3728
|
-
children: /* @__PURE__ */ (0,
|
|
3968
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
|
|
3729
3969
|
},
|
|
3730
3970
|
o.url
|
|
3731
3971
|
)) })
|
|
3732
3972
|
] });
|
|
3733
3973
|
}
|
|
3734
3974
|
function ParameterText({ field, value, onChange, disabled, id }) {
|
|
3735
|
-
return /* @__PURE__ */ (0,
|
|
3975
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3736
3976
|
ParameterCommitInput,
|
|
3737
3977
|
{
|
|
3738
3978
|
id,
|
|
@@ -3751,24 +3991,24 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
|
|
|
3751
3991
|
switch (field.type) {
|
|
3752
3992
|
case "number":
|
|
3753
3993
|
case "int":
|
|
3754
|
-
return /* @__PURE__ */ (0,
|
|
3994
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
|
|
3755
3995
|
case "boolean":
|
|
3756
|
-
return /* @__PURE__ */ (0,
|
|
3996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
|
|
3757
3997
|
case "choice":
|
|
3758
|
-
return /* @__PURE__ */ (0,
|
|
3998
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
|
|
3759
3999
|
case "color":
|
|
3760
|
-
return /* @__PURE__ */ (0,
|
|
4000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
|
|
3761
4001
|
case "vector":
|
|
3762
|
-
return /* @__PURE__ */ (0,
|
|
4002
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
|
|
3763
4003
|
case "image":
|
|
3764
|
-
return /* @__PURE__ */ (0,
|
|
4004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
|
|
3765
4005
|
case "text":
|
|
3766
|
-
return /* @__PURE__ */ (0,
|
|
4006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterText, { field, value, onChange: set, ...rest });
|
|
3767
4007
|
}
|
|
3768
4008
|
}
|
|
3769
4009
|
|
|
3770
4010
|
// src/effects/EffectParameters.tsx
|
|
3771
|
-
var
|
|
4011
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3772
4012
|
function EffectParameters({
|
|
3773
4013
|
description,
|
|
3774
4014
|
values,
|
|
@@ -3783,10 +4023,10 @@ function EffectParameters({
|
|
|
3783
4023
|
className = "",
|
|
3784
4024
|
components
|
|
3785
4025
|
}) {
|
|
3786
|
-
const fields = (0,
|
|
3787
|
-
const idBase = (0,
|
|
3788
|
-
const gesture =
|
|
3789
|
-
const count =
|
|
4026
|
+
const fields = (0, import_react29.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
|
|
4027
|
+
const idBase = (0, import_react29.useId)();
|
|
4028
|
+
const gesture = import_react29.default.useRef(null);
|
|
4029
|
+
const count = import_react29.default.useRef(0);
|
|
3790
4030
|
const CustomPresetSelect = resolveParameterComponents(components, useParameterComponents()).select;
|
|
3791
4031
|
const handlePresetSelect = (name) => {
|
|
3792
4032
|
if (!name) return;
|
|
@@ -3797,8 +4037,8 @@ function EffectParameters({
|
|
|
3797
4037
|
if (preset) onPreset({ ...description.defaults, ...preset.values });
|
|
3798
4038
|
}
|
|
3799
4039
|
};
|
|
3800
|
-
return /* @__PURE__ */ (0,
|
|
3801
|
-
(onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0,
|
|
4040
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
|
|
4041
|
+
(onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3802
4042
|
CustomPresetSelect,
|
|
3803
4043
|
{
|
|
3804
4044
|
"aria-label": `${description.name} presets`,
|
|
@@ -3813,7 +4053,7 @@ function EffectParameters({
|
|
|
3813
4053
|
],
|
|
3814
4054
|
onChange: (name) => handlePresetSelect(String(name))
|
|
3815
4055
|
}
|
|
3816
|
-
) : /* @__PURE__ */ (0,
|
|
4056
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
3817
4057
|
"select",
|
|
3818
4058
|
{
|
|
3819
4059
|
className: "w-full rounded border border-border px-1 py-0.5 text-xs",
|
|
@@ -3823,8 +4063,8 @@ function EffectParameters({
|
|
|
3823
4063
|
disabled,
|
|
3824
4064
|
onChange: (e) => handlePresetSelect(e.currentTarget.value),
|
|
3825
4065
|
children: [
|
|
3826
|
-
/* @__PURE__ */ (0,
|
|
3827
|
-
description.presets.map((p) => /* @__PURE__ */ (0,
|
|
4066
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
|
|
4067
|
+
description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
|
|
3828
4068
|
]
|
|
3829
4069
|
}
|
|
3830
4070
|
)),
|
|
@@ -3834,14 +4074,14 @@ function EffectParameters({
|
|
|
3834
4074
|
const keyed = keyframed?.has(field.id) ?? false;
|
|
3835
4075
|
const value = (0, import_effects3.effectFieldValue)(field, values[field.id]);
|
|
3836
4076
|
const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field.default);
|
|
3837
|
-
return /* @__PURE__ */ (0,
|
|
3838
|
-
/* @__PURE__ */ (0,
|
|
3839
|
-
/* @__PURE__ */ (0,
|
|
3840
|
-
keyed && /* @__PURE__ */ (0,
|
|
4077
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
|
|
4078
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
4079
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
|
|
4080
|
+
keyed && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
|
|
3841
4081
|
renderControlAddon?.(field.id),
|
|
3842
|
-
onReset && changed && !disabled && /* @__PURE__ */ (0,
|
|
4082
|
+
onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: "rounded px-1 text-[11px] text-muted-foreground hover:text-foreground", "aria-label": `Reset ${label}`, onClick: () => onReset(field.id), children: "\u21BA" })
|
|
3843
4083
|
] }),
|
|
3844
|
-
/* @__PURE__ */ (0,
|
|
4084
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3845
4085
|
ParameterFieldControl,
|
|
3846
4086
|
{
|
|
3847
4087
|
field,
|
|
@@ -3856,15 +4096,15 @@ function EffectParameters({
|
|
|
3856
4096
|
)
|
|
3857
4097
|
] }, field.id);
|
|
3858
4098
|
}),
|
|
3859
|
-
!fields.length && /* @__PURE__ */ (0,
|
|
4099
|
+
!fields.length && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
|
|
3860
4100
|
] });
|
|
3861
4101
|
}
|
|
3862
4102
|
|
|
3863
4103
|
// src/paint-editor/PaintEffectsPanel.tsx
|
|
3864
|
-
var
|
|
4104
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3865
4105
|
function usePaintEffectsProvider(controller) {
|
|
3866
|
-
const [provider, setProvider] = (0,
|
|
3867
|
-
(0,
|
|
4106
|
+
const [provider, setProvider] = (0, import_react30.useState)(controller.effectsProvider);
|
|
4107
|
+
(0, import_react30.useEffect)(() => {
|
|
3868
4108
|
setProvider(controller.effectsProvider);
|
|
3869
4109
|
return controller.effects.subscribe(setProvider);
|
|
3870
4110
|
}, [controller]);
|
|
@@ -3872,27 +4112,27 @@ function usePaintEffectsProvider(controller) {
|
|
|
3872
4112
|
}
|
|
3873
4113
|
function usePaintEffectsTools(registry, controller, options = {}) {
|
|
3874
4114
|
const { id, namespace, readOnly, playbackSurface } = options;
|
|
3875
|
-
(0,
|
|
4115
|
+
(0, import_react30.useEffect)(() => {
|
|
3876
4116
|
if (!registry) return;
|
|
3877
|
-
return registry.register((0,
|
|
4117
|
+
return registry.register((0, import_paint_editor15.createPaintEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
|
|
3878
4118
|
}, [registry, controller, id, namespace, readOnly, playbackSurface]);
|
|
3879
4119
|
}
|
|
3880
4120
|
function Controls({ provider, effect, name, values, apply }) {
|
|
3881
4121
|
const { description, error } = useEffectDescription(provider, effect);
|
|
3882
|
-
const drags = (0,
|
|
3883
|
-
if (!provider) return /* @__PURE__ */ (0,
|
|
4122
|
+
const drags = (0, import_react30.useRef)(/* @__PURE__ */ new Set());
|
|
4123
|
+
if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
|
|
3884
4124
|
'No effects provider: "',
|
|
3885
4125
|
name ?? effect,
|
|
3886
4126
|
'" is kept as it was drawn.'
|
|
3887
4127
|
] });
|
|
3888
|
-
if (error) return /* @__PURE__ */ (0,
|
|
3889
|
-
if (!description) return /* @__PURE__ */ (0,
|
|
4128
|
+
if (error) return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
|
|
4129
|
+
if (!description) return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
|
|
3890
4130
|
const commit = (gesture) => {
|
|
3891
4131
|
if (!gesture || drags.current.has(gesture)) return !gesture;
|
|
3892
4132
|
drags.current.add(gesture);
|
|
3893
4133
|
return true;
|
|
3894
4134
|
};
|
|
3895
|
-
return /* @__PURE__ */ (0,
|
|
4135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3896
4136
|
EffectParameters,
|
|
3897
4137
|
{
|
|
3898
4138
|
description,
|
|
@@ -3914,8 +4154,8 @@ var PaintEffectsPanel = ({ controller, className }) => {
|
|
|
3914
4154
|
const state = usePaintEditorState(controller);
|
|
3915
4155
|
const provider = usePaintEffectsProvider(controller);
|
|
3916
4156
|
const [error, attempt] = useAttempt();
|
|
3917
|
-
const [browse, setBrowse] = (0,
|
|
3918
|
-
const [busy, setBusy] = (0,
|
|
4157
|
+
const [browse, setBrowse] = (0, import_react30.useState)(null);
|
|
4158
|
+
const [busy, setBusy] = (0, import_react30.useState)(false);
|
|
3919
4159
|
const paper = controller.getPaperEffect();
|
|
3920
4160
|
const activeId = state.document.activeLayerId;
|
|
3921
4161
|
const layerEffect = activeId ? controller.getEffectLayer(activeId) : void 0;
|
|
@@ -3929,7 +4169,7 @@ var PaintEffectsPanel = ({ controller, className }) => {
|
|
|
3929
4169
|
if (!effectPaint) return;
|
|
3930
4170
|
run(() => controller.setEffectPaint({ effect: effectPaint.effect, values: effectPaint.values, time: effectPaint.time, map: effectPaint.map, live: effectPaint.live, ...patch }));
|
|
3931
4171
|
};
|
|
3932
|
-
const thumbnail = (0,
|
|
4172
|
+
const thumbnail = (0, import_react30.useMemo)(() => effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(48) : null, [controller, effectPaint, state.effectPaintRendering]);
|
|
3933
4173
|
const run = (work) => attempt(() => {
|
|
3934
4174
|
setBusy(true);
|
|
3935
4175
|
return work().finally(() => setBusy(false));
|
|
@@ -3945,28 +4185,28 @@ var PaintEffectsPanel = ({ controller, className }) => {
|
|
|
3945
4185
|
};
|
|
3946
4186
|
const toggle = (b) => setBrowse(browse === b ? null : b);
|
|
3947
4187
|
const pixel = active?.type === "pixel";
|
|
3948
|
-
return /* @__PURE__ */ (0,
|
|
3949
|
-
/* @__PURE__ */ (0,
|
|
3950
|
-
/* @__PURE__ */ (0,
|
|
3951
|
-
/* @__PURE__ */ (0,
|
|
3952
|
-
/* @__PURE__ */ (0,
|
|
3953
|
-
/* @__PURE__ */ (0,
|
|
3954
|
-
/* @__PURE__ */ (0,
|
|
3955
|
-
/* @__PURE__ */ (0,
|
|
4188
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
|
|
4189
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
4190
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
|
|
4191
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
|
|
4192
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
|
|
4193
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
|
|
4194
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("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" }),
|
|
4195
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("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" })
|
|
3956
4196
|
] }),
|
|
3957
|
-
!provider && /* @__PURE__ */ (0,
|
|
3958
|
-
browse && /* @__PURE__ */ (0,
|
|
3959
|
-
paper && /* @__PURE__ */ (0,
|
|
3960
|
-
/* @__PURE__ */ (0,
|
|
3961
|
-
/* @__PURE__ */ (0,
|
|
4197
|
+
!provider && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
|
|
4198
|
+
browse && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
|
|
4199
|
+
paper && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
|
|
4200
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
4201
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex-1 truncate", children: [
|
|
3962
4202
|
"Paper: ",
|
|
3963
4203
|
paper.name ?? paper.effect
|
|
3964
4204
|
] }),
|
|
3965
|
-
/* @__PURE__ */ (0,
|
|
4205
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
|
|
3966
4206
|
] }),
|
|
3967
|
-
/* @__PURE__ */ (0,
|
|
3968
|
-
/* @__PURE__ */ (0,
|
|
3969
|
-
/* @__PURE__ */ (0,
|
|
4207
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4208
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
|
|
4209
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3970
4210
|
"input",
|
|
3971
4211
|
{
|
|
3972
4212
|
type: "range",
|
|
@@ -3988,43 +4228,43 @@ var PaintEffectsPanel = ({ controller, className }) => {
|
|
|
3988
4228
|
`o${paper.opacity}`
|
|
3989
4229
|
)
|
|
3990
4230
|
] }),
|
|
3991
|
-
/* @__PURE__ */ (0,
|
|
3992
|
-
/* @__PURE__ */ (0,
|
|
3993
|
-
/* @__PURE__ */ (0,
|
|
4231
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4232
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
|
|
4233
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("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) => {
|
|
3994
4234
|
const blend = e.currentTarget.value;
|
|
3995
4235
|
run(() => controller.updatePaperEffect({ blend }));
|
|
3996
|
-
}, children:
|
|
4236
|
+
}, children: import_paint_editor15.PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: b, children: b }, b)) })
|
|
3997
4237
|
] }),
|
|
3998
|
-
/* @__PURE__ */ (0,
|
|
4238
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
|
|
3999
4239
|
] }),
|
|
4000
|
-
effectPaint && /* @__PURE__ */ (0,
|
|
4001
|
-
/* @__PURE__ */ (0,
|
|
4002
|
-
thumbnail ? /* @__PURE__ */ (0,
|
|
4003
|
-
/* @__PURE__ */ (0,
|
|
4240
|
+
effectPaint && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paint", children: [
|
|
4241
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
4242
|
+
thumbnail ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("img", { src: thumbnail, alt: "", className: "h-5 w-8 rounded object-cover ring-1 ring-slate-700", "data-testid": "effect-paint-thumbnail" }) : null,
|
|
4243
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex-1 truncate", children: [
|
|
4004
4244
|
"Paint: ",
|
|
4005
4245
|
effectPaint.effect,
|
|
4006
4246
|
state.effectPaintRendering ? " (rendering\u2026)" : ""
|
|
4007
4247
|
] }),
|
|
4008
|
-
/* @__PURE__ */ (0,
|
|
4248
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
|
|
4009
4249
|
] }),
|
|
4010
|
-
/* @__PURE__ */ (0,
|
|
4011
|
-
/* @__PURE__ */ (0,
|
|
4012
|
-
/* @__PURE__ */ (0,
|
|
4250
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
|
|
4251
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", title: "Lay the effect along each stroke instead of fixing it to the canvas", children: [
|
|
4252
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "checkbox", checked: effectPaint.map?.by === "stroke", onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
|
|
4013
4253
|
"Along the stroke"
|
|
4014
4254
|
] }),
|
|
4015
|
-
hasPathControl && /* @__PURE__ */ (0,
|
|
4016
|
-
/* @__PURE__ */ (0,
|
|
4255
|
+
hasPathControl && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", title: "Pass each stroke's centreline to the effect's own path control", children: [
|
|
4256
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "checkbox", checked: effectPaint.map?.by === "path", onChange: (e) => repaint({ map: e.target.checked ? { by: "path" } : { by: "canvas" } }) }),
|
|
4017
4257
|
"Along the stroke (native)"
|
|
4018
4258
|
] }),
|
|
4019
|
-
/* @__PURE__ */ (0,
|
|
4020
|
-
/* @__PURE__ */ (0,
|
|
4259
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
|
|
4260
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
|
|
4021
4261
|
"Live"
|
|
4022
4262
|
] })
|
|
4023
4263
|
] }),
|
|
4024
|
-
effectPaint.map?.by === "stroke" && /* @__PURE__ */ (0,
|
|
4025
|
-
/* @__PURE__ */ (0,
|
|
4026
|
-
/* @__PURE__ */ (0,
|
|
4027
|
-
/* @__PURE__ */ (0,
|
|
4264
|
+
effectPaint.map?.by === "stroke" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
4265
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4266
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-slate-400", children: "Length" }),
|
|
4267
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4028
4268
|
"input",
|
|
4029
4269
|
{
|
|
4030
4270
|
type: "number",
|
|
@@ -4038,55 +4278,56 @@ var PaintEffectsPanel = ({ controller, className }) => {
|
|
|
4038
4278
|
effectPaint.map.length
|
|
4039
4279
|
)
|
|
4040
4280
|
] }),
|
|
4041
|
-
/* @__PURE__ */ (0,
|
|
4042
|
-
/* @__PURE__ */ (0,
|
|
4043
|
-
/* @__PURE__ */ (0,
|
|
4044
|
-
/* @__PURE__ */ (0,
|
|
4281
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("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: [
|
|
4282
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "repeat", children: "Repeat" }),
|
|
4283
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "mirror", children: "Mirror" }),
|
|
4284
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "clamp", children: "Clamp" })
|
|
4045
4285
|
] })
|
|
4046
4286
|
] }),
|
|
4047
|
-
/* @__PURE__ */ (0,
|
|
4287
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
|
|
4048
4288
|
] }),
|
|
4049
|
-
animation && /* @__PURE__ */ (0,
|
|
4050
|
-
/* @__PURE__ */ (0,
|
|
4289
|
+
animation && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-2 rounded border border-slate-700 p-1", "data-effect-part": "playback", children: [
|
|
4290
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex-1 truncate", children: [
|
|
4051
4291
|
"Live paint: ",
|
|
4052
4292
|
animation.strokes,
|
|
4053
4293
|
" ",
|
|
4054
4294
|
animation.strokes === 1 ? "stroke" : "strokes"
|
|
4055
4295
|
] }),
|
|
4056
|
-
/* @__PURE__ */ (0,
|
|
4057
|
-
/* @__PURE__ */ (0,
|
|
4058
|
-
/* @__PURE__ */ (0,
|
|
4059
|
-
/* @__PURE__ */ (0,
|
|
4296
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button, "aria-pressed": playback.playing, onClick: () => attempt(() => controller.setEffectPlayback({ playing: !playback.playing })), children: playback.playing ? "Pause" : "Play" }),
|
|
4297
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4298
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-slate-400", children: "fps" }),
|
|
4299
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("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" })
|
|
4060
4300
|
] })
|
|
4061
4301
|
] }),
|
|
4062
|
-
layerEffect && activeId && /* @__PURE__ */ (0,
|
|
4063
|
-
/* @__PURE__ */ (0,
|
|
4064
|
-
/* @__PURE__ */ (0,
|
|
4302
|
+
layerEffect && activeId && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "layer", children: [
|
|
4303
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
4304
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex-1 truncate", children: [
|
|
4065
4305
|
"Layer: ",
|
|
4066
4306
|
layerEffect.name ?? layerEffect.effect
|
|
4067
4307
|
] }),
|
|
4068
|
-
/* @__PURE__ */ (0,
|
|
4308
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
|
|
4069
4309
|
] }),
|
|
4070
|
-
/* @__PURE__ */ (0,
|
|
4310
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
|
|
4071
4311
|
] }),
|
|
4072
|
-
/* @__PURE__ */ (0,
|
|
4312
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ErrorLine, { error })
|
|
4073
4313
|
] });
|
|
4074
4314
|
};
|
|
4075
4315
|
|
|
4076
4316
|
// src/paint-editor/PaintEditor.tsx
|
|
4077
|
-
var
|
|
4317
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4078
4318
|
var PAINT_CONTROLS = {
|
|
4079
4319
|
"mixing-pad": '[data-testid="mixing-pad"]',
|
|
4080
4320
|
lighting: '[data-testid="light-panel"]',
|
|
4081
4321
|
symmetry: '[aria-label="Symmetry"]'
|
|
4082
4322
|
};
|
|
4083
4323
|
var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, agentStrokes, className, playback, playbackId = "paint", onPlaybackReveal }) => {
|
|
4084
|
-
const [tool, setTool] = (0,
|
|
4085
|
-
const [
|
|
4086
|
-
const
|
|
4324
|
+
const [tool, setTool] = (0, import_react31.useState)("brush");
|
|
4325
|
+
const [fillOptions, setFillOptions] = (0, import_react31.useState)({ reference: "all", tolerance: 32, closeGap: 4, expand: 1, antialias: true });
|
|
4326
|
+
const [tab, setTab] = (0, import_react31.useState)("color");
|
|
4327
|
+
const tabRef = (0, import_react31.useRef)(tab);
|
|
4087
4328
|
tabRef.current = tab;
|
|
4088
|
-
const rootRef = (0,
|
|
4089
|
-
const [ownPresence] = (0,
|
|
4329
|
+
const rootRef = (0, import_react31.useRef)(null);
|
|
4330
|
+
const [ownPresence] = (0, import_react31.useState)(() => new import_paint_editor16.PaintPresence());
|
|
4090
4331
|
const ambientPlayback = useAgentPlayback();
|
|
4091
4332
|
const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
|
|
4092
4333
|
const viewBox = () => {
|
|
@@ -4097,12 +4338,12 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
|
|
|
4097
4338
|
const docToClient = (p) => {
|
|
4098
4339
|
const r = viewBox();
|
|
4099
4340
|
if (!r) return null;
|
|
4100
|
-
const q = (0,
|
|
4341
|
+
const q = (0, import_paint_editor16.documentToScreen)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x, p.y);
|
|
4101
4342
|
return { x: r.left + q.x, y: r.top + q.y };
|
|
4102
4343
|
};
|
|
4103
4344
|
const clientToDoc = (p) => {
|
|
4104
4345
|
const r = viewBox();
|
|
4105
|
-
return r ? (0,
|
|
4346
|
+
return r ? (0, import_paint_editor16.screenToDocument)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x - r.left, p.y - r.top) : null;
|
|
4106
4347
|
};
|
|
4107
4348
|
const elementRect = (selector) => {
|
|
4108
4349
|
const r = rootRef.current?.querySelector(selector)?.getBoundingClientRect();
|
|
@@ -4142,29 +4383,30 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
|
|
|
4142
4383
|
const box = rootRef.current?.getBoundingClientRect();
|
|
4143
4384
|
return c && box ? { x: c.x - box.left, y: c.y - box.top } : p;
|
|
4144
4385
|
};
|
|
4145
|
-
const [error, setError] = (0,
|
|
4386
|
+
const [error, setError] = (0, import_react31.useState)(null);
|
|
4146
4387
|
const effects = usePaintEffectsProvider(controller);
|
|
4147
4388
|
const tabs = effects ? ["color", "wet", "paper", "layers", "effects"] : ["color", "wet", "paper", "layers"];
|
|
4148
|
-
return /* @__PURE__ */ (0,
|
|
4149
|
-
playing && /* @__PURE__ */ (0,
|
|
4150
|
-
/* @__PURE__ */ (0,
|
|
4151
|
-
/* @__PURE__ */ (0,
|
|
4152
|
-
/* @__PURE__ */ (0,
|
|
4153
|
-
/* @__PURE__ */ (0,
|
|
4154
|
-
/* @__PURE__ */ (0,
|
|
4155
|
-
error && /* @__PURE__ */ (0,
|
|
4389
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("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: [
|
|
4390
|
+
playing && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
|
|
4391
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PaintToolbar, { controller, tool, onToolChange: setTool, fillOptions, onFillOptionsChange: setFillOptions, fileName }),
|
|
4392
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex min-h-0 flex-1 gap-2", children: [
|
|
4393
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
|
|
4394
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
4395
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PaintCanvas, { controller, tool, fillOptions, onError: setError, presence: playing ? void 0 : presence, proposals, agentStrokes, className: "flex-1 rounded-lg" }),
|
|
4396
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
|
|
4156
4397
|
] }),
|
|
4157
|
-
/* @__PURE__ */ (0,
|
|
4158
|
-
/* @__PURE__ */ (0,
|
|
4159
|
-
/* @__PURE__ */ (0,
|
|
4160
|
-
tab === "color" && /* @__PURE__ */ (0,
|
|
4161
|
-
tab === "wet" && /* @__PURE__ */ (0,
|
|
4162
|
-
tab === "paper" && /* @__PURE__ */ (0,
|
|
4163
|
-
tab === "layers" && /* @__PURE__ */ (0,
|
|
4164
|
-
tab === "layers" && /* @__PURE__ */ (0,
|
|
4165
|
-
tab === "layers" && /* @__PURE__ */ (0,
|
|
4166
|
-
tab === "layers" && /* @__PURE__ */ (0,
|
|
4167
|
-
tab === "
|
|
4398
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
|
|
4399
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex gap-1", role: "tablist", "aria-label": "Paint panels", children: tabs.map((t) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("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)) }),
|
|
4400
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
|
|
4401
|
+
tab === "color" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ColorPanel, { controller }),
|
|
4402
|
+
tab === "wet" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(WetPanel, { controller }),
|
|
4403
|
+
tab === "paper" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PaperPanel, { controller }),
|
|
4404
|
+
tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PaintLayersPanel, { controller }),
|
|
4405
|
+
tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(StrokePanel, { controller }),
|
|
4406
|
+
tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PathStrokePanel, { controller }),
|
|
4407
|
+
tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(EvolutionPanel, { controller, proposals }),
|
|
4408
|
+
tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(StickerPanel, { controller }),
|
|
4409
|
+
tab === "effects" && effects && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PaintEffectsPanel, { controller })
|
|
4168
4410
|
] })
|
|
4169
4411
|
] })
|
|
4170
4412
|
] })
|
|
@@ -4176,6 +4418,7 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
|
|
|
4176
4418
|
BrushLibraryBrowser,
|
|
4177
4419
|
BrushPanel,
|
|
4178
4420
|
ColorPanel,
|
|
4421
|
+
EvolutionPanel,
|
|
4179
4422
|
PaintCanvas,
|
|
4180
4423
|
PaintEditor,
|
|
4181
4424
|
PaintEffectsPanel,
|