@pixerate/editor-react 0.195.0 → 0.197.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.
@@ -51,6 +51,7 @@ __export(paint_editor_exports, {
51
51
  StickerPanel: () => StickerPanel,
52
52
  StickerPicker: () => StickerPicker,
53
53
  StrokePanel: () => StrokePanel,
54
+ TimeMachinePanel: () => TimeMachinePanel,
54
55
  WetPanel: () => WetPanel,
55
56
  useMutationRequests: () => useMutationRequests,
56
57
  usePaintChangeFeed: () => usePaintChangeFeed,
@@ -269,10 +270,10 @@ var PaintCanvas = ({ controller, tool = "brush", fillOptions, showGuides = true,
269
270
  y1: l.from.y,
270
271
  x2: l.to.x,
271
272
  y2: l.to.y,
272
- stroke: l.kind === "symmetry" ? "#22d3ee" : l.kind === "stencil" ? "#fbbf24" : l.kind === "stroke" || l.kind === "sticker" ? "#818cf8" : "#f472b6",
273
- strokeOpacity: l.kind === "symmetry" || l.kind === "stencil" || l.kind === "stroke" || l.kind === "sticker" ? 0.8 : 0.35,
274
- strokeWidth: 1 / state.view.zoom,
275
- strokeDasharray: l.kind === "symmetry" ? `${6 / state.view.zoom} ${4 / state.view.zoom}` : void 0
273
+ stroke: l.kind === "symmetry" ? "#22d3ee" : l.kind === "stencil" ? "#fbbf24" : l.kind === "stroke" || l.kind === "sticker" ? "#818cf8" : l.kind === "vortex" || l.kind === "vortex-reach" ? "#38bdf8" : "#f472b6",
274
+ strokeOpacity: l.kind === "vortex" ? 0.9 : l.kind === "symmetry" || l.kind === "stencil" || l.kind === "stroke" || l.kind === "sticker" ? 0.8 : l.kind === "vortex-reach" ? 0.45 : 0.35,
275
+ strokeWidth: (l.kind === "vortex" ? 1.5 : 1) / state.view.zoom,
276
+ strokeDasharray: l.kind === "symmetry" ? `${6 / state.view.zoom} ${4 / state.view.zoom}` : l.kind === "vortex-reach" ? `${4 / state.view.zoom} ${4 / state.view.zoom}` : void 0
276
277
  },
277
278
  i
278
279
  )),
@@ -1298,7 +1299,7 @@ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, clas
1298
1299
 
1299
1300
  // src/paint-editor/PaperPanel.tsx
1300
1301
  var import_react12 = require("react");
1301
- var import_paint_editor7 = require("@pixerate/editor/paint-editor");
1302
+ var import_paint_editor8 = require("@pixerate/editor/paint-editor");
1302
1303
 
1303
1304
  // src/paint-editor/FerroPanel.tsx
1304
1305
  var import_react11 = require("react");
@@ -1362,20 +1363,90 @@ var FerroPanel = ({ controller, className }) => {
1362
1363
  ] });
1363
1364
  };
1364
1365
 
1365
- // src/paint-editor/PaperPanel.tsx
1366
+ // src/paint-editor/TimeMachinePanel.tsx
1367
+ var import_paint_editor7 = require("@pixerate/editor/paint-editor");
1366
1368
  var import_jsx_runtime12 = require("react/jsx-runtime");
1369
+ var TimeMachinePanel = ({ controller, className }) => {
1370
+ const state = usePaintEditorState(controller);
1371
+ const [error, attempt] = useAttempt();
1372
+ const age = state.age;
1373
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "time-machine-panel", children: [
1374
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center justify-between gap-1", children: [
1375
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "font-medium text-slate-300", children: "Time machine (ageing & X-ray)" }),
1376
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1377
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1378
+ "button",
1379
+ {
1380
+ type: "button",
1381
+ className: chip(age.years === 300),
1382
+ onClick: () => attempt(() => controller.setAge({ years: 300 })),
1383
+ children: "Age 300 yr"
1384
+ }
1385
+ ),
1386
+ age.years > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.setAge({ years: 0 })), children: "Fresh" })
1387
+ ] })
1388
+ ] }),
1389
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center gap-2", children: [
1390
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1391
+ "input",
1392
+ {
1393
+ type: "checkbox",
1394
+ checked: state.xrayView,
1395
+ onChange: (e) => attempt(() => controller.setXrayView(e.target.checked))
1396
+ }
1397
+ ),
1398
+ " ",
1399
+ "X-ray view (pentimento)"
1400
+ ] }),
1401
+ import_paint_editor7.AGE_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1402
+ PaintSlider,
1403
+ {
1404
+ control: c,
1405
+ value: (0, import_paint_editor7.readPath)(age, c.path),
1406
+ onChange: (v) => attempt(() => controller.setAge({ [c.path]: v }))
1407
+ },
1408
+ c.path
1409
+ )),
1410
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", children: [
1411
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1412
+ "button",
1413
+ {
1414
+ type: "button",
1415
+ className: button,
1416
+ disabled: age.years <= 0,
1417
+ onClick: () => attempt(() => controller.bakeAge()),
1418
+ children: "Bake age"
1419
+ }
1420
+ ),
1421
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.setAge({ seed: age.seed + 1 })), children: "New crack seed" }),
1422
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1423
+ "button",
1424
+ {
1425
+ type: "button",
1426
+ className: chip(state.brush.id === "paint-scraper"),
1427
+ onClick: () => attempt(() => controller.setBrush({ id: "paint-scraper" })),
1428
+ children: "Scraper brush"
1429
+ }
1430
+ )
1431
+ ] }),
1432
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ErrorLine, { error })
1433
+ ] });
1434
+ };
1435
+
1436
+ // src/paint-editor/PaperPanel.tsx
1437
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1367
1438
  var SWATCH = { x: 0, y: 0, width: 64, height: 40 };
1368
1439
  var PaperPanel = ({ controller, className }) => {
1369
1440
  const state = usePaintEditorState(controller);
1370
1441
  const [error, attempt] = useAttempt();
1371
1442
  const [tiltFollow, setTiltFollow] = (0, import_react12.useState)(false);
1372
- (0, import_react12.useEffect)(() => tiltFollow ? (0, import_paint_editor7.startDeviceTilt)(controller) : void 0, [controller, tiltFollow]);
1443
+ (0, import_react12.useEffect)(() => tiltFollow ? (0, import_paint_editor8.startDeviceTilt)(controller) : void 0, [controller, tiltFollow]);
1373
1444
  const paper = state.document.paper;
1374
- const previews = (0, import_react12.useMemo)(() => new Map(import_paint_editor7.PAPER_LIBRARY.map((p) => [p.preset, { ...SWATCH, data: (0, import_paint_editor7.renderPaper)({ ...p, shading: Math.max(0.8, p.shading) }, SWATCH) }])), []);
1375
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paper-panel", children: [
1376
- import_paint_editor7.PAPER_FAMILIES.map((family) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
1377
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "mb-0.5 text-[10px] uppercase tracking-wide text-slate-500", children: family }),
1378
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": `${family} papers`, children: import_paint_editor7.PAPER_LIBRARY.filter((p) => p.family === family).map((p) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1445
+ const previews = (0, import_react12.useMemo)(() => new Map(import_paint_editor8.PAPER_LIBRARY.map((p) => [p.preset, { ...SWATCH, data: (0, import_paint_editor8.renderPaper)({ ...p, shading: Math.max(0.8, p.shading) }, SWATCH) }])), []);
1446
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paper-panel", children: [
1447
+ import_paint_editor8.PAPER_FAMILIES.map((family) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { children: [
1448
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "mb-0.5 text-[10px] uppercase tracking-wide text-slate-500", children: family }),
1449
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": `${family} papers`, children: import_paint_editor8.PAPER_LIBRARY.filter((p) => p.family === family).map((p) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1379
1450
  "button",
1380
1451
  {
1381
1452
  type: "button",
@@ -1384,73 +1455,74 @@ var PaperPanel = ({ controller, className }) => {
1384
1455
  title: p.name,
1385
1456
  className: `rounded p-0.5 ${paper.preset === p.preset ? "ring-2 ring-indigo-500" : "ring-1 ring-slate-700 hover:ring-slate-500"}`,
1386
1457
  onClick: () => attempt(() => controller.setPaper({ preset: p.preset })),
1387
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PixelCanvas, { pixels: previews.get(p.preset) ?? null, label: p.name, style: { width: 48, height: 30 } })
1458
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PixelCanvas, { pixels: previews.get(p.preset) ?? null, label: p.name, style: { width: 48, height: 30 } })
1388
1459
  },
1389
1460
  p.preset
1390
1461
  )) })
1391
1462
  ] }, family)),
1392
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "text-slate-300", children: paper.name }),
1393
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center justify-between", children: [
1394
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-slate-400", children: "Colour" }),
1395
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CommitColorInput, { label: "Paper colour", value: paper.color, onCommit: (v) => attempt(() => controller.setPaper({ color: v })), className: "h-6 w-10 rounded bg-transparent" })
1463
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "text-slate-300", children: paper.name }),
1464
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center justify-between", children: [
1465
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-slate-400", children: "Colour" }),
1466
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CommitColorInput, { label: "Paper colour", value: paper.color, onCommit: (v) => attempt(() => controller.setPaper({ color: v })), className: "h-6 w-10 rounded bg-transparent" })
1396
1467
  ] }),
1397
- import_paint_editor7.PAPER_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor7.readPath)(paper, c.path), onCommit: (v) => attempt(() => controller.setPaper((0, import_paint_editor7.patchPath)(paper, c.path, v))) }, c.path)),
1398
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center justify-between", children: [
1399
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-slate-400", children: "Backlight colour" }),
1400
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CommitColorInput, { label: "Backlight colour", value: paper.backlightColor ?? import_paint_editor7.DEFAULT_BACKLIGHT_COLOR, onCommit: (v) => attempt(() => controller.setPaper({ backlightColor: v })), className: "h-6 w-10 rounded bg-transparent" })
1468
+ import_paint_editor8.PAPER_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor8.readPath)(paper, c.path), onCommit: (v) => attempt(() => controller.setPaper((0, import_paint_editor8.patchPath)(paper, c.path, v))) }, c.path)),
1469
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center justify-between", children: [
1470
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-slate-400", children: "Backlight colour" }),
1471
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CommitColorInput, { label: "Backlight colour", value: paper.backlightColor ?? import_paint_editor8.DEFAULT_BACKLIGHT_COLOR, onCommit: (v) => attempt(() => controller.setPaper({ backlightColor: v })), className: "h-6 w-10 rounded bg-transparent" })
1401
1472
  ] }),
1402
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center gap-2", children: [
1403
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { type: "checkbox", checked: paper.tiling === "mirror", onChange: (e) => attempt(() => controller.setPaper({ tiling: e.target.checked ? "mirror" : "repeat" })) }),
1473
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center gap-2", children: [
1474
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "checkbox", checked: paper.tiling === "mirror", onChange: (e) => attempt(() => controller.setPaper({ tiling: e.target.checked ? "mirror" : "repeat" })) }),
1404
1475
  " Mirror tiling"
1405
1476
  ] }),
1406
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: "self-start px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.setPaper({ seed: paper.seed + 1 })), children: "New sheet" }),
1407
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "light-panel", children: [
1408
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "font-medium text-slate-300", children: "Light (thick paint, iridescence, metallic paper)" }),
1409
- import_paint_editor7.LIGHT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor7.readPath)(controller.getLighting(), c.path), onChange: (v) => attempt(() => controller.setLighting({ [c.path]: v })) }, c.path)),
1410
- import_paint_editor7.VIEW_TILT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor7.readPath)(state.viewTilt, c.path), onChange: (v) => attempt(() => controller.setViewTilt({ [c.path]: v })) }, c.path)),
1411
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1412
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1477
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "self-start px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.setPaper({ seed: paper.seed + 1 })), children: "New sheet" }),
1478
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "light-panel", children: [
1479
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "font-medium text-slate-300", children: "Light (thick paint, iridescence, metallic paper)" }),
1480
+ import_paint_editor8.LIGHT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor8.readPath)(controller.getLighting(), c.path), onChange: (v) => attempt(() => controller.setLighting({ [c.path]: v })) }, c.path)),
1481
+ import_paint_editor8.VIEW_TILT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor8.readPath)(state.viewTilt, c.path), onChange: (v) => attempt(() => controller.setViewTilt({ [c.path]: v })) }, c.path)),
1482
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1483
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1413
1484
  "button",
1414
1485
  {
1415
1486
  type: "button",
1416
1487
  "aria-pressed": tiltFollow,
1417
1488
  className: chip(tiltFollow),
1418
1489
  onClick: () => attempt(async () => {
1419
- if (!tiltFollow && !await (0, import_paint_editor7.requestDeviceTiltPermission)()) return;
1490
+ if (!tiltFollow && !await (0, import_paint_editor8.requestDeviceTiltPermission)()) return;
1420
1491
  setTiltFollow((v) => !v);
1421
1492
  }),
1422
1493
  children: "Device tilt"
1423
1494
  }
1424
1495
  ),
1425
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: "self-start px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.flattenRelief()), children: "Flatten relief" })
1496
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "self-start px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.flattenRelief()), children: "Flatten relief" })
1426
1497
  ] })
1427
1498
  ] }),
1428
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "uv-heat-panel", children: [
1429
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "font-medium text-slate-300", children: "UV blacklight & heat" }),
1430
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center gap-2", children: [
1431
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { type: "checkbox", checked: state.uvLight.on, onChange: (e) => attempt(() => controller.setUvLight({ on: e.target.checked })) }),
1499
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "uv-heat-panel", children: [
1500
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "font-medium text-slate-300", children: "UV blacklight & heat" }),
1501
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center gap-2", children: [
1502
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "checkbox", checked: state.uvLight.on, onChange: (e) => attempt(() => controller.setUvLight({ on: e.target.checked })) }),
1432
1503
  " UV blacklight"
1433
1504
  ] }),
1434
- import_paint_editor7.UV_LIGHT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor7.readPath)(state.uvLight, c.path), onChange: (v) => attempt(() => controller.setUvLight({ [c.path]: v })) }, c.path)),
1435
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1.5", children: [
1436
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.advanceHeat(10)), children: "Step heat" }),
1437
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.clearHeat()), children: "Cool canvas" }),
1438
- state.heat.hotCells > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "text-[11px] text-amber-400", children: [
1505
+ import_paint_editor8.UV_LIGHT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor8.readPath)(state.uvLight, c.path), onChange: (v) => attempt(() => controller.setUvLight({ [c.path]: v })) }, c.path)),
1506
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1.5", children: [
1507
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.advanceHeat(10)), children: "Step heat" }),
1508
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.clearHeat()), children: "Cool canvas" }),
1509
+ state.heat.hotCells > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "text-[11px] text-amber-400", children: [
1439
1510
  Math.round(state.heat.max * 100),
1440
1511
  "% warm"
1441
1512
  ] })
1442
1513
  ] })
1443
1514
  ] }),
1444
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FerroPanel, { controller }),
1445
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ErrorLine, { error })
1515
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(FerroPanel, { controller }),
1516
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TimeMachinePanel, { controller }),
1517
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ErrorLine, { error })
1446
1518
  ] });
1447
1519
  };
1448
1520
 
1449
1521
  // src/paint-editor/ColorPanel.tsx
1450
1522
  var import_react13 = require("react");
1451
- var import_paint_editor8 = require("@pixerate/editor/paint-editor");
1452
1523
  var import_paint_editor9 = require("@pixerate/editor/paint-editor");
1453
- var import_jsx_runtime13 = require("react/jsx-runtime");
1524
+ var import_paint_editor10 = require("@pixerate/editor/paint-editor");
1525
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1454
1526
  var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className }) => {
1455
1527
  const state = usePaintEditorState(controller);
1456
1528
  const [error, attempt] = useAttempt();
@@ -1461,54 +1533,54 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1461
1533
  const [parts, setParts] = (0, import_react13.useState)([1, 1]);
1462
1534
  const [padName, setPadName] = (0, import_react13.useState)("");
1463
1535
  const padPoints = (0, import_react13.useRef)(null);
1464
- const ring = (0, import_react13.useMemo)(() => (0, import_paint_editor8.renderColorWheel)(wheelSize, wheel), [wheelSize, wheel]);
1536
+ const ring = (0, import_react13.useMemo)(() => (0, import_paint_editor9.renderColorWheel)(wheelSize, wheel), [wheelSize, wheel]);
1465
1537
  const color = state.color;
1466
1538
  const harmony = (0, import_react13.useMemo)(() => controller.harmony(kind, { color, wheel }), [controller, kind, color, wheel]);
1467
- const [r, g, b] = (0, import_paint_editor8.parseHexColor)(color);
1468
- const hsv = (0, import_paint_editor8.rgbToHsv)(r, g, b);
1539
+ const [r, g, b] = (0, import_paint_editor9.parseHexColor)(color);
1540
+ const hsv = (0, import_paint_editor9.rgbToHsv)(r, g, b);
1469
1541
  const effectWell = (0, import_react13.useMemo)(() => state.effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(64) : null, [controller, state.effectPaint, state.effectPaintRendering]);
1470
- const pad = (0, import_react13.useMemo)(() => ({ width: import_paint_editor8.MIXING_PAD_WIDTH, height: import_paint_editor8.MIXING_PAD_HEIGHT, data: controller.mixingPad.pixels() }), [controller, state.mixingPadVersion]);
1542
+ const pad = (0, import_react13.useMemo)(() => ({ width: import_paint_editor9.MIXING_PAD_WIDTH, height: import_paint_editor9.MIXING_PAD_HEIGHT, data: controller.mixingPad.pixels() }), [controller, state.mixingPadVersion]);
1471
1543
  const R = wheelSize / 2;
1472
1544
  const mid = R * 0.82;
1473
- const setHsv = (s, v) => controller.setColor((0, import_paint_editor8.rgbToHexColor)(...(0, import_paint_editor8.hsvToRgb)(hsv.h, s, v)));
1545
+ const setHsv = (s, v) => controller.setColor((0, import_paint_editor9.rgbToHexColor)(...(0, import_paint_editor9.hsvToRgb)(hsv.h, s, v)));
1474
1546
  const padPoint = (e) => {
1475
1547
  const rect = e.currentTarget.getBoundingClientRect();
1476
- const kx = import_paint_editor8.MIXING_PAD_WIDTH / (rect.width || import_paint_editor8.MIXING_PAD_WIDTH);
1477
- const ky = import_paint_editor8.MIXING_PAD_HEIGHT / (rect.height || import_paint_editor8.MIXING_PAD_HEIGHT);
1478
- const x = Math.min(import_paint_editor8.MIXING_PAD_WIDTH, Math.max(0, (e.clientX - rect.left) * kx));
1479
- const y = Math.min(import_paint_editor8.MIXING_PAD_HEIGHT, Math.max(0, (e.clientY - rect.top) * ky));
1548
+ const kx = import_paint_editor9.MIXING_PAD_WIDTH / (rect.width || import_paint_editor9.MIXING_PAD_WIDTH);
1549
+ const ky = import_paint_editor9.MIXING_PAD_HEIGHT / (rect.height || import_paint_editor9.MIXING_PAD_HEIGHT);
1550
+ const x = Math.min(import_paint_editor9.MIXING_PAD_WIDTH, Math.max(0, (e.clientX - rect.left) * kx));
1551
+ const y = Math.min(import_paint_editor9.MIXING_PAD_HEIGHT, Math.max(0, (e.clientY - rect.top) * ky));
1480
1552
  return e.pointerType === "pen" && e.pressure > 0 ? { x, y, pressure: e.pressure } : { x, y };
1481
1553
  };
1482
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "color-panel", children: [
1483
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "relative self-center", style: { width: wheelSize, height: wheelSize }, children: [
1484
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1554
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "color-panel", children: [
1555
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "relative self-center", style: { width: wheelSize, height: wheelSize }, children: [
1556
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1485
1557
  "div",
1486
1558
  {
1487
1559
  role: "slider",
1488
1560
  "aria-label": "Hue wheel",
1489
1561
  "aria-valuemin": 0,
1490
1562
  "aria-valuemax": 360,
1491
- "aria-valuenow": Math.round((0, import_paint_editor8.hueToWheel)(hsv.h, wheel)),
1563
+ "aria-valuenow": Math.round((0, import_paint_editor9.hueToWheel)(hsv.h, wheel)),
1492
1564
  tabIndex: 0,
1493
1565
  className: "absolute inset-0 cursor-crosshair",
1494
1566
  onPointerDown: (e) => {
1495
1567
  const rect = e.currentTarget.getBoundingClientRect();
1496
- controller.setColor((0, import_paint_editor8.wheelPick)(e.clientX - rect.left - R, e.clientY - rect.top - R, wheel, color));
1568
+ controller.setColor((0, import_paint_editor9.wheelPick)(e.clientX - rect.left - R, e.clientY - rect.top - R, wheel, color));
1497
1569
  },
1498
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PixelCanvas, { pixels: ring, label: "Colour wheel", style: { width: wheelSize, height: wheelSize } })
1570
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PixelCanvas, { pixels: ring, label: "Colour wheel", style: { width: wheelSize, height: wheelSize } })
1499
1571
  }
1500
1572
  ),
1501
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { className: "pointer-events-none absolute inset-0", width: wheelSize, height: wheelSize, "aria-hidden": "true", children: harmony.map((h, i) => {
1502
- const p = (0, import_paint_editor8.wheelPoint)(h.angle, mid);
1503
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("circle", { cx: R + p.x, cy: R + p.y, r: i === 0 ? 7 : 5, fill: h.color, stroke: "#fff", strokeWidth: i === 0 ? 2 : 1 }, i);
1573
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("svg", { className: "pointer-events-none absolute inset-0", width: wheelSize, height: wheelSize, "aria-hidden": "true", children: harmony.map((h, i) => {
1574
+ const p = (0, import_paint_editor9.wheelPoint)(h.angle, mid);
1575
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("circle", { cx: R + p.x, cy: R + p.y, r: i === 0 ? 7 : 5, fill: h.color, stroke: "#fff", strokeWidth: i === 0 ? 2 : 1 }, i);
1504
1576
  }) }),
1505
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "absolute rounded-full border border-slate-700", style: { left: R - R * 0.45, top: R - R * 0.45, width: R * 0.9, height: R * 0.9, background: color } })
1577
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "absolute rounded-full border border-slate-700", style: { left: R - R * 0.45, top: R - R * 0.45, width: R * 0.9, height: R * 0.9, background: color } })
1506
1578
  ] }),
1507
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-2", children: [
1508
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "color", "aria-label": "Paint colour", value: color, onChange: (e) => controller.setColor(e.target.value), className: "h-7 w-9 rounded bg-transparent" }),
1509
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "color", "aria-label": "Second colour", value: state.secondaryColor, onChange: (e) => controller.setSecondaryColor(e.target.value), className: "h-5 w-7 rounded bg-transparent" }),
1510
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: button, title: "Swap colours (X)", onClick: () => controller.swapColors(), children: "Swap" }),
1511
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1579
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2", children: [
1580
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "color", "aria-label": "Paint colour", value: color, onChange: (e) => controller.setColor(e.target.value), className: "h-7 w-9 rounded bg-transparent" }),
1581
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "color", "aria-label": "Second colour", value: state.secondaryColor, onChange: (e) => controller.setSecondaryColor(e.target.value), className: "h-5 w-7 rounded bg-transparent" }),
1582
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, title: "Swap colours (X)", onClick: () => controller.swapColors(), children: "Swap" }),
1583
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1512
1584
  "input",
1513
1585
  {
1514
1586
  "aria-label": "Hex colour",
@@ -1519,49 +1591,49 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1519
1591
  color
1520
1592
  )
1521
1593
  ] }),
1522
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-2", "data-testid": "paint-source", children: [
1523
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1594
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2", "data-testid": "paint-source", children: [
1595
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1524
1596
  "span",
1525
1597
  {
1526
1598
  className: "h-5 flex-1 rounded ring-1 ring-slate-700",
1527
1599
  "aria-label": state.effectPaint ? `Effect paint: ${state.effectPaint.effect}` : state.paint.type === "gradient" ? "Gradient paint" : "Paint colour",
1528
1600
  "data-testid": "paint-well",
1529
1601
  "data-effect-paint": state.effectPaint ? state.effectPaint.effect : void 0,
1530
- style: { background: effectWell ? `center / cover no-repeat url("${effectWell}")` : (0, import_paint_editor9.paintSourceCss)(state.paint, { paint: color, secondary: state.secondaryColor }) }
1602
+ style: { background: effectWell ? `center / cover no-repeat url("${effectWell}")` : (0, import_paint_editor10.paintSourceCss)(state.paint, { paint: color, secondary: state.secondaryColor }) }
1531
1603
  }
1532
1604
  ),
1533
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1605
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1534
1606
  "button",
1535
1607
  {
1536
1608
  type: "button",
1537
1609
  className: chip(state.paint.type === "gradient"),
1538
1610
  "aria-pressed": state.paint.type === "gradient",
1539
1611
  title: "Paint that changes colour as the stroke goes",
1540
- onClick: () => attempt(() => state.paint.type === "gradient" ? controller.setColor(color) : controller.setPaint(import_paint_editor9.DEFAULT_PAINT_GRADIENT)),
1612
+ onClick: () => attempt(() => state.paint.type === "gradient" ? controller.setColor(color) : controller.setPaint(import_paint_editor10.DEFAULT_PAINT_GRADIENT)),
1541
1613
  children: "Gradient"
1542
1614
  }
1543
1615
  )
1544
1616
  ] }),
1545
- state.paint.type === "gradient" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaintGradientEditor, { value: state.paint, colors: { paint: color, secondary: state.secondaryColor }, onChange: (g2) => attempt(() => controller.setPaint(g2)) }),
1546
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center gap-2", children: [
1547
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "w-16 text-slate-400", children: "Saturation" }),
1548
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "range", "aria-label": "Saturation", min: 0, max: 1, step: 0.01, value: hsv.s, onChange: (e) => setHsv(Number(e.target.value), hsv.v), className: "flex-1 accent-indigo-500" })
1617
+ state.paint.type === "gradient" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PaintGradientEditor, { value: state.paint, colors: { paint: color, secondary: state.secondaryColor }, onChange: (g2) => attempt(() => controller.setPaint(g2)) }),
1618
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-2", children: [
1619
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w-16 text-slate-400", children: "Saturation" }),
1620
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "range", "aria-label": "Saturation", min: 0, max: 1, step: 0.01, value: hsv.s, onChange: (e) => setHsv(Number(e.target.value), hsv.v), className: "flex-1 accent-indigo-500" })
1549
1621
  ] }),
1550
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center gap-2", children: [
1551
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "w-16 text-slate-400", children: "Value" }),
1552
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "range", "aria-label": "Value", min: 0, max: 1, step: 0.01, value: hsv.v, onChange: (e) => setHsv(hsv.s, Number(e.target.value)), className: "flex-1 accent-indigo-500" })
1622
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-2", children: [
1623
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w-16 text-slate-400", children: "Value" }),
1624
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "range", "aria-label": "Value", min: 0, max: 1, step: 0.01, value: hsv.v, onChange: (e) => setHsv(hsv.s, Number(e.target.value)), className: "flex-1 accent-indigo-500" })
1553
1625
  ] }),
1554
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1", children: [
1555
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("select", { "aria-label": "Harmony", value: kind, onChange: (e) => setKind(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor8.HARMONY_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: k, children: k }, k)) }),
1556
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: chip(wheel === "ryb"), "aria-pressed": wheel === "ryb", onClick: () => setWheel("ryb"), children: "RYB" }),
1557
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: chip(wheel === "rgb"), "aria-pressed": wheel === "rgb", onClick: () => setWheel("rgb"), children: "RGB" })
1626
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1", children: [
1627
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("select", { "aria-label": "Harmony", value: kind, onChange: (e) => setKind(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor9.HARMONY_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: k, children: k }, k)) }),
1628
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: chip(wheel === "ryb"), "aria-pressed": wheel === "ryb", onClick: () => setWheel("ryb"), children: "RYB" }),
1629
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: chip(wheel === "rgb"), "aria-pressed": wheel === "rgb", onClick: () => setWheel("rgb"), children: "RGB" })
1558
1630
  ] }),
1559
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-wrap gap-1", "aria-label": "Harmony colours", children: [
1560
- harmony.map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", "aria-label": `Use ${h.color}`, title: h.color, className: "h-6 w-6 rounded ring-1 ring-slate-700", style: { background: h.color }, onClick: () => controller.setColor(h.color) }, i)),
1561
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: button, onClick: () => harmony.forEach((h) => controller.addSwatch(h.color)), children: "+ swatches" })
1631
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap gap-1", "aria-label": "Harmony colours", children: [
1632
+ harmony.map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", "aria-label": `Use ${h.color}`, title: h.color, className: "h-6 w-6 rounded ring-1 ring-slate-700", style: { background: h.color }, onClick: () => controller.setColor(h.color) }, i)),
1633
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, onClick: () => harmony.forEach((h) => controller.addSwatch(h.color)), children: "+ swatches" })
1562
1634
  ] }),
1563
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": "Swatches", children: [
1564
- state.swatches.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1635
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": "Swatches", children: [
1636
+ state.swatches.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1565
1637
  "button",
1566
1638
  {
1567
1639
  type: "button",
@@ -1570,7 +1642,7 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1570
1642
  "aria-label": s.name ?? (s.paint ? "Gradient" : s.color),
1571
1643
  title: `${s.name ?? (s.paint ? "Gradient" : s.color)} (right-click to remove)`,
1572
1644
  className: "h-5 w-5 rounded ring-1 ring-slate-700",
1573
- style: { background: s.paint ? (0, import_paint_editor9.paintSourceCss)(s.paint, { paint: color, secondary: state.secondaryColor }) : s.color },
1645
+ style: { background: s.paint ? (0, import_paint_editor10.paintSourceCss)(s.paint, { paint: color, secondary: state.secondaryColor }) : s.color },
1574
1646
  onClick: () => attempt(() => s.paint ? controller.setPaint(s.paint) : controller.setColor(s.color)),
1575
1647
  onContextMenu: (e) => {
1576
1648
  e.preventDefault();
@@ -1579,15 +1651,15 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1579
1651
  },
1580
1652
  i
1581
1653
  )),
1582
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: button, "aria-label": "Add swatch", onClick: () => attempt(() => controller.addSwatch(state.paint)), children: "+" })
1654
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, "aria-label": "Add swatch", onClick: () => attempt(() => controller.addSwatch(state.paint)), children: "+" })
1583
1655
  ] }),
1584
- mixingPad && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col gap-1", "data-testid": "mixing-pad", children: [
1585
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1", children: [
1586
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-slate-400", children: "Mixing pad" }),
1587
- ["paint", "knife", "pick"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", "aria-pressed": padTool === t, className: chip(padTool === t), onClick: () => setPadTool(t), children: t === "paint" ? "Paint" : t === "knife" ? "Knife" : "Pick" }, t)),
1588
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: button, onClick: () => controller.clearMixingPad(), children: "Clear" })
1656
+ mixingPad && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col gap-1", "data-testid": "mixing-pad", children: [
1657
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1", children: [
1658
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-slate-400", children: "Mixing pad" }),
1659
+ ["paint", "knife", "pick"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", "aria-pressed": padTool === t, className: chip(padTool === t), onClick: () => setPadTool(t), children: t === "paint" ? "Paint" : t === "knife" ? "Knife" : "Pick" }, t)),
1660
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, onClick: () => controller.clearMixingPad(), children: "Clear" })
1589
1661
  ] }),
1590
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1662
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1591
1663
  "div",
1592
1664
  {
1593
1665
  role: "application",
@@ -1596,7 +1668,7 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1596
1668
  onPointerDown: (e) => {
1597
1669
  const p = padPoint(e);
1598
1670
  if (padTool === "pick") {
1599
- attempt(() => controller.mixingPadPick(p.x, p.y, { setColor: true, radius: (0, import_paint_editor8.padSampleRadius)(sample) }));
1671
+ attempt(() => controller.mixingPadPick(p.x, p.y, { setColor: true, radius: (0, import_paint_editor9.padSampleRadius)(sample) }));
1600
1672
  return;
1601
1673
  }
1602
1674
  padPoints.current = [p];
@@ -1608,20 +1680,20 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1608
1680
  padPoints.current = null;
1609
1681
  if (pts?.length) attempt(() => controller.mixingPadStroke(pts, { tool: padTool === "knife" ? "knife" : "paint" }));
1610
1682
  },
1611
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PixelCanvas, { pixels: pad, label: "Mixing pad pixels", className: "w-full rounded", style: { aspectRatio: `${import_paint_editor8.MIXING_PAD_WIDTH} / ${import_paint_editor8.MIXING_PAD_HEIGHT}` } })
1683
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PixelCanvas, { pixels: pad, label: "Mixing pad pixels", className: "w-full rounded", style: { aspectRatio: `${import_paint_editor9.MIXING_PAD_WIDTH} / ${import_paint_editor9.MIXING_PAD_HEIGHT}` } })
1612
1684
  }
1613
1685
  ),
1614
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex flex-wrap items-center gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center gap-1", children: [
1615
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-slate-400", children: "Sample" }),
1616
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("select", { "aria-label": "Pick sample size", value: sample, onChange: (e) => setSample(Number(e.target.value)), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor8.PAD_SAMPLE_SIZES.map((n) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: n, children: n === 1 ? "1 px" : `${n}\xD7${n}` }, n)) })
1686
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-wrap items-center gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1", children: [
1687
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-slate-400", children: "Sample" }),
1688
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("select", { "aria-label": "Pick sample size", value: sample, onChange: (e) => setSample(Number(e.target.value)), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor9.PAD_SAMPLE_SIZES.map((n) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: n, children: n === 1 ? "1 px" : `${n}\xD7${n}` }, n)) })
1617
1689
  ] }) }),
1618
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1619
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: color } }),
1620
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "number", "aria-label": "Paint colour parts", min: 0, max: 20, value: parts[0], onChange: (e) => setParts([Number(e.target.value), parts[1]]), className: "w-10 rounded bg-slate-800 px-1 py-0.5" }),
1621
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-slate-500", children: ":" }),
1622
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "number", "aria-label": "Second colour parts", min: 0, max: 20, value: parts[1], onChange: (e) => setParts([parts[0], Number(e.target.value)]), className: "w-10 rounded bg-slate-800 px-1 py-0.5" }),
1623
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: state.secondaryColor } }),
1624
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1690
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1691
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: color } }),
1692
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "number", "aria-label": "Paint colour parts", min: 0, max: 20, value: parts[0], onChange: (e) => setParts([Number(e.target.value), parts[1]]), className: "w-10 rounded bg-slate-800 px-1 py-0.5" }),
1693
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-slate-500", children: ":" }),
1694
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "number", "aria-label": "Second colour parts", min: 0, max: 20, value: parts[1], onChange: (e) => setParts([parts[0], Number(e.target.value)]), className: "w-10 rounded bg-slate-800 px-1 py-0.5" }),
1695
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: state.secondaryColor } }),
1696
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1625
1697
  "button",
1626
1698
  {
1627
1699
  type: "button",
@@ -1640,22 +1712,22 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1640
1712
  }
1641
1713
  )
1642
1714
  ] }),
1643
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1644
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { value: padName, placeholder: "Pad name", "aria-label": "Pad name", onChange: (e) => setPadName(e.target.value), className: "w-24 rounded bg-slate-800 px-1.5 py-0.5" }),
1645
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.saveMixingPad(padName || void 0), setPadName(""))), children: "Keep pad" })
1715
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1716
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { value: padName, placeholder: "Pad name", "aria-label": "Pad name", onChange: (e) => setPadName(e.target.value), className: "w-24 rounded bg-slate-800 px-1.5 py-0.5" }),
1717
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.saveMixingPad(padName || void 0), setPadName(""))), children: "Keep pad" })
1646
1718
  ] }),
1647
- state.savedMixingPads.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ul", { className: "flex flex-col gap-0.5", "aria-label": "Kept pads", children: state.savedMixingPads.map((p) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("li", { className: "flex items-center gap-1", children: [
1648
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: `${button} flex-1 text-left`, onClick: () => attempt(() => controller.loadMixingPad(p.id)), children: p.name }),
1649
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: button, "aria-label": `Remove ${p.name}`, onClick: () => attempt(() => controller.removeMixingPad(p.id)), children: "\xD7" })
1719
+ state.savedMixingPads.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", { className: "flex flex-col gap-0.5", "aria-label": "Kept pads", children: state.savedMixingPads.map((p) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("li", { className: "flex items-center gap-1", children: [
1720
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: `${button} flex-1 text-left`, onClick: () => attempt(() => controller.loadMixingPad(p.id)), children: p.name }),
1721
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, "aria-label": `Remove ${p.name}`, onClick: () => attempt(() => controller.removeMixingPad(p.id)), children: "\xD7" })
1650
1722
  ] }, p.id)) })
1651
1723
  ] }),
1652
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ErrorLine, { error })
1724
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ErrorLine, { error })
1653
1725
  ] });
1654
1726
  };
1655
1727
 
1656
1728
  // src/paint-editor/PaintLayersPanel.tsx
1657
1729
  var import_react16 = require("react");
1658
- var import_paint_editor10 = require("@pixerate/editor/paint-editor");
1730
+ var import_paint_editor11 = require("@pixerate/editor/paint-editor");
1659
1731
 
1660
1732
  // src/image-editor/LayerEffectsPanel.tsx
1661
1733
  var import_react15 = require("react");
@@ -1668,16 +1740,16 @@ var imageColorInputClass = "h-6 w-8 rounded border border-border bg-transparent"
1668
1740
 
1669
1741
  // src/image-editor/controls/controls.tsx
1670
1742
  var import_react14 = require("react");
1671
- var import_jsx_runtime14 = require("react/jsx-runtime");
1743
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1672
1744
  var ControlsContext = (0, import_react14.createContext)({});
1673
1745
  function useImageEditorControls() {
1674
1746
  return (0, import_react14.useContext)(ControlsContext);
1675
1747
  }
1676
1748
  function ImageCheckbox(props) {
1677
1749
  const Host = useImageEditorControls().Checkbox;
1678
- if (Host) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Host, { ...props });
1750
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Host, { ...props });
1679
1751
  const { checked, label, disabled, onChange, className = "" } = props;
1680
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1752
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1681
1753
  "input",
1682
1754
  {
1683
1755
  type: "checkbox",
@@ -1691,9 +1763,9 @@ function ImageCheckbox(props) {
1691
1763
  }
1692
1764
  function ImageRange(props) {
1693
1765
  const Host = useImageEditorControls().Range;
1694
- if (Host) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Host, { ...props });
1766
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Host, { ...props });
1695
1767
  const { value, min, max, step, label, disabled, onChange, onStart, onEnd, className = "" } = props;
1696
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1768
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1697
1769
  "input",
1698
1770
  {
1699
1771
  type: "range",
@@ -1714,18 +1786,18 @@ function ImageRange(props) {
1714
1786
  }
1715
1787
  function ImageSelect(props) {
1716
1788
  const Host = useImageEditorControls().Select;
1717
- if (Host) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Host, { ...props });
1789
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Host, { ...props });
1718
1790
  const { value, options, label, placeholder, disabled, onChange, className = "" } = props;
1719
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("select", { "aria-label": label, value, disabled, onChange: (e) => onChange(e.target.value), className: `${imageSelectClass} ${className}`, children: [
1720
- placeholder !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", children: placeholder }),
1721
- options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: o.value, children: o.label }, o.value))
1791
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("select", { "aria-label": label, value, disabled, onChange: (e) => onChange(e.target.value), className: `${imageSelectClass} ${className}`, children: [
1792
+ placeholder !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "", children: placeholder }),
1793
+ options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: o.value, children: o.label }, o.value))
1722
1794
  ] });
1723
1795
  }
1724
1796
  function ImageColor(props) {
1725
1797
  const Host = useImageEditorControls().Color;
1726
- if (Host) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Host, { ...props });
1798
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Host, { ...props });
1727
1799
  const { value, label, alpha, disabled, onChange, className = "" } = props;
1728
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1800
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1729
1801
  "input",
1730
1802
  {
1731
1803
  type: "color",
@@ -1739,7 +1811,7 @@ function ImageColor(props) {
1739
1811
  }
1740
1812
 
1741
1813
  // src/image-editor/LayerEffectsPanel.tsx
1742
- var import_jsx_runtime15 = require("react/jsx-runtime");
1814
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1743
1815
  var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) => {
1744
1816
  const [, setTick] = (0, import_react15.useState)(0);
1745
1817
  (0, import_react15.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
@@ -1758,7 +1830,7 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1758
1830
  }
1759
1831
  };
1760
1832
  if (!model.available || !id) {
1761
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: `text-xs text-muted-foreground ${className ?? ""}`, "data-testid": "layer-effects", children: model.reason });
1833
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: `text-xs text-muted-foreground ${className ?? ""}`, "data-testid": "layer-effects", children: model.reason });
1762
1834
  }
1763
1835
  const effects = controller.getLayerEffects(id);
1764
1836
  const patterns = controller.getDocumentPatterns();
@@ -1773,14 +1845,14 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1773
1845
  case "range": {
1774
1846
  const k = c.percent ? 100 : 1;
1775
1847
  const shown = Math.round(c.value * k * 100) / 100;
1776
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1777
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "text-muted-foreground", children: [
1848
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1849
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "text-muted-foreground", children: [
1778
1850
  label,
1779
1851
  " ",
1780
1852
  shown,
1781
1853
  c.unit
1782
1854
  ] }),
1783
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1855
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1784
1856
  ImageRange,
1785
1857
  {
1786
1858
  label,
@@ -1797,19 +1869,19 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1797
1869
  ] }, c.key);
1798
1870
  }
1799
1871
  case "color":
1800
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1801
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ImageColor, { label, value: c.value, disabled: model.readOnly, onChange: (v) => change(effectId, c, v) }),
1872
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1873
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ImageColor, { label, value: c.value, disabled: model.readOnly, onChange: (v) => change(effectId, c, v) }),
1802
1874
  label
1803
1875
  ] }, c.key);
1804
1876
  case "checkbox":
1805
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1806
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ImageCheckbox, { label, checked: c.value, disabled: model.readOnly, onChange: (on) => change(effectId, c, on) }),
1877
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1878
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ImageCheckbox, { label, checked: c.value, disabled: model.readOnly, onChange: (on) => change(effectId, c, on) }),
1807
1879
  label
1808
1880
  ] }, c.key);
1809
1881
  case "select":
1810
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1811
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-muted-foreground", children: label }),
1812
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1882
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1883
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-muted-foreground", children: label }),
1884
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1813
1885
  ImageSelect,
1814
1886
  {
1815
1887
  label,
@@ -1822,16 +1894,16 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1822
1894
  ] }, c.key);
1823
1895
  }
1824
1896
  };
1825
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-foreground ${className ?? ""}`, "data-testid": "layer-effects", "aria-label": "Layer style", role: "group", children: [
1826
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
1827
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "font-semibold text-foreground", children: heading ? "Layer Style" : "Styles" }),
1828
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
1829
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ImageCheckbox, { label: "Effects on", checked: model.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.setLayerEffectsEnabled(id, on)) }),
1897
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-foreground ${className ?? ""}`, "data-testid": "layer-effects", "aria-label": "Layer style", role: "group", children: [
1898
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
1899
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "font-semibold text-foreground", children: heading ? "Layer Style" : "Styles" }),
1900
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
1901
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ImageCheckbox, { label: "Effects on", checked: model.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.setLayerEffectsEnabled(id, on)) }),
1830
1902
  "On"
1831
1903
  ] }),
1832
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
1904
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
1833
1905
  "Scale",
1834
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1906
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1835
1907
  "input",
1836
1908
  {
1837
1909
  type: "number",
@@ -1850,7 +1922,7 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1850
1922
  ),
1851
1923
  "%"
1852
1924
  ] }),
1853
- heading && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1925
+ heading && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1854
1926
  ImageSelect,
1855
1927
  {
1856
1928
  label: "Add style",
@@ -1866,14 +1938,14 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1866
1938
  }
1867
1939
  )
1868
1940
  ] }),
1869
- model.readOnly && model.reason && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-muted-foreground", children: model.reason }),
1870
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Effects", children: model.rows.map((row) => {
1941
+ model.readOnly && model.reason && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-muted-foreground", children: model.reason }),
1942
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Effects", children: model.rows.map((row) => {
1871
1943
  const effect = effects.items.find((e) => e.id === row.id);
1872
1944
  const expanded = open === row.id;
1873
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("li", { "data-effect-id": row.id, className: "rounded bg-background/60 ring-1 ring-border", children: [
1874
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-1.5 px-1.5 py-1", children: [
1875
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ImageCheckbox, { label: `${row.label} on`, checked: row.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.updateLayerEffect(id, row.id, { enabled: on })) }),
1876
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1945
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("li", { "data-effect-id": row.id, className: "rounded bg-background/60 ring-1 ring-border", children: [
1946
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1.5 px-1.5 py-1", children: [
1947
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ImageCheckbox, { label: `${row.label} on`, checked: row.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.updateLayerEffect(id, row.id, { enabled: on })) }),
1948
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1877
1949
  "button",
1878
1950
  {
1879
1951
  type: "button",
@@ -1883,17 +1955,17 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1883
1955
  children: row.label
1884
1956
  }
1885
1957
  ),
1886
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: imageIconButtonClass, "aria-label": `Remove ${row.label}`, disabled: model.readOnly, onClick: () => attempt(() => controller.removeLayerEffect(id, row.id)), children: "\u2715" })
1958
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: imageIconButtonClass, "aria-label": `Remove ${row.label}`, disabled: model.readOnly, onClick: () => attempt(() => controller.removeLayerEffect(id, row.id)), children: "\u2715" })
1887
1959
  ] }),
1888
- expanded && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 px-1.5 pb-1.5", "data-testid": "effect-settings", children: (0, import_raster.layerEffectControls)(effect, patterns).map((c) => renderControl(row.id, c)) })
1960
+ expanded && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 px-1.5 pb-1.5", "data-testid": "effect-settings", children: (0, import_raster.layerEffectControls)(effect, patterns).map((c) => renderControl(row.id, c)) })
1889
1961
  ] }, row.id);
1890
1962
  }) }),
1891
- error && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { role: "alert", className: "text-destructive", children: error })
1963
+ error && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { role: "alert", className: "text-destructive", children: error })
1892
1964
  ] });
1893
1965
  };
1894
1966
 
1895
1967
  // src/paint-editor/PaintLayersPanel.tsx
1896
- var import_jsx_runtime16 = require("react/jsx-runtime");
1968
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1897
1969
  function siblingIndex(layers, l) {
1898
1970
  const sibs = layers.filter((x) => x.parentId === l.parentId).reverse();
1899
1971
  return { index: sibs.findIndex((x) => x.id === l.id), count: sibs.length };
@@ -1911,18 +1983,18 @@ var PaintLayersPanel = ({ controller, className }) => {
1911
1983
  const to = Math.min(count - 1, Math.max(0, index + delta));
1912
1984
  if (to !== index) attempt(() => controller.moveLayer(active.id, to));
1913
1985
  };
1914
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-layers-panel", children: [
1915
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1916
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer()), children: "New layer" }),
1917
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer({ type: "group" })), children: "New group" }),
1918
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: button, title: "A layer whose strokes stay editable", onClick: () => attempt(() => controller.addLayer({ type: "strokes" })), children: "New stroke layer" }),
1919
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.duplicateLayer(active.id)), children: "Duplicate" }),
1920
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer up", onClick: () => move(1), children: "\u2191" }),
1921
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer down", onClick: () => move(-1), children: "\u2193" }),
1922
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.mergeDown(active.id)), children: "Merge down" }),
1923
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: button, disabled: !active || layers.length < 2, onClick: () => active && attempt(() => controller.removeLayer(active.id)), children: "Delete" })
1986
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-layers-panel", children: [
1987
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1988
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer()), children: "New layer" }),
1989
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer({ type: "group" })), children: "New group" }),
1990
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, title: "A layer whose strokes stay editable", onClick: () => attempt(() => controller.addLayer({ type: "strokes" })), children: "New stroke layer" }),
1991
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.duplicateLayer(active.id)), children: "Duplicate" }),
1992
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer up", onClick: () => move(1), children: "\u2191" }),
1993
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer down", onClick: () => move(-1), children: "\u2193" }),
1994
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.mergeDown(active.id)), children: "Merge down" }),
1995
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, disabled: !active || layers.length < 2, onClick: () => active && attempt(() => controller.removeLayer(active.id)), children: "Delete" })
1924
1996
  ] }),
1925
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { role: "tree", "aria-label": "Layers", className: "flex flex-col gap-0.5", children: layers.map((l) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
1997
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("ul", { role: "tree", "aria-label": "Layers", className: "flex flex-col gap-0.5", children: layers.map((l) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
1926
1998
  "li",
1927
1999
  {
1928
2000
  role: "treeitem",
@@ -1931,7 +2003,7 @@ var PaintLayersPanel = ({ controller, className }) => {
1931
2003
  style: { paddingLeft: 6 + l.depth * 12 },
1932
2004
  onClick: () => controller.setActiveLayer(l.id),
1933
2005
  children: [
1934
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2006
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1935
2007
  "button",
1936
2008
  {
1937
2009
  type: "button",
@@ -1944,7 +2016,7 @@ var PaintLayersPanel = ({ controller, className }) => {
1944
2016
  children: l.visible ? "\u25CF" : "\u25CB"
1945
2017
  }
1946
2018
  ),
1947
- renaming === l.id ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2019
+ renaming === l.id ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1948
2020
  "input",
1949
2021
  {
1950
2022
  autoFocus: true,
@@ -1961,23 +2033,23 @@ var PaintLayersPanel = ({ controller, className }) => {
1961
2033
  if (e.key === "Escape") setRenaming(null);
1962
2034
  }
1963
2035
  }
1964
- ) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "flex-1 truncate", onDoubleClick: () => setRenaming(l.id), children: [
2036
+ ) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex-1 truncate", onDoubleClick: () => setRenaming(l.id), children: [
1965
2037
  l.type === "group" ? "\u25B8 " : "",
1966
- l.liveStrokes !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { "aria-label": "Stroke layer", title: `Stroke layer: ${l.liveStrokes} editable strokes`, children: [
2038
+ l.liveStrokes !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { "aria-label": "Stroke layer", title: `Stroke layer: ${l.liveStrokes} editable strokes`, children: [
1967
2039
  "\u270E",
1968
2040
  " "
1969
2041
  ] }),
1970
2042
  l.name
1971
2043
  ] }),
1972
- l.locks.pixels || l.locks.all ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { title: "Locked", children: "\u{1F512}" }) : null
2044
+ l.locks.pixels || l.locks.all ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { title: "Locked", children: "\u{1F512}" }) : null
1973
2045
  ]
1974
2046
  },
1975
2047
  l.id
1976
2048
  )) }),
1977
- active && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
1978
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-2", children: [
1979
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w-14 text-slate-400", children: "Opacity" }),
1980
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2049
+ active && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
2050
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-2", children: [
2051
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-14 text-slate-400", children: "Opacity" }),
2052
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1981
2053
  "input",
1982
2054
  {
1983
2055
  type: "range",
@@ -1991,40 +2063,40 @@ var PaintLayersPanel = ({ controller, className }) => {
1991
2063
  }
1992
2064
  )
1993
2065
  ] }),
1994
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-2", children: [
1995
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w-14 text-slate-400", children: "Blend" }),
1996
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("select", { "aria-label": "Layer blend", value: active.blend, onChange: (e) => attempt(() => controller.updateLayer(active.id, { blend: e.target.value })), className: "flex-1 rounded bg-slate-800 px-1 py-0.5", children: [
1997
- active.type === "group" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "pass-through", children: "Pass through" }),
1998
- import_paint_editor10.BLEND_MENU_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("optgroup", { label: g.label, children: g.modes.map((m) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: m.id, title: m.description, children: m.label }, m.id)) }, g.label))
2066
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-2", children: [
2067
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-14 text-slate-400", children: "Blend" }),
2068
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("select", { "aria-label": "Layer blend", value: active.blend, onChange: (e) => attempt(() => controller.updateLayer(active.id, { blend: e.target.value })), className: "flex-1 rounded bg-slate-800 px-1 py-0.5", children: [
2069
+ active.type === "group" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "pass-through", children: "Pass through" }),
2070
+ import_paint_editor11.BLEND_MENU_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("optgroup", { label: g.label, children: g.modes.map((m) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: m.id, title: m.description, children: m.label }, m.id)) }, g.label))
1999
2071
  ] })
2000
2072
  ] }),
2001
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex gap-1", children: [
2002
- ["pixels", "transparency"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", "aria-pressed": Boolean(active.locks[k]), className: chip(Boolean(active.locks[k])), onClick: () => attempt(() => controller.updateLayer(active.id, { locks: { [k]: !active.locks[k] } })), children: k === "pixels" ? "Lock pixels" : "Lock transparency" }, k)),
2003
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", "aria-pressed": active.clipped, className: chip(active.clipped), onClick: () => attempt(() => controller.updateLayer(active.id, { clipped: !active.clipped })), children: "Clip" })
2073
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex gap-1", children: [
2074
+ ["pixels", "transparency"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", "aria-pressed": Boolean(active.locks[k]), className: chip(Boolean(active.locks[k])), onClick: () => attempt(() => controller.updateLayer(active.id, { locks: { [k]: !active.locks[k] } })), children: k === "pixels" ? "Lock pixels" : "Lock transparency" }, k)),
2075
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", "aria-pressed": active.clipped, className: chip(active.clipped), onClick: () => attempt(() => controller.updateLayer(active.id, { clipped: !active.clipped })), children: "Clip" })
2004
2076
  ] }),
2005
- light?.hasLight && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col gap-1.5 border-t border-slate-800 pt-1.5", "data-testid": "layer-light", children: [
2006
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center justify-between", children: [
2007
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "font-medium text-slate-300", title: "This layer's paint gives off light", children: "Light" }),
2008
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.clearLight(active.id)), children: "Clear light" })
2077
+ light?.hasLight && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-col gap-1.5 border-t border-slate-800 pt-1.5", "data-testid": "layer-light", children: [
2078
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center justify-between", children: [
2079
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "font-medium text-slate-300", title: "This layer's paint gives off light", children: "Light" }),
2080
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.clearLight(active.id)), children: "Clear light" })
2009
2081
  ] }),
2010
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-2", title: "How far the light spills onto the paint and paper around it (0 turns it off)", children: [
2011
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w-14 text-slate-400", children: "Spill" }),
2012
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { type: "range", "aria-label": "Light spill radius", min: 0, max: 120, step: 1, value: light.spill.radius, onChange: (e) => attempt(() => controller.setLightSpill(active.id, { radius: Number(e.target.value) })), className: "flex-1 accent-indigo-500" })
2082
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-2", title: "How far the light spills onto the paint and paper around it (0 turns it off)", children: [
2083
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-14 text-slate-400", children: "Spill" }),
2084
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "range", "aria-label": "Light spill radius", min: 0, max: 120, step: 1, value: light.spill.radius, onChange: (e) => attempt(() => controller.setLightSpill(active.id, { radius: Number(e.target.value) })), className: "flex-1 accent-indigo-500" })
2013
2085
  ] }),
2014
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-2", children: [
2015
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w-14 text-slate-400", children: "Strength" }),
2016
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { type: "range", "aria-label": "Light spill strength", min: 0, max: 2, step: 0.05, value: light.spill.strength, onChange: (e) => attempt(() => controller.setLightSpill(active.id, { strength: Number(e.target.value) })), className: "flex-1 accent-indigo-500" })
2086
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-2", children: [
2087
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-14 text-slate-400", children: "Strength" }),
2088
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "range", "aria-label": "Light spill strength", min: 0, max: 2, step: 0.05, value: light.spill.strength, onChange: (e) => attempt(() => controller.setLightSpill(active.id, { strength: Number(e.target.value) })), className: "flex-1 accent-indigo-500" })
2017
2089
  ] })
2018
2090
  ] }),
2019
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "border-t border-slate-800 pt-1.5", "data-testid": "paint-layer-effects", title: "Live layer styles drawn from this layer's paint: glows, shadows, strokes", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LayerEffectsPanel, { controller, layerId: active.id }) })
2091
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "border-t border-slate-800 pt-1.5", "data-testid": "paint-layer-effects", title: "Live layer styles drawn from this layer's paint: glows, shadows, strokes", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LayerEffectsPanel, { controller, layerId: active.id }) })
2020
2092
  ] }),
2021
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ErrorLine, { error })
2093
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ErrorLine, { error })
2022
2094
  ] });
2023
2095
  };
2024
2096
 
2025
2097
  // src/paint-editor/WetPanel.tsx
2026
- var import_paint_editor11 = require("@pixerate/editor/paint-editor");
2027
- var import_jsx_runtime17 = require("react/jsx-runtime");
2098
+ var import_paint_editor12 = require("@pixerate/editor/paint-editor");
2099
+ var import_jsx_runtime18 = require("react/jsx-runtime");
2028
2100
  var FLOW_LABELS = { none: "None", linear: "One way", swirl: "Swirl", radial: "Outwards", turbulent: "Eddies" };
2029
2101
  var WetPanel = ({ controller, className }) => {
2030
2102
  const state = usePaintEditorState(controller);
@@ -2034,31 +2106,31 @@ var WetPanel = ({ controller, className }) => {
2034
2106
  const info = layerId ? controller.wetLayerInfo(layerId) : null;
2035
2107
  const livePattern = layerId ? controller.getLivePatterns(layerId).layers[0] ?? null : null;
2036
2108
  const backend = controller.wetState();
2037
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "wet-panel", children: [
2038
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center justify-between", children: [
2039
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: wet.wet ? "text-sky-300" : "text-slate-400", "data-testid": "wet-status", children: wet.wet ? wet.paused ? "Wet (paused)" : "Wet" : "Dry" }),
2040
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "text-[10px] text-slate-500", children: [
2109
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "wet-panel", children: [
2110
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center justify-between", children: [
2111
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: wet.wet ? "text-sky-300" : "text-slate-400", "data-testid": "wet-status", children: wet.wet ? wet.paused ? "Wet (paused)" : "Wet" : "Dry" }),
2112
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "text-[10px] text-slate-500", children: [
2041
2113
  "step ",
2042
2114
  wet.clock
2043
2115
  ] })
2044
2116
  ] }),
2045
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2046
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, disabled: !wet.layerIds.length, onClick: () => attempt(async () => (await controller.wetIdle(), controller.dryPaint())), children: "Dry now" }),
2047
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: chip(wet.paused), "aria-pressed": wet.paused, onClick: () => controller.setWetPaused(!wet.paused), children: wet.paused ? "Resume" : "Pause" }),
2048
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: chip(wet.overlay), "aria-pressed": wet.overlay, onClick: () => controller.setWaterOverlay(!wet.overlay), children: "Water" }),
2049
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: chip(wet.instantDry), "aria-pressed": wet.instantDry, title: "Each wet stroke dries as soon as it ends", onClick: () => controller.setInstantDry(!wet.instantDry), children: "Instant dry" }),
2050
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, disabled: !layerId, onClick: () => attempt(async () => (await controller.wetIdle(), controller.wetPaper({}))), children: "Wet paper" })
2117
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2118
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, disabled: !wet.layerIds.length, onClick: () => attempt(async () => (await controller.wetIdle(), controller.dryPaint())), children: "Dry now" }),
2119
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: chip(wet.paused), "aria-pressed": wet.paused, onClick: () => controller.setWetPaused(!wet.paused), children: wet.paused ? "Resume" : "Pause" }),
2120
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: chip(wet.overlay), "aria-pressed": wet.overlay, onClick: () => controller.setWaterOverlay(!wet.overlay), children: "Water" }),
2121
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: chip(wet.instantDry), "aria-pressed": wet.instantDry, title: "Each wet stroke dries as soon as it ends", onClick: () => controller.setInstantDry(!wet.instantDry), children: "Instant dry" }),
2122
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, disabled: !layerId, onClick: () => attempt(async () => (await controller.wetIdle(), controller.wetPaper({}))), children: "Wet paper" })
2051
2123
  ] }),
2052
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PaintSlider, { control: import_paint_editor11.WET_SPEED_SLIDER, value: wet.speed, onChange: (v) => controller.setWetSpeed(v) }),
2053
- import_paint_editor11.WET_TILT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor11.readPath)(wet.tilt, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setCanvasTilt({ [c.path]: v }))) }, c.path)),
2054
- info && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-layer", children: [
2055
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "font-medium text-slate-300", children: "This layer" }),
2056
- import_paint_editor11.WET_PARAM_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor11.readPath)(info.params, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setWetParams(layerId, { [c.path]: v }))) }, c.path)),
2057
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2058
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-slate-400", children: "Flow map" }),
2059
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("select", { "aria-label": "Flow map", value: info.flow.kind, onChange: (e) => attempt(async () => (await controller.wetIdle(), controller.setFlowMap(layerId, { kind: e.target.value }))), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor11.WET_FLOW_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: k, children: FLOW_LABELS[k] }, k)) })
2124
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PaintSlider, { control: import_paint_editor12.WET_SPEED_SLIDER, value: wet.speed, onChange: (v) => controller.setWetSpeed(v) }),
2125
+ import_paint_editor12.WET_TILT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor12.readPath)(wet.tilt, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setCanvasTilt({ [c.path]: v }))) }, c.path)),
2126
+ info && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-layer", children: [
2127
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "font-medium text-slate-300", children: "This layer" }),
2128
+ import_paint_editor12.WET_PARAM_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor12.readPath)(info.params, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setWetParams(layerId, { [c.path]: v }))) }, c.path)),
2129
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2130
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-slate-400", children: "Flow map" }),
2131
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("select", { "aria-label": "Flow map", value: info.flow.kind, onChange: (e) => attempt(async () => (await controller.wetIdle(), controller.setFlowMap(layerId, { kind: e.target.value }))), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor12.WET_FLOW_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: k, children: FLOW_LABELS[k] }, k)) })
2060
2132
  ] }),
2061
- info.flow.kind !== "none" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2133
+ info.flow.kind !== "none" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2062
2134
  PaintSlider,
2063
2135
  {
2064
2136
  control: { path: "strength", label: "Flow strength", min: 0, max: 1, step: 0.01 },
@@ -2067,10 +2139,10 @@ var WetPanel = ({ controller, className }) => {
2067
2139
  }
2068
2140
  )
2069
2141
  ] }),
2070
- livePattern && layerId && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-live-patterns", children: [
2071
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center justify-between", children: [
2072
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "font-medium text-slate-300", children: "Live patterns" }),
2073
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2142
+ livePattern && layerId && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-live-patterns", children: [
2143
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center justify-between", children: [
2144
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "font-medium text-slate-300", children: "Live patterns" }),
2145
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2074
2146
  "button",
2075
2147
  {
2076
2148
  type: "button",
@@ -2085,35 +2157,35 @@ var WetPanel = ({ controller, className }) => {
2085
2157
  }
2086
2158
  )
2087
2159
  ] }),
2088
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2089
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-slate-400", children: "Pattern" }),
2090
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2160
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2161
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-slate-400", children: "Pattern" }),
2162
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2091
2163
  "select",
2092
2164
  {
2093
2165
  "aria-label": "Live pattern",
2094
2166
  value: livePattern.settings.pattern,
2095
2167
  onChange: (e) => attempt(async () => (await controller.wetIdle(), controller.setLivePatterns(layerId, { pattern: e.target.value }))),
2096
2168
  className: "rounded bg-slate-800 px-1 py-0.5",
2097
- children: import_paint_editor11.LIVE_PATTERN_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: k, children: import_paint_editor11.LIVE_PATTERN_LABELS[k] }, k))
2169
+ children: import_paint_editor12.LIVE_PATTERN_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: k, children: import_paint_editor12.LIVE_PATTERN_LABELS[k] }, k))
2098
2170
  }
2099
2171
  )
2100
2172
  ] }),
2101
- import_paint_editor11.LIVE_PATTERN_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor11.readPath)(livePattern.settings, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setLivePatterns(layerId, { [c.path]: v }))) }, c.path))
2173
+ import_paint_editor12.LIVE_PATTERN_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor12.readPath)(livePattern.settings, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setLivePatterns(layerId, { [c.path]: v }))) }, c.path))
2102
2174
  ] }),
2103
- backend.message && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[10px] text-amber-300", "data-testid": "wet-message", children: backend.message }),
2104
- backend.backend && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[10px] text-slate-500", children: backend.backend.kind === "wasm-threads" ? `WebAssembly, ${backend.backend.threads} threads` : backend.backend.kind === "wasm" ? "WebAssembly, one thread" : "JavaScript" }),
2105
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2106
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-slate-400", children: "Engine" }),
2107
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("select", { "aria-label": "Wet engine", value: wet.gpu, onChange: (e) => attempt(() => controller.setWetEngine({ gpu: e.target.value })), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor11.WET_GPU_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: o.value, children: o.label }, o.value)) })
2175
+ backend.message && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-[10px] text-amber-300", "data-testid": "wet-message", children: backend.message }),
2176
+ backend.backend && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-[10px] text-slate-500", children: backend.backend.kind === "wasm-threads" ? `WebAssembly, ${backend.backend.threads} threads` : backend.backend.kind === "wasm" ? "WebAssembly, one thread" : "JavaScript" }),
2177
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2178
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-slate-400", children: "Engine" }),
2179
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("select", { "aria-label": "Wet engine", value: wet.gpu, onChange: (e) => attempt(() => controller.setWetEngine({ gpu: e.target.value })), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor12.WET_GPU_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: o.value, children: o.label }, o.value)) })
2108
2180
  ] }),
2109
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: `text-[10px] ${backend.engine.state === "active" ? "text-emerald-300" : "text-slate-500"}`, "data-testid": "wet-engine", children: (0, import_paint_editor11.wetEngineSummary)(backend.engine) }),
2110
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ErrorLine, { error })
2181
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: `text-[10px] ${backend.engine.state === "active" ? "text-emerald-300" : "text-slate-500"}`, "data-testid": "wet-engine", children: (0, import_paint_editor12.wetEngineSummary)(backend.engine) }),
2182
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ErrorLine, { error })
2111
2183
  ] });
2112
2184
  };
2113
2185
 
2114
2186
  // src/paint-editor/StickerPanel.tsx
2115
- var import_paint_editor12 = require("@pixerate/editor/paint-editor");
2116
- var import_jsx_runtime18 = require("react/jsx-runtime");
2187
+ var import_paint_editor13 = require("@pixerate/editor/paint-editor");
2188
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2117
2189
  var StickerPanel = ({ controller, className }) => {
2118
2190
  const state = usePaintEditorState(controller);
2119
2191
  const [error, attempt] = useAttempt();
@@ -2123,16 +2195,16 @@ var StickerPanel = ({ controller, className }) => {
2123
2195
  const stickers = layerId ? state.document.stickers?.[layerId] ?? [] : [];
2124
2196
  if (!stickers.length) return null;
2125
2197
  const sel = stickers.find((s) => s.id === picked) ?? null;
2126
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "sticker-panel", children: [
2127
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "font-medium text-slate-300", children: [
2198
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "sticker-panel", children: [
2199
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "font-medium text-slate-300", children: [
2128
2200
  "Stickers (",
2129
2201
  stickers.length,
2130
2202
  ")"
2131
2203
  ] }),
2132
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex max-h-24 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Stickers", children: stickers.map((s) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", role: "option", "aria-selected": s.id === picked, title: `${(0, import_paint_editor12.stickerRefLabel)(s.ref)} ${s.id}`, className: `h-5 w-5 rounded ring-1 ${s.id === picked ? "ring-indigo-400" : "ring-slate-700"}`, style: { background: s.color }, onClick: () => setPicked(s.id) }, s.id)) }),
2133
- sel && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "sticker-edit", children: [
2134
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-slate-400", children: "Sticker" }),
2135
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2204
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex max-h-24 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Stickers", children: stickers.map((s) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", role: "option", "aria-selected": s.id === picked, title: `${(0, import_paint_editor13.stickerRefLabel)(s.ref)} ${s.id}`, className: `h-5 w-5 rounded ring-1 ${s.id === picked ? "ring-indigo-400" : "ring-slate-700"}`, style: { background: s.color }, onClick: () => setPicked(s.id) }, s.id)) }),
2205
+ sel && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "sticker-edit", children: [
2206
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-slate-400", children: "Sticker" }),
2207
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2136
2208
  StickerPicker,
2137
2209
  {
2138
2210
  controller,
@@ -2146,9 +2218,9 @@ var StickerPanel = ({ controller, className }) => {
2146
2218
  )
2147
2219
  }
2148
2220
  ),
2149
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
2150
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-slate-400", children: "Position" }),
2151
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "flex gap-1", children: ["x", "y"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2221
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
2222
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-slate-400", children: "Position" }),
2223
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "flex gap-1", children: ["x", "y"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2152
2224
  "input",
2153
2225
  {
2154
2226
  type: "number",
@@ -2162,24 +2234,24 @@ var StickerPanel = ({ controller, className }) => {
2162
2234
  `${sel.id}-${k}-${sel[k]}`
2163
2235
  )) })
2164
2236
  ] }),
2165
- import_paint_editor12.STICKER_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor12.readPath)(sel, c.path), onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { [c.path]: v })) }, c.path)),
2166
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center justify-between", children: [
2167
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-slate-400", children: "Colour" }),
2168
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CommitColorInput, { label: "Sticker colour", value: sel.color, onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { color: v })), className: "h-6 w-10 rounded bg-transparent" })
2237
+ import_paint_editor13.STICKER_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor13.readPath)(sel, c.path), onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { [c.path]: v })) }, c.path)),
2238
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center justify-between", children: [
2239
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-slate-400", children: "Colour" }),
2240
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CommitColorInput, { label: "Sticker colour", value: sel.color, onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { color: v })), className: "h-6 w-10 rounded bg-transparent" })
2169
2241
  ] }),
2170
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2171
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "front")), children: "To front" }),
2172
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "back")), children: "To back" }),
2173
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStickers(layerId, [sel.id]), setPicked(null))), children: "Delete" })
2242
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2243
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "front")), children: "To front" }),
2244
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "back")), children: "To back" }),
2245
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStickers(layerId, [sel.id]), setPicked(null))), children: "Delete" })
2174
2246
  ] })
2175
2247
  ] }),
2176
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ErrorLine, { error })
2248
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ErrorLine, { error })
2177
2249
  ] });
2178
2250
  };
2179
2251
 
2180
2252
  // src/paint-editor/StrokePanel.tsx
2181
- var import_paint_editor13 = require("@pixerate/editor/paint-editor");
2182
- var import_jsx_runtime19 = require("react/jsx-runtime");
2253
+ var import_paint_editor14 = require("@pixerate/editor/paint-editor");
2254
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2183
2255
  var StrokePanel = ({ controller, className }) => {
2184
2256
  const state = usePaintEditorState(controller);
2185
2257
  const [error, attempt] = useAttempt();
@@ -2188,17 +2260,17 @@ var StrokePanel = ({ controller, className }) => {
2188
2260
  if (!layerId || !strokes) return null;
2189
2261
  const index = strokes.findIndex((s) => s.id === state.selectedStroke);
2190
2262
  const sel = index >= 0 ? strokes[index] : null;
2191
- const brushes = state.brushes.filter((b) => !(0, import_paint_editor13.liveStrokeRefusal)(b));
2192
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "stroke-panel", children: [
2193
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between", children: [
2194
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "font-medium text-slate-300", children: [
2263
+ const brushes = state.brushes.filter((b) => !(0, import_paint_editor14.liveStrokeRefusal)(b));
2264
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "stroke-panel", children: [
2265
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between", children: [
2266
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "font-medium text-slate-300", children: [
2195
2267
  "Strokes (",
2196
2268
  strokes.length,
2197
2269
  ")"
2198
2270
  ] }),
2199
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.rasterizeLiveStrokes(layerId)), children: "Rasterize" })
2271
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.rasterizeLiveStrokes(layerId)), children: "Rasterize" })
2200
2272
  ] }),
2201
- /* @__PURE__ */ (0, import_jsx_runtime19.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_runtime19.jsx)(
2273
+ /* @__PURE__ */ (0, import_jsx_runtime20.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_runtime20.jsx)(
2202
2274
  "button",
2203
2275
  {
2204
2276
  type: "button",
@@ -2211,10 +2283,10 @@ var StrokePanel = ({ controller, className }) => {
2211
2283
  },
2212
2284
  s.id
2213
2285
  )) }),
2214
- sel && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "stroke-edit", children: [
2215
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2216
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-slate-400", children: "Brush" }),
2217
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2286
+ sel && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "stroke-edit", children: [
2287
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2288
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "Brush" }),
2289
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2218
2290
  "select",
2219
2291
  {
2220
2292
  "aria-label": "Stroke brush",
@@ -2222,41 +2294,41 @@ var StrokePanel = ({ controller, className }) => {
2222
2294
  onChange: (e) => e.target.value && attempt(() => controller.updateStroke(sel.id, { brushId: e.target.value })),
2223
2295
  className: "max-w-[10rem] rounded bg-slate-800 px-1 py-0.5",
2224
2296
  children: [
2225
- !brushes.some((b) => b.id === sel.brush.id) && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "", children: sel.brush.name }),
2226
- brushes.map((b) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: b.id, children: b.name }, b.id))
2297
+ !brushes.some((b) => b.id === sel.brush.id) && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "", children: sel.brush.name }),
2298
+ brushes.map((b) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: b.id, children: b.name }, b.id))
2227
2299
  ]
2228
2300
  }
2229
2301
  )
2230
2302
  ] }),
2231
- import_paint_editor13.STROKE_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime19.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)),
2232
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center justify-between", children: [
2233
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-slate-400", children: "Colour" }),
2234
- /* @__PURE__ */ (0, import_jsx_runtime19.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" })
2303
+ import_paint_editor14.STROKE_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor14.readPath)(sel.brush, c.path), onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { brush: { tip: { [c.path.split(".")[1]]: v } } })) }, c.path)),
2304
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center justify-between", children: [
2305
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "Colour" }),
2306
+ /* @__PURE__ */ (0, import_jsx_runtime20.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" })
2235
2307
  ] }),
2236
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2237
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.updateStroke(sel.id, { seed: (sel.seed + 1) % 2147483647 })), children: "New seed" }),
2238
- /* @__PURE__ */ (0, import_jsx_runtime19.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" }),
2239
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, disabled: index === 0, "aria-label": "Move stroke down", onClick: () => attempt(() => controller.reorderStroke(sel.id, index - 1)), children: "\u2193" }),
2240
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStrokes([sel.id]), controller.selectStroke(null))), children: "Delete" })
2308
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2309
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.updateStroke(sel.id, { seed: (sel.seed + 1) % 2147483647 })), children: "New seed" }),
2310
+ /* @__PURE__ */ (0, import_jsx_runtime20.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" }),
2311
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, disabled: index === 0, "aria-label": "Move stroke down", onClick: () => attempt(() => controller.reorderStroke(sel.id, index - 1)), children: "\u2193" }),
2312
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStrokes([sel.id]), controller.selectStroke(null))), children: "Delete" })
2241
2313
  ] })
2242
2314
  ] }),
2243
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ErrorLine, { error })
2315
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ErrorLine, { error })
2244
2316
  ] });
2245
2317
  };
2246
2318
 
2247
2319
  // src/paint-editor/PathStrokePanel.tsx
2248
2320
  var import_react17 = require("react");
2249
- var import_paint_editor14 = require("@pixerate/editor/paint-editor");
2250
- var import_jsx_runtime20 = require("react/jsx-runtime");
2321
+ var import_paint_editor15 = require("@pixerate/editor/paint-editor");
2322
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2251
2323
  var PathStrokePanel = ({ controller, className }) => {
2252
2324
  const state = usePaintEditorState(controller);
2253
2325
  const [error, attempt] = useAttempt();
2254
2326
  const [path, setPath] = (0, import_react17.useState)("");
2255
- const [taper, setTaper] = (0, import_react17.useState)(import_paint_editor14.PATH_STROKE_TAPERS[0].id);
2256
- const pressure = import_paint_editor14.PATH_STROKE_TAPERS.find((t) => t.id === taper)?.pressure;
2257
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "path-stroke-panel", children: [
2258
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "font-medium text-slate-300", children: "Brush a path" }),
2259
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2327
+ const [taper, setTaper] = (0, import_react17.useState)(import_paint_editor15.PATH_STROKE_TAPERS[0].id);
2328
+ const pressure = import_paint_editor15.PATH_STROKE_TAPERS.find((t) => t.id === taper)?.pressure;
2329
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "path-stroke-panel", children: [
2330
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "font-medium text-slate-300", children: "Brush a path" }),
2331
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2260
2332
  "textarea",
2261
2333
  {
2262
2334
  "aria-label": "SVG path data",
@@ -2267,18 +2339,18 @@ var PathStrokePanel = ({ controller, className }) => {
2267
2339
  className: "w-full resize-y rounded bg-slate-800 px-1 py-0.5 font-mono text-[11px]"
2268
2340
  }
2269
2341
  ),
2270
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
2271
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("select", { "aria-label": "Pressure along the path", value: taper, onChange: (e) => setTaper(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor14.PATH_STROKE_TAPERS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: t.id, children: t.label }, t.id)) }),
2272
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, disabled: !path.trim() || state.stroking, onClick: () => attempt(() => controller.strokePath({ path, ...pressure ? { pressure } : {} })), children: "Brush path" })
2342
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", children: [
2343
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("select", { "aria-label": "Pressure along the path", value: taper, onChange: (e) => setTaper(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor15.PATH_STROKE_TAPERS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: t.id, children: t.label }, t.id)) }),
2344
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, disabled: !path.trim() || state.stroking, onClick: () => attempt(() => controller.strokePath({ path, ...pressure ? { pressure } : {} })), children: "Brush path" })
2273
2345
  ] }),
2274
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ErrorLine, { error })
2346
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ErrorLine, { error })
2275
2347
  ] });
2276
2348
  };
2277
2349
 
2278
2350
  // src/paint-editor/EvolutionPanel.tsx
2279
2351
  var import_react18 = require("react");
2280
- var import_paint_editor15 = require("@pixerate/editor/paint-editor");
2281
- var import_jsx_runtime21 = require("react/jsx-runtime");
2352
+ var import_paint_editor16 = require("@pixerate/editor/paint-editor");
2353
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2282
2354
  var EvolutionPanel = ({ controller, proposals, className }) => {
2283
2355
  const state = usePaintEditorState(controller);
2284
2356
  const store = proposals ?? controller.proposals;
@@ -2288,12 +2360,12 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2288
2360
  const [selectedProposals, setSelectedProposals] = (0, import_react18.useState)([]);
2289
2361
  const [count, setCount] = (0, import_react18.useState)(4);
2290
2362
  const [seed, setSeed] = (0, import_react18.useState)(1);
2291
- const [mutation, setMutation] = (0, import_react18.useState)(() => (0, import_paint_editor15.normalizeMutationRates)());
2363
+ const [mutation, setMutation] = (0, import_react18.useState)(() => (0, import_paint_editor16.normalizeMutationRates)());
2292
2364
  const [contactSheetUrl, setContactSheetUrl] = (0, import_react18.useState)(null);
2293
- const eligibleStrokes = state.document.strokes.filter((s) => !(0, import_paint_editor15.liveStrokeRefusal)(s.brush));
2365
+ const eligibleStrokes = state.document.strokes.filter((s) => !(0, import_paint_editor16.liveStrokeRefusal)(s.brush));
2294
2366
  const activeStrokeIds = selectedStrokes.filter((id) => eligibleStrokes.some((s) => s.id === id));
2295
2367
  const effectiveStrokeIds = activeStrokeIds.length > 0 ? activeStrokeIds : state.selectedStroke && eligibleStrokes.some((s) => s.id === state.selectedStroke) ? [state.selectedStroke] : eligibleStrokes.length > 0 ? [eligibleStrokes[eligibleStrokes.length - 1].id] : [];
2296
- const variants = proposalState.proposals.filter((p) => (0, import_paint_editor15.proposalGenomeStrokes)(p).length > 0);
2368
+ const variants = proposalState.proposals.filter((p) => (0, import_paint_editor16.proposalGenomeStrokes)(p).length > 0);
2297
2369
  const activeProposalIds = selectedProposals.filter((id) => variants.some((v) => v.id === id));
2298
2370
  const toggleStroke = (id) => {
2299
2371
  setSelectedStrokes((prev) => prev.includes(id) ? prev.filter((x) => x !== id) : [...prev.slice(-15), id]);
@@ -2301,16 +2373,16 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2301
2373
  const toggleProposal = (id) => {
2302
2374
  setSelectedProposals((prev) => prev.includes(id) ? prev.filter((x) => x !== id) : [...prev.slice(-1), id]);
2303
2375
  };
2304
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "evolution-panel", children: [
2305
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between", children: [
2306
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "font-medium text-slate-300", children: [
2376
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "evolution-panel", children: [
2377
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center justify-between", children: [
2378
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "font-medium text-slate-300", children: [
2307
2379
  "Evolution (",
2308
2380
  eligibleStrokes.length,
2309
2381
  ")"
2310
2382
  ] }),
2311
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1 text-[11px] text-slate-400", children: [
2312
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "Count" }),
2313
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2383
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1 text-[11px] text-slate-400", children: [
2384
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: "Count" }),
2385
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2314
2386
  "input",
2315
2387
  {
2316
2388
  type: "number",
@@ -2324,9 +2396,9 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2324
2396
  )
2325
2397
  ] }) })
2326
2398
  ] }),
2327
- eligibleStrokes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex max-h-20 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Parent strokes", children: eligibleStrokes.map((s, i) => {
2399
+ eligibleStrokes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex max-h-20 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Parent strokes", children: eligibleStrokes.map((s, i) => {
2328
2400
  const on = effectiveStrokeIds.includes(s.id);
2329
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2401
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2330
2402
  "button",
2331
2403
  {
2332
2404
  type: "button",
@@ -2340,9 +2412,9 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2340
2412
  s.id
2341
2413
  );
2342
2414
  }) }),
2343
- import_paint_editor15.EVOLUTION_SLIDERS.map((c) => {
2415
+ import_paint_editor16.EVOLUTION_SLIDERS.map((c) => {
2344
2416
  const key = c.path;
2345
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2417
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2346
2418
  PaintSlider,
2347
2419
  {
2348
2420
  control: c,
@@ -2352,8 +2424,8 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2352
2424
  c.path
2353
2425
  );
2354
2426
  }),
2355
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2356
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2427
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2428
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2357
2429
  "button",
2358
2430
  {
2359
2431
  type: "button",
@@ -2366,7 +2438,7 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2366
2438
  children: "Breed strokes"
2367
2439
  }
2368
2440
  ),
2369
- activeProposalIds.length === 2 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2441
+ activeProposalIds.length === 2 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2370
2442
  "button",
2371
2443
  {
2372
2444
  type: "button",
@@ -2379,29 +2451,29 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2379
2451
  children: "Cross over (2)"
2380
2452
  }
2381
2453
  ),
2382
- variants.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2454
+ variants.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2383
2455
  "button",
2384
2456
  {
2385
2457
  type: "button",
2386
2458
  className: button,
2387
2459
  onClick: () => attempt(() => {
2388
- const sheet = (0, import_paint_editor15.exportProposalContactSheetPng)(controller, variants);
2460
+ const sheet = (0, import_paint_editor16.exportProposalContactSheetPng)(controller, variants);
2389
2461
  setContactSheetUrl(`data:image/png;base64,${sheet.base64}`);
2390
2462
  }),
2391
2463
  children: "Contact sheet"
2392
2464
  }
2393
2465
  )
2394
2466
  ] }),
2395
- variants.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "grid grid-cols-2 gap-1.5", "data-testid": "evolution-grid", children: variants.map((p) => {
2396
- const g = (0, import_paint_editor15.paintProposalGhost)(p);
2467
+ variants.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "grid grid-cols-2 gap-1.5", "data-testid": "evolution-grid", children: variants.map((p) => {
2468
+ const g = (0, import_paint_editor16.paintProposalGhost)(p);
2397
2469
  const picked = activeProposalIds.includes(p.id);
2398
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2470
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2399
2471
  "div",
2400
2472
  {
2401
2473
  "data-testid": `evolution-variant-${p.id}`,
2402
2474
  className: `flex flex-col gap-1 rounded border p-1.5 ${picked ? "border-indigo-500 bg-slate-800/90" : "border-slate-800 bg-slate-950/60"}`,
2403
2475
  children: [
2404
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex items-center justify-between gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2476
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex items-center justify-between gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2405
2477
  "button",
2406
2478
  {
2407
2479
  type: "button",
@@ -2411,10 +2483,10 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2411
2483
  children: p.title
2412
2484
  }
2413
2485
  ) }),
2414
- g && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex h-16 items-center justify-center overflow-hidden rounded bg-slate-900/80 p-1", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PixelCanvas, { pixels: g, label: p.title, className: "max-h-full max-w-full object-contain" }) }),
2415
- p.rationale && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "line-clamp-2 text-[10px] text-slate-400", title: p.rationale, children: p.rationale }),
2416
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2417
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2486
+ g && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex h-16 items-center justify-center overflow-hidden rounded bg-slate-900/80 p-1", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PixelCanvas, { pixels: g, label: p.title, className: "max-h-full max-w-full object-contain" }) }),
2487
+ p.rationale && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "line-clamp-2 text-[10px] text-slate-400", title: p.rationale, children: p.rationale }),
2488
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2489
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2418
2490
  "button",
2419
2491
  {
2420
2492
  type: "button",
@@ -2427,26 +2499,26 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2427
2499
  children: "Breed from"
2428
2500
  }
2429
2501
  ),
2430
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => store.accept(p.id)), children: "Accept" }),
2431
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => store.reject(p.id)), children: "Dismiss" })
2502
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => store.accept(p.id)), children: "Accept" }),
2503
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => store.reject(p.id)), children: "Dismiss" })
2432
2504
  ] })
2433
2505
  ]
2434
2506
  },
2435
2507
  p.id
2436
2508
  );
2437
2509
  }) }),
2438
- contactSheetUrl && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("img", { src: contactSheetUrl, alt: "Variant contact sheet", className: "w-full rounded border border-slate-800", "data-testid": "evolution-contact-sheet" }),
2439
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ErrorLine, { error })
2510
+ contactSheetUrl && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("img", { src: contactSheetUrl, alt: "Variant contact sheet", className: "w-full rounded border border-slate-800", "data-testid": "evolution-contact-sheet" }),
2511
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ErrorLine, { error })
2440
2512
  ] });
2441
2513
  };
2442
2514
 
2443
2515
  // src/paint-editor/PaintEditor.tsx
2444
2516
  var import_react32 = require("react");
2445
- var import_paint_editor17 = require("@pixerate/editor/paint-editor");
2517
+ var import_paint_editor18 = require("@pixerate/editor/paint-editor");
2446
2518
 
2447
2519
  // src/playback/AgentPlaybackContext.tsx
2448
2520
  var import_react19 = require("react");
2449
- var import_jsx_runtime22 = require("react/jsx-runtime");
2521
+ var import_jsx_runtime23 = require("react/jsx-runtime");
2450
2522
  var AgentPlaybackContext = (0, import_react19.createContext)(null);
2451
2523
  function useAgentPlayback() {
2452
2524
  return (0, import_react19.useContext)(AgentPlaybackContext);
@@ -2495,12 +2567,12 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
2495
2567
 
2496
2568
  // src/playback/PresenceLayer.tsx
2497
2569
  var import_react21 = __toESM(require("react"), 1);
2498
- var import_jsx_runtime23 = require("react/jsx-runtime");
2570
+ var import_jsx_runtime24 = require("react/jsx-runtime");
2499
2571
  function PresenceLayer({ presence, viewport, clip = true, renderCursor, className = "" }) {
2500
2572
  const { actors } = (0, import_react21.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
2501
2573
  if (!actors.length) return null;
2502
2574
  const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
2503
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2575
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2504
2576
  "div",
2505
2577
  {
2506
2578
  className: `pixerate-presence ${className}`.trim(),
@@ -2514,19 +2586,19 @@ function PresenceLayer({ presence, viewport, clip = true, renderCursor, classNam
2514
2586
  const br = map({ x: a.focus.x + a.focus.width, y: a.focus.y + a.focus.height });
2515
2587
  return { left: tl.x - 4, top: tl.y - 4, width: br.x - tl.x + 8, height: br.y - tl.y + 8 };
2516
2588
  })();
2517
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react21.default.Fragment, { children: [
2518
- ring && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2589
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react21.default.Fragment, { children: [
2590
+ ring && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2519
2591
  "div",
2520
2592
  {
2521
2593
  "data-actor-focus": a.id,
2522
2594
  style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
2523
2595
  }
2524
2596
  ),
2525
- /* @__PURE__ */ (0, import_jsx_runtime23.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_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
2526
- /* @__PURE__ */ (0, import_jsx_runtime23.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_runtime23.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 } }) }),
2527
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
2528
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
2529
- a.message && /* @__PURE__ */ (0, import_jsx_runtime23.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 })
2597
+ /* @__PURE__ */ (0, import_jsx_runtime24.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_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
2598
+ /* @__PURE__ */ (0, import_jsx_runtime24.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_runtime24.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 } }) }),
2599
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
2600
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
2601
+ a.message && /* @__PURE__ */ (0, import_jsx_runtime24.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 })
2530
2602
  ] })
2531
2603
  ] }) })
2532
2604
  ] }, a.id);
@@ -2537,7 +2609,7 @@ function PresenceLayer({ presence, viewport, clip = true, renderCursor, classNam
2537
2609
 
2538
2610
  // src/paint-editor/PaintEffectsPanel.tsx
2539
2611
  var import_react31 = require("react");
2540
- var import_paint_editor16 = require("@pixerate/editor/paint-editor");
2612
+ var import_paint_editor17 = require("@pixerate/editor/paint-editor");
2541
2613
  var import_effects4 = require("@pixerate/editor/effects");
2542
2614
 
2543
2615
  // src/effects/useEffects.ts
@@ -2562,7 +2634,7 @@ function useEffectDescription(provider, effect) {
2562
2634
  // src/effects/EffectThumbnail.tsx
2563
2635
  var import_react23 = require("react");
2564
2636
  var import_effects = require("@pixerate/editor/effects");
2565
- var import_jsx_runtime24 = require("react/jsx-runtime");
2637
+ var import_jsx_runtime25 = require("react/jsx-runtime");
2566
2638
  var LABELS = { motion: "Motion", camera: "Camera", timing: "Timing" };
2567
2639
  function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
2568
2640
  const ref = (0, import_react23.useRef)(null);
@@ -2582,13 +2654,13 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
2582
2654
  live = false;
2583
2655
  };
2584
2656
  }, [provider, effect, width, height]);
2585
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2657
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2586
2658
  "div",
2587
2659
  {
2588
2660
  className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
2589
2661
  style: { aspectRatio: `${width} / ${height}` },
2590
2662
  "data-effect-thumbnail": effect.id,
2591
- children: failed ? /* @__PURE__ */ (0, import_jsx_runtime24.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_runtime24.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
2663
+ children: failed ? /* @__PURE__ */ (0, import_jsx_runtime25.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_runtime25.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
2592
2664
  }
2593
2665
  );
2594
2666
  }
@@ -2596,7 +2668,7 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
2596
2668
  // src/effects/EffectsBrowser.tsx
2597
2669
  var import_react24 = require("react");
2598
2670
  var import_effects2 = require("@pixerate/editor/effects");
2599
- var import_jsx_runtime25 = require("react/jsx-runtime");
2671
+ var import_jsx_runtime26 = require("react/jsx-runtime");
2600
2672
  function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
2601
2673
  const [all, setAll] = (0, import_react24.useState)([]);
2602
2674
  const [query, setQuery] = (0, import_react24.useState)("");
@@ -2627,11 +2699,11 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2627
2699
  const categories = (0, import_react24.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
2628
2700
  const shown = found.filter(allowed);
2629
2701
  if (!provider)
2630
- return /* @__PURE__ */ (0, import_jsx_runtime25.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." });
2631
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
2632
- title && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h3", { className: "text-xs font-semibold", children: title }),
2633
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2634
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2702
+ return /* @__PURE__ */ (0, import_jsx_runtime26.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." });
2703
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
2704
+ title && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h3", { className: "text-xs font-semibold", children: title }),
2705
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2706
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2635
2707
  "input",
2636
2708
  {
2637
2709
  type: "search",
@@ -2642,17 +2714,17 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2642
2714
  onChange: (e) => setQuery(e.currentTarget.value)
2643
2715
  }
2644
2716
  ),
2645
- /* @__PURE__ */ (0, import_jsx_runtime25.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: [
2646
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "", children: "All categories" }),
2647
- categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: c, children: c }, c))
2717
+ /* @__PURE__ */ (0, import_jsx_runtime26.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: [
2718
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: "", children: "All categories" }),
2719
+ categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: c, children: c }, c))
2648
2720
  ] }),
2649
- uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime25.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: [
2650
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: "", children: "Any use" }),
2651
- uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
2721
+ uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime26.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: [
2722
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: "", children: "Any use" }),
2723
+ uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
2652
2724
  ] })
2653
2725
  ] }),
2654
- error && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
2655
- /* @__PURE__ */ (0, import_jsx_runtime25.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_runtime25.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
2726
+ error && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
2727
+ /* @__PURE__ */ (0, import_jsx_runtime26.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_runtime26.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
2656
2728
  "button",
2657
2729
  {
2658
2730
  type: "button",
@@ -2661,13 +2733,13 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2661
2733
  "data-effect-id": e.id,
2662
2734
  onClick: () => onPick(e),
2663
2735
  children: [
2664
- thumbnails && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(EffectThumbnail, { provider, effect: e }),
2665
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
2666
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
2736
+ thumbnails && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(EffectThumbnail, { provider, effect: e }),
2737
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
2738
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
2667
2739
  ]
2668
2740
  }
2669
2741
  ) }, e.id)) }),
2670
- !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
2742
+ !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
2671
2743
  ] });
2672
2744
  }
2673
2745
 
@@ -2692,7 +2764,7 @@ __export(color_exports, {
2692
2764
  // src/color/ColorPicker.tsx
2693
2765
  var import_react25 = require("react");
2694
2766
  var import_color = require("@pixerate/editor/color");
2695
- var import_jsx_runtime26 = require("react/jsx-runtime");
2767
+ var import_jsx_runtime27 = require("react/jsx-runtime");
2696
2768
  var LOCAL_STORAGE_KEY = "pixerate:color:recent";
2697
2769
  function readLocalRecents() {
2698
2770
  try {
@@ -2899,7 +2971,7 @@ var ColorPicker = ({
2899
2971
  }, [value, contrastAgainst]);
2900
2972
  const currentHex = (0, import_color.pickerStateToHex)(pickerState, alpha);
2901
2973
  const liveDescription = `Selected color: ${value}${contrastResult ? `, contrast ${contrastResult.ratio.toFixed(1)}:1 against ${contrastAgainst}, ${contrastResult.aa ? "passes AA" : "fails AA"}` : ""}`;
2902
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
2974
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
2903
2975
  "div",
2904
2976
  {
2905
2977
  id: pickerId,
@@ -2923,7 +2995,7 @@ var ColorPicker = ({
2923
2995
  pointerEvents: disabled ? "none" : "auto"
2924
2996
  },
2925
2997
  children: [
2926
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2998
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2927
2999
  "span",
2928
3000
  {
2929
3001
  role: "status",
@@ -2942,7 +3014,7 @@ var ColorPicker = ({
2942
3014
  children: liveDescription
2943
3015
  }
2944
3016
  ),
2945
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3017
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2946
3018
  "div",
2947
3019
  {
2948
3020
  role: "slider",
@@ -2964,7 +3036,7 @@ var ColorPicker = ({
2964
3036
  touchAction: "none",
2965
3037
  outline: "none"
2966
3038
  },
2967
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3039
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2968
3040
  "div",
2969
3041
  {
2970
3042
  style: {
@@ -2984,7 +3056,7 @@ var ColorPicker = ({
2984
3056
  )
2985
3057
  }
2986
3058
  ),
2987
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3059
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2988
3060
  "div",
2989
3061
  {
2990
3062
  role: "slider",
@@ -3007,7 +3079,7 @@ var ColorPicker = ({
3007
3079
  touchAction: "none",
3008
3080
  outline: "none"
3009
3081
  },
3010
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3082
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3011
3083
  "div",
3012
3084
  {
3013
3085
  style: {
@@ -3027,7 +3099,7 @@ var ColorPicker = ({
3027
3099
  )
3028
3100
  }
3029
3101
  ),
3030
- alpha && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3102
+ alpha && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3031
3103
  "div",
3032
3104
  {
3033
3105
  role: "slider",
@@ -3053,7 +3125,7 @@ var ColorPicker = ({
3053
3125
  overflow: "hidden"
3054
3126
  },
3055
3127
  children: [
3056
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3128
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3057
3129
  "div",
3058
3130
  {
3059
3131
  style: {
@@ -3063,7 +3135,7 @@ var ColorPicker = ({
3063
3135
  }
3064
3136
  }
3065
3137
  ),
3066
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3138
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3067
3139
  "div",
3068
3140
  {
3069
3141
  style: {
@@ -3084,8 +3156,8 @@ var ColorPicker = ({
3084
3156
  ]
3085
3157
  }
3086
3158
  ),
3087
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
3088
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3159
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
3160
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3089
3161
  "div",
3090
3162
  {
3091
3163
  style: {
@@ -3099,7 +3171,7 @@ var ColorPicker = ({
3099
3171
  flexShrink: 0,
3100
3172
  border: "1px solid rgba(255,255,255,0.15)"
3101
3173
  },
3102
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3174
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3103
3175
  "div",
3104
3176
  {
3105
3177
  style: {
@@ -3111,7 +3183,7 @@ var ColorPicker = ({
3111
3183
  )
3112
3184
  }
3113
3185
  ),
3114
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3186
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3115
3187
  "input",
3116
3188
  {
3117
3189
  type: "text",
@@ -3141,7 +3213,7 @@ var ColorPicker = ({
3141
3213
  }
3142
3214
  }
3143
3215
  ),
3144
- hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3216
+ hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3145
3217
  "button",
3146
3218
  {
3147
3219
  type: "button",
@@ -3161,7 +3233,7 @@ var ColorPicker = ({
3161
3233
  color: "inherit",
3162
3234
  cursor: disabled ? "default" : "pointer"
3163
3235
  },
3164
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3236
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3165
3237
  "svg",
3166
3238
  {
3167
3239
  width: "14",
@@ -3173,16 +3245,16 @@ var ColorPicker = ({
3173
3245
  strokeLinecap: "round",
3174
3246
  strokeLinejoin: "round",
3175
3247
  children: [
3176
- /* @__PURE__ */ (0, import_jsx_runtime26.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" }),
3177
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
3178
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("path", { d: "m14 6 4 4" })
3248
+ /* @__PURE__ */ (0, import_jsx_runtime27.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" }),
3249
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
3250
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("path", { d: "m14 6 4 4" })
3179
3251
  ]
3180
3252
  }
3181
3253
  )
3182
3254
  }
3183
3255
  )
3184
3256
  ] }),
3185
- isClipped && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3257
+ isClipped && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3186
3258
  "div",
3187
3259
  {
3188
3260
  role: "note",
@@ -3198,10 +3270,10 @@ var ColorPicker = ({
3198
3270
  borderRadius: "4px",
3199
3271
  alignSelf: "flex-start"
3200
3272
  },
3201
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
3273
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
3202
3274
  }
3203
3275
  ),
3204
- contrastResult && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3276
+ contrastResult && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3205
3277
  "div",
3206
3278
  {
3207
3279
  style: {
@@ -3215,15 +3287,15 @@ var ColorPicker = ({
3215
3287
  border: "1px solid rgba(255,255,255,0.1)"
3216
3288
  },
3217
3289
  children: [
3218
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { children: [
3290
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { children: [
3219
3291
  "Contrast: ",
3220
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("strong", { children: [
3292
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("strong", { children: [
3221
3293
  contrastResult.ratio.toFixed(2),
3222
3294
  ":1"
3223
3295
  ] })
3224
3296
  ] }),
3225
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
3226
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3297
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
3298
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3227
3299
  "span",
3228
3300
  {
3229
3301
  style: {
@@ -3236,7 +3308,7 @@ var ColorPicker = ({
3236
3308
  ]
3237
3309
  }
3238
3310
  ),
3239
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3311
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3240
3312
  "span",
3241
3313
  {
3242
3314
  style: {
@@ -3253,9 +3325,9 @@ var ColorPicker = ({
3253
3325
  ]
3254
3326
  }
3255
3327
  ),
3256
- swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
3257
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
3258
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3328
+ swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
3329
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
3330
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3259
3331
  "button",
3260
3332
  {
3261
3333
  type: "button",
@@ -3281,9 +3353,9 @@ var ColorPicker = ({
3281
3353
  `${color}-${idx}`
3282
3354
  )) })
3283
3355
  ] }),
3284
- activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
3285
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
3286
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3356
+ activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
3357
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
3358
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3287
3359
  "button",
3288
3360
  {
3289
3361
  type: "button",
@@ -3316,7 +3388,7 @@ var ColorPicker = ({
3316
3388
  // src/color/DualColorPicker.tsx
3317
3389
  var import_react26 = require("react");
3318
3390
  var import_color2 = require("@pixerate/editor/color");
3319
- var import_jsx_runtime27 = require("react/jsx-runtime");
3391
+ var import_jsx_runtime28 = require("react/jsx-runtime");
3320
3392
  function DualColorPicker({
3321
3393
  value,
3322
3394
  onChange,
@@ -3375,7 +3447,7 @@ function DualColorPicker({
3375
3447
  const activeColor = activeScheme === "dark" ? dual.dark : dual.light;
3376
3448
  const activeContrastTarget = contrastAgainst ? (0, import_color2.resolveColor)(contrastAgainst, activeScheme) ?? void 0 : void 0;
3377
3449
  const dualContrast = contrastAgainst && (0, import_color2.normalizeDualColor)(contrastAgainst) ? (0, import_color2.checkDualColorContrast)(dual, contrastAgainst) : null;
3378
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3450
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3379
3451
  "div",
3380
3452
  {
3381
3453
  className: `pixerate-dual-color-picker ${className}`,
@@ -3394,7 +3466,7 @@ function DualColorPicker({
3394
3466
  boxSizing: "border-box"
3395
3467
  },
3396
3468
  children: [
3397
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3469
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3398
3470
  "div",
3399
3471
  {
3400
3472
  role: "tablist",
@@ -3407,7 +3479,7 @@ function DualColorPicker({
3407
3479
  gap: "2px"
3408
3480
  },
3409
3481
  children: [
3410
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3482
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3411
3483
  "button",
3412
3484
  {
3413
3485
  type: "button",
@@ -3430,7 +3502,7 @@ function DualColorPicker({
3430
3502
  children: "Light"
3431
3503
  }
3432
3504
  ),
3433
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3505
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3434
3506
  "button",
3435
3507
  {
3436
3508
  type: "button",
@@ -3456,8 +3528,8 @@ function DualColorPicker({
3456
3528
  ]
3457
3529
  }
3458
3530
  ),
3459
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
3460
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3531
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
3532
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3461
3533
  "button",
3462
3534
  {
3463
3535
  type: "button",
@@ -3479,7 +3551,7 @@ function DualColorPicker({
3479
3551
  outline: "none"
3480
3552
  },
3481
3553
  children: [
3482
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3554
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3483
3555
  "span",
3484
3556
  {
3485
3557
  style: {
@@ -3491,11 +3563,11 @@ function DualColorPicker({
3491
3563
  }
3492
3564
  }
3493
3565
  ),
3494
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
3566
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
3495
3567
  ]
3496
3568
  }
3497
3569
  ),
3498
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3570
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3499
3571
  "button",
3500
3572
  {
3501
3573
  type: "button",
@@ -3517,7 +3589,7 @@ function DualColorPicker({
3517
3589
  outline: "none"
3518
3590
  },
3519
3591
  children: [
3520
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3592
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3521
3593
  "span",
3522
3594
  {
3523
3595
  style: {
@@ -3529,12 +3601,12 @@ function DualColorPicker({
3529
3601
  }
3530
3602
  }
3531
3603
  ),
3532
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
3604
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
3533
3605
  ]
3534
3606
  }
3535
3607
  )
3536
3608
  ] }),
3537
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3609
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3538
3610
  "div",
3539
3611
  {
3540
3612
  style: {
@@ -3545,7 +3617,7 @@ function DualColorPicker({
3545
3617
  padding: "2px 0"
3546
3618
  },
3547
3619
  children: [
3548
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3620
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3549
3621
  "label",
3550
3622
  {
3551
3623
  htmlFor: sameId,
@@ -3559,7 +3631,7 @@ function DualColorPicker({
3559
3631
  color: "#c4cad4"
3560
3632
  },
3561
3633
  children: [
3562
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3634
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3563
3635
  "input",
3564
3636
  {
3565
3637
  id: sameId,
@@ -3570,11 +3642,11 @@ function DualColorPicker({
3570
3642
  style: { cursor: disabled ? "not-allowed" : "pointer" }
3571
3643
  }
3572
3644
  ),
3573
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Same in both" })
3645
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Same in both" })
3574
3646
  ]
3575
3647
  }
3576
3648
  ),
3577
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3649
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3578
3650
  "button",
3579
3651
  {
3580
3652
  type: "button",
@@ -3596,7 +3668,7 @@ function DualColorPicker({
3596
3668
  ]
3597
3669
  }
3598
3670
  ),
3599
- dualContrast && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3671
+ dualContrast && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3600
3672
  "div",
3601
3673
  {
3602
3674
  "data-testid": "dual-contrast-summary",
@@ -3610,20 +3682,20 @@ function DualColorPicker({
3610
3682
  color: "#8c95a6"
3611
3683
  },
3612
3684
  children: [
3613
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { children: [
3685
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { children: [
3614
3686
  "Light:",
3615
3687
  " ",
3616
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3688
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3617
3689
  dualContrast.light.ratio.toFixed(2),
3618
3690
  " (",
3619
3691
  dualContrast.light.level,
3620
3692
  ")"
3621
3693
  ] })
3622
3694
  ] }),
3623
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { children: [
3695
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { children: [
3624
3696
  "Dark:",
3625
3697
  " ",
3626
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3698
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3627
3699
  dualContrast.dark.ratio.toFixed(2),
3628
3700
  " (",
3629
3701
  dualContrast.dark.level,
@@ -3633,7 +3705,7 @@ function DualColorPicker({
3633
3705
  ]
3634
3706
  }
3635
3707
  ),
3636
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3708
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3637
3709
  ColorPicker,
3638
3710
  {
3639
3711
  value: activeColor,
@@ -3721,7 +3793,7 @@ __reExport(color_exports, require("@pixerate/editor/color"));
3721
3793
 
3722
3794
  // src/parameters/controls.tsx
3723
3795
  var import_react28 = require("react");
3724
- var import_jsx_runtime28 = require("react/jsx-runtime");
3796
+ var import_jsx_runtime29 = require("react/jsx-runtime");
3725
3797
  var ParameterComponentsContext = (0, import_react28.createContext)({});
3726
3798
  function useParameterComponents() {
3727
3799
  return (0, import_react28.useContext)(ParameterComponentsContext);
@@ -3736,7 +3808,7 @@ function resolveParameterComponents(explicit, context) {
3736
3808
  }
3737
3809
 
3738
3810
  // src/parameters/fields.tsx
3739
- var import_jsx_runtime29 = require("react/jsx-runtime");
3811
+ var import_jsx_runtime30 = require("react/jsx-runtime");
3740
3812
  var parameterInputStyle = import_parameters.parameterThemeStyles.input;
3741
3813
  var parameterSelectStyle = import_parameters.parameterThemeStyles.select;
3742
3814
  var parameterButtonStyle = import_parameters.parameterThemeStyles.button;
@@ -3791,7 +3863,7 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
3791
3863
  if (typeof forwarded === "function") forwarded(el);
3792
3864
  else if (forwarded) forwarded.current = el;
3793
3865
  };
3794
- return multiline ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("textarea", { ...props, ref: setRef, className: `${props.className} h-auto min-h-[3.5rem] py-1` }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("input", { type: "text", ...props, ref: setRef });
3866
+ return multiline ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("textarea", { ...props, ref: setRef, className: `${props.className} h-auto min-h-[3.5rem] py-1` }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "text", ...props, ref: setRef });
3795
3867
  }
3796
3868
  var plainNumber = (field, value) => (0, import_parameters.formatParameterNumber)({ ...field, unit: void 0 }, value);
3797
3869
  function ParameterNumberInput(props) {
@@ -3825,9 +3897,9 @@ function ParameterNumberInput(props) {
3825
3897
  onCommit: handleCommit,
3826
3898
  onKeyDown: handleKeyDown
3827
3899
  };
3828
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
3829
- CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field) }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ParameterCommitInput, { ...inputProps }),
3830
- field.unit && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
3900
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
3901
+ CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field) }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterCommitInput, { ...inputProps }),
3902
+ field.unit && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
3831
3903
  ] });
3832
3904
  }
3833
3905
  function ParameterSlider(props) {
@@ -3846,7 +3918,7 @@ function ParameterSlider(props) {
3846
3918
  dragging.current = false;
3847
3919
  onGestureEnd?.();
3848
3920
  };
3849
- if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ParameterNumberInput, { ...props });
3921
+ if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterNumberInput, { ...props });
3850
3922
  const step = (0, import_parameters.parameterStep)(field);
3851
3923
  const sliderProps = {
3852
3924
  "aria-label": (0, import_parameters.parameterLabel)(field),
@@ -3860,8 +3932,8 @@ function ParameterSlider(props) {
3860
3932
  className: rangeClass,
3861
3933
  style: parameterRangeStyle
3862
3934
  };
3863
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-2", children: [
3864
- CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3935
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-2", children: [
3936
+ CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3865
3937
  CustomSlider,
3866
3938
  {
3867
3939
  ...sliderProps,
@@ -3871,7 +3943,7 @@ function ParameterSlider(props) {
3871
3943
  onGestureStart: start,
3872
3944
  onGestureEnd: end
3873
3945
  }
3874
- ) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3946
+ ) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3875
3947
  "input",
3876
3948
  {
3877
3949
  type: "range",
@@ -3883,11 +3955,11 @@ function ParameterSlider(props) {
3883
3955
  onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field, Number(e.target.value)))
3884
3956
  }
3885
3957
  ),
3886
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
3958
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
3887
3959
  ] });
3888
3960
  }
3889
3961
  function ParameterToggle({ field, value, onChange, disabled, id }) {
3890
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3962
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3891
3963
  "button",
3892
3964
  {
3893
3965
  type: "button",
@@ -3898,7 +3970,7 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
3898
3970
  disabled: disabled || field.readOnly,
3899
3971
  onClick: () => onChange(!value),
3900
3972
  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"}`,
3901
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3973
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3902
3974
  "span",
3903
3975
  {
3904
3976
  className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
@@ -3915,7 +3987,7 @@ function ParameterSelect(props) {
3915
3987
  const options = (0, import_parameters.getChoiceOptions)(field);
3916
3988
  const off = disabled || field.readOnly;
3917
3989
  if (field.control === "segmented") {
3918
- return /* @__PURE__ */ (0, import_jsx_runtime29.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_runtime29.jsx)(
3990
+ return /* @__PURE__ */ (0, import_jsx_runtime30.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_runtime30.jsx)(
3919
3991
  "button",
3920
3992
  {
3921
3993
  type: "button",
@@ -3932,7 +4004,7 @@ function ParameterSelect(props) {
3932
4004
  }
3933
4005
  if (CustomSelect) {
3934
4006
  const customOptions = options.map((o) => ({ value: o.value, label: (0, import_parameters.choiceOptionLabel)(o), description: o.description }));
3935
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4007
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3936
4008
  CustomSelect,
3937
4009
  {
3938
4010
  id,
@@ -3948,7 +4020,7 @@ function ParameterSelect(props) {
3948
4020
  );
3949
4021
  }
3950
4022
  const index = options.findIndex((o) => o.value === value);
3951
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4023
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3952
4024
  "select",
3953
4025
  {
3954
4026
  id,
@@ -3961,7 +4033,7 @@ function ParameterSelect(props) {
3961
4033
  },
3962
4034
  className: parameterInputClass,
3963
4035
  style: parameterSelectStyle,
3964
- children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: String(i), title: o.description, style: parameterSelectStyle, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
4036
+ children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: String(i), title: o.description, style: parameterSelectStyle, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
3965
4037
  }
3966
4038
  );
3967
4039
  }
@@ -3999,7 +4071,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3999
4071
  };
4000
4072
  }, [open]);
4001
4073
  if (CustomColor) {
4002
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4074
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4003
4075
  CustomColor,
4004
4076
  {
4005
4077
  id,
@@ -4014,9 +4086,9 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
4014
4086
  }
4015
4087
  );
4016
4088
  }
4017
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
4018
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-2", children: [
4019
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4089
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
4090
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-2", children: [
4091
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4020
4092
  "button",
4021
4093
  {
4022
4094
  ref: buttonRef,
@@ -4027,10 +4099,10 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
4027
4099
  disabled: off,
4028
4100
  onClick: () => setOpen((prev) => !prev),
4029
4101
  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",
4030
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
4102
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
4031
4103
  }
4032
4104
  ),
4033
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4105
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4034
4106
  ParameterCommitInput,
4035
4107
  {
4036
4108
  id,
@@ -4046,7 +4118,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
4046
4118
  }
4047
4119
  )
4048
4120
  ] }),
4049
- open && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4121
+ open && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4050
4122
  "div",
4051
4123
  {
4052
4124
  ref: popoverRef,
@@ -4060,7 +4132,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
4060
4132
  },
4061
4133
  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",
4062
4134
  style: { background: "var(--popover, var(--background, #fff))" },
4063
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4135
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4064
4136
  ColorPicker,
4065
4137
  {
4066
4138
  value: shown,
@@ -4078,11 +4150,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
4078
4150
  }
4079
4151
  function ParameterVector({ field, value, onChange, disabled, id, components }) {
4080
4152
  const size = (0, import_parameters.vectorSize)(field);
4081
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
4153
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
4082
4154
  const component = (0, import_parameters.vectorComponentField)(field, i);
4083
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
4084
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
4085
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4155
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
4156
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
4157
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4086
4158
  ParameterNumberInput,
4087
4159
  {
4088
4160
  field: component,
@@ -4100,11 +4172,11 @@ function ParameterVector({ field, value, onChange, disabled, id, components }) {
4100
4172
  function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
4101
4173
  const off = disabled || field.readOnly;
4102
4174
  const name = (0, import_parameters.parameterLabel)(field);
4103
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "space-y-1.5", children: [
4104
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-2", children: [
4105
- /* @__PURE__ */ (0, import_jsx_runtime29.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_runtime29.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
4106
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
4107
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4175
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "space-y-1.5", children: [
4176
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-2", children: [
4177
+ /* @__PURE__ */ (0, import_jsx_runtime30.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_runtime30.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
4178
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
4179
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4108
4180
  ParameterCommitInput,
4109
4181
  {
4110
4182
  id,
@@ -4115,15 +4187,15 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
4115
4187
  onCommit: (text) => onChange(text.trim())
4116
4188
  }
4117
4189
  ),
4118
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex gap-1", children: [
4119
- resolveFile && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4190
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex gap-1", children: [
4191
+ resolveFile && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
4120
4192
  "label",
4121
4193
  {
4122
4194
  style: parameterButtonStyle,
4123
4195
  className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`,
4124
4196
  children: [
4125
4197
  "Choose file\u2026",
4126
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4198
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4127
4199
  "input",
4128
4200
  {
4129
4201
  type: "file",
@@ -4141,7 +4213,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
4141
4213
  ]
4142
4214
  }
4143
4215
  ),
4144
- value && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4216
+ value && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4145
4217
  "button",
4146
4218
  {
4147
4219
  type: "button",
@@ -4156,7 +4228,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
4156
4228
  ] })
4157
4229
  ] })
4158
4230
  ] }),
4159
- field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4231
+ field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4160
4232
  "button",
4161
4233
  {
4162
4234
  type: "button",
@@ -4166,14 +4238,14 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
4166
4238
  disabled: off,
4167
4239
  onClick: () => onChange(o.url),
4168
4240
  className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
4169
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
4241
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
4170
4242
  },
4171
4243
  o.url
4172
4244
  )) })
4173
4245
  ] });
4174
4246
  }
4175
4247
  function ParameterText({ field, value, onChange, disabled, id }) {
4176
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4248
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4177
4249
  ParameterCommitInput,
4178
4250
  {
4179
4251
  id,
@@ -4192,24 +4264,24 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
4192
4264
  switch (field.type) {
4193
4265
  case "number":
4194
4266
  case "int":
4195
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
4267
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
4196
4268
  case "boolean":
4197
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
4269
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
4198
4270
  case "choice":
4199
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
4271
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
4200
4272
  case "color":
4201
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
4273
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
4202
4274
  case "vector":
4203
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
4275
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
4204
4276
  case "image":
4205
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
4277
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
4206
4278
  case "text":
4207
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ParameterText, { field, value, onChange: set, ...rest });
4279
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterText, { field, value, onChange: set, ...rest });
4208
4280
  }
4209
4281
  }
4210
4282
 
4211
4283
  // src/effects/EffectParameters.tsx
4212
- var import_jsx_runtime30 = require("react/jsx-runtime");
4284
+ var import_jsx_runtime31 = require("react/jsx-runtime");
4213
4285
  function EffectParameters({
4214
4286
  description,
4215
4287
  values,
@@ -4238,8 +4310,8 @@ function EffectParameters({
4238
4310
  if (preset) onPreset({ ...description.defaults, ...preset.values });
4239
4311
  }
4240
4312
  };
4241
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
4242
- (onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4313
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
4314
+ (onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4243
4315
  CustomPresetSelect,
4244
4316
  {
4245
4317
  "aria-label": `${description.name} presets`,
@@ -4254,7 +4326,7 @@ function EffectParameters({
4254
4326
  ],
4255
4327
  onChange: (name) => handlePresetSelect(String(name))
4256
4328
  }
4257
- ) : /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
4329
+ ) : /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4258
4330
  "select",
4259
4331
  {
4260
4332
  className: "w-full rounded border border-border px-1 py-0.5 text-xs",
@@ -4264,8 +4336,8 @@ function EffectParameters({
4264
4336
  disabled,
4265
4337
  onChange: (e) => handlePresetSelect(e.currentTarget.value),
4266
4338
  children: [
4267
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
4268
- description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
4339
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
4340
+ description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
4269
4341
  ]
4270
4342
  }
4271
4343
  )),
@@ -4275,14 +4347,14 @@ function EffectParameters({
4275
4347
  const keyed = keyframed?.has(field.id) ?? false;
4276
4348
  const value = (0, import_effects3.effectFieldValue)(field, values[field.id]);
4277
4349
  const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field.default);
4278
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
4279
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-1.5", children: [
4280
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
4281
- keyed && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
4350
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
4351
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-1.5", children: [
4352
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
4353
+ keyed && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
4282
4354
  renderControlAddon?.(field.id),
4283
- onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime30.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" })
4355
+ onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime31.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" })
4284
4356
  ] }),
4285
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4357
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4286
4358
  ParameterFieldControl,
4287
4359
  {
4288
4360
  field,
@@ -4297,12 +4369,12 @@ function EffectParameters({
4297
4369
  )
4298
4370
  ] }, field.id);
4299
4371
  }),
4300
- !fields.length && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
4372
+ !fields.length && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
4301
4373
  ] });
4302
4374
  }
4303
4375
 
4304
4376
  // src/paint-editor/PaintEffectsPanel.tsx
4305
- var import_jsx_runtime31 = require("react/jsx-runtime");
4377
+ var import_jsx_runtime32 = require("react/jsx-runtime");
4306
4378
  function usePaintEffectsProvider(controller) {
4307
4379
  const [provider, setProvider] = (0, import_react31.useState)(controller.effectsProvider);
4308
4380
  (0, import_react31.useEffect)(() => {
@@ -4315,25 +4387,25 @@ function usePaintEffectsTools(registry, controller, options = {}) {
4315
4387
  const { id, namespace, readOnly, playbackSurface } = options;
4316
4388
  (0, import_react31.useEffect)(() => {
4317
4389
  if (!registry) return;
4318
- return registry.register((0, import_paint_editor16.createPaintEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
4390
+ return registry.register((0, import_paint_editor17.createPaintEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
4319
4391
  }, [registry, controller, id, namespace, readOnly, playbackSurface]);
4320
4392
  }
4321
4393
  function Controls({ provider, effect, name, values, apply }) {
4322
4394
  const { description, error } = useEffectDescription(provider, effect);
4323
4395
  const drags = (0, import_react31.useRef)(/* @__PURE__ */ new Set());
4324
- if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
4396
+ if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
4325
4397
  'No effects provider: "',
4326
4398
  name ?? effect,
4327
4399
  '" is kept as it was drawn.'
4328
4400
  ] });
4329
- if (error) return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
4330
- if (!description) return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
4401
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
4402
+ if (!description) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
4331
4403
  const commit = (gesture) => {
4332
4404
  if (!gesture || drags.current.has(gesture)) return !gesture;
4333
4405
  drags.current.add(gesture);
4334
4406
  return true;
4335
4407
  };
4336
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4408
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4337
4409
  EffectParameters,
4338
4410
  {
4339
4411
  description,
@@ -4386,28 +4458,28 @@ var PaintEffectsPanel = ({ controller, className }) => {
4386
4458
  };
4387
4459
  const toggle = (b) => setBrowse(browse === b ? null : b);
4388
4460
  const pixel = active?.type === "pixel";
4389
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
4390
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
4391
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
4392
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
4393
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
4394
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
4395
- /* @__PURE__ */ (0, import_jsx_runtime31.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" }),
4396
- /* @__PURE__ */ (0, import_jsx_runtime31.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" })
4461
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
4462
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
4463
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
4464
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
4465
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
4466
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
4467
+ /* @__PURE__ */ (0, import_jsx_runtime32.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" }),
4468
+ /* @__PURE__ */ (0, import_jsx_runtime32.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" })
4397
4469
  ] }),
4398
- !provider && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
4399
- browse && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
4400
- paper && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
4401
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-1", children: [
4402
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "flex-1 truncate", children: [
4470
+ !provider && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
4471
+ browse && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
4472
+ paper && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
4473
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-1", children: [
4474
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "flex-1 truncate", children: [
4403
4475
  "Paper: ",
4404
4476
  paper.name ?? paper.effect
4405
4477
  ] }),
4406
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
4478
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
4407
4479
  ] }),
4408
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
4409
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
4410
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4480
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
4481
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
4482
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4411
4483
  "input",
4412
4484
  {
4413
4485
  type: "range",
@@ -4429,43 +4501,43 @@ var PaintEffectsPanel = ({ controller, className }) => {
4429
4501
  `o${paper.opacity}`
4430
4502
  )
4431
4503
  ] }),
4432
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
4433
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
4434
- /* @__PURE__ */ (0, import_jsx_runtime31.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) => {
4504
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
4505
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
4506
+ /* @__PURE__ */ (0, import_jsx_runtime32.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) => {
4435
4507
  const blend = e.currentTarget.value;
4436
4508
  run(() => controller.updatePaperEffect({ blend }));
4437
- }, children: import_paint_editor16.PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: b, children: b }, b)) })
4509
+ }, children: import_paint_editor17.PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: b, children: b }, b)) })
4438
4510
  ] }),
4439
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
4511
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
4440
4512
  ] }),
4441
- effectPaint && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paint", children: [
4442
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-1", children: [
4443
- thumbnail ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("img", { src: thumbnail, alt: "", className: "h-5 w-8 rounded object-cover ring-1 ring-slate-700", "data-testid": "effect-paint-thumbnail" }) : null,
4444
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "flex-1 truncate", children: [
4513
+ effectPaint && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paint", children: [
4514
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-1", children: [
4515
+ thumbnail ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("img", { src: thumbnail, alt: "", className: "h-5 w-8 rounded object-cover ring-1 ring-slate-700", "data-testid": "effect-paint-thumbnail" }) : null,
4516
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "flex-1 truncate", children: [
4445
4517
  "Paint: ",
4446
4518
  effectPaint.effect,
4447
4519
  state.effectPaintRendering ? " (rendering\u2026)" : ""
4448
4520
  ] }),
4449
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
4521
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
4450
4522
  ] }),
4451
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
4452
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", title: "Lay the effect along each stroke instead of fixing it to the canvas", children: [
4453
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("input", { type: "checkbox", checked: effectPaint.map?.by === "stroke", onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
4523
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
4524
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", title: "Lay the effect along each stroke instead of fixing it to the canvas", children: [
4525
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("input", { type: "checkbox", checked: effectPaint.map?.by === "stroke", onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
4454
4526
  "Along the stroke"
4455
4527
  ] }),
4456
- hasPathControl && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", title: "Pass each stroke's centreline to the effect's own path control", children: [
4457
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("input", { type: "checkbox", checked: effectPaint.map?.by === "path", onChange: (e) => repaint({ map: e.target.checked ? { by: "path" } : { by: "canvas" } }) }),
4528
+ hasPathControl && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", title: "Pass each stroke's centreline to the effect's own path control", children: [
4529
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("input", { type: "checkbox", checked: effectPaint.map?.by === "path", onChange: (e) => repaint({ map: e.target.checked ? { by: "path" } : { by: "canvas" } }) }),
4458
4530
  "Along the stroke (native)"
4459
4531
  ] }),
4460
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
4461
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
4532
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
4533
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
4462
4534
  "Live"
4463
4535
  ] })
4464
4536
  ] }),
4465
- effectPaint.map?.by === "stroke" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
4466
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
4467
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-slate-400", children: "Length" }),
4468
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4537
+ effectPaint.map?.by === "stroke" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
4538
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
4539
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-slate-400", children: "Length" }),
4540
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4469
4541
  "input",
4470
4542
  {
4471
4543
  type: "number",
@@ -4479,43 +4551,43 @@ var PaintEffectsPanel = ({ controller, className }) => {
4479
4551
  effectPaint.map.length
4480
4552
  )
4481
4553
  ] }),
4482
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("select", { "aria-label": "Effect repeat", value: effectPaint.map.repeat, onChange: (e) => repaint({ map: { ...effectPaint.map, repeat: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: [
4483
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: "repeat", children: "Repeat" }),
4484
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: "mirror", children: "Mirror" }),
4485
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: "clamp", children: "Clamp" })
4554
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("select", { "aria-label": "Effect repeat", value: effectPaint.map.repeat, onChange: (e) => repaint({ map: { ...effectPaint.map, repeat: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: [
4555
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: "repeat", children: "Repeat" }),
4556
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: "mirror", children: "Mirror" }),
4557
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: "clamp", children: "Clamp" })
4486
4558
  ] })
4487
4559
  ] }),
4488
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
4560
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
4489
4561
  ] }),
4490
- animation && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2 rounded border border-slate-700 p-1", "data-effect-part": "playback", children: [
4491
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "flex-1 truncate", children: [
4562
+ animation && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-2 rounded border border-slate-700 p-1", "data-effect-part": "playback", children: [
4563
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "flex-1 truncate", children: [
4492
4564
  "Live paint: ",
4493
4565
  animation.strokes,
4494
4566
  " ",
4495
4567
  animation.strokes === 1 ? "stroke" : "strokes"
4496
4568
  ] }),
4497
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: button, "aria-pressed": playback.playing, onClick: () => attempt(() => controller.setEffectPlayback({ playing: !playback.playing })), children: playback.playing ? "Pause" : "Play" }),
4498
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex items-center gap-1", children: [
4499
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-slate-400", children: "fps" }),
4500
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("input", { type: "number", "aria-label": "Live paint frame rate", min: 1, max: 60, value: playback.fps, onChange: (e) => attempt(() => controller.setEffectPlayback({ fps: Math.round(Number(e.target.value)) })), className: "w-12 rounded bg-slate-800 px-1 py-0.5" })
4569
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button, "aria-pressed": playback.playing, onClick: () => attempt(() => controller.setEffectPlayback({ playing: !playback.playing })), children: playback.playing ? "Pause" : "Play" }),
4570
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
4571
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-slate-400", children: "fps" }),
4572
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("input", { type: "number", "aria-label": "Live paint frame rate", min: 1, max: 60, value: playback.fps, onChange: (e) => attempt(() => controller.setEffectPlayback({ fps: Math.round(Number(e.target.value)) })), className: "w-12 rounded bg-slate-800 px-1 py-0.5" })
4501
4573
  ] })
4502
4574
  ] }),
4503
- layerEffect && activeId && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "layer", children: [
4504
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-1", children: [
4505
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "flex-1 truncate", children: [
4575
+ layerEffect && activeId && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "layer", children: [
4576
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-1", children: [
4577
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "flex-1 truncate", children: [
4506
4578
  "Layer: ",
4507
4579
  layerEffect.name ?? layerEffect.effect
4508
4580
  ] }),
4509
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
4581
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
4510
4582
  ] }),
4511
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
4583
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
4512
4584
  ] }),
4513
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ErrorLine, { error })
4585
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ErrorLine, { error })
4514
4586
  ] });
4515
4587
  };
4516
4588
 
4517
4589
  // src/paint-editor/PaintEditor.tsx
4518
- var import_jsx_runtime32 = require("react/jsx-runtime");
4590
+ var import_jsx_runtime33 = require("react/jsx-runtime");
4519
4591
  var PAINT_CONTROLS = {
4520
4592
  "mixing-pad": '[data-testid="mixing-pad"]',
4521
4593
  lighting: '[data-testid="light-panel"]',
@@ -4528,7 +4600,7 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
4528
4600
  const tabRef = (0, import_react32.useRef)(tab);
4529
4601
  tabRef.current = tab;
4530
4602
  const rootRef = (0, import_react32.useRef)(null);
4531
- const [ownPresence] = (0, import_react32.useState)(() => new import_paint_editor17.PaintPresence());
4603
+ const [ownPresence] = (0, import_react32.useState)(() => new import_paint_editor18.PaintPresence());
4532
4604
  const ambientPlayback = useAgentPlayback();
4533
4605
  const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
4534
4606
  const viewBox = () => {
@@ -4539,12 +4611,12 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
4539
4611
  const docToClient = (p) => {
4540
4612
  const r = viewBox();
4541
4613
  if (!r) return null;
4542
- const q = (0, import_paint_editor17.documentToScreen)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x, p.y);
4614
+ const q = (0, import_paint_editor18.documentToScreen)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x, p.y);
4543
4615
  return { x: r.left + q.x, y: r.top + q.y };
4544
4616
  };
4545
4617
  const clientToDoc = (p) => {
4546
4618
  const r = viewBox();
4547
- return r ? (0, import_paint_editor17.screenToDocument)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x - r.left, p.y - r.top) : null;
4619
+ return r ? (0, import_paint_editor18.screenToDocument)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x - r.left, p.y - r.top) : null;
4548
4620
  };
4549
4621
  const elementRect = (selector) => {
4550
4622
  const r = rootRef.current?.querySelector(selector)?.getBoundingClientRect();
@@ -4587,27 +4659,27 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
4587
4659
  const [error, setError] = (0, import_react32.useState)(null);
4588
4660
  const effects = usePaintEffectsProvider(controller);
4589
4661
  const tabs = effects ? ["color", "wet", "paper", "layers", "effects"] : ["color", "wet", "paper", "layers"];
4590
- return /* @__PURE__ */ (0, import_jsx_runtime32.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: [
4591
- playing && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
4592
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PaintToolbar, { controller, tool, onToolChange: setTool, fillOptions, onFillOptionsChange: setFillOptions, fileName }),
4593
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex min-h-0 flex-1 gap-2", children: [
4594
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
4595
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
4596
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PaintCanvas, { controller, tool, fillOptions, onError: setError, presence: playing ? void 0 : presence, proposals, agentStrokes, deviceTilt, className: "flex-1 rounded-lg" }),
4597
- error && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
4662
+ return /* @__PURE__ */ (0, import_jsx_runtime33.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: [
4663
+ playing && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
4664
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PaintToolbar, { controller, tool, onToolChange: setTool, fillOptions, onFillOptionsChange: setFillOptions, fileName }),
4665
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex min-h-0 flex-1 gap-2", children: [
4666
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
4667
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
4668
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PaintCanvas, { controller, tool, fillOptions, onError: setError, presence: playing ? void 0 : presence, proposals, agentStrokes, deviceTilt, className: "flex-1 rounded-lg" }),
4669
+ error && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
4598
4670
  ] }),
4599
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
4600
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex gap-1", role: "tablist", "aria-label": "Paint panels", children: tabs.map((t) => /* @__PURE__ */ (0, import_jsx_runtime32.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)) }),
4601
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
4602
- tab === "color" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ColorPanel, { controller }),
4603
- tab === "wet" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(WetPanel, { controller }),
4604
- tab === "paper" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PaperPanel, { controller }),
4605
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PaintLayersPanel, { controller }),
4606
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(StrokePanel, { controller }),
4607
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PathStrokePanel, { controller }),
4608
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(EvolutionPanel, { controller, proposals }),
4609
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(StickerPanel, { controller }),
4610
- tab === "effects" && effects && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PaintEffectsPanel, { controller })
4671
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
4672
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex gap-1", role: "tablist", "aria-label": "Paint panels", children: tabs.map((t) => /* @__PURE__ */ (0, import_jsx_runtime33.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)) }),
4673
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
4674
+ tab === "color" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ColorPanel, { controller }),
4675
+ tab === "wet" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(WetPanel, { controller }),
4676
+ tab === "paper" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PaperPanel, { controller }),
4677
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PaintLayersPanel, { controller }),
4678
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(StrokePanel, { controller }),
4679
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PathStrokePanel, { controller }),
4680
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(EvolutionPanel, { controller, proposals }),
4681
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(StickerPanel, { controller }),
4682
+ tab === "effects" && effects && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PaintEffectsPanel, { controller })
4611
4683
  ] })
4612
4684
  ] })
4613
4685
  ] })
@@ -4635,6 +4707,7 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
4635
4707
  StickerPanel,
4636
4708
  StickerPicker,
4637
4709
  StrokePanel,
4710
+ TimeMachinePanel,
4638
4711
  WetPanel,
4639
4712
  useMutationRequests,
4640
4713
  usePaintChangeFeed,