@pixerate/editor-react 0.177.0 → 0.179.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.
@@ -45,6 +45,7 @@ __export(paint_editor_exports, {
45
45
  PaintSlider: () => PaintSlider,
46
46
  PaintToolbar: () => PaintToolbar,
47
47
  PaperPanel: () => PaperPanel,
48
+ PathStrokePanel: () => PathStrokePanel,
48
49
  StickerPanel: () => StickerPanel,
49
50
  StickerPicker: () => StickerPicker,
50
51
  StrokePanel: () => StrokePanel,
@@ -962,6 +963,7 @@ var import_react9 = require("react");
962
963
  var import_react8 = require("react");
963
964
  var import_stickers = require("@pixerate/editor/stickers");
964
965
  var import_jsx_runtime8 = require("react/jsx-runtime");
966
+ var tooltip = (it) => `${it.name} (${it.ref}) \xB7 ${it.licence.name}${it.licence.attribution ? ` \xB7 ${it.licence.attribution}` : ""}${it.aiGenerated ? " \xB7 AI-generated" : ""}${it.variants?.includes("dark") ? " \xB7 light and dark" : ""}`;
965
967
  var StickerLibraryPicker = ({ provider, selected = [], onPick, label = "Stickers", footer, className }) => {
966
968
  const browser = (0, import_react8.useMemo)(() => new import_stickers.StickerBrowser(() => provider), [provider]);
967
969
  const [, setTick] = (0, import_react8.useState)(0);
@@ -977,6 +979,15 @@ var StickerLibraryPicker = ({ provider, selected = [], onPick, label = "Stickers
977
979
  s.categories.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("select", { "aria-label": "Sticker category", value: s.category, onChange: (e) => void browser.setCategory(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: [
978
980
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "", children: "All" }),
979
981
  s.categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: c.id, children: c.name }, c.id))
982
+ ] }),
983
+ s.collections.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("select", { "aria-label": "Sticker collection", value: s.collection, onChange: (e) => void browser.setCollection(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: [
984
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "", children: "All collections" }),
985
+ s.collections.map((c) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("option", { value: c.id, title: c.description, children: [
986
+ c.name,
987
+ " (",
988
+ c.count,
989
+ ")"
990
+ ] }, c.id))
980
991
  ] })
981
992
  ] }),
982
993
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex max-h-32 flex-wrap gap-1 overflow-y-auto", role: "group", "aria-label": label, children: s.items.map((it) => {
@@ -986,12 +997,13 @@ var StickerLibraryPicker = ({ provider, selected = [], onPick, label = "Stickers
986
997
  {
987
998
  type: "button",
988
999
  "aria-pressed": on,
989
- title: `${it.name} (${it.ref}) \xB7 ${it.licence.name}${it.licence.attribution ? ` \xB7 ${it.licence.attribution}` : ""}`,
1000
+ title: tooltip(it),
990
1001
  className: `flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] ${on ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300"}`,
991
1002
  onClick: () => onPick(it),
992
1003
  children: [
993
1004
  it.thumbnail && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("img", { src: it.thumbnail, alt: "", className: "h-4 w-4" }),
994
- it.name
1005
+ it.name,
1006
+ it.aiGenerated && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "rounded bg-slate-700 px-0.5 text-[8px] text-slate-200", "aria-label": "AI-generated", children: "AI" })
995
1007
  ]
996
1008
  },
997
1009
  it.ref
@@ -1927,29 +1939,60 @@ var StrokePanel = ({ controller, className }) => {
1927
1939
  ] });
1928
1940
  };
1929
1941
 
1942
+ // src/paint-editor/PathStrokePanel.tsx
1943
+ var import_react16 = require("react");
1944
+ var import_paint_editor13 = require("@pixerate/editor/paint-editor");
1945
+ var import_jsx_runtime19 = require("react/jsx-runtime");
1946
+ var PathStrokePanel = ({ controller, className }) => {
1947
+ const state = usePaintEditorState(controller);
1948
+ const [error, attempt] = useAttempt();
1949
+ const [path, setPath] = (0, import_react16.useState)("");
1950
+ const [taper, setTaper] = (0, import_react16.useState)(import_paint_editor13.PATH_STROKE_TAPERS[0].id);
1951
+ const pressure = import_paint_editor13.PATH_STROKE_TAPERS.find((t) => t.id === taper)?.pressure;
1952
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "path-stroke-panel", children: [
1953
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "font-medium text-slate-300", children: "Brush a path" }),
1954
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1955
+ "textarea",
1956
+ {
1957
+ "aria-label": "SVG path data",
1958
+ placeholder: "M 40 200 C 120 40 280 40 360 200",
1959
+ value: path,
1960
+ onChange: (e) => setPath(e.target.value),
1961
+ rows: 2,
1962
+ className: "w-full resize-y rounded bg-slate-800 px-1 py-0.5 font-mono text-[11px]"
1963
+ }
1964
+ ),
1965
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
1966
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("select", { "aria-label": "Pressure along the path", value: taper, onChange: (e) => setTaper(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor13.PATH_STROKE_TAPERS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: t.id, children: t.label }, t.id)) }),
1967
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, disabled: !path.trim() || state.stroking, onClick: () => attempt(() => controller.strokePath({ path, ...pressure ? { pressure } : {} })), children: "Brush path" })
1968
+ ] }),
1969
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ErrorLine, { error })
1970
+ ] });
1971
+ };
1972
+
1930
1973
  // src/paint-editor/PaintEditor.tsx
1931
- var import_react29 = require("react");
1932
- var import_paint_editor14 = require("@pixerate/editor/paint-editor");
1974
+ var import_react30 = require("react");
1975
+ var import_paint_editor15 = require("@pixerate/editor/paint-editor");
1933
1976
 
1934
1977
  // src/playback/AgentPlaybackContext.tsx
1935
- var import_react16 = require("react");
1936
- var import_jsx_runtime19 = require("react/jsx-runtime");
1937
- var AgentPlaybackContext = (0, import_react16.createContext)(null);
1978
+ var import_react17 = require("react");
1979
+ var import_jsx_runtime20 = require("react/jsx-runtime");
1980
+ var AgentPlaybackContext = (0, import_react17.createContext)(null);
1938
1981
  function useAgentPlayback() {
1939
- return (0, import_react16.useContext)(AgentPlaybackContext);
1982
+ return (0, import_react17.useContext)(AgentPlaybackContext);
1940
1983
  }
1941
1984
 
1942
1985
  // src/playback/usePlaybackSurface.ts
1943
- var import_react17 = require("react");
1986
+ var import_react18 = require("react");
1944
1987
  var import_tools = require("@pixerate/editor/tools");
1945
1988
  function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
1946
1989
  const ambient = useAgentPlayback();
1947
1990
  const target = playback === void 0 ? ambient : playback;
1948
- const [ownPresence] = (0, import_react17.useState)(() => new import_tools.PresenceStore());
1991
+ const [ownPresence] = (0, import_react18.useState)(() => new import_tools.PresenceStore());
1949
1992
  const presence = sharedPresence ?? ownPresence;
1950
- const latest = (0, import_react17.useRef)(options);
1993
+ const latest = (0, import_react18.useRef)(options);
1951
1994
  latest.current = options;
1952
- (0, import_react17.useEffect)(() => {
1995
+ (0, import_react18.useEffect)(() => {
1953
1996
  if (!target || !id) return;
1954
1997
  const o = () => latest.current;
1955
1998
  const surface = {
@@ -1981,13 +2024,13 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
1981
2024
  }
1982
2025
 
1983
2026
  // src/playback/PresenceLayer.tsx
1984
- var import_react18 = __toESM(require("react"), 1);
1985
- var import_jsx_runtime20 = require("react/jsx-runtime");
2027
+ var import_react19 = __toESM(require("react"), 1);
2028
+ var import_jsx_runtime21 = require("react/jsx-runtime");
1986
2029
  function PresenceLayer({ presence, viewport, clip = true, renderCursor, className = "" }) {
1987
- const { actors } = (0, import_react18.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
2030
+ const { actors } = (0, import_react19.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
1988
2031
  if (!actors.length) return null;
1989
2032
  const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
1990
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2033
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1991
2034
  "div",
1992
2035
  {
1993
2036
  className: `pixerate-presence ${className}`.trim(),
@@ -2001,19 +2044,19 @@ function PresenceLayer({ presence, viewport, clip = true, renderCursor, classNam
2001
2044
  const br = map({ x: a.focus.x + a.focus.width, y: a.focus.y + a.focus.height });
2002
2045
  return { left: tl.x - 4, top: tl.y - 4, width: br.x - tl.x + 8, height: br.y - tl.y + 8 };
2003
2046
  })();
2004
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react18.default.Fragment, { children: [
2005
- ring && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2047
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react19.default.Fragment, { children: [
2048
+ ring && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2006
2049
  "div",
2007
2050
  {
2008
2051
  "data-actor-focus": a.id,
2009
2052
  style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
2010
2053
  }
2011
2054
  ),
2012
- /* @__PURE__ */ (0, import_jsx_runtime20.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_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
2013
- /* @__PURE__ */ (0, import_jsx_runtime20.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_runtime20.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 } }) }),
2014
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
2015
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
2016
- a.message && /* @__PURE__ */ (0, import_jsx_runtime20.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 })
2055
+ /* @__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: [
2056
+ /* @__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 } }) }),
2057
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
2058
+ /* @__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 }),
2059
+ 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 })
2017
2060
  ] })
2018
2061
  ] }) })
2019
2062
  ] }, a.id);
@@ -2023,15 +2066,15 @@ function PresenceLayer({ presence, viewport, clip = true, renderCursor, classNam
2023
2066
  }
2024
2067
 
2025
2068
  // src/paint-editor/PaintEffectsPanel.tsx
2026
- var import_react28 = require("react");
2027
- var import_paint_editor13 = require("@pixerate/editor/paint-editor");
2069
+ var import_react29 = require("react");
2070
+ var import_paint_editor14 = require("@pixerate/editor/paint-editor");
2028
2071
 
2029
2072
  // src/effects/useEffects.ts
2030
- var import_react19 = require("react");
2073
+ var import_react20 = require("react");
2031
2074
  function useEffectDescription(provider, effect) {
2032
- const [state, setState] = (0, import_react19.useState)({ key: "", description: null, error: null });
2075
+ const [state, setState] = (0, import_react20.useState)({ key: "", description: null, error: null });
2033
2076
  const key = provider && effect ? `${provider.id}:${effect}` : "";
2034
- (0, import_react19.useEffect)(() => {
2077
+ (0, import_react20.useEffect)(() => {
2035
2078
  if (!provider || !effect) return;
2036
2079
  let live = true;
2037
2080
  Promise.resolve().then(() => provider.describe(effect)).then(
@@ -2046,14 +2089,14 @@ function useEffectDescription(provider, effect) {
2046
2089
  }
2047
2090
 
2048
2091
  // src/effects/EffectThumbnail.tsx
2049
- var import_react20 = require("react");
2092
+ var import_react21 = require("react");
2050
2093
  var import_effects = require("@pixerate/editor/effects");
2051
- var import_jsx_runtime21 = require("react/jsx-runtime");
2094
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2052
2095
  var LABELS = { motion: "Motion", camera: "Camera", timing: "Timing" };
2053
2096
  function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
2054
- const ref = (0, import_react20.useRef)(null);
2055
- const [failed, setFailed] = (0, import_react20.useState)(effect.kind in LABELS);
2056
- (0, import_react20.useEffect)(() => {
2097
+ const ref = (0, import_react21.useRef)(null);
2098
+ const [failed, setFailed] = (0, import_react21.useState)(effect.kind in LABELS);
2099
+ (0, import_react21.useEffect)(() => {
2057
2100
  if (effect.kind in LABELS) return;
2058
2101
  let live = true;
2059
2102
  (0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
@@ -2068,28 +2111,28 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
2068
2111
  live = false;
2069
2112
  };
2070
2113
  }, [provider, effect, width, height]);
2071
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2114
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2072
2115
  "div",
2073
2116
  {
2074
2117
  className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
2075
2118
  style: { aspectRatio: `${width} / ${height}` },
2076
2119
  "data-effect-thumbnail": effect.id,
2077
- children: failed ? /* @__PURE__ */ (0, import_jsx_runtime21.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_runtime21.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
2120
+ 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" })
2078
2121
  }
2079
2122
  );
2080
2123
  }
2081
2124
 
2082
2125
  // src/effects/EffectsBrowser.tsx
2083
- var import_react21 = require("react");
2126
+ var import_react22 = require("react");
2084
2127
  var import_effects2 = require("@pixerate/editor/effects");
2085
- var import_jsx_runtime22 = require("react/jsx-runtime");
2128
+ var import_jsx_runtime23 = require("react/jsx-runtime");
2086
2129
  function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
2087
- const [all, setAll] = (0, import_react21.useState)([]);
2088
- const [query, setQuery] = (0, import_react21.useState)("");
2089
- const [category, setCategory] = (0, import_react21.useState)("");
2090
- const [use, setUse] = (0, import_react21.useState)("");
2091
- const [error, setError] = (0, import_react21.useState)(null);
2092
- (0, import_react21.useEffect)(() => {
2130
+ const [all, setAll] = (0, import_react22.useState)([]);
2131
+ const [query, setQuery] = (0, import_react22.useState)("");
2132
+ const [category, setCategory] = (0, import_react22.useState)("");
2133
+ const [use, setUse] = (0, import_react22.useState)("");
2134
+ const [error, setError] = (0, import_react22.useState)(null);
2135
+ (0, import_react22.useEffect)(() => {
2093
2136
  if (!provider) return setAll([]);
2094
2137
  let live = true;
2095
2138
  Promise.resolve().then(() => provider.list()).then(
@@ -2100,8 +2143,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2100
2143
  live = false;
2101
2144
  };
2102
2145
  }, [provider]);
2103
- const [found, setFound] = (0, import_react21.useState)([]);
2104
- (0, import_react21.useEffect)(() => {
2146
+ const [found, setFound] = (0, import_react22.useState)([]);
2147
+ (0, import_react22.useEffect)(() => {
2105
2148
  if (!provider) return setFound([]);
2106
2149
  let live = true;
2107
2150
  Promise.resolve().then(() => provider.search(query, { ...category ? { category } : {}, ...use ? { use } : {} })).then((list) => live && setFound(list), () => live && setFound([]));
@@ -2110,14 +2153,14 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2110
2153
  };
2111
2154
  }, [provider, query, category, use]);
2112
2155
  const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses);
2113
- const categories = (0, import_react21.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
2156
+ const categories = (0, import_react22.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
2114
2157
  const shown = found.filter(allowed);
2115
2158
  if (!provider)
2116
- return /* @__PURE__ */ (0, import_jsx_runtime22.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." });
2117
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
2118
- title && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h3", { className: "text-xs font-semibold", children: title }),
2119
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2120
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2159
+ 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." });
2160
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
2161
+ title && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h3", { className: "text-xs font-semibold", children: title }),
2162
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2163
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2121
2164
  "input",
2122
2165
  {
2123
2166
  type: "search",
@@ -2128,17 +2171,17 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2128
2171
  onChange: (e) => setQuery(e.currentTarget.value)
2129
2172
  }
2130
2173
  ),
2131
- /* @__PURE__ */ (0, import_jsx_runtime22.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: [
2132
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "", children: "All categories" }),
2133
- categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: c, children: c }, c))
2174
+ /* @__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: [
2175
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "", children: "All categories" }),
2176
+ categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: c, children: c }, c))
2134
2177
  ] }),
2135
- uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime22.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: [
2136
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "", children: "Any use" }),
2137
- uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
2178
+ 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: [
2179
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "", children: "Any use" }),
2180
+ uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
2138
2181
  ] })
2139
2182
  ] }),
2140
- error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
2141
- /* @__PURE__ */ (0, import_jsx_runtime22.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_runtime22.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2183
+ error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
2184
+ /* @__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)(
2142
2185
  "button",
2143
2186
  {
2144
2187
  type: "button",
@@ -2147,23 +2190,23 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2147
2190
  "data-effect-id": e.id,
2148
2191
  onClick: () => onPick(e),
2149
2192
  children: [
2150
- thumbnails && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EffectThumbnail, { provider, effect: e }),
2151
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
2152
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
2193
+ thumbnails && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(EffectThumbnail, { provider, effect: e }),
2194
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
2195
+ /* @__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 ") })
2153
2196
  ]
2154
2197
  }
2155
2198
  ) }, e.id)) }),
2156
- !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
2199
+ !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
2157
2200
  ] });
2158
2201
  }
2159
2202
 
2160
2203
  // src/effects/EffectParameters.tsx
2161
- var import_react27 = __toESM(require("react"), 1);
2204
+ var import_react28 = __toESM(require("react"), 1);
2162
2205
  var import_effects3 = require("@pixerate/editor/effects");
2163
2206
  var import_parameters2 = require("@pixerate/editor/parameters");
2164
2207
 
2165
2208
  // src/parameters/fields.tsx
2166
- var import_react26 = require("react");
2209
+ var import_react27 = require("react");
2167
2210
  var import_parameters = require("@pixerate/editor/parameters");
2168
2211
 
2169
2212
  // src/color/index.ts
@@ -2176,9 +2219,9 @@ __export(color_exports, {
2176
2219
  });
2177
2220
 
2178
2221
  // src/color/ColorPicker.tsx
2179
- var import_react22 = require("react");
2222
+ var import_react23 = require("react");
2180
2223
  var import_color = require("@pixerate/editor/color");
2181
- var import_jsx_runtime23 = require("react/jsx-runtime");
2224
+ var import_jsx_runtime24 = require("react/jsx-runtime");
2182
2225
  var LOCAL_STORAGE_KEY = "pixerate:color:recent";
2183
2226
  function readLocalRecents() {
2184
2227
  try {
@@ -2216,24 +2259,24 @@ var ColorPicker = ({
2216
2259
  id,
2217
2260
  "aria-label": ariaLabel = "Color picker"
2218
2261
  }) => {
2219
- const generatedId = (0, import_react22.useId)();
2262
+ const generatedId = (0, import_react23.useId)();
2220
2263
  const pickerId = id || generatedId;
2221
- const [pickerState, setPickerState] = (0, import_react22.useState)(
2264
+ const [pickerState, setPickerState] = (0, import_react23.useState)(
2222
2265
  () => (0, import_color.pickerStateFromColor)(value) ?? DEFAULT_PICKER_STATE
2223
2266
  );
2224
- const stateRef = (0, import_react22.useRef)(pickerState);
2267
+ const stateRef = (0, import_react23.useRef)(pickerState);
2225
2268
  stateRef.current = pickerState;
2226
- (0, import_react22.useEffect)(() => {
2269
+ (0, import_react23.useEffect)(() => {
2227
2270
  const next = (0, import_color.pickerStateFromColor)(value, stateRef.current);
2228
2271
  if (next) {
2229
2272
  setPickerState(next);
2230
2273
  }
2231
2274
  }, [value]);
2232
- const [internalRecent, setInternalRecent] = (0, import_react22.useState)(
2275
+ const [internalRecent, setInternalRecent] = (0, import_react23.useState)(
2233
2276
  () => controlledRecent ? [] : readLocalRecents()
2234
2277
  );
2235
2278
  const activeRecent = controlledRecent ?? internalRecent;
2236
- const recordRecent = (0, import_react22.useCallback)(
2279
+ const recordRecent = (0, import_react23.useCallback)(
2237
2280
  (color) => {
2238
2281
  const updated = (0, import_color.pushRecentColor)(activeRecent, color, 12);
2239
2282
  if (!controlledRecent) {
@@ -2244,11 +2287,11 @@ var ColorPicker = ({
2244
2287
  },
2245
2288
  [activeRecent, controlledRecent, onRecentChange]
2246
2289
  );
2247
- const [textDraft, setTextDraft] = (0, import_react22.useState)(value);
2248
- const [isInvalid, setIsInvalid] = (0, import_react22.useState)(false);
2249
- const [isClipped, setIsClipped] = (0, import_react22.useState)(false);
2250
- const isTypingRef = (0, import_react22.useRef)(false);
2251
- (0, import_react22.useEffect)(() => {
2290
+ const [textDraft, setTextDraft] = (0, import_react23.useState)(value);
2291
+ const [isInvalid, setIsInvalid] = (0, import_react23.useState)(false);
2292
+ const [isClipped, setIsClipped] = (0, import_react23.useState)(false);
2293
+ const isTypingRef = (0, import_react23.useRef)(false);
2294
+ (0, import_react23.useEffect)(() => {
2252
2295
  if (!isTypingRef.current) {
2253
2296
  setTextDraft(value);
2254
2297
  setIsInvalid(false);
@@ -2256,11 +2299,11 @@ var ColorPicker = ({
2256
2299
  setIsClipped(Boolean(parsed && !(0, import_color.inSrgbGamut)(parsed)));
2257
2300
  }
2258
2301
  }, [value]);
2259
- const [hasEyeDropper, setHasEyeDropper] = (0, import_react22.useState)(false);
2260
- (0, import_react22.useEffect)(() => {
2302
+ const [hasEyeDropper, setHasEyeDropper] = (0, import_react23.useState)(false);
2303
+ (0, import_react23.useEffect)(() => {
2261
2304
  setHasEyeDropper(typeof window !== "undefined" && "EyeDropper" in window);
2262
2305
  }, []);
2263
- const emitColorChange = (0, import_react22.useCallback)(
2306
+ const emitColorChange = (0, import_react23.useCallback)(
2264
2307
  (nextState) => {
2265
2308
  setPickerState(nextState);
2266
2309
  const hex = (0, import_color.pickerStateToHex)(nextState, alpha);
@@ -2268,10 +2311,10 @@ var ColorPicker = ({
2268
2311
  },
2269
2312
  [alpha, onChange]
2270
2313
  );
2271
- const latest = (0, import_react22.useRef)({ emitColorChange, recordRecent, onGestureEnd, alpha });
2314
+ const latest = (0, import_react23.useRef)({ emitColorChange, recordRecent, onGestureEnd, alpha });
2272
2315
  latest.current = { emitColorChange, recordRecent, onGestureEnd, alpha };
2273
- const endDragRef = (0, import_react22.useRef)(null);
2274
- (0, import_react22.useEffect)(() => () => endDragRef.current?.(), []);
2316
+ const endDragRef = (0, import_react23.useRef)(null);
2317
+ (0, import_react23.useEffect)(() => () => endDragRef.current?.(), []);
2275
2318
  const startDrag = (e, next) => {
2276
2319
  if (disabled) return;
2277
2320
  e.preventDefault();
@@ -2373,7 +2416,7 @@ var ColorPicker = ({
2373
2416
  } catch {
2374
2417
  }
2375
2418
  };
2376
- const contrastResult = (0, import_react22.useMemo)(() => {
2419
+ const contrastResult = (0, import_react23.useMemo)(() => {
2377
2420
  if (!contrastAgainst) return null;
2378
2421
  const fg = (0, import_color.parseColor)(value);
2379
2422
  const bg = (0, import_color.parseColor)(contrastAgainst);
@@ -2385,7 +2428,7 @@ var ColorPicker = ({
2385
2428
  }, [value, contrastAgainst]);
2386
2429
  const currentHex = (0, import_color.pickerStateToHex)(pickerState, alpha);
2387
2430
  const liveDescription = `Selected color: ${value}${contrastResult ? `, contrast ${contrastResult.ratio.toFixed(1)}:1 against ${contrastAgainst}, ${contrastResult.aa ? "passes AA" : "fails AA"}` : ""}`;
2388
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2431
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2389
2432
  "div",
2390
2433
  {
2391
2434
  id: pickerId,
@@ -2409,7 +2452,7 @@ var ColorPicker = ({
2409
2452
  pointerEvents: disabled ? "none" : "auto"
2410
2453
  },
2411
2454
  children: [
2412
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2455
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2413
2456
  "span",
2414
2457
  {
2415
2458
  role: "status",
@@ -2428,7 +2471,7 @@ var ColorPicker = ({
2428
2471
  children: liveDescription
2429
2472
  }
2430
2473
  ),
2431
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2474
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2432
2475
  "div",
2433
2476
  {
2434
2477
  role: "slider",
@@ -2450,7 +2493,7 @@ var ColorPicker = ({
2450
2493
  touchAction: "none",
2451
2494
  outline: "none"
2452
2495
  },
2453
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2496
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2454
2497
  "div",
2455
2498
  {
2456
2499
  style: {
@@ -2470,7 +2513,7 @@ var ColorPicker = ({
2470
2513
  )
2471
2514
  }
2472
2515
  ),
2473
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2516
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2474
2517
  "div",
2475
2518
  {
2476
2519
  role: "slider",
@@ -2493,7 +2536,7 @@ var ColorPicker = ({
2493
2536
  touchAction: "none",
2494
2537
  outline: "none"
2495
2538
  },
2496
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2539
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2497
2540
  "div",
2498
2541
  {
2499
2542
  style: {
@@ -2513,7 +2556,7 @@ var ColorPicker = ({
2513
2556
  )
2514
2557
  }
2515
2558
  ),
2516
- alpha && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2559
+ alpha && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2517
2560
  "div",
2518
2561
  {
2519
2562
  role: "slider",
@@ -2539,7 +2582,7 @@ var ColorPicker = ({
2539
2582
  overflow: "hidden"
2540
2583
  },
2541
2584
  children: [
2542
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2585
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2543
2586
  "div",
2544
2587
  {
2545
2588
  style: {
@@ -2549,7 +2592,7 @@ var ColorPicker = ({
2549
2592
  }
2550
2593
  }
2551
2594
  ),
2552
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2595
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2553
2596
  "div",
2554
2597
  {
2555
2598
  style: {
@@ -2570,8 +2613,8 @@ var ColorPicker = ({
2570
2613
  ]
2571
2614
  }
2572
2615
  ),
2573
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
2574
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2616
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
2617
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2575
2618
  "div",
2576
2619
  {
2577
2620
  style: {
@@ -2585,7 +2628,7 @@ var ColorPicker = ({
2585
2628
  flexShrink: 0,
2586
2629
  border: "1px solid rgba(255,255,255,0.15)"
2587
2630
  },
2588
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2631
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2589
2632
  "div",
2590
2633
  {
2591
2634
  style: {
@@ -2597,7 +2640,7 @@ var ColorPicker = ({
2597
2640
  )
2598
2641
  }
2599
2642
  ),
2600
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2643
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2601
2644
  "input",
2602
2645
  {
2603
2646
  type: "text",
@@ -2627,7 +2670,7 @@ var ColorPicker = ({
2627
2670
  }
2628
2671
  }
2629
2672
  ),
2630
- hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2673
+ hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2631
2674
  "button",
2632
2675
  {
2633
2676
  type: "button",
@@ -2647,7 +2690,7 @@ var ColorPicker = ({
2647
2690
  color: "inherit",
2648
2691
  cursor: disabled ? "default" : "pointer"
2649
2692
  },
2650
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2693
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2651
2694
  "svg",
2652
2695
  {
2653
2696
  width: "14",
@@ -2659,16 +2702,16 @@ var ColorPicker = ({
2659
2702
  strokeLinecap: "round",
2660
2703
  strokeLinejoin: "round",
2661
2704
  children: [
2662
- /* @__PURE__ */ (0, import_jsx_runtime23.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" }),
2663
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
2664
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "m14 6 4 4" })
2705
+ /* @__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" }),
2706
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
2707
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: "m14 6 4 4" })
2665
2708
  ]
2666
2709
  }
2667
2710
  )
2668
2711
  }
2669
2712
  )
2670
2713
  ] }),
2671
- isClipped && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2714
+ isClipped && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2672
2715
  "div",
2673
2716
  {
2674
2717
  role: "note",
@@ -2684,10 +2727,10 @@ var ColorPicker = ({
2684
2727
  borderRadius: "4px",
2685
2728
  alignSelf: "flex-start"
2686
2729
  },
2687
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
2730
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
2688
2731
  }
2689
2732
  ),
2690
- contrastResult && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2733
+ contrastResult && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2691
2734
  "div",
2692
2735
  {
2693
2736
  style: {
@@ -2701,15 +2744,15 @@ var ColorPicker = ({
2701
2744
  border: "1px solid rgba(255,255,255,0.1)"
2702
2745
  },
2703
2746
  children: [
2704
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { children: [
2747
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { children: [
2705
2748
  "Contrast: ",
2706
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("strong", { children: [
2749
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("strong", { children: [
2707
2750
  contrastResult.ratio.toFixed(2),
2708
2751
  ":1"
2709
2752
  ] })
2710
2753
  ] }),
2711
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
2712
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2754
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
2755
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2713
2756
  "span",
2714
2757
  {
2715
2758
  style: {
@@ -2722,7 +2765,7 @@ var ColorPicker = ({
2722
2765
  ]
2723
2766
  }
2724
2767
  ),
2725
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2768
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2726
2769
  "span",
2727
2770
  {
2728
2771
  style: {
@@ -2739,9 +2782,9 @@ var ColorPicker = ({
2739
2782
  ]
2740
2783
  }
2741
2784
  ),
2742
- swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2743
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
2744
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2785
+ swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2786
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
2787
+ /* @__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)(
2745
2788
  "button",
2746
2789
  {
2747
2790
  type: "button",
@@ -2767,9 +2810,9 @@ var ColorPicker = ({
2767
2810
  `${color}-${idx}`
2768
2811
  )) })
2769
2812
  ] }),
2770
- activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2771
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
2772
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2813
+ activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2814
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
2815
+ /* @__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)(
2773
2816
  "button",
2774
2817
  {
2775
2818
  type: "button",
@@ -2800,9 +2843,9 @@ var ColorPicker = ({
2800
2843
  };
2801
2844
 
2802
2845
  // src/color/DualColorPicker.tsx
2803
- var import_react23 = require("react");
2846
+ var import_react24 = require("react");
2804
2847
  var import_color2 = require("@pixerate/editor/color");
2805
- var import_jsx_runtime24 = require("react/jsx-runtime");
2848
+ var import_jsx_runtime25 = require("react/jsx-runtime");
2806
2849
  function DualColorPicker({
2807
2850
  value,
2808
2851
  onChange,
@@ -2817,8 +2860,8 @@ function DualColorPicker({
2817
2860
  disabled = false,
2818
2861
  className = ""
2819
2862
  }) {
2820
- const sameId = (0, import_react23.useId)();
2821
- const [internalScheme, setInternalScheme] = (0, import_react23.useState)("light");
2863
+ const sameId = (0, import_react24.useId)();
2864
+ const [internalScheme, setInternalScheme] = (0, import_react24.useState)("light");
2822
2865
  const activeScheme = controlledScheme ?? internalScheme;
2823
2866
  const handleSchemeSelect = (nextScheme) => {
2824
2867
  if (onSchemeChange) {
@@ -2829,7 +2872,7 @@ function DualColorPicker({
2829
2872
  };
2830
2873
  const dual = (0, import_color2.normalizeDualColor)(value) ?? { light: "#000000", dark: "#000000" };
2831
2874
  const isSame = dual.light.toLowerCase() === dual.dark.toLowerCase();
2832
- const [sameInBoth, setSameInBoth] = (0, import_react23.useState)(isSame);
2875
+ const [sameInBoth, setSameInBoth] = (0, import_react24.useState)(isSame);
2833
2876
  const handleSameToggle = (e) => {
2834
2877
  const nextSame = e.target.checked;
2835
2878
  setSameInBoth(nextSame);
@@ -2861,7 +2904,7 @@ function DualColorPicker({
2861
2904
  const activeColor = activeScheme === "dark" ? dual.dark : dual.light;
2862
2905
  const activeContrastTarget = contrastAgainst ? (0, import_color2.resolveColor)(contrastAgainst, activeScheme) ?? void 0 : void 0;
2863
2906
  const dualContrast = contrastAgainst && (0, import_color2.normalizeDualColor)(contrastAgainst) ? (0, import_color2.checkDualColorContrast)(dual, contrastAgainst) : null;
2864
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2907
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
2865
2908
  "div",
2866
2909
  {
2867
2910
  className: `pixerate-dual-color-picker ${className}`,
@@ -2880,7 +2923,7 @@ function DualColorPicker({
2880
2923
  boxSizing: "border-box"
2881
2924
  },
2882
2925
  children: [
2883
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2926
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
2884
2927
  "div",
2885
2928
  {
2886
2929
  role: "tablist",
@@ -2893,7 +2936,7 @@ function DualColorPicker({
2893
2936
  gap: "2px"
2894
2937
  },
2895
2938
  children: [
2896
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2939
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2897
2940
  "button",
2898
2941
  {
2899
2942
  type: "button",
@@ -2916,7 +2959,7 @@ function DualColorPicker({
2916
2959
  children: "Light"
2917
2960
  }
2918
2961
  ),
2919
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2962
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2920
2963
  "button",
2921
2964
  {
2922
2965
  type: "button",
@@ -2942,8 +2985,8 @@ function DualColorPicker({
2942
2985
  ]
2943
2986
  }
2944
2987
  ),
2945
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
2946
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2988
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
2989
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
2947
2990
  "button",
2948
2991
  {
2949
2992
  type: "button",
@@ -2965,7 +3008,7 @@ function DualColorPicker({
2965
3008
  outline: "none"
2966
3009
  },
2967
3010
  children: [
2968
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3011
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2969
3012
  "span",
2970
3013
  {
2971
3014
  style: {
@@ -2977,11 +3020,11 @@ function DualColorPicker({
2977
3020
  }
2978
3021
  }
2979
3022
  ),
2980
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
3023
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
2981
3024
  ]
2982
3025
  }
2983
3026
  ),
2984
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
3027
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
2985
3028
  "button",
2986
3029
  {
2987
3030
  type: "button",
@@ -3003,7 +3046,7 @@ function DualColorPicker({
3003
3046
  outline: "none"
3004
3047
  },
3005
3048
  children: [
3006
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3049
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3007
3050
  "span",
3008
3051
  {
3009
3052
  style: {
@@ -3015,12 +3058,12 @@ function DualColorPicker({
3015
3058
  }
3016
3059
  }
3017
3060
  ),
3018
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
3061
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
3019
3062
  ]
3020
3063
  }
3021
3064
  )
3022
3065
  ] }),
3023
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
3066
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3024
3067
  "div",
3025
3068
  {
3026
3069
  style: {
@@ -3031,7 +3074,7 @@ function DualColorPicker({
3031
3074
  padding: "2px 0"
3032
3075
  },
3033
3076
  children: [
3034
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
3077
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3035
3078
  "label",
3036
3079
  {
3037
3080
  htmlFor: sameId,
@@ -3045,7 +3088,7 @@ function DualColorPicker({
3045
3088
  color: "#c4cad4"
3046
3089
  },
3047
3090
  children: [
3048
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3091
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3049
3092
  "input",
3050
3093
  {
3051
3094
  id: sameId,
@@ -3056,11 +3099,11 @@ function DualColorPicker({
3056
3099
  style: { cursor: disabled ? "not-allowed" : "pointer" }
3057
3100
  }
3058
3101
  ),
3059
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "Same in both" })
3102
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "Same in both" })
3060
3103
  ]
3061
3104
  }
3062
3105
  ),
3063
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3106
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3064
3107
  "button",
3065
3108
  {
3066
3109
  type: "button",
@@ -3082,7 +3125,7 @@ function DualColorPicker({
3082
3125
  ]
3083
3126
  }
3084
3127
  ),
3085
- dualContrast && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
3128
+ dualContrast && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3086
3129
  "div",
3087
3130
  {
3088
3131
  "data-testid": "dual-contrast-summary",
@@ -3096,20 +3139,20 @@ function DualColorPicker({
3096
3139
  color: "#8c95a6"
3097
3140
  },
3098
3141
  children: [
3099
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { children: [
3142
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { children: [
3100
3143
  "Light:",
3101
3144
  " ",
3102
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3145
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3103
3146
  dualContrast.light.ratio.toFixed(2),
3104
3147
  " (",
3105
3148
  dualContrast.light.level,
3106
3149
  ")"
3107
3150
  ] })
3108
3151
  ] }),
3109
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { children: [
3152
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { children: [
3110
3153
  "Dark:",
3111
3154
  " ",
3112
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3155
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3113
3156
  dualContrast.dark.ratio.toFixed(2),
3114
3157
  " (",
3115
3158
  dualContrast.dark.level,
@@ -3119,7 +3162,7 @@ function DualColorPicker({
3119
3162
  ]
3120
3163
  }
3121
3164
  ),
3122
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3165
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3123
3166
  ColorPicker,
3124
3167
  {
3125
3168
  value: activeColor,
@@ -3138,7 +3181,7 @@ function DualColorPicker({
3138
3181
  }
3139
3182
 
3140
3183
  // src/color/useColorScheme.ts
3141
- var import_react24 = require("react");
3184
+ var import_react25 = require("react");
3142
3185
  var import_color3 = require("@pixerate/editor/color");
3143
3186
  function getSnapshot(attribute) {
3144
3187
  if (typeof window === "undefined" || typeof document === "undefined") {
@@ -3163,7 +3206,7 @@ function getServerSnapshot() {
3163
3206
  function useColorScheme(options) {
3164
3207
  const override = options?.override;
3165
3208
  const attribute = options?.attribute;
3166
- const subscribe = (0, import_react24.useMemo)(() => {
3209
+ const subscribe = (0, import_react25.useMemo)(() => {
3167
3210
  return (callback) => {
3168
3211
  if (typeof window === "undefined" || typeof document === "undefined") {
3169
3212
  return () => {
@@ -3189,7 +3232,7 @@ function useColorScheme(options) {
3189
3232
  };
3190
3233
  };
3191
3234
  }, [attribute]);
3192
- const detected = (0, import_react24.useSyncExternalStore)(
3235
+ const detected = (0, import_react25.useSyncExternalStore)(
3193
3236
  subscribe,
3194
3237
  () => getSnapshot(attribute),
3195
3238
  getServerSnapshot
@@ -3206,11 +3249,11 @@ function useResolvedColor(value, scheme) {
3206
3249
  __reExport(color_exports, require("@pixerate/editor/color"));
3207
3250
 
3208
3251
  // src/parameters/controls.tsx
3209
- var import_react25 = require("react");
3210
- var import_jsx_runtime25 = require("react/jsx-runtime");
3211
- var ParameterComponentsContext = (0, import_react25.createContext)({});
3252
+ var import_react26 = require("react");
3253
+ var import_jsx_runtime26 = require("react/jsx-runtime");
3254
+ var ParameterComponentsContext = (0, import_react26.createContext)({});
3212
3255
  function useParameterComponents() {
3213
- return (0, import_react25.useContext)(ParameterComponentsContext);
3256
+ return (0, import_react26.useContext)(ParameterComponentsContext);
3214
3257
  }
3215
3258
  function resolveParameterComponents(explicit, context) {
3216
3259
  return {
@@ -3222,7 +3265,7 @@ function resolveParameterComponents(explicit, context) {
3222
3265
  }
3223
3266
 
3224
3267
  // src/parameters/fields.tsx
3225
- var import_jsx_runtime26 = require("react/jsx-runtime");
3268
+ var import_jsx_runtime27 = require("react/jsx-runtime");
3226
3269
  var parameterInputStyle = import_parameters.parameterThemeStyles.input;
3227
3270
  var parameterSelectStyle = import_parameters.parameterThemeStyles.select;
3228
3271
  var parameterButtonStyle = import_parameters.parameterThemeStyles.button;
@@ -3231,9 +3274,9 @@ var parameterInputClass = "h-7 w-full min-w-0 rounded-md border border-input bg-
3231
3274
  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";
3232
3275
  var rangeClass = "h-4 w-full min-w-0 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50";
3233
3276
  function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown, style, ...rest }) {
3234
- const inputRef = (0, import_react26.useRef)(null);
3235
- const lastCommitted = (0, import_react26.useRef)(null);
3236
- (0, import_react26.useLayoutEffect)(() => {
3277
+ const inputRef = (0, import_react27.useRef)(null);
3278
+ const lastCommitted = (0, import_react27.useRef)(null);
3279
+ (0, import_react27.useLayoutEffect)(() => {
3237
3280
  lastCommitted.current = null;
3238
3281
  const el = inputRef.current;
3239
3282
  if (el && el.value !== value) el.value = value;
@@ -3244,9 +3287,9 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
3244
3287
  onCommit(text, el);
3245
3288
  lastCommitted.current = el.value === text ? text : null;
3246
3289
  };
3247
- const commitRef = (0, import_react26.useRef)(commit);
3290
+ const commitRef = (0, import_react27.useRef)(commit);
3248
3291
  commitRef.current = commit;
3249
- (0, import_react26.useEffect)(() => {
3292
+ (0, import_react27.useEffect)(() => {
3250
3293
  const el = inputRef.current;
3251
3294
  if (!el) return;
3252
3295
  const change = () => commitRef.current(el);
@@ -3277,7 +3320,7 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
3277
3320
  if (typeof forwarded === "function") forwarded(el);
3278
3321
  else if (forwarded) forwarded.current = el;
3279
3322
  };
3280
- return multiline ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("textarea", { ...props, ref: setRef, className: `${props.className} h-auto min-h-[3.5rem] py-1` }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "text", ...props, ref: setRef });
3323
+ 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 });
3281
3324
  }
3282
3325
  var plainNumber = (field, value) => (0, import_parameters.formatParameterNumber)({ ...field, unit: void 0 }, value);
3283
3326
  function ParameterNumberInput(props) {
@@ -3311,9 +3354,9 @@ function ParameterNumberInput(props) {
3311
3354
  onCommit: handleCommit,
3312
3355
  onKeyDown: handleKeyDown
3313
3356
  };
3314
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
3315
- CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field) }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ParameterCommitInput, { ...inputProps }),
3316
- field.unit && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
3357
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
3358
+ CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field) }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterCommitInput, { ...inputProps }),
3359
+ 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 })
3317
3360
  ] });
3318
3361
  }
3319
3362
  function ParameterSlider(props) {
@@ -3321,7 +3364,7 @@ function ParameterSlider(props) {
3321
3364
  const ctx = useParameterComponents();
3322
3365
  const resolved = resolveParameterComponents(components, ctx);
3323
3366
  const CustomSlider = resolved.slider;
3324
- const dragging = (0, import_react26.useRef)(false);
3367
+ const dragging = (0, import_react27.useRef)(false);
3325
3368
  const start = () => {
3326
3369
  if (dragging.current) return;
3327
3370
  dragging.current = true;
@@ -3332,7 +3375,7 @@ function ParameterSlider(props) {
3332
3375
  dragging.current = false;
3333
3376
  onGestureEnd?.();
3334
3377
  };
3335
- if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ParameterNumberInput, { ...props });
3378
+ if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterNumberInput, { ...props });
3336
3379
  const step = (0, import_parameters.parameterStep)(field);
3337
3380
  const sliderProps = {
3338
3381
  "aria-label": (0, import_parameters.parameterLabel)(field),
@@ -3346,8 +3389,8 @@ function ParameterSlider(props) {
3346
3389
  className: rangeClass,
3347
3390
  style: parameterRangeStyle
3348
3391
  };
3349
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-2", children: [
3350
- CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3392
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-2", children: [
3393
+ CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3351
3394
  CustomSlider,
3352
3395
  {
3353
3396
  ...sliderProps,
@@ -3357,7 +3400,7 @@ function ParameterSlider(props) {
3357
3400
  onGestureStart: start,
3358
3401
  onGestureEnd: end
3359
3402
  }
3360
- ) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3403
+ ) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3361
3404
  "input",
3362
3405
  {
3363
3406
  type: "range",
@@ -3369,11 +3412,11 @@ function ParameterSlider(props) {
3369
3412
  onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field, Number(e.target.value)))
3370
3413
  }
3371
3414
  ),
3372
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
3415
+ /* @__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` }) })
3373
3416
  ] });
3374
3417
  }
3375
3418
  function ParameterToggle({ field, value, onChange, disabled, id }) {
3376
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3419
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3377
3420
  "button",
3378
3421
  {
3379
3422
  type: "button",
@@ -3384,7 +3427,7 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
3384
3427
  disabled: disabled || field.readOnly,
3385
3428
  onClick: () => onChange(!value),
3386
3429
  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"}`,
3387
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3430
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3388
3431
  "span",
3389
3432
  {
3390
3433
  className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
@@ -3401,7 +3444,7 @@ function ParameterSelect(props) {
3401
3444
  const options = (0, import_parameters.getChoiceOptions)(field);
3402
3445
  const off = disabled || field.readOnly;
3403
3446
  if (field.control === "segmented") {
3404
- return /* @__PURE__ */ (0, import_jsx_runtime26.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_runtime26.jsx)(
3447
+ 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)(
3405
3448
  "button",
3406
3449
  {
3407
3450
  type: "button",
@@ -3418,7 +3461,7 @@ function ParameterSelect(props) {
3418
3461
  }
3419
3462
  if (CustomSelect) {
3420
3463
  const customOptions = options.map((o) => ({ value: o.value, label: (0, import_parameters.choiceOptionLabel)(o), description: o.description }));
3421
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3464
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3422
3465
  CustomSelect,
3423
3466
  {
3424
3467
  id,
@@ -3434,7 +3477,7 @@ function ParameterSelect(props) {
3434
3477
  );
3435
3478
  }
3436
3479
  const index = options.findIndex((o) => o.value === value);
3437
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3480
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3438
3481
  "select",
3439
3482
  {
3440
3483
  id,
@@ -3447,23 +3490,23 @@ function ParameterSelect(props) {
3447
3490
  },
3448
3491
  className: parameterInputClass,
3449
3492
  style: parameterSelectStyle,
3450
- children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: String(i), title: o.description, style: parameterSelectStyle, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
3493
+ 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)))
3451
3494
  }
3452
3495
  );
3453
3496
  }
3454
3497
  function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id, components }) {
3455
3498
  const CustomColor = resolveParameterComponents(components, useParameterComponents()).color;
3456
- const [open, setOpen] = (0, import_react26.useState)(false);
3457
- const containerRef = (0, import_react26.useRef)(null);
3458
- const buttonRef = (0, import_react26.useRef)(null);
3459
- const popoverRef = (0, import_react26.useRef)(null);
3499
+ const [open, setOpen] = (0, import_react27.useState)(false);
3500
+ const containerRef = (0, import_react27.useRef)(null);
3501
+ const buttonRef = (0, import_react27.useRef)(null);
3502
+ const popoverRef = (0, import_react27.useRef)(null);
3460
3503
  const alpha = !!field.alpha;
3461
3504
  const hex = (0, import_parameters.normalizeHexColor)(value, true) ?? "#000000ff";
3462
3505
  const rgb = hex.slice(0, 7);
3463
3506
  const shown = alpha ? hex : rgb;
3464
3507
  const off = disabled || field.readOnly;
3465
3508
  const name = (0, import_parameters.parameterLabel)(field);
3466
- (0, import_react26.useEffect)(() => {
3509
+ (0, import_react27.useEffect)(() => {
3467
3510
  if (!open) return;
3468
3511
  const onPointerDown = (e) => {
3469
3512
  if (containerRef.current && !containerRef.current.contains(e.target)) {
@@ -3485,7 +3528,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3485
3528
  };
3486
3529
  }, [open]);
3487
3530
  if (CustomColor) {
3488
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3531
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3489
3532
  CustomColor,
3490
3533
  {
3491
3534
  id,
@@ -3500,9 +3543,9 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3500
3543
  }
3501
3544
  );
3502
3545
  }
3503
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
3504
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-2", children: [
3505
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3546
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
3547
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-2", children: [
3548
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3506
3549
  "button",
3507
3550
  {
3508
3551
  ref: buttonRef,
@@ -3513,10 +3556,10 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3513
3556
  disabled: off,
3514
3557
  onClick: () => setOpen((prev) => !prev),
3515
3558
  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",
3516
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
3559
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
3517
3560
  }
3518
3561
  ),
3519
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3562
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3520
3563
  ParameterCommitInput,
3521
3564
  {
3522
3565
  id,
@@ -3532,7 +3575,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3532
3575
  }
3533
3576
  )
3534
3577
  ] }),
3535
- open && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3578
+ open && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3536
3579
  "div",
3537
3580
  {
3538
3581
  ref: popoverRef,
@@ -3546,7 +3589,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3546
3589
  },
3547
3590
  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",
3548
3591
  style: { background: "var(--popover, var(--background, #fff))" },
3549
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3592
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3550
3593
  ColorPicker,
3551
3594
  {
3552
3595
  value: shown,
@@ -3564,11 +3607,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3564
3607
  }
3565
3608
  function ParameterVector({ field, value, onChange, disabled, id, components }) {
3566
3609
  const size = (0, import_parameters.vectorSize)(field);
3567
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
3610
+ 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) => {
3568
3611
  const component = (0, import_parameters.vectorComponentField)(field, i);
3569
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
3570
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
3571
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3612
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
3613
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
3614
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3572
3615
  ParameterNumberInput,
3573
3616
  {
3574
3617
  field: component,
@@ -3586,11 +3629,11 @@ function ParameterVector({ field, value, onChange, disabled, id, components }) {
3586
3629
  function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3587
3630
  const off = disabled || field.readOnly;
3588
3631
  const name = (0, import_parameters.parameterLabel)(field);
3589
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "space-y-1.5", children: [
3590
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-2", children: [
3591
- /* @__PURE__ */ (0, import_jsx_runtime26.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_runtime26.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
3592
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
3593
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3632
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "space-y-1.5", children: [
3633
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-2", children: [
3634
+ /* @__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" }) }),
3635
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
3636
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3594
3637
  ParameterCommitInput,
3595
3638
  {
3596
3639
  id,
@@ -3601,15 +3644,15 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3601
3644
  onCommit: (text) => onChange(text.trim())
3602
3645
  }
3603
3646
  ),
3604
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex gap-1", children: [
3605
- resolveFile && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3647
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex gap-1", children: [
3648
+ resolveFile && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3606
3649
  "label",
3607
3650
  {
3608
3651
  style: parameterButtonStyle,
3609
3652
  className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`,
3610
3653
  children: [
3611
3654
  "Choose file\u2026",
3612
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3655
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3613
3656
  "input",
3614
3657
  {
3615
3658
  type: "file",
@@ -3627,7 +3670,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3627
3670
  ]
3628
3671
  }
3629
3672
  ),
3630
- value && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3673
+ value && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3631
3674
  "button",
3632
3675
  {
3633
3676
  type: "button",
@@ -3642,7 +3685,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3642
3685
  ] })
3643
3686
  ] })
3644
3687
  ] }),
3645
- field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3688
+ 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)(
3646
3689
  "button",
3647
3690
  {
3648
3691
  type: "button",
@@ -3652,14 +3695,14 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3652
3695
  disabled: off,
3653
3696
  onClick: () => onChange(o.url),
3654
3697
  className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
3655
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
3698
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
3656
3699
  },
3657
3700
  o.url
3658
3701
  )) })
3659
3702
  ] });
3660
3703
  }
3661
3704
  function ParameterText({ field, value, onChange, disabled, id }) {
3662
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3705
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3663
3706
  ParameterCommitInput,
3664
3707
  {
3665
3708
  id,
@@ -3678,24 +3721,24 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
3678
3721
  switch (field.type) {
3679
3722
  case "number":
3680
3723
  case "int":
3681
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
3724
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
3682
3725
  case "boolean":
3683
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
3726
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
3684
3727
  case "choice":
3685
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
3728
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
3686
3729
  case "color":
3687
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
3730
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
3688
3731
  case "vector":
3689
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
3732
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
3690
3733
  case "image":
3691
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
3734
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
3692
3735
  case "text":
3693
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ParameterText, { field, value, onChange: set, ...rest });
3736
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ParameterText, { field, value, onChange: set, ...rest });
3694
3737
  }
3695
3738
  }
3696
3739
 
3697
3740
  // src/effects/EffectParameters.tsx
3698
- var import_jsx_runtime27 = require("react/jsx-runtime");
3741
+ var import_jsx_runtime28 = require("react/jsx-runtime");
3699
3742
  function EffectParameters({
3700
3743
  description,
3701
3744
  values,
@@ -3710,10 +3753,10 @@ function EffectParameters({
3710
3753
  className = "",
3711
3754
  components
3712
3755
  }) {
3713
- const fields = (0, import_react27.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
3714
- const idBase = (0, import_react27.useId)();
3715
- const gesture = import_react27.default.useRef(null);
3716
- const count = import_react27.default.useRef(0);
3756
+ const fields = (0, import_react28.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
3757
+ const idBase = (0, import_react28.useId)();
3758
+ const gesture = import_react28.default.useRef(null);
3759
+ const count = import_react28.default.useRef(0);
3717
3760
  const CustomPresetSelect = resolveParameterComponents(components, useParameterComponents()).select;
3718
3761
  const handlePresetSelect = (name) => {
3719
3762
  if (!name) return;
@@ -3724,8 +3767,8 @@ function EffectParameters({
3724
3767
  if (preset) onPreset({ ...description.defaults, ...preset.values });
3725
3768
  }
3726
3769
  };
3727
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
3728
- (onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3770
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
3771
+ (onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3729
3772
  CustomPresetSelect,
3730
3773
  {
3731
3774
  "aria-label": `${description.name} presets`,
@@ -3740,7 +3783,7 @@ function EffectParameters({
3740
3783
  ],
3741
3784
  onChange: (name) => handlePresetSelect(String(name))
3742
3785
  }
3743
- ) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3786
+ ) : /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3744
3787
  "select",
3745
3788
  {
3746
3789
  className: "w-full rounded border border-border px-1 py-0.5 text-xs",
@@ -3750,8 +3793,8 @@ function EffectParameters({
3750
3793
  disabled,
3751
3794
  onChange: (e) => handlePresetSelect(e.currentTarget.value),
3752
3795
  children: [
3753
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
3754
- description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
3796
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
3797
+ description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
3755
3798
  ]
3756
3799
  }
3757
3800
  )),
@@ -3761,14 +3804,14 @@ function EffectParameters({
3761
3804
  const keyed = keyframed?.has(field.id) ?? false;
3762
3805
  const value = (0, import_effects3.effectFieldValue)(field, values[field.id]);
3763
3806
  const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field.default);
3764
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
3765
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-1.5", children: [
3766
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
3767
- keyed && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
3807
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
3808
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-1.5", children: [
3809
+ /* @__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 }),
3810
+ keyed && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
3768
3811
  renderControlAddon?.(field.id),
3769
- onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime27.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" })
3812
+ 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" })
3770
3813
  ] }),
3771
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3814
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3772
3815
  ParameterFieldControl,
3773
3816
  {
3774
3817
  field,
@@ -3783,15 +3826,15 @@ function EffectParameters({
3783
3826
  )
3784
3827
  ] }, field.id);
3785
3828
  }),
3786
- !fields.length && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
3829
+ !fields.length && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
3787
3830
  ] });
3788
3831
  }
3789
3832
 
3790
3833
  // src/paint-editor/PaintEffectsPanel.tsx
3791
- var import_jsx_runtime28 = require("react/jsx-runtime");
3834
+ var import_jsx_runtime29 = require("react/jsx-runtime");
3792
3835
  function usePaintEffectsProvider(controller) {
3793
- const [provider, setProvider] = (0, import_react28.useState)(controller.effectsProvider);
3794
- (0, import_react28.useEffect)(() => {
3836
+ const [provider, setProvider] = (0, import_react29.useState)(controller.effectsProvider);
3837
+ (0, import_react29.useEffect)(() => {
3795
3838
  setProvider(controller.effectsProvider);
3796
3839
  return controller.effects.subscribe(setProvider);
3797
3840
  }, [controller]);
@@ -3799,27 +3842,27 @@ function usePaintEffectsProvider(controller) {
3799
3842
  }
3800
3843
  function usePaintEffectsTools(registry, controller, options = {}) {
3801
3844
  const { id, namespace, readOnly, playbackSurface } = options;
3802
- (0, import_react28.useEffect)(() => {
3845
+ (0, import_react29.useEffect)(() => {
3803
3846
  if (!registry) return;
3804
- return registry.register((0, import_paint_editor13.createPaintEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
3847
+ return registry.register((0, import_paint_editor14.createPaintEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
3805
3848
  }, [registry, controller, id, namespace, readOnly, playbackSurface]);
3806
3849
  }
3807
3850
  function Controls({ provider, effect, name, values, apply }) {
3808
3851
  const { description, error } = useEffectDescription(provider, effect);
3809
- const drags = (0, import_react28.useRef)(/* @__PURE__ */ new Set());
3810
- if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
3852
+ const drags = (0, import_react29.useRef)(/* @__PURE__ */ new Set());
3853
+ if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
3811
3854
  'No effects provider: "',
3812
3855
  name ?? effect,
3813
3856
  '" is kept as it was drawn.'
3814
3857
  ] });
3815
- if (error) return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
3816
- if (!description) return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
3858
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
3859
+ if (!description) return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
3817
3860
  const commit = (gesture) => {
3818
3861
  if (!gesture || drags.current.has(gesture)) return !gesture;
3819
3862
  drags.current.add(gesture);
3820
3863
  return true;
3821
3864
  };
3822
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3865
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3823
3866
  EffectParameters,
3824
3867
  {
3825
3868
  description,
@@ -3841,8 +3884,8 @@ var PaintEffectsPanel = ({ controller, className }) => {
3841
3884
  const state = usePaintEditorState(controller);
3842
3885
  const provider = usePaintEffectsProvider(controller);
3843
3886
  const [error, attempt] = useAttempt();
3844
- const [browse, setBrowse] = (0, import_react28.useState)(null);
3845
- const [busy, setBusy] = (0, import_react28.useState)(false);
3887
+ const [browse, setBrowse] = (0, import_react29.useState)(null);
3888
+ const [busy, setBusy] = (0, import_react29.useState)(false);
3846
3889
  const paper = controller.getPaperEffect();
3847
3890
  const activeId = state.document.activeLayerId;
3848
3891
  const layerEffect = activeId ? controller.getEffectLayer(activeId) : void 0;
@@ -3854,7 +3897,7 @@ var PaintEffectsPanel = ({ controller, className }) => {
3854
3897
  if (!effectPaint) return;
3855
3898
  run(() => controller.setEffectPaint({ effect: effectPaint.effect, values: effectPaint.values, time: effectPaint.time, map: effectPaint.map, live: effectPaint.live, ...patch }));
3856
3899
  };
3857
- const thumbnail = (0, import_react28.useMemo)(() => effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(48) : null, [controller, effectPaint, state.effectPaintRendering]);
3900
+ const thumbnail = (0, import_react29.useMemo)(() => effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(48) : null, [controller, effectPaint, state.effectPaintRendering]);
3858
3901
  const run = (work) => attempt(() => {
3859
3902
  setBusy(true);
3860
3903
  return work().finally(() => setBusy(false));
@@ -3870,28 +3913,28 @@ var PaintEffectsPanel = ({ controller, className }) => {
3870
3913
  };
3871
3914
  const toggle = (b) => setBrowse(browse === b ? null : b);
3872
3915
  const pixel = active?.type === "pixel";
3873
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
3874
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
3875
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
3876
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
3877
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
3878
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
3879
- /* @__PURE__ */ (0, import_jsx_runtime28.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" }),
3880
- /* @__PURE__ */ (0, import_jsx_runtime28.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" })
3916
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
3917
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
3918
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
3919
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
3920
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
3921
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
3922
+ /* @__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" }),
3923
+ /* @__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" })
3881
3924
  ] }),
3882
- !provider && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
3883
- browse && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
3884
- paper && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
3885
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-1", children: [
3886
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "flex-1 truncate", children: [
3925
+ !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." }),
3926
+ browse && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
3927
+ 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: [
3928
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-1", children: [
3929
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex-1 truncate", children: [
3887
3930
  "Paper: ",
3888
3931
  paper.name ?? paper.effect
3889
3932
  ] }),
3890
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
3933
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
3891
3934
  ] }),
3892
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
3893
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
3894
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3935
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
3936
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
3937
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3895
3938
  "input",
3896
3939
  {
3897
3940
  type: "range",
@@ -3913,39 +3956,39 @@ var PaintEffectsPanel = ({ controller, className }) => {
3913
3956
  `o${paper.opacity}`
3914
3957
  )
3915
3958
  ] }),
3916
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
3917
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
3918
- /* @__PURE__ */ (0, import_jsx_runtime28.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) => {
3959
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
3960
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
3961
+ /* @__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) => {
3919
3962
  const blend = e.currentTarget.value;
3920
3963
  run(() => controller.updatePaperEffect({ blend }));
3921
- }, children: import_paint_editor13.PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: b, children: b }, b)) })
3964
+ }, children: import_paint_editor14.PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: b, children: b }, b)) })
3922
3965
  ] }),
3923
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
3966
+ /* @__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)) })
3924
3967
  ] }),
3925
- effectPaint && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paint", children: [
3926
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-1", children: [
3927
- thumbnail ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("img", { src: thumbnail, alt: "", className: "h-5 w-8 rounded object-cover ring-1 ring-slate-700", "data-testid": "effect-paint-thumbnail" }) : null,
3928
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "flex-1 truncate", children: [
3968
+ 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: [
3969
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-1", children: [
3970
+ 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,
3971
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex-1 truncate", children: [
3929
3972
  "Paint: ",
3930
3973
  effectPaint.effect,
3931
3974
  state.effectPaintRendering ? " (rendering\u2026)" : ""
3932
3975
  ] }),
3933
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
3976
+ /* @__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" })
3934
3977
  ] }),
3935
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
3936
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", title: "Lay the effect along each stroke instead of fixing it to the canvas", children: [
3937
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.map), onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
3978
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
3979
+ /* @__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: [
3980
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.map), onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
3938
3981
  "Along the stroke"
3939
3982
  ] }),
3940
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
3941
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
3983
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
3984
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
3942
3985
  "Live"
3943
3986
  ] })
3944
3987
  ] }),
3945
- effectPaint.map && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
3946
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
3947
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-slate-400", children: "Length" }),
3948
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3988
+ effectPaint.map && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
3989
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
3990
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-slate-400", children: "Length" }),
3991
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3949
3992
  "input",
3950
3993
  {
3951
3994
  type: "number",
@@ -3959,55 +4002,55 @@ var PaintEffectsPanel = ({ controller, className }) => {
3959
4002
  effectPaint.map.length
3960
4003
  )
3961
4004
  ] }),
3962
- /* @__PURE__ */ (0, import_jsx_runtime28.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: [
3963
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "repeat", children: "Repeat" }),
3964
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "mirror", children: "Mirror" }),
3965
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "clamp", children: "Clamp" })
4005
+ /* @__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: [
4006
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: "repeat", children: "Repeat" }),
4007
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: "mirror", children: "Mirror" }),
4008
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: "clamp", children: "Clamp" })
3966
4009
  ] })
3967
4010
  ] }),
3968
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
4011
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
3969
4012
  ] }),
3970
- animation && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-2 rounded border border-slate-700 p-1", "data-effect-part": "playback", children: [
3971
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "flex-1 truncate", children: [
4013
+ 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: [
4014
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex-1 truncate", children: [
3972
4015
  "Live paint: ",
3973
4016
  animation.strokes,
3974
4017
  " ",
3975
4018
  animation.strokes === 1 ? "stroke" : "strokes"
3976
4019
  ] }),
3977
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button, "aria-pressed": playback.playing, onClick: () => attempt(() => controller.setEffectPlayback({ playing: !playback.playing })), children: playback.playing ? "Pause" : "Play" }),
3978
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
3979
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-slate-400", children: "fps" }),
3980
- /* @__PURE__ */ (0, import_jsx_runtime28.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" })
4020
+ /* @__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" }),
4021
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
4022
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-slate-400", children: "fps" }),
4023
+ /* @__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" })
3981
4024
  ] })
3982
4025
  ] }),
3983
- layerEffect && activeId && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "layer", children: [
3984
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-1", children: [
3985
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "flex-1 truncate", children: [
4026
+ 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: [
4027
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-1", children: [
4028
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex-1 truncate", children: [
3986
4029
  "Layer: ",
3987
4030
  layerEffect.name ?? layerEffect.effect
3988
4031
  ] }),
3989
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
4032
+ /* @__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" })
3990
4033
  ] }),
3991
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
4034
+ /* @__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)) })
3992
4035
  ] }),
3993
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ErrorLine, { error })
4036
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ErrorLine, { error })
3994
4037
  ] });
3995
4038
  };
3996
4039
 
3997
4040
  // src/paint-editor/PaintEditor.tsx
3998
- var import_jsx_runtime29 = require("react/jsx-runtime");
4041
+ var import_jsx_runtime30 = require("react/jsx-runtime");
3999
4042
  var PAINT_CONTROLS = {
4000
4043
  "mixing-pad": '[data-testid="mixing-pad"]',
4001
4044
  lighting: '[data-testid="light-panel"]',
4002
4045
  symmetry: '[aria-label="Symmetry"]'
4003
4046
  };
4004
4047
  var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, agentStrokes, className, playback, playbackId = "paint", onPlaybackReveal }) => {
4005
- const [tool, setTool] = (0, import_react29.useState)("brush");
4006
- const [tab, setTab] = (0, import_react29.useState)("color");
4007
- const tabRef = (0, import_react29.useRef)(tab);
4048
+ const [tool, setTool] = (0, import_react30.useState)("brush");
4049
+ const [tab, setTab] = (0, import_react30.useState)("color");
4050
+ const tabRef = (0, import_react30.useRef)(tab);
4008
4051
  tabRef.current = tab;
4009
- const rootRef = (0, import_react29.useRef)(null);
4010
- const [ownPresence] = (0, import_react29.useState)(() => new import_paint_editor14.PaintPresence());
4052
+ const rootRef = (0, import_react30.useRef)(null);
4053
+ const [ownPresence] = (0, import_react30.useState)(() => new import_paint_editor15.PaintPresence());
4011
4054
  const ambientPlayback = useAgentPlayback();
4012
4055
  const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
4013
4056
  const viewBox = () => {
@@ -4018,12 +4061,12 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
4018
4061
  const docToClient = (p) => {
4019
4062
  const r = viewBox();
4020
4063
  if (!r) return null;
4021
- const q = (0, import_paint_editor14.documentToScreen)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x, p.y);
4064
+ const q = (0, import_paint_editor15.documentToScreen)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x, p.y);
4022
4065
  return { x: r.left + q.x, y: r.top + q.y };
4023
4066
  };
4024
4067
  const clientToDoc = (p) => {
4025
4068
  const r = viewBox();
4026
- return r ? (0, import_paint_editor14.screenToDocument)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x - r.left, p.y - r.top) : null;
4069
+ 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;
4027
4070
  };
4028
4071
  const elementRect = (selector) => {
4029
4072
  const r = rootRef.current?.querySelector(selector)?.getBoundingClientRect();
@@ -4063,28 +4106,29 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
4063
4106
  const box = rootRef.current?.getBoundingClientRect();
4064
4107
  return c && box ? { x: c.x - box.left, y: c.y - box.top } : p;
4065
4108
  };
4066
- const [error, setError] = (0, import_react29.useState)(null);
4109
+ const [error, setError] = (0, import_react30.useState)(null);
4067
4110
  const effects = usePaintEffectsProvider(controller);
4068
4111
  const tabs = effects ? ["color", "wet", "paper", "layers", "effects"] : ["color", "wet", "paper", "layers"];
4069
- return /* @__PURE__ */ (0, import_jsx_runtime29.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: [
4070
- playing && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
4071
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PaintToolbar, { controller, tool, onToolChange: setTool, fileName }),
4072
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex min-h-0 flex-1 gap-2", children: [
4073
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
4074
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
4075
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PaintCanvas, { controller, tool, onError: setError, presence: playing ? void 0 : presence, proposals, agentStrokes, className: "flex-1 rounded-lg" }),
4076
- error && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
4112
+ 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: [
4113
+ playing && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
4114
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PaintToolbar, { controller, tool, onToolChange: setTool, fileName }),
4115
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex min-h-0 flex-1 gap-2", children: [
4116
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
4117
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
4118
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PaintCanvas, { controller, tool, onError: setError, presence: playing ? void 0 : presence, proposals, agentStrokes, className: "flex-1 rounded-lg" }),
4119
+ error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
4077
4120
  ] }),
4078
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
4079
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex gap-1", role: "tablist", "aria-label": "Paint panels", children: tabs.map((t) => /* @__PURE__ */ (0, import_jsx_runtime29.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)) }),
4080
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
4081
- tab === "color" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ColorPanel, { controller }),
4082
- tab === "wet" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(WetPanel, { controller }),
4083
- tab === "paper" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PaperPanel, { controller }),
4084
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PaintLayersPanel, { controller }),
4085
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(StrokePanel, { controller }),
4086
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(StickerPanel, { controller }),
4087
- tab === "effects" && effects && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PaintEffectsPanel, { controller })
4121
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
4122
+ /* @__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)) }),
4123
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
4124
+ tab === "color" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ColorPanel, { controller }),
4125
+ tab === "wet" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(WetPanel, { controller }),
4126
+ tab === "paper" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PaperPanel, { controller }),
4127
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PaintLayersPanel, { controller }),
4128
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(StrokePanel, { controller }),
4129
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PathStrokePanel, { controller }),
4130
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(StickerPanel, { controller }),
4131
+ tab === "effects" && effects && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PaintEffectsPanel, { controller })
4088
4132
  ] })
4089
4133
  ] })
4090
4134
  ] })
@@ -4106,6 +4150,7 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
4106
4150
  PaintSlider,
4107
4151
  PaintToolbar,
4108
4152
  PaperPanel,
4153
+ PathStrokePanel,
4109
4154
  StickerPanel,
4110
4155
  StickerPicker,
4111
4156
  StrokePanel,