@pixerate/editor-react 0.188.0 → 0.189.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,6 +35,7 @@ __export(paint_editor_exports, {
35
35
  BrushLibraryBrowser: () => BrushLibraryBrowser,
36
36
  BrushPanel: () => BrushPanel,
37
37
  ColorPanel: () => ColorPanel,
38
+ EvolutionPanel: () => EvolutionPanel,
38
39
  PaintCanvas: () => PaintCanvas,
39
40
  PaintEditor: () => PaintEditor,
40
41
  PaintEffectsPanel: () => PaintEffectsPanel,
@@ -2073,29 +2074,194 @@ var PathStrokePanel = ({ controller, className }) => {
2073
2074
  ] });
2074
2075
  };
2075
2076
 
2077
+ // src/paint-editor/EvolutionPanel.tsx
2078
+ var import_react17 = require("react");
2079
+ var import_paint_editor14 = require("@pixerate/editor/paint-editor");
2080
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2081
+ var EvolutionPanel = ({ controller, proposals, className }) => {
2082
+ const state = usePaintEditorState(controller);
2083
+ const store = proposals ?? controller.proposals;
2084
+ const proposalState = (0, import_react17.useSyncExternalStore)(store.subscribe, store.getState, store.getState);
2085
+ const [error, attempt] = useAttempt();
2086
+ const [selectedStrokes, setSelectedStrokes] = (0, import_react17.useState)([]);
2087
+ const [selectedProposals, setSelectedProposals] = (0, import_react17.useState)([]);
2088
+ const [count, setCount] = (0, import_react17.useState)(4);
2089
+ const [seed, setSeed] = (0, import_react17.useState)(1);
2090
+ const [mutation, setMutation] = (0, import_react17.useState)(() => (0, import_paint_editor14.normalizeMutationRates)());
2091
+ const [contactSheetUrl, setContactSheetUrl] = (0, import_react17.useState)(null);
2092
+ const eligibleStrokes = state.document.strokes.filter((s) => !(0, import_paint_editor14.liveStrokeRefusal)(s.brush));
2093
+ const activeStrokeIds = selectedStrokes.filter((id) => eligibleStrokes.some((s) => s.id === id));
2094
+ const effectiveStrokeIds = activeStrokeIds.length > 0 ? activeStrokeIds : state.selectedStroke && eligibleStrokes.some((s) => s.id === state.selectedStroke) ? [state.selectedStroke] : eligibleStrokes.length > 0 ? [eligibleStrokes[eligibleStrokes.length - 1].id] : [];
2095
+ const variants = proposalState.proposals.filter((p) => (0, import_paint_editor14.proposalGenomeStrokes)(p).length > 0);
2096
+ const activeProposalIds = selectedProposals.filter((id) => variants.some((v) => v.id === id));
2097
+ const toggleStroke = (id) => {
2098
+ setSelectedStrokes((prev) => prev.includes(id) ? prev.filter((x) => x !== id) : [...prev.slice(-15), id]);
2099
+ };
2100
+ const toggleProposal = (id) => {
2101
+ setSelectedProposals((prev) => prev.includes(id) ? prev.filter((x) => x !== id) : [...prev.slice(-1), id]);
2102
+ };
2103
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "evolution-panel", children: [
2104
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between", children: [
2105
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "font-medium text-slate-300", children: [
2106
+ "Evolution (",
2107
+ eligibleStrokes.length,
2108
+ ")"
2109
+ ] }),
2110
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1 text-[11px] text-slate-400", children: [
2111
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "Count" }),
2112
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2113
+ "input",
2114
+ {
2115
+ type: "number",
2116
+ "aria-label": "Variant count",
2117
+ min: 2,
2118
+ max: 12,
2119
+ value: count,
2120
+ onChange: (e) => setCount(Math.max(2, Math.min(12, Number(e.target.value) || 4))),
2121
+ className: "w-11 rounded bg-slate-800 px-1 py-0.5 text-right font-mono text-slate-200"
2122
+ }
2123
+ )
2124
+ ] }) })
2125
+ ] }),
2126
+ eligibleStrokes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex max-h-20 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Parent strokes", children: eligibleStrokes.map((s, i) => {
2127
+ const on = effectiveStrokeIds.includes(s.id);
2128
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2129
+ "button",
2130
+ {
2131
+ type: "button",
2132
+ role: "option",
2133
+ "aria-selected": on,
2134
+ title: `${i + 1}. ${s.brush.name} (${s.id})`,
2135
+ className: `h-5 w-5 rounded ring-1 ${on ? "ring-indigo-400" : "ring-slate-700"}`,
2136
+ style: { background: s.color },
2137
+ onClick: () => toggleStroke(s.id)
2138
+ },
2139
+ s.id
2140
+ );
2141
+ }) }),
2142
+ import_paint_editor14.EVOLUTION_SLIDERS.map((c) => {
2143
+ const key = c.path;
2144
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2145
+ PaintSlider,
2146
+ {
2147
+ control: c,
2148
+ value: mutation[key],
2149
+ onChange: (v) => setMutation((prev) => ({ ...prev, [key]: v }))
2150
+ },
2151
+ c.path
2152
+ );
2153
+ }),
2154
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2155
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2156
+ "button",
2157
+ {
2158
+ type: "button",
2159
+ className: button,
2160
+ disabled: effectiveStrokeIds.length === 0 || state.stroking,
2161
+ onClick: () => attempt(() => {
2162
+ controller.breedStrokes({ strokeIds: effectiveStrokeIds, count, mutation, seed });
2163
+ setSeed((s) => s + 1);
2164
+ }),
2165
+ children: "Breed strokes"
2166
+ }
2167
+ ),
2168
+ activeProposalIds.length === 2 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2169
+ "button",
2170
+ {
2171
+ type: "button",
2172
+ className: button,
2173
+ disabled: state.stroking,
2174
+ onClick: () => attempt(() => {
2175
+ controller.breedProposal({ proposalIds: activeProposalIds, count, mutation, seed });
2176
+ setSeed((s) => s + 1);
2177
+ }),
2178
+ children: "Cross over (2)"
2179
+ }
2180
+ ),
2181
+ variants.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2182
+ "button",
2183
+ {
2184
+ type: "button",
2185
+ className: button,
2186
+ onClick: () => attempt(() => {
2187
+ const sheet = (0, import_paint_editor14.exportProposalContactSheetPng)(controller, variants);
2188
+ setContactSheetUrl(`data:image/png;base64,${sheet.base64}`);
2189
+ }),
2190
+ children: "Contact sheet"
2191
+ }
2192
+ )
2193
+ ] }),
2194
+ variants.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "grid grid-cols-2 gap-1.5", "data-testid": "evolution-grid", children: variants.map((p) => {
2195
+ const g = (0, import_paint_editor14.paintProposalGhost)(p);
2196
+ const picked = activeProposalIds.includes(p.id);
2197
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2198
+ "div",
2199
+ {
2200
+ "data-testid": `evolution-variant-${p.id}`,
2201
+ 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"}`,
2202
+ children: [
2203
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex items-center justify-between gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2204
+ "button",
2205
+ {
2206
+ type: "button",
2207
+ "aria-pressed": picked,
2208
+ className: chip(picked),
2209
+ onClick: () => toggleProposal(p.id),
2210
+ children: p.title
2211
+ }
2212
+ ) }),
2213
+ g && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex h-16 items-center justify-center overflow-hidden rounded bg-slate-900/80 p-1", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PixelCanvas, { pixels: g, label: p.title, className: "max-h-full max-w-full object-contain" }) }),
2214
+ p.rationale && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "line-clamp-2 text-[10px] text-slate-400", title: p.rationale, children: p.rationale }),
2215
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2216
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2217
+ "button",
2218
+ {
2219
+ type: "button",
2220
+ className: button,
2221
+ disabled: state.stroking,
2222
+ onClick: () => attempt(() => {
2223
+ controller.breedProposal({ proposalIds: [p.id], count, mutation, seed });
2224
+ setSeed((s) => s + 1);
2225
+ }),
2226
+ children: "Breed from"
2227
+ }
2228
+ ),
2229
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => store.accept(p.id)), children: "Accept" }),
2230
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => store.reject(p.id)), children: "Dismiss" })
2231
+ ] })
2232
+ ]
2233
+ },
2234
+ p.id
2235
+ );
2236
+ }) }),
2237
+ contactSheetUrl && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("img", { src: contactSheetUrl, alt: "Variant contact sheet", className: "w-full rounded border border-slate-800", "data-testid": "evolution-contact-sheet" }),
2238
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ErrorLine, { error })
2239
+ ] });
2240
+ };
2241
+
2076
2242
  // src/paint-editor/PaintEditor.tsx
2077
- var import_react30 = require("react");
2078
- var import_paint_editor15 = require("@pixerate/editor/paint-editor");
2243
+ var import_react31 = require("react");
2244
+ var import_paint_editor16 = require("@pixerate/editor/paint-editor");
2079
2245
 
2080
2246
  // src/playback/AgentPlaybackContext.tsx
2081
- var import_react17 = require("react");
2082
- var import_jsx_runtime20 = require("react/jsx-runtime");
2083
- var AgentPlaybackContext = (0, import_react17.createContext)(null);
2247
+ var import_react18 = require("react");
2248
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2249
+ var AgentPlaybackContext = (0, import_react18.createContext)(null);
2084
2250
  function useAgentPlayback() {
2085
- return (0, import_react17.useContext)(AgentPlaybackContext);
2251
+ return (0, import_react18.useContext)(AgentPlaybackContext);
2086
2252
  }
2087
2253
 
2088
2254
  // src/playback/usePlaybackSurface.ts
2089
- var import_react18 = require("react");
2255
+ var import_react19 = require("react");
2090
2256
  var import_tools = require("@pixerate/editor/tools");
2091
2257
  function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
2092
2258
  const ambient = useAgentPlayback();
2093
2259
  const target = playback === void 0 ? ambient : playback;
2094
- const [ownPresence] = (0, import_react18.useState)(() => new import_tools.PresenceStore());
2260
+ const [ownPresence] = (0, import_react19.useState)(() => new import_tools.PresenceStore());
2095
2261
  const presence = sharedPresence ?? ownPresence;
2096
- const latest = (0, import_react18.useRef)(options);
2262
+ const latest = (0, import_react19.useRef)(options);
2097
2263
  latest.current = options;
2098
- (0, import_react18.useEffect)(() => {
2264
+ (0, import_react19.useEffect)(() => {
2099
2265
  if (!target || !id) return;
2100
2266
  const o = () => latest.current;
2101
2267
  const surface = {
@@ -2127,13 +2293,13 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
2127
2293
  }
2128
2294
 
2129
2295
  // src/playback/PresenceLayer.tsx
2130
- var import_react19 = __toESM(require("react"), 1);
2131
- var import_jsx_runtime21 = require("react/jsx-runtime");
2296
+ var import_react20 = __toESM(require("react"), 1);
2297
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2132
2298
  function PresenceLayer({ presence, viewport, clip = true, renderCursor, className = "" }) {
2133
- const { actors } = (0, import_react19.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
2299
+ const { actors } = (0, import_react20.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
2134
2300
  if (!actors.length) return null;
2135
2301
  const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
2136
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2302
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2137
2303
  "div",
2138
2304
  {
2139
2305
  className: `pixerate-presence ${className}`.trim(),
@@ -2147,19 +2313,19 @@ function PresenceLayer({ presence, viewport, clip = true, renderCursor, classNam
2147
2313
  const br = map({ x: a.focus.x + a.focus.width, y: a.focus.y + a.focus.height });
2148
2314
  return { left: tl.x - 4, top: tl.y - 4, width: br.x - tl.x + 8, height: br.y - tl.y + 8 };
2149
2315
  })();
2150
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react19.default.Fragment, { children: [
2151
- ring && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2316
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react20.default.Fragment, { children: [
2317
+ ring && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2152
2318
  "div",
2153
2319
  {
2154
2320
  "data-actor-focus": a.id,
2155
2321
  style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
2156
2322
  }
2157
2323
  ),
2158
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: renderCursor ? renderCursor(a) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
2159
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("svg", { width: "18", height: "20", viewBox: "0 0 12 18", style: { display: "block", transform: a.pressed ? "scale(0.85)" : void 0, transformOrigin: "0 0", filter: "drop-shadow(0 1px 2px rgba(0,0,0,.35))" }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M0,0 L0,14 L4,10.5 L7,17 L9.5,16 L6.5,9.5 L11.5,9.5 Z", style: { fill: a.color, stroke: "#ffffff", strokeWidth: 1 } }) }),
2160
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
2161
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
2162
- a.message && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "data-actor-message": a.id, style: { width: "max-content", maxWidth: 240, borderRadius: 8, borderTopLeftRadius: 0, padding: "4px 8px", fontSize: 12, color: "#1e293b", background: "#ffffff", boxShadow: "0 4px 12px rgba(15,23,42,.18)" }, children: a.message })
2324
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: renderCursor ? renderCursor(a) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
2325
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("svg", { width: "18", height: "20", viewBox: "0 0 12 18", style: { display: "block", transform: a.pressed ? "scale(0.85)" : void 0, transformOrigin: "0 0", filter: "drop-shadow(0 1px 2px rgba(0,0,0,.35))" }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M0,0 L0,14 L4,10.5 L7,17 L9.5,16 L6.5,9.5 L11.5,9.5 Z", style: { fill: a.color, stroke: "#ffffff", strokeWidth: 1 } }) }),
2326
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
2327
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
2328
+ a.message && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "data-actor-message": a.id, style: { width: "max-content", maxWidth: 240, borderRadius: 8, borderTopLeftRadius: 0, padding: "4px 8px", fontSize: 12, color: "#1e293b", background: "#ffffff", boxShadow: "0 4px 12px rgba(15,23,42,.18)" }, children: a.message })
2163
2329
  ] })
2164
2330
  ] }) })
2165
2331
  ] }, a.id);
@@ -2169,16 +2335,16 @@ function PresenceLayer({ presence, viewport, clip = true, renderCursor, classNam
2169
2335
  }
2170
2336
 
2171
2337
  // src/paint-editor/PaintEffectsPanel.tsx
2172
- var import_react29 = require("react");
2173
- var import_paint_editor14 = require("@pixerate/editor/paint-editor");
2338
+ var import_react30 = require("react");
2339
+ var import_paint_editor15 = require("@pixerate/editor/paint-editor");
2174
2340
  var import_effects4 = require("@pixerate/editor/effects");
2175
2341
 
2176
2342
  // src/effects/useEffects.ts
2177
- var import_react20 = require("react");
2343
+ var import_react21 = require("react");
2178
2344
  function useEffectDescription(provider, effect) {
2179
- const [state, setState] = (0, import_react20.useState)({ key: "", description: null, error: null });
2345
+ const [state, setState] = (0, import_react21.useState)({ key: "", description: null, error: null });
2180
2346
  const key = provider && effect ? `${provider.id}:${effect}` : "";
2181
- (0, import_react20.useEffect)(() => {
2347
+ (0, import_react21.useEffect)(() => {
2182
2348
  if (!provider || !effect) return;
2183
2349
  let live = true;
2184
2350
  Promise.resolve().then(() => provider.describe(effect)).then(
@@ -2193,14 +2359,14 @@ function useEffectDescription(provider, effect) {
2193
2359
  }
2194
2360
 
2195
2361
  // src/effects/EffectThumbnail.tsx
2196
- var import_react21 = require("react");
2362
+ var import_react22 = require("react");
2197
2363
  var import_effects = require("@pixerate/editor/effects");
2198
- var import_jsx_runtime22 = require("react/jsx-runtime");
2364
+ var import_jsx_runtime23 = require("react/jsx-runtime");
2199
2365
  var LABELS = { motion: "Motion", camera: "Camera", timing: "Timing" };
2200
2366
  function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
2201
- const ref = (0, import_react21.useRef)(null);
2202
- const [failed, setFailed] = (0, import_react21.useState)(effect.kind in LABELS);
2203
- (0, import_react21.useEffect)(() => {
2367
+ const ref = (0, import_react22.useRef)(null);
2368
+ const [failed, setFailed] = (0, import_react22.useState)(effect.kind in LABELS);
2369
+ (0, import_react22.useEffect)(() => {
2204
2370
  if (effect.kind in LABELS) return;
2205
2371
  let live = true;
2206
2372
  (0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
@@ -2215,28 +2381,28 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
2215
2381
  live = false;
2216
2382
  };
2217
2383
  }, [provider, effect, width, height]);
2218
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2384
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2219
2385
  "div",
2220
2386
  {
2221
2387
  className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
2222
2388
  style: { aspectRatio: `${width} / ${height}` },
2223
2389
  "data-effect-thumbnail": effect.id,
2224
- children: failed ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: LABELS[effect.kind] ?? "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
2390
+ children: failed ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: LABELS[effect.kind] ?? "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
2225
2391
  }
2226
2392
  );
2227
2393
  }
2228
2394
 
2229
2395
  // src/effects/EffectsBrowser.tsx
2230
- var import_react22 = require("react");
2396
+ var import_react23 = require("react");
2231
2397
  var import_effects2 = require("@pixerate/editor/effects");
2232
- var import_jsx_runtime23 = require("react/jsx-runtime");
2398
+ var import_jsx_runtime24 = require("react/jsx-runtime");
2233
2399
  function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
2234
- const [all, setAll] = (0, import_react22.useState)([]);
2235
- const [query, setQuery] = (0, import_react22.useState)("");
2236
- const [category, setCategory] = (0, import_react22.useState)("");
2237
- const [use, setUse] = (0, import_react22.useState)("");
2238
- const [error, setError] = (0, import_react22.useState)(null);
2239
- (0, import_react22.useEffect)(() => {
2400
+ const [all, setAll] = (0, import_react23.useState)([]);
2401
+ const [query, setQuery] = (0, import_react23.useState)("");
2402
+ const [category, setCategory] = (0, import_react23.useState)("");
2403
+ const [use, setUse] = (0, import_react23.useState)("");
2404
+ const [error, setError] = (0, import_react23.useState)(null);
2405
+ (0, import_react23.useEffect)(() => {
2240
2406
  if (!provider) return setAll([]);
2241
2407
  let live = true;
2242
2408
  Promise.resolve().then(() => provider.list()).then(
@@ -2247,8 +2413,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2247
2413
  live = false;
2248
2414
  };
2249
2415
  }, [provider]);
2250
- const [found, setFound] = (0, import_react22.useState)([]);
2251
- (0, import_react22.useEffect)(() => {
2416
+ const [found, setFound] = (0, import_react23.useState)([]);
2417
+ (0, import_react23.useEffect)(() => {
2252
2418
  if (!provider) return setFound([]);
2253
2419
  let live = true;
2254
2420
  Promise.resolve().then(() => provider.search(query, { ...category ? { category } : {}, ...use ? { use } : {} })).then((list) => live && setFound(list), () => live && setFound([]));
@@ -2257,14 +2423,14 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2257
2423
  };
2258
2424
  }, [provider, query, category, use]);
2259
2425
  const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses);
2260
- const categories = (0, import_react22.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
2426
+ const categories = (0, import_react23.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
2261
2427
  const shown = found.filter(allowed);
2262
2428
  if (!provider)
2263
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: `rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground ${className}`, "data-effects-browser": "", "data-effects-unavailable": "", children: "No effects provider is registered, so effects cannot be added. Effects already in the document are kept." });
2264
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
2265
- title && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h3", { className: "text-xs font-semibold", children: title }),
2266
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2267
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2429
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground ${className}`, "data-effects-browser": "", "data-effects-unavailable": "", children: "No effects provider is registered, so effects cannot be added. Effects already in the document are kept." });
2430
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
2431
+ title && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h3", { className: "text-xs font-semibold", children: title }),
2432
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2433
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2268
2434
  "input",
2269
2435
  {
2270
2436
  type: "search",
@@ -2275,17 +2441,17 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2275
2441
  onChange: (e) => setQuery(e.currentTarget.value)
2276
2442
  }
2277
2443
  ),
2278
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Category", value: category, onChange: (e) => setCategory(e.currentTarget.value), children: [
2279
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "", children: "All categories" }),
2280
- categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: c, children: c }, c))
2444
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Category", value: category, onChange: (e) => setCategory(e.currentTarget.value), children: [
2445
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "", children: "All categories" }),
2446
+ categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: c, children: c }, c))
2281
2447
  ] }),
2282
- uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Use", value: use, onChange: (e) => setUse(e.currentTarget.value), children: [
2283
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "", children: "Any use" }),
2284
- uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
2448
+ uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Use", value: use, onChange: (e) => setUse(e.currentTarget.value), children: [
2449
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "", children: "Any use" }),
2450
+ uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
2285
2451
  ] })
2286
2452
  ] }),
2287
- error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
2288
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("ul", { className: "grid max-h-96 grid-cols-[repeat(auto-fill,minmax(6.5rem,1fr))] gap-1.5 overflow-y-auto", role: "list", children: shown.map((e) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2453
+ error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
2454
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("ul", { className: "grid max-h-96 grid-cols-[repeat(auto-fill,minmax(6.5rem,1fr))] gap-1.5 overflow-y-auto", role: "list", children: shown.map((e) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2289
2455
  "button",
2290
2456
  {
2291
2457
  type: "button",
@@ -2294,23 +2460,23 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2294
2460
  "data-effect-id": e.id,
2295
2461
  onClick: () => onPick(e),
2296
2462
  children: [
2297
- thumbnails && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(EffectThumbnail, { provider, effect: e }),
2298
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
2299
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
2463
+ thumbnails && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(EffectThumbnail, { provider, effect: e }),
2464
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
2465
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
2300
2466
  ]
2301
2467
  }
2302
2468
  ) }, e.id)) }),
2303
- !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
2469
+ !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
2304
2470
  ] });
2305
2471
  }
2306
2472
 
2307
2473
  // src/effects/EffectParameters.tsx
2308
- var import_react28 = __toESM(require("react"), 1);
2474
+ var import_react29 = __toESM(require("react"), 1);
2309
2475
  var import_effects3 = require("@pixerate/editor/effects");
2310
2476
  var import_parameters2 = require("@pixerate/editor/parameters");
2311
2477
 
2312
2478
  // src/parameters/fields.tsx
2313
- var import_react27 = require("react");
2479
+ var import_react28 = require("react");
2314
2480
  var import_parameters = require("@pixerate/editor/parameters");
2315
2481
 
2316
2482
  // src/color/index.ts
@@ -2323,9 +2489,9 @@ __export(color_exports, {
2323
2489
  });
2324
2490
 
2325
2491
  // src/color/ColorPicker.tsx
2326
- var import_react23 = require("react");
2492
+ var import_react24 = require("react");
2327
2493
  var import_color = require("@pixerate/editor/color");
2328
- var import_jsx_runtime24 = require("react/jsx-runtime");
2494
+ var import_jsx_runtime25 = require("react/jsx-runtime");
2329
2495
  var LOCAL_STORAGE_KEY = "pixerate:color:recent";
2330
2496
  function readLocalRecents() {
2331
2497
  try {
@@ -2363,24 +2529,24 @@ var ColorPicker = ({
2363
2529
  id,
2364
2530
  "aria-label": ariaLabel = "Color picker"
2365
2531
  }) => {
2366
- const generatedId = (0, import_react23.useId)();
2532
+ const generatedId = (0, import_react24.useId)();
2367
2533
  const pickerId = id || generatedId;
2368
- const [pickerState, setPickerState] = (0, import_react23.useState)(
2534
+ const [pickerState, setPickerState] = (0, import_react24.useState)(
2369
2535
  () => (0, import_color.pickerStateFromColor)(value) ?? DEFAULT_PICKER_STATE
2370
2536
  );
2371
- const stateRef = (0, import_react23.useRef)(pickerState);
2537
+ const stateRef = (0, import_react24.useRef)(pickerState);
2372
2538
  stateRef.current = pickerState;
2373
- (0, import_react23.useEffect)(() => {
2539
+ (0, import_react24.useEffect)(() => {
2374
2540
  const next = (0, import_color.pickerStateFromColor)(value, stateRef.current);
2375
2541
  if (next) {
2376
2542
  setPickerState(next);
2377
2543
  }
2378
2544
  }, [value]);
2379
- const [internalRecent, setInternalRecent] = (0, import_react23.useState)(
2545
+ const [internalRecent, setInternalRecent] = (0, import_react24.useState)(
2380
2546
  () => controlledRecent ? [] : readLocalRecents()
2381
2547
  );
2382
2548
  const activeRecent = controlledRecent ?? internalRecent;
2383
- const recordRecent = (0, import_react23.useCallback)(
2549
+ const recordRecent = (0, import_react24.useCallback)(
2384
2550
  (color) => {
2385
2551
  const updated = (0, import_color.pushRecentColor)(activeRecent, color, 12);
2386
2552
  if (!controlledRecent) {
@@ -2391,11 +2557,11 @@ var ColorPicker = ({
2391
2557
  },
2392
2558
  [activeRecent, controlledRecent, onRecentChange]
2393
2559
  );
2394
- const [textDraft, setTextDraft] = (0, import_react23.useState)(value);
2395
- const [isInvalid, setIsInvalid] = (0, import_react23.useState)(false);
2396
- const [isClipped, setIsClipped] = (0, import_react23.useState)(false);
2397
- const isTypingRef = (0, import_react23.useRef)(false);
2398
- (0, import_react23.useEffect)(() => {
2560
+ const [textDraft, setTextDraft] = (0, import_react24.useState)(value);
2561
+ const [isInvalid, setIsInvalid] = (0, import_react24.useState)(false);
2562
+ const [isClipped, setIsClipped] = (0, import_react24.useState)(false);
2563
+ const isTypingRef = (0, import_react24.useRef)(false);
2564
+ (0, import_react24.useEffect)(() => {
2399
2565
  if (!isTypingRef.current) {
2400
2566
  setTextDraft(value);
2401
2567
  setIsInvalid(false);
@@ -2403,11 +2569,11 @@ var ColorPicker = ({
2403
2569
  setIsClipped(Boolean(parsed && !(0, import_color.inSrgbGamut)(parsed)));
2404
2570
  }
2405
2571
  }, [value]);
2406
- const [hasEyeDropper, setHasEyeDropper] = (0, import_react23.useState)(false);
2407
- (0, import_react23.useEffect)(() => {
2572
+ const [hasEyeDropper, setHasEyeDropper] = (0, import_react24.useState)(false);
2573
+ (0, import_react24.useEffect)(() => {
2408
2574
  setHasEyeDropper(typeof window !== "undefined" && "EyeDropper" in window);
2409
2575
  }, []);
2410
- const emitColorChange = (0, import_react23.useCallback)(
2576
+ const emitColorChange = (0, import_react24.useCallback)(
2411
2577
  (nextState) => {
2412
2578
  setPickerState(nextState);
2413
2579
  const hex = (0, import_color.pickerStateToHex)(nextState, alpha);
@@ -2415,10 +2581,10 @@ var ColorPicker = ({
2415
2581
  },
2416
2582
  [alpha, onChange]
2417
2583
  );
2418
- const latest = (0, import_react23.useRef)({ emitColorChange, recordRecent, onGestureEnd, alpha });
2584
+ const latest = (0, import_react24.useRef)({ emitColorChange, recordRecent, onGestureEnd, alpha });
2419
2585
  latest.current = { emitColorChange, recordRecent, onGestureEnd, alpha };
2420
- const endDragRef = (0, import_react23.useRef)(null);
2421
- (0, import_react23.useEffect)(() => () => endDragRef.current?.(), []);
2586
+ const endDragRef = (0, import_react24.useRef)(null);
2587
+ (0, import_react24.useEffect)(() => () => endDragRef.current?.(), []);
2422
2588
  const startDrag = (e, next) => {
2423
2589
  if (disabled) return;
2424
2590
  e.preventDefault();
@@ -2520,7 +2686,7 @@ var ColorPicker = ({
2520
2686
  } catch {
2521
2687
  }
2522
2688
  };
2523
- const contrastResult = (0, import_react23.useMemo)(() => {
2689
+ const contrastResult = (0, import_react24.useMemo)(() => {
2524
2690
  if (!contrastAgainst) return null;
2525
2691
  const fg = (0, import_color.parseColor)(value);
2526
2692
  const bg = (0, import_color.parseColor)(contrastAgainst);
@@ -2532,7 +2698,7 @@ var ColorPicker = ({
2532
2698
  }, [value, contrastAgainst]);
2533
2699
  const currentHex = (0, import_color.pickerStateToHex)(pickerState, alpha);
2534
2700
  const liveDescription = `Selected color: ${value}${contrastResult ? `, contrast ${contrastResult.ratio.toFixed(1)}:1 against ${contrastAgainst}, ${contrastResult.aa ? "passes AA" : "fails AA"}` : ""}`;
2535
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2701
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
2536
2702
  "div",
2537
2703
  {
2538
2704
  id: pickerId,
@@ -2556,7 +2722,7 @@ var ColorPicker = ({
2556
2722
  pointerEvents: disabled ? "none" : "auto"
2557
2723
  },
2558
2724
  children: [
2559
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2725
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2560
2726
  "span",
2561
2727
  {
2562
2728
  role: "status",
@@ -2575,7 +2741,7 @@ var ColorPicker = ({
2575
2741
  children: liveDescription
2576
2742
  }
2577
2743
  ),
2578
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2744
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2579
2745
  "div",
2580
2746
  {
2581
2747
  role: "slider",
@@ -2597,7 +2763,7 @@ var ColorPicker = ({
2597
2763
  touchAction: "none",
2598
2764
  outline: "none"
2599
2765
  },
2600
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2766
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2601
2767
  "div",
2602
2768
  {
2603
2769
  style: {
@@ -2617,7 +2783,7 @@ var ColorPicker = ({
2617
2783
  )
2618
2784
  }
2619
2785
  ),
2620
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2786
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2621
2787
  "div",
2622
2788
  {
2623
2789
  role: "slider",
@@ -2640,7 +2806,7 @@ var ColorPicker = ({
2640
2806
  touchAction: "none",
2641
2807
  outline: "none"
2642
2808
  },
2643
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2809
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2644
2810
  "div",
2645
2811
  {
2646
2812
  style: {
@@ -2660,7 +2826,7 @@ var ColorPicker = ({
2660
2826
  )
2661
2827
  }
2662
2828
  ),
2663
- alpha && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2829
+ alpha && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
2664
2830
  "div",
2665
2831
  {
2666
2832
  role: "slider",
@@ -2686,7 +2852,7 @@ var ColorPicker = ({
2686
2852
  overflow: "hidden"
2687
2853
  },
2688
2854
  children: [
2689
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2855
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2690
2856
  "div",
2691
2857
  {
2692
2858
  style: {
@@ -2696,7 +2862,7 @@ var ColorPicker = ({
2696
2862
  }
2697
2863
  }
2698
2864
  ),
2699
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2865
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2700
2866
  "div",
2701
2867
  {
2702
2868
  style: {
@@ -2717,8 +2883,8 @@ var ColorPicker = ({
2717
2883
  ]
2718
2884
  }
2719
2885
  ),
2720
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
2721
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2886
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
2887
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2722
2888
  "div",
2723
2889
  {
2724
2890
  style: {
@@ -2732,7 +2898,7 @@ var ColorPicker = ({
2732
2898
  flexShrink: 0,
2733
2899
  border: "1px solid rgba(255,255,255,0.15)"
2734
2900
  },
2735
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2901
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2736
2902
  "div",
2737
2903
  {
2738
2904
  style: {
@@ -2744,7 +2910,7 @@ var ColorPicker = ({
2744
2910
  )
2745
2911
  }
2746
2912
  ),
2747
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2913
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2748
2914
  "input",
2749
2915
  {
2750
2916
  type: "text",
@@ -2774,7 +2940,7 @@ var ColorPicker = ({
2774
2940
  }
2775
2941
  }
2776
2942
  ),
2777
- hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2943
+ hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2778
2944
  "button",
2779
2945
  {
2780
2946
  type: "button",
@@ -2794,7 +2960,7 @@ var ColorPicker = ({
2794
2960
  color: "inherit",
2795
2961
  cursor: disabled ? "default" : "pointer"
2796
2962
  },
2797
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2963
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
2798
2964
  "svg",
2799
2965
  {
2800
2966
  width: "14",
@@ -2806,16 +2972,16 @@ var ColorPicker = ({
2806
2972
  strokeLinecap: "round",
2807
2973
  strokeLinejoin: "round",
2808
2974
  children: [
2809
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: "m19 11-8-8-8.5 8.5a2.12 2.12 0 0 0 0 3l2.5 2.5 1.5-1.5" }),
2810
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
2811
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: "m14 6 4 4" })
2975
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "m19 11-8-8-8.5 8.5a2.12 2.12 0 0 0 0 3l2.5 2.5 1.5-1.5" }),
2976
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
2977
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "m14 6 4 4" })
2812
2978
  ]
2813
2979
  }
2814
2980
  )
2815
2981
  }
2816
2982
  )
2817
2983
  ] }),
2818
- isClipped && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2984
+ isClipped && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2819
2985
  "div",
2820
2986
  {
2821
2987
  role: "note",
@@ -2831,10 +2997,10 @@ var ColorPicker = ({
2831
2997
  borderRadius: "4px",
2832
2998
  alignSelf: "flex-start"
2833
2999
  },
2834
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
3000
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
2835
3001
  }
2836
3002
  ),
2837
- contrastResult && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
3003
+ contrastResult && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
2838
3004
  "div",
2839
3005
  {
2840
3006
  style: {
@@ -2848,15 +3014,15 @@ var ColorPicker = ({
2848
3014
  border: "1px solid rgba(255,255,255,0.1)"
2849
3015
  },
2850
3016
  children: [
2851
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { children: [
3017
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { children: [
2852
3018
  "Contrast: ",
2853
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("strong", { children: [
3019
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("strong", { children: [
2854
3020
  contrastResult.ratio.toFixed(2),
2855
3021
  ":1"
2856
3022
  ] })
2857
3023
  ] }),
2858
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
2859
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
3024
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
3025
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
2860
3026
  "span",
2861
3027
  {
2862
3028
  style: {
@@ -2869,7 +3035,7 @@ var ColorPicker = ({
2869
3035
  ]
2870
3036
  }
2871
3037
  ),
2872
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
3038
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
2873
3039
  "span",
2874
3040
  {
2875
3041
  style: {
@@ -2886,9 +3052,9 @@ var ColorPicker = ({
2886
3052
  ]
2887
3053
  }
2888
3054
  ),
2889
- swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2890
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
2891
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3055
+ swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
3056
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
3057
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2892
3058
  "button",
2893
3059
  {
2894
3060
  type: "button",
@@ -2914,9 +3080,9 @@ var ColorPicker = ({
2914
3080
  `${color}-${idx}`
2915
3081
  )) })
2916
3082
  ] }),
2917
- activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2918
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
2919
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3083
+ activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
3084
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
3085
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2920
3086
  "button",
2921
3087
  {
2922
3088
  type: "button",
@@ -2947,9 +3113,9 @@ var ColorPicker = ({
2947
3113
  };
2948
3114
 
2949
3115
  // src/color/DualColorPicker.tsx
2950
- var import_react24 = require("react");
3116
+ var import_react25 = require("react");
2951
3117
  var import_color2 = require("@pixerate/editor/color");
2952
- var import_jsx_runtime25 = require("react/jsx-runtime");
3118
+ var import_jsx_runtime26 = require("react/jsx-runtime");
2953
3119
  function DualColorPicker({
2954
3120
  value,
2955
3121
  onChange,
@@ -2964,8 +3130,8 @@ function DualColorPicker({
2964
3130
  disabled = false,
2965
3131
  className = ""
2966
3132
  }) {
2967
- const sameId = (0, import_react24.useId)();
2968
- const [internalScheme, setInternalScheme] = (0, import_react24.useState)("light");
3133
+ const sameId = (0, import_react25.useId)();
3134
+ const [internalScheme, setInternalScheme] = (0, import_react25.useState)("light");
2969
3135
  const activeScheme = controlledScheme ?? internalScheme;
2970
3136
  const handleSchemeSelect = (nextScheme) => {
2971
3137
  if (onSchemeChange) {
@@ -2976,7 +3142,7 @@ function DualColorPicker({
2976
3142
  };
2977
3143
  const dual = (0, import_color2.normalizeDualColor)(value) ?? { light: "#000000", dark: "#000000" };
2978
3144
  const isSame = dual.light.toLowerCase() === dual.dark.toLowerCase();
2979
- const [sameInBoth, setSameInBoth] = (0, import_react24.useState)(isSame);
3145
+ const [sameInBoth, setSameInBoth] = (0, import_react25.useState)(isSame);
2980
3146
  const handleSameToggle = (e) => {
2981
3147
  const nextSame = e.target.checked;
2982
3148
  setSameInBoth(nextSame);
@@ -3008,7 +3174,7 @@ function DualColorPicker({
3008
3174
  const activeColor = activeScheme === "dark" ? dual.dark : dual.light;
3009
3175
  const activeContrastTarget = contrastAgainst ? (0, import_color2.resolveColor)(contrastAgainst, activeScheme) ?? void 0 : void 0;
3010
3176
  const dualContrast = contrastAgainst && (0, import_color2.normalizeDualColor)(contrastAgainst) ? (0, import_color2.checkDualColorContrast)(dual, contrastAgainst) : null;
3011
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3177
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3012
3178
  "div",
3013
3179
  {
3014
3180
  className: `pixerate-dual-color-picker ${className}`,
@@ -3027,7 +3193,7 @@ function DualColorPicker({
3027
3193
  boxSizing: "border-box"
3028
3194
  },
3029
3195
  children: [
3030
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3196
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3031
3197
  "div",
3032
3198
  {
3033
3199
  role: "tablist",
@@ -3040,7 +3206,7 @@ function DualColorPicker({
3040
3206
  gap: "2px"
3041
3207
  },
3042
3208
  children: [
3043
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3209
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3044
3210
  "button",
3045
3211
  {
3046
3212
  type: "button",
@@ -3063,7 +3229,7 @@ function DualColorPicker({
3063
3229
  children: "Light"
3064
3230
  }
3065
3231
  ),
3066
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3232
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3067
3233
  "button",
3068
3234
  {
3069
3235
  type: "button",
@@ -3089,8 +3255,8 @@ function DualColorPicker({
3089
3255
  ]
3090
3256
  }
3091
3257
  ),
3092
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
3093
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3258
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
3259
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3094
3260
  "button",
3095
3261
  {
3096
3262
  type: "button",
@@ -3112,7 +3278,7 @@ function DualColorPicker({
3112
3278
  outline: "none"
3113
3279
  },
3114
3280
  children: [
3115
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3281
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3116
3282
  "span",
3117
3283
  {
3118
3284
  style: {
@@ -3124,11 +3290,11 @@ function DualColorPicker({
3124
3290
  }
3125
3291
  }
3126
3292
  ),
3127
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
3293
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
3128
3294
  ]
3129
3295
  }
3130
3296
  ),
3131
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3297
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3132
3298
  "button",
3133
3299
  {
3134
3300
  type: "button",
@@ -3150,7 +3316,7 @@ function DualColorPicker({
3150
3316
  outline: "none"
3151
3317
  },
3152
3318
  children: [
3153
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3319
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3154
3320
  "span",
3155
3321
  {
3156
3322
  style: {
@@ -3162,12 +3328,12 @@ function DualColorPicker({
3162
3328
  }
3163
3329
  }
3164
3330
  ),
3165
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
3331
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
3166
3332
  ]
3167
3333
  }
3168
3334
  )
3169
3335
  ] }),
3170
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3336
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3171
3337
  "div",
3172
3338
  {
3173
3339
  style: {
@@ -3178,7 +3344,7 @@ function DualColorPicker({
3178
3344
  padding: "2px 0"
3179
3345
  },
3180
3346
  children: [
3181
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3347
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3182
3348
  "label",
3183
3349
  {
3184
3350
  htmlFor: sameId,
@@ -3192,7 +3358,7 @@ function DualColorPicker({
3192
3358
  color: "#c4cad4"
3193
3359
  },
3194
3360
  children: [
3195
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3361
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3196
3362
  "input",
3197
3363
  {
3198
3364
  id: sameId,
@@ -3203,11 +3369,11 @@ function DualColorPicker({
3203
3369
  style: { cursor: disabled ? "not-allowed" : "pointer" }
3204
3370
  }
3205
3371
  ),
3206
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "Same in both" })
3372
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Same in both" })
3207
3373
  ]
3208
3374
  }
3209
3375
  ),
3210
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3376
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3211
3377
  "button",
3212
3378
  {
3213
3379
  type: "button",
@@ -3229,7 +3395,7 @@ function DualColorPicker({
3229
3395
  ]
3230
3396
  }
3231
3397
  ),
3232
- dualContrast && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3398
+ dualContrast && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3233
3399
  "div",
3234
3400
  {
3235
3401
  "data-testid": "dual-contrast-summary",
@@ -3243,20 +3409,20 @@ function DualColorPicker({
3243
3409
  color: "#8c95a6"
3244
3410
  },
3245
3411
  children: [
3246
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { children: [
3412
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { children: [
3247
3413
  "Light:",
3248
3414
  " ",
3249
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3415
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3250
3416
  dualContrast.light.ratio.toFixed(2),
3251
3417
  " (",
3252
3418
  dualContrast.light.level,
3253
3419
  ")"
3254
3420
  ] })
3255
3421
  ] }),
3256
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { children: [
3422
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { children: [
3257
3423
  "Dark:",
3258
3424
  " ",
3259
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3425
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3260
3426
  dualContrast.dark.ratio.toFixed(2),
3261
3427
  " (",
3262
3428
  dualContrast.dark.level,
@@ -3266,7 +3432,7 @@ function DualColorPicker({
3266
3432
  ]
3267
3433
  }
3268
3434
  ),
3269
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3435
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3270
3436
  ColorPicker,
3271
3437
  {
3272
3438
  value: activeColor,
@@ -3285,7 +3451,7 @@ function DualColorPicker({
3285
3451
  }
3286
3452
 
3287
3453
  // src/color/useColorScheme.ts
3288
- var import_react25 = require("react");
3454
+ var import_react26 = require("react");
3289
3455
  var import_color3 = require("@pixerate/editor/color");
3290
3456
  function getSnapshot(attribute) {
3291
3457
  if (typeof window === "undefined" || typeof document === "undefined") {
@@ -3310,7 +3476,7 @@ function getServerSnapshot() {
3310
3476
  function useColorScheme(options) {
3311
3477
  const override = options?.override;
3312
3478
  const attribute = options?.attribute;
3313
- const subscribe = (0, import_react25.useMemo)(() => {
3479
+ const subscribe = (0, import_react26.useMemo)(() => {
3314
3480
  return (callback) => {
3315
3481
  if (typeof window === "undefined" || typeof document === "undefined") {
3316
3482
  return () => {
@@ -3336,7 +3502,7 @@ function useColorScheme(options) {
3336
3502
  };
3337
3503
  };
3338
3504
  }, [attribute]);
3339
- const detected = (0, import_react25.useSyncExternalStore)(
3505
+ const detected = (0, import_react26.useSyncExternalStore)(
3340
3506
  subscribe,
3341
3507
  () => getSnapshot(attribute),
3342
3508
  getServerSnapshot
@@ -3353,11 +3519,11 @@ function useResolvedColor(value, scheme) {
3353
3519
  __reExport(color_exports, require("@pixerate/editor/color"));
3354
3520
 
3355
3521
  // src/parameters/controls.tsx
3356
- var import_react26 = require("react");
3357
- var import_jsx_runtime26 = require("react/jsx-runtime");
3358
- var ParameterComponentsContext = (0, import_react26.createContext)({});
3522
+ var import_react27 = require("react");
3523
+ var import_jsx_runtime27 = require("react/jsx-runtime");
3524
+ var ParameterComponentsContext = (0, import_react27.createContext)({});
3359
3525
  function useParameterComponents() {
3360
- return (0, import_react26.useContext)(ParameterComponentsContext);
3526
+ return (0, import_react27.useContext)(ParameterComponentsContext);
3361
3527
  }
3362
3528
  function resolveParameterComponents(explicit, context) {
3363
3529
  return {
@@ -3369,7 +3535,7 @@ function resolveParameterComponents(explicit, context) {
3369
3535
  }
3370
3536
 
3371
3537
  // src/parameters/fields.tsx
3372
- var import_jsx_runtime27 = require("react/jsx-runtime");
3538
+ var import_jsx_runtime28 = require("react/jsx-runtime");
3373
3539
  var parameterInputStyle = import_parameters.parameterThemeStyles.input;
3374
3540
  var parameterSelectStyle = import_parameters.parameterThemeStyles.select;
3375
3541
  var parameterButtonStyle = import_parameters.parameterThemeStyles.button;
@@ -3378,9 +3544,9 @@ var parameterInputClass = "h-7 w-full min-w-0 rounded-md border border-input bg-
3378
3544
  var parameterButtonClass = "inline-flex h-7 items-center justify-center gap-1 rounded-md border border-input bg-background px-2 text-xs text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:pointer-events-none disabled:opacity-50";
3379
3545
  var rangeClass = "h-4 w-full min-w-0 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50";
3380
3546
  function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown, style, ...rest }) {
3381
- const inputRef = (0, import_react27.useRef)(null);
3382
- const lastCommitted = (0, import_react27.useRef)(null);
3383
- (0, import_react27.useLayoutEffect)(() => {
3547
+ const inputRef = (0, import_react28.useRef)(null);
3548
+ const lastCommitted = (0, import_react28.useRef)(null);
3549
+ (0, import_react28.useLayoutEffect)(() => {
3384
3550
  lastCommitted.current = null;
3385
3551
  const el = inputRef.current;
3386
3552
  if (el && el.value !== value) el.value = value;
@@ -3391,9 +3557,9 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
3391
3557
  onCommit(text, el);
3392
3558
  lastCommitted.current = el.value === text ? text : null;
3393
3559
  };
3394
- const commitRef = (0, import_react27.useRef)(commit);
3560
+ const commitRef = (0, import_react28.useRef)(commit);
3395
3561
  commitRef.current = commit;
3396
- (0, import_react27.useEffect)(() => {
3562
+ (0, import_react28.useEffect)(() => {
3397
3563
  const el = inputRef.current;
3398
3564
  if (!el) return;
3399
3565
  const change = () => commitRef.current(el);
@@ -3424,7 +3590,7 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
3424
3590
  if (typeof forwarded === "function") forwarded(el);
3425
3591
  else if (forwarded) forwarded.current = el;
3426
3592
  };
3427
- return multiline ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("textarea", { ...props, ref: setRef, className: `${props.className} h-auto min-h-[3.5rem] py-1` }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("input", { type: "text", ...props, ref: setRef });
3593
+ return multiline ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("textarea", { ...props, ref: setRef, className: `${props.className} h-auto min-h-[3.5rem] py-1` }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("input", { type: "text", ...props, ref: setRef });
3428
3594
  }
3429
3595
  var plainNumber = (field, value) => (0, import_parameters.formatParameterNumber)({ ...field, unit: void 0 }, value);
3430
3596
  function ParameterNumberInput(props) {
@@ -3458,9 +3624,9 @@ function ParameterNumberInput(props) {
3458
3624
  onCommit: handleCommit,
3459
3625
  onKeyDown: handleKeyDown
3460
3626
  };
3461
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
3462
- CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field) }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterCommitInput, { ...inputProps }),
3463
- field.unit && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
3627
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
3628
+ CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field) }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterCommitInput, { ...inputProps }),
3629
+ field.unit && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
3464
3630
  ] });
3465
3631
  }
3466
3632
  function ParameterSlider(props) {
@@ -3468,7 +3634,7 @@ function ParameterSlider(props) {
3468
3634
  const ctx = useParameterComponents();
3469
3635
  const resolved = resolveParameterComponents(components, ctx);
3470
3636
  const CustomSlider = resolved.slider;
3471
- const dragging = (0, import_react27.useRef)(false);
3637
+ const dragging = (0, import_react28.useRef)(false);
3472
3638
  const start = () => {
3473
3639
  if (dragging.current) return;
3474
3640
  dragging.current = true;
@@ -3479,7 +3645,7 @@ function ParameterSlider(props) {
3479
3645
  dragging.current = false;
3480
3646
  onGestureEnd?.();
3481
3647
  };
3482
- if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterNumberInput, { ...props });
3648
+ if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterNumberInput, { ...props });
3483
3649
  const step = (0, import_parameters.parameterStep)(field);
3484
3650
  const sliderProps = {
3485
3651
  "aria-label": (0, import_parameters.parameterLabel)(field),
@@ -3493,8 +3659,8 @@ function ParameterSlider(props) {
3493
3659
  className: rangeClass,
3494
3660
  style: parameterRangeStyle
3495
3661
  };
3496
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-2", children: [
3497
- CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3662
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-2", children: [
3663
+ CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3498
3664
  CustomSlider,
3499
3665
  {
3500
3666
  ...sliderProps,
@@ -3504,7 +3670,7 @@ function ParameterSlider(props) {
3504
3670
  onGestureStart: start,
3505
3671
  onGestureEnd: end
3506
3672
  }
3507
- ) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3673
+ ) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3508
3674
  "input",
3509
3675
  {
3510
3676
  type: "range",
@@ -3516,11 +3682,11 @@ function ParameterSlider(props) {
3516
3682
  onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field, Number(e.target.value)))
3517
3683
  }
3518
3684
  ),
3519
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
3685
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
3520
3686
  ] });
3521
3687
  }
3522
3688
  function ParameterToggle({ field, value, onChange, disabled, id }) {
3523
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3689
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3524
3690
  "button",
3525
3691
  {
3526
3692
  type: "button",
@@ -3531,7 +3697,7 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
3531
3697
  disabled: disabled || field.readOnly,
3532
3698
  onClick: () => onChange(!value),
3533
3699
  className: `relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:opacity-50 ${value ? "bg-primary" : "bg-muted"}`,
3534
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3700
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3535
3701
  "span",
3536
3702
  {
3537
3703
  className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
@@ -3548,7 +3714,7 @@ function ParameterSelect(props) {
3548
3714
  const options = (0, import_parameters.getChoiceOptions)(field);
3549
3715
  const off = disabled || field.readOnly;
3550
3716
  if (field.control === "segmented") {
3551
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { role: "radiogroup", "aria-label": (0, import_parameters.parameterLabel)(field), className: "inline-flex flex-wrap rounded-md border border-input bg-muted p-0.5", children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3717
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { role: "radiogroup", "aria-label": (0, import_parameters.parameterLabel)(field), className: "inline-flex flex-wrap rounded-md border border-input bg-muted p-0.5", children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3552
3718
  "button",
3553
3719
  {
3554
3720
  type: "button",
@@ -3565,7 +3731,7 @@ function ParameterSelect(props) {
3565
3731
  }
3566
3732
  if (CustomSelect) {
3567
3733
  const customOptions = options.map((o) => ({ value: o.value, label: (0, import_parameters.choiceOptionLabel)(o), description: o.description }));
3568
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3734
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3569
3735
  CustomSelect,
3570
3736
  {
3571
3737
  id,
@@ -3581,7 +3747,7 @@ function ParameterSelect(props) {
3581
3747
  );
3582
3748
  }
3583
3749
  const index = options.findIndex((o) => o.value === value);
3584
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3750
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3585
3751
  "select",
3586
3752
  {
3587
3753
  id,
@@ -3594,23 +3760,23 @@ function ParameterSelect(props) {
3594
3760
  },
3595
3761
  className: parameterInputClass,
3596
3762
  style: parameterSelectStyle,
3597
- children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: String(i), title: o.description, style: parameterSelectStyle, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
3763
+ children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: String(i), title: o.description, style: parameterSelectStyle, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
3598
3764
  }
3599
3765
  );
3600
3766
  }
3601
3767
  function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id, components }) {
3602
3768
  const CustomColor = resolveParameterComponents(components, useParameterComponents()).color;
3603
- const [open, setOpen] = (0, import_react27.useState)(false);
3604
- const containerRef = (0, import_react27.useRef)(null);
3605
- const buttonRef = (0, import_react27.useRef)(null);
3606
- const popoverRef = (0, import_react27.useRef)(null);
3769
+ const [open, setOpen] = (0, import_react28.useState)(false);
3770
+ const containerRef = (0, import_react28.useRef)(null);
3771
+ const buttonRef = (0, import_react28.useRef)(null);
3772
+ const popoverRef = (0, import_react28.useRef)(null);
3607
3773
  const alpha = !!field.alpha;
3608
3774
  const hex = (0, import_parameters.normalizeHexColor)(value, true) ?? "#000000ff";
3609
3775
  const rgb = hex.slice(0, 7);
3610
3776
  const shown = alpha ? hex : rgb;
3611
3777
  const off = disabled || field.readOnly;
3612
3778
  const name = (0, import_parameters.parameterLabel)(field);
3613
- (0, import_react27.useEffect)(() => {
3779
+ (0, import_react28.useEffect)(() => {
3614
3780
  if (!open) return;
3615
3781
  const onPointerDown = (e) => {
3616
3782
  if (containerRef.current && !containerRef.current.contains(e.target)) {
@@ -3632,7 +3798,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3632
3798
  };
3633
3799
  }, [open]);
3634
3800
  if (CustomColor) {
3635
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3801
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3636
3802
  CustomColor,
3637
3803
  {
3638
3804
  id,
@@ -3647,9 +3813,9 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3647
3813
  }
3648
3814
  );
3649
3815
  }
3650
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
3651
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-2", children: [
3652
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3816
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
3817
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-2", children: [
3818
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3653
3819
  "button",
3654
3820
  {
3655
3821
  ref: buttonRef,
@@ -3660,10 +3826,10 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3660
3826
  disabled: off,
3661
3827
  onClick: () => setOpen((prev) => !prev),
3662
3828
  className: "relative h-7 w-9 shrink-0 overflow-hidden rounded-md border border-input bg-[repeating-conic-gradient(#d4d4d8_0_25%,#fff_0_50%)] bg-[length:8px_8px] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50",
3663
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
3829
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
3664
3830
  }
3665
3831
  ),
3666
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3832
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3667
3833
  ParameterCommitInput,
3668
3834
  {
3669
3835
  id,
@@ -3679,7 +3845,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3679
3845
  }
3680
3846
  )
3681
3847
  ] }),
3682
- open && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3848
+ open && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3683
3849
  "div",
3684
3850
  {
3685
3851
  ref: popoverRef,
@@ -3693,7 +3859,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3693
3859
  },
3694
3860
  className: "absolute left-0 top-full z-50 mt-1 w-64 rounded-lg border border-border bg-popover p-2 text-popover-foreground shadow-xl",
3695
3861
  style: { background: "var(--popover, var(--background, #fff))" },
3696
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3862
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3697
3863
  ColorPicker,
3698
3864
  {
3699
3865
  value: shown,
@@ -3711,11 +3877,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3711
3877
  }
3712
3878
  function ParameterVector({ field, value, onChange, disabled, id, components }) {
3713
3879
  const size = (0, import_parameters.vectorSize)(field);
3714
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
3880
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
3715
3881
  const component = (0, import_parameters.vectorComponentField)(field, i);
3716
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
3717
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
3718
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3882
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
3883
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
3884
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3719
3885
  ParameterNumberInput,
3720
3886
  {
3721
3887
  field: component,
@@ -3733,11 +3899,11 @@ function ParameterVector({ field, value, onChange, disabled, id, components }) {
3733
3899
  function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3734
3900
  const off = disabled || field.readOnly;
3735
3901
  const name = (0, import_parameters.parameterLabel)(field);
3736
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "space-y-1.5", children: [
3737
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-2", children: [
3738
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex h-12 w-16 shrink-0 items-center justify-center overflow-hidden rounded-md border border-input bg-muted", children: value ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
3739
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
3740
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3902
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "space-y-1.5", children: [
3903
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-2", children: [
3904
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex h-12 w-16 shrink-0 items-center justify-center overflow-hidden rounded-md border border-input bg-muted", children: value ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
3905
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
3906
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3741
3907
  ParameterCommitInput,
3742
3908
  {
3743
3909
  id,
@@ -3748,15 +3914,15 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3748
3914
  onCommit: (text) => onChange(text.trim())
3749
3915
  }
3750
3916
  ),
3751
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex gap-1", children: [
3752
- resolveFile && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3917
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex gap-1", children: [
3918
+ resolveFile && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3753
3919
  "label",
3754
3920
  {
3755
3921
  style: parameterButtonStyle,
3756
3922
  className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`,
3757
3923
  children: [
3758
3924
  "Choose file\u2026",
3759
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3925
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3760
3926
  "input",
3761
3927
  {
3762
3928
  type: "file",
@@ -3774,7 +3940,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3774
3940
  ]
3775
3941
  }
3776
3942
  ),
3777
- value && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3943
+ value && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3778
3944
  "button",
3779
3945
  {
3780
3946
  type: "button",
@@ -3789,7 +3955,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3789
3955
  ] })
3790
3956
  ] })
3791
3957
  ] }),
3792
- field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3958
+ field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3793
3959
  "button",
3794
3960
  {
3795
3961
  type: "button",
@@ -3799,14 +3965,14 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3799
3965
  disabled: off,
3800
3966
  onClick: () => onChange(o.url),
3801
3967
  className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
3802
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
3968
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
3803
3969
  },
3804
3970
  o.url
3805
3971
  )) })
3806
3972
  ] });
3807
3973
  }
3808
3974
  function ParameterText({ field, value, onChange, disabled, id }) {
3809
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3975
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3810
3976
  ParameterCommitInput,
3811
3977
  {
3812
3978
  id,
@@ -3825,24 +3991,24 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
3825
3991
  switch (field.type) {
3826
3992
  case "number":
3827
3993
  case "int":
3828
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
3994
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
3829
3995
  case "boolean":
3830
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
3996
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
3831
3997
  case "choice":
3832
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
3998
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
3833
3999
  case "color":
3834
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
4000
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
3835
4001
  case "vector":
3836
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
4002
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
3837
4003
  case "image":
3838
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
4004
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
3839
4005
  case "text":
3840
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterText, { field, value, onChange: set, ...rest });
4006
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ParameterText, { field, value, onChange: set, ...rest });
3841
4007
  }
3842
4008
  }
3843
4009
 
3844
4010
  // src/effects/EffectParameters.tsx
3845
- var import_jsx_runtime28 = require("react/jsx-runtime");
4011
+ var import_jsx_runtime29 = require("react/jsx-runtime");
3846
4012
  function EffectParameters({
3847
4013
  description,
3848
4014
  values,
@@ -3857,10 +4023,10 @@ function EffectParameters({
3857
4023
  className = "",
3858
4024
  components
3859
4025
  }) {
3860
- const fields = (0, import_react28.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
3861
- const idBase = (0, import_react28.useId)();
3862
- const gesture = import_react28.default.useRef(null);
3863
- const count = import_react28.default.useRef(0);
4026
+ const fields = (0, import_react29.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
4027
+ const idBase = (0, import_react29.useId)();
4028
+ const gesture = import_react29.default.useRef(null);
4029
+ const count = import_react29.default.useRef(0);
3864
4030
  const CustomPresetSelect = resolveParameterComponents(components, useParameterComponents()).select;
3865
4031
  const handlePresetSelect = (name) => {
3866
4032
  if (!name) return;
@@ -3871,8 +4037,8 @@ function EffectParameters({
3871
4037
  if (preset) onPreset({ ...description.defaults, ...preset.values });
3872
4038
  }
3873
4039
  };
3874
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
3875
- (onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4040
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
4041
+ (onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3876
4042
  CustomPresetSelect,
3877
4043
  {
3878
4044
  "aria-label": `${description.name} presets`,
@@ -3887,7 +4053,7 @@ function EffectParameters({
3887
4053
  ],
3888
4054
  onChange: (name) => handlePresetSelect(String(name))
3889
4055
  }
3890
- ) : /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4056
+ ) : /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3891
4057
  "select",
3892
4058
  {
3893
4059
  className: "w-full rounded border border-border px-1 py-0.5 text-xs",
@@ -3897,8 +4063,8 @@ function EffectParameters({
3897
4063
  disabled,
3898
4064
  onChange: (e) => handlePresetSelect(e.currentTarget.value),
3899
4065
  children: [
3900
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
3901
- description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
4066
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
4067
+ description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
3902
4068
  ]
3903
4069
  }
3904
4070
  )),
@@ -3908,14 +4074,14 @@ function EffectParameters({
3908
4074
  const keyed = keyframed?.has(field.id) ?? false;
3909
4075
  const value = (0, import_effects3.effectFieldValue)(field, values[field.id]);
3910
4076
  const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field.default);
3911
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
3912
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-1.5", children: [
3913
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
3914
- keyed && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
4077
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
4078
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-1.5", children: [
4079
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
4080
+ keyed && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
3915
4081
  renderControlAddon?.(field.id),
3916
- onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: "rounded px-1 text-[11px] text-muted-foreground hover:text-foreground", "aria-label": `Reset ${label}`, onClick: () => onReset(field.id), children: "\u21BA" })
4082
+ onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: "rounded px-1 text-[11px] text-muted-foreground hover:text-foreground", "aria-label": `Reset ${label}`, onClick: () => onReset(field.id), children: "\u21BA" })
3917
4083
  ] }),
3918
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4084
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3919
4085
  ParameterFieldControl,
3920
4086
  {
3921
4087
  field,
@@ -3930,15 +4096,15 @@ function EffectParameters({
3930
4096
  )
3931
4097
  ] }, field.id);
3932
4098
  }),
3933
- !fields.length && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
4099
+ !fields.length && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
3934
4100
  ] });
3935
4101
  }
3936
4102
 
3937
4103
  // src/paint-editor/PaintEffectsPanel.tsx
3938
- var import_jsx_runtime29 = require("react/jsx-runtime");
4104
+ var import_jsx_runtime30 = require("react/jsx-runtime");
3939
4105
  function usePaintEffectsProvider(controller) {
3940
- const [provider, setProvider] = (0, import_react29.useState)(controller.effectsProvider);
3941
- (0, import_react29.useEffect)(() => {
4106
+ const [provider, setProvider] = (0, import_react30.useState)(controller.effectsProvider);
4107
+ (0, import_react30.useEffect)(() => {
3942
4108
  setProvider(controller.effectsProvider);
3943
4109
  return controller.effects.subscribe(setProvider);
3944
4110
  }, [controller]);
@@ -3946,27 +4112,27 @@ function usePaintEffectsProvider(controller) {
3946
4112
  }
3947
4113
  function usePaintEffectsTools(registry, controller, options = {}) {
3948
4114
  const { id, namespace, readOnly, playbackSurface } = options;
3949
- (0, import_react29.useEffect)(() => {
4115
+ (0, import_react30.useEffect)(() => {
3950
4116
  if (!registry) return;
3951
- return registry.register((0, import_paint_editor14.createPaintEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
4117
+ return registry.register((0, import_paint_editor15.createPaintEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
3952
4118
  }, [registry, controller, id, namespace, readOnly, playbackSurface]);
3953
4119
  }
3954
4120
  function Controls({ provider, effect, name, values, apply }) {
3955
4121
  const { description, error } = useEffectDescription(provider, effect);
3956
- const drags = (0, import_react29.useRef)(/* @__PURE__ */ new Set());
3957
- if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
4122
+ const drags = (0, import_react30.useRef)(/* @__PURE__ */ new Set());
4123
+ if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
3958
4124
  'No effects provider: "',
3959
4125
  name ?? effect,
3960
4126
  '" is kept as it was drawn.'
3961
4127
  ] });
3962
- if (error) return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
3963
- if (!description) return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
4128
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
4129
+ if (!description) return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
3964
4130
  const commit = (gesture) => {
3965
4131
  if (!gesture || drags.current.has(gesture)) return !gesture;
3966
4132
  drags.current.add(gesture);
3967
4133
  return true;
3968
4134
  };
3969
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4135
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3970
4136
  EffectParameters,
3971
4137
  {
3972
4138
  description,
@@ -3988,8 +4154,8 @@ var PaintEffectsPanel = ({ controller, className }) => {
3988
4154
  const state = usePaintEditorState(controller);
3989
4155
  const provider = usePaintEffectsProvider(controller);
3990
4156
  const [error, attempt] = useAttempt();
3991
- const [browse, setBrowse] = (0, import_react29.useState)(null);
3992
- const [busy, setBusy] = (0, import_react29.useState)(false);
4157
+ const [browse, setBrowse] = (0, import_react30.useState)(null);
4158
+ const [busy, setBusy] = (0, import_react30.useState)(false);
3993
4159
  const paper = controller.getPaperEffect();
3994
4160
  const activeId = state.document.activeLayerId;
3995
4161
  const layerEffect = activeId ? controller.getEffectLayer(activeId) : void 0;
@@ -4003,7 +4169,7 @@ var PaintEffectsPanel = ({ controller, className }) => {
4003
4169
  if (!effectPaint) return;
4004
4170
  run(() => controller.setEffectPaint({ effect: effectPaint.effect, values: effectPaint.values, time: effectPaint.time, map: effectPaint.map, live: effectPaint.live, ...patch }));
4005
4171
  };
4006
- const thumbnail = (0, import_react29.useMemo)(() => effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(48) : null, [controller, effectPaint, state.effectPaintRendering]);
4172
+ const thumbnail = (0, import_react30.useMemo)(() => effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(48) : null, [controller, effectPaint, state.effectPaintRendering]);
4007
4173
  const run = (work) => attempt(() => {
4008
4174
  setBusy(true);
4009
4175
  return work().finally(() => setBusy(false));
@@ -4019,28 +4185,28 @@ var PaintEffectsPanel = ({ controller, className }) => {
4019
4185
  };
4020
4186
  const toggle = (b) => setBrowse(browse === b ? null : b);
4021
4187
  const pixel = active?.type === "pixel";
4022
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
4023
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
4024
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
4025
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
4026
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
4027
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
4028
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "light", onClick: () => toggle("light"), title: "Bake a light, glow or grade into the active layer's dried paint", children: "Light\u2026" }),
4029
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paint", onClick: () => toggle("paint"), title: "Paint with an effect: brushes take each pixel's colour from it", children: "Paint\u2026" })
4188
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
4189
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
4190
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
4191
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
4192
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
4193
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
4194
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "light", onClick: () => toggle("light"), title: "Bake a light, glow or grade into the active layer's dried paint", children: "Light\u2026" }),
4195
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paint", onClick: () => toggle("paint"), title: "Paint with an effect: brushes take each pixel's colour from it", children: "Paint\u2026" })
4030
4196
  ] }),
4031
- !provider && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
4032
- browse && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
4033
- paper && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
4034
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-1", children: [
4035
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex-1 truncate", children: [
4197
+ !provider && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
4198
+ browse && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
4199
+ paper && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
4200
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-1", children: [
4201
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex-1 truncate", children: [
4036
4202
  "Paper: ",
4037
4203
  paper.name ?? paper.effect
4038
4204
  ] }),
4039
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
4205
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
4040
4206
  ] }),
4041
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
4042
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
4043
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4207
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
4208
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
4209
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4044
4210
  "input",
4045
4211
  {
4046
4212
  type: "range",
@@ -4062,43 +4228,43 @@ var PaintEffectsPanel = ({ controller, className }) => {
4062
4228
  `o${paper.opacity}`
4063
4229
  )
4064
4230
  ] }),
4065
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
4066
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
4067
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("select", { className: "flex-1 rounded bg-slate-800 px-1 py-0.5 text-[11px]", "aria-label": "Effect paper blend", value: paper.blend, onChange: (e) => {
4231
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
4232
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
4233
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("select", { className: "flex-1 rounded bg-slate-800 px-1 py-0.5 text-[11px]", "aria-label": "Effect paper blend", value: paper.blend, onChange: (e) => {
4068
4234
  const blend = e.currentTarget.value;
4069
4235
  run(() => controller.updatePaperEffect({ blend }));
4070
- }, children: import_paint_editor14.PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: b, children: b }, b)) })
4236
+ }, children: import_paint_editor15.PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: b, children: b }, b)) })
4071
4237
  ] }),
4072
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
4238
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
4073
4239
  ] }),
4074
- effectPaint && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paint", children: [
4075
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-1", children: [
4076
- thumbnail ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("img", { src: thumbnail, alt: "", className: "h-5 w-8 rounded object-cover ring-1 ring-slate-700", "data-testid": "effect-paint-thumbnail" }) : null,
4077
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex-1 truncate", children: [
4240
+ effectPaint && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paint", children: [
4241
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-1", children: [
4242
+ thumbnail ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("img", { src: thumbnail, alt: "", className: "h-5 w-8 rounded object-cover ring-1 ring-slate-700", "data-testid": "effect-paint-thumbnail" }) : null,
4243
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex-1 truncate", children: [
4078
4244
  "Paint: ",
4079
4245
  effectPaint.effect,
4080
4246
  state.effectPaintRendering ? " (rendering\u2026)" : ""
4081
4247
  ] }),
4082
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
4248
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
4083
4249
  ] }),
4084
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
4085
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", title: "Lay the effect along each stroke instead of fixing it to the canvas", children: [
4086
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("input", { type: "checkbox", checked: effectPaint.map?.by === "stroke", onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
4250
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
4251
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", title: "Lay the effect along each stroke instead of fixing it to the canvas", children: [
4252
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "checkbox", checked: effectPaint.map?.by === "stroke", onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
4087
4253
  "Along the stroke"
4088
4254
  ] }),
4089
- hasPathControl && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", title: "Pass each stroke's centreline to the effect's own path control", children: [
4090
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("input", { type: "checkbox", checked: effectPaint.map?.by === "path", onChange: (e) => repaint({ map: e.target.checked ? { by: "path" } : { by: "canvas" } }) }),
4255
+ hasPathControl && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", title: "Pass each stroke's centreline to the effect's own path control", children: [
4256
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "checkbox", checked: effectPaint.map?.by === "path", onChange: (e) => repaint({ map: e.target.checked ? { by: "path" } : { by: "canvas" } }) }),
4091
4257
  "Along the stroke (native)"
4092
4258
  ] }),
4093
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
4094
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
4259
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
4260
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
4095
4261
  "Live"
4096
4262
  ] })
4097
4263
  ] }),
4098
- effectPaint.map?.by === "stroke" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
4099
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
4100
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-slate-400", children: "Length" }),
4101
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4264
+ effectPaint.map?.by === "stroke" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
4265
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
4266
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-slate-400", children: "Length" }),
4267
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4102
4268
  "input",
4103
4269
  {
4104
4270
  type: "number",
@@ -4112,56 +4278,56 @@ var PaintEffectsPanel = ({ controller, className }) => {
4112
4278
  effectPaint.map.length
4113
4279
  )
4114
4280
  ] }),
4115
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("select", { "aria-label": "Effect repeat", value: effectPaint.map.repeat, onChange: (e) => repaint({ map: { ...effectPaint.map, repeat: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: [
4116
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: "repeat", children: "Repeat" }),
4117
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: "mirror", children: "Mirror" }),
4118
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: "clamp", children: "Clamp" })
4281
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("select", { "aria-label": "Effect repeat", value: effectPaint.map.repeat, onChange: (e) => repaint({ map: { ...effectPaint.map, repeat: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: [
4282
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "repeat", children: "Repeat" }),
4283
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "mirror", children: "Mirror" }),
4284
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "clamp", children: "Clamp" })
4119
4285
  ] })
4120
4286
  ] }),
4121
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
4287
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
4122
4288
  ] }),
4123
- animation && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-2 rounded border border-slate-700 p-1", "data-effect-part": "playback", children: [
4124
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex-1 truncate", children: [
4289
+ animation && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-2 rounded border border-slate-700 p-1", "data-effect-part": "playback", children: [
4290
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex-1 truncate", children: [
4125
4291
  "Live paint: ",
4126
4292
  animation.strokes,
4127
4293
  " ",
4128
4294
  animation.strokes === 1 ? "stroke" : "strokes"
4129
4295
  ] }),
4130
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, "aria-pressed": playback.playing, onClick: () => attempt(() => controller.setEffectPlayback({ playing: !playback.playing })), children: playback.playing ? "Pause" : "Play" }),
4131
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
4132
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-slate-400", children: "fps" }),
4133
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("input", { type: "number", "aria-label": "Live paint frame rate", min: 1, max: 60, value: playback.fps, onChange: (e) => attempt(() => controller.setEffectPlayback({ fps: Math.round(Number(e.target.value)) })), className: "w-12 rounded bg-slate-800 px-1 py-0.5" })
4296
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button, "aria-pressed": playback.playing, onClick: () => attempt(() => controller.setEffectPlayback({ playing: !playback.playing })), children: playback.playing ? "Pause" : "Play" }),
4297
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-1", children: [
4298
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-slate-400", children: "fps" }),
4299
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "number", "aria-label": "Live paint frame rate", min: 1, max: 60, value: playback.fps, onChange: (e) => attempt(() => controller.setEffectPlayback({ fps: Math.round(Number(e.target.value)) })), className: "w-12 rounded bg-slate-800 px-1 py-0.5" })
4134
4300
  ] })
4135
4301
  ] }),
4136
- layerEffect && activeId && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "layer", children: [
4137
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-1", children: [
4138
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex-1 truncate", children: [
4302
+ layerEffect && activeId && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "layer", children: [
4303
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-1", children: [
4304
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "flex-1 truncate", children: [
4139
4305
  "Layer: ",
4140
4306
  layerEffect.name ?? layerEffect.effect
4141
4307
  ] }),
4142
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
4308
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
4143
4309
  ] }),
4144
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
4310
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
4145
4311
  ] }),
4146
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ErrorLine, { error })
4312
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ErrorLine, { error })
4147
4313
  ] });
4148
4314
  };
4149
4315
 
4150
4316
  // src/paint-editor/PaintEditor.tsx
4151
- var import_jsx_runtime30 = require("react/jsx-runtime");
4317
+ var import_jsx_runtime31 = require("react/jsx-runtime");
4152
4318
  var PAINT_CONTROLS = {
4153
4319
  "mixing-pad": '[data-testid="mixing-pad"]',
4154
4320
  lighting: '[data-testid="light-panel"]',
4155
4321
  symmetry: '[aria-label="Symmetry"]'
4156
4322
  };
4157
4323
  var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, agentStrokes, className, playback, playbackId = "paint", onPlaybackReveal }) => {
4158
- const [tool, setTool] = (0, import_react30.useState)("brush");
4159
- const [fillOptions, setFillOptions] = (0, import_react30.useState)({ reference: "all", tolerance: 32, closeGap: 4, expand: 1, antialias: true });
4160
- const [tab, setTab] = (0, import_react30.useState)("color");
4161
- const tabRef = (0, import_react30.useRef)(tab);
4324
+ const [tool, setTool] = (0, import_react31.useState)("brush");
4325
+ const [fillOptions, setFillOptions] = (0, import_react31.useState)({ reference: "all", tolerance: 32, closeGap: 4, expand: 1, antialias: true });
4326
+ const [tab, setTab] = (0, import_react31.useState)("color");
4327
+ const tabRef = (0, import_react31.useRef)(tab);
4162
4328
  tabRef.current = tab;
4163
- const rootRef = (0, import_react30.useRef)(null);
4164
- const [ownPresence] = (0, import_react30.useState)(() => new import_paint_editor15.PaintPresence());
4329
+ const rootRef = (0, import_react31.useRef)(null);
4330
+ const [ownPresence] = (0, import_react31.useState)(() => new import_paint_editor16.PaintPresence());
4165
4331
  const ambientPlayback = useAgentPlayback();
4166
4332
  const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
4167
4333
  const viewBox = () => {
@@ -4172,12 +4338,12 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
4172
4338
  const docToClient = (p) => {
4173
4339
  const r = viewBox();
4174
4340
  if (!r) return null;
4175
- const q = (0, import_paint_editor15.documentToScreen)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x, p.y);
4341
+ const q = (0, import_paint_editor16.documentToScreen)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x, p.y);
4176
4342
  return { x: r.left + q.x, y: r.top + q.y };
4177
4343
  };
4178
4344
  const clientToDoc = (p) => {
4179
4345
  const r = viewBox();
4180
- return r ? (0, import_paint_editor15.screenToDocument)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x - r.left, p.y - r.top) : null;
4346
+ return r ? (0, import_paint_editor16.screenToDocument)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x - r.left, p.y - r.top) : null;
4181
4347
  };
4182
4348
  const elementRect = (selector) => {
4183
4349
  const r = rootRef.current?.querySelector(selector)?.getBoundingClientRect();
@@ -4217,29 +4383,30 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
4217
4383
  const box = rootRef.current?.getBoundingClientRect();
4218
4384
  return c && box ? { x: c.x - box.left, y: c.y - box.top } : p;
4219
4385
  };
4220
- const [error, setError] = (0, import_react30.useState)(null);
4386
+ const [error, setError] = (0, import_react31.useState)(null);
4221
4387
  const effects = usePaintEffectsProvider(controller);
4222
4388
  const tabs = effects ? ["color", "wet", "paper", "layers", "effects"] : ["color", "wet", "paper", "layers"];
4223
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { ref: rootRef, className: `relative flex flex-col gap-2 rounded-xl border border-slate-800 bg-slate-900 p-2 ${className ?? ""}`, style: { height }, "data-testid": "paint-editor", children: [
4224
- playing && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
4225
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PaintToolbar, { controller, tool, onToolChange: setTool, fillOptions, onFillOptionsChange: setFillOptions, fileName }),
4226
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex min-h-0 flex-1 gap-2", children: [
4227
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
4228
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
4229
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PaintCanvas, { controller, tool, fillOptions, onError: setError, presence: playing ? void 0 : presence, proposals, agentStrokes, className: "flex-1 rounded-lg" }),
4230
- error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
4389
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { ref: rootRef, className: `relative flex flex-col gap-2 rounded-xl border border-slate-800 bg-slate-900 p-2 ${className ?? ""}`, style: { height }, "data-testid": "paint-editor", children: [
4390
+ playing && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
4391
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PaintToolbar, { controller, tool, onToolChange: setTool, fillOptions, onFillOptionsChange: setFillOptions, fileName }),
4392
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex min-h-0 flex-1 gap-2", children: [
4393
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
4394
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
4395
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PaintCanvas, { controller, tool, fillOptions, onError: setError, presence: playing ? void 0 : presence, proposals, agentStrokes, className: "flex-1 rounded-lg" }),
4396
+ error && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
4231
4397
  ] }),
4232
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
4233
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex gap-1", role: "tablist", "aria-label": "Paint panels", children: tabs.map((t) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", role: "tab", "aria-selected": tab === t, "data-paint-tab": t, className: chip(tab === t), onClick: () => setTab(t), children: t === "color" ? "Colour" : t === "wet" ? "Wet" : t === "paper" ? "Paper" : t === "layers" ? "Layers" : "Effects" }, t)) }),
4234
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
4235
- tab === "color" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ColorPanel, { controller }),
4236
- tab === "wet" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(WetPanel, { controller }),
4237
- tab === "paper" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PaperPanel, { controller }),
4238
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PaintLayersPanel, { controller }),
4239
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(StrokePanel, { controller }),
4240
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PathStrokePanel, { controller }),
4241
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(StickerPanel, { controller }),
4242
- tab === "effects" && effects && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PaintEffectsPanel, { controller })
4398
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
4399
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex gap-1", role: "tablist", "aria-label": "Paint panels", children: tabs.map((t) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", role: "tab", "aria-selected": tab === t, "data-paint-tab": t, className: chip(tab === t), onClick: () => setTab(t), children: t === "color" ? "Colour" : t === "wet" ? "Wet" : t === "paper" ? "Paper" : t === "layers" ? "Layers" : "Effects" }, t)) }),
4400
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
4401
+ tab === "color" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ColorPanel, { controller }),
4402
+ tab === "wet" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(WetPanel, { controller }),
4403
+ tab === "paper" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PaperPanel, { controller }),
4404
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PaintLayersPanel, { controller }),
4405
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(StrokePanel, { controller }),
4406
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PathStrokePanel, { controller }),
4407
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(EvolutionPanel, { controller, proposals }),
4408
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(StickerPanel, { controller }),
4409
+ tab === "effects" && effects && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PaintEffectsPanel, { controller })
4243
4410
  ] })
4244
4411
  ] })
4245
4412
  ] })
@@ -4251,6 +4418,7 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
4251
4418
  BrushLibraryBrowser,
4252
4419
  BrushPanel,
4253
4420
  ColorPanel,
4421
+ EvolutionPanel,
4254
4422
  PaintCanvas,
4255
4423
  PaintEditor,
4256
4424
  PaintEffectsPanel,