@pixerate/editor-react 0.161.0 → 0.162.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.
@@ -43,6 +43,7 @@ __export(paint_editor_exports, {
43
43
  PaintToolbar: () => PaintToolbar,
44
44
  PaperPanel: () => PaperPanel,
45
45
  StickerPanel: () => StickerPanel,
46
+ StrokePanel: () => StrokePanel,
46
47
  WetPanel: () => WetPanel,
47
48
  usePaintDirector: () => usePaintDirector,
48
49
  usePaintEditor: () => usePaintEditor,
@@ -89,6 +90,7 @@ var PaintCanvas = ({ controller, tool = "brush", showGuides = true, fitOnMount =
89
90
  const [size, setSize] = (0, import_react2.useState)({ width: 800, height: 600 });
90
91
  const measured = (0, import_react2.useRef)(false);
91
92
  const [predicted, setPredicted] = (0, import_react2.useState)([]);
93
+ const [strokeDrag, setStrokeDrag] = (0, import_react2.useState)(null);
92
94
  const presenter = (0, import_react2.useMemo)(() => new import_paint_editor2.PaintCanvasPresenter(controller), [controller]);
93
95
  const gesture = (0, import_react2.useMemo)(
94
96
  () => new import_paint_editor2.PaintGesture(controller, () => {
@@ -142,7 +144,7 @@ var PaintCanvas = ({ controller, tool = "brush", showGuides = true, fitOnMount =
142
144
  }, [gesture]);
143
145
  const report = () => onError?.(gesture.error);
144
146
  const transform = (0, import_paint_editor2.viewCssTransform)(state.view, doc, size);
145
- const lines = showGuides ? (0, import_paint_editor2.guideOverlay)(controller) : [];
147
+ const lines = showGuides ? (0, import_paint_editor2.guideOverlay)(controller, strokeDrag) : [];
146
148
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
147
149
  "div",
148
150
  {
@@ -152,7 +154,7 @@ var PaintCanvas = ({ controller, tool = "brush", showGuides = true, fitOnMount =
152
154
  "aria-label": "Paint canvas",
153
155
  "data-testid": "paint-canvas",
154
156
  className: `relative overflow-hidden bg-slate-950 outline-none touch-none select-none ${className ?? ""}`,
155
- style: { cursor: tool === "pan" ? "grab" : tool === "eyedropper" ? "copy" : "crosshair" },
157
+ style: { cursor: tool === "pan" ? "grab" : tool === "eyedropper" ? "copy" : tool === "stroke" ? "default" : "crosshair" },
156
158
  onPointerDown: (e) => {
157
159
  viewport.current?.focus();
158
160
  if (gesture.down(e.nativeEvent)) e.target.setPointerCapture?.(e.pointerId);
@@ -161,14 +163,18 @@ var PaintCanvas = ({ controller, tool = "brush", showGuides = true, fitOnMount =
161
163
  onPointerMove: (e) => {
162
164
  gesture.move(e.nativeEvent);
163
165
  if (gesture.predicted.length || predicted.length) setPredicted(gesture.predicted.map((p) => ({ x: p.x, y: p.y })));
166
+ if (gesture.strokeDrag || strokeDrag) setStrokeDrag(gesture.strokeDrag);
164
167
  },
165
168
  onPointerUp: (e) => {
166
169
  gesture.up(e.nativeEvent);
167
170
  setPredicted([]);
171
+ setStrokeDrag(null);
172
+ report();
168
173
  },
169
174
  onPointerCancel: () => {
170
175
  gesture.cancel();
171
176
  setPredicted([]);
177
+ setStrokeDrag(null);
172
178
  },
173
179
  onKeyDown: (e) => {
174
180
  if ((0, import_paint_editor2.handlePaintShortcut)(controller, gesture, e)) e.preventDefault();
@@ -203,8 +209,8 @@ var PaintCanvas = ({ controller, tool = "brush", showGuides = true, fitOnMount =
203
209
  y1: l.from.y,
204
210
  x2: l.to.x,
205
211
  y2: l.to.y,
206
- stroke: l.kind === "symmetry" ? "#22d3ee" : l.kind === "stencil" ? "#fbbf24" : l.kind === "sticker" ? "#818cf8" : "#f472b6",
207
- strokeOpacity: l.kind === "symmetry" || l.kind === "stencil" || l.kind === "sticker" ? 0.8 : 0.35,
212
+ stroke: l.kind === "symmetry" ? "#22d3ee" : l.kind === "stencil" ? "#fbbf24" : l.kind === "stroke" || l.kind === "sticker" ? "#818cf8" : "#f472b6",
213
+ strokeOpacity: l.kind === "symmetry" || l.kind === "stencil" || l.kind === "stroke" || l.kind === "sticker" ? 0.8 : 0.35,
208
214
  strokeWidth: 1 / state.view.zoom,
209
215
  strokeDasharray: l.kind === "symmetry" ? `${6 / state.view.zoom} ${4 / state.view.zoom}` : void 0
210
216
  },
@@ -1157,6 +1163,7 @@ var PaintLayersPanel = ({ controller, className }) => {
1157
1163
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1158
1164
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer()), children: "New layer" }),
1159
1165
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer({ type: "group" })), children: "New group" }),
1166
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: button, title: "A layer whose strokes stay editable", onClick: () => attempt(() => controller.addLayer({ type: "strokes" })), children: "New stroke layer" }),
1160
1167
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.duplicateLayer(active.id)), children: "Duplicate" }),
1161
1168
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer up", onClick: () => move(1), children: "\u2191" }),
1162
1169
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer down", onClick: () => move(-1), children: "\u2193" }),
@@ -1204,6 +1211,10 @@ var PaintLayersPanel = ({ controller, className }) => {
1204
1211
  }
1205
1212
  ) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex-1 truncate", onDoubleClick: () => setRenaming(l.id), children: [
1206
1213
  l.type === "group" ? "\u25B8 " : "",
1214
+ l.liveStrokes !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { "aria-label": "Stroke layer", title: `Stroke layer: ${l.liveStrokes} editable strokes`, children: [
1215
+ "\u270E",
1216
+ " "
1217
+ ] }),
1207
1218
  l.name
1208
1219
  ] }),
1209
1220
  l.locks.pixels || l.locks.all ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { title: "Locked", children: "\u{1F512}" }) : null
@@ -1354,13 +1365,80 @@ var StickerPanel = ({ controller, className }) => {
1354
1365
  ] });
1355
1366
  };
1356
1367
 
1368
+ // src/paint-editor/StrokePanel.tsx
1369
+ var import_paint_editor13 = require("@pixerate/editor/paint-editor");
1370
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1371
+ var StrokePanel = ({ controller, className }) => {
1372
+ const state = usePaintEditorState(controller);
1373
+ const [error, attempt] = useAttempt();
1374
+ const layerId = state.document.activeLayerId;
1375
+ const strokes = layerId ? state.document.liveStrokes?.[layerId] : void 0;
1376
+ if (!layerId || !strokes) return null;
1377
+ const index = strokes.findIndex((s) => s.id === state.selectedStroke);
1378
+ const sel = index >= 0 ? strokes[index] : null;
1379
+ const brushes = state.brushes.filter((b) => !(0, import_paint_editor13.liveStrokeRefusal)(b));
1380
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "stroke-panel", children: [
1381
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center justify-between", children: [
1382
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "font-medium text-slate-300", children: [
1383
+ "Strokes (",
1384
+ strokes.length,
1385
+ ")"
1386
+ ] }),
1387
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.rasterizeLiveStrokes(layerId)), children: "Rasterize" })
1388
+ ] }),
1389
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex max-h-24 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Strokes", children: strokes.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1390
+ "button",
1391
+ {
1392
+ type: "button",
1393
+ role: "option",
1394
+ "aria-selected": s.id === state.selectedStroke,
1395
+ title: `${i + 1}. ${s.brush.name} (${s.id})`,
1396
+ className: `h-5 w-5 rounded ring-1 ${s.id === state.selectedStroke ? "ring-indigo-400" : "ring-slate-700"}`,
1397
+ style: { background: s.color },
1398
+ onClick: () => controller.selectStroke(s.id)
1399
+ },
1400
+ s.id
1401
+ )) }),
1402
+ sel && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "stroke-edit", children: [
1403
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
1404
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-slate-400", children: "Brush" }),
1405
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1406
+ "select",
1407
+ {
1408
+ "aria-label": "Stroke brush",
1409
+ value: brushes.some((b) => b.id === sel.brush.id) ? sel.brush.id : "",
1410
+ onChange: (e) => e.target.value && attempt(() => controller.updateStroke(sel.id, { brushId: e.target.value })),
1411
+ className: "max-w-[10rem] rounded bg-slate-800 px-1 py-0.5",
1412
+ children: [
1413
+ !brushes.some((b) => b.id === sel.brush.id) && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "", children: sel.brush.name }),
1414
+ brushes.map((b) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: b.id, children: b.name }, b.id))
1415
+ ]
1416
+ }
1417
+ )
1418
+ ] }),
1419
+ import_paint_editor13.STROKE_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor13.readPath)(sel.brush, c.path), onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { brush: { tip: { [c.path.split(".")[1]]: v } } })) }, c.path)),
1420
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center justify-between", children: [
1421
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-slate-400", children: "Colour" }),
1422
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CommitColorInput, { label: "Stroke colour", value: sel.color, onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { color: v })), className: "h-6 w-10 rounded bg-transparent" })
1423
+ ] }),
1424
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1425
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.updateStroke(sel.id, { seed: (sel.seed + 1) % 2147483647 })), children: "New seed" }),
1426
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, disabled: index === strokes.length - 1, "aria-label": "Move stroke up", onClick: () => attempt(() => controller.reorderStroke(sel.id, index + 1)), children: "\u2191" }),
1427
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, disabled: index === 0, "aria-label": "Move stroke down", onClick: () => attempt(() => controller.reorderStroke(sel.id, index - 1)), children: "\u2193" }),
1428
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStrokes([sel.id]), controller.selectStroke(null))), children: "Delete" })
1429
+ ] })
1430
+ ] }),
1431
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ErrorLine, { error })
1432
+ ] });
1433
+ };
1434
+
1357
1435
  // src/paint-editor/PaintEditor.tsx
1358
1436
  var import_react23 = require("react");
1359
- var import_paint_editor14 = require("@pixerate/editor/paint-editor");
1437
+ var import_paint_editor15 = require("@pixerate/editor/paint-editor");
1360
1438
 
1361
1439
  // src/playback/AgentPlaybackContext.tsx
1362
1440
  var import_react10 = require("react");
1363
- var import_jsx_runtime12 = require("react/jsx-runtime");
1441
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1364
1442
  var AgentPlaybackContext = (0, import_react10.createContext)(null);
1365
1443
  function useAgentPlayback() {
1366
1444
  return (0, import_react10.useContext)(AgentPlaybackContext);
@@ -1409,12 +1487,12 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
1409
1487
 
1410
1488
  // src/playback/PresenceLayer.tsx
1411
1489
  var import_react12 = __toESM(require("react"), 1);
1412
- var import_jsx_runtime13 = require("react/jsx-runtime");
1490
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1413
1491
  function PresenceLayer({ presence, viewport, clip = true, renderCursor, className = "" }) {
1414
1492
  const { actors } = (0, import_react12.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
1415
1493
  if (!actors.length) return null;
1416
1494
  const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
1417
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1495
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1418
1496
  "div",
1419
1497
  {
1420
1498
  className: `pixerate-presence ${className}`.trim(),
@@ -1428,19 +1506,19 @@ function PresenceLayer({ presence, viewport, clip = true, renderCursor, classNam
1428
1506
  const br = map({ x: a.focus.x + a.focus.width, y: a.focus.y + a.focus.height });
1429
1507
  return { left: tl.x - 4, top: tl.y - 4, width: br.x - tl.x + 8, height: br.y - tl.y + 8 };
1430
1508
  })();
1431
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react12.default.Fragment, { children: [
1432
- ring && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1509
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react12.default.Fragment, { children: [
1510
+ ring && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1433
1511
  "div",
1434
1512
  {
1435
1513
  "data-actor-focus": a.id,
1436
1514
  style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
1437
1515
  }
1438
1516
  ),
1439
- /* @__PURE__ */ (0, import_jsx_runtime13.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_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
1440
- /* @__PURE__ */ (0, import_jsx_runtime13.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_runtime13.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 } }) }),
1441
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
1442
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
1443
- a.message && /* @__PURE__ */ (0, import_jsx_runtime13.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 })
1517
+ /* @__PURE__ */ (0, import_jsx_runtime14.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_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
1518
+ /* @__PURE__ */ (0, import_jsx_runtime14.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_runtime14.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 } }) }),
1519
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
1520
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
1521
+ a.message && /* @__PURE__ */ (0, import_jsx_runtime14.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 })
1444
1522
  ] })
1445
1523
  ] }) })
1446
1524
  ] }, a.id);
@@ -1451,7 +1529,7 @@ function PresenceLayer({ presence, viewport, clip = true, renderCursor, classNam
1451
1529
 
1452
1530
  // src/paint-editor/PaintEffectsPanel.tsx
1453
1531
  var import_react22 = require("react");
1454
- var import_paint_editor13 = require("@pixerate/editor/paint-editor");
1532
+ var import_paint_editor14 = require("@pixerate/editor/paint-editor");
1455
1533
 
1456
1534
  // src/effects/useEffects.ts
1457
1535
  var import_react13 = require("react");
@@ -1475,7 +1553,7 @@ function useEffectDescription(provider, effect) {
1475
1553
  // src/effects/EffectThumbnail.tsx
1476
1554
  var import_react14 = require("react");
1477
1555
  var import_effects = require("@pixerate/editor/effects");
1478
- var import_jsx_runtime14 = require("react/jsx-runtime");
1556
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1479
1557
  var LABELS = { motion: "Motion", camera: "Camera" };
1480
1558
  function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
1481
1559
  const ref = (0, import_react14.useRef)(null);
@@ -1495,13 +1573,13 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
1495
1573
  live = false;
1496
1574
  };
1497
1575
  }, [provider, effect, width, height]);
1498
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1576
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1499
1577
  "div",
1500
1578
  {
1501
1579
  className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
1502
1580
  style: { aspectRatio: `${width} / ${height}` },
1503
1581
  "data-effect-thumbnail": effect.id,
1504
- children: failed ? /* @__PURE__ */ (0, import_jsx_runtime14.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_runtime14.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
1582
+ children: failed ? /* @__PURE__ */ (0, import_jsx_runtime15.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_runtime15.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
1505
1583
  }
1506
1584
  );
1507
1585
  }
@@ -1509,7 +1587,7 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
1509
1587
  // src/effects/EffectsBrowser.tsx
1510
1588
  var import_react15 = require("react");
1511
1589
  var import_effects2 = require("@pixerate/editor/effects");
1512
- var import_jsx_runtime15 = require("react/jsx-runtime");
1590
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1513
1591
  function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
1514
1592
  const [all, setAll] = (0, import_react15.useState)([]);
1515
1593
  const [query, setQuery] = (0, import_react15.useState)("");
@@ -1540,11 +1618,11 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1540
1618
  const categories = (0, import_react15.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
1541
1619
  const shown = found.filter(allowed);
1542
1620
  if (!provider)
1543
- return /* @__PURE__ */ (0, import_jsx_runtime15.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." });
1544
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
1545
- title && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h3", { className: "text-xs font-semibold", children: title }),
1546
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1547
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1621
+ return /* @__PURE__ */ (0, import_jsx_runtime16.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." });
1622
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
1623
+ title && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h3", { className: "text-xs font-semibold", children: title }),
1624
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1625
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1548
1626
  "input",
1549
1627
  {
1550
1628
  type: "search",
@@ -1555,17 +1633,17 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1555
1633
  onChange: (e) => setQuery(e.currentTarget.value)
1556
1634
  }
1557
1635
  ),
1558
- /* @__PURE__ */ (0, import_jsx_runtime15.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: [
1559
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "", children: "All categories" }),
1560
- categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: c, children: c }, c))
1636
+ /* @__PURE__ */ (0, import_jsx_runtime16.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: [
1637
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "", children: "All categories" }),
1638
+ categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: c, children: c }, c))
1561
1639
  ] }),
1562
- uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime15.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: [
1563
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "", children: "Any use" }),
1564
- uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
1640
+ uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime16.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: [
1641
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "", children: "Any use" }),
1642
+ uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
1565
1643
  ] })
1566
1644
  ] }),
1567
- error && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
1568
- /* @__PURE__ */ (0, import_jsx_runtime15.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_runtime15.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1645
+ error && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
1646
+ /* @__PURE__ */ (0, import_jsx_runtime16.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_runtime16.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
1569
1647
  "button",
1570
1648
  {
1571
1649
  type: "button",
@@ -1574,13 +1652,13 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1574
1652
  "data-effect-id": e.id,
1575
1653
  onClick: () => onPick(e),
1576
1654
  children: [
1577
- thumbnails && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(EffectThumbnail, { provider, effect: e }),
1578
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
1579
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
1655
+ thumbnails && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(EffectThumbnail, { provider, effect: e }),
1656
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
1657
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
1580
1658
  ]
1581
1659
  }
1582
1660
  ) }, e.id)) }),
1583
- !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
1661
+ !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
1584
1662
  ] });
1585
1663
  }
1586
1664
 
@@ -1605,7 +1683,7 @@ __export(color_exports, {
1605
1683
  // src/color/ColorPicker.tsx
1606
1684
  var import_react16 = require("react");
1607
1685
  var import_color = require("@pixerate/editor/color");
1608
- var import_jsx_runtime16 = require("react/jsx-runtime");
1686
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1609
1687
  var LOCAL_STORAGE_KEY = "pixerate:color:recent";
1610
1688
  function readLocalRecents() {
1611
1689
  try {
@@ -1812,7 +1890,7 @@ var ColorPicker = ({
1812
1890
  }, [value, contrastAgainst]);
1813
1891
  const currentHex = (0, import_color.pickerStateToHex)(pickerState, alpha);
1814
1892
  const liveDescription = `Selected color: ${value}${contrastResult ? `, contrast ${contrastResult.ratio.toFixed(1)}:1 against ${contrastAgainst}, ${contrastResult.aa ? "passes AA" : "fails AA"}` : ""}`;
1815
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
1893
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
1816
1894
  "div",
1817
1895
  {
1818
1896
  id: pickerId,
@@ -1836,7 +1914,7 @@ var ColorPicker = ({
1836
1914
  pointerEvents: disabled ? "none" : "auto"
1837
1915
  },
1838
1916
  children: [
1839
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1917
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1840
1918
  "span",
1841
1919
  {
1842
1920
  role: "status",
@@ -1855,7 +1933,7 @@ var ColorPicker = ({
1855
1933
  children: liveDescription
1856
1934
  }
1857
1935
  ),
1858
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1936
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1859
1937
  "div",
1860
1938
  {
1861
1939
  role: "slider",
@@ -1877,7 +1955,7 @@ var ColorPicker = ({
1877
1955
  touchAction: "none",
1878
1956
  outline: "none"
1879
1957
  },
1880
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1958
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1881
1959
  "div",
1882
1960
  {
1883
1961
  style: {
@@ -1897,7 +1975,7 @@ var ColorPicker = ({
1897
1975
  )
1898
1976
  }
1899
1977
  ),
1900
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1978
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1901
1979
  "div",
1902
1980
  {
1903
1981
  role: "slider",
@@ -1920,7 +1998,7 @@ var ColorPicker = ({
1920
1998
  touchAction: "none",
1921
1999
  outline: "none"
1922
2000
  },
1923
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2001
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1924
2002
  "div",
1925
2003
  {
1926
2004
  style: {
@@ -1940,7 +2018,7 @@ var ColorPicker = ({
1940
2018
  )
1941
2019
  }
1942
2020
  ),
1943
- alpha && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
2021
+ alpha && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
1944
2022
  "div",
1945
2023
  {
1946
2024
  role: "slider",
@@ -1966,7 +2044,7 @@ var ColorPicker = ({
1966
2044
  overflow: "hidden"
1967
2045
  },
1968
2046
  children: [
1969
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2047
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1970
2048
  "div",
1971
2049
  {
1972
2050
  style: {
@@ -1976,7 +2054,7 @@ var ColorPicker = ({
1976
2054
  }
1977
2055
  }
1978
2056
  ),
1979
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2057
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1980
2058
  "div",
1981
2059
  {
1982
2060
  style: {
@@ -1997,8 +2075,8 @@ var ColorPicker = ({
1997
2075
  ]
1998
2076
  }
1999
2077
  ),
2000
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
2001
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2078
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
2079
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2002
2080
  "div",
2003
2081
  {
2004
2082
  style: {
@@ -2012,7 +2090,7 @@ var ColorPicker = ({
2012
2090
  flexShrink: 0,
2013
2091
  border: "1px solid rgba(255,255,255,0.15)"
2014
2092
  },
2015
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2093
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2016
2094
  "div",
2017
2095
  {
2018
2096
  style: {
@@ -2024,7 +2102,7 @@ var ColorPicker = ({
2024
2102
  )
2025
2103
  }
2026
2104
  ),
2027
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2105
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2028
2106
  "input",
2029
2107
  {
2030
2108
  type: "text",
@@ -2054,7 +2132,7 @@ var ColorPicker = ({
2054
2132
  }
2055
2133
  }
2056
2134
  ),
2057
- hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2135
+ hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2058
2136
  "button",
2059
2137
  {
2060
2138
  type: "button",
@@ -2074,7 +2152,7 @@ var ColorPicker = ({
2074
2152
  color: "inherit",
2075
2153
  cursor: disabled ? "default" : "pointer"
2076
2154
  },
2077
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
2155
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2078
2156
  "svg",
2079
2157
  {
2080
2158
  width: "14",
@@ -2086,16 +2164,16 @@ var ColorPicker = ({
2086
2164
  strokeLinecap: "round",
2087
2165
  strokeLinejoin: "round",
2088
2166
  children: [
2089
- /* @__PURE__ */ (0, import_jsx_runtime16.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" }),
2090
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
2091
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "m14 6 4 4" })
2167
+ /* @__PURE__ */ (0, import_jsx_runtime17.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" }),
2168
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
2169
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "m14 6 4 4" })
2092
2170
  ]
2093
2171
  }
2094
2172
  )
2095
2173
  }
2096
2174
  )
2097
2175
  ] }),
2098
- isClipped && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2176
+ isClipped && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2099
2177
  "div",
2100
2178
  {
2101
2179
  role: "note",
@@ -2111,10 +2189,10 @@ var ColorPicker = ({
2111
2189
  borderRadius: "4px",
2112
2190
  alignSelf: "flex-start"
2113
2191
  },
2114
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
2192
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
2115
2193
  }
2116
2194
  ),
2117
- contrastResult && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
2195
+ contrastResult && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2118
2196
  "div",
2119
2197
  {
2120
2198
  style: {
@@ -2128,15 +2206,15 @@ var ColorPicker = ({
2128
2206
  border: "1px solid rgba(255,255,255,0.1)"
2129
2207
  },
2130
2208
  children: [
2131
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { children: [
2209
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { children: [
2132
2210
  "Contrast: ",
2133
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("strong", { children: [
2211
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("strong", { children: [
2134
2212
  contrastResult.ratio.toFixed(2),
2135
2213
  ":1"
2136
2214
  ] })
2137
2215
  ] }),
2138
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
2139
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
2216
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
2217
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2140
2218
  "span",
2141
2219
  {
2142
2220
  style: {
@@ -2149,7 +2227,7 @@ var ColorPicker = ({
2149
2227
  ]
2150
2228
  }
2151
2229
  ),
2152
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
2230
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2153
2231
  "span",
2154
2232
  {
2155
2233
  style: {
@@ -2166,9 +2244,9 @@ var ColorPicker = ({
2166
2244
  ]
2167
2245
  }
2168
2246
  ),
2169
- swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2170
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
2171
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2247
+ swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2248
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
2249
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2172
2250
  "button",
2173
2251
  {
2174
2252
  type: "button",
@@ -2194,9 +2272,9 @@ var ColorPicker = ({
2194
2272
  `${color}-${idx}`
2195
2273
  )) })
2196
2274
  ] }),
2197
- activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2198
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
2199
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2275
+ activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2276
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
2277
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2200
2278
  "button",
2201
2279
  {
2202
2280
  type: "button",
@@ -2229,7 +2307,7 @@ var ColorPicker = ({
2229
2307
  // src/color/DualColorPicker.tsx
2230
2308
  var import_react17 = require("react");
2231
2309
  var import_color2 = require("@pixerate/editor/color");
2232
- var import_jsx_runtime17 = require("react/jsx-runtime");
2310
+ var import_jsx_runtime18 = require("react/jsx-runtime");
2233
2311
  function DualColorPicker({
2234
2312
  value,
2235
2313
  onChange,
@@ -2288,7 +2366,7 @@ function DualColorPicker({
2288
2366
  const activeColor = activeScheme === "dark" ? dual.dark : dual.light;
2289
2367
  const activeContrastTarget = contrastAgainst ? (0, import_color2.resolveColor)(contrastAgainst, activeScheme) ?? void 0 : void 0;
2290
2368
  const dualContrast = contrastAgainst && (0, import_color2.normalizeDualColor)(contrastAgainst) ? (0, import_color2.checkDualColorContrast)(dual, contrastAgainst) : null;
2291
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2369
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2292
2370
  "div",
2293
2371
  {
2294
2372
  className: `pixerate-dual-color-picker ${className}`,
@@ -2307,7 +2385,7 @@ function DualColorPicker({
2307
2385
  boxSizing: "border-box"
2308
2386
  },
2309
2387
  children: [
2310
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2388
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2311
2389
  "div",
2312
2390
  {
2313
2391
  role: "tablist",
@@ -2320,7 +2398,7 @@ function DualColorPicker({
2320
2398
  gap: "2px"
2321
2399
  },
2322
2400
  children: [
2323
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2401
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2324
2402
  "button",
2325
2403
  {
2326
2404
  type: "button",
@@ -2343,7 +2421,7 @@ function DualColorPicker({
2343
2421
  children: "Light"
2344
2422
  }
2345
2423
  ),
2346
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2424
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2347
2425
  "button",
2348
2426
  {
2349
2427
  type: "button",
@@ -2369,8 +2447,8 @@ function DualColorPicker({
2369
2447
  ]
2370
2448
  }
2371
2449
  ),
2372
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
2373
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2450
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
2451
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2374
2452
  "button",
2375
2453
  {
2376
2454
  type: "button",
@@ -2392,7 +2470,7 @@ function DualColorPicker({
2392
2470
  outline: "none"
2393
2471
  },
2394
2472
  children: [
2395
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2473
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2396
2474
  "span",
2397
2475
  {
2398
2476
  style: {
@@ -2404,11 +2482,11 @@ function DualColorPicker({
2404
2482
  }
2405
2483
  }
2406
2484
  ),
2407
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
2485
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
2408
2486
  ]
2409
2487
  }
2410
2488
  ),
2411
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2489
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2412
2490
  "button",
2413
2491
  {
2414
2492
  type: "button",
@@ -2430,7 +2508,7 @@ function DualColorPicker({
2430
2508
  outline: "none"
2431
2509
  },
2432
2510
  children: [
2433
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2511
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2434
2512
  "span",
2435
2513
  {
2436
2514
  style: {
@@ -2442,12 +2520,12 @@ function DualColorPicker({
2442
2520
  }
2443
2521
  }
2444
2522
  ),
2445
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
2523
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
2446
2524
  ]
2447
2525
  }
2448
2526
  )
2449
2527
  ] }),
2450
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2528
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2451
2529
  "div",
2452
2530
  {
2453
2531
  style: {
@@ -2458,7 +2536,7 @@ function DualColorPicker({
2458
2536
  padding: "2px 0"
2459
2537
  },
2460
2538
  children: [
2461
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2539
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2462
2540
  "label",
2463
2541
  {
2464
2542
  htmlFor: sameId,
@@ -2472,7 +2550,7 @@ function DualColorPicker({
2472
2550
  color: "#c4cad4"
2473
2551
  },
2474
2552
  children: [
2475
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2553
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2476
2554
  "input",
2477
2555
  {
2478
2556
  id: sameId,
@@ -2483,11 +2561,11 @@ function DualColorPicker({
2483
2561
  style: { cursor: disabled ? "not-allowed" : "pointer" }
2484
2562
  }
2485
2563
  ),
2486
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: "Same in both" })
2564
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "Same in both" })
2487
2565
  ]
2488
2566
  }
2489
2567
  ),
2490
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2568
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2491
2569
  "button",
2492
2570
  {
2493
2571
  type: "button",
@@ -2509,7 +2587,7 @@ function DualColorPicker({
2509
2587
  ]
2510
2588
  }
2511
2589
  ),
2512
- dualContrast && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2590
+ dualContrast && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2513
2591
  "div",
2514
2592
  {
2515
2593
  "data-testid": "dual-contrast-summary",
@@ -2523,20 +2601,20 @@ function DualColorPicker({
2523
2601
  color: "#8c95a6"
2524
2602
  },
2525
2603
  children: [
2526
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { children: [
2604
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { children: [
2527
2605
  "Light:",
2528
2606
  " ",
2529
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
2607
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
2530
2608
  dualContrast.light.ratio.toFixed(2),
2531
2609
  " (",
2532
2610
  dualContrast.light.level,
2533
2611
  ")"
2534
2612
  ] })
2535
2613
  ] }),
2536
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { children: [
2614
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { children: [
2537
2615
  "Dark:",
2538
2616
  " ",
2539
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
2617
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
2540
2618
  dualContrast.dark.ratio.toFixed(2),
2541
2619
  " (",
2542
2620
  dualContrast.dark.level,
@@ -2546,7 +2624,7 @@ function DualColorPicker({
2546
2624
  ]
2547
2625
  }
2548
2626
  ),
2549
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2627
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2550
2628
  ColorPicker,
2551
2629
  {
2552
2630
  value: activeColor,
@@ -2634,7 +2712,7 @@ __reExport(color_exports, require("@pixerate/editor/color"));
2634
2712
 
2635
2713
  // src/parameters/controls.tsx
2636
2714
  var import_react19 = require("react");
2637
- var import_jsx_runtime18 = require("react/jsx-runtime");
2715
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2638
2716
  var ParameterComponentsContext = (0, import_react19.createContext)({});
2639
2717
  function useParameterComponents() {
2640
2718
  return (0, import_react19.useContext)(ParameterComponentsContext);
@@ -2649,7 +2727,7 @@ function resolveParameterComponents(explicit, context) {
2649
2727
  }
2650
2728
 
2651
2729
  // src/parameters/fields.tsx
2652
- var import_jsx_runtime19 = require("react/jsx-runtime");
2730
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2653
2731
  var parameterInputStyle = import_parameters.parameterThemeStyles.input;
2654
2732
  var parameterSelectStyle = import_parameters.parameterThemeStyles.select;
2655
2733
  var parameterButtonStyle = import_parameters.parameterThemeStyles.button;
@@ -2704,7 +2782,7 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
2704
2782
  if (typeof forwarded === "function") forwarded(el);
2705
2783
  else if (forwarded) forwarded.current = el;
2706
2784
  };
2707
- return multiline ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("textarea", { ...props, ref: setRef, className: `${props.className} h-auto min-h-[3.5rem] py-1` }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "text", ...props, ref: setRef });
2785
+ return multiline ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("textarea", { ...props, ref: setRef, className: `${props.className} h-auto min-h-[3.5rem] py-1` }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("input", { type: "text", ...props, ref: setRef });
2708
2786
  }
2709
2787
  var plainNumber = (field, value) => (0, import_parameters.formatParameterNumber)({ ...field, unit: void 0 }, value);
2710
2788
  function ParameterNumberInput(props) {
@@ -2738,9 +2816,9 @@ function ParameterNumberInput(props) {
2738
2816
  onCommit: handleCommit,
2739
2817
  onKeyDown: handleKeyDown
2740
2818
  };
2741
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
2742
- CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field) }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ParameterCommitInput, { ...inputProps }),
2743
- field.unit && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
2819
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
2820
+ CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field) }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ParameterCommitInput, { ...inputProps }),
2821
+ field.unit && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
2744
2822
  ] });
2745
2823
  }
2746
2824
  function ParameterSlider(props) {
@@ -2759,7 +2837,7 @@ function ParameterSlider(props) {
2759
2837
  dragging.current = false;
2760
2838
  onGestureEnd?.();
2761
2839
  };
2762
- if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ParameterNumberInput, { ...props });
2840
+ if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ParameterNumberInput, { ...props });
2763
2841
  const step = (0, import_parameters.parameterStep)(field);
2764
2842
  const sliderProps = {
2765
2843
  "aria-label": (0, import_parameters.parameterLabel)(field),
@@ -2773,8 +2851,8 @@ function ParameterSlider(props) {
2773
2851
  className: rangeClass,
2774
2852
  style: parameterRangeStyle
2775
2853
  };
2776
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
2777
- CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2854
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
2855
+ CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2778
2856
  CustomSlider,
2779
2857
  {
2780
2858
  ...sliderProps,
@@ -2784,7 +2862,7 @@ function ParameterSlider(props) {
2784
2862
  onGestureStart: start,
2785
2863
  onGestureEnd: end
2786
2864
  }
2787
- ) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2865
+ ) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2788
2866
  "input",
2789
2867
  {
2790
2868
  type: "range",
@@ -2796,11 +2874,11 @@ function ParameterSlider(props) {
2796
2874
  onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field, Number(e.target.value)))
2797
2875
  }
2798
2876
  ),
2799
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
2877
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
2800
2878
  ] });
2801
2879
  }
2802
2880
  function ParameterToggle({ field, value, onChange, disabled, id }) {
2803
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2881
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2804
2882
  "button",
2805
2883
  {
2806
2884
  type: "button",
@@ -2811,7 +2889,7 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
2811
2889
  disabled: disabled || field.readOnly,
2812
2890
  onClick: () => onChange(!value),
2813
2891
  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"}`,
2814
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2892
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2815
2893
  "span",
2816
2894
  {
2817
2895
  className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
@@ -2828,7 +2906,7 @@ function ParameterSelect(props) {
2828
2906
  const options = (0, import_parameters.getChoiceOptions)(field);
2829
2907
  const off = disabled || field.readOnly;
2830
2908
  if (field.control === "segmented") {
2831
- return /* @__PURE__ */ (0, import_jsx_runtime19.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_runtime19.jsx)(
2909
+ return /* @__PURE__ */ (0, import_jsx_runtime20.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_runtime20.jsx)(
2832
2910
  "button",
2833
2911
  {
2834
2912
  type: "button",
@@ -2845,7 +2923,7 @@ function ParameterSelect(props) {
2845
2923
  }
2846
2924
  if (CustomSelect) {
2847
2925
  const customOptions = options.map((o) => ({ value: o.value, label: (0, import_parameters.choiceOptionLabel)(o), description: o.description }));
2848
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2926
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2849
2927
  CustomSelect,
2850
2928
  {
2851
2929
  id,
@@ -2861,7 +2939,7 @@ function ParameterSelect(props) {
2861
2939
  );
2862
2940
  }
2863
2941
  const index = options.findIndex((o) => o.value === value);
2864
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2942
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2865
2943
  "select",
2866
2944
  {
2867
2945
  id,
@@ -2874,7 +2952,7 @@ function ParameterSelect(props) {
2874
2952
  },
2875
2953
  className: parameterInputClass,
2876
2954
  style: parameterSelectStyle,
2877
- children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: String(i), title: o.description, style: parameterSelectStyle, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
2955
+ children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: String(i), title: o.description, style: parameterSelectStyle, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
2878
2956
  }
2879
2957
  );
2880
2958
  }
@@ -2912,7 +2990,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
2912
2990
  };
2913
2991
  }, [open]);
2914
2992
  if (CustomColor) {
2915
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2993
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2916
2994
  CustomColor,
2917
2995
  {
2918
2996
  id,
@@ -2927,9 +3005,9 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
2927
3005
  }
2928
3006
  );
2929
3007
  }
2930
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
2931
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
2932
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3008
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
3009
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
3010
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2933
3011
  "button",
2934
3012
  {
2935
3013
  ref: buttonRef,
@@ -2940,10 +3018,10 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
2940
3018
  disabled: off,
2941
3019
  onClick: () => setOpen((prev) => !prev),
2942
3020
  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",
2943
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
3021
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
2944
3022
  }
2945
3023
  ),
2946
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3024
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2947
3025
  ParameterCommitInput,
2948
3026
  {
2949
3027
  id,
@@ -2959,7 +3037,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
2959
3037
  }
2960
3038
  )
2961
3039
  ] }),
2962
- open && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3040
+ open && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2963
3041
  "div",
2964
3042
  {
2965
3043
  ref: popoverRef,
@@ -2973,7 +3051,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
2973
3051
  },
2974
3052
  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",
2975
3053
  style: { background: "var(--popover, var(--background, #fff))" },
2976
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3054
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2977
3055
  ColorPicker,
2978
3056
  {
2979
3057
  value: shown,
@@ -2991,11 +3069,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
2991
3069
  }
2992
3070
  function ParameterVector({ field, value, onChange, disabled, id, components }) {
2993
3071
  const size = (0, import_parameters.vectorSize)(field);
2994
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
3072
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
2995
3073
  const component = (0, import_parameters.vectorComponentField)(field, i);
2996
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
2997
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
2998
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3074
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
3075
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
3076
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2999
3077
  ParameterNumberInput,
3000
3078
  {
3001
3079
  field: component,
@@ -3013,11 +3091,11 @@ function ParameterVector({ field, value, onChange, disabled, id, components }) {
3013
3091
  function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3014
3092
  const off = disabled || field.readOnly;
3015
3093
  const name = (0, import_parameters.parameterLabel)(field);
3016
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1.5", children: [
3017
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
3018
- /* @__PURE__ */ (0, import_jsx_runtime19.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_runtime19.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
3019
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
3020
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3094
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1.5", children: [
3095
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
3096
+ /* @__PURE__ */ (0, import_jsx_runtime20.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_runtime20.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
3097
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
3098
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3021
3099
  ParameterCommitInput,
3022
3100
  {
3023
3101
  id,
@@ -3028,15 +3106,15 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3028
3106
  onCommit: (text) => onChange(text.trim())
3029
3107
  }
3030
3108
  ),
3031
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex gap-1", children: [
3032
- resolveFile && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
3109
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex gap-1", children: [
3110
+ resolveFile && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
3033
3111
  "label",
3034
3112
  {
3035
3113
  style: parameterButtonStyle,
3036
3114
  className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`,
3037
3115
  children: [
3038
3116
  "Choose file\u2026",
3039
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3117
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3040
3118
  "input",
3041
3119
  {
3042
3120
  type: "file",
@@ -3054,7 +3132,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3054
3132
  ]
3055
3133
  }
3056
3134
  ),
3057
- value && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3135
+ value && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3058
3136
  "button",
3059
3137
  {
3060
3138
  type: "button",
@@ -3069,7 +3147,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3069
3147
  ] })
3070
3148
  ] })
3071
3149
  ] }),
3072
- field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3150
+ field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3073
3151
  "button",
3074
3152
  {
3075
3153
  type: "button",
@@ -3079,14 +3157,14 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3079
3157
  disabled: off,
3080
3158
  onClick: () => onChange(o.url),
3081
3159
  className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
3082
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
3160
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
3083
3161
  },
3084
3162
  o.url
3085
3163
  )) })
3086
3164
  ] });
3087
3165
  }
3088
3166
  function ParameterText({ field, value, onChange, disabled, id }) {
3089
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3167
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3090
3168
  ParameterCommitInput,
3091
3169
  {
3092
3170
  id,
@@ -3105,24 +3183,24 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
3105
3183
  switch (field.type) {
3106
3184
  case "number":
3107
3185
  case "int":
3108
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
3186
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
3109
3187
  case "boolean":
3110
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
3188
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
3111
3189
  case "choice":
3112
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
3190
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
3113
3191
  case "color":
3114
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
3192
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
3115
3193
  case "vector":
3116
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
3194
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
3117
3195
  case "image":
3118
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
3196
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
3119
3197
  case "text":
3120
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ParameterText, { field, value, onChange: set, ...rest });
3198
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ParameterText, { field, value, onChange: set, ...rest });
3121
3199
  }
3122
3200
  }
3123
3201
 
3124
3202
  // src/effects/EffectParameters.tsx
3125
- var import_jsx_runtime20 = require("react/jsx-runtime");
3203
+ var import_jsx_runtime21 = require("react/jsx-runtime");
3126
3204
  function EffectParameters({
3127
3205
  description,
3128
3206
  values,
@@ -3151,8 +3229,8 @@ function EffectParameters({
3151
3229
  if (preset) onPreset({ ...description.defaults, ...preset.values });
3152
3230
  }
3153
3231
  };
3154
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
3155
- (onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3232
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
3233
+ (onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3156
3234
  CustomPresetSelect,
3157
3235
  {
3158
3236
  "aria-label": `${description.name} presets`,
@@ -3167,7 +3245,7 @@ function EffectParameters({
3167
3245
  ],
3168
3246
  onChange: (name) => handlePresetSelect(String(name))
3169
3247
  }
3170
- ) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
3248
+ ) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3171
3249
  "select",
3172
3250
  {
3173
3251
  className: "w-full rounded border border-border px-1 py-0.5 text-xs",
@@ -3177,8 +3255,8 @@ function EffectParameters({
3177
3255
  disabled,
3178
3256
  onChange: (e) => handlePresetSelect(e.currentTarget.value),
3179
3257
  children: [
3180
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
3181
- description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
3258
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
3259
+ description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
3182
3260
  ]
3183
3261
  }
3184
3262
  )),
@@ -3188,14 +3266,14 @@ function EffectParameters({
3188
3266
  const keyed = keyframed?.has(field.id) ?? false;
3189
3267
  const value = (0, import_effects3.effectFieldValue)(field, values[field.id]);
3190
3268
  const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field.default);
3191
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
3192
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1.5", children: [
3193
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
3194
- keyed && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
3269
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
3270
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5", children: [
3271
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
3272
+ keyed && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
3195
3273
  renderControlAddon?.(field.id),
3196
- onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime20.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" })
3274
+ onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime21.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" })
3197
3275
  ] }),
3198
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3276
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3199
3277
  ParameterFieldControl,
3200
3278
  {
3201
3279
  field,
@@ -3210,12 +3288,12 @@ function EffectParameters({
3210
3288
  )
3211
3289
  ] }, field.id);
3212
3290
  }),
3213
- !fields.length && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
3291
+ !fields.length && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
3214
3292
  ] });
3215
3293
  }
3216
3294
 
3217
3295
  // src/paint-editor/PaintEffectsPanel.tsx
3218
- var import_jsx_runtime21 = require("react/jsx-runtime");
3296
+ var import_jsx_runtime22 = require("react/jsx-runtime");
3219
3297
  function usePaintEffectsProvider(controller) {
3220
3298
  const [provider, setProvider] = (0, import_react22.useState)(controller.effectsProvider);
3221
3299
  (0, import_react22.useEffect)(() => {
@@ -3228,25 +3306,25 @@ function usePaintEffectsTools(registry, controller, options = {}) {
3228
3306
  const { id, namespace, readOnly, playbackSurface } = options;
3229
3307
  (0, import_react22.useEffect)(() => {
3230
3308
  if (!registry) return;
3231
- return registry.register((0, import_paint_editor13.createPaintEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
3309
+ return registry.register((0, import_paint_editor14.createPaintEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
3232
3310
  }, [registry, controller, id, namespace, readOnly, playbackSurface]);
3233
3311
  }
3234
3312
  function Controls({ provider, effect, name, values, apply }) {
3235
3313
  const { description, error } = useEffectDescription(provider, effect);
3236
3314
  const drags = (0, import_react22.useRef)(/* @__PURE__ */ new Set());
3237
- if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
3315
+ if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
3238
3316
  'No effects provider: "',
3239
3317
  name ?? effect,
3240
3318
  '" is kept as it was drawn.'
3241
3319
  ] });
3242
- if (error) return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
3243
- if (!description) return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
3320
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
3321
+ if (!description) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
3244
3322
  const commit = (gesture) => {
3245
3323
  if (!gesture || drags.current.has(gesture)) return !gesture;
3246
3324
  drags.current.add(gesture);
3247
3325
  return true;
3248
3326
  };
3249
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3327
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3250
3328
  EffectParameters,
3251
3329
  {
3252
3330
  description,
@@ -3291,28 +3369,28 @@ var PaintEffectsPanel = ({ controller, className }) => {
3291
3369
  };
3292
3370
  const toggle = (b) => setBrowse(browse === b ? null : b);
3293
3371
  const pixel = active?.type === "pixel";
3294
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
3295
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
3296
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
3297
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
3298
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
3299
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
3300
- /* @__PURE__ */ (0, import_jsx_runtime21.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" }),
3301
- /* @__PURE__ */ (0, import_jsx_runtime21.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" })
3372
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
3373
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
3374
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
3375
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
3376
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
3377
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
3378
+ /* @__PURE__ */ (0, import_jsx_runtime22.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" }),
3379
+ /* @__PURE__ */ (0, import_jsx_runtime22.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" })
3302
3380
  ] }),
3303
- !provider && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
3304
- browse && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
3305
- paper && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
3306
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1", children: [
3307
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "flex-1 truncate", children: [
3381
+ !provider && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
3382
+ browse && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
3383
+ paper && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
3384
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1", children: [
3385
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "flex-1 truncate", children: [
3308
3386
  "Paper: ",
3309
3387
  paper.name ?? paper.effect
3310
3388
  ] }),
3311
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
3389
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
3312
3390
  ] }),
3313
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
3314
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
3315
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3391
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", children: [
3392
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
3393
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3316
3394
  "input",
3317
3395
  {
3318
3396
  type: "range",
@@ -3334,43 +3412,43 @@ var PaintEffectsPanel = ({ controller, className }) => {
3334
3412
  `o${paper.opacity}`
3335
3413
  )
3336
3414
  ] }),
3337
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
3338
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
3339
- /* @__PURE__ */ (0, import_jsx_runtime21.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) => {
3415
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", children: [
3416
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
3417
+ /* @__PURE__ */ (0, import_jsx_runtime22.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) => {
3340
3418
  const blend = e.currentTarget.value;
3341
3419
  run(() => controller.updatePaperEffect({ blend }));
3342
- }, children: import_paint_editor13.PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: b, children: b }, b)) })
3420
+ }, children: import_paint_editor14.PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: b, children: b }, b)) })
3343
3421
  ] }),
3344
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
3422
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
3345
3423
  ] }),
3346
- effectPaint && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paint", children: [
3347
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1", children: [
3348
- thumbnail ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("img", { src: thumbnail, alt: "", className: "h-5 w-8 rounded object-cover ring-1 ring-slate-700", "data-testid": "effect-paint-thumbnail" }) : null,
3349
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "flex-1 truncate", children: [
3424
+ effectPaint && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paint", children: [
3425
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1", children: [
3426
+ thumbnail ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("img", { src: thumbnail, alt: "", className: "h-5 w-8 rounded object-cover ring-1 ring-slate-700", "data-testid": "effect-paint-thumbnail" }) : null,
3427
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "flex-1 truncate", children: [
3350
3428
  "Paint: ",
3351
3429
  effectPaint.effect,
3352
3430
  state.effectPaintRendering ? " (rendering\u2026)" : ""
3353
3431
  ] }),
3354
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
3432
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
3355
3433
  ] }),
3356
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => run(() => controller.setEffectPaint({ effect: effectPaint.effect, values: { ...effectPaint.values, ...values }, time: effectPaint.time })) })
3434
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => run(() => controller.setEffectPaint({ effect: effectPaint.effect, values: { ...effectPaint.values, ...values }, time: effectPaint.time })) })
3357
3435
  ] }),
3358
- layerEffect && activeId && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "layer", children: [
3359
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1", children: [
3360
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "flex-1 truncate", children: [
3436
+ layerEffect && activeId && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "layer", children: [
3437
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1", children: [
3438
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "flex-1 truncate", children: [
3361
3439
  "Layer: ",
3362
3440
  layerEffect.name ?? layerEffect.effect
3363
3441
  ] }),
3364
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
3442
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
3365
3443
  ] }),
3366
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
3444
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
3367
3445
  ] }),
3368
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ErrorLine, { error })
3446
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ErrorLine, { error })
3369
3447
  ] });
3370
3448
  };
3371
3449
 
3372
3450
  // src/paint-editor/PaintEditor.tsx
3373
- var import_jsx_runtime22 = require("react/jsx-runtime");
3451
+ var import_jsx_runtime23 = require("react/jsx-runtime");
3374
3452
  var PAINT_CONTROLS = {
3375
3453
  "mixing-pad": '[data-testid="mixing-pad"]',
3376
3454
  lighting: '[data-testid="light-panel"]',
@@ -3382,7 +3460,7 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, className, pl
3382
3460
  const tabRef = (0, import_react23.useRef)(tab);
3383
3461
  tabRef.current = tab;
3384
3462
  const rootRef = (0, import_react23.useRef)(null);
3385
- const [ownPresence] = (0, import_react23.useState)(() => new import_paint_editor14.PaintPresence());
3463
+ const [ownPresence] = (0, import_react23.useState)(() => new import_paint_editor15.PaintPresence());
3386
3464
  const ambientPlayback = useAgentPlayback();
3387
3465
  const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
3388
3466
  const viewBox = () => {
@@ -3393,12 +3471,12 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, className, pl
3393
3471
  const docToClient = (p) => {
3394
3472
  const r = viewBox();
3395
3473
  if (!r) return null;
3396
- const q = (0, import_paint_editor14.documentToScreen)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x, p.y);
3474
+ const q = (0, import_paint_editor15.documentToScreen)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x, p.y);
3397
3475
  return { x: r.left + q.x, y: r.top + q.y };
3398
3476
  };
3399
3477
  const clientToDoc = (p) => {
3400
3478
  const r = viewBox();
3401
- return r ? (0, import_paint_editor14.screenToDocument)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x - r.left, p.y - r.top) : null;
3479
+ 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;
3402
3480
  };
3403
3481
  const elementRect = (selector) => {
3404
3482
  const r = rootRef.current?.querySelector(selector)?.getBoundingClientRect();
@@ -3441,24 +3519,25 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, className, pl
3441
3519
  const [error, setError] = (0, import_react23.useState)(null);
3442
3520
  const effects = usePaintEffectsProvider(controller);
3443
3521
  const tabs = effects ? ["color", "wet", "paper", "layers", "effects"] : ["color", "wet", "paper", "layers"];
3444
- return /* @__PURE__ */ (0, import_jsx_runtime22.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: [
3445
- playing && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
3446
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PaintToolbar, { controller, tool, onToolChange: setTool, fileName }),
3447
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex min-h-0 flex-1 gap-2", children: [
3448
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
3449
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
3450
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PaintCanvas, { controller, tool, onError: setError, presence: playing ? void 0 : presence, className: "flex-1 rounded-lg" }),
3451
- error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
3522
+ return /* @__PURE__ */ (0, import_jsx_runtime23.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: [
3523
+ playing && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
3524
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PaintToolbar, { controller, tool, onToolChange: setTool, fileName }),
3525
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex min-h-0 flex-1 gap-2", children: [
3526
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
3527
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
3528
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PaintCanvas, { controller, tool, onError: setError, presence: playing ? void 0 : presence, className: "flex-1 rounded-lg" }),
3529
+ error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
3452
3530
  ] }),
3453
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
3454
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex gap-1", role: "tablist", "aria-label": "Paint panels", children: tabs.map((t) => /* @__PURE__ */ (0, import_jsx_runtime22.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)) }),
3455
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
3456
- tab === "color" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ColorPanel, { controller }),
3457
- tab === "wet" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(WetPanel, { controller }),
3458
- tab === "paper" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PaperPanel, { controller }),
3459
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PaintLayersPanel, { controller }),
3460
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StickerPanel, { controller }),
3461
- tab === "effects" && effects && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PaintEffectsPanel, { controller })
3531
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
3532
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex gap-1", role: "tablist", "aria-label": "Paint panels", children: tabs.map((t) => /* @__PURE__ */ (0, import_jsx_runtime23.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)) }),
3533
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
3534
+ tab === "color" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ColorPanel, { controller }),
3535
+ tab === "wet" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(WetPanel, { controller }),
3536
+ tab === "paper" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PaperPanel, { controller }),
3537
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PaintLayersPanel, { controller }),
3538
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(StrokePanel, { controller }),
3539
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(StickerPanel, { controller }),
3540
+ tab === "effects" && effects && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PaintEffectsPanel, { controller })
3462
3541
  ] })
3463
3542
  ] })
3464
3543
  ] })
@@ -3478,6 +3557,7 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, className, pl
3478
3557
  PaintToolbar,
3479
3558
  PaperPanel,
3480
3559
  StickerPanel,
3560
+ StrokePanel,
3481
3561
  WetPanel,
3482
3562
  usePaintDirector,
3483
3563
  usePaintEditor,