@pixerate/editor-react 0.188.0 → 0.190.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.
@@ -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,
@@ -50,6 +51,7 @@ __export(paint_editor_exports, {
50
51
  StickerPicker: () => StickerPicker,
51
52
  StrokePanel: () => StrokePanel,
52
53
  WetPanel: () => WetPanel,
54
+ useMutationRequests: () => useMutationRequests,
53
55
  usePaintChangeFeed: () => usePaintChangeFeed,
54
56
  usePaintDirector: () => usePaintDirector,
55
57
  usePaintEditor: () => usePaintEditor,
@@ -82,8 +84,30 @@ function usePaintDirector(controller, options = {}) {
82
84
  const presence = new import_paint_editor.PaintPresence();
83
85
  return { presence, director: new import_paint_editor.PaintDirector(controller, presence, options) };
84
86
  });
87
+ (0, import_react.useEffect)(() => {
88
+ controller.setMutationDirector(value.director);
89
+ return () => controller.setMutationDirector(null);
90
+ }, [controller, value.director]);
85
91
  return value;
86
92
  }
93
+ function useMutationRequests(controller, onRequest) {
94
+ const state = usePaintEditorState(controller);
95
+ const cbRef = (0, import_react.useRef)(onRequest);
96
+ cbRef.current = onRequest;
97
+ const [last, setLast] = (0, import_react.useState)(null);
98
+ (0, import_react.useEffect)(() => {
99
+ return controller.onMutationRequest((m) => {
100
+ setLast(m);
101
+ cbRef.current?.(m);
102
+ });
103
+ }, [controller]);
104
+ const pending = (0, import_react.useMemo)(() => state.mutations.filter((m) => m.state === "pending"), [state.mutations]);
105
+ return {
106
+ pending,
107
+ mutations: state.mutations,
108
+ last: last && state.mutations.some((m) => m.id === last.id && m.state === "pending") ? last : pending[pending.length - 1] ?? null
109
+ };
110
+ }
87
111
  function usePaintProposals(controller, options = {}) {
88
112
  const [store] = (0, import_react.useState)(() => (0, import_paint_editor.createPaintProposals)({ ...options, controller }));
89
113
  const state = (0, import_react.useSyncExternalStore)(store.subscribe, store.getState, store.getState);
@@ -110,7 +134,7 @@ function usePaintChangeFeed(controller, options = {}) {
110
134
  var import_react2 = require("react");
111
135
  var import_paint_editor2 = require("@pixerate/editor/paint-editor");
112
136
  var import_jsx_runtime = require("react/jsx-runtime");
113
- var PaintCanvas = ({ controller, tool = "brush", fillOptions, showGuides = true, fitOnMount = true, onError, presence, proposals, agentStrokes, className }) => {
137
+ var PaintCanvas = ({ controller, tool = "brush", fillOptions, showGuides = true, fitOnMount = true, onError, presence, proposals, agentStrokes, deviceTilt = false, className }) => {
114
138
  const state = usePaintEditorState(controller);
115
139
  const viewport = (0, import_react2.useRef)(null);
116
140
  const canvas = (0, import_react2.useRef)(null);
@@ -157,6 +181,7 @@ var PaintCanvas = ({ controller, tool = "brush", fillOptions, showGuides = true,
157
181
  else controller.takeDirty();
158
182
  }, [state, presenter, controller]);
159
183
  (0, import_react2.useEffect)(() => (0, import_paint_editor2.startWetClock)(controller), [controller]);
184
+ (0, import_react2.useEffect)(() => deviceTilt ? (0, import_paint_editor2.startDeviceTilt)(controller) : void 0, [controller, deviceTilt]);
160
185
  (0, import_react2.useEffect)(() => {
161
186
  const ctx = water.current?.getContext("2d");
162
187
  if (ctx && typeof ctx.createImageData === "function") (0, import_paint_editor2.drawWaterOverlay)(controller, ctx);
@@ -1162,7 +1187,7 @@ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, clas
1162
1187
  const carried = (0, import_paint_editor5.brushLoadColor)(state.mixerLoad);
1163
1188
  const palette = (spec.colour?.palette ?? []).flatMap((c) => (0, import_brushes3.brushColourHex)(c, state.colorScheme) ?? []);
1164
1189
  const slug = (name) => name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || "brush";
1165
- const loads = (["dab", "mixer", "impasto"].includes(brush.engine) || brush.engine === "wet" && brush.wet.tool === "paint") && !brush.ghost;
1190
+ const loads = (["dab", "mixer", "impasto"].includes(brush.engine) || brush.engine === "wet" && brush.wet.tool === "paint") && !brush.ghost && !brush.mutation;
1166
1191
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "brush-panel", children: [
1167
1192
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(BrushLibraryBrowser, { entries, activeId: brush.id, onSelect: (id) => controller.setBrush({ id }), thumbnail: (id) => thumbs.get(id) ?? null, thumbnailWidth, thumbnailHeight }),
1168
1193
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
@@ -1178,12 +1203,15 @@ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, clas
1178
1203
  renderExtra: (section) => {
1179
1204
  if (section === "shape" && brush.engine === "sticker")
1180
1205
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(StickerPicker, { controller, label: "Sticker stamps", selected: brush.sticker.stamps, onPick: (ref) => controller.setBrush({ sticker: { stamps: (0, import_paint_editor5.toggleStickerRef)(brush.sticker.stamps, ref) } }) });
1181
- if (section === "behaviour" && loads)
1182
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", children: [
1183
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-slate-400", children: "Carries" }),
1184
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-label": "Brush load", title: carried ?? "Clean", className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: carried ?? "transparent" } }),
1185
- brush.engine === "mixer" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: button, onClick: () => controller.loadMixerBrush(), children: "Load" }),
1186
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: button, onClick: () => controller.cleanMixerBrush(brush.engine === "mixer"), children: "Clean" })
1206
+ if (section === "behaviour")
1207
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1208
+ brush.mutation && !state.hasMutationAgent && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-[11px] text-amber-400", role: "status", "data-paint-mutation-unconnected": true, children: "No agent is connected \u2014 mutation strokes will stay as ordinary paint." }),
1209
+ loads && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", children: [
1210
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-slate-400", children: "Carries" }),
1211
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-label": "Brush load", title: carried ?? "Clean", className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: carried ?? "transparent" } }),
1212
+ brush.engine === "mixer" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: button, onClick: () => controller.loadMixerBrush(), children: "Load" }),
1213
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: button, onClick: () => controller.cleanMixerBrush(brush.engine === "mixer"), children: "Clean" })
1214
+ ] })
1187
1215
  ] });
1188
1216
  if (section === "colour")
1189
1217
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
@@ -1235,6 +1263,8 @@ var SWATCH = { x: 0, y: 0, width: 64, height: 40 };
1235
1263
  var PaperPanel = ({ controller, className }) => {
1236
1264
  const state = usePaintEditorState(controller);
1237
1265
  const [error, attempt] = useAttempt();
1266
+ const [tiltFollow, setTiltFollow] = (0, import_react11.useState)(false);
1267
+ (0, import_react11.useEffect)(() => tiltFollow ? (0, import_paint_editor6.startDeviceTilt)(controller) : void 0, [controller, tiltFollow]);
1238
1268
  const paper = state.document.paper;
1239
1269
  const previews = (0, import_react11.useMemo)(() => new Map(import_paint_editor6.PAPER_LIBRARY.map((p) => [p.preset, { ...SWATCH, data: (0, import_paint_editor6.renderPaper)({ ...p, shading: Math.max(0.8, p.shading) }, SWATCH) }])), []);
1240
1270
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paper-panel", children: [
@@ -1270,9 +1300,41 @@ var PaperPanel = ({ controller, className }) => {
1270
1300
  ] }),
1271
1301
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: "self-start px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.setPaper({ seed: paper.seed + 1 })), children: "New sheet" }),
1272
1302
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "light-panel", children: [
1273
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "font-medium text-slate-300", children: "Light (thick paint, metallic paper)" }),
1303
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "font-medium text-slate-300", children: "Light (thick paint, iridescence, metallic paper)" }),
1274
1304
  import_paint_editor6.LIGHT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor6.readPath)(controller.getLighting(), c.path), onChange: (v) => attempt(() => controller.setLighting({ [c.path]: v })) }, c.path)),
1275
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: "self-start px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.flattenRelief()), children: "Flatten relief" })
1305
+ import_paint_editor6.VIEW_TILT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor6.readPath)(state.viewTilt, c.path), onChange: (v) => attempt(() => controller.setViewTilt({ [c.path]: v })) }, c.path)),
1306
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1307
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1308
+ "button",
1309
+ {
1310
+ type: "button",
1311
+ "aria-pressed": tiltFollow,
1312
+ className: chip(tiltFollow),
1313
+ onClick: () => attempt(async () => {
1314
+ if (!tiltFollow && !await (0, import_paint_editor6.requestDeviceTiltPermission)()) return;
1315
+ setTiltFollow((v) => !v);
1316
+ }),
1317
+ children: "Device tilt"
1318
+ }
1319
+ ),
1320
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: "self-start px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.flattenRelief()), children: "Flatten relief" })
1321
+ ] })
1322
+ ] }),
1323
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "uv-heat-panel", children: [
1324
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "font-medium text-slate-300", children: "UV blacklight & heat" }),
1325
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex items-center gap-2", children: [
1326
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { type: "checkbox", checked: state.uvLight.on, onChange: (e) => attempt(() => controller.setUvLight({ on: e.target.checked })) }),
1327
+ " UV blacklight"
1328
+ ] }),
1329
+ import_paint_editor6.UV_LIGHT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor6.readPath)(state.uvLight, c.path), onChange: (v) => attempt(() => controller.setUvLight({ [c.path]: v })) }, c.path)),
1330
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-1.5", children: [
1331
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.advanceHeat(10)), children: "Step heat" }),
1332
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.clearHeat()), children: "Cool canvas" }),
1333
+ state.heat.hotCells > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "text-[11px] text-amber-400", children: [
1334
+ Math.round(state.heat.max * 100),
1335
+ "% warm"
1336
+ ] })
1337
+ ] })
1276
1338
  ] }),
1277
1339
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ErrorLine, { error })
1278
1340
  ] });
@@ -1734,7 +1796,7 @@ var PaintLayersPanel = ({ controller, className }) => {
1734
1796
  usePaintEditorState(controller);
1735
1797
  const [error, attempt] = useAttempt();
1736
1798
  const [renaming, setRenaming] = (0, import_react15.useState)(null);
1737
- const layers = controller.listLayers();
1799
+ const layers = controller.listLayers().filter((l) => !l.temporary);
1738
1800
  const active = layers.find((l) => l.active) ?? null;
1739
1801
  const light = active?.type === "pixel" ? controller.lightOf(active.id) : null;
1740
1802
  const move = (delta) => {
@@ -2073,29 +2135,194 @@ var PathStrokePanel = ({ controller, className }) => {
2073
2135
  ] });
2074
2136
  };
2075
2137
 
2138
+ // src/paint-editor/EvolutionPanel.tsx
2139
+ var import_react17 = require("react");
2140
+ var import_paint_editor14 = require("@pixerate/editor/paint-editor");
2141
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2142
+ var EvolutionPanel = ({ controller, proposals, className }) => {
2143
+ const state = usePaintEditorState(controller);
2144
+ const store = proposals ?? controller.proposals;
2145
+ const proposalState = (0, import_react17.useSyncExternalStore)(store.subscribe, store.getState, store.getState);
2146
+ const [error, attempt] = useAttempt();
2147
+ const [selectedStrokes, setSelectedStrokes] = (0, import_react17.useState)([]);
2148
+ const [selectedProposals, setSelectedProposals] = (0, import_react17.useState)([]);
2149
+ const [count, setCount] = (0, import_react17.useState)(4);
2150
+ const [seed, setSeed] = (0, import_react17.useState)(1);
2151
+ const [mutation, setMutation] = (0, import_react17.useState)(() => (0, import_paint_editor14.normalizeMutationRates)());
2152
+ const [contactSheetUrl, setContactSheetUrl] = (0, import_react17.useState)(null);
2153
+ const eligibleStrokes = state.document.strokes.filter((s) => !(0, import_paint_editor14.liveStrokeRefusal)(s.brush));
2154
+ const activeStrokeIds = selectedStrokes.filter((id) => eligibleStrokes.some((s) => s.id === id));
2155
+ 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] : [];
2156
+ const variants = proposalState.proposals.filter((p) => (0, import_paint_editor14.proposalGenomeStrokes)(p).length > 0);
2157
+ const activeProposalIds = selectedProposals.filter((id) => variants.some((v) => v.id === id));
2158
+ const toggleStroke = (id) => {
2159
+ setSelectedStrokes((prev) => prev.includes(id) ? prev.filter((x) => x !== id) : [...prev.slice(-15), id]);
2160
+ };
2161
+ const toggleProposal = (id) => {
2162
+ setSelectedProposals((prev) => prev.includes(id) ? prev.filter((x) => x !== id) : [...prev.slice(-1), id]);
2163
+ };
2164
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "evolution-panel", children: [
2165
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between", children: [
2166
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "font-medium text-slate-300", children: [
2167
+ "Evolution (",
2168
+ eligibleStrokes.length,
2169
+ ")"
2170
+ ] }),
2171
+ /* @__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: [
2172
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "Count" }),
2173
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2174
+ "input",
2175
+ {
2176
+ type: "number",
2177
+ "aria-label": "Variant count",
2178
+ min: 2,
2179
+ max: 12,
2180
+ value: count,
2181
+ onChange: (e) => setCount(Math.max(2, Math.min(12, Number(e.target.value) || 4))),
2182
+ className: "w-11 rounded bg-slate-800 px-1 py-0.5 text-right font-mono text-slate-200"
2183
+ }
2184
+ )
2185
+ ] }) })
2186
+ ] }),
2187
+ 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) => {
2188
+ const on = effectiveStrokeIds.includes(s.id);
2189
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2190
+ "button",
2191
+ {
2192
+ type: "button",
2193
+ role: "option",
2194
+ "aria-selected": on,
2195
+ title: `${i + 1}. ${s.brush.name} (${s.id})`,
2196
+ className: `h-5 w-5 rounded ring-1 ${on ? "ring-indigo-400" : "ring-slate-700"}`,
2197
+ style: { background: s.color },
2198
+ onClick: () => toggleStroke(s.id)
2199
+ },
2200
+ s.id
2201
+ );
2202
+ }) }),
2203
+ import_paint_editor14.EVOLUTION_SLIDERS.map((c) => {
2204
+ const key = c.path;
2205
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2206
+ PaintSlider,
2207
+ {
2208
+ control: c,
2209
+ value: mutation[key],
2210
+ onChange: (v) => setMutation((prev) => ({ ...prev, [key]: v }))
2211
+ },
2212
+ c.path
2213
+ );
2214
+ }),
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: effectiveStrokeIds.length === 0 || state.stroking,
2222
+ onClick: () => attempt(() => {
2223
+ controller.breedStrokes({ strokeIds: effectiveStrokeIds, count, mutation, seed });
2224
+ setSeed((s) => s + 1);
2225
+ }),
2226
+ children: "Breed strokes"
2227
+ }
2228
+ ),
2229
+ activeProposalIds.length === 2 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2230
+ "button",
2231
+ {
2232
+ type: "button",
2233
+ className: button,
2234
+ disabled: state.stroking,
2235
+ onClick: () => attempt(() => {
2236
+ controller.breedProposal({ proposalIds: activeProposalIds, count, mutation, seed });
2237
+ setSeed((s) => s + 1);
2238
+ }),
2239
+ children: "Cross over (2)"
2240
+ }
2241
+ ),
2242
+ variants.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2243
+ "button",
2244
+ {
2245
+ type: "button",
2246
+ className: button,
2247
+ onClick: () => attempt(() => {
2248
+ const sheet = (0, import_paint_editor14.exportProposalContactSheetPng)(controller, variants);
2249
+ setContactSheetUrl(`data:image/png;base64,${sheet.base64}`);
2250
+ }),
2251
+ children: "Contact sheet"
2252
+ }
2253
+ )
2254
+ ] }),
2255
+ 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) => {
2256
+ const g = (0, import_paint_editor14.paintProposalGhost)(p);
2257
+ const picked = activeProposalIds.includes(p.id);
2258
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2259
+ "div",
2260
+ {
2261
+ "data-testid": `evolution-variant-${p.id}`,
2262
+ 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"}`,
2263
+ children: [
2264
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex items-center justify-between gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2265
+ "button",
2266
+ {
2267
+ type: "button",
2268
+ "aria-pressed": picked,
2269
+ className: chip(picked),
2270
+ onClick: () => toggleProposal(p.id),
2271
+ children: p.title
2272
+ }
2273
+ ) }),
2274
+ 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" }) }),
2275
+ p.rationale && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "line-clamp-2 text-[10px] text-slate-400", title: p.rationale, children: p.rationale }),
2276
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2277
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2278
+ "button",
2279
+ {
2280
+ type: "button",
2281
+ className: button,
2282
+ disabled: state.stroking,
2283
+ onClick: () => attempt(() => {
2284
+ controller.breedProposal({ proposalIds: [p.id], count, mutation, seed });
2285
+ setSeed((s) => s + 1);
2286
+ }),
2287
+ children: "Breed from"
2288
+ }
2289
+ ),
2290
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => store.accept(p.id)), children: "Accept" }),
2291
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => store.reject(p.id)), children: "Dismiss" })
2292
+ ] })
2293
+ ]
2294
+ },
2295
+ p.id
2296
+ );
2297
+ }) }),
2298
+ 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" }),
2299
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ErrorLine, { error })
2300
+ ] });
2301
+ };
2302
+
2076
2303
  // src/paint-editor/PaintEditor.tsx
2077
- var import_react30 = require("react");
2078
- var import_paint_editor15 = require("@pixerate/editor/paint-editor");
2304
+ var import_react31 = require("react");
2305
+ var import_paint_editor16 = require("@pixerate/editor/paint-editor");
2079
2306
 
2080
2307
  // src/playback/AgentPlaybackContext.tsx
2081
- var import_react17 = require("react");
2082
- var import_jsx_runtime20 = require("react/jsx-runtime");
2083
- var AgentPlaybackContext = (0, import_react17.createContext)(null);
2308
+ var import_react18 = require("react");
2309
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2310
+ var AgentPlaybackContext = (0, import_react18.createContext)(null);
2084
2311
  function useAgentPlayback() {
2085
- return (0, import_react17.useContext)(AgentPlaybackContext);
2312
+ return (0, import_react18.useContext)(AgentPlaybackContext);
2086
2313
  }
2087
2314
 
2088
2315
  // src/playback/usePlaybackSurface.ts
2089
- var import_react18 = require("react");
2316
+ var import_react19 = require("react");
2090
2317
  var import_tools = require("@pixerate/editor/tools");
2091
2318
  function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
2092
2319
  const ambient = useAgentPlayback();
2093
2320
  const target = playback === void 0 ? ambient : playback;
2094
- const [ownPresence] = (0, import_react18.useState)(() => new import_tools.PresenceStore());
2321
+ const [ownPresence] = (0, import_react19.useState)(() => new import_tools.PresenceStore());
2095
2322
  const presence = sharedPresence ?? ownPresence;
2096
- const latest = (0, import_react18.useRef)(options);
2323
+ const latest = (0, import_react19.useRef)(options);
2097
2324
  latest.current = options;
2098
- (0, import_react18.useEffect)(() => {
2325
+ (0, import_react19.useEffect)(() => {
2099
2326
  if (!target || !id) return;
2100
2327
  const o = () => latest.current;
2101
2328
  const surface = {
@@ -2127,13 +2354,13 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
2127
2354
  }
2128
2355
 
2129
2356
  // src/playback/PresenceLayer.tsx
2130
- var import_react19 = __toESM(require("react"), 1);
2131
- var import_jsx_runtime21 = require("react/jsx-runtime");
2357
+ var import_react20 = __toESM(require("react"), 1);
2358
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2132
2359
  function PresenceLayer({ presence, viewport, clip = true, renderCursor, className = "" }) {
2133
- const { actors } = (0, import_react19.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
2360
+ const { actors } = (0, import_react20.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
2134
2361
  if (!actors.length) return null;
2135
2362
  const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
2136
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2363
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2137
2364
  "div",
2138
2365
  {
2139
2366
  className: `pixerate-presence ${className}`.trim(),
@@ -2147,19 +2374,19 @@ function PresenceLayer({ presence, viewport, clip = true, renderCursor, classNam
2147
2374
  const br = map({ x: a.focus.x + a.focus.width, y: a.focus.y + a.focus.height });
2148
2375
  return { left: tl.x - 4, top: tl.y - 4, width: br.x - tl.x + 8, height: br.y - tl.y + 8 };
2149
2376
  })();
2150
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react19.default.Fragment, { children: [
2151
- ring && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2377
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react20.default.Fragment, { children: [
2378
+ ring && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2152
2379
  "div",
2153
2380
  {
2154
2381
  "data-actor-focus": a.id,
2155
2382
  style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
2156
2383
  }
2157
2384
  ),
2158
- /* @__PURE__ */ (0, import_jsx_runtime21.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_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
2159
- /* @__PURE__ */ (0, import_jsx_runtime21.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_runtime21.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 } }) }),
2160
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
2161
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
2162
- a.message && /* @__PURE__ */ (0, import_jsx_runtime21.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 })
2385
+ /* @__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: [
2386
+ /* @__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 } }) }),
2387
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
2388
+ /* @__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 }),
2389
+ 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 })
2163
2390
  ] })
2164
2391
  ] }) })
2165
2392
  ] }, a.id);
@@ -2169,16 +2396,16 @@ function PresenceLayer({ presence, viewport, clip = true, renderCursor, classNam
2169
2396
  }
2170
2397
 
2171
2398
  // src/paint-editor/PaintEffectsPanel.tsx
2172
- var import_react29 = require("react");
2173
- var import_paint_editor14 = require("@pixerate/editor/paint-editor");
2399
+ var import_react30 = require("react");
2400
+ var import_paint_editor15 = require("@pixerate/editor/paint-editor");
2174
2401
  var import_effects4 = require("@pixerate/editor/effects");
2175
2402
 
2176
2403
  // src/effects/useEffects.ts
2177
- var import_react20 = require("react");
2404
+ var import_react21 = require("react");
2178
2405
  function useEffectDescription(provider, effect) {
2179
- const [state, setState] = (0, import_react20.useState)({ key: "", description: null, error: null });
2406
+ const [state, setState] = (0, import_react21.useState)({ key: "", description: null, error: null });
2180
2407
  const key = provider && effect ? `${provider.id}:${effect}` : "";
2181
- (0, import_react20.useEffect)(() => {
2408
+ (0, import_react21.useEffect)(() => {
2182
2409
  if (!provider || !effect) return;
2183
2410
  let live = true;
2184
2411
  Promise.resolve().then(() => provider.describe(effect)).then(
@@ -2193,14 +2420,14 @@ function useEffectDescription(provider, effect) {
2193
2420
  }
2194
2421
 
2195
2422
  // src/effects/EffectThumbnail.tsx
2196
- var import_react21 = require("react");
2423
+ var import_react22 = require("react");
2197
2424
  var import_effects = require("@pixerate/editor/effects");
2198
- var import_jsx_runtime22 = require("react/jsx-runtime");
2425
+ var import_jsx_runtime23 = require("react/jsx-runtime");
2199
2426
  var LABELS = { motion: "Motion", camera: "Camera", timing: "Timing" };
2200
2427
  function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
2201
- const ref = (0, import_react21.useRef)(null);
2202
- const [failed, setFailed] = (0, import_react21.useState)(effect.kind in LABELS);
2203
- (0, import_react21.useEffect)(() => {
2428
+ const ref = (0, import_react22.useRef)(null);
2429
+ const [failed, setFailed] = (0, import_react22.useState)(effect.kind in LABELS);
2430
+ (0, import_react22.useEffect)(() => {
2204
2431
  if (effect.kind in LABELS) return;
2205
2432
  let live = true;
2206
2433
  (0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
@@ -2215,28 +2442,28 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
2215
2442
  live = false;
2216
2443
  };
2217
2444
  }, [provider, effect, width, height]);
2218
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2445
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2219
2446
  "div",
2220
2447
  {
2221
2448
  className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
2222
2449
  style: { aspectRatio: `${width} / ${height}` },
2223
2450
  "data-effect-thumbnail": effect.id,
2224
- children: failed ? /* @__PURE__ */ (0, import_jsx_runtime22.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_runtime22.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
2451
+ 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" })
2225
2452
  }
2226
2453
  );
2227
2454
  }
2228
2455
 
2229
2456
  // src/effects/EffectsBrowser.tsx
2230
- var import_react22 = require("react");
2457
+ var import_react23 = require("react");
2231
2458
  var import_effects2 = require("@pixerate/editor/effects");
2232
- var import_jsx_runtime23 = require("react/jsx-runtime");
2459
+ var import_jsx_runtime24 = require("react/jsx-runtime");
2233
2460
  function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
2234
- const [all, setAll] = (0, import_react22.useState)([]);
2235
- const [query, setQuery] = (0, import_react22.useState)("");
2236
- const [category, setCategory] = (0, import_react22.useState)("");
2237
- const [use, setUse] = (0, import_react22.useState)("");
2238
- const [error, setError] = (0, import_react22.useState)(null);
2239
- (0, import_react22.useEffect)(() => {
2461
+ const [all, setAll] = (0, import_react23.useState)([]);
2462
+ const [query, setQuery] = (0, import_react23.useState)("");
2463
+ const [category, setCategory] = (0, import_react23.useState)("");
2464
+ const [use, setUse] = (0, import_react23.useState)("");
2465
+ const [error, setError] = (0, import_react23.useState)(null);
2466
+ (0, import_react23.useEffect)(() => {
2240
2467
  if (!provider) return setAll([]);
2241
2468
  let live = true;
2242
2469
  Promise.resolve().then(() => provider.list()).then(
@@ -2247,8 +2474,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2247
2474
  live = false;
2248
2475
  };
2249
2476
  }, [provider]);
2250
- const [found, setFound] = (0, import_react22.useState)([]);
2251
- (0, import_react22.useEffect)(() => {
2477
+ const [found, setFound] = (0, import_react23.useState)([]);
2478
+ (0, import_react23.useEffect)(() => {
2252
2479
  if (!provider) return setFound([]);
2253
2480
  let live = true;
2254
2481
  Promise.resolve().then(() => provider.search(query, { ...category ? { category } : {}, ...use ? { use } : {} })).then((list) => live && setFound(list), () => live && setFound([]));
@@ -2257,14 +2484,14 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2257
2484
  };
2258
2485
  }, [provider, query, category, use]);
2259
2486
  const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses);
2260
- const categories = (0, import_react22.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
2487
+ const categories = (0, import_react23.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
2261
2488
  const shown = found.filter(allowed);
2262
2489
  if (!provider)
2263
- return /* @__PURE__ */ (0, import_jsx_runtime23.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." });
2264
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
2265
- title && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h3", { className: "text-xs font-semibold", children: title }),
2266
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2267
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2490
+ 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." });
2491
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
2492
+ title && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h3", { className: "text-xs font-semibold", children: title }),
2493
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2494
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2268
2495
  "input",
2269
2496
  {
2270
2497
  type: "search",
@@ -2275,17 +2502,17 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2275
2502
  onChange: (e) => setQuery(e.currentTarget.value)
2276
2503
  }
2277
2504
  ),
2278
- /* @__PURE__ */ (0, import_jsx_runtime23.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: [
2279
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "", children: "All categories" }),
2280
- categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: c, children: c }, c))
2505
+ /* @__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: [
2506
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "", children: "All categories" }),
2507
+ categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: c, children: c }, c))
2281
2508
  ] }),
2282
- uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime23.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: [
2283
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "", children: "Any use" }),
2284
- uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
2509
+ 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: [
2510
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "", children: "Any use" }),
2511
+ uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
2285
2512
  ] })
2286
2513
  ] }),
2287
- error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
2288
- /* @__PURE__ */ (0, import_jsx_runtime23.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_runtime23.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2514
+ error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
2515
+ /* @__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)(
2289
2516
  "button",
2290
2517
  {
2291
2518
  type: "button",
@@ -2294,23 +2521,23 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2294
2521
  "data-effect-id": e.id,
2295
2522
  onClick: () => onPick(e),
2296
2523
  children: [
2297
- thumbnails && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(EffectThumbnail, { provider, effect: e }),
2298
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
2299
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
2524
+ thumbnails && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(EffectThumbnail, { provider, effect: e }),
2525
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
2526
+ /* @__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 ") })
2300
2527
  ]
2301
2528
  }
2302
2529
  ) }, e.id)) }),
2303
- !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
2530
+ !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
2304
2531
  ] });
2305
2532
  }
2306
2533
 
2307
2534
  // src/effects/EffectParameters.tsx
2308
- var import_react28 = __toESM(require("react"), 1);
2535
+ var import_react29 = __toESM(require("react"), 1);
2309
2536
  var import_effects3 = require("@pixerate/editor/effects");
2310
2537
  var import_parameters2 = require("@pixerate/editor/parameters");
2311
2538
 
2312
2539
  // src/parameters/fields.tsx
2313
- var import_react27 = require("react");
2540
+ var import_react28 = require("react");
2314
2541
  var import_parameters = require("@pixerate/editor/parameters");
2315
2542
 
2316
2543
  // src/color/index.ts
@@ -2323,9 +2550,9 @@ __export(color_exports, {
2323
2550
  });
2324
2551
 
2325
2552
  // src/color/ColorPicker.tsx
2326
- var import_react23 = require("react");
2553
+ var import_react24 = require("react");
2327
2554
  var import_color = require("@pixerate/editor/color");
2328
- var import_jsx_runtime24 = require("react/jsx-runtime");
2555
+ var import_jsx_runtime25 = require("react/jsx-runtime");
2329
2556
  var LOCAL_STORAGE_KEY = "pixerate:color:recent";
2330
2557
  function readLocalRecents() {
2331
2558
  try {
@@ -2363,24 +2590,24 @@ var ColorPicker = ({
2363
2590
  id,
2364
2591
  "aria-label": ariaLabel = "Color picker"
2365
2592
  }) => {
2366
- const generatedId = (0, import_react23.useId)();
2593
+ const generatedId = (0, import_react24.useId)();
2367
2594
  const pickerId = id || generatedId;
2368
- const [pickerState, setPickerState] = (0, import_react23.useState)(
2595
+ const [pickerState, setPickerState] = (0, import_react24.useState)(
2369
2596
  () => (0, import_color.pickerStateFromColor)(value) ?? DEFAULT_PICKER_STATE
2370
2597
  );
2371
- const stateRef = (0, import_react23.useRef)(pickerState);
2598
+ const stateRef = (0, import_react24.useRef)(pickerState);
2372
2599
  stateRef.current = pickerState;
2373
- (0, import_react23.useEffect)(() => {
2600
+ (0, import_react24.useEffect)(() => {
2374
2601
  const next = (0, import_color.pickerStateFromColor)(value, stateRef.current);
2375
2602
  if (next) {
2376
2603
  setPickerState(next);
2377
2604
  }
2378
2605
  }, [value]);
2379
- const [internalRecent, setInternalRecent] = (0, import_react23.useState)(
2606
+ const [internalRecent, setInternalRecent] = (0, import_react24.useState)(
2380
2607
  () => controlledRecent ? [] : readLocalRecents()
2381
2608
  );
2382
2609
  const activeRecent = controlledRecent ?? internalRecent;
2383
- const recordRecent = (0, import_react23.useCallback)(
2610
+ const recordRecent = (0, import_react24.useCallback)(
2384
2611
  (color) => {
2385
2612
  const updated = (0, import_color.pushRecentColor)(activeRecent, color, 12);
2386
2613
  if (!controlledRecent) {
@@ -2391,11 +2618,11 @@ var ColorPicker = ({
2391
2618
  },
2392
2619
  [activeRecent, controlledRecent, onRecentChange]
2393
2620
  );
2394
- const [textDraft, setTextDraft] = (0, import_react23.useState)(value);
2395
- const [isInvalid, setIsInvalid] = (0, import_react23.useState)(false);
2396
- const [isClipped, setIsClipped] = (0, import_react23.useState)(false);
2397
- const isTypingRef = (0, import_react23.useRef)(false);
2398
- (0, import_react23.useEffect)(() => {
2621
+ const [textDraft, setTextDraft] = (0, import_react24.useState)(value);
2622
+ const [isInvalid, setIsInvalid] = (0, import_react24.useState)(false);
2623
+ const [isClipped, setIsClipped] = (0, import_react24.useState)(false);
2624
+ const isTypingRef = (0, import_react24.useRef)(false);
2625
+ (0, import_react24.useEffect)(() => {
2399
2626
  if (!isTypingRef.current) {
2400
2627
  setTextDraft(value);
2401
2628
  setIsInvalid(false);
@@ -2403,11 +2630,11 @@ var ColorPicker = ({
2403
2630
  setIsClipped(Boolean(parsed && !(0, import_color.inSrgbGamut)(parsed)));
2404
2631
  }
2405
2632
  }, [value]);
2406
- const [hasEyeDropper, setHasEyeDropper] = (0, import_react23.useState)(false);
2407
- (0, import_react23.useEffect)(() => {
2633
+ const [hasEyeDropper, setHasEyeDropper] = (0, import_react24.useState)(false);
2634
+ (0, import_react24.useEffect)(() => {
2408
2635
  setHasEyeDropper(typeof window !== "undefined" && "EyeDropper" in window);
2409
2636
  }, []);
2410
- const emitColorChange = (0, import_react23.useCallback)(
2637
+ const emitColorChange = (0, import_react24.useCallback)(
2411
2638
  (nextState) => {
2412
2639
  setPickerState(nextState);
2413
2640
  const hex = (0, import_color.pickerStateToHex)(nextState, alpha);
@@ -2415,10 +2642,10 @@ var ColorPicker = ({
2415
2642
  },
2416
2643
  [alpha, onChange]
2417
2644
  );
2418
- const latest = (0, import_react23.useRef)({ emitColorChange, recordRecent, onGestureEnd, alpha });
2645
+ const latest = (0, import_react24.useRef)({ emitColorChange, recordRecent, onGestureEnd, alpha });
2419
2646
  latest.current = { emitColorChange, recordRecent, onGestureEnd, alpha };
2420
- const endDragRef = (0, import_react23.useRef)(null);
2421
- (0, import_react23.useEffect)(() => () => endDragRef.current?.(), []);
2647
+ const endDragRef = (0, import_react24.useRef)(null);
2648
+ (0, import_react24.useEffect)(() => () => endDragRef.current?.(), []);
2422
2649
  const startDrag = (e, next) => {
2423
2650
  if (disabled) return;
2424
2651
  e.preventDefault();
@@ -2520,7 +2747,7 @@ var ColorPicker = ({
2520
2747
  } catch {
2521
2748
  }
2522
2749
  };
2523
- const contrastResult = (0, import_react23.useMemo)(() => {
2750
+ const contrastResult = (0, import_react24.useMemo)(() => {
2524
2751
  if (!contrastAgainst) return null;
2525
2752
  const fg = (0, import_color.parseColor)(value);
2526
2753
  const bg = (0, import_color.parseColor)(contrastAgainst);
@@ -2532,7 +2759,7 @@ var ColorPicker = ({
2532
2759
  }, [value, contrastAgainst]);
2533
2760
  const currentHex = (0, import_color.pickerStateToHex)(pickerState, alpha);
2534
2761
  const liveDescription = `Selected color: ${value}${contrastResult ? `, contrast ${contrastResult.ratio.toFixed(1)}:1 against ${contrastAgainst}, ${contrastResult.aa ? "passes AA" : "fails AA"}` : ""}`;
2535
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2762
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
2536
2763
  "div",
2537
2764
  {
2538
2765
  id: pickerId,
@@ -2556,7 +2783,7 @@ var ColorPicker = ({
2556
2783
  pointerEvents: disabled ? "none" : "auto"
2557
2784
  },
2558
2785
  children: [
2559
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2786
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2560
2787
  "span",
2561
2788
  {
2562
2789
  role: "status",
@@ -2575,7 +2802,7 @@ var ColorPicker = ({
2575
2802
  children: liveDescription
2576
2803
  }
2577
2804
  ),
2578
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2805
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2579
2806
  "div",
2580
2807
  {
2581
2808
  role: "slider",
@@ -2597,7 +2824,7 @@ var ColorPicker = ({
2597
2824
  touchAction: "none",
2598
2825
  outline: "none"
2599
2826
  },
2600
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2827
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2601
2828
  "div",
2602
2829
  {
2603
2830
  style: {
@@ -2617,7 +2844,7 @@ var ColorPicker = ({
2617
2844
  )
2618
2845
  }
2619
2846
  ),
2620
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2847
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2621
2848
  "div",
2622
2849
  {
2623
2850
  role: "slider",
@@ -2640,7 +2867,7 @@ var ColorPicker = ({
2640
2867
  touchAction: "none",
2641
2868
  outline: "none"
2642
2869
  },
2643
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2870
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2644
2871
  "div",
2645
2872
  {
2646
2873
  style: {
@@ -2660,7 +2887,7 @@ var ColorPicker = ({
2660
2887
  )
2661
2888
  }
2662
2889
  ),
2663
- alpha && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2890
+ alpha && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
2664
2891
  "div",
2665
2892
  {
2666
2893
  role: "slider",
@@ -2686,7 +2913,7 @@ var ColorPicker = ({
2686
2913
  overflow: "hidden"
2687
2914
  },
2688
2915
  children: [
2689
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2916
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2690
2917
  "div",
2691
2918
  {
2692
2919
  style: {
@@ -2696,7 +2923,7 @@ var ColorPicker = ({
2696
2923
  }
2697
2924
  }
2698
2925
  ),
2699
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2926
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2700
2927
  "div",
2701
2928
  {
2702
2929
  style: {
@@ -2717,8 +2944,8 @@ var ColorPicker = ({
2717
2944
  ]
2718
2945
  }
2719
2946
  ),
2720
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
2721
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2947
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
2948
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2722
2949
  "div",
2723
2950
  {
2724
2951
  style: {
@@ -2732,7 +2959,7 @@ var ColorPicker = ({
2732
2959
  flexShrink: 0,
2733
2960
  border: "1px solid rgba(255,255,255,0.15)"
2734
2961
  },
2735
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2962
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2736
2963
  "div",
2737
2964
  {
2738
2965
  style: {
@@ -2744,7 +2971,7 @@ var ColorPicker = ({
2744
2971
  )
2745
2972
  }
2746
2973
  ),
2747
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2974
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2748
2975
  "input",
2749
2976
  {
2750
2977
  type: "text",
@@ -2774,7 +3001,7 @@ var ColorPicker = ({
2774
3001
  }
2775
3002
  }
2776
3003
  ),
2777
- hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3004
+ hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2778
3005
  "button",
2779
3006
  {
2780
3007
  type: "button",
@@ -2794,7 +3021,7 @@ var ColorPicker = ({
2794
3021
  color: "inherit",
2795
3022
  cursor: disabled ? "default" : "pointer"
2796
3023
  },
2797
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
3024
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
2798
3025
  "svg",
2799
3026
  {
2800
3027
  width: "14",
@@ -2806,16 +3033,16 @@ var ColorPicker = ({
2806
3033
  strokeLinecap: "round",
2807
3034
  strokeLinejoin: "round",
2808
3035
  children: [
2809
- /* @__PURE__ */ (0, import_jsx_runtime24.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" }),
2810
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
2811
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: "m14 6 4 4" })
3036
+ /* @__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" }),
3037
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
3038
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "m14 6 4 4" })
2812
3039
  ]
2813
3040
  }
2814
3041
  )
2815
3042
  }
2816
3043
  )
2817
3044
  ] }),
2818
- isClipped && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3045
+ isClipped && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2819
3046
  "div",
2820
3047
  {
2821
3048
  role: "note",
@@ -2831,10 +3058,10 @@ var ColorPicker = ({
2831
3058
  borderRadius: "4px",
2832
3059
  alignSelf: "flex-start"
2833
3060
  },
2834
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
3061
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
2835
3062
  }
2836
3063
  ),
2837
- contrastResult && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
3064
+ contrastResult && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
2838
3065
  "div",
2839
3066
  {
2840
3067
  style: {
@@ -2848,15 +3075,15 @@ var ColorPicker = ({
2848
3075
  border: "1px solid rgba(255,255,255,0.1)"
2849
3076
  },
2850
3077
  children: [
2851
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { children: [
3078
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { children: [
2852
3079
  "Contrast: ",
2853
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("strong", { children: [
3080
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("strong", { children: [
2854
3081
  contrastResult.ratio.toFixed(2),
2855
3082
  ":1"
2856
3083
  ] })
2857
3084
  ] }),
2858
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
2859
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
3085
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
3086
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
2860
3087
  "span",
2861
3088
  {
2862
3089
  style: {
@@ -2869,7 +3096,7 @@ var ColorPicker = ({
2869
3096
  ]
2870
3097
  }
2871
3098
  ),
2872
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
3099
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
2873
3100
  "span",
2874
3101
  {
2875
3102
  style: {
@@ -2886,9 +3113,9 @@ var ColorPicker = ({
2886
3113
  ]
2887
3114
  }
2888
3115
  ),
2889
- swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2890
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
2891
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3116
+ swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
3117
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
3118
+ /* @__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)(
2892
3119
  "button",
2893
3120
  {
2894
3121
  type: "button",
@@ -2914,9 +3141,9 @@ var ColorPicker = ({
2914
3141
  `${color}-${idx}`
2915
3142
  )) })
2916
3143
  ] }),
2917
- activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2918
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
2919
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3144
+ activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
3145
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
3146
+ /* @__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)(
2920
3147
  "button",
2921
3148
  {
2922
3149
  type: "button",
@@ -2947,9 +3174,9 @@ var ColorPicker = ({
2947
3174
  };
2948
3175
 
2949
3176
  // src/color/DualColorPicker.tsx
2950
- var import_react24 = require("react");
3177
+ var import_react25 = require("react");
2951
3178
  var import_color2 = require("@pixerate/editor/color");
2952
- var import_jsx_runtime25 = require("react/jsx-runtime");
3179
+ var import_jsx_runtime26 = require("react/jsx-runtime");
2953
3180
  function DualColorPicker({
2954
3181
  value,
2955
3182
  onChange,
@@ -2964,8 +3191,8 @@ function DualColorPicker({
2964
3191
  disabled = false,
2965
3192
  className = ""
2966
3193
  }) {
2967
- const sameId = (0, import_react24.useId)();
2968
- const [internalScheme, setInternalScheme] = (0, import_react24.useState)("light");
3194
+ const sameId = (0, import_react25.useId)();
3195
+ const [internalScheme, setInternalScheme] = (0, import_react25.useState)("light");
2969
3196
  const activeScheme = controlledScheme ?? internalScheme;
2970
3197
  const handleSchemeSelect = (nextScheme) => {
2971
3198
  if (onSchemeChange) {
@@ -2976,7 +3203,7 @@ function DualColorPicker({
2976
3203
  };
2977
3204
  const dual = (0, import_color2.normalizeDualColor)(value) ?? { light: "#000000", dark: "#000000" };
2978
3205
  const isSame = dual.light.toLowerCase() === dual.dark.toLowerCase();
2979
- const [sameInBoth, setSameInBoth] = (0, import_react24.useState)(isSame);
3206
+ const [sameInBoth, setSameInBoth] = (0, import_react25.useState)(isSame);
2980
3207
  const handleSameToggle = (e) => {
2981
3208
  const nextSame = e.target.checked;
2982
3209
  setSameInBoth(nextSame);
@@ -3008,7 +3235,7 @@ function DualColorPicker({
3008
3235
  const activeColor = activeScheme === "dark" ? dual.dark : dual.light;
3009
3236
  const activeContrastTarget = contrastAgainst ? (0, import_color2.resolveColor)(contrastAgainst, activeScheme) ?? void 0 : void 0;
3010
3237
  const dualContrast = contrastAgainst && (0, import_color2.normalizeDualColor)(contrastAgainst) ? (0, import_color2.checkDualColorContrast)(dual, contrastAgainst) : null;
3011
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3238
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3012
3239
  "div",
3013
3240
  {
3014
3241
  className: `pixerate-dual-color-picker ${className}`,
@@ -3027,7 +3254,7 @@ function DualColorPicker({
3027
3254
  boxSizing: "border-box"
3028
3255
  },
3029
3256
  children: [
3030
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3257
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3031
3258
  "div",
3032
3259
  {
3033
3260
  role: "tablist",
@@ -3040,7 +3267,7 @@ function DualColorPicker({
3040
3267
  gap: "2px"
3041
3268
  },
3042
3269
  children: [
3043
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3270
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3044
3271
  "button",
3045
3272
  {
3046
3273
  type: "button",
@@ -3063,7 +3290,7 @@ function DualColorPicker({
3063
3290
  children: "Light"
3064
3291
  }
3065
3292
  ),
3066
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3293
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3067
3294
  "button",
3068
3295
  {
3069
3296
  type: "button",
@@ -3089,8 +3316,8 @@ function DualColorPicker({
3089
3316
  ]
3090
3317
  }
3091
3318
  ),
3092
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
3093
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3319
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
3320
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3094
3321
  "button",
3095
3322
  {
3096
3323
  type: "button",
@@ -3112,7 +3339,7 @@ function DualColorPicker({
3112
3339
  outline: "none"
3113
3340
  },
3114
3341
  children: [
3115
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3342
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3116
3343
  "span",
3117
3344
  {
3118
3345
  style: {
@@ -3124,11 +3351,11 @@ function DualColorPicker({
3124
3351
  }
3125
3352
  }
3126
3353
  ),
3127
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
3354
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
3128
3355
  ]
3129
3356
  }
3130
3357
  ),
3131
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3358
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3132
3359
  "button",
3133
3360
  {
3134
3361
  type: "button",
@@ -3150,7 +3377,7 @@ function DualColorPicker({
3150
3377
  outline: "none"
3151
3378
  },
3152
3379
  children: [
3153
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3380
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3154
3381
  "span",
3155
3382
  {
3156
3383
  style: {
@@ -3162,12 +3389,12 @@ function DualColorPicker({
3162
3389
  }
3163
3390
  }
3164
3391
  ),
3165
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
3392
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
3166
3393
  ]
3167
3394
  }
3168
3395
  )
3169
3396
  ] }),
3170
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3397
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3171
3398
  "div",
3172
3399
  {
3173
3400
  style: {
@@ -3178,7 +3405,7 @@ function DualColorPicker({
3178
3405
  padding: "2px 0"
3179
3406
  },
3180
3407
  children: [
3181
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3408
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3182
3409
  "label",
3183
3410
  {
3184
3411
  htmlFor: sameId,
@@ -3192,7 +3419,7 @@ function DualColorPicker({
3192
3419
  color: "#c4cad4"
3193
3420
  },
3194
3421
  children: [
3195
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3422
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3196
3423
  "input",
3197
3424
  {
3198
3425
  id: sameId,
@@ -3203,11 +3430,11 @@ function DualColorPicker({
3203
3430
  style: { cursor: disabled ? "not-allowed" : "pointer" }
3204
3431
  }
3205
3432
  ),
3206
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "Same in both" })
3433
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Same in both" })
3207
3434
  ]
3208
3435
  }
3209
3436
  ),
3210
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3437
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3211
3438
  "button",
3212
3439
  {
3213
3440
  type: "button",
@@ -3229,7 +3456,7 @@ function DualColorPicker({
3229
3456
  ]
3230
3457
  }
3231
3458
  ),
3232
- dualContrast && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3459
+ dualContrast && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3233
3460
  "div",
3234
3461
  {
3235
3462
  "data-testid": "dual-contrast-summary",
@@ -3243,20 +3470,20 @@ function DualColorPicker({
3243
3470
  color: "#8c95a6"
3244
3471
  },
3245
3472
  children: [
3246
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { children: [
3473
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { children: [
3247
3474
  "Light:",
3248
3475
  " ",
3249
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3476
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3250
3477
  dualContrast.light.ratio.toFixed(2),
3251
3478
  " (",
3252
3479
  dualContrast.light.level,
3253
3480
  ")"
3254
3481
  ] })
3255
3482
  ] }),
3256
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { children: [
3483
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { children: [
3257
3484
  "Dark:",
3258
3485
  " ",
3259
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3486
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3260
3487
  dualContrast.dark.ratio.toFixed(2),
3261
3488
  " (",
3262
3489
  dualContrast.dark.level,
@@ -3266,7 +3493,7 @@ function DualColorPicker({
3266
3493
  ]
3267
3494
  }
3268
3495
  ),
3269
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3496
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3270
3497
  ColorPicker,
3271
3498
  {
3272
3499
  value: activeColor,
@@ -3285,7 +3512,7 @@ function DualColorPicker({
3285
3512
  }
3286
3513
 
3287
3514
  // src/color/useColorScheme.ts
3288
- var import_react25 = require("react");
3515
+ var import_react26 = require("react");
3289
3516
  var import_color3 = require("@pixerate/editor/color");
3290
3517
  function getSnapshot(attribute) {
3291
3518
  if (typeof window === "undefined" || typeof document === "undefined") {
@@ -3310,7 +3537,7 @@ function getServerSnapshot() {
3310
3537
  function useColorScheme(options) {
3311
3538
  const override = options?.override;
3312
3539
  const attribute = options?.attribute;
3313
- const subscribe = (0, import_react25.useMemo)(() => {
3540
+ const subscribe = (0, import_react26.useMemo)(() => {
3314
3541
  return (callback) => {
3315
3542
  if (typeof window === "undefined" || typeof document === "undefined") {
3316
3543
  return () => {
@@ -3336,7 +3563,7 @@ function useColorScheme(options) {
3336
3563
  };
3337
3564
  };
3338
3565
  }, [attribute]);
3339
- const detected = (0, import_react25.useSyncExternalStore)(
3566
+ const detected = (0, import_react26.useSyncExternalStore)(
3340
3567
  subscribe,
3341
3568
  () => getSnapshot(attribute),
3342
3569
  getServerSnapshot
@@ -3353,11 +3580,11 @@ function useResolvedColor(value, scheme) {
3353
3580
  __reExport(color_exports, require("@pixerate/editor/color"));
3354
3581
 
3355
3582
  // src/parameters/controls.tsx
3356
- var import_react26 = require("react");
3357
- var import_jsx_runtime26 = require("react/jsx-runtime");
3358
- var ParameterComponentsContext = (0, import_react26.createContext)({});
3583
+ var import_react27 = require("react");
3584
+ var import_jsx_runtime27 = require("react/jsx-runtime");
3585
+ var ParameterComponentsContext = (0, import_react27.createContext)({});
3359
3586
  function useParameterComponents() {
3360
- return (0, import_react26.useContext)(ParameterComponentsContext);
3587
+ return (0, import_react27.useContext)(ParameterComponentsContext);
3361
3588
  }
3362
3589
  function resolveParameterComponents(explicit, context) {
3363
3590
  return {
@@ -3369,7 +3596,7 @@ function resolveParameterComponents(explicit, context) {
3369
3596
  }
3370
3597
 
3371
3598
  // src/parameters/fields.tsx
3372
- var import_jsx_runtime27 = require("react/jsx-runtime");
3599
+ var import_jsx_runtime28 = require("react/jsx-runtime");
3373
3600
  var parameterInputStyle = import_parameters.parameterThemeStyles.input;
3374
3601
  var parameterSelectStyle = import_parameters.parameterThemeStyles.select;
3375
3602
  var parameterButtonStyle = import_parameters.parameterThemeStyles.button;
@@ -3378,9 +3605,9 @@ var parameterInputClass = "h-7 w-full min-w-0 rounded-md border border-input bg-
3378
3605
  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";
3379
3606
  var rangeClass = "h-4 w-full min-w-0 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50";
3380
3607
  function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown, style, ...rest }) {
3381
- const inputRef = (0, import_react27.useRef)(null);
3382
- const lastCommitted = (0, import_react27.useRef)(null);
3383
- (0, import_react27.useLayoutEffect)(() => {
3608
+ const inputRef = (0, import_react28.useRef)(null);
3609
+ const lastCommitted = (0, import_react28.useRef)(null);
3610
+ (0, import_react28.useLayoutEffect)(() => {
3384
3611
  lastCommitted.current = null;
3385
3612
  const el = inputRef.current;
3386
3613
  if (el && el.value !== value) el.value = value;
@@ -3391,9 +3618,9 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
3391
3618
  onCommit(text, el);
3392
3619
  lastCommitted.current = el.value === text ? text : null;
3393
3620
  };
3394
- const commitRef = (0, import_react27.useRef)(commit);
3621
+ const commitRef = (0, import_react28.useRef)(commit);
3395
3622
  commitRef.current = commit;
3396
- (0, import_react27.useEffect)(() => {
3623
+ (0, import_react28.useEffect)(() => {
3397
3624
  const el = inputRef.current;
3398
3625
  if (!el) return;
3399
3626
  const change = () => commitRef.current(el);
@@ -3424,7 +3651,7 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
3424
3651
  if (typeof forwarded === "function") forwarded(el);
3425
3652
  else if (forwarded) forwarded.current = el;
3426
3653
  };
3427
- return multiline ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("textarea", { ...props, ref: setRef, className: `${props.className} h-auto min-h-[3.5rem] py-1` }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { type: "text", ...props, ref: setRef });
3654
+ 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 });
3428
3655
  }
3429
3656
  var plainNumber = (field, value) => (0, import_parameters.formatParameterNumber)({ ...field, unit: void 0 }, value);
3430
3657
  function ParameterNumberInput(props) {
@@ -3458,9 +3685,9 @@ function ParameterNumberInput(props) {
3458
3685
  onCommit: handleCommit,
3459
3686
  onKeyDown: handleKeyDown
3460
3687
  };
3461
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
3462
- CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field) }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterCommitInput, { ...inputProps }),
3463
- field.unit && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
3688
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
3689
+ CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field) }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterCommitInput, { ...inputProps }),
3690
+ 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 })
3464
3691
  ] });
3465
3692
  }
3466
3693
  function ParameterSlider(props) {
@@ -3468,7 +3695,7 @@ function ParameterSlider(props) {
3468
3695
  const ctx = useParameterComponents();
3469
3696
  const resolved = resolveParameterComponents(components, ctx);
3470
3697
  const CustomSlider = resolved.slider;
3471
- const dragging = (0, import_react27.useRef)(false);
3698
+ const dragging = (0, import_react28.useRef)(false);
3472
3699
  const start = () => {
3473
3700
  if (dragging.current) return;
3474
3701
  dragging.current = true;
@@ -3479,7 +3706,7 @@ function ParameterSlider(props) {
3479
3706
  dragging.current = false;
3480
3707
  onGestureEnd?.();
3481
3708
  };
3482
- if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterNumberInput, { ...props });
3709
+ if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterNumberInput, { ...props });
3483
3710
  const step = (0, import_parameters.parameterStep)(field);
3484
3711
  const sliderProps = {
3485
3712
  "aria-label": (0, import_parameters.parameterLabel)(field),
@@ -3493,8 +3720,8 @@ function ParameterSlider(props) {
3493
3720
  className: rangeClass,
3494
3721
  style: parameterRangeStyle
3495
3722
  };
3496
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-2", children: [
3497
- CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3723
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-2", children: [
3724
+ CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3498
3725
  CustomSlider,
3499
3726
  {
3500
3727
  ...sliderProps,
@@ -3504,7 +3731,7 @@ function ParameterSlider(props) {
3504
3731
  onGestureStart: start,
3505
3732
  onGestureEnd: end
3506
3733
  }
3507
- ) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3734
+ ) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3508
3735
  "input",
3509
3736
  {
3510
3737
  type: "range",
@@ -3516,11 +3743,11 @@ function ParameterSlider(props) {
3516
3743
  onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field, Number(e.target.value)))
3517
3744
  }
3518
3745
  ),
3519
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
3746
+ /* @__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` }) })
3520
3747
  ] });
3521
3748
  }
3522
3749
  function ParameterToggle({ field, value, onChange, disabled, id }) {
3523
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3750
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3524
3751
  "button",
3525
3752
  {
3526
3753
  type: "button",
@@ -3531,7 +3758,7 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
3531
3758
  disabled: disabled || field.readOnly,
3532
3759
  onClick: () => onChange(!value),
3533
3760
  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"}`,
3534
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3761
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3535
3762
  "span",
3536
3763
  {
3537
3764
  className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
@@ -3548,7 +3775,7 @@ function ParameterSelect(props) {
3548
3775
  const options = (0, import_parameters.getChoiceOptions)(field);
3549
3776
  const off = disabled || field.readOnly;
3550
3777
  if (field.control === "segmented") {
3551
- return /* @__PURE__ */ (0, import_jsx_runtime27.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_runtime27.jsx)(
3778
+ 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)(
3552
3779
  "button",
3553
3780
  {
3554
3781
  type: "button",
@@ -3565,7 +3792,7 @@ function ParameterSelect(props) {
3565
3792
  }
3566
3793
  if (CustomSelect) {
3567
3794
  const customOptions = options.map((o) => ({ value: o.value, label: (0, import_parameters.choiceOptionLabel)(o), description: o.description }));
3568
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3795
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3569
3796
  CustomSelect,
3570
3797
  {
3571
3798
  id,
@@ -3581,7 +3808,7 @@ function ParameterSelect(props) {
3581
3808
  );
3582
3809
  }
3583
3810
  const index = options.findIndex((o) => o.value === value);
3584
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3811
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3585
3812
  "select",
3586
3813
  {
3587
3814
  id,
@@ -3594,23 +3821,23 @@ function ParameterSelect(props) {
3594
3821
  },
3595
3822
  className: parameterInputClass,
3596
3823
  style: parameterSelectStyle,
3597
- children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: String(i), title: o.description, style: parameterSelectStyle, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
3824
+ 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)))
3598
3825
  }
3599
3826
  );
3600
3827
  }
3601
3828
  function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id, components }) {
3602
3829
  const CustomColor = resolveParameterComponents(components, useParameterComponents()).color;
3603
- const [open, setOpen] = (0, import_react27.useState)(false);
3604
- const containerRef = (0, import_react27.useRef)(null);
3605
- const buttonRef = (0, import_react27.useRef)(null);
3606
- const popoverRef = (0, import_react27.useRef)(null);
3830
+ const [open, setOpen] = (0, import_react28.useState)(false);
3831
+ const containerRef = (0, import_react28.useRef)(null);
3832
+ const buttonRef = (0, import_react28.useRef)(null);
3833
+ const popoverRef = (0, import_react28.useRef)(null);
3607
3834
  const alpha = !!field.alpha;
3608
3835
  const hex = (0, import_parameters.normalizeHexColor)(value, true) ?? "#000000ff";
3609
3836
  const rgb = hex.slice(0, 7);
3610
3837
  const shown = alpha ? hex : rgb;
3611
3838
  const off = disabled || field.readOnly;
3612
3839
  const name = (0, import_parameters.parameterLabel)(field);
3613
- (0, import_react27.useEffect)(() => {
3840
+ (0, import_react28.useEffect)(() => {
3614
3841
  if (!open) return;
3615
3842
  const onPointerDown = (e) => {
3616
3843
  if (containerRef.current && !containerRef.current.contains(e.target)) {
@@ -3632,7 +3859,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3632
3859
  };
3633
3860
  }, [open]);
3634
3861
  if (CustomColor) {
3635
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3862
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3636
3863
  CustomColor,
3637
3864
  {
3638
3865
  id,
@@ -3647,9 +3874,9 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3647
3874
  }
3648
3875
  );
3649
3876
  }
3650
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
3651
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-2", children: [
3652
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3877
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
3878
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-2", children: [
3879
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3653
3880
  "button",
3654
3881
  {
3655
3882
  ref: buttonRef,
@@ -3660,10 +3887,10 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3660
3887
  disabled: off,
3661
3888
  onClick: () => setOpen((prev) => !prev),
3662
3889
  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",
3663
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
3890
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
3664
3891
  }
3665
3892
  ),
3666
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3893
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3667
3894
  ParameterCommitInput,
3668
3895
  {
3669
3896
  id,
@@ -3679,7 +3906,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3679
3906
  }
3680
3907
  )
3681
3908
  ] }),
3682
- open && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3909
+ open && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3683
3910
  "div",
3684
3911
  {
3685
3912
  ref: popoverRef,
@@ -3693,7 +3920,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3693
3920
  },
3694
3921
  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",
3695
3922
  style: { background: "var(--popover, var(--background, #fff))" },
3696
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3923
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3697
3924
  ColorPicker,
3698
3925
  {
3699
3926
  value: shown,
@@ -3711,11 +3938,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3711
3938
  }
3712
3939
  function ParameterVector({ field, value, onChange, disabled, id, components }) {
3713
3940
  const size = (0, import_parameters.vectorSize)(field);
3714
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
3941
+ 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) => {
3715
3942
  const component = (0, import_parameters.vectorComponentField)(field, i);
3716
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
3717
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
3718
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3943
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
3944
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
3945
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3719
3946
  ParameterNumberInput,
3720
3947
  {
3721
3948
  field: component,
@@ -3733,11 +3960,11 @@ function ParameterVector({ field, value, onChange, disabled, id, components }) {
3733
3960
  function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3734
3961
  const off = disabled || field.readOnly;
3735
3962
  const name = (0, import_parameters.parameterLabel)(field);
3736
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "space-y-1.5", children: [
3737
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-2", children: [
3738
- /* @__PURE__ */ (0, import_jsx_runtime27.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_runtime27.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
3739
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
3740
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3963
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "space-y-1.5", children: [
3964
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-2", children: [
3965
+ /* @__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" }) }),
3966
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
3967
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3741
3968
  ParameterCommitInput,
3742
3969
  {
3743
3970
  id,
@@ -3748,15 +3975,15 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3748
3975
  onCommit: (text) => onChange(text.trim())
3749
3976
  }
3750
3977
  ),
3751
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex gap-1", children: [
3752
- resolveFile && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3978
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex gap-1", children: [
3979
+ resolveFile && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3753
3980
  "label",
3754
3981
  {
3755
3982
  style: parameterButtonStyle,
3756
3983
  className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`,
3757
3984
  children: [
3758
3985
  "Choose file\u2026",
3759
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3986
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3760
3987
  "input",
3761
3988
  {
3762
3989
  type: "file",
@@ -3774,7 +4001,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3774
4001
  ]
3775
4002
  }
3776
4003
  ),
3777
- value && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4004
+ value && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3778
4005
  "button",
3779
4006
  {
3780
4007
  type: "button",
@@ -3789,7 +4016,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3789
4016
  ] })
3790
4017
  ] })
3791
4018
  ] }),
3792
- field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4019
+ 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)(
3793
4020
  "button",
3794
4021
  {
3795
4022
  type: "button",
@@ -3799,14 +4026,14 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3799
4026
  disabled: off,
3800
4027
  onClick: () => onChange(o.url),
3801
4028
  className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
3802
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
4029
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
3803
4030
  },
3804
4031
  o.url
3805
4032
  )) })
3806
4033
  ] });
3807
4034
  }
3808
4035
  function ParameterText({ field, value, onChange, disabled, id }) {
3809
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4036
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3810
4037
  ParameterCommitInput,
3811
4038
  {
3812
4039
  id,
@@ -3825,24 +4052,24 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
3825
4052
  switch (field.type) {
3826
4053
  case "number":
3827
4054
  case "int":
3828
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
4055
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
3829
4056
  case "boolean":
3830
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
4057
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
3831
4058
  case "choice":
3832
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
4059
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
3833
4060
  case "color":
3834
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
4061
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
3835
4062
  case "vector":
3836
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
4063
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
3837
4064
  case "image":
3838
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
4065
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
3839
4066
  case "text":
3840
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterText, { field, value, onChange: set, ...rest });
4067
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterText, { field, value, onChange: set, ...rest });
3841
4068
  }
3842
4069
  }
3843
4070
 
3844
4071
  // src/effects/EffectParameters.tsx
3845
- var import_jsx_runtime28 = require("react/jsx-runtime");
4072
+ var import_jsx_runtime29 = require("react/jsx-runtime");
3846
4073
  function EffectParameters({
3847
4074
  description,
3848
4075
  values,
@@ -3857,10 +4084,10 @@ function EffectParameters({
3857
4084
  className = "",
3858
4085
  components
3859
4086
  }) {
3860
- const fields = (0, import_react28.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
3861
- const idBase = (0, import_react28.useId)();
3862
- const gesture = import_react28.default.useRef(null);
3863
- const count = import_react28.default.useRef(0);
4087
+ const fields = (0, import_react29.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
4088
+ const idBase = (0, import_react29.useId)();
4089
+ const gesture = import_react29.default.useRef(null);
4090
+ const count = import_react29.default.useRef(0);
3864
4091
  const CustomPresetSelect = resolveParameterComponents(components, useParameterComponents()).select;
3865
4092
  const handlePresetSelect = (name) => {
3866
4093
  if (!name) return;
@@ -3871,8 +4098,8 @@ function EffectParameters({
3871
4098
  if (preset) onPreset({ ...description.defaults, ...preset.values });
3872
4099
  }
3873
4100
  };
3874
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
3875
- (onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4101
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
4102
+ (onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3876
4103
  CustomPresetSelect,
3877
4104
  {
3878
4105
  "aria-label": `${description.name} presets`,
@@ -3887,7 +4114,7 @@ function EffectParameters({
3887
4114
  ],
3888
4115
  onChange: (name) => handlePresetSelect(String(name))
3889
4116
  }
3890
- ) : /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4117
+ ) : /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3891
4118
  "select",
3892
4119
  {
3893
4120
  className: "w-full rounded border border-border px-1 py-0.5 text-xs",
@@ -3897,8 +4124,8 @@ function EffectParameters({
3897
4124
  disabled,
3898
4125
  onChange: (e) => handlePresetSelect(e.currentTarget.value),
3899
4126
  children: [
3900
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
3901
- description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
4127
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
4128
+ description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
3902
4129
  ]
3903
4130
  }
3904
4131
  )),
@@ -3908,14 +4135,14 @@ function EffectParameters({
3908
4135
  const keyed = keyframed?.has(field.id) ?? false;
3909
4136
  const value = (0, import_effects3.effectFieldValue)(field, values[field.id]);
3910
4137
  const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field.default);
3911
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
3912
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-1.5", children: [
3913
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
3914
- keyed && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
4138
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
4139
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-1.5", children: [
4140
+ /* @__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 }),
4141
+ keyed && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
3915
4142
  renderControlAddon?.(field.id),
3916
- onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime28.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" })
4143
+ 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" })
3917
4144
  ] }),
3918
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4145
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3919
4146
  ParameterFieldControl,
3920
4147
  {
3921
4148
  field,
@@ -3930,15 +4157,15 @@ function EffectParameters({
3930
4157
  )
3931
4158
  ] }, field.id);
3932
4159
  }),
3933
- !fields.length && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
4160
+ !fields.length && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
3934
4161
  ] });
3935
4162
  }
3936
4163
 
3937
4164
  // src/paint-editor/PaintEffectsPanel.tsx
3938
- var import_jsx_runtime29 = require("react/jsx-runtime");
4165
+ var import_jsx_runtime30 = require("react/jsx-runtime");
3939
4166
  function usePaintEffectsProvider(controller) {
3940
- const [provider, setProvider] = (0, import_react29.useState)(controller.effectsProvider);
3941
- (0, import_react29.useEffect)(() => {
4167
+ const [provider, setProvider] = (0, import_react30.useState)(controller.effectsProvider);
4168
+ (0, import_react30.useEffect)(() => {
3942
4169
  setProvider(controller.effectsProvider);
3943
4170
  return controller.effects.subscribe(setProvider);
3944
4171
  }, [controller]);
@@ -3946,27 +4173,27 @@ function usePaintEffectsProvider(controller) {
3946
4173
  }
3947
4174
  function usePaintEffectsTools(registry, controller, options = {}) {
3948
4175
  const { id, namespace, readOnly, playbackSurface } = options;
3949
- (0, import_react29.useEffect)(() => {
4176
+ (0, import_react30.useEffect)(() => {
3950
4177
  if (!registry) return;
3951
- return registry.register((0, import_paint_editor14.createPaintEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
4178
+ return registry.register((0, import_paint_editor15.createPaintEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
3952
4179
  }, [registry, controller, id, namespace, readOnly, playbackSurface]);
3953
4180
  }
3954
4181
  function Controls({ provider, effect, name, values, apply }) {
3955
4182
  const { description, error } = useEffectDescription(provider, effect);
3956
- const drags = (0, import_react29.useRef)(/* @__PURE__ */ new Set());
3957
- if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
4183
+ const drags = (0, import_react30.useRef)(/* @__PURE__ */ new Set());
4184
+ if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
3958
4185
  'No effects provider: "',
3959
4186
  name ?? effect,
3960
4187
  '" is kept as it was drawn.'
3961
4188
  ] });
3962
- if (error) return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
3963
- if (!description) return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
4189
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
4190
+ if (!description) return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
3964
4191
  const commit = (gesture) => {
3965
4192
  if (!gesture || drags.current.has(gesture)) return !gesture;
3966
4193
  drags.current.add(gesture);
3967
4194
  return true;
3968
4195
  };
3969
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4196
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3970
4197
  EffectParameters,
3971
4198
  {
3972
4199
  description,
@@ -3988,8 +4215,8 @@ var PaintEffectsPanel = ({ controller, className }) => {
3988
4215
  const state = usePaintEditorState(controller);
3989
4216
  const provider = usePaintEffectsProvider(controller);
3990
4217
  const [error, attempt] = useAttempt();
3991
- const [browse, setBrowse] = (0, import_react29.useState)(null);
3992
- const [busy, setBusy] = (0, import_react29.useState)(false);
4218
+ const [browse, setBrowse] = (0, import_react30.useState)(null);
4219
+ const [busy, setBusy] = (0, import_react30.useState)(false);
3993
4220
  const paper = controller.getPaperEffect();
3994
4221
  const activeId = state.document.activeLayerId;
3995
4222
  const layerEffect = activeId ? controller.getEffectLayer(activeId) : void 0;
@@ -4003,7 +4230,7 @@ var PaintEffectsPanel = ({ controller, className }) => {
4003
4230
  if (!effectPaint) return;
4004
4231
  run(() => controller.setEffectPaint({ effect: effectPaint.effect, values: effectPaint.values, time: effectPaint.time, map: effectPaint.map, live: effectPaint.live, ...patch }));
4005
4232
  };
4006
- const thumbnail = (0, import_react29.useMemo)(() => effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(48) : null, [controller, effectPaint, state.effectPaintRendering]);
4233
+ const thumbnail = (0, import_react30.useMemo)(() => effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(48) : null, [controller, effectPaint, state.effectPaintRendering]);
4007
4234
  const run = (work) => attempt(() => {
4008
4235
  setBusy(true);
4009
4236
  return work().finally(() => setBusy(false));
@@ -4019,28 +4246,28 @@ var PaintEffectsPanel = ({ controller, className }) => {
4019
4246
  };
4020
4247
  const toggle = (b) => setBrowse(browse === b ? null : b);
4021
4248
  const pixel = active?.type === "pixel";
4022
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
4023
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
4024
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
4025
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
4026
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
4027
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
4028
- /* @__PURE__ */ (0, import_jsx_runtime29.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" }),
4029
- /* @__PURE__ */ (0, import_jsx_runtime29.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" })
4249
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
4250
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
4251
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
4252
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
4253
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
4254
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
4255
+ /* @__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" }),
4256
+ /* @__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" })
4030
4257
  ] }),
4031
- !provider && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
4032
- browse && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
4033
- paper && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
4034
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-1", children: [
4035
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex-1 truncate", children: [
4258
+ !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." }),
4259
+ browse && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
4260
+ 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: [
4261
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-1", children: [
4262
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex-1 truncate", children: [
4036
4263
  "Paper: ",
4037
4264
  paper.name ?? paper.effect
4038
4265
  ] }),
4039
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
4266
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
4040
4267
  ] }),
4041
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
4042
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
4043
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4268
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
4269
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
4270
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4044
4271
  "input",
4045
4272
  {
4046
4273
  type: "range",
@@ -4062,43 +4289,43 @@ var PaintEffectsPanel = ({ controller, className }) => {
4062
4289
  `o${paper.opacity}`
4063
4290
  )
4064
4291
  ] }),
4065
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
4066
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
4067
- /* @__PURE__ */ (0, import_jsx_runtime29.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) => {
4292
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
4293
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
4294
+ /* @__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) => {
4068
4295
  const blend = e.currentTarget.value;
4069
4296
  run(() => controller.updatePaperEffect({ blend }));
4070
- }, children: import_paint_editor14.PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: b, children: b }, b)) })
4297
+ }, children: import_paint_editor15.PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: b, children: b }, b)) })
4071
4298
  ] }),
4072
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
4299
+ /* @__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)) })
4073
4300
  ] }),
4074
- effectPaint && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paint", children: [
4075
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-1", children: [
4076
- thumbnail ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("img", { src: thumbnail, alt: "", className: "h-5 w-8 rounded object-cover ring-1 ring-slate-700", "data-testid": "effect-paint-thumbnail" }) : null,
4077
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex-1 truncate", children: [
4301
+ 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: [
4302
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-1", children: [
4303
+ 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,
4304
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex-1 truncate", children: [
4078
4305
  "Paint: ",
4079
4306
  effectPaint.effect,
4080
4307
  state.effectPaintRendering ? " (rendering\u2026)" : ""
4081
4308
  ] }),
4082
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
4309
+ /* @__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" })
4083
4310
  ] }),
4084
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
4085
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", title: "Lay the effect along each stroke instead of fixing it to the canvas", children: [
4086
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("input", { type: "checkbox", checked: effectPaint.map?.by === "stroke", onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
4311
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
4312
+ /* @__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: [
4313
+ /* @__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" } }) }),
4087
4314
  "Along the stroke"
4088
4315
  ] }),
4089
- hasPathControl && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", title: "Pass each stroke's centreline to the effect's own path control", children: [
4090
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("input", { type: "checkbox", checked: effectPaint.map?.by === "path", onChange: (e) => repaint({ map: e.target.checked ? { by: "path" } : { by: "canvas" } }) }),
4316
+ 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: [
4317
+ /* @__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" } }) }),
4091
4318
  "Along the stroke (native)"
4092
4319
  ] }),
4093
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
4094
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
4320
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
4321
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
4095
4322
  "Live"
4096
4323
  ] })
4097
4324
  ] }),
4098
- effectPaint.map?.by === "stroke" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
4099
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
4100
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-slate-400", children: "Length" }),
4101
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4325
+ effectPaint.map?.by === "stroke" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
4326
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
4327
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-slate-400", children: "Length" }),
4328
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4102
4329
  "input",
4103
4330
  {
4104
4331
  type: "number",
@@ -4112,56 +4339,56 @@ var PaintEffectsPanel = ({ controller, className }) => {
4112
4339
  effectPaint.map.length
4113
4340
  )
4114
4341
  ] }),
4115
- /* @__PURE__ */ (0, import_jsx_runtime29.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: [
4116
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: "repeat", children: "Repeat" }),
4117
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: "mirror", children: "Mirror" }),
4118
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: "clamp", children: "Clamp" })
4342
+ /* @__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: [
4343
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "repeat", children: "Repeat" }),
4344
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "mirror", children: "Mirror" }),
4345
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "clamp", children: "Clamp" })
4119
4346
  ] })
4120
4347
  ] }),
4121
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
4348
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
4122
4349
  ] }),
4123
- animation && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-2 rounded border border-slate-700 p-1", "data-effect-part": "playback", children: [
4124
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex-1 truncate", children: [
4350
+ 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: [
4351
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex-1 truncate", children: [
4125
4352
  "Live paint: ",
4126
4353
  animation.strokes,
4127
4354
  " ",
4128
4355
  animation.strokes === 1 ? "stroke" : "strokes"
4129
4356
  ] }),
4130
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, "aria-pressed": playback.playing, onClick: () => attempt(() => controller.setEffectPlayback({ playing: !playback.playing })), children: playback.playing ? "Pause" : "Play" }),
4131
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
4132
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-slate-400", children: "fps" }),
4133
- /* @__PURE__ */ (0, import_jsx_runtime29.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" })
4357
+ /* @__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" }),
4358
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
4359
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-slate-400", children: "fps" }),
4360
+ /* @__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" })
4134
4361
  ] })
4135
4362
  ] }),
4136
- layerEffect && activeId && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "layer", children: [
4137
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-1", children: [
4138
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex-1 truncate", children: [
4363
+ 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: [
4364
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-1", children: [
4365
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex-1 truncate", children: [
4139
4366
  "Layer: ",
4140
4367
  layerEffect.name ?? layerEffect.effect
4141
4368
  ] }),
4142
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
4369
+ /* @__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" })
4143
4370
  ] }),
4144
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
4371
+ /* @__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)) })
4145
4372
  ] }),
4146
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ErrorLine, { error })
4373
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ErrorLine, { error })
4147
4374
  ] });
4148
4375
  };
4149
4376
 
4150
4377
  // src/paint-editor/PaintEditor.tsx
4151
- var import_jsx_runtime30 = require("react/jsx-runtime");
4378
+ var import_jsx_runtime31 = require("react/jsx-runtime");
4152
4379
  var PAINT_CONTROLS = {
4153
4380
  "mixing-pad": '[data-testid="mixing-pad"]',
4154
4381
  lighting: '[data-testid="light-panel"]',
4155
4382
  symmetry: '[aria-label="Symmetry"]'
4156
4383
  };
4157
- var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, agentStrokes, className, playback, playbackId = "paint", onPlaybackReveal }) => {
4158
- const [tool, setTool] = (0, import_react30.useState)("brush");
4159
- const [fillOptions, setFillOptions] = (0, import_react30.useState)({ reference: "all", tolerance: 32, closeGap: 4, expand: 1, antialias: true });
4160
- const [tab, setTab] = (0, import_react30.useState)("color");
4161
- const tabRef = (0, import_react30.useRef)(tab);
4384
+ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, agentStrokes, deviceTilt, className, playback, playbackId = "paint", onPlaybackReveal }) => {
4385
+ const [tool, setTool] = (0, import_react31.useState)("brush");
4386
+ const [fillOptions, setFillOptions] = (0, import_react31.useState)({ reference: "all", tolerance: 32, closeGap: 4, expand: 1, antialias: true });
4387
+ const [tab, setTab] = (0, import_react31.useState)("color");
4388
+ const tabRef = (0, import_react31.useRef)(tab);
4162
4389
  tabRef.current = tab;
4163
- const rootRef = (0, import_react30.useRef)(null);
4164
- const [ownPresence] = (0, import_react30.useState)(() => new import_paint_editor15.PaintPresence());
4390
+ const rootRef = (0, import_react31.useRef)(null);
4391
+ const [ownPresence] = (0, import_react31.useState)(() => new import_paint_editor16.PaintPresence());
4165
4392
  const ambientPlayback = useAgentPlayback();
4166
4393
  const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
4167
4394
  const viewBox = () => {
@@ -4172,12 +4399,12 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
4172
4399
  const docToClient = (p) => {
4173
4400
  const r = viewBox();
4174
4401
  if (!r) return null;
4175
- const q = (0, import_paint_editor15.documentToScreen)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x, p.y);
4402
+ const q = (0, import_paint_editor16.documentToScreen)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x, p.y);
4176
4403
  return { x: r.left + q.x, y: r.top + q.y };
4177
4404
  };
4178
4405
  const clientToDoc = (p) => {
4179
4406
  const r = viewBox();
4180
- return r ? (0, import_paint_editor15.screenToDocument)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x - r.left, p.y - r.top) : null;
4407
+ 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;
4181
4408
  };
4182
4409
  const elementRect = (selector) => {
4183
4410
  const r = rootRef.current?.querySelector(selector)?.getBoundingClientRect();
@@ -4217,29 +4444,30 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
4217
4444
  const box = rootRef.current?.getBoundingClientRect();
4218
4445
  return c && box ? { x: c.x - box.left, y: c.y - box.top } : p;
4219
4446
  };
4220
- const [error, setError] = (0, import_react30.useState)(null);
4447
+ const [error, setError] = (0, import_react31.useState)(null);
4221
4448
  const effects = usePaintEffectsProvider(controller);
4222
4449
  const tabs = effects ? ["color", "wet", "paper", "layers", "effects"] : ["color", "wet", "paper", "layers"];
4223
- return /* @__PURE__ */ (0, import_jsx_runtime30.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: [
4224
- playing && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
4225
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PaintToolbar, { controller, tool, onToolChange: setTool, fillOptions, onFillOptionsChange: setFillOptions, fileName }),
4226
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex min-h-0 flex-1 gap-2", children: [
4227
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
4228
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
4229
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PaintCanvas, { controller, tool, fillOptions, onError: setError, presence: playing ? void 0 : presence, proposals, agentStrokes, className: "flex-1 rounded-lg" }),
4230
- error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
4450
+ 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: [
4451
+ playing && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
4452
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PaintToolbar, { controller, tool, onToolChange: setTool, fillOptions, onFillOptionsChange: setFillOptions, fileName }),
4453
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex min-h-0 flex-1 gap-2", children: [
4454
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
4455
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
4456
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PaintCanvas, { controller, tool, fillOptions, onError: setError, presence: playing ? void 0 : presence, proposals, agentStrokes, deviceTilt, className: "flex-1 rounded-lg" }),
4457
+ error && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
4231
4458
  ] }),
4232
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
4233
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex gap-1", role: "tablist", "aria-label": "Paint panels", children: tabs.map((t) => /* @__PURE__ */ (0, import_jsx_runtime30.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)) }),
4234
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
4235
- tab === "color" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ColorPanel, { controller }),
4236
- tab === "wet" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(WetPanel, { controller }),
4237
- tab === "paper" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PaperPanel, { controller }),
4238
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PaintLayersPanel, { controller }),
4239
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(StrokePanel, { controller }),
4240
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PathStrokePanel, { controller }),
4241
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(StickerPanel, { controller }),
4242
- tab === "effects" && effects && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PaintEffectsPanel, { controller })
4459
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
4460
+ /* @__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)) }),
4461
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
4462
+ tab === "color" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ColorPanel, { controller }),
4463
+ tab === "wet" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(WetPanel, { controller }),
4464
+ tab === "paper" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PaperPanel, { controller }),
4465
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PaintLayersPanel, { controller }),
4466
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(StrokePanel, { controller }),
4467
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PathStrokePanel, { controller }),
4468
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(EvolutionPanel, { controller, proposals }),
4469
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(StickerPanel, { controller }),
4470
+ tab === "effects" && effects && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PaintEffectsPanel, { controller })
4243
4471
  ] })
4244
4472
  ] })
4245
4473
  ] })
@@ -4251,6 +4479,7 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
4251
4479
  BrushLibraryBrowser,
4252
4480
  BrushPanel,
4253
4481
  ColorPanel,
4482
+ EvolutionPanel,
4254
4483
  PaintCanvas,
4255
4484
  PaintEditor,
4256
4485
  PaintEffectsPanel,
@@ -4266,6 +4495,7 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
4266
4495
  StickerPicker,
4267
4496
  StrokePanel,
4268
4497
  WetPanel,
4498
+ useMutationRequests,
4269
4499
  usePaintChangeFeed,
4270
4500
  usePaintDirector,
4271
4501
  usePaintEditor,