@pixerate/editor-react 0.196.0 → 0.198.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.
@@ -178,8 +178,13 @@ var PaintCanvas = ({ controller, tool = "brush", fillOptions, showGuides = true,
178
178
  if (ctx && typeof ctx.createImageData === "function") drawWaterOverlay(controller, ctx);
179
179
  }, [state, controller]);
180
180
  useEffect2(() => {
181
+ controller.catchUpCultures();
181
182
  const player = controller.playEffects();
182
- return () => player.stop();
183
+ const cultures = controller.playCultures();
184
+ return () => {
185
+ player.stop();
186
+ cultures.stop();
187
+ };
183
188
  }, [controller]);
184
189
  useEffect2(() => {
185
190
  const el = viewport.current;
@@ -258,10 +263,10 @@ var PaintCanvas = ({ controller, tool = "brush", fillOptions, showGuides = true,
258
263
  y1: l.from.y,
259
264
  x2: l.to.x,
260
265
  y2: l.to.y,
261
- stroke: l.kind === "symmetry" ? "#22d3ee" : l.kind === "stencil" ? "#fbbf24" : l.kind === "stroke" || l.kind === "sticker" ? "#818cf8" : "#f472b6",
262
- strokeOpacity: l.kind === "symmetry" || l.kind === "stencil" || l.kind === "stroke" || l.kind === "sticker" ? 0.8 : 0.35,
263
- strokeWidth: 1 / state.view.zoom,
264
- strokeDasharray: l.kind === "symmetry" ? `${6 / state.view.zoom} ${4 / state.view.zoom}` : void 0
266
+ stroke: l.kind === "symmetry" ? "#22d3ee" : l.kind === "stencil" ? "#fbbf24" : l.kind === "stroke" || l.kind === "sticker" ? "#818cf8" : l.kind === "vortex" || l.kind === "vortex-reach" ? "#38bdf8" : "#f472b6",
267
+ strokeOpacity: l.kind === "vortex" ? 0.9 : l.kind === "symmetry" || l.kind === "stencil" || l.kind === "stroke" || l.kind === "sticker" ? 0.8 : l.kind === "vortex-reach" ? 0.45 : 0.35,
268
+ strokeWidth: (l.kind === "vortex" ? 1.5 : 1) / state.view.zoom,
269
+ strokeDasharray: l.kind === "symmetry" ? `${6 / state.view.zoom} ${4 / state.view.zoom}` : l.kind === "vortex-reach" ? `${4 / state.view.zoom} ${4 / state.view.zoom}` : void 0
265
270
  },
266
271
  i
267
272
  )),
@@ -820,7 +825,7 @@ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, clas
820
825
 
821
826
  // src/paint-editor/PaperPanel.tsx
822
827
  import { useEffect as useEffect4, useMemo as useMemo5, useState as useState5 } from "react";
823
- import { DEFAULT_BACKLIGHT_COLOR, LIGHT_SLIDERS, PAPER_FAMILIES, PAPER_LIBRARY, PAPER_SLIDERS, UV_LIGHT_SLIDERS, VIEW_TILT_SLIDERS, patchPath, readPath as readPath3, renderPaper, requestDeviceTiltPermission, startDeviceTilt as startDeviceTilt2 } from "@pixerate/editor/paint-editor";
828
+ import { DEFAULT_BACKLIGHT_COLOR, LIGHT_SLIDERS, PAPER_FAMILIES, PAPER_LIBRARY, PAPER_SLIDERS, UV_LIGHT_SLIDERS, VIEW_TILT_SLIDERS, patchPath, readPath as readPath4, renderPaper, requestDeviceTiltPermission, startDeviceTilt as startDeviceTilt2 } from "@pixerate/editor/paint-editor";
824
829
 
825
830
  // src/paint-editor/FerroPanel.tsx
826
831
  import { useMemo as useMemo4 } from "react";
@@ -954,8 +959,90 @@ var TimeMachinePanel = ({ controller, className }) => {
954
959
  ] });
955
960
  };
956
961
 
957
- // src/paint-editor/PaperPanel.tsx
962
+ // src/paint-editor/CulturePanel.tsx
963
+ import { CULTURE_SLIDERS, readPath as readPath3 } from "@pixerate/editor/paint-editor";
958
964
  import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
965
+ var CulturePanel = ({ controller, className }) => {
966
+ const state = usePaintEditorState(controller);
967
+ const [error, attempt] = useAttempt();
968
+ const { cultures, brush } = state;
969
+ const activeId = state.document.activeLayerId;
970
+ const activeColony = cultures.layers.find((l) => l.layerId === activeId) ?? cultures.layers[0] ?? null;
971
+ const totalTips = cultures.layers.reduce((acc, l) => acc + l.tips, 0);
972
+ const totalSegments = cultures.layers.reduce((acc, l) => acc + l.segments, 0);
973
+ const canCarryCulture = ["dab", "mixer", "impasto", "particle", "bristle"].includes(brush.engine);
974
+ return /* @__PURE__ */ jsxs7("div", { className: `${panel} ${className ?? ""}`, "data-testid": "culture-panel", children: [
975
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between", children: [
976
+ /* @__PURE__ */ jsx8("span", { className: "font-medium text-slate-300", children: "Biopaint (mycelial ink)" }),
977
+ /* @__PURE__ */ jsxs7("div", { className: "flex gap-1", children: [
978
+ /* @__PURE__ */ jsx8("button", { type: "button", className: button, onClick: () => attempt(() => controller.growCultures({ steps: 40 })), children: "Grow" }),
979
+ /* @__PURE__ */ jsx8(
980
+ "button",
981
+ {
982
+ type: "button",
983
+ "aria-pressed": cultures.paused,
984
+ className: chip(cultures.paused),
985
+ onClick: () => controller.setCulturePaused(!cultures.paused),
986
+ children: cultures.paused ? "Paused" : "Pause"
987
+ }
988
+ ),
989
+ /* @__PURE__ */ jsx8(
990
+ "button",
991
+ {
992
+ type: "button",
993
+ className: button,
994
+ disabled: !activeColony || activeColony.tips === 0,
995
+ onClick: () => attempt(() => controller.removeCultures(activeColony?.layerId)),
996
+ children: "Kill colony"
997
+ }
998
+ )
999
+ ] })
1000
+ ] }),
1001
+ /* @__PURE__ */ jsx8("div", { className: "flex items-center justify-between text-[11px] text-slate-400", children: /* @__PURE__ */ jsx8("span", { children: activeColony ? `${totalTips} living tips \xB7 ${totalSegments} segments (${activeColony.status})` : "No mycelial colony on canvas" }) }),
1002
+ /* @__PURE__ */ jsxs7("label", { className: "flex items-center gap-2 text-[11px]", children: [
1003
+ /* @__PURE__ */ jsx8(
1004
+ "input",
1005
+ {
1006
+ type: "checkbox",
1007
+ checked: cultures.growWhileClosed,
1008
+ onChange: (e) => attempt(() => controller.setCultureOptions({ growWhileClosed: e.target.checked }))
1009
+ }
1010
+ ),
1011
+ "Grow while closed"
1012
+ ] }),
1013
+ canCarryCulture && /* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-1 border-t border-slate-800 pt-1.5", children: [
1014
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between", children: [
1015
+ /* @__PURE__ */ jsx8("span", { className: "text-[11px] text-slate-400", children: "Brush spores" }),
1016
+ /* @__PURE__ */ jsx8(
1017
+ "button",
1018
+ {
1019
+ type: "button",
1020
+ "aria-pressed": Boolean(brush.culture),
1021
+ className: chip(Boolean(brush.culture)),
1022
+ onClick: () => attempt(() => controller.setBrush({ culture: brush.culture ? null : {} })),
1023
+ children: brush.culture ? "On" : "Off"
1024
+ }
1025
+ )
1026
+ ] }),
1027
+ brush.culture && CULTURE_SLIDERS.map((c) => {
1028
+ const key = c.path.replace(/^culture\./, "");
1029
+ return /* @__PURE__ */ jsx8(
1030
+ PaintSlider,
1031
+ {
1032
+ control: c,
1033
+ value: readPath3(brush.culture, key),
1034
+ onCommit: (v) => attempt(() => controller.setBrush({ culture: { [key]: v } }))
1035
+ },
1036
+ c.path
1037
+ );
1038
+ })
1039
+ ] }),
1040
+ /* @__PURE__ */ jsx8(ErrorLine, { error })
1041
+ ] });
1042
+ };
1043
+
1044
+ // src/paint-editor/PaperPanel.tsx
1045
+ import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
959
1046
  var SWATCH = { x: 0, y: 0, width: 64, height: 40 };
960
1047
  var PaperPanel = ({ controller, className }) => {
961
1048
  const state = usePaintEditorState(controller);
@@ -964,10 +1051,10 @@ var PaperPanel = ({ controller, className }) => {
964
1051
  useEffect4(() => tiltFollow ? startDeviceTilt2(controller) : void 0, [controller, tiltFollow]);
965
1052
  const paper = state.document.paper;
966
1053
  const previews = useMemo5(() => new Map(PAPER_LIBRARY.map((p) => [p.preset, { ...SWATCH, data: renderPaper({ ...p, shading: Math.max(0.8, p.shading) }, SWATCH) }])), []);
967
- return /* @__PURE__ */ jsxs7("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paper-panel", children: [
968
- PAPER_FAMILIES.map((family) => /* @__PURE__ */ jsxs7("div", { children: [
969
- /* @__PURE__ */ jsx8("div", { className: "mb-0.5 text-[10px] uppercase tracking-wide text-slate-500", children: family }),
970
- /* @__PURE__ */ jsx8("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": `${family} papers`, children: PAPER_LIBRARY.filter((p) => p.family === family).map((p) => /* @__PURE__ */ jsx8(
1054
+ return /* @__PURE__ */ jsxs8("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paper-panel", children: [
1055
+ PAPER_FAMILIES.map((family) => /* @__PURE__ */ jsxs8("div", { children: [
1056
+ /* @__PURE__ */ jsx9("div", { className: "mb-0.5 text-[10px] uppercase tracking-wide text-slate-500", children: family }),
1057
+ /* @__PURE__ */ jsx9("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": `${family} papers`, children: PAPER_LIBRARY.filter((p) => p.family === family).map((p) => /* @__PURE__ */ jsx9(
971
1058
  "button",
972
1059
  {
973
1060
  type: "button",
@@ -976,32 +1063,32 @@ var PaperPanel = ({ controller, className }) => {
976
1063
  title: p.name,
977
1064
  className: `rounded p-0.5 ${paper.preset === p.preset ? "ring-2 ring-indigo-500" : "ring-1 ring-slate-700 hover:ring-slate-500"}`,
978
1065
  onClick: () => attempt(() => controller.setPaper({ preset: p.preset })),
979
- children: /* @__PURE__ */ jsx8(PixelCanvas, { pixels: previews.get(p.preset) ?? null, label: p.name, style: { width: 48, height: 30 } })
1066
+ children: /* @__PURE__ */ jsx9(PixelCanvas, { pixels: previews.get(p.preset) ?? null, label: p.name, style: { width: 48, height: 30 } })
980
1067
  },
981
1068
  p.preset
982
1069
  )) })
983
1070
  ] }, family)),
984
- /* @__PURE__ */ jsx8("div", { className: "text-slate-300", children: paper.name }),
985
- /* @__PURE__ */ jsxs7("label", { className: "flex items-center justify-between", children: [
986
- /* @__PURE__ */ jsx8("span", { className: "text-slate-400", children: "Colour" }),
987
- /* @__PURE__ */ jsx8(CommitColorInput, { label: "Paper colour", value: paper.color, onCommit: (v) => attempt(() => controller.setPaper({ color: v })), className: "h-6 w-10 rounded bg-transparent" })
1071
+ /* @__PURE__ */ jsx9("div", { className: "text-slate-300", children: paper.name }),
1072
+ /* @__PURE__ */ jsxs8("label", { className: "flex items-center justify-between", children: [
1073
+ /* @__PURE__ */ jsx9("span", { className: "text-slate-400", children: "Colour" }),
1074
+ /* @__PURE__ */ jsx9(CommitColorInput, { label: "Paper colour", value: paper.color, onCommit: (v) => attempt(() => controller.setPaper({ color: v })), className: "h-6 w-10 rounded bg-transparent" })
988
1075
  ] }),
989
- PAPER_SLIDERS.map((c) => /* @__PURE__ */ jsx8(PaintSlider, { control: c, value: readPath3(paper, c.path), onCommit: (v) => attempt(() => controller.setPaper(patchPath(paper, c.path, v))) }, c.path)),
990
- /* @__PURE__ */ jsxs7("label", { className: "flex items-center justify-between", children: [
991
- /* @__PURE__ */ jsx8("span", { className: "text-slate-400", children: "Backlight colour" }),
992
- /* @__PURE__ */ jsx8(CommitColorInput, { label: "Backlight colour", value: paper.backlightColor ?? DEFAULT_BACKLIGHT_COLOR, onCommit: (v) => attempt(() => controller.setPaper({ backlightColor: v })), className: "h-6 w-10 rounded bg-transparent" })
1076
+ PAPER_SLIDERS.map((c) => /* @__PURE__ */ jsx9(PaintSlider, { control: c, value: readPath4(paper, c.path), onCommit: (v) => attempt(() => controller.setPaper(patchPath(paper, c.path, v))) }, c.path)),
1077
+ /* @__PURE__ */ jsxs8("label", { className: "flex items-center justify-between", children: [
1078
+ /* @__PURE__ */ jsx9("span", { className: "text-slate-400", children: "Backlight colour" }),
1079
+ /* @__PURE__ */ jsx9(CommitColorInput, { label: "Backlight colour", value: paper.backlightColor ?? DEFAULT_BACKLIGHT_COLOR, onCommit: (v) => attempt(() => controller.setPaper({ backlightColor: v })), className: "h-6 w-10 rounded bg-transparent" })
993
1080
  ] }),
994
- /* @__PURE__ */ jsxs7("label", { className: "flex items-center gap-2", children: [
995
- /* @__PURE__ */ jsx8("input", { type: "checkbox", checked: paper.tiling === "mirror", onChange: (e) => attempt(() => controller.setPaper({ tiling: e.target.checked ? "mirror" : "repeat" })) }),
1081
+ /* @__PURE__ */ jsxs8("label", { className: "flex items-center gap-2", children: [
1082
+ /* @__PURE__ */ jsx9("input", { type: "checkbox", checked: paper.tiling === "mirror", onChange: (e) => attempt(() => controller.setPaper({ tiling: e.target.checked ? "mirror" : "repeat" })) }),
996
1083
  " Mirror tiling"
997
1084
  ] }),
998
- /* @__PURE__ */ jsx8("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" }),
999
- /* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-1.5", "data-testid": "light-panel", children: [
1000
- /* @__PURE__ */ jsx8("span", { className: "font-medium text-slate-300", children: "Light (thick paint, iridescence, metallic paper)" }),
1001
- LIGHT_SLIDERS.map((c) => /* @__PURE__ */ jsx8(PaintSlider, { control: c, value: readPath3(controller.getLighting(), c.path), onChange: (v) => attempt(() => controller.setLighting({ [c.path]: v })) }, c.path)),
1002
- VIEW_TILT_SLIDERS.map((c) => /* @__PURE__ */ jsx8(PaintSlider, { control: c, value: readPath3(state.viewTilt, c.path), onChange: (v) => attempt(() => controller.setViewTilt({ [c.path]: v })) }, c.path)),
1003
- /* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap items-center gap-1", children: [
1004
- /* @__PURE__ */ jsx8(
1085
+ /* @__PURE__ */ jsx9("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" }),
1086
+ /* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-1.5", "data-testid": "light-panel", children: [
1087
+ /* @__PURE__ */ jsx9("span", { className: "font-medium text-slate-300", children: "Light (thick paint, iridescence, metallic paper)" }),
1088
+ LIGHT_SLIDERS.map((c) => /* @__PURE__ */ jsx9(PaintSlider, { control: c, value: readPath4(controller.getLighting(), c.path), onChange: (v) => attempt(() => controller.setLighting({ [c.path]: v })) }, c.path)),
1089
+ VIEW_TILT_SLIDERS.map((c) => /* @__PURE__ */ jsx9(PaintSlider, { control: c, value: readPath4(state.viewTilt, c.path), onChange: (v) => attempt(() => controller.setViewTilt({ [c.path]: v })) }, c.path)),
1090
+ /* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap items-center gap-1", children: [
1091
+ /* @__PURE__ */ jsx9(
1005
1092
  "button",
1006
1093
  {
1007
1094
  type: "button",
@@ -1014,28 +1101,29 @@ var PaperPanel = ({ controller, className }) => {
1014
1101
  children: "Device tilt"
1015
1102
  }
1016
1103
  ),
1017
- /* @__PURE__ */ jsx8("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" })
1104
+ /* @__PURE__ */ jsx9("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" })
1018
1105
  ] })
1019
1106
  ] }),
1020
- /* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-1.5", "data-testid": "uv-heat-panel", children: [
1021
- /* @__PURE__ */ jsx8("span", { className: "font-medium text-slate-300", children: "UV blacklight & heat" }),
1022
- /* @__PURE__ */ jsxs7("label", { className: "flex items-center gap-2", children: [
1023
- /* @__PURE__ */ jsx8("input", { type: "checkbox", checked: state.uvLight.on, onChange: (e) => attempt(() => controller.setUvLight({ on: e.target.checked })) }),
1107
+ /* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-1.5", "data-testid": "uv-heat-panel", children: [
1108
+ /* @__PURE__ */ jsx9("span", { className: "font-medium text-slate-300", children: "UV blacklight & heat" }),
1109
+ /* @__PURE__ */ jsxs8("label", { className: "flex items-center gap-2", children: [
1110
+ /* @__PURE__ */ jsx9("input", { type: "checkbox", checked: state.uvLight.on, onChange: (e) => attempt(() => controller.setUvLight({ on: e.target.checked })) }),
1024
1111
  " UV blacklight"
1025
1112
  ] }),
1026
- UV_LIGHT_SLIDERS.map((c) => /* @__PURE__ */ jsx8(PaintSlider, { control: c, value: readPath3(state.uvLight, c.path), onChange: (v) => attempt(() => controller.setUvLight({ [c.path]: v })) }, c.path)),
1027
- /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-1.5", children: [
1028
- /* @__PURE__ */ jsx8("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" }),
1029
- /* @__PURE__ */ jsx8("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" }),
1030
- state.heat.hotCells > 0 && /* @__PURE__ */ jsxs7("span", { className: "text-[11px] text-amber-400", children: [
1113
+ UV_LIGHT_SLIDERS.map((c) => /* @__PURE__ */ jsx9(PaintSlider, { control: c, value: readPath4(state.uvLight, c.path), onChange: (v) => attempt(() => controller.setUvLight({ [c.path]: v })) }, c.path)),
1114
+ /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-1.5", children: [
1115
+ /* @__PURE__ */ jsx9("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" }),
1116
+ /* @__PURE__ */ jsx9("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" }),
1117
+ state.heat.hotCells > 0 && /* @__PURE__ */ jsxs8("span", { className: "text-[11px] text-amber-400", children: [
1031
1118
  Math.round(state.heat.max * 100),
1032
1119
  "% warm"
1033
1120
  ] })
1034
1121
  ] })
1035
1122
  ] }),
1036
- /* @__PURE__ */ jsx8(FerroPanel, { controller }),
1037
- /* @__PURE__ */ jsx8(TimeMachinePanel, { controller }),
1038
- /* @__PURE__ */ jsx8(ErrorLine, { error })
1123
+ /* @__PURE__ */ jsx9(FerroPanel, { controller }),
1124
+ /* @__PURE__ */ jsx9(TimeMachinePanel, { controller }),
1125
+ /* @__PURE__ */ jsx9(CulturePanel, { controller }),
1126
+ /* @__PURE__ */ jsx9(ErrorLine, { error })
1039
1127
  ] });
1040
1128
  };
1041
1129
 
@@ -1057,7 +1145,7 @@ import {
1057
1145
  wheelPoint
1058
1146
  } from "@pixerate/editor/paint-editor";
1059
1147
  import { DEFAULT_PAINT_GRADIENT as DEFAULT_PAINT_GRADIENT2, paintSourceCss } from "@pixerate/editor/paint-editor";
1060
- import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1148
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
1061
1149
  var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className }) => {
1062
1150
  const state = usePaintEditorState(controller);
1063
1151
  const [error, attempt] = useAttempt();
@@ -1086,9 +1174,9 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1086
1174
  const y = Math.min(MIXING_PAD_HEIGHT, Math.max(0, (e.clientY - rect.top) * ky));
1087
1175
  return e.pointerType === "pen" && e.pressure > 0 ? { x, y, pressure: e.pressure } : { x, y };
1088
1176
  };
1089
- return /* @__PURE__ */ jsxs8("div", { className: `${panel} ${className ?? ""}`, "data-testid": "color-panel", children: [
1090
- /* @__PURE__ */ jsxs8("div", { className: "relative self-center", style: { width: wheelSize, height: wheelSize }, children: [
1091
- /* @__PURE__ */ jsx9(
1177
+ return /* @__PURE__ */ jsxs9("div", { className: `${panel} ${className ?? ""}`, "data-testid": "color-panel", children: [
1178
+ /* @__PURE__ */ jsxs9("div", { className: "relative self-center", style: { width: wheelSize, height: wheelSize }, children: [
1179
+ /* @__PURE__ */ jsx10(
1092
1180
  "div",
1093
1181
  {
1094
1182
  role: "slider",
@@ -1102,20 +1190,20 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1102
1190
  const rect = e.currentTarget.getBoundingClientRect();
1103
1191
  controller.setColor(wheelPick(e.clientX - rect.left - R, e.clientY - rect.top - R, wheel, color));
1104
1192
  },
1105
- children: /* @__PURE__ */ jsx9(PixelCanvas, { pixels: ring, label: "Colour wheel", style: { width: wheelSize, height: wheelSize } })
1193
+ children: /* @__PURE__ */ jsx10(PixelCanvas, { pixels: ring, label: "Colour wheel", style: { width: wheelSize, height: wheelSize } })
1106
1194
  }
1107
1195
  ),
1108
- /* @__PURE__ */ jsx9("svg", { className: "pointer-events-none absolute inset-0", width: wheelSize, height: wheelSize, "aria-hidden": "true", children: harmony.map((h, i) => {
1196
+ /* @__PURE__ */ jsx10("svg", { className: "pointer-events-none absolute inset-0", width: wheelSize, height: wheelSize, "aria-hidden": "true", children: harmony.map((h, i) => {
1109
1197
  const p = wheelPoint(h.angle, mid);
1110
- return /* @__PURE__ */ jsx9("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);
1198
+ return /* @__PURE__ */ jsx10("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);
1111
1199
  }) }),
1112
- /* @__PURE__ */ jsx9("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 } })
1200
+ /* @__PURE__ */ jsx10("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 } })
1113
1201
  ] }),
1114
- /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
1115
- /* @__PURE__ */ jsx9("input", { type: "color", "aria-label": "Paint colour", value: color, onChange: (e) => controller.setColor(e.target.value), className: "h-7 w-9 rounded bg-transparent" }),
1116
- /* @__PURE__ */ jsx9("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" }),
1117
- /* @__PURE__ */ jsx9("button", { type: "button", className: button, title: "Swap colours (X)", onClick: () => controller.swapColors(), children: "Swap" }),
1118
- /* @__PURE__ */ jsx9(
1202
+ /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
1203
+ /* @__PURE__ */ jsx10("input", { type: "color", "aria-label": "Paint colour", value: color, onChange: (e) => controller.setColor(e.target.value), className: "h-7 w-9 rounded bg-transparent" }),
1204
+ /* @__PURE__ */ jsx10("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" }),
1205
+ /* @__PURE__ */ jsx10("button", { type: "button", className: button, title: "Swap colours (X)", onClick: () => controller.swapColors(), children: "Swap" }),
1206
+ /* @__PURE__ */ jsx10(
1119
1207
  "input",
1120
1208
  {
1121
1209
  "aria-label": "Hex colour",
@@ -1126,8 +1214,8 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1126
1214
  color
1127
1215
  )
1128
1216
  ] }),
1129
- /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", "data-testid": "paint-source", children: [
1130
- /* @__PURE__ */ jsx9(
1217
+ /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", "data-testid": "paint-source", children: [
1218
+ /* @__PURE__ */ jsx10(
1131
1219
  "span",
1132
1220
  {
1133
1221
  className: "h-5 flex-1 rounded ring-1 ring-slate-700",
@@ -1137,7 +1225,7 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1137
1225
  style: { background: effectWell ? `center / cover no-repeat url("${effectWell}")` : paintSourceCss(state.paint, { paint: color, secondary: state.secondaryColor }) }
1138
1226
  }
1139
1227
  ),
1140
- /* @__PURE__ */ jsx9(
1228
+ /* @__PURE__ */ jsx10(
1141
1229
  "button",
1142
1230
  {
1143
1231
  type: "button",
@@ -1149,26 +1237,26 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1149
1237
  }
1150
1238
  )
1151
1239
  ] }),
1152
- state.paint.type === "gradient" && /* @__PURE__ */ jsx9(PaintGradientEditor, { value: state.paint, colors: { paint: color, secondary: state.secondaryColor }, onChange: (g2) => attempt(() => controller.setPaint(g2)) }),
1153
- /* @__PURE__ */ jsxs8("label", { className: "flex items-center gap-2", children: [
1154
- /* @__PURE__ */ jsx9("span", { className: "w-16 text-slate-400", children: "Saturation" }),
1155
- /* @__PURE__ */ jsx9("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" })
1240
+ state.paint.type === "gradient" && /* @__PURE__ */ jsx10(PaintGradientEditor, { value: state.paint, colors: { paint: color, secondary: state.secondaryColor }, onChange: (g2) => attempt(() => controller.setPaint(g2)) }),
1241
+ /* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-2", children: [
1242
+ /* @__PURE__ */ jsx10("span", { className: "w-16 text-slate-400", children: "Saturation" }),
1243
+ /* @__PURE__ */ jsx10("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" })
1156
1244
  ] }),
1157
- /* @__PURE__ */ jsxs8("label", { className: "flex items-center gap-2", children: [
1158
- /* @__PURE__ */ jsx9("span", { className: "w-16 text-slate-400", children: "Value" }),
1159
- /* @__PURE__ */ jsx9("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" })
1245
+ /* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-2", children: [
1246
+ /* @__PURE__ */ jsx10("span", { className: "w-16 text-slate-400", children: "Value" }),
1247
+ /* @__PURE__ */ jsx10("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" })
1160
1248
  ] }),
1161
- /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-1", children: [
1162
- /* @__PURE__ */ jsx9("select", { "aria-label": "Harmony", value: kind, onChange: (e) => setKind(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: HARMONY_KINDS.map((k) => /* @__PURE__ */ jsx9("option", { value: k, children: k }, k)) }),
1163
- /* @__PURE__ */ jsx9("button", { type: "button", className: chip(wheel === "ryb"), "aria-pressed": wheel === "ryb", onClick: () => setWheel("ryb"), children: "RYB" }),
1164
- /* @__PURE__ */ jsx9("button", { type: "button", className: chip(wheel === "rgb"), "aria-pressed": wheel === "rgb", onClick: () => setWheel("rgb"), children: "RGB" })
1249
+ /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1", children: [
1250
+ /* @__PURE__ */ jsx10("select", { "aria-label": "Harmony", value: kind, onChange: (e) => setKind(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: HARMONY_KINDS.map((k) => /* @__PURE__ */ jsx10("option", { value: k, children: k }, k)) }),
1251
+ /* @__PURE__ */ jsx10("button", { type: "button", className: chip(wheel === "ryb"), "aria-pressed": wheel === "ryb", onClick: () => setWheel("ryb"), children: "RYB" }),
1252
+ /* @__PURE__ */ jsx10("button", { type: "button", className: chip(wheel === "rgb"), "aria-pressed": wheel === "rgb", onClick: () => setWheel("rgb"), children: "RGB" })
1165
1253
  ] }),
1166
- /* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap gap-1", "aria-label": "Harmony colours", children: [
1167
- harmony.map((h, i) => /* @__PURE__ */ jsx9("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)),
1168
- /* @__PURE__ */ jsx9("button", { type: "button", className: button, onClick: () => harmony.forEach((h) => controller.addSwatch(h.color)), children: "+ swatches" })
1254
+ /* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap gap-1", "aria-label": "Harmony colours", children: [
1255
+ harmony.map((h, i) => /* @__PURE__ */ jsx10("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)),
1256
+ /* @__PURE__ */ jsx10("button", { type: "button", className: button, onClick: () => harmony.forEach((h) => controller.addSwatch(h.color)), children: "+ swatches" })
1169
1257
  ] }),
1170
- /* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": "Swatches", children: [
1171
- state.swatches.map((s, i) => /* @__PURE__ */ jsx9(
1258
+ /* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": "Swatches", children: [
1259
+ state.swatches.map((s, i) => /* @__PURE__ */ jsx10(
1172
1260
  "button",
1173
1261
  {
1174
1262
  type: "button",
@@ -1186,15 +1274,15 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1186
1274
  },
1187
1275
  i
1188
1276
  )),
1189
- /* @__PURE__ */ jsx9("button", { type: "button", className: button, "aria-label": "Add swatch", onClick: () => attempt(() => controller.addSwatch(state.paint)), children: "+" })
1277
+ /* @__PURE__ */ jsx10("button", { type: "button", className: button, "aria-label": "Add swatch", onClick: () => attempt(() => controller.addSwatch(state.paint)), children: "+" })
1190
1278
  ] }),
1191
- mixingPad && /* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-1", "data-testid": "mixing-pad", children: [
1192
- /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-1", children: [
1193
- /* @__PURE__ */ jsx9("span", { className: "text-slate-400", children: "Mixing pad" }),
1194
- ["paint", "knife", "pick"].map((t) => /* @__PURE__ */ jsx9("button", { type: "button", "aria-pressed": padTool === t, className: chip(padTool === t), onClick: () => setPadTool(t), children: t === "paint" ? "Paint" : t === "knife" ? "Knife" : "Pick" }, t)),
1195
- /* @__PURE__ */ jsx9("button", { type: "button", className: button, onClick: () => controller.clearMixingPad(), children: "Clear" })
1279
+ mixingPad && /* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-1", "data-testid": "mixing-pad", children: [
1280
+ /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1", children: [
1281
+ /* @__PURE__ */ jsx10("span", { className: "text-slate-400", children: "Mixing pad" }),
1282
+ ["paint", "knife", "pick"].map((t) => /* @__PURE__ */ jsx10("button", { type: "button", "aria-pressed": padTool === t, className: chip(padTool === t), onClick: () => setPadTool(t), children: t === "paint" ? "Paint" : t === "knife" ? "Knife" : "Pick" }, t)),
1283
+ /* @__PURE__ */ jsx10("button", { type: "button", className: button, onClick: () => controller.clearMixingPad(), children: "Clear" })
1196
1284
  ] }),
1197
- /* @__PURE__ */ jsx9(
1285
+ /* @__PURE__ */ jsx10(
1198
1286
  "div",
1199
1287
  {
1200
1288
  role: "application",
@@ -1215,20 +1303,20 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1215
1303
  padPoints.current = null;
1216
1304
  if (pts?.length) attempt(() => controller.mixingPadStroke(pts, { tool: padTool === "knife" ? "knife" : "paint" }));
1217
1305
  },
1218
- children: /* @__PURE__ */ jsx9(PixelCanvas, { pixels: pad, label: "Mixing pad pixels", className: "w-full rounded", style: { aspectRatio: `${MIXING_PAD_WIDTH} / ${MIXING_PAD_HEIGHT}` } })
1306
+ children: /* @__PURE__ */ jsx10(PixelCanvas, { pixels: pad, label: "Mixing pad pixels", className: "w-full rounded", style: { aspectRatio: `${MIXING_PAD_WIDTH} / ${MIXING_PAD_HEIGHT}` } })
1219
1307
  }
1220
1308
  ),
1221
- /* @__PURE__ */ jsx9("div", { className: "flex flex-wrap items-center gap-1", children: /* @__PURE__ */ jsxs8("label", { className: "flex items-center gap-1", children: [
1222
- /* @__PURE__ */ jsx9("span", { className: "text-slate-400", children: "Sample" }),
1223
- /* @__PURE__ */ jsx9("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: PAD_SAMPLE_SIZES.map((n) => /* @__PURE__ */ jsx9("option", { value: n, children: n === 1 ? "1 px" : `${n}\xD7${n}` }, n)) })
1309
+ /* @__PURE__ */ jsx10("div", { className: "flex flex-wrap items-center gap-1", children: /* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-1", children: [
1310
+ /* @__PURE__ */ jsx10("span", { className: "text-slate-400", children: "Sample" }),
1311
+ /* @__PURE__ */ jsx10("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: PAD_SAMPLE_SIZES.map((n) => /* @__PURE__ */ jsx10("option", { value: n, children: n === 1 ? "1 px" : `${n}\xD7${n}` }, n)) })
1224
1312
  ] }) }),
1225
- /* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap items-center gap-1", children: [
1226
- /* @__PURE__ */ jsx9("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: color } }),
1227
- /* @__PURE__ */ jsx9("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" }),
1228
- /* @__PURE__ */ jsx9("span", { className: "text-slate-500", children: ":" }),
1229
- /* @__PURE__ */ jsx9("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" }),
1230
- /* @__PURE__ */ jsx9("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: state.secondaryColor } }),
1231
- /* @__PURE__ */ jsx9(
1313
+ /* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap items-center gap-1", children: [
1314
+ /* @__PURE__ */ jsx10("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: color } }),
1315
+ /* @__PURE__ */ jsx10("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" }),
1316
+ /* @__PURE__ */ jsx10("span", { className: "text-slate-500", children: ":" }),
1317
+ /* @__PURE__ */ jsx10("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" }),
1318
+ /* @__PURE__ */ jsx10("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: state.secondaryColor } }),
1319
+ /* @__PURE__ */ jsx10(
1232
1320
  "button",
1233
1321
  {
1234
1322
  type: "button",
@@ -1247,23 +1335,23 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1247
1335
  }
1248
1336
  )
1249
1337
  ] }),
1250
- /* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap items-center gap-1", children: [
1251
- /* @__PURE__ */ jsx9("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" }),
1252
- /* @__PURE__ */ jsx9("button", { type: "button", className: button, onClick: () => attempt(() => (controller.saveMixingPad(padName || void 0), setPadName(""))), children: "Keep pad" })
1338
+ /* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap items-center gap-1", children: [
1339
+ /* @__PURE__ */ jsx10("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" }),
1340
+ /* @__PURE__ */ jsx10("button", { type: "button", className: button, onClick: () => attempt(() => (controller.saveMixingPad(padName || void 0), setPadName(""))), children: "Keep pad" })
1253
1341
  ] }),
1254
- state.savedMixingPads.length > 0 && /* @__PURE__ */ jsx9("ul", { className: "flex flex-col gap-0.5", "aria-label": "Kept pads", children: state.savedMixingPads.map((p) => /* @__PURE__ */ jsxs8("li", { className: "flex items-center gap-1", children: [
1255
- /* @__PURE__ */ jsx9("button", { type: "button", className: `${button} flex-1 text-left`, onClick: () => attempt(() => controller.loadMixingPad(p.id)), children: p.name }),
1256
- /* @__PURE__ */ jsx9("button", { type: "button", className: button, "aria-label": `Remove ${p.name}`, onClick: () => attempt(() => controller.removeMixingPad(p.id)), children: "\xD7" })
1342
+ state.savedMixingPads.length > 0 && /* @__PURE__ */ jsx10("ul", { className: "flex flex-col gap-0.5", "aria-label": "Kept pads", children: state.savedMixingPads.map((p) => /* @__PURE__ */ jsxs9("li", { className: "flex items-center gap-1", children: [
1343
+ /* @__PURE__ */ jsx10("button", { type: "button", className: `${button} flex-1 text-left`, onClick: () => attempt(() => controller.loadMixingPad(p.id)), children: p.name }),
1344
+ /* @__PURE__ */ jsx10("button", { type: "button", className: button, "aria-label": `Remove ${p.name}`, onClick: () => attempt(() => controller.removeMixingPad(p.id)), children: "\xD7" })
1257
1345
  ] }, p.id)) })
1258
1346
  ] }),
1259
- /* @__PURE__ */ jsx9(ErrorLine, { error })
1347
+ /* @__PURE__ */ jsx10(ErrorLine, { error })
1260
1348
  ] });
1261
1349
  };
1262
1350
 
1263
1351
  // src/paint-editor/PaintLayersPanel.tsx
1264
1352
  import { useState as useState7 } from "react";
1265
1353
  import { BLEND_MENU_GROUPS } from "@pixerate/editor/paint-editor";
1266
- import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
1354
+ import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
1267
1355
  function siblingIndex(layers, l) {
1268
1356
  const sibs = layers.filter((x) => x.parentId === l.parentId).reverse();
1269
1357
  return { index: sibs.findIndex((x) => x.id === l.id), count: sibs.length };
@@ -1281,18 +1369,18 @@ var PaintLayersPanel = ({ controller, className }) => {
1281
1369
  const to = Math.min(count - 1, Math.max(0, index + delta));
1282
1370
  if (to !== index) attempt(() => controller.moveLayer(active.id, to));
1283
1371
  };
1284
- return /* @__PURE__ */ jsxs9("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-layers-panel", children: [
1285
- /* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap gap-1", children: [
1286
- /* @__PURE__ */ jsx10("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer()), children: "New layer" }),
1287
- /* @__PURE__ */ jsx10("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer({ type: "group" })), children: "New group" }),
1288
- /* @__PURE__ */ jsx10("button", { type: "button", className: button, title: "A layer whose strokes stay editable", onClick: () => attempt(() => controller.addLayer({ type: "strokes" })), children: "New stroke layer" }),
1289
- /* @__PURE__ */ jsx10("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.duplicateLayer(active.id)), children: "Duplicate" }),
1290
- /* @__PURE__ */ jsx10("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer up", onClick: () => move(1), children: "\u2191" }),
1291
- /* @__PURE__ */ jsx10("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer down", onClick: () => move(-1), children: "\u2193" }),
1292
- /* @__PURE__ */ jsx10("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.mergeDown(active.id)), children: "Merge down" }),
1293
- /* @__PURE__ */ jsx10("button", { type: "button", className: button, disabled: !active || layers.length < 2, onClick: () => active && attempt(() => controller.removeLayer(active.id)), children: "Delete" })
1372
+ return /* @__PURE__ */ jsxs10("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-layers-panel", children: [
1373
+ /* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap gap-1", children: [
1374
+ /* @__PURE__ */ jsx11("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer()), children: "New layer" }),
1375
+ /* @__PURE__ */ jsx11("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer({ type: "group" })), children: "New group" }),
1376
+ /* @__PURE__ */ jsx11("button", { type: "button", className: button, title: "A layer whose strokes stay editable", onClick: () => attempt(() => controller.addLayer({ type: "strokes" })), children: "New stroke layer" }),
1377
+ /* @__PURE__ */ jsx11("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.duplicateLayer(active.id)), children: "Duplicate" }),
1378
+ /* @__PURE__ */ jsx11("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer up", onClick: () => move(1), children: "\u2191" }),
1379
+ /* @__PURE__ */ jsx11("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer down", onClick: () => move(-1), children: "\u2193" }),
1380
+ /* @__PURE__ */ jsx11("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.mergeDown(active.id)), children: "Merge down" }),
1381
+ /* @__PURE__ */ jsx11("button", { type: "button", className: button, disabled: !active || layers.length < 2, onClick: () => active && attempt(() => controller.removeLayer(active.id)), children: "Delete" })
1294
1382
  ] }),
1295
- /* @__PURE__ */ jsx10("ul", { role: "tree", "aria-label": "Layers", className: "flex flex-col gap-0.5", children: layers.map((l) => /* @__PURE__ */ jsxs9(
1383
+ /* @__PURE__ */ jsx11("ul", { role: "tree", "aria-label": "Layers", className: "flex flex-col gap-0.5", children: layers.map((l) => /* @__PURE__ */ jsxs10(
1296
1384
  "li",
1297
1385
  {
1298
1386
  role: "treeitem",
@@ -1301,7 +1389,7 @@ var PaintLayersPanel = ({ controller, className }) => {
1301
1389
  style: { paddingLeft: 6 + l.depth * 12 },
1302
1390
  onClick: () => controller.setActiveLayer(l.id),
1303
1391
  children: [
1304
- /* @__PURE__ */ jsx10(
1392
+ /* @__PURE__ */ jsx11(
1305
1393
  "button",
1306
1394
  {
1307
1395
  type: "button",
@@ -1314,7 +1402,7 @@ var PaintLayersPanel = ({ controller, className }) => {
1314
1402
  children: l.visible ? "\u25CF" : "\u25CB"
1315
1403
  }
1316
1404
  ),
1317
- renaming === l.id ? /* @__PURE__ */ jsx10(
1405
+ renaming === l.id ? /* @__PURE__ */ jsx11(
1318
1406
  "input",
1319
1407
  {
1320
1408
  autoFocus: true,
@@ -1331,23 +1419,23 @@ var PaintLayersPanel = ({ controller, className }) => {
1331
1419
  if (e.key === "Escape") setRenaming(null);
1332
1420
  }
1333
1421
  }
1334
- ) : /* @__PURE__ */ jsxs9("span", { className: "flex-1 truncate", onDoubleClick: () => setRenaming(l.id), children: [
1422
+ ) : /* @__PURE__ */ jsxs10("span", { className: "flex-1 truncate", onDoubleClick: () => setRenaming(l.id), children: [
1335
1423
  l.type === "group" ? "\u25B8 " : "",
1336
- l.liveStrokes !== void 0 && /* @__PURE__ */ jsxs9("span", { "aria-label": "Stroke layer", title: `Stroke layer: ${l.liveStrokes} editable strokes`, children: [
1424
+ l.liveStrokes !== void 0 && /* @__PURE__ */ jsxs10("span", { "aria-label": "Stroke layer", title: `Stroke layer: ${l.liveStrokes} editable strokes`, children: [
1337
1425
  "\u270E",
1338
1426
  " "
1339
1427
  ] }),
1340
1428
  l.name
1341
1429
  ] }),
1342
- l.locks.pixels || l.locks.all ? /* @__PURE__ */ jsx10("span", { title: "Locked", children: "\u{1F512}" }) : null
1430
+ l.locks.pixels || l.locks.all ? /* @__PURE__ */ jsx11("span", { title: "Locked", children: "\u{1F512}" }) : null
1343
1431
  ]
1344
1432
  },
1345
1433
  l.id
1346
1434
  )) }),
1347
- active && /* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-1.5", children: [
1348
- /* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-2", children: [
1349
- /* @__PURE__ */ jsx10("span", { className: "w-14 text-slate-400", children: "Opacity" }),
1350
- /* @__PURE__ */ jsx10(
1435
+ active && /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-1.5", children: [
1436
+ /* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-2", children: [
1437
+ /* @__PURE__ */ jsx11("span", { className: "w-14 text-slate-400", children: "Opacity" }),
1438
+ /* @__PURE__ */ jsx11(
1351
1439
  "input",
1352
1440
  {
1353
1441
  type: "range",
@@ -1361,40 +1449,40 @@ var PaintLayersPanel = ({ controller, className }) => {
1361
1449
  }
1362
1450
  )
1363
1451
  ] }),
1364
- /* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-2", children: [
1365
- /* @__PURE__ */ jsx10("span", { className: "w-14 text-slate-400", children: "Blend" }),
1366
- /* @__PURE__ */ jsxs9("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: [
1367
- active.type === "group" && /* @__PURE__ */ jsx10("option", { value: "pass-through", children: "Pass through" }),
1368
- BLEND_MENU_GROUPS.map((g) => /* @__PURE__ */ jsx10("optgroup", { label: g.label, children: g.modes.map((m) => /* @__PURE__ */ jsx10("option", { value: m.id, title: m.description, children: m.label }, m.id)) }, g.label))
1452
+ /* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-2", children: [
1453
+ /* @__PURE__ */ jsx11("span", { className: "w-14 text-slate-400", children: "Blend" }),
1454
+ /* @__PURE__ */ jsxs10("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: [
1455
+ active.type === "group" && /* @__PURE__ */ jsx11("option", { value: "pass-through", children: "Pass through" }),
1456
+ BLEND_MENU_GROUPS.map((g) => /* @__PURE__ */ jsx11("optgroup", { label: g.label, children: g.modes.map((m) => /* @__PURE__ */ jsx11("option", { value: m.id, title: m.description, children: m.label }, m.id)) }, g.label))
1369
1457
  ] })
1370
1458
  ] }),
1371
- /* @__PURE__ */ jsxs9("div", { className: "flex gap-1", children: [
1372
- ["pixels", "transparency"].map((k) => /* @__PURE__ */ jsx10("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)),
1373
- /* @__PURE__ */ jsx10("button", { type: "button", "aria-pressed": active.clipped, className: chip(active.clipped), onClick: () => attempt(() => controller.updateLayer(active.id, { clipped: !active.clipped })), children: "Clip" })
1459
+ /* @__PURE__ */ jsxs10("div", { className: "flex gap-1", children: [
1460
+ ["pixels", "transparency"].map((k) => /* @__PURE__ */ jsx11("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)),
1461
+ /* @__PURE__ */ jsx11("button", { type: "button", "aria-pressed": active.clipped, className: chip(active.clipped), onClick: () => attempt(() => controller.updateLayer(active.id, { clipped: !active.clipped })), children: "Clip" })
1374
1462
  ] }),
1375
- light?.hasLight && /* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-1.5 border-t border-slate-800 pt-1.5", "data-testid": "layer-light", children: [
1376
- /* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-between", children: [
1377
- /* @__PURE__ */ jsx10("span", { className: "font-medium text-slate-300", title: "This layer's paint gives off light", children: "Light" }),
1378
- /* @__PURE__ */ jsx10("button", { type: "button", className: button, onClick: () => attempt(() => controller.clearLight(active.id)), children: "Clear light" })
1463
+ light?.hasLight && /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-1.5 border-t border-slate-800 pt-1.5", "data-testid": "layer-light", children: [
1464
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between", children: [
1465
+ /* @__PURE__ */ jsx11("span", { className: "font-medium text-slate-300", title: "This layer's paint gives off light", children: "Light" }),
1466
+ /* @__PURE__ */ jsx11("button", { type: "button", className: button, onClick: () => attempt(() => controller.clearLight(active.id)), children: "Clear light" })
1379
1467
  ] }),
1380
- /* @__PURE__ */ jsxs9("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: [
1381
- /* @__PURE__ */ jsx10("span", { className: "w-14 text-slate-400", children: "Spill" }),
1382
- /* @__PURE__ */ jsx10("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" })
1468
+ /* @__PURE__ */ jsxs10("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: [
1469
+ /* @__PURE__ */ jsx11("span", { className: "w-14 text-slate-400", children: "Spill" }),
1470
+ /* @__PURE__ */ jsx11("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" })
1383
1471
  ] }),
1384
- /* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-2", children: [
1385
- /* @__PURE__ */ jsx10("span", { className: "w-14 text-slate-400", children: "Strength" }),
1386
- /* @__PURE__ */ jsx10("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" })
1472
+ /* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-2", children: [
1473
+ /* @__PURE__ */ jsx11("span", { className: "w-14 text-slate-400", children: "Strength" }),
1474
+ /* @__PURE__ */ jsx11("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" })
1387
1475
  ] })
1388
1476
  ] }),
1389
- /* @__PURE__ */ jsx10("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__ */ jsx10(LayerEffectsPanel, { controller, layerId: active.id }) })
1477
+ /* @__PURE__ */ jsx11("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__ */ jsx11(LayerEffectsPanel, { controller, layerId: active.id }) })
1390
1478
  ] }),
1391
- /* @__PURE__ */ jsx10(ErrorLine, { error })
1479
+ /* @__PURE__ */ jsx11(ErrorLine, { error })
1392
1480
  ] });
1393
1481
  };
1394
1482
 
1395
1483
  // src/paint-editor/WetPanel.tsx
1396
- import { LIVE_PATTERN_KINDS, LIVE_PATTERN_LABELS, LIVE_PATTERN_SLIDERS, WET_FLOW_KINDS, WET_GPU_OPTIONS, WET_PARAM_SLIDERS, WET_SPEED_SLIDER, WET_TILT_SLIDERS, readPath as readPath4, wetEngineSummary } from "@pixerate/editor/paint-editor";
1397
- import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
1484
+ import { LIVE_PATTERN_KINDS, LIVE_PATTERN_LABELS, LIVE_PATTERN_SLIDERS, WET_FLOW_KINDS, WET_GPU_OPTIONS, WET_PARAM_SLIDERS, WET_SPEED_SLIDER, WET_TILT_SLIDERS, readPath as readPath5, wetEngineSummary } from "@pixerate/editor/paint-editor";
1485
+ import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
1398
1486
  var FLOW_LABELS = { none: "None", linear: "One way", swirl: "Swirl", radial: "Outwards", turbulent: "Eddies" };
1399
1487
  var WetPanel = ({ controller, className }) => {
1400
1488
  const state = usePaintEditorState(controller);
@@ -1404,31 +1492,31 @@ var WetPanel = ({ controller, className }) => {
1404
1492
  const info = layerId ? controller.wetLayerInfo(layerId) : null;
1405
1493
  const livePattern = layerId ? controller.getLivePatterns(layerId).layers[0] ?? null : null;
1406
1494
  const backend = controller.wetState();
1407
- return /* @__PURE__ */ jsxs10("div", { className: `${panel} ${className ?? ""}`, "data-testid": "wet-panel", children: [
1408
- /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between", children: [
1409
- /* @__PURE__ */ jsx11("span", { className: wet.wet ? "text-sky-300" : "text-slate-400", "data-testid": "wet-status", children: wet.wet ? wet.paused ? "Wet (paused)" : "Wet" : "Dry" }),
1410
- /* @__PURE__ */ jsxs10("span", { className: "text-[10px] text-slate-500", children: [
1495
+ return /* @__PURE__ */ jsxs11("div", { className: `${panel} ${className ?? ""}`, "data-testid": "wet-panel", children: [
1496
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between", children: [
1497
+ /* @__PURE__ */ jsx12("span", { className: wet.wet ? "text-sky-300" : "text-slate-400", "data-testid": "wet-status", children: wet.wet ? wet.paused ? "Wet (paused)" : "Wet" : "Dry" }),
1498
+ /* @__PURE__ */ jsxs11("span", { className: "text-[10px] text-slate-500", children: [
1411
1499
  "step ",
1412
1500
  wet.clock
1413
1501
  ] })
1414
1502
  ] }),
1415
- /* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap gap-1", children: [
1416
- /* @__PURE__ */ jsx11("button", { type: "button", className: button, disabled: !wet.layerIds.length, onClick: () => attempt(async () => (await controller.wetIdle(), controller.dryPaint())), children: "Dry now" }),
1417
- /* @__PURE__ */ jsx11("button", { type: "button", className: chip(wet.paused), "aria-pressed": wet.paused, onClick: () => controller.setWetPaused(!wet.paused), children: wet.paused ? "Resume" : "Pause" }),
1418
- /* @__PURE__ */ jsx11("button", { type: "button", className: chip(wet.overlay), "aria-pressed": wet.overlay, onClick: () => controller.setWaterOverlay(!wet.overlay), children: "Water" }),
1419
- /* @__PURE__ */ jsx11("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" }),
1420
- /* @__PURE__ */ jsx11("button", { type: "button", className: button, disabled: !layerId, onClick: () => attempt(async () => (await controller.wetIdle(), controller.wetPaper({}))), children: "Wet paper" })
1503
+ /* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap gap-1", children: [
1504
+ /* @__PURE__ */ jsx12("button", { type: "button", className: button, disabled: !wet.layerIds.length, onClick: () => attempt(async () => (await controller.wetIdle(), controller.dryPaint())), children: "Dry now" }),
1505
+ /* @__PURE__ */ jsx12("button", { type: "button", className: chip(wet.paused), "aria-pressed": wet.paused, onClick: () => controller.setWetPaused(!wet.paused), children: wet.paused ? "Resume" : "Pause" }),
1506
+ /* @__PURE__ */ jsx12("button", { type: "button", className: chip(wet.overlay), "aria-pressed": wet.overlay, onClick: () => controller.setWaterOverlay(!wet.overlay), children: "Water" }),
1507
+ /* @__PURE__ */ jsx12("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" }),
1508
+ /* @__PURE__ */ jsx12("button", { type: "button", className: button, disabled: !layerId, onClick: () => attempt(async () => (await controller.wetIdle(), controller.wetPaper({}))), children: "Wet paper" })
1421
1509
  ] }),
1422
- /* @__PURE__ */ jsx11(PaintSlider, { control: WET_SPEED_SLIDER, value: wet.speed, onChange: (v) => controller.setWetSpeed(v) }),
1423
- WET_TILT_SLIDERS.map((c) => /* @__PURE__ */ jsx11(PaintSlider, { control: c, value: readPath4(wet.tilt, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setCanvasTilt({ [c.path]: v }))) }, c.path)),
1424
- info && /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-layer", children: [
1425
- /* @__PURE__ */ jsx11("span", { className: "font-medium text-slate-300", children: "This layer" }),
1426
- WET_PARAM_SLIDERS.map((c) => /* @__PURE__ */ jsx11(PaintSlider, { control: c, value: readPath4(info.params, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setWetParams(layerId, { [c.path]: v }))) }, c.path)),
1427
- /* @__PURE__ */ jsxs10("label", { className: "flex items-center justify-between gap-2", children: [
1428
- /* @__PURE__ */ jsx11("span", { className: "text-slate-400", children: "Flow map" }),
1429
- /* @__PURE__ */ jsx11("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: WET_FLOW_KINDS.map((k) => /* @__PURE__ */ jsx11("option", { value: k, children: FLOW_LABELS[k] }, k)) })
1510
+ /* @__PURE__ */ jsx12(PaintSlider, { control: WET_SPEED_SLIDER, value: wet.speed, onChange: (v) => controller.setWetSpeed(v) }),
1511
+ WET_TILT_SLIDERS.map((c) => /* @__PURE__ */ jsx12(PaintSlider, { control: c, value: readPath5(wet.tilt, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setCanvasTilt({ [c.path]: v }))) }, c.path)),
1512
+ info && /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-layer", children: [
1513
+ /* @__PURE__ */ jsx12("span", { className: "font-medium text-slate-300", children: "This layer" }),
1514
+ WET_PARAM_SLIDERS.map((c) => /* @__PURE__ */ jsx12(PaintSlider, { control: c, value: readPath5(info.params, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setWetParams(layerId, { [c.path]: v }))) }, c.path)),
1515
+ /* @__PURE__ */ jsxs11("label", { className: "flex items-center justify-between gap-2", children: [
1516
+ /* @__PURE__ */ jsx12("span", { className: "text-slate-400", children: "Flow map" }),
1517
+ /* @__PURE__ */ jsx12("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: WET_FLOW_KINDS.map((k) => /* @__PURE__ */ jsx12("option", { value: k, children: FLOW_LABELS[k] }, k)) })
1430
1518
  ] }),
1431
- info.flow.kind !== "none" && /* @__PURE__ */ jsx11(
1519
+ info.flow.kind !== "none" && /* @__PURE__ */ jsx12(
1432
1520
  PaintSlider,
1433
1521
  {
1434
1522
  control: { path: "strength", label: "Flow strength", min: 0, max: 1, step: 0.01 },
@@ -1437,10 +1525,10 @@ var WetPanel = ({ controller, className }) => {
1437
1525
  }
1438
1526
  )
1439
1527
  ] }),
1440
- livePattern && layerId && /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-live-patterns", children: [
1441
- /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between", children: [
1442
- /* @__PURE__ */ jsx11("span", { className: "font-medium text-slate-300", children: "Live patterns" }),
1443
- /* @__PURE__ */ jsx11(
1528
+ livePattern && layerId && /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-live-patterns", children: [
1529
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between", children: [
1530
+ /* @__PURE__ */ jsx12("span", { className: "font-medium text-slate-300", children: "Live patterns" }),
1531
+ /* @__PURE__ */ jsx12(
1444
1532
  "button",
1445
1533
  {
1446
1534
  type: "button",
@@ -1455,35 +1543,35 @@ var WetPanel = ({ controller, className }) => {
1455
1543
  }
1456
1544
  )
1457
1545
  ] }),
1458
- /* @__PURE__ */ jsxs10("label", { className: "flex items-center justify-between gap-2", children: [
1459
- /* @__PURE__ */ jsx11("span", { className: "text-slate-400", children: "Pattern" }),
1460
- /* @__PURE__ */ jsx11(
1546
+ /* @__PURE__ */ jsxs11("label", { className: "flex items-center justify-between gap-2", children: [
1547
+ /* @__PURE__ */ jsx12("span", { className: "text-slate-400", children: "Pattern" }),
1548
+ /* @__PURE__ */ jsx12(
1461
1549
  "select",
1462
1550
  {
1463
1551
  "aria-label": "Live pattern",
1464
1552
  value: livePattern.settings.pattern,
1465
1553
  onChange: (e) => attempt(async () => (await controller.wetIdle(), controller.setLivePatterns(layerId, { pattern: e.target.value }))),
1466
1554
  className: "rounded bg-slate-800 px-1 py-0.5",
1467
- children: LIVE_PATTERN_KINDS.map((k) => /* @__PURE__ */ jsx11("option", { value: k, children: LIVE_PATTERN_LABELS[k] }, k))
1555
+ children: LIVE_PATTERN_KINDS.map((k) => /* @__PURE__ */ jsx12("option", { value: k, children: LIVE_PATTERN_LABELS[k] }, k))
1468
1556
  }
1469
1557
  )
1470
1558
  ] }),
1471
- LIVE_PATTERN_SLIDERS.map((c) => /* @__PURE__ */ jsx11(PaintSlider, { control: c, value: readPath4(livePattern.settings, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setLivePatterns(layerId, { [c.path]: v }))) }, c.path))
1559
+ LIVE_PATTERN_SLIDERS.map((c) => /* @__PURE__ */ jsx12(PaintSlider, { control: c, value: readPath5(livePattern.settings, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setLivePatterns(layerId, { [c.path]: v }))) }, c.path))
1472
1560
  ] }),
1473
- backend.message && /* @__PURE__ */ jsx11("p", { className: "text-[10px] text-amber-300", "data-testid": "wet-message", children: backend.message }),
1474
- backend.backend && /* @__PURE__ */ jsx11("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" }),
1475
- /* @__PURE__ */ jsxs10("label", { className: "flex items-center justify-between gap-2", children: [
1476
- /* @__PURE__ */ jsx11("span", { className: "text-slate-400", children: "Engine" }),
1477
- /* @__PURE__ */ jsx11("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: WET_GPU_OPTIONS.map((o) => /* @__PURE__ */ jsx11("option", { value: o.value, children: o.label }, o.value)) })
1561
+ backend.message && /* @__PURE__ */ jsx12("p", { className: "text-[10px] text-amber-300", "data-testid": "wet-message", children: backend.message }),
1562
+ backend.backend && /* @__PURE__ */ jsx12("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" }),
1563
+ /* @__PURE__ */ jsxs11("label", { className: "flex items-center justify-between gap-2", children: [
1564
+ /* @__PURE__ */ jsx12("span", { className: "text-slate-400", children: "Engine" }),
1565
+ /* @__PURE__ */ jsx12("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: WET_GPU_OPTIONS.map((o) => /* @__PURE__ */ jsx12("option", { value: o.value, children: o.label }, o.value)) })
1478
1566
  ] }),
1479
- /* @__PURE__ */ jsx11("p", { className: `text-[10px] ${backend.engine.state === "active" ? "text-emerald-300" : "text-slate-500"}`, "data-testid": "wet-engine", children: wetEngineSummary(backend.engine) }),
1480
- /* @__PURE__ */ jsx11(ErrorLine, { error })
1567
+ /* @__PURE__ */ jsx12("p", { className: `text-[10px] ${backend.engine.state === "active" ? "text-emerald-300" : "text-slate-500"}`, "data-testid": "wet-engine", children: wetEngineSummary(backend.engine) }),
1568
+ /* @__PURE__ */ jsx12(ErrorLine, { error })
1481
1569
  ] });
1482
1570
  };
1483
1571
 
1484
1572
  // src/paint-editor/StickerPanel.tsx
1485
- import { STICKER_SLIDERS, readPath as readPath5, stickerRefLabel } from "@pixerate/editor/paint-editor";
1486
- import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
1573
+ import { STICKER_SLIDERS, readPath as readPath6, stickerRefLabel } from "@pixerate/editor/paint-editor";
1574
+ import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
1487
1575
  var StickerPanel = ({ controller, className }) => {
1488
1576
  const state = usePaintEditorState(controller);
1489
1577
  const [error, attempt] = useAttempt();
@@ -1493,16 +1581,16 @@ var StickerPanel = ({ controller, className }) => {
1493
1581
  const stickers = layerId ? state.document.stickers?.[layerId] ?? [] : [];
1494
1582
  if (!stickers.length) return null;
1495
1583
  const sel = stickers.find((s) => s.id === picked) ?? null;
1496
- return /* @__PURE__ */ jsxs11("div", { className: `${panel} ${className ?? ""}`, "data-testid": "sticker-panel", children: [
1497
- /* @__PURE__ */ jsxs11("span", { className: "font-medium text-slate-300", children: [
1584
+ return /* @__PURE__ */ jsxs12("div", { className: `${panel} ${className ?? ""}`, "data-testid": "sticker-panel", children: [
1585
+ /* @__PURE__ */ jsxs12("span", { className: "font-medium text-slate-300", children: [
1498
1586
  "Stickers (",
1499
1587
  stickers.length,
1500
1588
  ")"
1501
1589
  ] }),
1502
- /* @__PURE__ */ jsx12("div", { className: "flex max-h-24 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Stickers", children: stickers.map((s) => /* @__PURE__ */ jsx12("button", { type: "button", role: "option", "aria-selected": s.id === picked, title: `${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)) }),
1503
- sel && /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-1.5", "data-testid": "sticker-edit", children: [
1504
- /* @__PURE__ */ jsx12("span", { className: "text-slate-400", children: "Sticker" }),
1505
- /* @__PURE__ */ jsx12(
1590
+ /* @__PURE__ */ jsx13("div", { className: "flex max-h-24 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Stickers", children: stickers.map((s) => /* @__PURE__ */ jsx13("button", { type: "button", role: "option", "aria-selected": s.id === picked, title: `${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)) }),
1591
+ sel && /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-1.5", "data-testid": "sticker-edit", children: [
1592
+ /* @__PURE__ */ jsx13("span", { className: "text-slate-400", children: "Sticker" }),
1593
+ /* @__PURE__ */ jsx13(
1506
1594
  StickerPicker,
1507
1595
  {
1508
1596
  controller,
@@ -1516,9 +1604,9 @@ var StickerPanel = ({ controller, className }) => {
1516
1604
  )
1517
1605
  }
1518
1606
  ),
1519
- /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between gap-2", children: [
1520
- /* @__PURE__ */ jsx12("span", { className: "text-slate-400", children: "Position" }),
1521
- /* @__PURE__ */ jsx12("span", { className: "flex gap-1", children: ["x", "y"].map((k) => /* @__PURE__ */ jsx12(
1607
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-center justify-between gap-2", children: [
1608
+ /* @__PURE__ */ jsx13("span", { className: "text-slate-400", children: "Position" }),
1609
+ /* @__PURE__ */ jsx13("span", { className: "flex gap-1", children: ["x", "y"].map((k) => /* @__PURE__ */ jsx13(
1522
1610
  "input",
1523
1611
  {
1524
1612
  type: "number",
@@ -1532,24 +1620,24 @@ var StickerPanel = ({ controller, className }) => {
1532
1620
  `${sel.id}-${k}-${sel[k]}`
1533
1621
  )) })
1534
1622
  ] }),
1535
- STICKER_SLIDERS.map((c) => /* @__PURE__ */ jsx12(PaintSlider, { control: c, value: readPath5(sel, c.path), onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { [c.path]: v })) }, c.path)),
1536
- /* @__PURE__ */ jsxs11("label", { className: "flex items-center justify-between", children: [
1537
- /* @__PURE__ */ jsx12("span", { className: "text-slate-400", children: "Colour" }),
1538
- /* @__PURE__ */ jsx12(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" })
1623
+ STICKER_SLIDERS.map((c) => /* @__PURE__ */ jsx13(PaintSlider, { control: c, value: readPath6(sel, c.path), onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { [c.path]: v })) }, c.path)),
1624
+ /* @__PURE__ */ jsxs12("label", { className: "flex items-center justify-between", children: [
1625
+ /* @__PURE__ */ jsx13("span", { className: "text-slate-400", children: "Colour" }),
1626
+ /* @__PURE__ */ jsx13(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" })
1539
1627
  ] }),
1540
- /* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap gap-1", children: [
1541
- /* @__PURE__ */ jsx12("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "front")), children: "To front" }),
1542
- /* @__PURE__ */ jsx12("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "back")), children: "To back" }),
1543
- /* @__PURE__ */ jsx12("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStickers(layerId, [sel.id]), setPicked(null))), children: "Delete" })
1628
+ /* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap gap-1", children: [
1629
+ /* @__PURE__ */ jsx13("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "front")), children: "To front" }),
1630
+ /* @__PURE__ */ jsx13("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "back")), children: "To back" }),
1631
+ /* @__PURE__ */ jsx13("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStickers(layerId, [sel.id]), setPicked(null))), children: "Delete" })
1544
1632
  ] })
1545
1633
  ] }),
1546
- /* @__PURE__ */ jsx12(ErrorLine, { error })
1634
+ /* @__PURE__ */ jsx13(ErrorLine, { error })
1547
1635
  ] });
1548
1636
  };
1549
1637
 
1550
1638
  // src/paint-editor/StrokePanel.tsx
1551
- import { STROKE_SLIDERS, liveStrokeRefusal, readPath as readPath6 } from "@pixerate/editor/paint-editor";
1552
- import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
1639
+ import { STROKE_SLIDERS, liveStrokeRefusal, readPath as readPath7 } from "@pixerate/editor/paint-editor";
1640
+ import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
1553
1641
  var StrokePanel = ({ controller, className }) => {
1554
1642
  const state = usePaintEditorState(controller);
1555
1643
  const [error, attempt] = useAttempt();
@@ -1559,16 +1647,16 @@ var StrokePanel = ({ controller, className }) => {
1559
1647
  const index = strokes.findIndex((s) => s.id === state.selectedStroke);
1560
1648
  const sel = index >= 0 ? strokes[index] : null;
1561
1649
  const brushes = state.brushes.filter((b) => !liveStrokeRefusal(b));
1562
- return /* @__PURE__ */ jsxs12("div", { className: `${panel} ${className ?? ""}`, "data-testid": "stroke-panel", children: [
1563
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center justify-between", children: [
1564
- /* @__PURE__ */ jsxs12("span", { className: "font-medium text-slate-300", children: [
1650
+ return /* @__PURE__ */ jsxs13("div", { className: `${panel} ${className ?? ""}`, "data-testid": "stroke-panel", children: [
1651
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between", children: [
1652
+ /* @__PURE__ */ jsxs13("span", { className: "font-medium text-slate-300", children: [
1565
1653
  "Strokes (",
1566
1654
  strokes.length,
1567
1655
  ")"
1568
1656
  ] }),
1569
- /* @__PURE__ */ jsx13("button", { type: "button", className: button, onClick: () => attempt(() => controller.rasterizeLiveStrokes(layerId)), children: "Rasterize" })
1657
+ /* @__PURE__ */ jsx14("button", { type: "button", className: button, onClick: () => attempt(() => controller.rasterizeLiveStrokes(layerId)), children: "Rasterize" })
1570
1658
  ] }),
1571
- /* @__PURE__ */ jsx13("div", { className: "flex max-h-24 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Strokes", children: strokes.map((s, i) => /* @__PURE__ */ jsx13(
1659
+ /* @__PURE__ */ jsx14("div", { className: "flex max-h-24 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Strokes", children: strokes.map((s, i) => /* @__PURE__ */ jsx14(
1572
1660
  "button",
1573
1661
  {
1574
1662
  type: "button",
@@ -1581,10 +1669,10 @@ var StrokePanel = ({ controller, className }) => {
1581
1669
  },
1582
1670
  s.id
1583
1671
  )) }),
1584
- sel && /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-1.5", "data-testid": "stroke-edit", children: [
1585
- /* @__PURE__ */ jsxs12("label", { className: "flex items-center justify-between gap-2", children: [
1586
- /* @__PURE__ */ jsx13("span", { className: "text-slate-400", children: "Brush" }),
1587
- /* @__PURE__ */ jsxs12(
1672
+ sel && /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-1.5", "data-testid": "stroke-edit", children: [
1673
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center justify-between gap-2", children: [
1674
+ /* @__PURE__ */ jsx14("span", { className: "text-slate-400", children: "Brush" }),
1675
+ /* @__PURE__ */ jsxs13(
1588
1676
  "select",
1589
1677
  {
1590
1678
  "aria-label": "Stroke brush",
@@ -1592,41 +1680,41 @@ var StrokePanel = ({ controller, className }) => {
1592
1680
  onChange: (e) => e.target.value && attempt(() => controller.updateStroke(sel.id, { brushId: e.target.value })),
1593
1681
  className: "max-w-[10rem] rounded bg-slate-800 px-1 py-0.5",
1594
1682
  children: [
1595
- !brushes.some((b) => b.id === sel.brush.id) && /* @__PURE__ */ jsx13("option", { value: "", children: sel.brush.name }),
1596
- brushes.map((b) => /* @__PURE__ */ jsx13("option", { value: b.id, children: b.name }, b.id))
1683
+ !brushes.some((b) => b.id === sel.brush.id) && /* @__PURE__ */ jsx14("option", { value: "", children: sel.brush.name }),
1684
+ brushes.map((b) => /* @__PURE__ */ jsx14("option", { value: b.id, children: b.name }, b.id))
1597
1685
  ]
1598
1686
  }
1599
1687
  )
1600
1688
  ] }),
1601
- STROKE_SLIDERS.map((c) => /* @__PURE__ */ jsx13(PaintSlider, { control: c, value: readPath6(sel.brush, c.path), onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { brush: { tip: { [c.path.split(".")[1]]: v } } })) }, c.path)),
1602
- /* @__PURE__ */ jsxs12("label", { className: "flex items-center justify-between", children: [
1603
- /* @__PURE__ */ jsx13("span", { className: "text-slate-400", children: "Colour" }),
1604
- /* @__PURE__ */ jsx13(CommitColorInput, { label: "Stroke colour", value: sel.color, onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { color: v })), className: "h-6 w-10 rounded bg-transparent" })
1689
+ STROKE_SLIDERS.map((c) => /* @__PURE__ */ jsx14(PaintSlider, { control: c, value: readPath7(sel.brush, c.path), onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { brush: { tip: { [c.path.split(".")[1]]: v } } })) }, c.path)),
1690
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center justify-between", children: [
1691
+ /* @__PURE__ */ jsx14("span", { className: "text-slate-400", children: "Colour" }),
1692
+ /* @__PURE__ */ jsx14(CommitColorInput, { label: "Stroke colour", value: sel.color, onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { color: v })), className: "h-6 w-10 rounded bg-transparent" })
1605
1693
  ] }),
1606
- /* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap gap-1", children: [
1607
- /* @__PURE__ */ jsx13("button", { type: "button", className: button, onClick: () => attempt(() => controller.updateStroke(sel.id, { seed: (sel.seed + 1) % 2147483647 })), children: "New seed" }),
1608
- /* @__PURE__ */ jsx13("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" }),
1609
- /* @__PURE__ */ jsx13("button", { type: "button", className: button, disabled: index === 0, "aria-label": "Move stroke down", onClick: () => attempt(() => controller.reorderStroke(sel.id, index - 1)), children: "\u2193" }),
1610
- /* @__PURE__ */ jsx13("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStrokes([sel.id]), controller.selectStroke(null))), children: "Delete" })
1694
+ /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap gap-1", children: [
1695
+ /* @__PURE__ */ jsx14("button", { type: "button", className: button, onClick: () => attempt(() => controller.updateStroke(sel.id, { seed: (sel.seed + 1) % 2147483647 })), children: "New seed" }),
1696
+ /* @__PURE__ */ jsx14("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" }),
1697
+ /* @__PURE__ */ jsx14("button", { type: "button", className: button, disabled: index === 0, "aria-label": "Move stroke down", onClick: () => attempt(() => controller.reorderStroke(sel.id, index - 1)), children: "\u2193" }),
1698
+ /* @__PURE__ */ jsx14("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStrokes([sel.id]), controller.selectStroke(null))), children: "Delete" })
1611
1699
  ] })
1612
1700
  ] }),
1613
- /* @__PURE__ */ jsx13(ErrorLine, { error })
1701
+ /* @__PURE__ */ jsx14(ErrorLine, { error })
1614
1702
  ] });
1615
1703
  };
1616
1704
 
1617
1705
  // src/paint-editor/PathStrokePanel.tsx
1618
1706
  import { useState as useState8 } from "react";
1619
1707
  import { PATH_STROKE_TAPERS } from "@pixerate/editor/paint-editor";
1620
- import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
1708
+ import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
1621
1709
  var PathStrokePanel = ({ controller, className }) => {
1622
1710
  const state = usePaintEditorState(controller);
1623
1711
  const [error, attempt] = useAttempt();
1624
1712
  const [path, setPath] = useState8("");
1625
1713
  const [taper, setTaper] = useState8(PATH_STROKE_TAPERS[0].id);
1626
1714
  const pressure = PATH_STROKE_TAPERS.find((t) => t.id === taper)?.pressure;
1627
- return /* @__PURE__ */ jsxs13("div", { className: `${panel} ${className ?? ""}`, "data-testid": "path-stroke-panel", children: [
1628
- /* @__PURE__ */ jsx14("span", { className: "font-medium text-slate-300", children: "Brush a path" }),
1629
- /* @__PURE__ */ jsx14(
1715
+ return /* @__PURE__ */ jsxs14("div", { className: `${panel} ${className ?? ""}`, "data-testid": "path-stroke-panel", children: [
1716
+ /* @__PURE__ */ jsx15("span", { className: "font-medium text-slate-300", children: "Brush a path" }),
1717
+ /* @__PURE__ */ jsx15(
1630
1718
  "textarea",
1631
1719
  {
1632
1720
  "aria-label": "SVG path data",
@@ -1637,11 +1725,11 @@ var PathStrokePanel = ({ controller, className }) => {
1637
1725
  className: "w-full resize-y rounded bg-slate-800 px-1 py-0.5 font-mono text-[11px]"
1638
1726
  }
1639
1727
  ),
1640
- /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
1641
- /* @__PURE__ */ jsx14("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: PATH_STROKE_TAPERS.map((t) => /* @__PURE__ */ jsx14("option", { value: t.id, children: t.label }, t.id)) }),
1642
- /* @__PURE__ */ jsx14("button", { type: "button", className: button, disabled: !path.trim() || state.stroking, onClick: () => attempt(() => controller.strokePath({ path, ...pressure ? { pressure } : {} })), children: "Brush path" })
1728
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2", children: [
1729
+ /* @__PURE__ */ jsx15("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: PATH_STROKE_TAPERS.map((t) => /* @__PURE__ */ jsx15("option", { value: t.id, children: t.label }, t.id)) }),
1730
+ /* @__PURE__ */ jsx15("button", { type: "button", className: button, disabled: !path.trim() || state.stroking, onClick: () => attempt(() => controller.strokePath({ path, ...pressure ? { pressure } : {} })), children: "Brush path" })
1643
1731
  ] }),
1644
- /* @__PURE__ */ jsx14(ErrorLine, { error })
1732
+ /* @__PURE__ */ jsx15(ErrorLine, { error })
1645
1733
  ] });
1646
1734
  };
1647
1735
 
@@ -1655,7 +1743,7 @@ import {
1655
1743
  paintProposalGhost as paintProposalGhost2,
1656
1744
  proposalGenomeStrokes
1657
1745
  } from "@pixerate/editor/paint-editor";
1658
- import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
1746
+ import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
1659
1747
  var EvolutionPanel = ({ controller, proposals, className }) => {
1660
1748
  const state = usePaintEditorState(controller);
1661
1749
  const store = proposals ?? controller.proposals;
@@ -1678,16 +1766,16 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
1678
1766
  const toggleProposal = (id) => {
1679
1767
  setSelectedProposals((prev) => prev.includes(id) ? prev.filter((x) => x !== id) : [...prev.slice(-1), id]);
1680
1768
  };
1681
- return /* @__PURE__ */ jsxs14("div", { className: `${panel} ${className ?? ""}`, "data-testid": "evolution-panel", children: [
1682
- /* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between", children: [
1683
- /* @__PURE__ */ jsxs14("span", { className: "font-medium text-slate-300", children: [
1769
+ return /* @__PURE__ */ jsxs15("div", { className: `${panel} ${className ?? ""}`, "data-testid": "evolution-panel", children: [
1770
+ /* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-between", children: [
1771
+ /* @__PURE__ */ jsxs15("span", { className: "font-medium text-slate-300", children: [
1684
1772
  "Evolution (",
1685
1773
  eligibleStrokes.length,
1686
1774
  ")"
1687
1775
  ] }),
1688
- /* @__PURE__ */ jsx15("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-1 text-[11px] text-slate-400", children: [
1689
- /* @__PURE__ */ jsx15("span", { children: "Count" }),
1690
- /* @__PURE__ */ jsx15(
1776
+ /* @__PURE__ */ jsx16("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1 text-[11px] text-slate-400", children: [
1777
+ /* @__PURE__ */ jsx16("span", { children: "Count" }),
1778
+ /* @__PURE__ */ jsx16(
1691
1779
  "input",
1692
1780
  {
1693
1781
  type: "number",
@@ -1701,9 +1789,9 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
1701
1789
  )
1702
1790
  ] }) })
1703
1791
  ] }),
1704
- eligibleStrokes.length > 0 && /* @__PURE__ */ jsx15("div", { className: "flex max-h-20 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Parent strokes", children: eligibleStrokes.map((s, i) => {
1792
+ eligibleStrokes.length > 0 && /* @__PURE__ */ jsx16("div", { className: "flex max-h-20 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Parent strokes", children: eligibleStrokes.map((s, i) => {
1705
1793
  const on = effectiveStrokeIds.includes(s.id);
1706
- return /* @__PURE__ */ jsx15(
1794
+ return /* @__PURE__ */ jsx16(
1707
1795
  "button",
1708
1796
  {
1709
1797
  type: "button",
@@ -1719,7 +1807,7 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
1719
1807
  }) }),
1720
1808
  EVOLUTION_SLIDERS.map((c) => {
1721
1809
  const key = c.path;
1722
- return /* @__PURE__ */ jsx15(
1810
+ return /* @__PURE__ */ jsx16(
1723
1811
  PaintSlider,
1724
1812
  {
1725
1813
  control: c,
@@ -1729,8 +1817,8 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
1729
1817
  c.path
1730
1818
  );
1731
1819
  }),
1732
- /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap gap-1", children: [
1733
- /* @__PURE__ */ jsx15(
1820
+ /* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap gap-1", children: [
1821
+ /* @__PURE__ */ jsx16(
1734
1822
  "button",
1735
1823
  {
1736
1824
  type: "button",
@@ -1743,7 +1831,7 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
1743
1831
  children: "Breed strokes"
1744
1832
  }
1745
1833
  ),
1746
- activeProposalIds.length === 2 && /* @__PURE__ */ jsx15(
1834
+ activeProposalIds.length === 2 && /* @__PURE__ */ jsx16(
1747
1835
  "button",
1748
1836
  {
1749
1837
  type: "button",
@@ -1756,7 +1844,7 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
1756
1844
  children: "Cross over (2)"
1757
1845
  }
1758
1846
  ),
1759
- variants.length > 0 && /* @__PURE__ */ jsx15(
1847
+ variants.length > 0 && /* @__PURE__ */ jsx16(
1760
1848
  "button",
1761
1849
  {
1762
1850
  type: "button",
@@ -1769,16 +1857,16 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
1769
1857
  }
1770
1858
  )
1771
1859
  ] }),
1772
- variants.length > 0 && /* @__PURE__ */ jsx15("div", { className: "grid grid-cols-2 gap-1.5", "data-testid": "evolution-grid", children: variants.map((p) => {
1860
+ variants.length > 0 && /* @__PURE__ */ jsx16("div", { className: "grid grid-cols-2 gap-1.5", "data-testid": "evolution-grid", children: variants.map((p) => {
1773
1861
  const g = paintProposalGhost2(p);
1774
1862
  const picked = activeProposalIds.includes(p.id);
1775
- return /* @__PURE__ */ jsxs14(
1863
+ return /* @__PURE__ */ jsxs15(
1776
1864
  "div",
1777
1865
  {
1778
1866
  "data-testid": `evolution-variant-${p.id}`,
1779
1867
  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"}`,
1780
1868
  children: [
1781
- /* @__PURE__ */ jsx15("div", { className: "flex items-center justify-between gap-1", children: /* @__PURE__ */ jsx15(
1869
+ /* @__PURE__ */ jsx16("div", { className: "flex items-center justify-between gap-1", children: /* @__PURE__ */ jsx16(
1782
1870
  "button",
1783
1871
  {
1784
1872
  type: "button",
@@ -1788,10 +1876,10 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
1788
1876
  children: p.title
1789
1877
  }
1790
1878
  ) }),
1791
- g && /* @__PURE__ */ jsx15("div", { className: "flex h-16 items-center justify-center overflow-hidden rounded bg-slate-900/80 p-1", children: /* @__PURE__ */ jsx15(PixelCanvas, { pixels: g, label: p.title, className: "max-h-full max-w-full object-contain" }) }),
1792
- p.rationale && /* @__PURE__ */ jsx15("span", { className: "line-clamp-2 text-[10px] text-slate-400", title: p.rationale, children: p.rationale }),
1793
- /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap gap-1", children: [
1794
- /* @__PURE__ */ jsx15(
1879
+ g && /* @__PURE__ */ jsx16("div", { className: "flex h-16 items-center justify-center overflow-hidden rounded bg-slate-900/80 p-1", children: /* @__PURE__ */ jsx16(PixelCanvas, { pixels: g, label: p.title, className: "max-h-full max-w-full object-contain" }) }),
1880
+ p.rationale && /* @__PURE__ */ jsx16("span", { className: "line-clamp-2 text-[10px] text-slate-400", title: p.rationale, children: p.rationale }),
1881
+ /* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap gap-1", children: [
1882
+ /* @__PURE__ */ jsx16(
1795
1883
  "button",
1796
1884
  {
1797
1885
  type: "button",
@@ -1804,16 +1892,16 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
1804
1892
  children: "Breed from"
1805
1893
  }
1806
1894
  ),
1807
- /* @__PURE__ */ jsx15("button", { type: "button", className: button, onClick: () => attempt(() => store.accept(p.id)), children: "Accept" }),
1808
- /* @__PURE__ */ jsx15("button", { type: "button", className: button, onClick: () => attempt(() => store.reject(p.id)), children: "Dismiss" })
1895
+ /* @__PURE__ */ jsx16("button", { type: "button", className: button, onClick: () => attempt(() => store.accept(p.id)), children: "Accept" }),
1896
+ /* @__PURE__ */ jsx16("button", { type: "button", className: button, onClick: () => attempt(() => store.reject(p.id)), children: "Dismiss" })
1809
1897
  ] })
1810
1898
  ]
1811
1899
  },
1812
1900
  p.id
1813
1901
  );
1814
1902
  }) }),
1815
- contactSheetUrl && /* @__PURE__ */ jsx15("img", { src: contactSheetUrl, alt: "Variant contact sheet", className: "w-full rounded border border-slate-800", "data-testid": "evolution-contact-sheet" }),
1816
- /* @__PURE__ */ jsx15(ErrorLine, { error })
1903
+ contactSheetUrl && /* @__PURE__ */ jsx16("img", { src: contactSheetUrl, alt: "Variant contact sheet", className: "w-full rounded border border-slate-800", "data-testid": "evolution-contact-sheet" }),
1904
+ /* @__PURE__ */ jsx16(ErrorLine, { error })
1817
1905
  ] });
1818
1906
  };
1819
1907
 
@@ -1825,7 +1913,7 @@ import { PaintPresence as PaintPresence2, documentToScreen as documentToScreen2,
1825
1913
  import { useEffect as useEffect5, useMemo as useMemo7, useRef as useRef6, useState as useState10 } from "react";
1826
1914
  import { createPaintEffectsToolProvider, PAPER_EFFECT_BLENDS } from "@pixerate/editor/paint-editor";
1827
1915
  import { pathControlsOf } from "@pixerate/editor/effects";
1828
- import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
1916
+ import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
1829
1917
  function usePaintEffectsProvider(controller) {
1830
1918
  const [provider, setProvider] = useState10(controller.effectsProvider);
1831
1919
  useEffect5(() => {
@@ -1844,19 +1932,19 @@ function usePaintEffectsTools(registry, controller, options = {}) {
1844
1932
  function Controls({ provider, effect, name, values, apply }) {
1845
1933
  const { description, error } = useEffectDescription(provider, effect);
1846
1934
  const drags = useRef6(/* @__PURE__ */ new Set());
1847
- if (!provider) return /* @__PURE__ */ jsxs15("p", { className: "text-[11px] text-slate-400", children: [
1935
+ if (!provider) return /* @__PURE__ */ jsxs16("p", { className: "text-[11px] text-slate-400", children: [
1848
1936
  'No effects provider: "',
1849
1937
  name ?? effect,
1850
1938
  '" is kept as it was drawn.'
1851
1939
  ] });
1852
- if (error) return /* @__PURE__ */ jsx16("p", { className: "text-[11px] text-amber-400", children: error });
1853
- if (!description) return /* @__PURE__ */ jsx16("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
1940
+ if (error) return /* @__PURE__ */ jsx17("p", { className: "text-[11px] text-amber-400", children: error });
1941
+ if (!description) return /* @__PURE__ */ jsx17("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
1854
1942
  const commit = (gesture) => {
1855
1943
  if (!gesture || drags.current.has(gesture)) return !gesture;
1856
1944
  drags.current.add(gesture);
1857
1945
  return true;
1858
1946
  };
1859
- return /* @__PURE__ */ jsx16(
1947
+ return /* @__PURE__ */ jsx17(
1860
1948
  EffectParameters,
1861
1949
  {
1862
1950
  description,
@@ -1909,28 +1997,28 @@ var PaintEffectsPanel = ({ controller, className }) => {
1909
1997
  };
1910
1998
  const toggle = (b) => setBrowse(browse === b ? null : b);
1911
1999
  const pixel = active?.type === "pixel";
1912
- return /* @__PURE__ */ jsxs15("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
1913
- /* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap items-center gap-1", children: [
1914
- /* @__PURE__ */ jsx16("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
1915
- /* @__PURE__ */ jsx16("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
1916
- /* @__PURE__ */ jsx16("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
1917
- /* @__PURE__ */ jsx16("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
1918
- /* @__PURE__ */ jsx16("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" }),
1919
- /* @__PURE__ */ jsx16("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" })
2000
+ return /* @__PURE__ */ jsxs16("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
2001
+ /* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap items-center gap-1", children: [
2002
+ /* @__PURE__ */ jsx17("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
2003
+ /* @__PURE__ */ jsx17("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
2004
+ /* @__PURE__ */ jsx17("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
2005
+ /* @__PURE__ */ jsx17("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
2006
+ /* @__PURE__ */ jsx17("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" }),
2007
+ /* @__PURE__ */ jsx17("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" })
1920
2008
  ] }),
1921
- !provider && /* @__PURE__ */ jsx16("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
1922
- browse && /* @__PURE__ */ jsx16(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
1923
- paper && /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
1924
- /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-1", children: [
1925
- /* @__PURE__ */ jsxs15("span", { className: "flex-1 truncate", children: [
2009
+ !provider && /* @__PURE__ */ jsx17("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
2010
+ browse && /* @__PURE__ */ jsx17(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
2011
+ paper && /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
2012
+ /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1", children: [
2013
+ /* @__PURE__ */ jsxs16("span", { className: "flex-1 truncate", children: [
1926
2014
  "Paper: ",
1927
2015
  paper.name ?? paper.effect
1928
2016
  ] }),
1929
- /* @__PURE__ */ jsx16("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
2017
+ /* @__PURE__ */ jsx17("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
1930
2018
  ] }),
1931
- /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", children: [
1932
- /* @__PURE__ */ jsx16("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
1933
- /* @__PURE__ */ jsx16(
2019
+ /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
2020
+ /* @__PURE__ */ jsx17("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
2021
+ /* @__PURE__ */ jsx17(
1934
2022
  "input",
1935
2023
  {
1936
2024
  type: "range",
@@ -1952,43 +2040,43 @@ var PaintEffectsPanel = ({ controller, className }) => {
1952
2040
  `o${paper.opacity}`
1953
2041
  )
1954
2042
  ] }),
1955
- /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", children: [
1956
- /* @__PURE__ */ jsx16("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
1957
- /* @__PURE__ */ jsx16("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) => {
2043
+ /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
2044
+ /* @__PURE__ */ jsx17("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
2045
+ /* @__PURE__ */ jsx17("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) => {
1958
2046
  const blend = e.currentTarget.value;
1959
2047
  run(() => controller.updatePaperEffect({ blend }));
1960
- }, children: PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ jsx16("option", { value: b, children: b }, b)) })
2048
+ }, children: PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ jsx17("option", { value: b, children: b }, b)) })
1961
2049
  ] }),
1962
- /* @__PURE__ */ jsx16(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
2050
+ /* @__PURE__ */ jsx17(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
1963
2051
  ] }),
1964
- effectPaint && /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paint", children: [
1965
- /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-1", children: [
1966
- thumbnail ? /* @__PURE__ */ jsx16("img", { src: thumbnail, alt: "", className: "h-5 w-8 rounded object-cover ring-1 ring-slate-700", "data-testid": "effect-paint-thumbnail" }) : null,
1967
- /* @__PURE__ */ jsxs15("span", { className: "flex-1 truncate", children: [
2052
+ effectPaint && /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paint", children: [
2053
+ /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1", children: [
2054
+ thumbnail ? /* @__PURE__ */ jsx17("img", { src: thumbnail, alt: "", className: "h-5 w-8 rounded object-cover ring-1 ring-slate-700", "data-testid": "effect-paint-thumbnail" }) : null,
2055
+ /* @__PURE__ */ jsxs16("span", { className: "flex-1 truncate", children: [
1968
2056
  "Paint: ",
1969
2057
  effectPaint.effect,
1970
2058
  state.effectPaintRendering ? " (rendering\u2026)" : ""
1971
2059
  ] }),
1972
- /* @__PURE__ */ jsx16("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
2060
+ /* @__PURE__ */ jsx17("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
1973
2061
  ] }),
1974
- /* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
1975
- /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", title: "Lay the effect along each stroke instead of fixing it to the canvas", children: [
1976
- /* @__PURE__ */ jsx16("input", { type: "checkbox", checked: effectPaint.map?.by === "stroke", onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
2062
+ /* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
2063
+ /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", title: "Lay the effect along each stroke instead of fixing it to the canvas", children: [
2064
+ /* @__PURE__ */ jsx17("input", { type: "checkbox", checked: effectPaint.map?.by === "stroke", onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
1977
2065
  "Along the stroke"
1978
2066
  ] }),
1979
- hasPathControl && /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", title: "Pass each stroke's centreline to the effect's own path control", children: [
1980
- /* @__PURE__ */ jsx16("input", { type: "checkbox", checked: effectPaint.map?.by === "path", onChange: (e) => repaint({ map: e.target.checked ? { by: "path" } : { by: "canvas" } }) }),
2067
+ hasPathControl && /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", title: "Pass each stroke's centreline to the effect's own path control", children: [
2068
+ /* @__PURE__ */ jsx17("input", { type: "checkbox", checked: effectPaint.map?.by === "path", onChange: (e) => repaint({ map: e.target.checked ? { by: "path" } : { by: "canvas" } }) }),
1981
2069
  "Along the stroke (native)"
1982
2070
  ] }),
1983
- /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
1984
- /* @__PURE__ */ jsx16("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
2071
+ /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
2072
+ /* @__PURE__ */ jsx17("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
1985
2073
  "Live"
1986
2074
  ] })
1987
2075
  ] }),
1988
- effectPaint.map?.by === "stroke" && /* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap items-center gap-2", children: [
1989
- /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", children: [
1990
- /* @__PURE__ */ jsx16("span", { className: "text-slate-400", children: "Length" }),
1991
- /* @__PURE__ */ jsx16(
2076
+ effectPaint.map?.by === "stroke" && /* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap items-center gap-2", children: [
2077
+ /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
2078
+ /* @__PURE__ */ jsx17("span", { className: "text-slate-400", children: "Length" }),
2079
+ /* @__PURE__ */ jsx17(
1992
2080
  "input",
1993
2081
  {
1994
2082
  type: "number",
@@ -2002,43 +2090,43 @@ var PaintEffectsPanel = ({ controller, className }) => {
2002
2090
  effectPaint.map.length
2003
2091
  )
2004
2092
  ] }),
2005
- /* @__PURE__ */ jsxs15("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: [
2006
- /* @__PURE__ */ jsx16("option", { value: "repeat", children: "Repeat" }),
2007
- /* @__PURE__ */ jsx16("option", { value: "mirror", children: "Mirror" }),
2008
- /* @__PURE__ */ jsx16("option", { value: "clamp", children: "Clamp" })
2093
+ /* @__PURE__ */ jsxs16("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: [
2094
+ /* @__PURE__ */ jsx17("option", { value: "repeat", children: "Repeat" }),
2095
+ /* @__PURE__ */ jsx17("option", { value: "mirror", children: "Mirror" }),
2096
+ /* @__PURE__ */ jsx17("option", { value: "clamp", children: "Clamp" })
2009
2097
  ] })
2010
2098
  ] }),
2011
- /* @__PURE__ */ jsx16(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
2099
+ /* @__PURE__ */ jsx17(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
2012
2100
  ] }),
2013
- animation && /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2 rounded border border-slate-700 p-1", "data-effect-part": "playback", children: [
2014
- /* @__PURE__ */ jsxs15("span", { className: "flex-1 truncate", children: [
2101
+ animation && /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2 rounded border border-slate-700 p-1", "data-effect-part": "playback", children: [
2102
+ /* @__PURE__ */ jsxs16("span", { className: "flex-1 truncate", children: [
2015
2103
  "Live paint: ",
2016
2104
  animation.strokes,
2017
2105
  " ",
2018
2106
  animation.strokes === 1 ? "stroke" : "strokes"
2019
2107
  ] }),
2020
- /* @__PURE__ */ jsx16("button", { type: "button", className: button, "aria-pressed": playback.playing, onClick: () => attempt(() => controller.setEffectPlayback({ playing: !playback.playing })), children: playback.playing ? "Pause" : "Play" }),
2021
- /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-1", children: [
2022
- /* @__PURE__ */ jsx16("span", { className: "text-slate-400", children: "fps" }),
2023
- /* @__PURE__ */ jsx16("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" })
2108
+ /* @__PURE__ */ jsx17("button", { type: "button", className: button, "aria-pressed": playback.playing, onClick: () => attempt(() => controller.setEffectPlayback({ playing: !playback.playing })), children: playback.playing ? "Pause" : "Play" }),
2109
+ /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-1", children: [
2110
+ /* @__PURE__ */ jsx17("span", { className: "text-slate-400", children: "fps" }),
2111
+ /* @__PURE__ */ jsx17("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" })
2024
2112
  ] })
2025
2113
  ] }),
2026
- layerEffect && activeId && /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "layer", children: [
2027
- /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-1", children: [
2028
- /* @__PURE__ */ jsxs15("span", { className: "flex-1 truncate", children: [
2114
+ layerEffect && activeId && /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "layer", children: [
2115
+ /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1", children: [
2116
+ /* @__PURE__ */ jsxs16("span", { className: "flex-1 truncate", children: [
2029
2117
  "Layer: ",
2030
2118
  layerEffect.name ?? layerEffect.effect
2031
2119
  ] }),
2032
- /* @__PURE__ */ jsx16("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
2120
+ /* @__PURE__ */ jsx17("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
2033
2121
  ] }),
2034
- /* @__PURE__ */ jsx16(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
2122
+ /* @__PURE__ */ jsx17(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
2035
2123
  ] }),
2036
- /* @__PURE__ */ jsx16(ErrorLine, { error })
2124
+ /* @__PURE__ */ jsx17(ErrorLine, { error })
2037
2125
  ] });
2038
2126
  };
2039
2127
 
2040
2128
  // src/paint-editor/PaintEditor.tsx
2041
- import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
2129
+ import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
2042
2130
  var PAINT_CONTROLS = {
2043
2131
  "mixing-pad": '[data-testid="mixing-pad"]',
2044
2132
  lighting: '[data-testid="light-panel"]',
@@ -2110,27 +2198,27 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
2110
2198
  const [error, setError] = useState11(null);
2111
2199
  const effects = usePaintEffectsProvider(controller);
2112
2200
  const tabs = effects ? ["color", "wet", "paper", "layers", "effects"] : ["color", "wet", "paper", "layers"];
2113
- return /* @__PURE__ */ jsxs16("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: [
2114
- playing && /* @__PURE__ */ jsx17(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
2115
- /* @__PURE__ */ jsx17(PaintToolbar, { controller, tool, onToolChange: setTool, fillOptions, onFillOptionsChange: setFillOptions, fileName }),
2116
- /* @__PURE__ */ jsxs16("div", { className: "flex min-h-0 flex-1 gap-2", children: [
2117
- /* @__PURE__ */ jsx17(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
2118
- /* @__PURE__ */ jsxs16("div", { className: "flex min-w-0 flex-1 flex-col", children: [
2119
- /* @__PURE__ */ jsx17(PaintCanvas, { controller, tool, fillOptions, onError: setError, presence: playing ? void 0 : presence, proposals, agentStrokes, deviceTilt, className: "flex-1 rounded-lg" }),
2120
- error && /* @__PURE__ */ jsx17("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
2201
+ return /* @__PURE__ */ jsxs17("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: [
2202
+ playing && /* @__PURE__ */ jsx18(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
2203
+ /* @__PURE__ */ jsx18(PaintToolbar, { controller, tool, onToolChange: setTool, fillOptions, onFillOptionsChange: setFillOptions, fileName }),
2204
+ /* @__PURE__ */ jsxs17("div", { className: "flex min-h-0 flex-1 gap-2", children: [
2205
+ /* @__PURE__ */ jsx18(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
2206
+ /* @__PURE__ */ jsxs17("div", { className: "flex min-w-0 flex-1 flex-col", children: [
2207
+ /* @__PURE__ */ jsx18(PaintCanvas, { controller, tool, fillOptions, onError: setError, presence: playing ? void 0 : presence, proposals, agentStrokes, deviceTilt, className: "flex-1 rounded-lg" }),
2208
+ error && /* @__PURE__ */ jsx18("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
2121
2209
  ] }),
2122
- /* @__PURE__ */ jsxs16("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
2123
- /* @__PURE__ */ jsx17("div", { className: "flex gap-1", role: "tablist", "aria-label": "Paint panels", children: tabs.map((t) => /* @__PURE__ */ jsx17("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)) }),
2124
- /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
2125
- tab === "color" && /* @__PURE__ */ jsx17(ColorPanel, { controller }),
2126
- tab === "wet" && /* @__PURE__ */ jsx17(WetPanel, { controller }),
2127
- tab === "paper" && /* @__PURE__ */ jsx17(PaperPanel, { controller }),
2128
- tab === "layers" && /* @__PURE__ */ jsx17(PaintLayersPanel, { controller }),
2129
- tab === "layers" && /* @__PURE__ */ jsx17(StrokePanel, { controller }),
2130
- tab === "layers" && /* @__PURE__ */ jsx17(PathStrokePanel, { controller }),
2131
- tab === "layers" && /* @__PURE__ */ jsx17(EvolutionPanel, { controller, proposals }),
2132
- tab === "layers" && /* @__PURE__ */ jsx17(StickerPanel, { controller }),
2133
- tab === "effects" && effects && /* @__PURE__ */ jsx17(PaintEffectsPanel, { controller })
2210
+ /* @__PURE__ */ jsxs17("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
2211
+ /* @__PURE__ */ jsx18("div", { className: "flex gap-1", role: "tablist", "aria-label": "Paint panels", children: tabs.map((t) => /* @__PURE__ */ jsx18("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)) }),
2212
+ /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
2213
+ tab === "color" && /* @__PURE__ */ jsx18(ColorPanel, { controller }),
2214
+ tab === "wet" && /* @__PURE__ */ jsx18(WetPanel, { controller }),
2215
+ tab === "paper" && /* @__PURE__ */ jsx18(PaperPanel, { controller }),
2216
+ tab === "layers" && /* @__PURE__ */ jsx18(PaintLayersPanel, { controller }),
2217
+ tab === "layers" && /* @__PURE__ */ jsx18(StrokePanel, { controller }),
2218
+ tab === "layers" && /* @__PURE__ */ jsx18(PathStrokePanel, { controller }),
2219
+ tab === "layers" && /* @__PURE__ */ jsx18(EvolutionPanel, { controller, proposals }),
2220
+ tab === "layers" && /* @__PURE__ */ jsx18(StickerPanel, { controller }),
2221
+ tab === "effects" && effects && /* @__PURE__ */ jsx18(PaintEffectsPanel, { controller })
2134
2222
  ] })
2135
2223
  ] })
2136
2224
  ] })
@@ -2141,6 +2229,7 @@ export {
2141
2229
  BrushLibraryBrowser,
2142
2230
  BrushPanel,
2143
2231
  ColorPanel,
2232
+ CulturePanel,
2144
2233
  EvolutionPanel,
2145
2234
  FerroPanel,
2146
2235
  PaintCanvas,