@pixerate/editor-react 0.199.0 → 0.201.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.
Files changed (39) hide show
  1. package/dist/animation-editor/index.cjs +3 -3
  2. package/dist/animation-editor/index.js +1 -1
  3. package/dist/brushes/BrushEditor.d.cts +1 -1
  4. package/dist/brushes/BrushEditor.d.ts +1 -1
  5. package/dist/brushes/BrushLibraryBrowser.d.cts +1 -1
  6. package/dist/brushes/BrushLibraryBrowser.d.ts +1 -1
  7. package/dist/brushes/index.cjs +8 -5
  8. package/dist/brushes/index.js +2 -2
  9. package/dist/canvas/index.cjs +3 -3
  10. package/dist/canvas/index.js +1 -1
  11. package/dist/{chunk-BICTULEJ.js → chunk-HOFRSMB6.js} +3 -3
  12. package/dist/{chunk-GUBRH2OO.js → chunk-IYYUBI3M.js} +8 -5
  13. package/dist/{chunk-2QXGKOVK.js → chunk-QYARM2FN.js} +1 -1
  14. package/dist/{chunk-W6UZ7PVT.js → chunk-WTW6HRFI.js} +3 -3
  15. package/dist/effects/EffectsBrowser.d.cts +3 -1
  16. package/dist/effects/EffectsBrowser.d.ts +3 -1
  17. package/dist/effects/index.cjs +3 -3
  18. package/dist/effects/index.js +1 -1
  19. package/dist/image-editor/index.cjs +11 -8
  20. package/dist/image-editor/index.js +4 -4
  21. package/dist/index.cjs +11 -8
  22. package/dist/index.js +4 -4
  23. package/dist/paint-editor/BrushPanel.d.cts +5 -1
  24. package/dist/paint-editor/BrushPanel.d.ts +5 -1
  25. package/dist/paint-editor/PaintEditor.d.cts +3 -2
  26. package/dist/paint-editor/PaintEditor.d.ts +3 -2
  27. package/dist/paint-editor/PaperPanel.d.cts +2 -1
  28. package/dist/paint-editor/PaperPanel.d.ts +2 -1
  29. package/dist/paint-editor/SpecialtyPanel.d.cts +24 -0
  30. package/dist/paint-editor/SpecialtyPanel.d.ts +24 -0
  31. package/dist/paint-editor/index.cjs +910 -838
  32. package/dist/paint-editor/index.d.cts +1 -0
  33. package/dist/paint-editor/index.d.ts +1 -0
  34. package/dist/paint-editor/index.js +557 -490
  35. package/dist/vector/index.cjs +11 -8
  36. package/dist/vector/index.js +3 -3
  37. package/dist/video-editor/index.cjs +3 -3
  38. package/dist/video-editor/index.js +1 -1
  39. package/package.json +3 -3
@@ -49,6 +49,8 @@ __export(paint_editor_exports, {
49
49
  PaintToolbar: () => PaintToolbar,
50
50
  PaperPanel: () => PaperPanel,
51
51
  PathStrokePanel: () => PathStrokePanel,
52
+ SpecialtyGuideCard: () => SpecialtyGuideCard,
53
+ SpecialtyPanel: () => SpecialtyPanel,
52
54
  StickerPanel: () => StickerPanel,
53
55
  StickerPicker: () => StickerPicker,
54
56
  StrokePanel: () => StrokePanel,
@@ -807,8 +809,8 @@ var PaintToolbar = ({ controller, tool, onToolChange, fillOptions: controlledFil
807
809
  };
808
810
 
809
811
  // src/paint-editor/BrushPanel.tsx
810
- var import_react10 = require("react");
811
- var import_paint_editor5 = require("@pixerate/editor/paint-editor");
812
+ var import_react12 = require("react");
813
+ var import_paint_editor7 = require("@pixerate/editor/paint-editor");
812
814
  var import_brushes3 = require("@pixerate/editor/brushes");
813
815
 
814
816
  // src/brushes/BrushEditor.tsx
@@ -850,6 +852,7 @@ var BrushEditor = ({ brush, profile = import_brushes.PAINT_PROFILE, onChange, pr
850
852
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "font-medium text-slate-300", children: s.title }),
851
853
  s.controls.map((c) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react5.default.Fragment, { children: [
852
854
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(EditorControl, { control: c, onSet: set }),
855
+ c.hint && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "text-[10px] leading-snug text-slate-400", "data-hint": c.path, children: c.hint }),
853
856
  addSource && (c.path === "tip.stamps" || c.path === "tip.grain.source") && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AddImage, { label: c.path === "tip.stamps" ? "Add image tip\u2026" : "Add grain image\u2026", onFile: (f) => addSource(f, c.path === "tip.stamps" ? "tip" : "grain") })
854
857
  ] }, c.path)),
855
858
  renderExtra?.(s.id)
@@ -975,10 +978,12 @@ var BrushLibraryBrowser = ({ entries, activeId, onSelect, profile, thumbnail, th
975
978
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: `flex flex-col gap-1 ${className ?? ""}`, "data-testid": "brush-library", children: [
976
979
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "search", value: text, placeholder: "Find a brush", "aria-label": "Find a brush", onChange: (e) => setText(e.target.value), className: "rounded bg-slate-800 px-1.5 py-0.5" }),
977
980
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-col gap-1.5", role: "listbox", "aria-label": "Brushes", children: [
978
- groups.map((g) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { role: "group", "aria-label": g.title, className: "flex flex-col gap-0.5", children: [
979
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-[10px] uppercase tracking-wide text-slate-500", children: g.title }),
980
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "grid grid-cols-2 gap-1", children: g.varieties.flatMap(
981
- (v) => v.entries.map((e) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
981
+ groups.map((g) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { role: "group", "aria-label": g.title, "data-group": g.id, className: `flex flex-col gap-0.5 ${g.id === "specialty" ? "mt-1 border-t border-indigo-500/40 pt-1" : ""}`, children: [
982
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: `text-[10px] uppercase tracking-wide ${g.id === "specialty" ? "text-indigo-300" : "text-slate-500"}`, children: g.title }),
983
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "grid grid-cols-2 gap-1", children: g.varieties.flatMap((v) => [
984
+ // Specialty paint is listed by kind (Ferrofluid, UV-fluorescent…).
985
+ ...g.id === "specialty" ? [/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "col-span-2 text-[10px] text-slate-400", children: v.title }, `kind-${v.variety}`)] : [],
986
+ ...v.entries.map((e) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
982
987
  "button",
983
988
  {
984
989
  type: "button",
@@ -994,7 +999,7 @@ var BrushLibraryBrowser = ({ entries, activeId, onSelect, profile, thumbnail, th
994
999
  },
995
1000
  e.brush.id
996
1001
  ))
997
- ) })
1002
+ ]) })
998
1003
  ] }, g.id)),
999
1004
  !groups.length && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-slate-500", children: "No brush matches." })
1000
1005
  ] })
@@ -1214,32 +1219,183 @@ var StickerPicker = ({ controller, selected, onPick, label = "Stickers" }) => {
1214
1219
  );
1215
1220
  };
1216
1221
 
1217
- // src/paint-editor/BrushPanel.tsx
1222
+ // src/paint-editor/SpecialtyPanel.tsx
1223
+ var import_react11 = require("react");
1224
+ var import_paint_editor6 = require("@pixerate/editor/paint-editor");
1225
+
1226
+ // src/paint-editor/FerroPanel.tsx
1227
+ var import_react10 = require("react");
1228
+ var import_paint_editor5 = require("@pixerate/editor/paint-editor");
1218
1229
  var import_jsx_runtime10 = require("react/jsx-runtime");
1219
- var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, className }) => {
1230
+ var FerroPanel = ({ controller, className }) => {
1231
+ const state = usePaintEditorState(controller);
1232
+ const [error, attempt] = useAttempt();
1233
+ const magnets = state.document.magnets ?? [];
1234
+ const activeId = state.document.activeLayerId;
1235
+ const info = (0, import_react10.useMemo)(() => {
1236
+ try {
1237
+ return activeId ? controller.getFerrofluid(activeId) : null;
1238
+ } catch {
1239
+ return null;
1240
+ }
1241
+ }, [controller, state.document, activeId]);
1242
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "ferro-panel", children: [
1243
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-between", children: [
1244
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "font-medium text-slate-300", children: "Ferrofluid & magnets" }),
1245
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex gap-1", children: [
1246
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1247
+ "button",
1248
+ {
1249
+ type: "button",
1250
+ className: button,
1251
+ onClick: () => attempt(() => controller.addMagnet({ x: Math.round(state.document.canvas.width / 2), y: Math.round(state.document.canvas.height / 2) })),
1252
+ children: "Add magnet"
1253
+ }
1254
+ ),
1255
+ magnets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.removeMagnets()), children: "Clear magnets" })
1256
+ ] })
1257
+ ] }),
1258
+ magnets.map((m) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-800 p-1.5", "data-magnet": m.id, children: [
1259
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
1260
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "font-mono text-slate-300", children: [
1261
+ m.id,
1262
+ " (",
1263
+ Math.round(m.x),
1264
+ ", ",
1265
+ Math.round(m.y),
1266
+ ")"
1267
+ ] }),
1268
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", "aria-label": `Remove magnet ${m.id}`, className: "px-1 text-slate-400 hover:text-white", onClick: () => attempt(() => controller.removeMagnets([m.id])), children: "\xD7" })
1269
+ ] }),
1270
+ import_paint_editor5.MAGNET_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1271
+ PaintSlider,
1272
+ {
1273
+ control: { ...c, label: `${c.label} (${m.id})` },
1274
+ value: (0, import_paint_editor5.readPath)(m, c.path),
1275
+ onCommit: (v) => attempt(() => controller.updateMagnet(m.id, { [c.path]: v }))
1276
+ },
1277
+ c.path
1278
+ ))
1279
+ ] }, m.id)),
1280
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
1281
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-[11px] text-slate-400", children: info?.ferro ? `${info.activeSpikeArea} spike px \xB7 max ${Math.round(info.maxSpikeHeight * 100)}%` : "No liquid ferrofluid on layer" }),
1282
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: button, disabled: !info?.ferro, onClick: () => attempt(() => controller.cureFerrofluid()), children: "Cure ferrofluid" })
1283
+ ] }),
1284
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ErrorLine, { error })
1285
+ ] });
1286
+ };
1287
+
1288
+ // src/paint-editor/SpecialtyPanel.tsx
1289
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1290
+ var SpecialtyGuideCard = ({ controller, onOpenSpecialtyPanel, className }) => {
1291
+ const state = usePaintEditorState(controller);
1292
+ const [error, attempt] = useAttempt();
1293
+ const guides = (0, import_paint_editor6.brushSpecialtyGuides)(state);
1294
+ if (!guides.length) return null;
1295
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: `flex flex-col gap-2 rounded-lg border border-indigo-500/40 bg-indigo-950/30 p-2 ${className ?? ""}`, "data-testid": "brush-specialty-guide", children: [
1296
+ guides.map((g) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(GuideItem, { guide: g, onAction: (a) => attempt(() => (0, import_paint_editor6.runBrushSpecialtyAction)(controller, a)) }, g.kind)),
1297
+ onOpenSpecialtyPanel && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: `${button} self-start`, onClick: onOpenSpecialtyPanel, children: "Open Specialty panel" }),
1298
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ErrorLine, { error })
1299
+ ] });
1300
+ };
1301
+ var GuideItem = ({ guide: g, onAction }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col gap-1", "data-specialty": g.kind, children: [
1302
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-1.5", children: [
1303
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "rounded bg-indigo-600 px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-white", children: "Specialty" }),
1304
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "font-medium text-slate-200", children: g.title })
1305
+ ] }),
1306
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-[11px] leading-snug text-slate-400", children: g.howToUse }),
1307
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("p", { role: "status", "data-ready": g.ready, className: `text-[11px] ${g.ready ? "text-emerald-400" : "text-amber-400"}`, children: [
1308
+ g.ready ? "\u25CF " : "\u25CB ",
1309
+ g.status
1310
+ ] }),
1311
+ g.actions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex flex-wrap gap-1", children: g.actions.map((a) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: button, "data-action": a.id, title: `${a.tool}`, onClick: () => onAction(a), children: a.label }, a.id)) })
1312
+ ] });
1313
+ var PICKS = ["ferrofluid", "uv-marker", "thermo-ink", "soap-film", "ghost-wash", "mutation-wash", "turing-wash"];
1314
+ var SpecialtyPanel = ({ controller, className }) => {
1315
+ const state = usePaintEditorState(controller);
1316
+ const [error, attempt] = useAttempt();
1317
+ const [tiltFollow, setTiltFollow] = (0, import_react11.useState)(false);
1318
+ (0, import_react11.useEffect)(() => tiltFollow ? (0, import_paint_editor6.startDeviceTilt)(controller) : void 0, [controller, tiltFollow]);
1319
+ const guides = (0, import_paint_editor6.brushSpecialtyGuides)(state);
1320
+ const picks = PICKS.filter((id) => state.brushes.some((b) => b.id === id));
1321
+ const heat = state.heat;
1322
+ const tilted = state.viewTilt.x !== 0 || state.viewTilt.y !== 0;
1323
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "specialty-panel", children: [
1324
+ guides.length ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SpecialtyGuideCard, { controller }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col gap-1", "data-testid": "specialty-picks", children: [
1325
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-slate-400", children: "The active brush is a standard one. Pick a specialty brush:" }),
1326
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex flex-wrap gap-1", children: picks.map((id) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.setBrush({ id })), children: state.brushes.find((b) => b.id === id).name }, id)) })
1327
+ ] }),
1328
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "uv-heat-panel", children: [
1329
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "font-medium text-slate-300", children: "UV blacklight & heat" }),
1330
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-[11px] leading-snug text-slate-500", children: "UV-fluorescent ink (UV marker) glows in its own colour under the blacklight; invisible UV ink shows only under it. Thermochromic ink (Thermochromic ink preset) shifts toward its hot colour where the canvas is warm." }),
1331
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex items-center gap-2", children: [
1332
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { type: "checkbox", checked: state.uvLight.on, onChange: (e) => attempt(() => controller.setUvLight({ on: e.target.checked })) }),
1333
+ " UV blacklight"
1334
+ ] }),
1335
+ import_paint_editor6.UV_LIGHT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor6.readPath)(state.uvLight, c.path), onChange: (v) => attempt(() => controller.setUvLight({ [c.path]: v })) }, c.path)),
1336
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-[11px] text-slate-400", role: "status", children: heat.hotCells > 0 ? `Canvas heat: ${Math.round(heat.max * 100)}% at its warmest` : "Canvas is cool" }),
1337
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1338
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.paintHeat((0, import_paint_editor6.warmCanvasHeat)(state.document.canvas))), children: "Warm canvas" }),
1339
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: button, disabled: heat.hotCells === 0, onClick: () => attempt(() => controller.advanceHeat(10)), children: "Step heat" }),
1340
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: button, disabled: heat.hotCells === 0, onClick: () => attempt(() => controller.clearHeat()), children: "Cool canvas" })
1341
+ ] })
1342
+ ] }),
1343
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
1344
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-[11px] leading-snug text-slate-500", children: "Ferrofluid and Ferro ink pool into liquid magnetic paint that magnets pull into 3D Rosensweig spikes." }),
1345
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FerroPanel, { controller })
1346
+ ] }),
1347
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "view-tilt-panel", children: [
1348
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "font-medium text-slate-300", children: "Thin-film iridescence & view tilt" }),
1349
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-[11px] leading-snug text-slate-500", children: "Scarab lacquer, Soap film and Pearl glaze shift colour with the viewing angle." }),
1350
+ import_paint_editor6.VIEW_TILT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor6.readPath)(state.viewTilt, c.path), onChange: (v) => attempt(() => controller.setViewTilt({ [c.path]: v })) }, c.path)),
1351
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1352
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: button, disabled: !tilted, onClick: () => attempt(() => controller.setViewTilt({ x: 0, y: 0 })), children: "Reset tilt" }),
1353
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1354
+ "button",
1355
+ {
1356
+ type: "button",
1357
+ "aria-pressed": tiltFollow,
1358
+ className: chip(tiltFollow),
1359
+ onClick: () => attempt(async () => {
1360
+ if (!tiltFollow && !await (0, import_paint_editor6.requestDeviceTiltPermission)()) return;
1361
+ setTiltFollow((v) => !v);
1362
+ }),
1363
+ children: "Device tilt"
1364
+ }
1365
+ )
1366
+ ] })
1367
+ ] }),
1368
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ErrorLine, { error })
1369
+ ] });
1370
+ };
1371
+
1372
+ // src/paint-editor/BrushPanel.tsx
1373
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1374
+ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, onOpenSpecialtyPanel, className }) => {
1220
1375
  const state = usePaintEditorState(controller);
1221
1376
  const [error, attempt] = useAttempt();
1222
- const fileRef = (0, import_react10.useRef)(null);
1377
+ const fileRef = (0, import_react12.useRef)(null);
1223
1378
  const { brush, brushes } = state;
1224
1379
  const paper = state.document.paper;
1225
- const thumbs = (0, import_react10.useMemo)(
1380
+ const thumbs = (0, import_react12.useMemo)(
1226
1381
  // Each in a colour that reads on the paper (the brush's own default when it has one).
1227
1382
  () => new Map(brushes.map((b) => [b.id, controller.brushThumbnail(b.id, { width: thumbnailWidth, height: thumbnailHeight, color: (0, import_brushes3.brushPreviewColours)(controller.getBrushSpec(b.id), { paper: paper.color }).color })])),
1228
1383
  // Thumbnails follow the library and the paper.
1229
1384
  // eslint-disable-next-line react-hooks/exhaustive-deps
1230
1385
  [controller, brushes, paper, thumbnailWidth, thumbnailHeight]
1231
1386
  );
1232
- const entries = (0, import_react10.useMemo)(() => brushes.map((b) => ({ brush: controller.getBrushSpec(b.id), builtin: Boolean(b.builtin) })), [controller, brushes]);
1233
- const spec = (0, import_react10.useMemo)(() => controller.getBrushSpec(), [controller, brush]);
1387
+ const entries = (0, import_react12.useMemo)(() => brushes.map((b) => ({ brush: controller.getBrushSpec(b.id), builtin: Boolean(b.builtin) })), [controller, brushes]);
1388
+ const spec = (0, import_react12.useMemo)(() => controller.getBrushSpec(), [controller, brush]);
1234
1389
  const own = typeof spec.colour?.default === "string" && /^#[0-9a-f]{6}/i.test(spec.colour.default) ? spec.colour.default.slice(0, 7) : void 0;
1235
- const preview = (0, import_react10.useMemo)(() => controller.brushThumbnail(brush.id, { width: 240, height: 64, color: own }), [controller, brush, paper, state.color, own]);
1236
- const carried = (0, import_paint_editor5.brushLoadColor)(state.mixerLoad);
1390
+ const preview = (0, import_react12.useMemo)(() => controller.brushThumbnail(brush.id, { width: 240, height: 64, color: own }), [controller, brush, paper, state.color, own]);
1391
+ const carried = (0, import_paint_editor7.brushLoadColor)(state.mixerLoad);
1237
1392
  const palette = (spec.colour?.palette ?? []).flatMap((c) => (0, import_brushes3.brushColourHex)(c, state.colorScheme) ?? []);
1238
1393
  const slug = (name) => name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || "brush";
1239
1394
  const loads = (["dab", "mixer", "impasto"].includes(brush.engine) || brush.engine === "wet" && brush.wet.tool === "paint") && !brush.ghost && !brush.mutation;
1240
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "brush-panel", children: [
1241
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(BrushLibraryBrowser, { entries, activeId: brush.id, onSelect: (id) => controller.setBrush({ id }), thumbnail: (id) => thumbs.get(id) ?? null, thumbnailWidth, thumbnailHeight }),
1242
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1395
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "brush-panel", children: [
1396
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BrushLibraryBrowser, { entries, activeId: brush.id, onSelect: (id) => controller.setBrush({ id }), thumbnail: (id) => thumbs.get(id) ?? null, thumbnailWidth, thumbnailHeight }),
1397
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SpecialtyGuideCard, { controller, onOpenSpecialtyPanel }),
1398
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1243
1399
  BrushEditor,
1244
1400
  {
1245
1401
  brush: spec,
@@ -1251,40 +1407,40 @@ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, clas
1251
1407
  onAddSource: async (file) => (await (0, import_brushes3.addBrushSourceFromFile)(controller.brushLibrary, file)).ref,
1252
1408
  renderExtra: (section) => {
1253
1409
  if (section === "shape" && brush.engine === "sticker")
1254
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(StickerPicker, { controller, label: "Sticker stamps", selected: brush.sticker.stamps, onPick: (ref) => controller.setBrush({ sticker: { stamps: (0, import_paint_editor5.toggleStickerRef)(brush.sticker.stamps, ref) } }) });
1410
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(StickerPicker, { controller, label: "Sticker stamps", selected: brush.sticker.stamps, onPick: (ref) => controller.setBrush({ sticker: { stamps: (0, import_paint_editor7.toggleStickerRef)(brush.sticker.stamps, ref) } }) });
1255
1411
  if (section === "behaviour")
1256
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1257
- brush.mutation && !state.hasMutationAgent && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-[11px] text-amber-400", role: "status", "data-paint-mutation-unconnected": true, children: "No agent is connected \u2014 mutation strokes will stay as ordinary paint." }),
1258
- loads && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", children: [
1259
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-slate-400", children: "Carries" }),
1260
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-label": "Brush load", title: carried ?? "Clean", className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: carried ?? "transparent" } }),
1261
- brush.engine === "mixer" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: button, onClick: () => controller.loadMixerBrush(), children: "Load" }),
1262
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: button, onClick: () => controller.cleanMixerBrush(brush.engine === "mixer"), children: "Clean" })
1412
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
1413
+ brush.mutation && !state.hasMutationAgent && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-[11px] text-amber-400", role: "status", "data-paint-mutation-unconnected": true, children: "No agent is connected \u2014 mutation strokes will stay as ordinary paint." }),
1414
+ loads && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1", children: [
1415
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-slate-400", children: "Carries" }),
1416
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { "aria-label": "Brush load", title: carried ?? "Clean", className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: carried ?? "transparent" } }),
1417
+ brush.engine === "mixer" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, onClick: () => controller.loadMixerBrush(), children: "Load" }),
1418
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, onClick: () => controller.cleanMixerBrush(brush.engine === "mixer"), children: "Clean" })
1263
1419
  ] })
1264
1420
  ] });
1265
1421
  if (section === "colour")
1266
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1267
- palette.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Paint with a palette colour", children: palette.map((hex, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", "aria-label": `Paint with ${hex}`, title: hex, "aria-pressed": state.color === hex, className: `h-5 w-5 rounded ring-1 ${state.color === hex ? "ring-white" : "ring-slate-700"}`, style: { background: hex }, onClick: () => controller.setColor(hex) }, `${hex}-${i}`)) }),
1268
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex items-center gap-2", title: "Choosing a brush with a default colour (the highlighter's yellow) makes it your colour unless this is on", children: [
1269
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "checkbox", "aria-label": "Keep my colour", checked: state.colorLocked, onChange: (e) => controller.setColorLocked(e.target.checked) }),
1422
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
1423
+ palette.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Paint with a palette colour", children: palette.map((hex, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", "aria-label": `Paint with ${hex}`, title: hex, "aria-pressed": state.color === hex, className: `h-5 w-5 rounded ring-1 ${state.color === hex ? "ring-white" : "ring-slate-700"}`, style: { background: hex }, onClick: () => controller.setColor(hex) }, `${hex}-${i}`)) }),
1424
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center gap-2", title: "Choosing a brush with a default colour (the highlighter's yellow) makes it your colour unless this is on", children: [
1425
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { type: "checkbox", "aria-label": "Keep my colour", checked: state.colorLocked, onChange: (e) => controller.setColorLocked(e.target.checked) }),
1270
1426
  " Keep my colour when choosing a brush"
1271
1427
  ] }),
1272
- (0, import_paint_editor5.brushTakesPaint)(brush) && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "brush-gradient", children: [
1273
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
1274
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-slate-400", title: "A gradient of the brush's own, used instead of the paint (the multi-colour brush)", children: "Brush gradient" }),
1275
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", "aria-pressed": brush.paint !== null, className: chip(brush.paint !== null), onClick: () => attempt(() => controller.setBrush({ paint: brush.paint ? null : import_paint_editor5.DEFAULT_PAINT_GRADIENT })), children: brush.paint ? "On" : "Off" })
1428
+ (0, import_paint_editor7.brushTakesPaint)(brush) && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "brush-gradient", children: [
1429
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
1430
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-slate-400", title: "A gradient of the brush's own, used instead of the paint (the multi-colour brush)", children: "Brush gradient" }),
1431
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", "aria-pressed": brush.paint !== null, className: chip(brush.paint !== null), onClick: () => attempt(() => controller.setBrush({ paint: brush.paint ? null : import_paint_editor7.DEFAULT_PAINT_GRADIENT })), children: brush.paint ? "On" : "Off" })
1276
1432
  ] }),
1277
- brush.paint && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaintGradientEditor, { value: brush.paint, colors: { paint: state.color, secondary: state.secondaryColor }, onChange: (g) => attempt(() => controller.setBrush({ paint: g })) })
1433
+ brush.paint && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PaintGradientEditor, { value: brush.paint, colors: { paint: state.color, secondary: state.secondaryColor }, onChange: (g) => attempt(() => controller.setBrush({ paint: g })) })
1278
1434
  ] })
1279
1435
  ] });
1280
1436
  return null;
1281
1437
  }
1282
1438
  }
1283
1439
  ),
1284
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1285
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: button, onClick: () => attempt(async () => (0, import_paint_editor5.downloadBytes)(JSON.stringify(await controller.exportBrushes(), null, 2), "brushes.json", "application/json")), children: "Export" }),
1286
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: button, onClick: () => fileRef.current?.click(), children: "Import\u2026" }),
1287
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1440
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1441
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, onClick: () => attempt(async () => (0, import_paint_editor7.downloadBytes)(JSON.stringify(await controller.exportBrushes(), null, 2), "brushes.json", "application/json")), children: "Export" }),
1442
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, onClick: () => fileRef.current?.click(), children: "Import\u2026" }),
1443
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1288
1444
  "input",
1289
1445
  {
1290
1446
  ref: fileRef,
@@ -1300,88 +1456,26 @@ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, clas
1300
1456
  }
1301
1457
  )
1302
1458
  ] }),
1303
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ErrorLine, { error })
1459
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ErrorLine, { error })
1304
1460
  ] });
1305
1461
  };
1306
1462
 
1307
1463
  // src/paint-editor/PaperPanel.tsx
1308
- var import_react12 = require("react");
1309
- var import_paint_editor9 = require("@pixerate/editor/paint-editor");
1310
-
1311
- // src/paint-editor/FerroPanel.tsx
1312
- var import_react11 = require("react");
1313
- var import_paint_editor6 = require("@pixerate/editor/paint-editor");
1314
- var import_jsx_runtime11 = require("react/jsx-runtime");
1315
- var FerroPanel = ({ controller, className }) => {
1316
- const state = usePaintEditorState(controller);
1317
- const [error, attempt] = useAttempt();
1318
- const magnets = state.document.magnets ?? [];
1319
- const activeId = state.document.activeLayerId;
1320
- const info = (0, import_react11.useMemo)(() => {
1321
- try {
1322
- return activeId ? controller.getFerrofluid(activeId) : null;
1323
- } catch {
1324
- return null;
1325
- }
1326
- }, [controller, state.document, activeId]);
1327
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "ferro-panel", children: [
1328
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center justify-between", children: [
1329
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "font-medium text-slate-300", children: "Ferrofluid & magnets" }),
1330
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex gap-1", children: [
1331
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1332
- "button",
1333
- {
1334
- type: "button",
1335
- className: button,
1336
- onClick: () => attempt(() => controller.addMagnet({ x: Math.round(state.document.canvas.width / 2), y: Math.round(state.document.canvas.height / 2) })),
1337
- children: "Add magnet"
1338
- }
1339
- ),
1340
- magnets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.removeMagnets()), children: "Clear magnets" })
1341
- ] })
1342
- ] }),
1343
- magnets.map((m) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-800 p-1.5", "data-magnet": m.id, children: [
1344
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
1345
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "font-mono text-slate-300", children: [
1346
- m.id,
1347
- " (",
1348
- Math.round(m.x),
1349
- ", ",
1350
- Math.round(m.y),
1351
- ")"
1352
- ] }),
1353
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", "aria-label": `Remove magnet ${m.id}`, className: "px-1 text-slate-400 hover:text-white", onClick: () => attempt(() => controller.removeMagnets([m.id])), children: "\xD7" })
1354
- ] }),
1355
- import_paint_editor6.MAGNET_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1356
- PaintSlider,
1357
- {
1358
- control: { ...c, label: `${c.label} (${m.id})` },
1359
- value: (0, import_paint_editor6.readPath)(m, c.path),
1360
- onCommit: (v) => attempt(() => controller.updateMagnet(m.id, { [c.path]: v }))
1361
- },
1362
- c.path
1363
- ))
1364
- ] }, m.id)),
1365
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
1366
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-[11px] text-slate-400", children: info?.ferro ? `${info.activeSpikeArea} spike px \xB7 max ${Math.round(info.maxSpikeHeight * 100)}%` : "No liquid ferrofluid on layer" }),
1367
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: button, disabled: !info?.ferro, onClick: () => attempt(() => controller.cureFerrofluid()), children: "Cure ferrofluid" })
1368
- ] }),
1369
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ErrorLine, { error })
1370
- ] });
1371
- };
1464
+ var import_react13 = require("react");
1465
+ var import_paint_editor10 = require("@pixerate/editor/paint-editor");
1372
1466
 
1373
1467
  // src/paint-editor/TimeMachinePanel.tsx
1374
- var import_paint_editor7 = require("@pixerate/editor/paint-editor");
1375
- var import_jsx_runtime12 = require("react/jsx-runtime");
1468
+ var import_paint_editor8 = require("@pixerate/editor/paint-editor");
1469
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1376
1470
  var TimeMachinePanel = ({ controller, className }) => {
1377
1471
  const state = usePaintEditorState(controller);
1378
1472
  const [error, attempt] = useAttempt();
1379
1473
  const age = state.age;
1380
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "time-machine-panel", children: [
1381
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center justify-between gap-1", children: [
1382
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "font-medium text-slate-300", children: "Time machine (ageing & X-ray)" }),
1383
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1384
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1474
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "time-machine-panel", children: [
1475
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center justify-between gap-1", children: [
1476
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "font-medium text-slate-300", children: "Time machine (ageing & X-ray)" }),
1477
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1478
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1385
1479
  "button",
1386
1480
  {
1387
1481
  type: "button",
@@ -1390,11 +1484,11 @@ var TimeMachinePanel = ({ controller, className }) => {
1390
1484
  children: "Age 300 yr"
1391
1485
  }
1392
1486
  ),
1393
- age.years > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.setAge({ years: 0 })), children: "Fresh" })
1487
+ age.years > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.setAge({ years: 0 })), children: "Fresh" })
1394
1488
  ] })
1395
1489
  ] }),
1396
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center gap-2", children: [
1397
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1490
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center gap-2", children: [
1491
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1398
1492
  "input",
1399
1493
  {
1400
1494
  type: "checkbox",
@@ -1405,17 +1499,17 @@ var TimeMachinePanel = ({ controller, className }) => {
1405
1499
  " ",
1406
1500
  "X-ray view (pentimento)"
1407
1501
  ] }),
1408
- import_paint_editor7.AGE_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1502
+ import_paint_editor8.AGE_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1409
1503
  PaintSlider,
1410
1504
  {
1411
1505
  control: c,
1412
- value: (0, import_paint_editor7.readPath)(age, c.path),
1506
+ value: (0, import_paint_editor8.readPath)(age, c.path),
1413
1507
  onChange: (v) => attempt(() => controller.setAge({ [c.path]: v }))
1414
1508
  },
1415
1509
  c.path
1416
1510
  )),
1417
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", children: [
1418
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1511
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", children: [
1512
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1419
1513
  "button",
1420
1514
  {
1421
1515
  type: "button",
@@ -1425,8 +1519,8 @@ var TimeMachinePanel = ({ controller, className }) => {
1425
1519
  children: "Bake age"
1426
1520
  }
1427
1521
  ),
1428
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.setAge({ seed: age.seed + 1 })), children: "New crack seed" }),
1429
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1522
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.setAge({ seed: age.seed + 1 })), children: "New crack seed" }),
1523
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1430
1524
  "button",
1431
1525
  {
1432
1526
  type: "button",
@@ -1436,13 +1530,13 @@ var TimeMachinePanel = ({ controller, className }) => {
1436
1530
  }
1437
1531
  )
1438
1532
  ] }),
1439
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ErrorLine, { error })
1533
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ErrorLine, { error })
1440
1534
  ] });
1441
1535
  };
1442
1536
 
1443
1537
  // src/paint-editor/CulturePanel.tsx
1444
- var import_paint_editor8 = require("@pixerate/editor/paint-editor");
1445
- var import_jsx_runtime13 = require("react/jsx-runtime");
1538
+ var import_paint_editor9 = require("@pixerate/editor/paint-editor");
1539
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1446
1540
  var CulturePanel = ({ controller, className }) => {
1447
1541
  const state = usePaintEditorState(controller);
1448
1542
  const [error, attempt] = useAttempt();
@@ -1452,12 +1546,12 @@ var CulturePanel = ({ controller, className }) => {
1452
1546
  const totalTips = cultures.layers.reduce((acc, l) => acc + l.tips, 0);
1453
1547
  const totalSegments = cultures.layers.reduce((acc, l) => acc + l.segments, 0);
1454
1548
  const canCarryCulture = ["dab", "mixer", "impasto", "particle", "bristle"].includes(brush.engine);
1455
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "culture-panel", children: [
1456
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center justify-between", children: [
1457
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "font-medium text-slate-300", children: "Biopaint (mycelial ink)" }),
1458
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex gap-1", children: [
1459
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.growCultures({ steps: 40 })), children: "Grow" }),
1460
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1549
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "culture-panel", children: [
1550
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center justify-between", children: [
1551
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "font-medium text-slate-300", children: "Biopaint (mycelial ink)" }),
1552
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex gap-1", children: [
1553
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.growCultures({ steps: 40 })), children: "Grow" }),
1554
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1461
1555
  "button",
1462
1556
  {
1463
1557
  type: "button",
@@ -1467,7 +1561,7 @@ var CulturePanel = ({ controller, className }) => {
1467
1561
  children: cultures.paused ? "Paused" : "Pause"
1468
1562
  }
1469
1563
  ),
1470
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1564
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1471
1565
  "button",
1472
1566
  {
1473
1567
  type: "button",
@@ -1479,9 +1573,9 @@ var CulturePanel = ({ controller, className }) => {
1479
1573
  )
1480
1574
  ] })
1481
1575
  ] }),
1482
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex items-center justify-between text-[11px] text-slate-400", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: activeColony ? `${totalTips} living tips \xB7 ${totalSegments} segments (${activeColony.status})` : "No mycelial colony on canvas" }) }),
1483
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center gap-2 text-[11px]", children: [
1484
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1576
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex items-center justify-between text-[11px] text-slate-400", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: activeColony ? `${totalTips} living tips \xB7 ${totalSegments} segments (${activeColony.status})` : "No mycelial colony on canvas" }) }),
1577
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-2 text-[11px]", children: [
1578
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1485
1579
  "input",
1486
1580
  {
1487
1581
  type: "checkbox",
@@ -1491,10 +1585,10 @@ var CulturePanel = ({ controller, className }) => {
1491
1585
  ),
1492
1586
  "Grow while closed"
1493
1587
  ] }),
1494
- canCarryCulture && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col gap-1 border-t border-slate-800 pt-1.5", children: [
1495
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center justify-between", children: [
1496
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-[11px] text-slate-400", children: "Brush spores" }),
1497
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1588
+ canCarryCulture && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col gap-1 border-t border-slate-800 pt-1.5", children: [
1589
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center justify-between", children: [
1590
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-[11px] text-slate-400", children: "Brush spores" }),
1591
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1498
1592
  "button",
1499
1593
  {
1500
1594
  type: "button",
@@ -1505,37 +1599,35 @@ var CulturePanel = ({ controller, className }) => {
1505
1599
  }
1506
1600
  )
1507
1601
  ] }),
1508
- brush.culture && import_paint_editor8.CULTURE_SLIDERS.map((c) => {
1602
+ brush.culture && import_paint_editor9.CULTURE_SLIDERS.map((c) => {
1509
1603
  const key = c.path.replace(/^culture\./, "");
1510
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1604
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1511
1605
  PaintSlider,
1512
1606
  {
1513
1607
  control: c,
1514
- value: (0, import_paint_editor8.readPath)(brush.culture, key),
1608
+ value: (0, import_paint_editor9.readPath)(brush.culture, key),
1515
1609
  onCommit: (v) => attempt(() => controller.setBrush({ culture: { [key]: v } }))
1516
1610
  },
1517
1611
  c.path
1518
1612
  );
1519
1613
  })
1520
1614
  ] }),
1521
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ErrorLine, { error })
1615
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ErrorLine, { error })
1522
1616
  ] });
1523
1617
  };
1524
1618
 
1525
1619
  // src/paint-editor/PaperPanel.tsx
1526
- var import_jsx_runtime14 = require("react/jsx-runtime");
1620
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1527
1621
  var SWATCH = { x: 0, y: 0, width: 64, height: 40 };
1528
1622
  var PaperPanel = ({ controller, className }) => {
1529
1623
  const state = usePaintEditorState(controller);
1530
1624
  const [error, attempt] = useAttempt();
1531
- const [tiltFollow, setTiltFollow] = (0, import_react12.useState)(false);
1532
- (0, import_react12.useEffect)(() => tiltFollow ? (0, import_paint_editor9.startDeviceTilt)(controller) : void 0, [controller, tiltFollow]);
1533
1625
  const paper = state.document.paper;
1534
- const previews = (0, import_react12.useMemo)(() => new Map(import_paint_editor9.PAPER_LIBRARY.map((p) => [p.preset, { ...SWATCH, data: (0, import_paint_editor9.renderPaper)({ ...p, shading: Math.max(0.8, p.shading) }, SWATCH) }])), []);
1535
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paper-panel", children: [
1536
- import_paint_editor9.PAPER_FAMILIES.map((family) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
1537
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "mb-0.5 text-[10px] uppercase tracking-wide text-slate-500", children: family }),
1538
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": `${family} papers`, children: import_paint_editor9.PAPER_LIBRARY.filter((p) => p.family === family).map((p) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1626
+ const previews = (0, import_react13.useMemo)(() => new Map(import_paint_editor10.PAPER_LIBRARY.map((p) => [p.preset, { ...SWATCH, data: (0, import_paint_editor10.renderPaper)({ ...p, shading: Math.max(0.8, p.shading) }, SWATCH) }])), []);
1627
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paper-panel", children: [
1628
+ import_paint_editor10.PAPER_FAMILIES.map((family) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { children: [
1629
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "mb-0.5 text-[10px] uppercase tracking-wide text-slate-500", children: family }),
1630
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": `${family} papers`, children: import_paint_editor10.PAPER_LIBRARY.filter((p) => p.family === family).map((p) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1539
1631
  "button",
1540
1632
  {
1541
1633
  type: "button",
@@ -1544,133 +1636,100 @@ var PaperPanel = ({ controller, className }) => {
1544
1636
  title: p.name,
1545
1637
  className: `rounded p-0.5 ${paper.preset === p.preset ? "ring-2 ring-indigo-500" : "ring-1 ring-slate-700 hover:ring-slate-500"}`,
1546
1638
  onClick: () => attempt(() => controller.setPaper({ preset: p.preset })),
1547
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PixelCanvas, { pixels: previews.get(p.preset) ?? null, label: p.name, style: { width: 48, height: 30 } })
1639
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PixelCanvas, { pixels: previews.get(p.preset) ?? null, label: p.name, style: { width: 48, height: 30 } })
1548
1640
  },
1549
1641
  p.preset
1550
1642
  )) })
1551
1643
  ] }, family)),
1552
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "text-slate-300", children: paper.name }),
1553
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center justify-between", children: [
1554
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-slate-400", children: "Colour" }),
1555
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CommitColorInput, { label: "Paper colour", value: paper.color, onCommit: (v) => attempt(() => controller.setPaper({ color: v })), className: "h-6 w-10 rounded bg-transparent" })
1644
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "text-slate-300", children: paper.name }),
1645
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center justify-between", children: [
1646
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-slate-400", children: "Colour" }),
1647
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CommitColorInput, { label: "Paper colour", value: paper.color, onCommit: (v) => attempt(() => controller.setPaper({ color: v })), className: "h-6 w-10 rounded bg-transparent" })
1556
1648
  ] }),
1557
- import_paint_editor9.PAPER_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor9.readPath)(paper, c.path), onCommit: (v) => attempt(() => controller.setPaper((0, import_paint_editor9.patchPath)(paper, c.path, v))) }, c.path)),
1558
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center justify-between", children: [
1559
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-slate-400", children: "Backlight colour" }),
1560
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CommitColorInput, { label: "Backlight colour", value: paper.backlightColor ?? import_paint_editor9.DEFAULT_BACKLIGHT_COLOR, onCommit: (v) => attempt(() => controller.setPaper({ backlightColor: v })), className: "h-6 w-10 rounded bg-transparent" })
1649
+ import_paint_editor10.PAPER_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor10.readPath)(paper, c.path), onCommit: (v) => attempt(() => controller.setPaper((0, import_paint_editor10.patchPath)(paper, c.path, v))) }, c.path)),
1650
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center justify-between", children: [
1651
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-slate-400", children: "Backlight colour" }),
1652
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CommitColorInput, { label: "Backlight colour", value: paper.backlightColor ?? import_paint_editor10.DEFAULT_BACKLIGHT_COLOR, onCommit: (v) => attempt(() => controller.setPaper({ backlightColor: v })), className: "h-6 w-10 rounded bg-transparent" })
1561
1653
  ] }),
1562
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-2", children: [
1563
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "checkbox", checked: paper.tiling === "mirror", onChange: (e) => attempt(() => controller.setPaper({ tiling: e.target.checked ? "mirror" : "repeat" })) }),
1654
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-2", children: [
1655
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "checkbox", checked: paper.tiling === "mirror", onChange: (e) => attempt(() => controller.setPaper({ tiling: e.target.checked ? "mirror" : "repeat" })) }),
1564
1656
  " Mirror tiling"
1565
1657
  ] }),
1566
- /* @__PURE__ */ (0, import_jsx_runtime14.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" }),
1567
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "light-panel", children: [
1568
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "font-medium text-slate-300", children: "Light (thick paint, iridescence, metallic paper)" }),
1569
- import_paint_editor9.LIGHT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor9.readPath)(controller.getLighting(), c.path), onChange: (v) => attempt(() => controller.setLighting({ [c.path]: v })) }, c.path)),
1570
- import_paint_editor9.VIEW_TILT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor9.readPath)(state.viewTilt, c.path), onChange: (v) => attempt(() => controller.setViewTilt({ [c.path]: v })) }, c.path)),
1571
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1572
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1573
- "button",
1574
- {
1575
- type: "button",
1576
- "aria-pressed": tiltFollow,
1577
- className: chip(tiltFollow),
1578
- onClick: () => attempt(async () => {
1579
- if (!tiltFollow && !await (0, import_paint_editor9.requestDeviceTiltPermission)()) return;
1580
- setTiltFollow((v) => !v);
1581
- }),
1582
- children: "Device tilt"
1583
- }
1584
- ),
1585
- /* @__PURE__ */ (0, import_jsx_runtime14.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" })
1586
- ] })
1587
- ] }),
1588
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "uv-heat-panel", children: [
1589
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "font-medium text-slate-300", children: "UV blacklight & heat" }),
1590
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-2", children: [
1591
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "checkbox", checked: state.uvLight.on, onChange: (e) => attempt(() => controller.setUvLight({ on: e.target.checked })) }),
1592
- " UV blacklight"
1593
- ] }),
1594
- import_paint_editor9.UV_LIGHT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor9.readPath)(state.uvLight, c.path), onChange: (v) => attempt(() => controller.setUvLight({ [c.path]: v })) }, c.path)),
1595
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1.5", children: [
1596
- /* @__PURE__ */ (0, import_jsx_runtime14.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" }),
1597
- /* @__PURE__ */ (0, import_jsx_runtime14.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" }),
1598
- state.heat.hotCells > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "text-[11px] text-amber-400", children: [
1599
- Math.round(state.heat.max * 100),
1600
- "% warm"
1601
- ] })
1602
- ] })
1658
+ /* @__PURE__ */ (0, import_jsx_runtime15.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" }),
1659
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "light-panel", children: [
1660
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "font-medium text-slate-300", children: "Light (thick paint, iridescence, metallic paper)" }),
1661
+ import_paint_editor10.LIGHT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor10.readPath)(controller.getLighting(), c.path), onChange: (v) => attempt(() => controller.setLighting({ [c.path]: v })) }, c.path)),
1662
+ /* @__PURE__ */ (0, import_jsx_runtime15.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" })
1603
1663
  ] }),
1604
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FerroPanel, { controller }),
1605
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TimeMachinePanel, { controller }),
1606
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CulturePanel, { controller }),
1607
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ErrorLine, { error })
1664
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TimeMachinePanel, { controller }),
1665
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CulturePanel, { controller }),
1666
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ErrorLine, { error })
1608
1667
  ] });
1609
1668
  };
1610
1669
 
1611
1670
  // src/paint-editor/ColorPanel.tsx
1612
- var import_react13 = require("react");
1613
- var import_paint_editor10 = require("@pixerate/editor/paint-editor");
1671
+ var import_react14 = require("react");
1614
1672
  var import_paint_editor11 = require("@pixerate/editor/paint-editor");
1615
- var import_jsx_runtime15 = require("react/jsx-runtime");
1673
+ var import_paint_editor12 = require("@pixerate/editor/paint-editor");
1674
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1616
1675
  var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className }) => {
1617
1676
  const state = usePaintEditorState(controller);
1618
1677
  const [error, attempt] = useAttempt();
1619
- const [wheel, setWheel] = (0, import_react13.useState)("ryb");
1620
- const [kind, setKind] = (0, import_react13.useState)("complementary");
1621
- const [padTool, setPadTool] = (0, import_react13.useState)("paint");
1622
- const [sample, setSample] = (0, import_react13.useState)(3);
1623
- const [parts, setParts] = (0, import_react13.useState)([1, 1]);
1624
- const [padName, setPadName] = (0, import_react13.useState)("");
1625
- const padPoints = (0, import_react13.useRef)(null);
1626
- const ring = (0, import_react13.useMemo)(() => (0, import_paint_editor10.renderColorWheel)(wheelSize, wheel), [wheelSize, wheel]);
1678
+ const [wheel, setWheel] = (0, import_react14.useState)("ryb");
1679
+ const [kind, setKind] = (0, import_react14.useState)("complementary");
1680
+ const [padTool, setPadTool] = (0, import_react14.useState)("paint");
1681
+ const [sample, setSample] = (0, import_react14.useState)(3);
1682
+ const [parts, setParts] = (0, import_react14.useState)([1, 1]);
1683
+ const [padName, setPadName] = (0, import_react14.useState)("");
1684
+ const padPoints = (0, import_react14.useRef)(null);
1685
+ const ring = (0, import_react14.useMemo)(() => (0, import_paint_editor11.renderColorWheel)(wheelSize, wheel), [wheelSize, wheel]);
1627
1686
  const color = state.color;
1628
- const harmony = (0, import_react13.useMemo)(() => controller.harmony(kind, { color, wheel }), [controller, kind, color, wheel]);
1629
- const [r, g, b] = (0, import_paint_editor10.parseHexColor)(color);
1630
- const hsv = (0, import_paint_editor10.rgbToHsv)(r, g, b);
1631
- const effectWell = (0, import_react13.useMemo)(() => state.effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(64) : null, [controller, state.effectPaint, state.effectPaintRendering]);
1632
- const pad = (0, import_react13.useMemo)(() => ({ width: import_paint_editor10.MIXING_PAD_WIDTH, height: import_paint_editor10.MIXING_PAD_HEIGHT, data: controller.mixingPad.pixels() }), [controller, state.mixingPadVersion]);
1687
+ const harmony = (0, import_react14.useMemo)(() => controller.harmony(kind, { color, wheel }), [controller, kind, color, wheel]);
1688
+ const [r, g, b] = (0, import_paint_editor11.parseHexColor)(color);
1689
+ const hsv = (0, import_paint_editor11.rgbToHsv)(r, g, b);
1690
+ const effectWell = (0, import_react14.useMemo)(() => state.effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(64) : null, [controller, state.effectPaint, state.effectPaintRendering]);
1691
+ const pad = (0, import_react14.useMemo)(() => ({ width: import_paint_editor11.MIXING_PAD_WIDTH, height: import_paint_editor11.MIXING_PAD_HEIGHT, data: controller.mixingPad.pixels() }), [controller, state.mixingPadVersion]);
1633
1692
  const R = wheelSize / 2;
1634
1693
  const mid = R * 0.82;
1635
- const setHsv = (s, v) => controller.setColor((0, import_paint_editor10.rgbToHexColor)(...(0, import_paint_editor10.hsvToRgb)(hsv.h, s, v)));
1694
+ const setHsv = (s, v) => controller.setColor((0, import_paint_editor11.rgbToHexColor)(...(0, import_paint_editor11.hsvToRgb)(hsv.h, s, v)));
1636
1695
  const padPoint = (e) => {
1637
1696
  const rect = e.currentTarget.getBoundingClientRect();
1638
- const kx = import_paint_editor10.MIXING_PAD_WIDTH / (rect.width || import_paint_editor10.MIXING_PAD_WIDTH);
1639
- const ky = import_paint_editor10.MIXING_PAD_HEIGHT / (rect.height || import_paint_editor10.MIXING_PAD_HEIGHT);
1640
- const x = Math.min(import_paint_editor10.MIXING_PAD_WIDTH, Math.max(0, (e.clientX - rect.left) * kx));
1641
- const y = Math.min(import_paint_editor10.MIXING_PAD_HEIGHT, Math.max(0, (e.clientY - rect.top) * ky));
1697
+ const kx = import_paint_editor11.MIXING_PAD_WIDTH / (rect.width || import_paint_editor11.MIXING_PAD_WIDTH);
1698
+ const ky = import_paint_editor11.MIXING_PAD_HEIGHT / (rect.height || import_paint_editor11.MIXING_PAD_HEIGHT);
1699
+ const x = Math.min(import_paint_editor11.MIXING_PAD_WIDTH, Math.max(0, (e.clientX - rect.left) * kx));
1700
+ const y = Math.min(import_paint_editor11.MIXING_PAD_HEIGHT, Math.max(0, (e.clientY - rect.top) * ky));
1642
1701
  return e.pointerType === "pen" && e.pressure > 0 ? { x, y, pressure: e.pressure } : { x, y };
1643
1702
  };
1644
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "color-panel", children: [
1645
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "relative self-center", style: { width: wheelSize, height: wheelSize }, children: [
1646
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1703
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "color-panel", children: [
1704
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "relative self-center", style: { width: wheelSize, height: wheelSize }, children: [
1705
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1647
1706
  "div",
1648
1707
  {
1649
1708
  role: "slider",
1650
1709
  "aria-label": "Hue wheel",
1651
1710
  "aria-valuemin": 0,
1652
1711
  "aria-valuemax": 360,
1653
- "aria-valuenow": Math.round((0, import_paint_editor10.hueToWheel)(hsv.h, wheel)),
1712
+ "aria-valuenow": Math.round((0, import_paint_editor11.hueToWheel)(hsv.h, wheel)),
1654
1713
  tabIndex: 0,
1655
1714
  className: "absolute inset-0 cursor-crosshair",
1656
1715
  onPointerDown: (e) => {
1657
1716
  const rect = e.currentTarget.getBoundingClientRect();
1658
- controller.setColor((0, import_paint_editor10.wheelPick)(e.clientX - rect.left - R, e.clientY - rect.top - R, wheel, color));
1717
+ controller.setColor((0, import_paint_editor11.wheelPick)(e.clientX - rect.left - R, e.clientY - rect.top - R, wheel, color));
1659
1718
  },
1660
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PixelCanvas, { pixels: ring, label: "Colour wheel", style: { width: wheelSize, height: wheelSize } })
1719
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PixelCanvas, { pixels: ring, label: "Colour wheel", style: { width: wheelSize, height: wheelSize } })
1661
1720
  }
1662
1721
  ),
1663
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("svg", { className: "pointer-events-none absolute inset-0", width: wheelSize, height: wheelSize, "aria-hidden": "true", children: harmony.map((h, i) => {
1664
- const p = (0, import_paint_editor10.wheelPoint)(h.angle, mid);
1665
- return /* @__PURE__ */ (0, import_jsx_runtime15.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);
1722
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { className: "pointer-events-none absolute inset-0", width: wheelSize, height: wheelSize, "aria-hidden": "true", children: harmony.map((h, i) => {
1723
+ const p = (0, import_paint_editor11.wheelPoint)(h.angle, mid);
1724
+ return /* @__PURE__ */ (0, import_jsx_runtime16.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);
1666
1725
  }) }),
1667
- /* @__PURE__ */ (0, import_jsx_runtime15.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 } })
1726
+ /* @__PURE__ */ (0, import_jsx_runtime16.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 } })
1668
1727
  ] }),
1669
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2", children: [
1670
- /* @__PURE__ */ (0, import_jsx_runtime15.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" }),
1671
- /* @__PURE__ */ (0, import_jsx_runtime15.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" }),
1672
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, title: "Swap colours (X)", onClick: () => controller.swapColors(), children: "Swap" }),
1673
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1728
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
1729
+ /* @__PURE__ */ (0, import_jsx_runtime16.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" }),
1730
+ /* @__PURE__ */ (0, import_jsx_runtime16.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" }),
1731
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: button, title: "Swap colours (X)", onClick: () => controller.swapColors(), children: "Swap" }),
1732
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1674
1733
  "input",
1675
1734
  {
1676
1735
  "aria-label": "Hex colour",
@@ -1681,49 +1740,49 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1681
1740
  color
1682
1741
  )
1683
1742
  ] }),
1684
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2", "data-testid": "paint-source", children: [
1685
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1743
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", "data-testid": "paint-source", children: [
1744
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1686
1745
  "span",
1687
1746
  {
1688
1747
  className: "h-5 flex-1 rounded ring-1 ring-slate-700",
1689
1748
  "aria-label": state.effectPaint ? `Effect paint: ${state.effectPaint.effect}` : state.paint.type === "gradient" ? "Gradient paint" : "Paint colour",
1690
1749
  "data-testid": "paint-well",
1691
1750
  "data-effect-paint": state.effectPaint ? state.effectPaint.effect : void 0,
1692
- style: { background: effectWell ? `center / cover no-repeat url("${effectWell}")` : (0, import_paint_editor11.paintSourceCss)(state.paint, { paint: color, secondary: state.secondaryColor }) }
1751
+ style: { background: effectWell ? `center / cover no-repeat url("${effectWell}")` : (0, import_paint_editor12.paintSourceCss)(state.paint, { paint: color, secondary: state.secondaryColor }) }
1693
1752
  }
1694
1753
  ),
1695
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1754
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1696
1755
  "button",
1697
1756
  {
1698
1757
  type: "button",
1699
1758
  className: chip(state.paint.type === "gradient"),
1700
1759
  "aria-pressed": state.paint.type === "gradient",
1701
1760
  title: "Paint that changes colour as the stroke goes",
1702
- onClick: () => attempt(() => state.paint.type === "gradient" ? controller.setColor(color) : controller.setPaint(import_paint_editor11.DEFAULT_PAINT_GRADIENT)),
1761
+ onClick: () => attempt(() => state.paint.type === "gradient" ? controller.setColor(color) : controller.setPaint(import_paint_editor12.DEFAULT_PAINT_GRADIENT)),
1703
1762
  children: "Gradient"
1704
1763
  }
1705
1764
  )
1706
1765
  ] }),
1707
- state.paint.type === "gradient" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PaintGradientEditor, { value: state.paint, colors: { paint: color, secondary: state.secondaryColor }, onChange: (g2) => attempt(() => controller.setPaint(g2)) }),
1708
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-2", children: [
1709
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-16 text-slate-400", children: "Saturation" }),
1710
- /* @__PURE__ */ (0, import_jsx_runtime15.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" })
1766
+ state.paint.type === "gradient" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PaintGradientEditor, { value: state.paint, colors: { paint: color, secondary: state.secondaryColor }, onChange: (g2) => attempt(() => controller.setPaint(g2)) }),
1767
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-2", children: [
1768
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w-16 text-slate-400", children: "Saturation" }),
1769
+ /* @__PURE__ */ (0, import_jsx_runtime16.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" })
1711
1770
  ] }),
1712
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-2", children: [
1713
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-16 text-slate-400", children: "Value" }),
1714
- /* @__PURE__ */ (0, import_jsx_runtime15.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" })
1771
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-2", children: [
1772
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w-16 text-slate-400", children: "Value" }),
1773
+ /* @__PURE__ */ (0, import_jsx_runtime16.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" })
1715
1774
  ] }),
1716
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-1", children: [
1717
- /* @__PURE__ */ (0, import_jsx_runtime15.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_editor10.HARMONY_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: k, children: k }, k)) }),
1718
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: chip(wheel === "ryb"), "aria-pressed": wheel === "ryb", onClick: () => setWheel("ryb"), children: "RYB" }),
1719
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: chip(wheel === "rgb"), "aria-pressed": wheel === "rgb", onClick: () => setWheel("rgb"), children: "RGB" })
1775
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1", children: [
1776
+ /* @__PURE__ */ (0, import_jsx_runtime16.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_editor11.HARMONY_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: k, children: k }, k)) }),
1777
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: chip(wheel === "ryb"), "aria-pressed": wheel === "ryb", onClick: () => setWheel("ryb"), children: "RYB" }),
1778
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: chip(wheel === "rgb"), "aria-pressed": wheel === "rgb", onClick: () => setWheel("rgb"), children: "RGB" })
1720
1779
  ] }),
1721
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap gap-1", "aria-label": "Harmony colours", children: [
1722
- harmony.map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime15.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)),
1723
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, onClick: () => harmony.forEach((h) => controller.addSwatch(h.color)), children: "+ swatches" })
1780
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap gap-1", "aria-label": "Harmony colours", children: [
1781
+ harmony.map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime16.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)),
1782
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: button, onClick: () => harmony.forEach((h) => controller.addSwatch(h.color)), children: "+ swatches" })
1724
1783
  ] }),
1725
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": "Swatches", children: [
1726
- state.swatches.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1784
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": "Swatches", children: [
1785
+ state.swatches.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1727
1786
  "button",
1728
1787
  {
1729
1788
  type: "button",
@@ -1732,7 +1791,7 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1732
1791
  "aria-label": s.name ?? (s.paint ? "Gradient" : s.color),
1733
1792
  title: `${s.name ?? (s.paint ? "Gradient" : s.color)} (right-click to remove)`,
1734
1793
  className: "h-5 w-5 rounded ring-1 ring-slate-700",
1735
- style: { background: s.paint ? (0, import_paint_editor11.paintSourceCss)(s.paint, { paint: color, secondary: state.secondaryColor }) : s.color },
1794
+ style: { background: s.paint ? (0, import_paint_editor12.paintSourceCss)(s.paint, { paint: color, secondary: state.secondaryColor }) : s.color },
1736
1795
  onClick: () => attempt(() => s.paint ? controller.setPaint(s.paint) : controller.setColor(s.color)),
1737
1796
  onContextMenu: (e) => {
1738
1797
  e.preventDefault();
@@ -1741,15 +1800,15 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1741
1800
  },
1742
1801
  i
1743
1802
  )),
1744
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, "aria-label": "Add swatch", onClick: () => attempt(() => controller.addSwatch(state.paint)), children: "+" })
1803
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: button, "aria-label": "Add swatch", onClick: () => attempt(() => controller.addSwatch(state.paint)), children: "+" })
1745
1804
  ] }),
1746
- mixingPad && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-col gap-1", "data-testid": "mixing-pad", children: [
1747
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-1", children: [
1748
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-slate-400", children: "Mixing pad" }),
1749
- ["paint", "knife", "pick"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", "aria-pressed": padTool === t, className: chip(padTool === t), onClick: () => setPadTool(t), children: t === "paint" ? "Paint" : t === "knife" ? "Knife" : "Pick" }, t)),
1750
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, onClick: () => controller.clearMixingPad(), children: "Clear" })
1805
+ mixingPad && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col gap-1", "data-testid": "mixing-pad", children: [
1806
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1", children: [
1807
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-slate-400", children: "Mixing pad" }),
1808
+ ["paint", "knife", "pick"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", "aria-pressed": padTool === t, className: chip(padTool === t), onClick: () => setPadTool(t), children: t === "paint" ? "Paint" : t === "knife" ? "Knife" : "Pick" }, t)),
1809
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: button, onClick: () => controller.clearMixingPad(), children: "Clear" })
1751
1810
  ] }),
1752
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1811
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1753
1812
  "div",
1754
1813
  {
1755
1814
  role: "application",
@@ -1758,7 +1817,7 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1758
1817
  onPointerDown: (e) => {
1759
1818
  const p = padPoint(e);
1760
1819
  if (padTool === "pick") {
1761
- attempt(() => controller.mixingPadPick(p.x, p.y, { setColor: true, radius: (0, import_paint_editor10.padSampleRadius)(sample) }));
1820
+ attempt(() => controller.mixingPadPick(p.x, p.y, { setColor: true, radius: (0, import_paint_editor11.padSampleRadius)(sample) }));
1762
1821
  return;
1763
1822
  }
1764
1823
  padPoints.current = [p];
@@ -1770,20 +1829,20 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1770
1829
  padPoints.current = null;
1771
1830
  if (pts?.length) attempt(() => controller.mixingPadStroke(pts, { tool: padTool === "knife" ? "knife" : "paint" }));
1772
1831
  },
1773
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PixelCanvas, { pixels: pad, label: "Mixing pad pixels", className: "w-full rounded", style: { aspectRatio: `${import_paint_editor10.MIXING_PAD_WIDTH} / ${import_paint_editor10.MIXING_PAD_HEIGHT}` } })
1832
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PixelCanvas, { pixels: pad, label: "Mixing pad pixels", className: "w-full rounded", style: { aspectRatio: `${import_paint_editor11.MIXING_PAD_WIDTH} / ${import_paint_editor11.MIXING_PAD_HEIGHT}` } })
1774
1833
  }
1775
1834
  ),
1776
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex flex-wrap items-center gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-1", children: [
1777
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-slate-400", children: "Sample" }),
1778
- /* @__PURE__ */ (0, import_jsx_runtime15.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_editor10.PAD_SAMPLE_SIZES.map((n) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: n, children: n === 1 ? "1 px" : `${n}\xD7${n}` }, n)) })
1835
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex flex-wrap items-center gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1", children: [
1836
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-slate-400", children: "Sample" }),
1837
+ /* @__PURE__ */ (0, import_jsx_runtime16.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_editor11.PAD_SAMPLE_SIZES.map((n) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: n, children: n === 1 ? "1 px" : `${n}\xD7${n}` }, n)) })
1779
1838
  ] }) }),
1780
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1781
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: color } }),
1782
- /* @__PURE__ */ (0, import_jsx_runtime15.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" }),
1783
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-slate-500", children: ":" }),
1784
- /* @__PURE__ */ (0, import_jsx_runtime15.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" }),
1785
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: state.secondaryColor } }),
1786
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1839
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1840
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: color } }),
1841
+ /* @__PURE__ */ (0, import_jsx_runtime16.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" }),
1842
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-slate-500", children: ":" }),
1843
+ /* @__PURE__ */ (0, import_jsx_runtime16.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" }),
1844
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: state.secondaryColor } }),
1845
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1787
1846
  "button",
1788
1847
  {
1789
1848
  type: "button",
@@ -1802,25 +1861,25 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1802
1861
  }
1803
1862
  )
1804
1863
  ] }),
1805
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1806
- /* @__PURE__ */ (0, import_jsx_runtime15.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" }),
1807
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.saveMixingPad(padName || void 0), setPadName(""))), children: "Keep pad" })
1864
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1865
+ /* @__PURE__ */ (0, import_jsx_runtime16.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" }),
1866
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.saveMixingPad(padName || void 0), setPadName(""))), children: "Keep pad" })
1808
1867
  ] }),
1809
- state.savedMixingPads.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ul", { className: "flex flex-col gap-0.5", "aria-label": "Kept pads", children: state.savedMixingPads.map((p) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("li", { className: "flex items-center gap-1", children: [
1810
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: `${button} flex-1 text-left`, onClick: () => attempt(() => controller.loadMixingPad(p.id)), children: p.name }),
1811
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, "aria-label": `Remove ${p.name}`, onClick: () => attempt(() => controller.removeMixingPad(p.id)), children: "\xD7" })
1868
+ state.savedMixingPads.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { className: "flex flex-col gap-0.5", "aria-label": "Kept pads", children: state.savedMixingPads.map((p) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("li", { className: "flex items-center gap-1", children: [
1869
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: `${button} flex-1 text-left`, onClick: () => attempt(() => controller.loadMixingPad(p.id)), children: p.name }),
1870
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: button, "aria-label": `Remove ${p.name}`, onClick: () => attempt(() => controller.removeMixingPad(p.id)), children: "\xD7" })
1812
1871
  ] }, p.id)) })
1813
1872
  ] }),
1814
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ErrorLine, { error })
1873
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ErrorLine, { error })
1815
1874
  ] });
1816
1875
  };
1817
1876
 
1818
1877
  // src/paint-editor/PaintLayersPanel.tsx
1819
- var import_react16 = require("react");
1820
- var import_paint_editor12 = require("@pixerate/editor/paint-editor");
1878
+ var import_react17 = require("react");
1879
+ var import_paint_editor13 = require("@pixerate/editor/paint-editor");
1821
1880
 
1822
1881
  // src/image-editor/LayerEffectsPanel.tsx
1823
- var import_react15 = require("react");
1882
+ var import_react16 = require("react");
1824
1883
  var import_raster = require("@pixerate/editor/raster");
1825
1884
 
1826
1885
  // src/image-editor/styles.ts
@@ -1829,17 +1888,17 @@ var imageSelectClass = "rounded border border-input bg-background px-1.5 py-1 te
1829
1888
  var imageColorInputClass = "h-6 w-8 rounded border border-border bg-transparent";
1830
1889
 
1831
1890
  // src/image-editor/controls/controls.tsx
1832
- var import_react14 = require("react");
1833
- var import_jsx_runtime16 = require("react/jsx-runtime");
1834
- var ControlsContext = (0, import_react14.createContext)({});
1891
+ var import_react15 = require("react");
1892
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1893
+ var ControlsContext = (0, import_react15.createContext)({});
1835
1894
  function useImageEditorControls() {
1836
- return (0, import_react14.useContext)(ControlsContext);
1895
+ return (0, import_react15.useContext)(ControlsContext);
1837
1896
  }
1838
1897
  function ImageCheckbox(props) {
1839
1898
  const Host = useImageEditorControls().Checkbox;
1840
- if (Host) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Host, { ...props });
1899
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Host, { ...props });
1841
1900
  const { checked, label, disabled, onChange, className = "" } = props;
1842
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1901
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1843
1902
  "input",
1844
1903
  {
1845
1904
  type: "checkbox",
@@ -1853,9 +1912,9 @@ function ImageCheckbox(props) {
1853
1912
  }
1854
1913
  function ImageRange(props) {
1855
1914
  const Host = useImageEditorControls().Range;
1856
- if (Host) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Host, { ...props });
1915
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Host, { ...props });
1857
1916
  const { value, min, max, step, label, disabled, onChange, onStart, onEnd, className = "" } = props;
1858
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1917
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1859
1918
  "input",
1860
1919
  {
1861
1920
  type: "range",
@@ -1876,18 +1935,18 @@ function ImageRange(props) {
1876
1935
  }
1877
1936
  function ImageSelect(props) {
1878
1937
  const Host = useImageEditorControls().Select;
1879
- if (Host) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Host, { ...props });
1938
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Host, { ...props });
1880
1939
  const { value, options, label, placeholder, disabled, onChange, className = "" } = props;
1881
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("select", { "aria-label": label, value, disabled, onChange: (e) => onChange(e.target.value), className: `${imageSelectClass} ${className}`, children: [
1882
- placeholder !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "", children: placeholder }),
1883
- options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: o.value, children: o.label }, o.value))
1940
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("select", { "aria-label": label, value, disabled, onChange: (e) => onChange(e.target.value), className: `${imageSelectClass} ${className}`, children: [
1941
+ placeholder !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: placeholder }),
1942
+ options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: o.value, children: o.label }, o.value))
1884
1943
  ] });
1885
1944
  }
1886
1945
  function ImageColor(props) {
1887
1946
  const Host = useImageEditorControls().Color;
1888
- if (Host) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Host, { ...props });
1947
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Host, { ...props });
1889
1948
  const { value, label, alpha, disabled, onChange, className = "" } = props;
1890
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1949
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1891
1950
  "input",
1892
1951
  {
1893
1952
  type: "color",
@@ -1901,13 +1960,13 @@ function ImageColor(props) {
1901
1960
  }
1902
1961
 
1903
1962
  // src/image-editor/LayerEffectsPanel.tsx
1904
- var import_jsx_runtime17 = require("react/jsx-runtime");
1963
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1905
1964
  var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) => {
1906
- const [, setTick] = (0, import_react15.useState)(0);
1907
- (0, import_react15.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
1908
- const [open, setOpen] = (0, import_react15.useState)(null);
1909
- const [error, setError] = (0, import_react15.useState)(null);
1910
- const commitNext = (0, import_react15.useRef)(true);
1965
+ const [, setTick] = (0, import_react16.useState)(0);
1966
+ (0, import_react16.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
1967
+ const [open, setOpen] = (0, import_react16.useState)(null);
1968
+ const [error, setError] = (0, import_react16.useState)(null);
1969
+ const commitNext = (0, import_react16.useRef)(true);
1911
1970
  const layer = layerId ? controller.getLayer(layerId) : controller.getActiveLayer();
1912
1971
  const model = (0, import_raster.layerEffectsPanel)(layer);
1913
1972
  const id = layer?.id;
@@ -1920,7 +1979,7 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1920
1979
  }
1921
1980
  };
1922
1981
  if (!model.available || !id) {
1923
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: `text-xs text-muted-foreground ${className ?? ""}`, "data-testid": "layer-effects", children: model.reason });
1982
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: `text-xs text-muted-foreground ${className ?? ""}`, "data-testid": "layer-effects", children: model.reason });
1924
1983
  }
1925
1984
  const effects = controller.getLayerEffects(id);
1926
1985
  const patterns = controller.getDocumentPatterns();
@@ -1935,14 +1994,14 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1935
1994
  case "range": {
1936
1995
  const k = c.percent ? 100 : 1;
1937
1996
  const shown = Math.round(c.value * k * 100) / 100;
1938
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1939
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "text-muted-foreground", children: [
1997
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1998
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "text-muted-foreground", children: [
1940
1999
  label,
1941
2000
  " ",
1942
2001
  shown,
1943
2002
  c.unit
1944
2003
  ] }),
1945
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2004
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1946
2005
  ImageRange,
1947
2006
  {
1948
2007
  label,
@@ -1959,19 +2018,19 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1959
2018
  ] }, c.key);
1960
2019
  }
1961
2020
  case "color":
1962
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1963
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ImageColor, { label, value: c.value, disabled: model.readOnly, onChange: (v) => change(effectId, c, v) }),
2021
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
2022
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ImageColor, { label, value: c.value, disabled: model.readOnly, onChange: (v) => change(effectId, c, v) }),
1964
2023
  label
1965
2024
  ] }, c.key);
1966
2025
  case "checkbox":
1967
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1968
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ImageCheckbox, { label, checked: c.value, disabled: model.readOnly, onChange: (on) => change(effectId, c, on) }),
2026
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
2027
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ImageCheckbox, { label, checked: c.value, disabled: model.readOnly, onChange: (on) => change(effectId, c, on) }),
1969
2028
  label
1970
2029
  ] }, c.key);
1971
2030
  case "select":
1972
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1973
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-muted-foreground", children: label }),
1974
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2031
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
2032
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-muted-foreground", children: label }),
2033
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1975
2034
  ImageSelect,
1976
2035
  {
1977
2036
  label,
@@ -1984,16 +2043,16 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1984
2043
  ] }, c.key);
1985
2044
  }
1986
2045
  };
1987
- return /* @__PURE__ */ (0, import_jsx_runtime17.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: [
1988
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
1989
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "font-semibold text-foreground", children: heading ? "Layer Style" : "Styles" }),
1990
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
1991
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ImageCheckbox, { label: "Effects on", checked: model.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.setLayerEffectsEnabled(id, on)) }),
2046
+ return /* @__PURE__ */ (0, import_jsx_runtime18.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: [
2047
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
2048
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "font-semibold text-foreground", children: heading ? "Layer Style" : "Styles" }),
2049
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
2050
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ImageCheckbox, { label: "Effects on", checked: model.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.setLayerEffectsEnabled(id, on)) }),
1992
2051
  "On"
1993
2052
  ] }),
1994
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
2053
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
1995
2054
  "Scale",
1996
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2055
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1997
2056
  "input",
1998
2057
  {
1999
2058
  type: "number",
@@ -2012,7 +2071,7 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
2012
2071
  ),
2013
2072
  "%"
2014
2073
  ] }),
2015
- heading && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2074
+ heading && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2016
2075
  ImageSelect,
2017
2076
  {
2018
2077
  label: "Add style",
@@ -2028,14 +2087,14 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
2028
2087
  }
2029
2088
  )
2030
2089
  ] }),
2031
- model.readOnly && model.reason && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-muted-foreground", children: model.reason }),
2032
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Effects", children: model.rows.map((row) => {
2090
+ model.readOnly && model.reason && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-muted-foreground", children: model.reason }),
2091
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Effects", children: model.rows.map((row) => {
2033
2092
  const effect = effects.items.find((e) => e.id === row.id);
2034
2093
  const expanded = open === row.id;
2035
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("li", { "data-effect-id": row.id, className: "rounded bg-background/60 ring-1 ring-border", children: [
2036
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-1.5 px-1.5 py-1", children: [
2037
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ImageCheckbox, { label: `${row.label} on`, checked: row.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.updateLayerEffect(id, row.id, { enabled: on })) }),
2038
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2094
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("li", { "data-effect-id": row.id, className: "rounded bg-background/60 ring-1 ring-border", children: [
2095
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1.5 px-1.5 py-1", children: [
2096
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ImageCheckbox, { label: `${row.label} on`, checked: row.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.updateLayerEffect(id, row.id, { enabled: on })) }),
2097
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2039
2098
  "button",
2040
2099
  {
2041
2100
  type: "button",
@@ -2045,17 +2104,17 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
2045
2104
  children: row.label
2046
2105
  }
2047
2106
  ),
2048
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: imageIconButtonClass, "aria-label": `Remove ${row.label}`, disabled: model.readOnly, onClick: () => attempt(() => controller.removeLayerEffect(id, row.id)), children: "\u2715" })
2107
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: imageIconButtonClass, "aria-label": `Remove ${row.label}`, disabled: model.readOnly, onClick: () => attempt(() => controller.removeLayerEffect(id, row.id)), children: "\u2715" })
2049
2108
  ] }),
2050
- expanded && /* @__PURE__ */ (0, import_jsx_runtime17.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)) })
2109
+ expanded && /* @__PURE__ */ (0, import_jsx_runtime18.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)) })
2051
2110
  ] }, row.id);
2052
2111
  }) }),
2053
- error && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { role: "alert", className: "text-destructive", children: error })
2112
+ error && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { role: "alert", className: "text-destructive", children: error })
2054
2113
  ] });
2055
2114
  };
2056
2115
 
2057
2116
  // src/paint-editor/PaintLayersPanel.tsx
2058
- var import_jsx_runtime18 = require("react/jsx-runtime");
2117
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2059
2118
  function siblingIndex(layers, l) {
2060
2119
  const sibs = layers.filter((x) => x.parentId === l.parentId).reverse();
2061
2120
  return { index: sibs.findIndex((x) => x.id === l.id), count: sibs.length };
@@ -2063,7 +2122,7 @@ function siblingIndex(layers, l) {
2063
2122
  var PaintLayersPanel = ({ controller, className }) => {
2064
2123
  usePaintEditorState(controller);
2065
2124
  const [error, attempt] = useAttempt();
2066
- const [renaming, setRenaming] = (0, import_react16.useState)(null);
2125
+ const [renaming, setRenaming] = (0, import_react17.useState)(null);
2067
2126
  const layers = controller.listLayers().filter((l) => !l.temporary);
2068
2127
  const active = layers.find((l) => l.active) ?? null;
2069
2128
  const light = active?.type === "pixel" ? controller.lightOf(active.id) : null;
@@ -2073,18 +2132,18 @@ var PaintLayersPanel = ({ controller, className }) => {
2073
2132
  const to = Math.min(count - 1, Math.max(0, index + delta));
2074
2133
  if (to !== index) attempt(() => controller.moveLayer(active.id, to));
2075
2134
  };
2076
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-layers-panel", children: [
2077
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2078
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer()), children: "New layer" }),
2079
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer({ type: "group" })), children: "New group" }),
2080
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, title: "A layer whose strokes stay editable", onClick: () => attempt(() => controller.addLayer({ type: "strokes" })), children: "New stroke layer" }),
2081
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.duplicateLayer(active.id)), children: "Duplicate" }),
2082
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer up", onClick: () => move(1), children: "\u2191" }),
2083
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer down", onClick: () => move(-1), children: "\u2193" }),
2084
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.mergeDown(active.id)), children: "Merge down" }),
2085
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, disabled: !active || layers.length < 2, onClick: () => active && attempt(() => controller.removeLayer(active.id)), children: "Delete" })
2135
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-layers-panel", children: [
2136
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2137
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer()), children: "New layer" }),
2138
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer({ type: "group" })), children: "New group" }),
2139
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, title: "A layer whose strokes stay editable", onClick: () => attempt(() => controller.addLayer({ type: "strokes" })), children: "New stroke layer" }),
2140
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.duplicateLayer(active.id)), children: "Duplicate" }),
2141
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer up", onClick: () => move(1), children: "\u2191" }),
2142
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer down", onClick: () => move(-1), children: "\u2193" }),
2143
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.mergeDown(active.id)), children: "Merge down" }),
2144
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, disabled: !active || layers.length < 2, onClick: () => active && attempt(() => controller.removeLayer(active.id)), children: "Delete" })
2086
2145
  ] }),
2087
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("ul", { role: "tree", "aria-label": "Layers", className: "flex flex-col gap-0.5", children: layers.map((l) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2146
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("ul", { role: "tree", "aria-label": "Layers", className: "flex flex-col gap-0.5", children: layers.map((l) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2088
2147
  "li",
2089
2148
  {
2090
2149
  role: "treeitem",
@@ -2093,7 +2152,7 @@ var PaintLayersPanel = ({ controller, className }) => {
2093
2152
  style: { paddingLeft: 6 + l.depth * 12 },
2094
2153
  onClick: () => controller.setActiveLayer(l.id),
2095
2154
  children: [
2096
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2155
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2097
2156
  "button",
2098
2157
  {
2099
2158
  type: "button",
@@ -2106,7 +2165,7 @@ var PaintLayersPanel = ({ controller, className }) => {
2106
2165
  children: l.visible ? "\u25CF" : "\u25CB"
2107
2166
  }
2108
2167
  ),
2109
- renaming === l.id ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2168
+ renaming === l.id ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2110
2169
  "input",
2111
2170
  {
2112
2171
  autoFocus: true,
@@ -2123,23 +2182,23 @@ var PaintLayersPanel = ({ controller, className }) => {
2123
2182
  if (e.key === "Escape") setRenaming(null);
2124
2183
  }
2125
2184
  }
2126
- ) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "flex-1 truncate", onDoubleClick: () => setRenaming(l.id), children: [
2185
+ ) : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "flex-1 truncate", onDoubleClick: () => setRenaming(l.id), children: [
2127
2186
  l.type === "group" ? "\u25B8 " : "",
2128
- l.liveStrokes !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { "aria-label": "Stroke layer", title: `Stroke layer: ${l.liveStrokes} editable strokes`, children: [
2187
+ l.liveStrokes !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { "aria-label": "Stroke layer", title: `Stroke layer: ${l.liveStrokes} editable strokes`, children: [
2129
2188
  "\u270E",
2130
2189
  " "
2131
2190
  ] }),
2132
2191
  l.name
2133
2192
  ] }),
2134
- l.locks.pixels || l.locks.all ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { title: "Locked", children: "\u{1F512}" }) : null
2193
+ l.locks.pixels || l.locks.all ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { title: "Locked", children: "\u{1F512}" }) : null
2135
2194
  ]
2136
2195
  },
2137
2196
  l.id
2138
2197
  )) }),
2139
- active && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
2140
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-2", children: [
2141
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "w-14 text-slate-400", children: "Opacity" }),
2142
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2198
+ active && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
2199
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-2", children: [
2200
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "w-14 text-slate-400", children: "Opacity" }),
2201
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2143
2202
  "input",
2144
2203
  {
2145
2204
  type: "range",
@@ -2153,40 +2212,40 @@ var PaintLayersPanel = ({ controller, className }) => {
2153
2212
  }
2154
2213
  )
2155
2214
  ] }),
2156
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-2", children: [
2157
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "w-14 text-slate-400", children: "Blend" }),
2158
- /* @__PURE__ */ (0, import_jsx_runtime18.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: [
2159
- active.type === "group" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "pass-through", children: "Pass through" }),
2160
- import_paint_editor12.BLEND_MENU_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("optgroup", { label: g.label, children: g.modes.map((m) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: m.id, title: m.description, children: m.label }, m.id)) }, g.label))
2215
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-2", children: [
2216
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "w-14 text-slate-400", children: "Blend" }),
2217
+ /* @__PURE__ */ (0, import_jsx_runtime19.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: [
2218
+ active.type === "group" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "pass-through", children: "Pass through" }),
2219
+ import_paint_editor13.BLEND_MENU_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("optgroup", { label: g.label, children: g.modes.map((m) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: m.id, title: m.description, children: m.label }, m.id)) }, g.label))
2161
2220
  ] })
2162
2221
  ] }),
2163
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex gap-1", children: [
2164
- ["pixels", "transparency"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime18.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)),
2165
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", "aria-pressed": active.clipped, className: chip(active.clipped), onClick: () => attempt(() => controller.updateLayer(active.id, { clipped: !active.clipped })), children: "Clip" })
2222
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex gap-1", children: [
2223
+ ["pixels", "transparency"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime19.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)),
2224
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", "aria-pressed": active.clipped, className: chip(active.clipped), onClick: () => attempt(() => controller.updateLayer(active.id, { clipped: !active.clipped })), children: "Clip" })
2166
2225
  ] }),
2167
- light?.hasLight && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-1.5 border-t border-slate-800 pt-1.5", "data-testid": "layer-light", children: [
2168
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center justify-between", children: [
2169
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "font-medium text-slate-300", title: "This layer's paint gives off light", children: "Light" }),
2170
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.clearLight(active.id)), children: "Clear light" })
2226
+ light?.hasLight && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-1.5 border-t border-slate-800 pt-1.5", "data-testid": "layer-light", children: [
2227
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between", children: [
2228
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "font-medium text-slate-300", title: "This layer's paint gives off light", children: "Light" }),
2229
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.clearLight(active.id)), children: "Clear light" })
2171
2230
  ] }),
2172
- /* @__PURE__ */ (0, import_jsx_runtime18.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: [
2173
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "w-14 text-slate-400", children: "Spill" }),
2174
- /* @__PURE__ */ (0, import_jsx_runtime18.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" })
2231
+ /* @__PURE__ */ (0, import_jsx_runtime19.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: [
2232
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "w-14 text-slate-400", children: "Spill" }),
2233
+ /* @__PURE__ */ (0, import_jsx_runtime19.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" })
2175
2234
  ] }),
2176
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-2", children: [
2177
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "w-14 text-slate-400", children: "Strength" }),
2178
- /* @__PURE__ */ (0, import_jsx_runtime18.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" })
2235
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-2", children: [
2236
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "w-14 text-slate-400", children: "Strength" }),
2237
+ /* @__PURE__ */ (0, import_jsx_runtime19.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" })
2179
2238
  ] })
2180
2239
  ] }),
2181
- /* @__PURE__ */ (0, import_jsx_runtime18.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_runtime18.jsx)(LayerEffectsPanel, { controller, layerId: active.id }) })
2240
+ /* @__PURE__ */ (0, import_jsx_runtime19.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_runtime19.jsx)(LayerEffectsPanel, { controller, layerId: active.id }) })
2182
2241
  ] }),
2183
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ErrorLine, { error })
2242
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ErrorLine, { error })
2184
2243
  ] });
2185
2244
  };
2186
2245
 
2187
2246
  // src/paint-editor/WetPanel.tsx
2188
- var import_paint_editor13 = require("@pixerate/editor/paint-editor");
2189
- var import_jsx_runtime19 = require("react/jsx-runtime");
2247
+ var import_paint_editor14 = require("@pixerate/editor/paint-editor");
2248
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2190
2249
  var FLOW_LABELS = { none: "None", linear: "One way", swirl: "Swirl", radial: "Outwards", turbulent: "Eddies" };
2191
2250
  var WetPanel = ({ controller, className }) => {
2192
2251
  const state = usePaintEditorState(controller);
@@ -2196,31 +2255,31 @@ var WetPanel = ({ controller, className }) => {
2196
2255
  const info = layerId ? controller.wetLayerInfo(layerId) : null;
2197
2256
  const livePattern = layerId ? controller.getLivePatterns(layerId).layers[0] ?? null : null;
2198
2257
  const backend = controller.wetState();
2199
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "wet-panel", children: [
2200
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between", children: [
2201
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: wet.wet ? "text-sky-300" : "text-slate-400", "data-testid": "wet-status", children: wet.wet ? wet.paused ? "Wet (paused)" : "Wet" : "Dry" }),
2202
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "text-[10px] text-slate-500", children: [
2258
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "wet-panel", children: [
2259
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between", children: [
2260
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: wet.wet ? "text-sky-300" : "text-slate-400", "data-testid": "wet-status", children: wet.wet ? wet.paused ? "Wet (paused)" : "Wet" : "Dry" }),
2261
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "text-[10px] text-slate-500", children: [
2203
2262
  "step ",
2204
2263
  wet.clock
2205
2264
  ] })
2206
2265
  ] }),
2207
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2208
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, disabled: !wet.layerIds.length, onClick: () => attempt(async () => (await controller.wetIdle(), controller.dryPaint())), children: "Dry now" }),
2209
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: chip(wet.paused), "aria-pressed": wet.paused, onClick: () => controller.setWetPaused(!wet.paused), children: wet.paused ? "Resume" : "Pause" }),
2210
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: chip(wet.overlay), "aria-pressed": wet.overlay, onClick: () => controller.setWaterOverlay(!wet.overlay), children: "Water" }),
2211
- /* @__PURE__ */ (0, import_jsx_runtime19.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" }),
2212
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, disabled: !layerId, onClick: () => attempt(async () => (await controller.wetIdle(), controller.wetPaper({}))), children: "Wet paper" })
2266
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2267
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, disabled: !wet.layerIds.length, onClick: () => attempt(async () => (await controller.wetIdle(), controller.dryPaint())), children: "Dry now" }),
2268
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: chip(wet.paused), "aria-pressed": wet.paused, onClick: () => controller.setWetPaused(!wet.paused), children: wet.paused ? "Resume" : "Pause" }),
2269
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: chip(wet.overlay), "aria-pressed": wet.overlay, onClick: () => controller.setWaterOverlay(!wet.overlay), children: "Water" }),
2270
+ /* @__PURE__ */ (0, import_jsx_runtime20.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" }),
2271
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, disabled: !layerId, onClick: () => attempt(async () => (await controller.wetIdle(), controller.wetPaper({}))), children: "Wet paper" })
2213
2272
  ] }),
2214
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PaintSlider, { control: import_paint_editor13.WET_SPEED_SLIDER, value: wet.speed, onChange: (v) => controller.setWetSpeed(v) }),
2215
- import_paint_editor13.WET_TILT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor13.readPath)(wet.tilt, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setCanvasTilt({ [c.path]: v }))) }, c.path)),
2216
- info && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-layer", children: [
2217
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "font-medium text-slate-300", children: "This layer" }),
2218
- import_paint_editor13.WET_PARAM_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor13.readPath)(info.params, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setWetParams(layerId, { [c.path]: v }))) }, c.path)),
2219
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2220
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-slate-400", children: "Flow map" }),
2221
- /* @__PURE__ */ (0, import_jsx_runtime19.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_editor13.WET_FLOW_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: k, children: FLOW_LABELS[k] }, k)) })
2273
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PaintSlider, { control: import_paint_editor14.WET_SPEED_SLIDER, value: wet.speed, onChange: (v) => controller.setWetSpeed(v) }),
2274
+ import_paint_editor14.WET_TILT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor14.readPath)(wet.tilt, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setCanvasTilt({ [c.path]: v }))) }, c.path)),
2275
+ info && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-layer", children: [
2276
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "font-medium text-slate-300", children: "This layer" }),
2277
+ import_paint_editor14.WET_PARAM_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor14.readPath)(info.params, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setWetParams(layerId, { [c.path]: v }))) }, c.path)),
2278
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2279
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "Flow map" }),
2280
+ /* @__PURE__ */ (0, import_jsx_runtime20.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_editor14.WET_FLOW_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: k, children: FLOW_LABELS[k] }, k)) })
2222
2281
  ] }),
2223
- info.flow.kind !== "none" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2282
+ info.flow.kind !== "none" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2224
2283
  PaintSlider,
2225
2284
  {
2226
2285
  control: { path: "strength", label: "Flow strength", min: 0, max: 1, step: 0.01 },
@@ -2229,10 +2288,10 @@ var WetPanel = ({ controller, className }) => {
2229
2288
  }
2230
2289
  )
2231
2290
  ] }),
2232
- livePattern && layerId && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-live-patterns", children: [
2233
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between", children: [
2234
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "font-medium text-slate-300", children: "Live patterns" }),
2235
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2291
+ livePattern && layerId && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-live-patterns", children: [
2292
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between", children: [
2293
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "font-medium text-slate-300", children: "Live patterns" }),
2294
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2236
2295
  "button",
2237
2296
  {
2238
2297
  type: "button",
@@ -2247,35 +2306,35 @@ var WetPanel = ({ controller, className }) => {
2247
2306
  }
2248
2307
  )
2249
2308
  ] }),
2250
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2251
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-slate-400", children: "Pattern" }),
2252
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2309
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2310
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "Pattern" }),
2311
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2253
2312
  "select",
2254
2313
  {
2255
2314
  "aria-label": "Live pattern",
2256
2315
  value: livePattern.settings.pattern,
2257
2316
  onChange: (e) => attempt(async () => (await controller.wetIdle(), controller.setLivePatterns(layerId, { pattern: e.target.value }))),
2258
2317
  className: "rounded bg-slate-800 px-1 py-0.5",
2259
- children: import_paint_editor13.LIVE_PATTERN_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: k, children: import_paint_editor13.LIVE_PATTERN_LABELS[k] }, k))
2318
+ children: import_paint_editor14.LIVE_PATTERN_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: k, children: import_paint_editor14.LIVE_PATTERN_LABELS[k] }, k))
2260
2319
  }
2261
2320
  )
2262
2321
  ] }),
2263
- import_paint_editor13.LIVE_PATTERN_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor13.readPath)(livePattern.settings, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setLivePatterns(layerId, { [c.path]: v }))) }, c.path))
2322
+ import_paint_editor14.LIVE_PATTERN_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor14.readPath)(livePattern.settings, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setLivePatterns(layerId, { [c.path]: v }))) }, c.path))
2264
2323
  ] }),
2265
- backend.message && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[10px] text-amber-300", "data-testid": "wet-message", children: backend.message }),
2266
- backend.backend && /* @__PURE__ */ (0, import_jsx_runtime19.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" }),
2267
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2268
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-slate-400", children: "Engine" }),
2269
- /* @__PURE__ */ (0, import_jsx_runtime19.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_editor13.WET_GPU_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: o.value, children: o.label }, o.value)) })
2324
+ backend.message && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[10px] text-amber-300", "data-testid": "wet-message", children: backend.message }),
2325
+ backend.backend && /* @__PURE__ */ (0, import_jsx_runtime20.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" }),
2326
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2327
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "Engine" }),
2328
+ /* @__PURE__ */ (0, import_jsx_runtime20.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_editor14.WET_GPU_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: o.value, children: o.label }, o.value)) })
2270
2329
  ] }),
2271
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: `text-[10px] ${backend.engine.state === "active" ? "text-emerald-300" : "text-slate-500"}`, "data-testid": "wet-engine", children: (0, import_paint_editor13.wetEngineSummary)(backend.engine) }),
2272
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ErrorLine, { error })
2330
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: `text-[10px] ${backend.engine.state === "active" ? "text-emerald-300" : "text-slate-500"}`, "data-testid": "wet-engine", children: (0, import_paint_editor14.wetEngineSummary)(backend.engine) }),
2331
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ErrorLine, { error })
2273
2332
  ] });
2274
2333
  };
2275
2334
 
2276
2335
  // src/paint-editor/StickerPanel.tsx
2277
- var import_paint_editor14 = require("@pixerate/editor/paint-editor");
2278
- var import_jsx_runtime20 = require("react/jsx-runtime");
2336
+ var import_paint_editor15 = require("@pixerate/editor/paint-editor");
2337
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2279
2338
  var StickerPanel = ({ controller, className }) => {
2280
2339
  const state = usePaintEditorState(controller);
2281
2340
  const [error, attempt] = useAttempt();
@@ -2285,16 +2344,16 @@ var StickerPanel = ({ controller, className }) => {
2285
2344
  const stickers = layerId ? state.document.stickers?.[layerId] ?? [] : [];
2286
2345
  if (!stickers.length) return null;
2287
2346
  const sel = stickers.find((s) => s.id === picked) ?? null;
2288
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "sticker-panel", children: [
2289
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "font-medium text-slate-300", children: [
2347
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "sticker-panel", children: [
2348
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "font-medium text-slate-300", children: [
2290
2349
  "Stickers (",
2291
2350
  stickers.length,
2292
2351
  ")"
2293
2352
  ] }),
2294
- /* @__PURE__ */ (0, import_jsx_runtime20.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_runtime20.jsx)("button", { type: "button", role: "option", "aria-selected": s.id === picked, title: `${(0, import_paint_editor14.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)) }),
2295
- sel && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "sticker-edit", children: [
2296
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "Sticker" }),
2297
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2353
+ /* @__PURE__ */ (0, import_jsx_runtime21.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_runtime21.jsx)("button", { type: "button", role: "option", "aria-selected": s.id === picked, title: `${(0, import_paint_editor15.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)) }),
2354
+ sel && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "sticker-edit", children: [
2355
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-slate-400", children: "Sticker" }),
2356
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2298
2357
  StickerPicker,
2299
2358
  {
2300
2359
  controller,
@@ -2308,9 +2367,9 @@ var StickerPanel = ({ controller, className }) => {
2308
2367
  )
2309
2368
  }
2310
2369
  ),
2311
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
2312
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "Position" }),
2313
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "flex gap-1", children: ["x", "y"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2370
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
2371
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-slate-400", children: "Position" }),
2372
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex gap-1", children: ["x", "y"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2314
2373
  "input",
2315
2374
  {
2316
2375
  type: "number",
@@ -2324,24 +2383,24 @@ var StickerPanel = ({ controller, className }) => {
2324
2383
  `${sel.id}-${k}-${sel[k]}`
2325
2384
  )) })
2326
2385
  ] }),
2327
- import_paint_editor14.STICKER_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor14.readPath)(sel, c.path), onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { [c.path]: v })) }, c.path)),
2328
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center justify-between", children: [
2329
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "Colour" }),
2330
- /* @__PURE__ */ (0, import_jsx_runtime20.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" })
2386
+ import_paint_editor15.STICKER_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor15.readPath)(sel, c.path), onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { [c.path]: v })) }, c.path)),
2387
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center justify-between", children: [
2388
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-slate-400", children: "Colour" }),
2389
+ /* @__PURE__ */ (0, import_jsx_runtime21.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" })
2331
2390
  ] }),
2332
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2333
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "front")), children: "To front" }),
2334
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "back")), children: "To back" }),
2335
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStickers(layerId, [sel.id]), setPicked(null))), children: "Delete" })
2391
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2392
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "front")), children: "To front" }),
2393
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "back")), children: "To back" }),
2394
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStickers(layerId, [sel.id]), setPicked(null))), children: "Delete" })
2336
2395
  ] })
2337
2396
  ] }),
2338
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ErrorLine, { error })
2397
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ErrorLine, { error })
2339
2398
  ] });
2340
2399
  };
2341
2400
 
2342
2401
  // src/paint-editor/StrokePanel.tsx
2343
- var import_paint_editor15 = require("@pixerate/editor/paint-editor");
2344
- var import_jsx_runtime21 = require("react/jsx-runtime");
2402
+ var import_paint_editor16 = require("@pixerate/editor/paint-editor");
2403
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2345
2404
  var StrokePanel = ({ controller, className }) => {
2346
2405
  const state = usePaintEditorState(controller);
2347
2406
  const [error, attempt] = useAttempt();
@@ -2350,17 +2409,17 @@ var StrokePanel = ({ controller, className }) => {
2350
2409
  if (!layerId || !strokes) return null;
2351
2410
  const index = strokes.findIndex((s) => s.id === state.selectedStroke);
2352
2411
  const sel = index >= 0 ? strokes[index] : null;
2353
- const brushes = state.brushes.filter((b) => !(0, import_paint_editor15.liveStrokeRefusal)(b));
2354
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "stroke-panel", children: [
2355
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between", children: [
2356
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "font-medium text-slate-300", children: [
2412
+ const brushes = state.brushes.filter((b) => !(0, import_paint_editor16.liveStrokeRefusal)(b));
2413
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "stroke-panel", children: [
2414
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center justify-between", children: [
2415
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "font-medium text-slate-300", children: [
2357
2416
  "Strokes (",
2358
2417
  strokes.length,
2359
2418
  ")"
2360
2419
  ] }),
2361
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.rasterizeLiveStrokes(layerId)), children: "Rasterize" })
2420
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.rasterizeLiveStrokes(layerId)), children: "Rasterize" })
2362
2421
  ] }),
2363
- /* @__PURE__ */ (0, import_jsx_runtime21.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_runtime21.jsx)(
2422
+ /* @__PURE__ */ (0, import_jsx_runtime22.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_runtime22.jsx)(
2364
2423
  "button",
2365
2424
  {
2366
2425
  type: "button",
@@ -2373,10 +2432,10 @@ var StrokePanel = ({ controller, className }) => {
2373
2432
  },
2374
2433
  s.id
2375
2434
  )) }),
2376
- sel && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "stroke-edit", children: [
2377
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2378
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-slate-400", children: "Brush" }),
2379
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2435
+ sel && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "stroke-edit", children: [
2436
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2437
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-slate-400", children: "Brush" }),
2438
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2380
2439
  "select",
2381
2440
  {
2382
2441
  "aria-label": "Stroke brush",
@@ -2384,41 +2443,41 @@ var StrokePanel = ({ controller, className }) => {
2384
2443
  onChange: (e) => e.target.value && attempt(() => controller.updateStroke(sel.id, { brushId: e.target.value })),
2385
2444
  className: "max-w-[10rem] rounded bg-slate-800 px-1 py-0.5",
2386
2445
  children: [
2387
- !brushes.some((b) => b.id === sel.brush.id) && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "", children: sel.brush.name }),
2388
- brushes.map((b) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: b.id, children: b.name }, b.id))
2446
+ !brushes.some((b) => b.id === sel.brush.id) && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "", children: sel.brush.name }),
2447
+ brushes.map((b) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: b.id, children: b.name }, b.id))
2389
2448
  ]
2390
2449
  }
2391
2450
  )
2392
2451
  ] }),
2393
- import_paint_editor15.STROKE_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor15.readPath)(sel.brush, c.path), onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { brush: { tip: { [c.path.split(".")[1]]: v } } })) }, c.path)),
2394
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center justify-between", children: [
2395
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-slate-400", children: "Colour" }),
2396
- /* @__PURE__ */ (0, import_jsx_runtime21.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" })
2452
+ import_paint_editor16.STROKE_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor16.readPath)(sel.brush, c.path), onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { brush: { tip: { [c.path.split(".")[1]]: v } } })) }, c.path)),
2453
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center justify-between", children: [
2454
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-slate-400", children: "Colour" }),
2455
+ /* @__PURE__ */ (0, import_jsx_runtime22.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" })
2397
2456
  ] }),
2398
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2399
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.updateStroke(sel.id, { seed: (sel.seed + 1) % 2147483647 })), children: "New seed" }),
2400
- /* @__PURE__ */ (0, import_jsx_runtime21.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" }),
2401
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, disabled: index === 0, "aria-label": "Move stroke down", onClick: () => attempt(() => controller.reorderStroke(sel.id, index - 1)), children: "\u2193" }),
2402
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStrokes([sel.id]), controller.selectStroke(null))), children: "Delete" })
2457
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2458
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.updateStroke(sel.id, { seed: (sel.seed + 1) % 2147483647 })), children: "New seed" }),
2459
+ /* @__PURE__ */ (0, import_jsx_runtime22.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" }),
2460
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: button, disabled: index === 0, "aria-label": "Move stroke down", onClick: () => attempt(() => controller.reorderStroke(sel.id, index - 1)), children: "\u2193" }),
2461
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStrokes([sel.id]), controller.selectStroke(null))), children: "Delete" })
2403
2462
  ] })
2404
2463
  ] }),
2405
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ErrorLine, { error })
2464
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ErrorLine, { error })
2406
2465
  ] });
2407
2466
  };
2408
2467
 
2409
2468
  // src/paint-editor/PathStrokePanel.tsx
2410
- var import_react17 = require("react");
2411
- var import_paint_editor16 = require("@pixerate/editor/paint-editor");
2412
- var import_jsx_runtime22 = require("react/jsx-runtime");
2469
+ var import_react18 = require("react");
2470
+ var import_paint_editor17 = require("@pixerate/editor/paint-editor");
2471
+ var import_jsx_runtime23 = require("react/jsx-runtime");
2413
2472
  var PathStrokePanel = ({ controller, className }) => {
2414
2473
  const state = usePaintEditorState(controller);
2415
2474
  const [error, attempt] = useAttempt();
2416
- const [path, setPath] = (0, import_react17.useState)("");
2417
- const [taper, setTaper] = (0, import_react17.useState)(import_paint_editor16.PATH_STROKE_TAPERS[0].id);
2418
- const pressure = import_paint_editor16.PATH_STROKE_TAPERS.find((t) => t.id === taper)?.pressure;
2419
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "path-stroke-panel", children: [
2420
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "font-medium text-slate-300", children: "Brush a path" }),
2421
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2475
+ const [path, setPath] = (0, import_react18.useState)("");
2476
+ const [taper, setTaper] = (0, import_react18.useState)(import_paint_editor17.PATH_STROKE_TAPERS[0].id);
2477
+ const pressure = import_paint_editor17.PATH_STROKE_TAPERS.find((t) => t.id === taper)?.pressure;
2478
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "path-stroke-panel", children: [
2479
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-medium text-slate-300", children: "Brush a path" }),
2480
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2422
2481
  "textarea",
2423
2482
  {
2424
2483
  "aria-label": "SVG path data",
@@ -2429,33 +2488,33 @@ var PathStrokePanel = ({ controller, className }) => {
2429
2488
  className: "w-full resize-y rounded bg-slate-800 px-1 py-0.5 font-mono text-[11px]"
2430
2489
  }
2431
2490
  ),
2432
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-2", children: [
2433
- /* @__PURE__ */ (0, import_jsx_runtime22.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_editor16.PATH_STROKE_TAPERS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: t.id, children: t.label }, t.id)) }),
2434
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: button, disabled: !path.trim() || state.stroking, onClick: () => attempt(() => controller.strokePath({ path, ...pressure ? { pressure } : {} })), children: "Brush path" })
2491
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2", children: [
2492
+ /* @__PURE__ */ (0, import_jsx_runtime23.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_editor17.PATH_STROKE_TAPERS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: t.id, children: t.label }, t.id)) }),
2493
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: button, disabled: !path.trim() || state.stroking, onClick: () => attempt(() => controller.strokePath({ path, ...pressure ? { pressure } : {} })), children: "Brush path" })
2435
2494
  ] }),
2436
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ErrorLine, { error })
2495
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ErrorLine, { error })
2437
2496
  ] });
2438
2497
  };
2439
2498
 
2440
2499
  // src/paint-editor/EvolutionPanel.tsx
2441
- var import_react18 = require("react");
2442
- var import_paint_editor17 = require("@pixerate/editor/paint-editor");
2443
- var import_jsx_runtime23 = require("react/jsx-runtime");
2500
+ var import_react19 = require("react");
2501
+ var import_paint_editor18 = require("@pixerate/editor/paint-editor");
2502
+ var import_jsx_runtime24 = require("react/jsx-runtime");
2444
2503
  var EvolutionPanel = ({ controller, proposals, className }) => {
2445
2504
  const state = usePaintEditorState(controller);
2446
2505
  const store = proposals ?? controller.proposals;
2447
- const proposalState = (0, import_react18.useSyncExternalStore)(store.subscribe, store.getState, store.getState);
2506
+ const proposalState = (0, import_react19.useSyncExternalStore)(store.subscribe, store.getState, store.getState);
2448
2507
  const [error, attempt] = useAttempt();
2449
- const [selectedStrokes, setSelectedStrokes] = (0, import_react18.useState)([]);
2450
- const [selectedProposals, setSelectedProposals] = (0, import_react18.useState)([]);
2451
- const [count, setCount] = (0, import_react18.useState)(4);
2452
- const [seed, setSeed] = (0, import_react18.useState)(1);
2453
- const [mutation, setMutation] = (0, import_react18.useState)(() => (0, import_paint_editor17.normalizeMutationRates)());
2454
- const [contactSheetUrl, setContactSheetUrl] = (0, import_react18.useState)(null);
2455
- const eligibleStrokes = state.document.strokes.filter((s) => !(0, import_paint_editor17.liveStrokeRefusal)(s.brush));
2508
+ const [selectedStrokes, setSelectedStrokes] = (0, import_react19.useState)([]);
2509
+ const [selectedProposals, setSelectedProposals] = (0, import_react19.useState)([]);
2510
+ const [count, setCount] = (0, import_react19.useState)(4);
2511
+ const [seed, setSeed] = (0, import_react19.useState)(1);
2512
+ const [mutation, setMutation] = (0, import_react19.useState)(() => (0, import_paint_editor18.normalizeMutationRates)());
2513
+ const [contactSheetUrl, setContactSheetUrl] = (0, import_react19.useState)(null);
2514
+ const eligibleStrokes = state.document.strokes.filter((s) => !(0, import_paint_editor18.liveStrokeRefusal)(s.brush));
2456
2515
  const activeStrokeIds = selectedStrokes.filter((id) => eligibleStrokes.some((s) => s.id === id));
2457
2516
  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] : [];
2458
- const variants = proposalState.proposals.filter((p) => (0, import_paint_editor17.proposalGenomeStrokes)(p).length > 0);
2517
+ const variants = proposalState.proposals.filter((p) => (0, import_paint_editor18.proposalGenomeStrokes)(p).length > 0);
2459
2518
  const activeProposalIds = selectedProposals.filter((id) => variants.some((v) => v.id === id));
2460
2519
  const toggleStroke = (id) => {
2461
2520
  setSelectedStrokes((prev) => prev.includes(id) ? prev.filter((x) => x !== id) : [...prev.slice(-15), id]);
@@ -2463,16 +2522,16 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2463
2522
  const toggleProposal = (id) => {
2464
2523
  setSelectedProposals((prev) => prev.includes(id) ? prev.filter((x) => x !== id) : [...prev.slice(-1), id]);
2465
2524
  };
2466
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "evolution-panel", children: [
2467
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between", children: [
2468
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "font-medium text-slate-300", children: [
2525
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "evolution-panel", children: [
2526
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center justify-between", children: [
2527
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "font-medium text-slate-300", children: [
2469
2528
  "Evolution (",
2470
2529
  eligibleStrokes.length,
2471
2530
  ")"
2472
2531
  ] }),
2473
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1 text-[11px] text-slate-400", children: [
2474
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Count" }),
2475
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2532
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1 text-[11px] text-slate-400", children: [
2533
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "Count" }),
2534
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2476
2535
  "input",
2477
2536
  {
2478
2537
  type: "number",
@@ -2486,9 +2545,9 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2486
2545
  )
2487
2546
  ] }) })
2488
2547
  ] }),
2489
- eligibleStrokes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.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) => {
2548
+ eligibleStrokes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.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) => {
2490
2549
  const on = effectiveStrokeIds.includes(s.id);
2491
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2550
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2492
2551
  "button",
2493
2552
  {
2494
2553
  type: "button",
@@ -2502,9 +2561,9 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2502
2561
  s.id
2503
2562
  );
2504
2563
  }) }),
2505
- import_paint_editor17.EVOLUTION_SLIDERS.map((c) => {
2564
+ import_paint_editor18.EVOLUTION_SLIDERS.map((c) => {
2506
2565
  const key = c.path;
2507
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2566
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2508
2567
  PaintSlider,
2509
2568
  {
2510
2569
  control: c,
@@ -2514,8 +2573,8 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2514
2573
  c.path
2515
2574
  );
2516
2575
  }),
2517
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2518
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2576
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2577
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2519
2578
  "button",
2520
2579
  {
2521
2580
  type: "button",
@@ -2528,7 +2587,7 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2528
2587
  children: "Breed strokes"
2529
2588
  }
2530
2589
  ),
2531
- activeProposalIds.length === 2 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2590
+ activeProposalIds.length === 2 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2532
2591
  "button",
2533
2592
  {
2534
2593
  type: "button",
@@ -2541,29 +2600,29 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2541
2600
  children: "Cross over (2)"
2542
2601
  }
2543
2602
  ),
2544
- variants.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2603
+ variants.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2545
2604
  "button",
2546
2605
  {
2547
2606
  type: "button",
2548
2607
  className: button,
2549
2608
  onClick: () => attempt(() => {
2550
- const sheet = (0, import_paint_editor17.exportProposalContactSheetPng)(controller, variants);
2609
+ const sheet = (0, import_paint_editor18.exportProposalContactSheetPng)(controller, variants);
2551
2610
  setContactSheetUrl(`data:image/png;base64,${sheet.base64}`);
2552
2611
  }),
2553
2612
  children: "Contact sheet"
2554
2613
  }
2555
2614
  )
2556
2615
  ] }),
2557
- variants.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "grid grid-cols-2 gap-1.5", "data-testid": "evolution-grid", children: variants.map((p) => {
2558
- const g = (0, import_paint_editor17.paintProposalGhost)(p);
2616
+ variants.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "grid grid-cols-2 gap-1.5", "data-testid": "evolution-grid", children: variants.map((p) => {
2617
+ const g = (0, import_paint_editor18.paintProposalGhost)(p);
2559
2618
  const picked = activeProposalIds.includes(p.id);
2560
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2619
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2561
2620
  "div",
2562
2621
  {
2563
2622
  "data-testid": `evolution-variant-${p.id}`,
2564
2623
  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"}`,
2565
2624
  children: [
2566
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex items-center justify-between gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2625
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex items-center justify-between gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2567
2626
  "button",
2568
2627
  {
2569
2628
  type: "button",
@@ -2573,10 +2632,10 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2573
2632
  children: p.title
2574
2633
  }
2575
2634
  ) }),
2576
- g && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex h-16 items-center justify-center overflow-hidden rounded bg-slate-900/80 p-1", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PixelCanvas, { pixels: g, label: p.title, className: "max-h-full max-w-full object-contain" }) }),
2577
- p.rationale && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "line-clamp-2 text-[10px] text-slate-400", title: p.rationale, children: p.rationale }),
2578
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2579
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2635
+ g && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex h-16 items-center justify-center overflow-hidden rounded bg-slate-900/80 p-1", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PixelCanvas, { pixels: g, label: p.title, className: "max-h-full max-w-full object-contain" }) }),
2636
+ p.rationale && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "line-clamp-2 text-[10px] text-slate-400", title: p.rationale, children: p.rationale }),
2637
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2638
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2580
2639
  "button",
2581
2640
  {
2582
2641
  type: "button",
@@ -2589,42 +2648,42 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2589
2648
  children: "Breed from"
2590
2649
  }
2591
2650
  ),
2592
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => store.accept(p.id)), children: "Accept" }),
2593
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => store.reject(p.id)), children: "Dismiss" })
2651
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => store.accept(p.id)), children: "Accept" }),
2652
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => store.reject(p.id)), children: "Dismiss" })
2594
2653
  ] })
2595
2654
  ]
2596
2655
  },
2597
2656
  p.id
2598
2657
  );
2599
2658
  }) }),
2600
- contactSheetUrl && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("img", { src: contactSheetUrl, alt: "Variant contact sheet", className: "w-full rounded border border-slate-800", "data-testid": "evolution-contact-sheet" }),
2601
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ErrorLine, { error })
2659
+ contactSheetUrl && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("img", { src: contactSheetUrl, alt: "Variant contact sheet", className: "w-full rounded border border-slate-800", "data-testid": "evolution-contact-sheet" }),
2660
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ErrorLine, { error })
2602
2661
  ] });
2603
2662
  };
2604
2663
 
2605
2664
  // src/paint-editor/PaintEditor.tsx
2606
- var import_react32 = require("react");
2607
- var import_paint_editor19 = require("@pixerate/editor/paint-editor");
2665
+ var import_react33 = require("react");
2666
+ var import_paint_editor20 = require("@pixerate/editor/paint-editor");
2608
2667
 
2609
2668
  // src/playback/AgentPlaybackContext.tsx
2610
- var import_react19 = require("react");
2611
- var import_jsx_runtime24 = require("react/jsx-runtime");
2612
- var AgentPlaybackContext = (0, import_react19.createContext)(null);
2669
+ var import_react20 = require("react");
2670
+ var import_jsx_runtime25 = require("react/jsx-runtime");
2671
+ var AgentPlaybackContext = (0, import_react20.createContext)(null);
2613
2672
  function useAgentPlayback() {
2614
- return (0, import_react19.useContext)(AgentPlaybackContext);
2673
+ return (0, import_react20.useContext)(AgentPlaybackContext);
2615
2674
  }
2616
2675
 
2617
2676
  // src/playback/usePlaybackSurface.ts
2618
- var import_react20 = require("react");
2677
+ var import_react21 = require("react");
2619
2678
  var import_tools = require("@pixerate/editor/tools");
2620
2679
  function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
2621
2680
  const ambient = useAgentPlayback();
2622
2681
  const target = playback === void 0 ? ambient : playback;
2623
- const [ownPresence] = (0, import_react20.useState)(() => new import_tools.PresenceStore());
2682
+ const [ownPresence] = (0, import_react21.useState)(() => new import_tools.PresenceStore());
2624
2683
  const presence = sharedPresence ?? ownPresence;
2625
- const latest = (0, import_react20.useRef)(options);
2684
+ const latest = (0, import_react21.useRef)(options);
2626
2685
  latest.current = options;
2627
- (0, import_react20.useEffect)(() => {
2686
+ (0, import_react21.useEffect)(() => {
2628
2687
  if (!target || !id) return;
2629
2688
  const o = () => latest.current;
2630
2689
  const surface = {
@@ -2656,13 +2715,13 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
2656
2715
  }
2657
2716
 
2658
2717
  // src/playback/PresenceLayer.tsx
2659
- var import_react21 = __toESM(require("react"), 1);
2660
- var import_jsx_runtime25 = require("react/jsx-runtime");
2718
+ var import_react22 = __toESM(require("react"), 1);
2719
+ var import_jsx_runtime26 = require("react/jsx-runtime");
2661
2720
  function PresenceLayer({ presence, viewport, clip = true, renderCursor, className = "" }) {
2662
- const { actors } = (0, import_react21.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
2721
+ const { actors } = (0, import_react22.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
2663
2722
  if (!actors.length) return null;
2664
2723
  const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
2665
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2724
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2666
2725
  "div",
2667
2726
  {
2668
2727
  className: `pixerate-presence ${className}`.trim(),
@@ -2676,19 +2735,19 @@ function PresenceLayer({ presence, viewport, clip = true, renderCursor, classNam
2676
2735
  const br = map({ x: a.focus.x + a.focus.width, y: a.focus.y + a.focus.height });
2677
2736
  return { left: tl.x - 4, top: tl.y - 4, width: br.x - tl.x + 8, height: br.y - tl.y + 8 };
2678
2737
  })();
2679
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_react21.default.Fragment, { children: [
2680
- ring && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2738
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_react22.default.Fragment, { children: [
2739
+ ring && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2681
2740
  "div",
2682
2741
  {
2683
2742
  "data-actor-focus": a.id,
2684
2743
  style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
2685
2744
  }
2686
2745
  ),
2687
- /* @__PURE__ */ (0, import_jsx_runtime25.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_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
2688
- /* @__PURE__ */ (0, import_jsx_runtime25.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_runtime25.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 } }) }),
2689
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
2690
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
2691
- a.message && /* @__PURE__ */ (0, import_jsx_runtime25.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 })
2746
+ /* @__PURE__ */ (0, import_jsx_runtime26.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_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
2747
+ /* @__PURE__ */ (0, import_jsx_runtime26.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_runtime26.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 } }) }),
2748
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
2749
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
2750
+ a.message && /* @__PURE__ */ (0, import_jsx_runtime26.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 })
2692
2751
  ] })
2693
2752
  ] }) })
2694
2753
  ] }, a.id);
@@ -2698,16 +2757,16 @@ function PresenceLayer({ presence, viewport, clip = true, renderCursor, classNam
2698
2757
  }
2699
2758
 
2700
2759
  // src/paint-editor/PaintEffectsPanel.tsx
2701
- var import_react31 = require("react");
2702
- var import_paint_editor18 = require("@pixerate/editor/paint-editor");
2760
+ var import_react32 = require("react");
2761
+ var import_paint_editor19 = require("@pixerate/editor/paint-editor");
2703
2762
  var import_effects4 = require("@pixerate/editor/effects");
2704
2763
 
2705
2764
  // src/effects/useEffects.ts
2706
- var import_react22 = require("react");
2765
+ var import_react23 = require("react");
2707
2766
  function useEffectDescription(provider, effect) {
2708
- const [state, setState] = (0, import_react22.useState)({ key: "", description: null, error: null });
2767
+ const [state, setState] = (0, import_react23.useState)({ key: "", description: null, error: null });
2709
2768
  const key = provider && effect ? `${provider.id}:${effect}` : "";
2710
- (0, import_react22.useEffect)(() => {
2769
+ (0, import_react23.useEffect)(() => {
2711
2770
  if (!provider || !effect) return;
2712
2771
  let live = true;
2713
2772
  Promise.resolve().then(() => provider.describe(effect)).then(
@@ -2722,14 +2781,14 @@ function useEffectDescription(provider, effect) {
2722
2781
  }
2723
2782
 
2724
2783
  // src/effects/EffectThumbnail.tsx
2725
- var import_react23 = require("react");
2784
+ var import_react24 = require("react");
2726
2785
  var import_effects = require("@pixerate/editor/effects");
2727
- var import_jsx_runtime26 = require("react/jsx-runtime");
2786
+ var import_jsx_runtime27 = require("react/jsx-runtime");
2728
2787
  var LABELS = { motion: "Motion", camera: "Camera", timing: "Timing" };
2729
2788
  function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
2730
- const ref = (0, import_react23.useRef)(null);
2731
- const [failed, setFailed] = (0, import_react23.useState)(effect.kind in LABELS);
2732
- (0, import_react23.useEffect)(() => {
2789
+ const ref = (0, import_react24.useRef)(null);
2790
+ const [failed, setFailed] = (0, import_react24.useState)(effect.kind in LABELS);
2791
+ (0, import_react24.useEffect)(() => {
2733
2792
  if (effect.kind in LABELS) return;
2734
2793
  let live = true;
2735
2794
  (0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
@@ -2744,28 +2803,28 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
2744
2803
  live = false;
2745
2804
  };
2746
2805
  }, [provider, effect, width, height]);
2747
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2806
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2748
2807
  "div",
2749
2808
  {
2750
2809
  className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
2751
2810
  style: { aspectRatio: `${width} / ${height}` },
2752
2811
  "data-effect-thumbnail": effect.id,
2753
- children: failed ? /* @__PURE__ */ (0, import_jsx_runtime26.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_runtime26.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
2812
+ children: failed ? /* @__PURE__ */ (0, import_jsx_runtime27.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_runtime27.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
2754
2813
  }
2755
2814
  );
2756
2815
  }
2757
2816
 
2758
2817
  // src/effects/EffectsBrowser.tsx
2759
- var import_react24 = require("react");
2818
+ var import_react25 = require("react");
2760
2819
  var import_effects2 = require("@pixerate/editor/effects");
2761
- var import_jsx_runtime27 = require("react/jsx-runtime");
2762
- function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
2763
- const [all, setAll] = (0, import_react24.useState)([]);
2764
- const [query, setQuery] = (0, import_react24.useState)("");
2765
- const [category, setCategory] = (0, import_react24.useState)("");
2766
- const [use, setUse] = (0, import_react24.useState)("");
2767
- const [error, setError] = (0, import_react24.useState)(null);
2768
- (0, import_react24.useEffect)(() => {
2820
+ var import_jsx_runtime28 = require("react/jsx-runtime");
2821
+ function EffectsBrowser({ provider, uses, kinds, filter, onPick, thumbnails = true, title = "Effects", className = "" }) {
2822
+ const [all, setAll] = (0, import_react25.useState)([]);
2823
+ const [query, setQuery] = (0, import_react25.useState)("");
2824
+ const [category, setCategory] = (0, import_react25.useState)("");
2825
+ const [use, setUse] = (0, import_react25.useState)("");
2826
+ const [error, setError] = (0, import_react25.useState)(null);
2827
+ (0, import_react25.useEffect)(() => {
2769
2828
  if (!provider) return setAll([]);
2770
2829
  let live = true;
2771
2830
  Promise.resolve().then(() => provider.list()).then(
@@ -2776,8 +2835,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2776
2835
  live = false;
2777
2836
  };
2778
2837
  }, [provider]);
2779
- const [found, setFound] = (0, import_react24.useState)([]);
2780
- (0, import_react24.useEffect)(() => {
2838
+ const [found, setFound] = (0, import_react25.useState)([]);
2839
+ (0, import_react25.useEffect)(() => {
2781
2840
  if (!provider) return setFound([]);
2782
2841
  let live = true;
2783
2842
  Promise.resolve().then(() => provider.search(query, { ...category ? { category } : {}, ...use ? { use } : {} })).then((list) => live && setFound(list), () => live && setFound([]));
@@ -2785,15 +2844,15 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2785
2844
  live = false;
2786
2845
  };
2787
2846
  }, [provider, query, category, use]);
2788
- const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses);
2789
- const categories = (0, import_react24.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
2847
+ const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses) && (!filter || filter(e));
2848
+ const categories = (0, import_react25.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds, filter]);
2790
2849
  const shown = found.filter(allowed);
2791
2850
  if (!provider)
2792
- return /* @__PURE__ */ (0, import_jsx_runtime27.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." });
2793
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
2794
- title && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h3", { className: "text-xs font-semibold", children: title }),
2795
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2796
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2851
+ return /* @__PURE__ */ (0, import_jsx_runtime28.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." });
2852
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
2853
+ title && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h3", { className: "text-xs font-semibold", children: title }),
2854
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2855
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2797
2856
  "input",
2798
2857
  {
2799
2858
  type: "search",
@@ -2804,17 +2863,17 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2804
2863
  onChange: (e) => setQuery(e.currentTarget.value)
2805
2864
  }
2806
2865
  ),
2807
- /* @__PURE__ */ (0, import_jsx_runtime27.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: [
2808
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: "", children: "All categories" }),
2809
- categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: c, children: c }, c))
2866
+ /* @__PURE__ */ (0, import_jsx_runtime28.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: [
2867
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "", children: "All categories" }),
2868
+ categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: c, children: c }, c))
2810
2869
  ] }),
2811
- uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime27.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: [
2812
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: "", children: "Any use" }),
2813
- uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
2870
+ uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime28.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: [
2871
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "", children: "Any use" }),
2872
+ uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
2814
2873
  ] })
2815
2874
  ] }),
2816
- error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
2817
- /* @__PURE__ */ (0, import_jsx_runtime27.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_runtime27.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
2875
+ error && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
2876
+ /* @__PURE__ */ (0, import_jsx_runtime28.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_runtime28.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
2818
2877
  "button",
2819
2878
  {
2820
2879
  type: "button",
@@ -2823,23 +2882,23 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2823
2882
  "data-effect-id": e.id,
2824
2883
  onClick: () => onPick(e),
2825
2884
  children: [
2826
- thumbnails && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(EffectThumbnail, { provider, effect: e }),
2827
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
2828
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
2885
+ thumbnails && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(EffectThumbnail, { provider, effect: e }),
2886
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
2887
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
2829
2888
  ]
2830
2889
  }
2831
2890
  ) }, e.id)) }),
2832
- !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
2891
+ !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
2833
2892
  ] });
2834
2893
  }
2835
2894
 
2836
2895
  // src/effects/EffectParameters.tsx
2837
- var import_react30 = __toESM(require("react"), 1);
2896
+ var import_react31 = __toESM(require("react"), 1);
2838
2897
  var import_effects3 = require("@pixerate/editor/effects");
2839
2898
  var import_parameters2 = require("@pixerate/editor/parameters");
2840
2899
 
2841
2900
  // src/parameters/fields.tsx
2842
- var import_react29 = require("react");
2901
+ var import_react30 = require("react");
2843
2902
  var import_parameters = require("@pixerate/editor/parameters");
2844
2903
 
2845
2904
  // src/color/index.ts
@@ -2852,9 +2911,9 @@ __export(color_exports, {
2852
2911
  });
2853
2912
 
2854
2913
  // src/color/ColorPicker.tsx
2855
- var import_react25 = require("react");
2914
+ var import_react26 = require("react");
2856
2915
  var import_color = require("@pixerate/editor/color");
2857
- var import_jsx_runtime28 = require("react/jsx-runtime");
2916
+ var import_jsx_runtime29 = require("react/jsx-runtime");
2858
2917
  var LOCAL_STORAGE_KEY = "pixerate:color:recent";
2859
2918
  function readLocalRecents() {
2860
2919
  try {
@@ -2892,24 +2951,24 @@ var ColorPicker = ({
2892
2951
  id,
2893
2952
  "aria-label": ariaLabel = "Color picker"
2894
2953
  }) => {
2895
- const generatedId = (0, import_react25.useId)();
2954
+ const generatedId = (0, import_react26.useId)();
2896
2955
  const pickerId = id || generatedId;
2897
- const [pickerState, setPickerState] = (0, import_react25.useState)(
2956
+ const [pickerState, setPickerState] = (0, import_react26.useState)(
2898
2957
  () => (0, import_color.pickerStateFromColor)(value) ?? DEFAULT_PICKER_STATE
2899
2958
  );
2900
- const stateRef = (0, import_react25.useRef)(pickerState);
2959
+ const stateRef = (0, import_react26.useRef)(pickerState);
2901
2960
  stateRef.current = pickerState;
2902
- (0, import_react25.useEffect)(() => {
2961
+ (0, import_react26.useEffect)(() => {
2903
2962
  const next = (0, import_color.pickerStateFromColor)(value, stateRef.current);
2904
2963
  if (next) {
2905
2964
  setPickerState(next);
2906
2965
  }
2907
2966
  }, [value]);
2908
- const [internalRecent, setInternalRecent] = (0, import_react25.useState)(
2967
+ const [internalRecent, setInternalRecent] = (0, import_react26.useState)(
2909
2968
  () => controlledRecent ? [] : readLocalRecents()
2910
2969
  );
2911
2970
  const activeRecent = controlledRecent ?? internalRecent;
2912
- const recordRecent = (0, import_react25.useCallback)(
2971
+ const recordRecent = (0, import_react26.useCallback)(
2913
2972
  (color) => {
2914
2973
  const updated = (0, import_color.pushRecentColor)(activeRecent, color, 12);
2915
2974
  if (!controlledRecent) {
@@ -2920,11 +2979,11 @@ var ColorPicker = ({
2920
2979
  },
2921
2980
  [activeRecent, controlledRecent, onRecentChange]
2922
2981
  );
2923
- const [textDraft, setTextDraft] = (0, import_react25.useState)(value);
2924
- const [isInvalid, setIsInvalid] = (0, import_react25.useState)(false);
2925
- const [isClipped, setIsClipped] = (0, import_react25.useState)(false);
2926
- const isTypingRef = (0, import_react25.useRef)(false);
2927
- (0, import_react25.useEffect)(() => {
2982
+ const [textDraft, setTextDraft] = (0, import_react26.useState)(value);
2983
+ const [isInvalid, setIsInvalid] = (0, import_react26.useState)(false);
2984
+ const [isClipped, setIsClipped] = (0, import_react26.useState)(false);
2985
+ const isTypingRef = (0, import_react26.useRef)(false);
2986
+ (0, import_react26.useEffect)(() => {
2928
2987
  if (!isTypingRef.current) {
2929
2988
  setTextDraft(value);
2930
2989
  setIsInvalid(false);
@@ -2932,11 +2991,11 @@ var ColorPicker = ({
2932
2991
  setIsClipped(Boolean(parsed && !(0, import_color.inSrgbGamut)(parsed)));
2933
2992
  }
2934
2993
  }, [value]);
2935
- const [hasEyeDropper, setHasEyeDropper] = (0, import_react25.useState)(false);
2936
- (0, import_react25.useEffect)(() => {
2994
+ const [hasEyeDropper, setHasEyeDropper] = (0, import_react26.useState)(false);
2995
+ (0, import_react26.useEffect)(() => {
2937
2996
  setHasEyeDropper(typeof window !== "undefined" && "EyeDropper" in window);
2938
2997
  }, []);
2939
- const emitColorChange = (0, import_react25.useCallback)(
2998
+ const emitColorChange = (0, import_react26.useCallback)(
2940
2999
  (nextState) => {
2941
3000
  setPickerState(nextState);
2942
3001
  const hex = (0, import_color.pickerStateToHex)(nextState, alpha);
@@ -2944,10 +3003,10 @@ var ColorPicker = ({
2944
3003
  },
2945
3004
  [alpha, onChange]
2946
3005
  );
2947
- const latest = (0, import_react25.useRef)({ emitColorChange, recordRecent, onGestureEnd, alpha });
3006
+ const latest = (0, import_react26.useRef)({ emitColorChange, recordRecent, onGestureEnd, alpha });
2948
3007
  latest.current = { emitColorChange, recordRecent, onGestureEnd, alpha };
2949
- const endDragRef = (0, import_react25.useRef)(null);
2950
- (0, import_react25.useEffect)(() => () => endDragRef.current?.(), []);
3008
+ const endDragRef = (0, import_react26.useRef)(null);
3009
+ (0, import_react26.useEffect)(() => () => endDragRef.current?.(), []);
2951
3010
  const startDrag = (e, next) => {
2952
3011
  if (disabled) return;
2953
3012
  e.preventDefault();
@@ -3049,7 +3108,7 @@ var ColorPicker = ({
3049
3108
  } catch {
3050
3109
  }
3051
3110
  };
3052
- const contrastResult = (0, import_react25.useMemo)(() => {
3111
+ const contrastResult = (0, import_react26.useMemo)(() => {
3053
3112
  if (!contrastAgainst) return null;
3054
3113
  const fg = (0, import_color.parseColor)(value);
3055
3114
  const bg = (0, import_color.parseColor)(contrastAgainst);
@@ -3061,7 +3120,7 @@ var ColorPicker = ({
3061
3120
  }, [value, contrastAgainst]);
3062
3121
  const currentHex = (0, import_color.pickerStateToHex)(pickerState, alpha);
3063
3122
  const liveDescription = `Selected color: ${value}${contrastResult ? `, contrast ${contrastResult.ratio.toFixed(1)}:1 against ${contrastAgainst}, ${contrastResult.aa ? "passes AA" : "fails AA"}` : ""}`;
3064
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3123
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3065
3124
  "div",
3066
3125
  {
3067
3126
  id: pickerId,
@@ -3085,7 +3144,7 @@ var ColorPicker = ({
3085
3144
  pointerEvents: disabled ? "none" : "auto"
3086
3145
  },
3087
3146
  children: [
3088
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3147
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3089
3148
  "span",
3090
3149
  {
3091
3150
  role: "status",
@@ -3104,7 +3163,7 @@ var ColorPicker = ({
3104
3163
  children: liveDescription
3105
3164
  }
3106
3165
  ),
3107
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3166
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3108
3167
  "div",
3109
3168
  {
3110
3169
  role: "slider",
@@ -3126,7 +3185,7 @@ var ColorPicker = ({
3126
3185
  touchAction: "none",
3127
3186
  outline: "none"
3128
3187
  },
3129
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3188
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3130
3189
  "div",
3131
3190
  {
3132
3191
  style: {
@@ -3146,7 +3205,7 @@ var ColorPicker = ({
3146
3205
  )
3147
3206
  }
3148
3207
  ),
3149
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3208
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3150
3209
  "div",
3151
3210
  {
3152
3211
  role: "slider",
@@ -3169,7 +3228,7 @@ var ColorPicker = ({
3169
3228
  touchAction: "none",
3170
3229
  outline: "none"
3171
3230
  },
3172
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3231
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3173
3232
  "div",
3174
3233
  {
3175
3234
  style: {
@@ -3189,7 +3248,7 @@ var ColorPicker = ({
3189
3248
  )
3190
3249
  }
3191
3250
  ),
3192
- alpha && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3251
+ alpha && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3193
3252
  "div",
3194
3253
  {
3195
3254
  role: "slider",
@@ -3215,7 +3274,7 @@ var ColorPicker = ({
3215
3274
  overflow: "hidden"
3216
3275
  },
3217
3276
  children: [
3218
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3277
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3219
3278
  "div",
3220
3279
  {
3221
3280
  style: {
@@ -3225,7 +3284,7 @@ var ColorPicker = ({
3225
3284
  }
3226
3285
  }
3227
3286
  ),
3228
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3287
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3229
3288
  "div",
3230
3289
  {
3231
3290
  style: {
@@ -3246,8 +3305,8 @@ var ColorPicker = ({
3246
3305
  ]
3247
3306
  }
3248
3307
  ),
3249
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
3250
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3308
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
3309
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3251
3310
  "div",
3252
3311
  {
3253
3312
  style: {
@@ -3261,7 +3320,7 @@ var ColorPicker = ({
3261
3320
  flexShrink: 0,
3262
3321
  border: "1px solid rgba(255,255,255,0.15)"
3263
3322
  },
3264
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3323
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3265
3324
  "div",
3266
3325
  {
3267
3326
  style: {
@@ -3273,7 +3332,7 @@ var ColorPicker = ({
3273
3332
  )
3274
3333
  }
3275
3334
  ),
3276
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3335
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3277
3336
  "input",
3278
3337
  {
3279
3338
  type: "text",
@@ -3303,7 +3362,7 @@ var ColorPicker = ({
3303
3362
  }
3304
3363
  }
3305
3364
  ),
3306
- hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3365
+ hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3307
3366
  "button",
3308
3367
  {
3309
3368
  type: "button",
@@ -3323,7 +3382,7 @@ var ColorPicker = ({
3323
3382
  color: "inherit",
3324
3383
  cursor: disabled ? "default" : "pointer"
3325
3384
  },
3326
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3385
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3327
3386
  "svg",
3328
3387
  {
3329
3388
  width: "14",
@@ -3335,16 +3394,16 @@ var ColorPicker = ({
3335
3394
  strokeLinecap: "round",
3336
3395
  strokeLinejoin: "round",
3337
3396
  children: [
3338
- /* @__PURE__ */ (0, import_jsx_runtime28.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" }),
3339
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
3340
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "m14 6 4 4" })
3397
+ /* @__PURE__ */ (0, import_jsx_runtime29.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" }),
3398
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
3399
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("path", { d: "m14 6 4 4" })
3341
3400
  ]
3342
3401
  }
3343
3402
  )
3344
3403
  }
3345
3404
  )
3346
3405
  ] }),
3347
- isClipped && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3406
+ isClipped && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3348
3407
  "div",
3349
3408
  {
3350
3409
  role: "note",
@@ -3360,10 +3419,10 @@ var ColorPicker = ({
3360
3419
  borderRadius: "4px",
3361
3420
  alignSelf: "flex-start"
3362
3421
  },
3363
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
3422
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
3364
3423
  }
3365
3424
  ),
3366
- contrastResult && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3425
+ contrastResult && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3367
3426
  "div",
3368
3427
  {
3369
3428
  style: {
@@ -3377,15 +3436,15 @@ var ColorPicker = ({
3377
3436
  border: "1px solid rgba(255,255,255,0.1)"
3378
3437
  },
3379
3438
  children: [
3380
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { children: [
3439
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { children: [
3381
3440
  "Contrast: ",
3382
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("strong", { children: [
3441
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("strong", { children: [
3383
3442
  contrastResult.ratio.toFixed(2),
3384
3443
  ":1"
3385
3444
  ] })
3386
3445
  ] }),
3387
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
3388
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3446
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
3447
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3389
3448
  "span",
3390
3449
  {
3391
3450
  style: {
@@ -3398,7 +3457,7 @@ var ColorPicker = ({
3398
3457
  ]
3399
3458
  }
3400
3459
  ),
3401
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3460
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3402
3461
  "span",
3403
3462
  {
3404
3463
  style: {
@@ -3415,9 +3474,9 @@ var ColorPicker = ({
3415
3474
  ]
3416
3475
  }
3417
3476
  ),
3418
- swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
3419
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
3420
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3477
+ swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
3478
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
3479
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3421
3480
  "button",
3422
3481
  {
3423
3482
  type: "button",
@@ -3443,9 +3502,9 @@ var ColorPicker = ({
3443
3502
  `${color}-${idx}`
3444
3503
  )) })
3445
3504
  ] }),
3446
- activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
3447
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
3448
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3505
+ activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
3506
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
3507
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3449
3508
  "button",
3450
3509
  {
3451
3510
  type: "button",
@@ -3476,9 +3535,9 @@ var ColorPicker = ({
3476
3535
  };
3477
3536
 
3478
3537
  // src/color/DualColorPicker.tsx
3479
- var import_react26 = require("react");
3538
+ var import_react27 = require("react");
3480
3539
  var import_color2 = require("@pixerate/editor/color");
3481
- var import_jsx_runtime29 = require("react/jsx-runtime");
3540
+ var import_jsx_runtime30 = require("react/jsx-runtime");
3482
3541
  function DualColorPicker({
3483
3542
  value,
3484
3543
  onChange,
@@ -3493,8 +3552,8 @@ function DualColorPicker({
3493
3552
  disabled = false,
3494
3553
  className = ""
3495
3554
  }) {
3496
- const sameId = (0, import_react26.useId)();
3497
- const [internalScheme, setInternalScheme] = (0, import_react26.useState)("light");
3555
+ const sameId = (0, import_react27.useId)();
3556
+ const [internalScheme, setInternalScheme] = (0, import_react27.useState)("light");
3498
3557
  const activeScheme = controlledScheme ?? internalScheme;
3499
3558
  const handleSchemeSelect = (nextScheme) => {
3500
3559
  if (onSchemeChange) {
@@ -3505,7 +3564,7 @@ function DualColorPicker({
3505
3564
  };
3506
3565
  const dual = (0, import_color2.normalizeDualColor)(value) ?? { light: "#000000", dark: "#000000" };
3507
3566
  const isSame = dual.light.toLowerCase() === dual.dark.toLowerCase();
3508
- const [sameInBoth, setSameInBoth] = (0, import_react26.useState)(isSame);
3567
+ const [sameInBoth, setSameInBoth] = (0, import_react27.useState)(isSame);
3509
3568
  const handleSameToggle = (e) => {
3510
3569
  const nextSame = e.target.checked;
3511
3570
  setSameInBoth(nextSame);
@@ -3537,7 +3596,7 @@ function DualColorPicker({
3537
3596
  const activeColor = activeScheme === "dark" ? dual.dark : dual.light;
3538
3597
  const activeContrastTarget = contrastAgainst ? (0, import_color2.resolveColor)(contrastAgainst, activeScheme) ?? void 0 : void 0;
3539
3598
  const dualContrast = contrastAgainst && (0, import_color2.normalizeDualColor)(contrastAgainst) ? (0, import_color2.checkDualColorContrast)(dual, contrastAgainst) : null;
3540
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3599
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
3541
3600
  "div",
3542
3601
  {
3543
3602
  className: `pixerate-dual-color-picker ${className}`,
@@ -3556,7 +3615,7 @@ function DualColorPicker({
3556
3615
  boxSizing: "border-box"
3557
3616
  },
3558
3617
  children: [
3559
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3618
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
3560
3619
  "div",
3561
3620
  {
3562
3621
  role: "tablist",
@@ -3569,7 +3628,7 @@ function DualColorPicker({
3569
3628
  gap: "2px"
3570
3629
  },
3571
3630
  children: [
3572
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3631
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3573
3632
  "button",
3574
3633
  {
3575
3634
  type: "button",
@@ -3592,7 +3651,7 @@ function DualColorPicker({
3592
3651
  children: "Light"
3593
3652
  }
3594
3653
  ),
3595
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3654
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3596
3655
  "button",
3597
3656
  {
3598
3657
  type: "button",
@@ -3618,8 +3677,8 @@ function DualColorPicker({
3618
3677
  ]
3619
3678
  }
3620
3679
  ),
3621
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
3622
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3680
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
3681
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
3623
3682
  "button",
3624
3683
  {
3625
3684
  type: "button",
@@ -3641,7 +3700,7 @@ function DualColorPicker({
3641
3700
  outline: "none"
3642
3701
  },
3643
3702
  children: [
3644
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3703
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3645
3704
  "span",
3646
3705
  {
3647
3706
  style: {
@@ -3653,11 +3712,11 @@ function DualColorPicker({
3653
3712
  }
3654
3713
  }
3655
3714
  ),
3656
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
3715
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
3657
3716
  ]
3658
3717
  }
3659
3718
  ),
3660
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3719
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
3661
3720
  "button",
3662
3721
  {
3663
3722
  type: "button",
@@ -3679,7 +3738,7 @@ function DualColorPicker({
3679
3738
  outline: "none"
3680
3739
  },
3681
3740
  children: [
3682
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3741
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3683
3742
  "span",
3684
3743
  {
3685
3744
  style: {
@@ -3691,12 +3750,12 @@ function DualColorPicker({
3691
3750
  }
3692
3751
  }
3693
3752
  ),
3694
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
3753
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
3695
3754
  ]
3696
3755
  }
3697
3756
  )
3698
3757
  ] }),
3699
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3758
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
3700
3759
  "div",
3701
3760
  {
3702
3761
  style: {
@@ -3707,7 +3766,7 @@ function DualColorPicker({
3707
3766
  padding: "2px 0"
3708
3767
  },
3709
3768
  children: [
3710
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3769
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
3711
3770
  "label",
3712
3771
  {
3713
3772
  htmlFor: sameId,
@@ -3721,7 +3780,7 @@ function DualColorPicker({
3721
3780
  color: "#c4cad4"
3722
3781
  },
3723
3782
  children: [
3724
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3783
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3725
3784
  "input",
3726
3785
  {
3727
3786
  id: sameId,
@@ -3732,11 +3791,11 @@ function DualColorPicker({
3732
3791
  style: { cursor: disabled ? "not-allowed" : "pointer" }
3733
3792
  }
3734
3793
  ),
3735
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: "Same in both" })
3794
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Same in both" })
3736
3795
  ]
3737
3796
  }
3738
3797
  ),
3739
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3798
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3740
3799
  "button",
3741
3800
  {
3742
3801
  type: "button",
@@ -3758,7 +3817,7 @@ function DualColorPicker({
3758
3817
  ]
3759
3818
  }
3760
3819
  ),
3761
- dualContrast && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3820
+ dualContrast && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
3762
3821
  "div",
3763
3822
  {
3764
3823
  "data-testid": "dual-contrast-summary",
@@ -3772,20 +3831,20 @@ function DualColorPicker({
3772
3831
  color: "#8c95a6"
3773
3832
  },
3774
3833
  children: [
3775
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { children: [
3834
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { children: [
3776
3835
  "Light:",
3777
3836
  " ",
3778
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3837
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3779
3838
  dualContrast.light.ratio.toFixed(2),
3780
3839
  " (",
3781
3840
  dualContrast.light.level,
3782
3841
  ")"
3783
3842
  ] })
3784
3843
  ] }),
3785
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { children: [
3844
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { children: [
3786
3845
  "Dark:",
3787
3846
  " ",
3788
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3847
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3789
3848
  dualContrast.dark.ratio.toFixed(2),
3790
3849
  " (",
3791
3850
  dualContrast.dark.level,
@@ -3795,7 +3854,7 @@ function DualColorPicker({
3795
3854
  ]
3796
3855
  }
3797
3856
  ),
3798
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3857
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3799
3858
  ColorPicker,
3800
3859
  {
3801
3860
  value: activeColor,
@@ -3814,7 +3873,7 @@ function DualColorPicker({
3814
3873
  }
3815
3874
 
3816
3875
  // src/color/useColorScheme.ts
3817
- var import_react27 = require("react");
3876
+ var import_react28 = require("react");
3818
3877
  var import_color3 = require("@pixerate/editor/color");
3819
3878
  function getSnapshot(attribute) {
3820
3879
  if (typeof window === "undefined" || typeof document === "undefined") {
@@ -3839,7 +3898,7 @@ function getServerSnapshot() {
3839
3898
  function useColorScheme(options) {
3840
3899
  const override = options?.override;
3841
3900
  const attribute = options?.attribute;
3842
- const subscribe = (0, import_react27.useMemo)(() => {
3901
+ const subscribe = (0, import_react28.useMemo)(() => {
3843
3902
  return (callback) => {
3844
3903
  if (typeof window === "undefined" || typeof document === "undefined") {
3845
3904
  return () => {
@@ -3865,7 +3924,7 @@ function useColorScheme(options) {
3865
3924
  };
3866
3925
  };
3867
3926
  }, [attribute]);
3868
- const detected = (0, import_react27.useSyncExternalStore)(
3927
+ const detected = (0, import_react28.useSyncExternalStore)(
3869
3928
  subscribe,
3870
3929
  () => getSnapshot(attribute),
3871
3930
  getServerSnapshot
@@ -3882,11 +3941,11 @@ function useResolvedColor(value, scheme) {
3882
3941
  __reExport(color_exports, require("@pixerate/editor/color"));
3883
3942
 
3884
3943
  // src/parameters/controls.tsx
3885
- var import_react28 = require("react");
3886
- var import_jsx_runtime30 = require("react/jsx-runtime");
3887
- var ParameterComponentsContext = (0, import_react28.createContext)({});
3944
+ var import_react29 = require("react");
3945
+ var import_jsx_runtime31 = require("react/jsx-runtime");
3946
+ var ParameterComponentsContext = (0, import_react29.createContext)({});
3888
3947
  function useParameterComponents() {
3889
- return (0, import_react28.useContext)(ParameterComponentsContext);
3948
+ return (0, import_react29.useContext)(ParameterComponentsContext);
3890
3949
  }
3891
3950
  function resolveParameterComponents(explicit, context) {
3892
3951
  return {
@@ -3898,7 +3957,7 @@ function resolveParameterComponents(explicit, context) {
3898
3957
  }
3899
3958
 
3900
3959
  // src/parameters/fields.tsx
3901
- var import_jsx_runtime31 = require("react/jsx-runtime");
3960
+ var import_jsx_runtime32 = require("react/jsx-runtime");
3902
3961
  var parameterInputStyle = import_parameters.parameterThemeStyles.input;
3903
3962
  var parameterSelectStyle = import_parameters.parameterThemeStyles.select;
3904
3963
  var parameterButtonStyle = import_parameters.parameterThemeStyles.button;
@@ -3907,9 +3966,9 @@ var parameterInputClass = "h-7 w-full min-w-0 rounded-md border border-input bg-
3907
3966
  var parameterButtonClass = "inline-flex h-7 items-center justify-center gap-1 rounded-md border border-input bg-background px-2 text-xs text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:pointer-events-none disabled:opacity-50";
3908
3967
  var rangeClass = "h-4 w-full min-w-0 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50";
3909
3968
  function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown, style, ...rest }) {
3910
- const inputRef = (0, import_react29.useRef)(null);
3911
- const lastCommitted = (0, import_react29.useRef)(null);
3912
- (0, import_react29.useLayoutEffect)(() => {
3969
+ const inputRef = (0, import_react30.useRef)(null);
3970
+ const lastCommitted = (0, import_react30.useRef)(null);
3971
+ (0, import_react30.useLayoutEffect)(() => {
3913
3972
  lastCommitted.current = null;
3914
3973
  const el = inputRef.current;
3915
3974
  if (el && el.value !== value) el.value = value;
@@ -3920,9 +3979,9 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
3920
3979
  onCommit(text, el);
3921
3980
  lastCommitted.current = el.value === text ? text : null;
3922
3981
  };
3923
- const commitRef = (0, import_react29.useRef)(commit);
3982
+ const commitRef = (0, import_react30.useRef)(commit);
3924
3983
  commitRef.current = commit;
3925
- (0, import_react29.useEffect)(() => {
3984
+ (0, import_react30.useEffect)(() => {
3926
3985
  const el = inputRef.current;
3927
3986
  if (!el) return;
3928
3987
  const change = () => commitRef.current(el);
@@ -3953,7 +4012,7 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
3953
4012
  if (typeof forwarded === "function") forwarded(el);
3954
4013
  else if (forwarded) forwarded.current = el;
3955
4014
  };
3956
- return multiline ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("textarea", { ...props, ref: setRef, className: `${props.className} h-auto min-h-[3.5rem] py-1` }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("input", { type: "text", ...props, ref: setRef });
4015
+ return multiline ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("textarea", { ...props, ref: setRef, className: `${props.className} h-auto min-h-[3.5rem] py-1` }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("input", { type: "text", ...props, ref: setRef });
3957
4016
  }
3958
4017
  var plainNumber = (field, value) => (0, import_parameters.formatParameterNumber)({ ...field, unit: void 0 }, value);
3959
4018
  function ParameterNumberInput(props) {
@@ -3987,9 +4046,9 @@ function ParameterNumberInput(props) {
3987
4046
  onCommit: handleCommit,
3988
4047
  onKeyDown: handleKeyDown
3989
4048
  };
3990
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
3991
- CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field) }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterCommitInput, { ...inputProps }),
3992
- field.unit && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
4049
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
4050
+ CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field) }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ParameterCommitInput, { ...inputProps }),
4051
+ field.unit && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
3993
4052
  ] });
3994
4053
  }
3995
4054
  function ParameterSlider(props) {
@@ -3997,7 +4056,7 @@ function ParameterSlider(props) {
3997
4056
  const ctx = useParameterComponents();
3998
4057
  const resolved = resolveParameterComponents(components, ctx);
3999
4058
  const CustomSlider = resolved.slider;
4000
- const dragging = (0, import_react29.useRef)(false);
4059
+ const dragging = (0, import_react30.useRef)(false);
4001
4060
  const start = () => {
4002
4061
  if (dragging.current) return;
4003
4062
  dragging.current = true;
@@ -4008,7 +4067,7 @@ function ParameterSlider(props) {
4008
4067
  dragging.current = false;
4009
4068
  onGestureEnd?.();
4010
4069
  };
4011
- if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterNumberInput, { ...props });
4070
+ if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ParameterNumberInput, { ...props });
4012
4071
  const step = (0, import_parameters.parameterStep)(field);
4013
4072
  const sliderProps = {
4014
4073
  "aria-label": (0, import_parameters.parameterLabel)(field),
@@ -4022,8 +4081,8 @@ function ParameterSlider(props) {
4022
4081
  className: rangeClass,
4023
4082
  style: parameterRangeStyle
4024
4083
  };
4025
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2", children: [
4026
- CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4084
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-2", children: [
4085
+ CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4027
4086
  CustomSlider,
4028
4087
  {
4029
4088
  ...sliderProps,
@@ -4033,7 +4092,7 @@ function ParameterSlider(props) {
4033
4092
  onGestureStart: start,
4034
4093
  onGestureEnd: end
4035
4094
  }
4036
- ) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4095
+ ) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4037
4096
  "input",
4038
4097
  {
4039
4098
  type: "range",
@@ -4045,11 +4104,11 @@ function ParameterSlider(props) {
4045
4104
  onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field, Number(e.target.value)))
4046
4105
  }
4047
4106
  ),
4048
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
4107
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
4049
4108
  ] });
4050
4109
  }
4051
4110
  function ParameterToggle({ field, value, onChange, disabled, id }) {
4052
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4111
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4053
4112
  "button",
4054
4113
  {
4055
4114
  type: "button",
@@ -4060,7 +4119,7 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
4060
4119
  disabled: disabled || field.readOnly,
4061
4120
  onClick: () => onChange(!value),
4062
4121
  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"}`,
4063
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4122
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4064
4123
  "span",
4065
4124
  {
4066
4125
  className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
@@ -4077,7 +4136,7 @@ function ParameterSelect(props) {
4077
4136
  const options = (0, import_parameters.getChoiceOptions)(field);
4078
4137
  const off = disabled || field.readOnly;
4079
4138
  if (field.control === "segmented") {
4080
- return /* @__PURE__ */ (0, import_jsx_runtime31.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_runtime31.jsx)(
4139
+ return /* @__PURE__ */ (0, import_jsx_runtime32.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_runtime32.jsx)(
4081
4140
  "button",
4082
4141
  {
4083
4142
  type: "button",
@@ -4094,7 +4153,7 @@ function ParameterSelect(props) {
4094
4153
  }
4095
4154
  if (CustomSelect) {
4096
4155
  const customOptions = options.map((o) => ({ value: o.value, label: (0, import_parameters.choiceOptionLabel)(o), description: o.description }));
4097
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4156
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4098
4157
  CustomSelect,
4099
4158
  {
4100
4159
  id,
@@ -4110,7 +4169,7 @@ function ParameterSelect(props) {
4110
4169
  );
4111
4170
  }
4112
4171
  const index = options.findIndex((o) => o.value === value);
4113
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4172
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4114
4173
  "select",
4115
4174
  {
4116
4175
  id,
@@ -4123,23 +4182,23 @@ function ParameterSelect(props) {
4123
4182
  },
4124
4183
  className: parameterInputClass,
4125
4184
  style: parameterSelectStyle,
4126
- children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: String(i), title: o.description, style: parameterSelectStyle, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
4185
+ children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: String(i), title: o.description, style: parameterSelectStyle, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
4127
4186
  }
4128
4187
  );
4129
4188
  }
4130
4189
  function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id, components }) {
4131
4190
  const CustomColor = resolveParameterComponents(components, useParameterComponents()).color;
4132
- const [open, setOpen] = (0, import_react29.useState)(false);
4133
- const containerRef = (0, import_react29.useRef)(null);
4134
- const buttonRef = (0, import_react29.useRef)(null);
4135
- const popoverRef = (0, import_react29.useRef)(null);
4191
+ const [open, setOpen] = (0, import_react30.useState)(false);
4192
+ const containerRef = (0, import_react30.useRef)(null);
4193
+ const buttonRef = (0, import_react30.useRef)(null);
4194
+ const popoverRef = (0, import_react30.useRef)(null);
4136
4195
  const alpha = !!field.alpha;
4137
4196
  const hex = (0, import_parameters.normalizeHexColor)(value, true) ?? "#000000ff";
4138
4197
  const rgb = hex.slice(0, 7);
4139
4198
  const shown = alpha ? hex : rgb;
4140
4199
  const off = disabled || field.readOnly;
4141
4200
  const name = (0, import_parameters.parameterLabel)(field);
4142
- (0, import_react29.useEffect)(() => {
4201
+ (0, import_react30.useEffect)(() => {
4143
4202
  if (!open) return;
4144
4203
  const onPointerDown = (e) => {
4145
4204
  if (containerRef.current && !containerRef.current.contains(e.target)) {
@@ -4161,7 +4220,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
4161
4220
  };
4162
4221
  }, [open]);
4163
4222
  if (CustomColor) {
4164
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4223
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4165
4224
  CustomColor,
4166
4225
  {
4167
4226
  id,
@@ -4176,9 +4235,9 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
4176
4235
  }
4177
4236
  );
4178
4237
  }
4179
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
4180
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2", children: [
4181
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4238
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
4239
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-2", children: [
4240
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4182
4241
  "button",
4183
4242
  {
4184
4243
  ref: buttonRef,
@@ -4189,10 +4248,10 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
4189
4248
  disabled: off,
4190
4249
  onClick: () => setOpen((prev) => !prev),
4191
4250
  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",
4192
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
4251
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
4193
4252
  }
4194
4253
  ),
4195
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4254
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4196
4255
  ParameterCommitInput,
4197
4256
  {
4198
4257
  id,
@@ -4208,7 +4267,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
4208
4267
  }
4209
4268
  )
4210
4269
  ] }),
4211
- open && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4270
+ open && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4212
4271
  "div",
4213
4272
  {
4214
4273
  ref: popoverRef,
@@ -4222,7 +4281,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
4222
4281
  },
4223
4282
  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",
4224
4283
  style: { background: "var(--popover, var(--background, #fff))" },
4225
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4284
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4226
4285
  ColorPicker,
4227
4286
  {
4228
4287
  value: shown,
@@ -4240,11 +4299,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
4240
4299
  }
4241
4300
  function ParameterVector({ field, value, onChange, disabled, id, components }) {
4242
4301
  const size = (0, import_parameters.vectorSize)(field);
4243
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
4302
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
4244
4303
  const component = (0, import_parameters.vectorComponentField)(field, i);
4245
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
4246
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
4247
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4304
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
4305
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
4306
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4248
4307
  ParameterNumberInput,
4249
4308
  {
4250
4309
  field: component,
@@ -4262,11 +4321,11 @@ function ParameterVector({ field, value, onChange, disabled, id, components }) {
4262
4321
  function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
4263
4322
  const off = disabled || field.readOnly;
4264
4323
  const name = (0, import_parameters.parameterLabel)(field);
4265
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "space-y-1.5", children: [
4266
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2", children: [
4267
- /* @__PURE__ */ (0, import_jsx_runtime31.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_runtime31.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
4268
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
4269
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4324
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "space-y-1.5", children: [
4325
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-2", children: [
4326
+ /* @__PURE__ */ (0, import_jsx_runtime32.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_runtime32.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
4327
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
4328
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4270
4329
  ParameterCommitInput,
4271
4330
  {
4272
4331
  id,
@@ -4277,15 +4336,15 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
4277
4336
  onCommit: (text) => onChange(text.trim())
4278
4337
  }
4279
4338
  ),
4280
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex gap-1", children: [
4281
- resolveFile && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4339
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex gap-1", children: [
4340
+ resolveFile && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
4282
4341
  "label",
4283
4342
  {
4284
4343
  style: parameterButtonStyle,
4285
4344
  className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`,
4286
4345
  children: [
4287
4346
  "Choose file\u2026",
4288
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4347
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4289
4348
  "input",
4290
4349
  {
4291
4350
  type: "file",
@@ -4303,7 +4362,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
4303
4362
  ]
4304
4363
  }
4305
4364
  ),
4306
- value && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4365
+ value && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4307
4366
  "button",
4308
4367
  {
4309
4368
  type: "button",
@@ -4318,7 +4377,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
4318
4377
  ] })
4319
4378
  ] })
4320
4379
  ] }),
4321
- field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4380
+ field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4322
4381
  "button",
4323
4382
  {
4324
4383
  type: "button",
@@ -4328,14 +4387,14 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
4328
4387
  disabled: off,
4329
4388
  onClick: () => onChange(o.url),
4330
4389
  className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
4331
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
4390
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
4332
4391
  },
4333
4392
  o.url
4334
4393
  )) })
4335
4394
  ] });
4336
4395
  }
4337
4396
  function ParameterText({ field, value, onChange, disabled, id }) {
4338
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4397
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4339
4398
  ParameterCommitInput,
4340
4399
  {
4341
4400
  id,
@@ -4354,24 +4413,24 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
4354
4413
  switch (field.type) {
4355
4414
  case "number":
4356
4415
  case "int":
4357
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
4416
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
4358
4417
  case "boolean":
4359
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
4418
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
4360
4419
  case "choice":
4361
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
4420
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
4362
4421
  case "color":
4363
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
4422
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
4364
4423
  case "vector":
4365
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
4424
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
4366
4425
  case "image":
4367
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
4426
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
4368
4427
  case "text":
4369
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterText, { field, value, onChange: set, ...rest });
4428
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ParameterText, { field, value, onChange: set, ...rest });
4370
4429
  }
4371
4430
  }
4372
4431
 
4373
4432
  // src/effects/EffectParameters.tsx
4374
- var import_jsx_runtime32 = require("react/jsx-runtime");
4433
+ var import_jsx_runtime33 = require("react/jsx-runtime");
4375
4434
  function EffectParameters({
4376
4435
  description,
4377
4436
  values,
@@ -4386,10 +4445,10 @@ function EffectParameters({
4386
4445
  className = "",
4387
4446
  components
4388
4447
  }) {
4389
- const fields = (0, import_react30.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
4390
- const idBase = (0, import_react30.useId)();
4391
- const gesture = import_react30.default.useRef(null);
4392
- const count = import_react30.default.useRef(0);
4448
+ const fields = (0, import_react31.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
4449
+ const idBase = (0, import_react31.useId)();
4450
+ const gesture = import_react31.default.useRef(null);
4451
+ const count = import_react31.default.useRef(0);
4393
4452
  const CustomPresetSelect = resolveParameterComponents(components, useParameterComponents()).select;
4394
4453
  const handlePresetSelect = (name) => {
4395
4454
  if (!name) return;
@@ -4400,8 +4459,8 @@ function EffectParameters({
4400
4459
  if (preset) onPreset({ ...description.defaults, ...preset.values });
4401
4460
  }
4402
4461
  };
4403
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
4404
- (onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4462
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
4463
+ (onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4405
4464
  CustomPresetSelect,
4406
4465
  {
4407
4466
  "aria-label": `${description.name} presets`,
@@ -4416,7 +4475,7 @@ function EffectParameters({
4416
4475
  ],
4417
4476
  onChange: (name) => handlePresetSelect(String(name))
4418
4477
  }
4419
- ) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
4478
+ ) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4420
4479
  "select",
4421
4480
  {
4422
4481
  className: "w-full rounded border border-border px-1 py-0.5 text-xs",
@@ -4426,8 +4485,8 @@ function EffectParameters({
4426
4485
  disabled,
4427
4486
  onChange: (e) => handlePresetSelect(e.currentTarget.value),
4428
4487
  children: [
4429
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
4430
- description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
4488
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
4489
+ description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
4431
4490
  ]
4432
4491
  }
4433
4492
  )),
@@ -4437,14 +4496,14 @@ function EffectParameters({
4437
4496
  const keyed = keyframed?.has(field.id) ?? false;
4438
4497
  const value = (0, import_effects3.effectFieldValue)(field, values[field.id]);
4439
4498
  const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field.default);
4440
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
4441
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-1.5", children: [
4442
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
4443
- keyed && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
4499
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
4500
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-1.5", children: [
4501
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
4502
+ keyed && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
4444
4503
  renderControlAddon?.(field.id),
4445
- onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime32.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" })
4504
+ onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime33.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" })
4446
4505
  ] }),
4447
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4506
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4448
4507
  ParameterFieldControl,
4449
4508
  {
4450
4509
  field,
@@ -4459,15 +4518,15 @@ function EffectParameters({
4459
4518
  )
4460
4519
  ] }, field.id);
4461
4520
  }),
4462
- !fields.length && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
4521
+ !fields.length && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
4463
4522
  ] });
4464
4523
  }
4465
4524
 
4466
4525
  // src/paint-editor/PaintEffectsPanel.tsx
4467
- var import_jsx_runtime33 = require("react/jsx-runtime");
4526
+ var import_jsx_runtime34 = require("react/jsx-runtime");
4468
4527
  function usePaintEffectsProvider(controller) {
4469
- const [provider, setProvider] = (0, import_react31.useState)(controller.effectsCatalog);
4470
- (0, import_react31.useEffect)(() => {
4528
+ const [provider, setProvider] = (0, import_react32.useState)(controller.effectsCatalog);
4529
+ (0, import_react32.useEffect)(() => {
4471
4530
  const sync = () => setProvider(controller.effectsCatalog);
4472
4531
  sync();
4473
4532
  const a = controller.effects.subscribe(sync);
@@ -4481,10 +4540,10 @@ function usePaintEffectsProvider(controller) {
4481
4540
  }
4482
4541
  function usePaintEffectsTools(registry, controller, options = {}) {
4483
4542
  const { id, namespace, readOnly, playbackSurface } = options;
4484
- (0, import_react31.useEffect)(() => {
4543
+ (0, import_react32.useEffect)(() => {
4485
4544
  if (!registry) return;
4486
- const a = registry.register((0, import_paint_editor18.createPaintEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
4487
- const b = registry.register((0, import_paint_editor18.createPaintEffectAuthoringToolProvider)(controller, { id: id ? `${id}-authoring` : void 0, namespace: namespace === void 0 ? void 0 : namespace && `${namespace}-authoring`, readOnly, playbackSurface }));
4545
+ const a = registry.register((0, import_paint_editor19.createPaintEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
4546
+ const b = registry.register((0, import_paint_editor19.createPaintEffectAuthoringToolProvider)(controller, { id: id ? `${id}-authoring` : void 0, namespace: namespace === void 0 ? void 0 : namespace && `${namespace}-authoring`, readOnly, playbackSurface }));
4488
4547
  return () => {
4489
4548
  a();
4490
4549
  b();
@@ -4493,20 +4552,20 @@ function usePaintEffectsTools(registry, controller, options = {}) {
4493
4552
  }
4494
4553
  function Controls({ provider, effect, name, values, apply }) {
4495
4554
  const { description, error } = useEffectDescription(provider, effect);
4496
- const drags = (0, import_react31.useRef)(/* @__PURE__ */ new Set());
4497
- if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
4555
+ const drags = (0, import_react32.useRef)(/* @__PURE__ */ new Set());
4556
+ if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
4498
4557
  'No effects provider: "',
4499
4558
  name ?? effect,
4500
4559
  '" is kept as it was drawn.'
4501
4560
  ] });
4502
- if (error) return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
4503
- if (!description) return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
4561
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
4562
+ if (!description) return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
4504
4563
  const commit = (gesture) => {
4505
4564
  if (!gesture || drags.current.has(gesture)) return !gesture;
4506
4565
  drags.current.add(gesture);
4507
4566
  return true;
4508
4567
  };
4509
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4568
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4510
4569
  EffectParameters,
4511
4570
  {
4512
4571
  description,
@@ -4528,8 +4587,8 @@ var PaintEffectsPanel = ({ controller, className }) => {
4528
4587
  const state = usePaintEditorState(controller);
4529
4588
  const provider = usePaintEffectsProvider(controller);
4530
4589
  const [error, attempt] = useAttempt();
4531
- const [browse, setBrowse] = (0, import_react31.useState)(null);
4532
- const [busy, setBusy] = (0, import_react31.useState)(false);
4590
+ const [browse, setBrowse] = (0, import_react32.useState)(null);
4591
+ const [busy, setBusy] = (0, import_react32.useState)(false);
4533
4592
  const paper = controller.getPaperEffect();
4534
4593
  const activeId = state.document.activeLayerId;
4535
4594
  const layerEffect = activeId ? controller.getEffectLayer(activeId) : void 0;
@@ -4541,9 +4600,9 @@ var PaintEffectsPanel = ({ controller, className }) => {
4541
4600
  const playback = state.effectPlayback;
4542
4601
  const repaint = (patch) => {
4543
4602
  if (!effectPaint) return;
4544
- run(() => controller.setEffectPaint({ effect: effectPaint.effect, values: effectPaint.values, time: effectPaint.time, map: effectPaint.map, live: effectPaint.live, ...patch }));
4603
+ run(() => controller.setEffectPaint({ effect: effectPaint.effect, values: effectPaint.values, time: effectPaint.time, map: effectPaint.map ?? { by: "canvas" }, live: effectPaint.live ?? false, ...patch }));
4545
4604
  };
4546
- const thumbnail = (0, import_react31.useMemo)(() => effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(48) : null, [controller, effectPaint, state.effectPaintRendering]);
4605
+ const thumbnail = (0, import_react32.useMemo)(() => effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(48) : null, [controller, effectPaint, state.effectPaintRendering]);
4547
4606
  const run = (work) => attempt(() => {
4548
4607
  setBusy(true);
4549
4608
  return work().finally(() => setBusy(false));
@@ -4558,29 +4617,30 @@ var PaintEffectsPanel = ({ controller, className }) => {
4558
4617
  else if (kind === "paint") run(() => controller.setEffectPaint({ effect: id }));
4559
4618
  };
4560
4619
  const toggle = (b) => setBrowse(browse === b ? null : b);
4620
+ const offered = (0, import_react32.useMemo)(() => browse ? (e) => (0, import_paint_editor19.paintEffectOffered)(e, browse, provider?.capabilities) : void 0, [browse, provider]);
4561
4621
  const pixel = active?.type === "pixel";
4562
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
4563
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
4564
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
4565
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
4566
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
4567
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
4568
- /* @__PURE__ */ (0, import_jsx_runtime33.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" }),
4569
- /* @__PURE__ */ (0, import_jsx_runtime33.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" })
4622
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
4623
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
4624
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
4625
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
4626
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
4627
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
4628
+ /* @__PURE__ */ (0, import_jsx_runtime34.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" }),
4629
+ /* @__PURE__ */ (0, import_jsx_runtime34.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" })
4570
4630
  ] }),
4571
- !provider && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
4572
- browse && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
4573
- paper && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
4574
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-1", children: [
4575
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "flex-1 truncate", children: [
4631
+ !provider && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
4632
+ browse && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, filter: offered, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
4633
+ paper && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
4634
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-1", children: [
4635
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "flex-1 truncate", children: [
4576
4636
  "Paper: ",
4577
4637
  paper.name ?? paper.effect
4578
4638
  ] }),
4579
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
4639
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
4580
4640
  ] }),
4581
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
4582
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
4583
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4641
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
4642
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
4643
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4584
4644
  "input",
4585
4645
  {
4586
4646
  type: "range",
@@ -4602,43 +4662,43 @@ var PaintEffectsPanel = ({ controller, className }) => {
4602
4662
  `o${paper.opacity}`
4603
4663
  )
4604
4664
  ] }),
4605
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
4606
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
4607
- /* @__PURE__ */ (0, import_jsx_runtime33.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) => {
4665
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
4666
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
4667
+ /* @__PURE__ */ (0, import_jsx_runtime34.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) => {
4608
4668
  const blend = e.currentTarget.value;
4609
4669
  run(() => controller.updatePaperEffect({ blend }));
4610
- }, children: import_paint_editor18.PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: b, children: b }, b)) })
4670
+ }, children: import_paint_editor19.PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: b, children: b }, b)) })
4611
4671
  ] }),
4612
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
4672
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
4613
4673
  ] }),
4614
- effectPaint && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paint", children: [
4615
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-1", children: [
4616
- thumbnail ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("img", { src: thumbnail, alt: "", className: "h-5 w-8 rounded object-cover ring-1 ring-slate-700", "data-testid": "effect-paint-thumbnail" }) : null,
4617
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "flex-1 truncate", children: [
4674
+ effectPaint && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paint", children: [
4675
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-1", children: [
4676
+ thumbnail ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("img", { src: thumbnail, alt: "", className: "h-5 w-8 rounded object-cover ring-1 ring-slate-700", "data-testid": "effect-paint-thumbnail" }) : null,
4677
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "flex-1 truncate", children: [
4618
4678
  "Paint: ",
4619
4679
  effectPaint.effect,
4620
4680
  state.effectPaintRendering ? " (rendering\u2026)" : ""
4621
4681
  ] }),
4622
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
4682
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
4623
4683
  ] }),
4624
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
4625
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", title: "Lay the effect along each stroke instead of fixing it to the canvas", children: [
4626
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { type: "checkbox", checked: effectPaint.map?.by === "stroke", onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
4684
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
4685
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", title: "Lay the effect along each stroke instead of fixing it to the canvas", children: [
4686
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("input", { type: "checkbox", checked: effectPaint.map?.by === "stroke", onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
4627
4687
  "Along the stroke"
4628
4688
  ] }),
4629
- hasPathControl && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", title: "Pass each stroke's centreline to the effect's own path control", children: [
4630
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { type: "checkbox", checked: effectPaint.map?.by === "path", onChange: (e) => repaint({ map: e.target.checked ? { by: "path" } : { by: "canvas" } }) }),
4689
+ hasPathControl && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", title: "Pass each stroke's centreline to the effect's own path control", children: [
4690
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("input", { type: "checkbox", checked: effectPaint.map?.by === "path", onChange: (e) => repaint({ map: e.target.checked ? { by: "path" } : { by: "canvas" } }) }),
4631
4691
  "Along the stroke (native)"
4632
4692
  ] }),
4633
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
4634
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
4693
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
4694
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
4635
4695
  "Live"
4636
4696
  ] })
4637
4697
  ] }),
4638
- effectPaint.map?.by === "stroke" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
4639
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
4640
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-slate-400", children: "Length" }),
4641
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4698
+ effectPaint.map?.by === "stroke" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
4699
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
4700
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-slate-400", children: "Length" }),
4701
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4642
4702
  "input",
4643
4703
  {
4644
4704
  type: "number",
@@ -4652,56 +4712,57 @@ var PaintEffectsPanel = ({ controller, className }) => {
4652
4712
  effectPaint.map.length
4653
4713
  )
4654
4714
  ] }),
4655
- /* @__PURE__ */ (0, import_jsx_runtime33.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: [
4656
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: "repeat", children: "Repeat" }),
4657
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: "mirror", children: "Mirror" }),
4658
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: "clamp", children: "Clamp" })
4715
+ /* @__PURE__ */ (0, import_jsx_runtime34.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: [
4716
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "repeat", children: "Repeat" }),
4717
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "mirror", children: "Mirror" }),
4718
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "clamp", children: "Clamp" })
4659
4719
  ] })
4660
4720
  ] }),
4661
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
4721
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
4662
4722
  ] }),
4663
- animation && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-2 rounded border border-slate-700 p-1", "data-effect-part": "playback", children: [
4664
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "flex-1 truncate", children: [
4723
+ animation && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-2 rounded border border-slate-700 p-1", "data-effect-part": "playback", children: [
4724
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "flex-1 truncate", children: [
4665
4725
  "Live paint: ",
4666
4726
  animation.strokes,
4667
4727
  " ",
4668
4728
  animation.strokes === 1 ? "stroke" : "strokes"
4669
4729
  ] }),
4670
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button, "aria-pressed": playback.playing, onClick: () => attempt(() => controller.setEffectPlayback({ playing: !playback.playing })), children: playback.playing ? "Pause" : "Play" }),
4671
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
4672
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-slate-400", children: "fps" }),
4673
- /* @__PURE__ */ (0, import_jsx_runtime33.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" })
4730
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: button, "aria-pressed": playback.playing, onClick: () => attempt(() => controller.setEffectPlayback({ playing: !playback.playing })), children: playback.playing ? "Pause" : "Play" }),
4731
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "flex items-center gap-1", children: [
4732
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-slate-400", children: "fps" }),
4733
+ /* @__PURE__ */ (0, import_jsx_runtime34.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" })
4674
4734
  ] })
4675
4735
  ] }),
4676
- layerEffect && activeId && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "layer", children: [
4677
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-1", children: [
4678
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "flex-1 truncate", children: [
4736
+ layerEffect && activeId && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "layer", children: [
4737
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-1", children: [
4738
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "flex-1 truncate", children: [
4679
4739
  "Layer: ",
4680
4740
  layerEffect.name ?? layerEffect.effect
4681
4741
  ] }),
4682
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
4742
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
4683
4743
  ] }),
4684
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
4744
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
4685
4745
  ] }),
4686
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ErrorLine, { error })
4746
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ErrorLine, { error })
4687
4747
  ] });
4688
4748
  };
4689
4749
 
4690
4750
  // src/paint-editor/PaintEditor.tsx
4691
- var import_jsx_runtime34 = require("react/jsx-runtime");
4751
+ var import_jsx_runtime35 = require("react/jsx-runtime");
4692
4752
  var PAINT_CONTROLS = {
4693
4753
  "mixing-pad": '[data-testid="mixing-pad"]',
4694
4754
  lighting: '[data-testid="light-panel"]',
4695
4755
  symmetry: '[aria-label="Symmetry"]'
4696
4756
  };
4757
+ var TAB_LABELS = { color: "Colour", wet: "Wet", paper: "Paper", specialty: "Specialty", layers: "Layers", effects: "Effects" };
4697
4758
  var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, agentStrokes, deviceTilt, className, playback, playbackId = "paint", onPlaybackReveal }) => {
4698
- const [tool, setTool] = (0, import_react32.useState)("brush");
4699
- const [fillOptions, setFillOptions] = (0, import_react32.useState)({ reference: "all", tolerance: 32, closeGap: 4, expand: 1, antialias: true });
4700
- const [tab, setTab] = (0, import_react32.useState)("color");
4701
- const tabRef = (0, import_react32.useRef)(tab);
4759
+ const [tool, setTool] = (0, import_react33.useState)("brush");
4760
+ const [fillOptions, setFillOptions] = (0, import_react33.useState)({ reference: "all", tolerance: 32, closeGap: 4, expand: 1, antialias: true });
4761
+ const [tab, setTab] = (0, import_react33.useState)("color");
4762
+ const tabRef = (0, import_react33.useRef)(tab);
4702
4763
  tabRef.current = tab;
4703
- const rootRef = (0, import_react32.useRef)(null);
4704
- const [ownPresence] = (0, import_react32.useState)(() => new import_paint_editor19.PaintPresence());
4764
+ const rootRef = (0, import_react33.useRef)(null);
4765
+ const [ownPresence] = (0, import_react33.useState)(() => new import_paint_editor20.PaintPresence());
4705
4766
  const ambientPlayback = useAgentPlayback();
4706
4767
  const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
4707
4768
  const viewBox = () => {
@@ -4712,12 +4773,12 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
4712
4773
  const docToClient = (p) => {
4713
4774
  const r = viewBox();
4714
4775
  if (!r) return null;
4715
- const q = (0, import_paint_editor19.documentToScreen)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x, p.y);
4776
+ const q = (0, import_paint_editor20.documentToScreen)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x, p.y);
4716
4777
  return { x: r.left + q.x, y: r.top + q.y };
4717
4778
  };
4718
4779
  const clientToDoc = (p) => {
4719
4780
  const r = viewBox();
4720
- return r ? (0, import_paint_editor19.screenToDocument)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x - r.left, p.y - r.top) : null;
4781
+ return r ? (0, import_paint_editor20.screenToDocument)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x - r.left, p.y - r.top) : null;
4721
4782
  };
4722
4783
  const elementRect = (selector) => {
4723
4784
  const r = rootRef.current?.querySelector(selector)?.getBoundingClientRect();
@@ -4757,30 +4818,39 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
4757
4818
  const box = rootRef.current?.getBoundingClientRect();
4758
4819
  return c && box ? { x: c.x - box.left, y: c.y - box.top } : p;
4759
4820
  };
4760
- const [error, setError] = (0, import_react32.useState)(null);
4821
+ const [error, setError] = (0, import_react33.useState)(null);
4761
4822
  const effects = usePaintEffectsProvider(controller);
4762
- const tabs = effects ? ["color", "wet", "paper", "layers", "effects"] : ["color", "wet", "paper", "layers"];
4763
- return /* @__PURE__ */ (0, import_jsx_runtime34.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: [
4764
- playing && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
4765
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PaintToolbar, { controller, tool, onToolChange: setTool, fillOptions, onFillOptionsChange: setFillOptions, fileName }),
4766
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex min-h-0 flex-1 gap-2", children: [
4767
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
4768
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
4769
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PaintCanvas, { controller, tool, fillOptions, onError: setError, presence: playing ? void 0 : presence, proposals, agentStrokes, deviceTilt, className: "flex-1 rounded-lg" }),
4770
- error && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
4823
+ const tabs = effects ? ["color", "wet", "paper", "specialty", "layers", "effects"] : ["color", "wet", "paper", "specialty", "layers"];
4824
+ const specialty = (0, import_react33.useSyncExternalStore)(
4825
+ (notify) => controller.subscribe(notify),
4826
+ () => (0, import_paint_editor20.specialtyInPlay)(controller.getState()),
4827
+ () => (0, import_paint_editor20.specialtyInPlay)(controller.getState())
4828
+ );
4829
+ return /* @__PURE__ */ (0, import_jsx_runtime35.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: [
4830
+ playing && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
4831
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PaintToolbar, { controller, tool, onToolChange: setTool, fillOptions, onFillOptionsChange: setFillOptions, fileName }),
4832
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex min-h-0 flex-1 gap-2", children: [
4833
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(BrushPanel, { controller, onOpenSpecialtyPanel: () => setTab("specialty"), className: "w-60 shrink-0 overflow-y-auto pr-1" }),
4834
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
4835
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PaintCanvas, { controller, tool, fillOptions, onError: setError, presence: playing ? void 0 : presence, proposals, agentStrokes, deviceTilt, className: "flex-1 rounded-lg" }),
4836
+ error && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
4771
4837
  ] }),
4772
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
4773
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex gap-1", role: "tablist", "aria-label": "Paint panels", children: tabs.map((t) => /* @__PURE__ */ (0, import_jsx_runtime34.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)) }),
4774
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
4775
- tab === "color" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ColorPanel, { controller }),
4776
- tab === "wet" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(WetPanel, { controller }),
4777
- tab === "paper" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PaperPanel, { controller }),
4778
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PaintLayersPanel, { controller }),
4779
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(StrokePanel, { controller }),
4780
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PathStrokePanel, { controller }),
4781
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(EvolutionPanel, { controller, proposals }),
4782
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(StickerPanel, { controller }),
4783
- tab === "effects" && effects && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PaintEffectsPanel, { controller })
4838
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
4839
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex gap-1", role: "tablist", "aria-label": "Paint panels", children: tabs.map((t) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("button", { type: "button", role: "tab", "aria-selected": tab === t, "data-paint-tab": t, className: chip(tab === t), onClick: () => setTab(t), ...t === "specialty" && specialty ? { "data-active": "", title: "Specialty paint is in play" } : {}, children: [
4840
+ TAB_LABELS[t],
4841
+ t === "specialty" && specialty && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { "aria-hidden": "true", className: "ml-1 text-indigo-300", children: "\u2022" })
4842
+ ] }, t)) }),
4843
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
4844
+ tab === "color" && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ColorPanel, { controller }),
4845
+ tab === "wet" && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(WetPanel, { controller }),
4846
+ tab === "paper" && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PaperPanel, { controller }),
4847
+ tab === "specialty" && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SpecialtyPanel, { controller }),
4848
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PaintLayersPanel, { controller }),
4849
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(StrokePanel, { controller }),
4850
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PathStrokePanel, { controller }),
4851
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(EvolutionPanel, { controller, proposals }),
4852
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(StickerPanel, { controller }),
4853
+ tab === "effects" && effects && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PaintEffectsPanel, { controller })
4784
4854
  ] })
4785
4855
  ] })
4786
4856
  ] })
@@ -4806,6 +4876,8 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
4806
4876
  PaintToolbar,
4807
4877
  PaperPanel,
4808
4878
  PathStrokePanel,
4879
+ SpecialtyGuideCard,
4880
+ SpecialtyPanel,
4809
4881
  StickerPanel,
4810
4882
  StickerPicker,
4811
4883
  StrokePanel,