@pixerate/editor-react 0.95.0 → 0.97.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +2 -0
  2. package/dist/animation-editor/index.cjs +1261 -198
  3. package/dist/animation-editor/index.js +4 -2
  4. package/dist/canvas/index.cjs +1439 -376
  5. package/dist/canvas/index.js +4 -2
  6. package/dist/chunk-3I7FOSLF.js +988 -0
  7. package/dist/{chunk-OTGJEYHV.js → chunk-5LFQ2UQZ.js} +75 -68
  8. package/dist/chunk-KIRIU53A.js +72 -0
  9. package/dist/{chunk-6YRSQW2V.js → chunk-NC4RLZTK.js} +1 -1
  10. package/dist/chunk-Q7LAFHGP.js +655 -0
  11. package/dist/color/ColorPicker.d.cts +30 -0
  12. package/dist/color/ColorPicker.d.ts +30 -0
  13. package/dist/color/DualColorPicker.d.cts +29 -0
  14. package/dist/color/DualColorPicker.d.ts +29 -0
  15. package/dist/color/index.cjs +1067 -0
  16. package/dist/color/index.d.cts +7 -0
  17. package/dist/color/index.d.ts +7 -0
  18. package/dist/color/index.js +14 -0
  19. package/dist/color/useColorScheme.d.cts +16 -0
  20. package/dist/color/useColorScheme.d.ts +16 -0
  21. package/dist/effects/EffectAuthoringEditor.d.cts +22 -0
  22. package/dist/effects/EffectAuthoringEditor.d.ts +22 -0
  23. package/dist/effects/EffectParameters.d.cts +5 -1
  24. package/dist/effects/EffectParameters.d.ts +5 -1
  25. package/dist/effects/index.cjs +1624 -127
  26. package/dist/effects/index.d.cts +2 -0
  27. package/dist/effects/index.d.ts +2 -0
  28. package/dist/effects/index.js +8 -2
  29. package/dist/effects/useEffectAuthoring.d.cts +6 -0
  30. package/dist/effects/useEffectAuthoring.d.ts +6 -0
  31. package/dist/gradient/FillPicker.d.cts +27 -0
  32. package/dist/gradient/FillPicker.d.ts +27 -0
  33. package/dist/gradient/GradientEditor.d.cts +21 -0
  34. package/dist/gradient/GradientEditor.d.ts +21 -0
  35. package/dist/gradient/index.cjs +1601 -0
  36. package/dist/gradient/index.d.cts +6 -0
  37. package/dist/gradient/index.d.ts +6 -0
  38. package/dist/gradient/index.js +617 -0
  39. package/dist/gradient/useGradientController.d.cts +10 -0
  40. package/dist/gradient/useGradientController.d.ts +10 -0
  41. package/dist/image-editor/index.cjs +1763 -700
  42. package/dist/image-editor/index.js +5 -3
  43. package/dist/index.cjs +2181 -1118
  44. package/dist/index.js +5 -3
  45. package/dist/paint-editor/index.cjs +1254 -191
  46. package/dist/paint-editor/index.js +4 -2
  47. package/dist/parameters/fields.d.cts +1 -1
  48. package/dist/parameters/fields.d.ts +1 -1
  49. package/dist/parameters/index.cjs +1218 -173
  50. package/dist/parameters/index.js +3 -1
  51. package/dist/vector/index.cjs +1240 -177
  52. package/dist/vector/index.js +4 -2
  53. package/dist/video-editor/index.cjs +1251 -188
  54. package/dist/video-editor/index.js +4 -2
  55. package/package.json +29 -3
  56. package/dist/chunk-5R67YSSD.js +0 -205
@@ -17,6 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  }
18
18
  return to;
19
19
  };
20
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
21
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
22
  // If the importer is in node compatibility mode or this is not an ESM
22
23
  // file that has been converted to a CommonJS file using a Babel-
@@ -1849,7 +1850,7 @@ function useCanvasBrushes(options = {}) {
1849
1850
  }
1850
1851
 
1851
1852
  // src/canvas/CanvasEffects.tsx
1852
- var import_react24 = require("react");
1853
+ var import_react27 = require("react");
1853
1854
  var import_canvas14 = require("@pixerate/editor/canvas");
1854
1855
 
1855
1856
  // src/effects/useEffects.ts
@@ -1983,14 +1984,1055 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1983
1984
  }
1984
1985
 
1985
1986
  // src/effects/EffectParameters.tsx
1986
- var import_react23 = __toESM(require("react"), 1);
1987
+ var import_react26 = __toESM(require("react"), 1);
1987
1988
  var import_effects3 = require("@pixerate/editor/effects");
1988
1989
  var import_parameters2 = require("@pixerate/editor/parameters");
1989
1990
 
1990
1991
  // src/parameters/fields.tsx
1991
- var import_react22 = require("react");
1992
+ var import_react25 = require("react");
1992
1993
  var import_parameters = require("@pixerate/editor/parameters");
1994
+
1995
+ // src/color/index.ts
1996
+ var color_exports = {};
1997
+ __export(color_exports, {
1998
+ ColorPicker: () => ColorPicker,
1999
+ DualColorPicker: () => DualColorPicker,
2000
+ useColorScheme: () => useColorScheme,
2001
+ useResolvedColor: () => useResolvedColor
2002
+ });
2003
+
2004
+ // src/color/ColorPicker.tsx
2005
+ var import_react22 = require("react");
2006
+ var import_color = require("@pixerate/editor/color");
1993
2007
  var import_jsx_runtime9 = require("react/jsx-runtime");
2008
+ var LOCAL_STORAGE_KEY = "pixerate:color:recent";
2009
+ function readLocalRecents() {
2010
+ try {
2011
+ if (typeof localStorage === "undefined") return [];
2012
+ const raw = localStorage.getItem(LOCAL_STORAGE_KEY);
2013
+ if (!raw) return [];
2014
+ const parsed = JSON.parse(raw);
2015
+ return Array.isArray(parsed) ? parsed : [];
2016
+ } catch {
2017
+ return [];
2018
+ }
2019
+ }
2020
+ function writeLocalRecents(list) {
2021
+ try {
2022
+ if (typeof localStorage !== "undefined") {
2023
+ localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(list));
2024
+ }
2025
+ } catch {
2026
+ }
2027
+ }
2028
+ var CHECKERBOARD_BG = "repeating-conic-gradient(var(--pixerate-checker-a, #d4d4d8) 0 25%, var(--pixerate-checker-b, #ffffff) 0 50%)";
2029
+ var DEFAULT_PICKER_STATE = { h: 0, s: 1, v: 1, alpha: 1 };
2030
+ var ColorPicker = ({
2031
+ value,
2032
+ onChange,
2033
+ onGestureStart,
2034
+ onGestureEnd,
2035
+ alpha = false,
2036
+ swatches,
2037
+ recent: controlledRecent,
2038
+ onRecentChange,
2039
+ contrastAgainst,
2040
+ disabled = false,
2041
+ className,
2042
+ id,
2043
+ "aria-label": ariaLabel = "Color picker"
2044
+ }) => {
2045
+ const generatedId = (0, import_react22.useId)();
2046
+ const pickerId = id || generatedId;
2047
+ const [pickerState, setPickerState] = (0, import_react22.useState)(
2048
+ () => (0, import_color.pickerStateFromColor)(value) ?? DEFAULT_PICKER_STATE
2049
+ );
2050
+ const stateRef = (0, import_react22.useRef)(pickerState);
2051
+ stateRef.current = pickerState;
2052
+ (0, import_react22.useEffect)(() => {
2053
+ const next = (0, import_color.pickerStateFromColor)(value, stateRef.current);
2054
+ if (next) {
2055
+ setPickerState(next);
2056
+ }
2057
+ }, [value]);
2058
+ const [internalRecent, setInternalRecent] = (0, import_react22.useState)(
2059
+ () => controlledRecent ? [] : readLocalRecents()
2060
+ );
2061
+ const activeRecent = controlledRecent ?? internalRecent;
2062
+ const recordRecent = (0, import_react22.useCallback)(
2063
+ (color) => {
2064
+ const updated = (0, import_color.pushRecentColor)(activeRecent, color, 12);
2065
+ if (!controlledRecent) {
2066
+ setInternalRecent(updated);
2067
+ writeLocalRecents(updated);
2068
+ }
2069
+ onRecentChange?.(updated);
2070
+ },
2071
+ [activeRecent, controlledRecent, onRecentChange]
2072
+ );
2073
+ const [textDraft, setTextDraft] = (0, import_react22.useState)(value);
2074
+ const [isInvalid, setIsInvalid] = (0, import_react22.useState)(false);
2075
+ const [isClipped, setIsClipped] = (0, import_react22.useState)(false);
2076
+ const isTypingRef = (0, import_react22.useRef)(false);
2077
+ (0, import_react22.useEffect)(() => {
2078
+ if (!isTypingRef.current) {
2079
+ setTextDraft(value);
2080
+ setIsInvalid(false);
2081
+ const parsed = (0, import_color.parseColor)(value);
2082
+ setIsClipped(Boolean(parsed && !(0, import_color.inSrgbGamut)(parsed)));
2083
+ }
2084
+ }, [value]);
2085
+ const [hasEyeDropper, setHasEyeDropper] = (0, import_react22.useState)(false);
2086
+ (0, import_react22.useEffect)(() => {
2087
+ setHasEyeDropper(typeof window !== "undefined" && "EyeDropper" in window);
2088
+ }, []);
2089
+ const emitColorChange = (0, import_react22.useCallback)(
2090
+ (nextState) => {
2091
+ setPickerState(nextState);
2092
+ const hex = (0, import_color.pickerStateToHex)(nextState, alpha);
2093
+ onChange(hex);
2094
+ },
2095
+ [alpha, onChange]
2096
+ );
2097
+ const latest = (0, import_react22.useRef)({ emitColorChange, recordRecent, onGestureEnd, alpha });
2098
+ latest.current = { emitColorChange, recordRecent, onGestureEnd, alpha };
2099
+ const endDragRef = (0, import_react22.useRef)(null);
2100
+ (0, import_react22.useEffect)(() => () => endDragRef.current?.(), []);
2101
+ const startDrag = (e, next) => {
2102
+ if (disabled) return;
2103
+ e.preventDefault();
2104
+ endDragRef.current?.();
2105
+ onGestureStart?.();
2106
+ const rect = e.currentTarget.getBoundingClientRect();
2107
+ const update = (clientX, clientY) => {
2108
+ const x = Math.max(0, Math.min(1, (clientX - rect.left) / rect.width));
2109
+ const y = Math.max(0, Math.min(1, (clientY - rect.top) / rect.height));
2110
+ latest.current.emitColorChange(next(stateRef.current, x, y));
2111
+ };
2112
+ update(e.clientX, e.clientY);
2113
+ const onPointerMove = (ev) => update(ev.clientX, ev.clientY);
2114
+ const end = () => {
2115
+ window.removeEventListener("pointermove", onPointerMove);
2116
+ window.removeEventListener("pointerup", onPointerUp);
2117
+ window.removeEventListener("pointercancel", onPointerUp);
2118
+ endDragRef.current = null;
2119
+ latest.current.onGestureEnd?.();
2120
+ };
2121
+ const onPointerUp = () => {
2122
+ end();
2123
+ latest.current.recordRecent((0, import_color.pickerStateToHex)(stateRef.current, latest.current.alpha));
2124
+ };
2125
+ endDragRef.current = end;
2126
+ window.addEventListener("pointermove", onPointerMove);
2127
+ window.addEventListener("pointerup", onPointerUp);
2128
+ window.addEventListener("pointercancel", onPointerUp);
2129
+ };
2130
+ const handleAreaPointerDown = (e) => startDrag(e, (state, x, y) => (0, import_color.pickerStateFromArea)(state, x, y));
2131
+ const handleHuePointerDown = (e) => startDrag(e, (state, x) => (0, import_color.pickerStateFromHue)(state, x));
2132
+ const handleAlphaPointerDown = (e) => startDrag(e, (state, x) => (0, import_color.pickerStateFromAlpha)(state, x));
2133
+ const handleAreaKeyDown = (e) => {
2134
+ if (disabled) return;
2135
+ const next = (0, import_color.pickerKeyStep)(pickerState, "area", e.key, e.shiftKey);
2136
+ if (next) {
2137
+ e.preventDefault();
2138
+ emitColorChange(next);
2139
+ recordRecent((0, import_color.pickerStateToHex)(next, alpha));
2140
+ }
2141
+ };
2142
+ const handleHueKeyDown = (e) => {
2143
+ if (disabled) return;
2144
+ const next = (0, import_color.pickerKeyStep)(pickerState, "hue", e.key, e.shiftKey);
2145
+ if (next) {
2146
+ e.preventDefault();
2147
+ emitColorChange(next);
2148
+ recordRecent((0, import_color.pickerStateToHex)(next, alpha));
2149
+ }
2150
+ };
2151
+ const handleAlphaKeyDown = (e) => {
2152
+ if (disabled) return;
2153
+ const next = (0, import_color.pickerKeyStep)(pickerState, "alpha", e.key, e.shiftKey);
2154
+ if (next) {
2155
+ e.preventDefault();
2156
+ emitColorChange(next);
2157
+ recordRecent((0, import_color.pickerStateToHex)(next, alpha));
2158
+ }
2159
+ };
2160
+ const commitTextInput = (inputElement) => {
2161
+ isTypingRef.current = false;
2162
+ const parsed = (0, import_color.parseColor)(textDraft);
2163
+ if (parsed) {
2164
+ setIsInvalid(false);
2165
+ setIsClipped(!(0, import_color.inSrgbGamut)(parsed));
2166
+ const formatted = (0, import_color.formatHex)(parsed);
2167
+ onChange(formatted);
2168
+ recordRecent(formatted);
2169
+ } else {
2170
+ setIsInvalid(true);
2171
+ setTextDraft(value);
2172
+ if (inputElement) {
2173
+ inputElement.value = value;
2174
+ }
2175
+ }
2176
+ };
2177
+ const handleTextKeyDown = (e) => {
2178
+ if (e.key === "Enter") {
2179
+ e.preventDefault();
2180
+ commitTextInput(e.currentTarget);
2181
+ } else if (e.key === "Escape") {
2182
+ e.preventDefault();
2183
+ isTypingRef.current = false;
2184
+ setIsInvalid(false);
2185
+ setTextDraft(value);
2186
+ e.currentTarget.value = value;
2187
+ }
2188
+ };
2189
+ const handleEyeDropper = async () => {
2190
+ if (disabled || !hasEyeDropper) return;
2191
+ try {
2192
+ const EyeDropperClass = window.EyeDropper;
2193
+ const eyeDropper = new EyeDropperClass();
2194
+ const res = await eyeDropper.open();
2195
+ if (res?.sRGBHex) {
2196
+ onChange(res.sRGBHex);
2197
+ recordRecent(res.sRGBHex);
2198
+ }
2199
+ } catch {
2200
+ }
2201
+ };
2202
+ const contrastResult = (0, import_react22.useMemo)(() => {
2203
+ if (!contrastAgainst) return null;
2204
+ const fg = (0, import_color.parseColor)(value);
2205
+ const bg = (0, import_color.parseColor)(contrastAgainst);
2206
+ if (!fg || !bg) return null;
2207
+ const ratio = (0, import_color.contrastRatio)(fg, bg);
2208
+ const aa = ratio >= 4.5;
2209
+ const aaa = ratio >= 7;
2210
+ return { ratio, aa, aaa };
2211
+ }, [value, contrastAgainst]);
2212
+ const currentHex = (0, import_color.pickerStateToHex)(pickerState, alpha);
2213
+ const liveDescription = `Selected color: ${value}${contrastResult ? `, contrast ${contrastResult.ratio.toFixed(1)}:1 against ${contrastAgainst}, ${contrastResult.aa ? "passes AA" : "fails AA"}` : ""}`;
2214
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
2215
+ "div",
2216
+ {
2217
+ id: pickerId,
2218
+ role: "group",
2219
+ "aria-label": ariaLabel,
2220
+ className,
2221
+ style: {
2222
+ boxSizing: "border-box",
2223
+ width: "var(--pixerate-color-picker-width, 240px)",
2224
+ borderRadius: "var(--pixerate-color-picker-radius, 8px)",
2225
+ background: "var(--pixerate-color-picker-bg, #1f2430)",
2226
+ color: "var(--pixerate-color-picker-fg, #f0f2f5)",
2227
+ padding: "12px",
2228
+ display: "flex",
2229
+ flexDirection: "column",
2230
+ gap: "10px",
2231
+ fontFamily: "system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
2232
+ fontSize: "12px",
2233
+ userSelect: "none",
2234
+ opacity: disabled ? 0.6 : 1,
2235
+ pointerEvents: disabled ? "none" : "auto"
2236
+ },
2237
+ children: [
2238
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2239
+ "span",
2240
+ {
2241
+ role: "status",
2242
+ "aria-live": "polite",
2243
+ style: {
2244
+ position: "absolute",
2245
+ width: "1px",
2246
+ height: "1px",
2247
+ padding: 0,
2248
+ margin: "-1px",
2249
+ overflow: "hidden",
2250
+ clip: "rect(0, 0, 0, 0)",
2251
+ whiteSpace: "nowrap",
2252
+ border: 0
2253
+ },
2254
+ children: liveDescription
2255
+ }
2256
+ ),
2257
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2258
+ "div",
2259
+ {
2260
+ role: "slider",
2261
+ tabIndex: disabled ? -1 : 0,
2262
+ "aria-label": "Saturation and brightness",
2263
+ "aria-valuetext": `Saturation ${Math.round(pickerState.s * 100)}%, Brightness ${Math.round(
2264
+ pickerState.v * 100
2265
+ )}%`,
2266
+ "aria-disabled": disabled,
2267
+ onPointerDown: handleAreaPointerDown,
2268
+ onKeyDown: handleAreaKeyDown,
2269
+ style: {
2270
+ position: "relative",
2271
+ width: "100%",
2272
+ height: "150px",
2273
+ borderRadius: "6px",
2274
+ background: (0, import_color.pickerAreaBackground)(pickerState),
2275
+ cursor: disabled ? "default" : "crosshair",
2276
+ touchAction: "none",
2277
+ outline: "none"
2278
+ },
2279
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2280
+ "div",
2281
+ {
2282
+ style: {
2283
+ position: "absolute",
2284
+ width: "var(--pixerate-color-picker-thumb-size, 14px)",
2285
+ height: "var(--pixerate-color-picker-thumb-size, 14px)",
2286
+ borderRadius: "50%",
2287
+ transform: "translate(-50%, -50%)",
2288
+ left: `${pickerState.s * 100}%`,
2289
+ top: `${(1 - pickerState.v) * 100}%`,
2290
+ border: "2px solid #ffffff",
2291
+ boxShadow: "0 0 2px 1px rgba(0,0,0,0.6)",
2292
+ pointerEvents: "none",
2293
+ backgroundColor: currentHex
2294
+ }
2295
+ }
2296
+ )
2297
+ }
2298
+ ),
2299
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2300
+ "div",
2301
+ {
2302
+ role: "slider",
2303
+ tabIndex: disabled ? -1 : 0,
2304
+ "aria-label": "Hue",
2305
+ "aria-valuenow": Math.round(pickerState.h),
2306
+ "aria-valuemin": 0,
2307
+ "aria-valuemax": 360,
2308
+ "aria-valuetext": `${Math.round(pickerState.h)} degrees`,
2309
+ "aria-disabled": disabled,
2310
+ onPointerDown: handleHuePointerDown,
2311
+ onKeyDown: handleHueKeyDown,
2312
+ style: {
2313
+ position: "relative",
2314
+ width: "100%",
2315
+ height: "12px",
2316
+ borderRadius: "6px",
2317
+ background: import_color.PICKER_HUE_BACKGROUND,
2318
+ cursor: disabled ? "default" : "pointer",
2319
+ touchAction: "none",
2320
+ outline: "none"
2321
+ },
2322
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2323
+ "div",
2324
+ {
2325
+ style: {
2326
+ position: "absolute",
2327
+ top: "50%",
2328
+ transform: "translate(-50%, -50%)",
2329
+ left: `${pickerState.h / 360 * 100}%`,
2330
+ width: "var(--pixerate-color-picker-thumb-size, 14px)",
2331
+ height: "var(--pixerate-color-picker-thumb-size, 14px)",
2332
+ borderRadius: "50%",
2333
+ border: "2px solid #ffffff",
2334
+ boxShadow: "0 0 2px 1px rgba(0,0,0,0.6)",
2335
+ pointerEvents: "none",
2336
+ backgroundColor: `hsl(${pickerState.h}, 100%, 50%)`
2337
+ }
2338
+ }
2339
+ )
2340
+ }
2341
+ ),
2342
+ alpha && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
2343
+ "div",
2344
+ {
2345
+ role: "slider",
2346
+ tabIndex: disabled ? -1 : 0,
2347
+ "aria-label": "Alpha",
2348
+ "aria-valuenow": Math.round(pickerState.alpha * 100),
2349
+ "aria-valuemin": 0,
2350
+ "aria-valuemax": 100,
2351
+ "aria-valuetext": `${Math.round(pickerState.alpha * 100)}%`,
2352
+ "aria-disabled": disabled,
2353
+ onPointerDown: handleAlphaPointerDown,
2354
+ onKeyDown: handleAlphaKeyDown,
2355
+ style: {
2356
+ position: "relative",
2357
+ width: "100%",
2358
+ height: "12px",
2359
+ borderRadius: "6px",
2360
+ backgroundImage: CHECKERBOARD_BG,
2361
+ backgroundSize: "8px 8px",
2362
+ cursor: disabled ? "default" : "pointer",
2363
+ touchAction: "none",
2364
+ outline: "none",
2365
+ overflow: "hidden"
2366
+ },
2367
+ children: [
2368
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2369
+ "div",
2370
+ {
2371
+ style: {
2372
+ position: "absolute",
2373
+ inset: 0,
2374
+ background: (0, import_color.pickerAlphaBackground)(pickerState)
2375
+ }
2376
+ }
2377
+ ),
2378
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2379
+ "div",
2380
+ {
2381
+ style: {
2382
+ position: "absolute",
2383
+ top: "50%",
2384
+ transform: "translate(-50%, -50%)",
2385
+ left: `${pickerState.alpha * 100}%`,
2386
+ width: "var(--pixerate-color-picker-thumb-size, 14px)",
2387
+ height: "var(--pixerate-color-picker-thumb-size, 14px)",
2388
+ borderRadius: "50%",
2389
+ border: "2px solid #ffffff",
2390
+ boxShadow: "0 0 2px 1px rgba(0,0,0,0.6)",
2391
+ pointerEvents: "none",
2392
+ backgroundColor: currentHex
2393
+ }
2394
+ }
2395
+ )
2396
+ ]
2397
+ }
2398
+ ),
2399
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
2400
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2401
+ "div",
2402
+ {
2403
+ style: {
2404
+ position: "relative",
2405
+ width: "28px",
2406
+ height: "28px",
2407
+ borderRadius: "4px",
2408
+ backgroundImage: CHECKERBOARD_BG,
2409
+ backgroundSize: "8px 8px",
2410
+ overflow: "hidden",
2411
+ flexShrink: 0,
2412
+ border: "1px solid rgba(255,255,255,0.15)"
2413
+ },
2414
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2415
+ "div",
2416
+ {
2417
+ style: {
2418
+ width: "100%",
2419
+ height: "100%",
2420
+ backgroundColor: currentHex
2421
+ }
2422
+ }
2423
+ )
2424
+ }
2425
+ ),
2426
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2427
+ "input",
2428
+ {
2429
+ type: "text",
2430
+ value: textDraft,
2431
+ disabled,
2432
+ "aria-label": "Color hex or CSS string",
2433
+ "aria-invalid": isInvalid ? "true" : void 0,
2434
+ onChange: (e) => {
2435
+ isTypingRef.current = true;
2436
+ setTextDraft(e.target.value);
2437
+ setIsInvalid(false);
2438
+ },
2439
+ onKeyDown: handleTextKeyDown,
2440
+ onBlur: (e) => commitTextInput(e.currentTarget),
2441
+ style: {
2442
+ flex: 1,
2443
+ minWidth: 0,
2444
+ height: "28px",
2445
+ padding: "0 8px",
2446
+ fontSize: "12px",
2447
+ fontFamily: "monospace",
2448
+ borderRadius: "4px",
2449
+ border: isInvalid ? "1px solid #ef4444" : "1px solid rgba(255,255,255,0.2)",
2450
+ background: "rgba(0,0,0,0.2)",
2451
+ color: "inherit",
2452
+ outline: "none"
2453
+ }
2454
+ }
2455
+ ),
2456
+ hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2457
+ "button",
2458
+ {
2459
+ type: "button",
2460
+ disabled,
2461
+ "aria-label": "Pick color from screen",
2462
+ title: "Pick color from screen",
2463
+ onClick: handleEyeDropper,
2464
+ style: {
2465
+ display: "inline-flex",
2466
+ alignItems: "center",
2467
+ justifyContent: "center",
2468
+ width: "28px",
2469
+ height: "28px",
2470
+ borderRadius: "4px",
2471
+ border: "1px solid rgba(255,255,255,0.2)",
2472
+ background: "transparent",
2473
+ color: "inherit",
2474
+ cursor: disabled ? "default" : "pointer"
2475
+ },
2476
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
2477
+ "svg",
2478
+ {
2479
+ width: "14",
2480
+ height: "14",
2481
+ viewBox: "0 0 24 24",
2482
+ fill: "none",
2483
+ stroke: "currentColor",
2484
+ strokeWidth: "2",
2485
+ strokeLinecap: "round",
2486
+ strokeLinejoin: "round",
2487
+ children: [
2488
+ /* @__PURE__ */ (0, import_jsx_runtime9.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" }),
2489
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
2490
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "m14 6 4 4" })
2491
+ ]
2492
+ }
2493
+ )
2494
+ }
2495
+ )
2496
+ ] }),
2497
+ isClipped && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2498
+ "div",
2499
+ {
2500
+ role: "note",
2501
+ title: "This colour was outside standard sRGB and clipped.",
2502
+ style: {
2503
+ display: "inline-flex",
2504
+ alignItems: "center",
2505
+ gap: "4px",
2506
+ fontSize: "10px",
2507
+ color: "#f59e0b",
2508
+ background: "rgba(245, 158, 11, 0.1)",
2509
+ padding: "2px 6px",
2510
+ borderRadius: "4px",
2511
+ alignSelf: "flex-start"
2512
+ },
2513
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
2514
+ }
2515
+ ),
2516
+ contrastResult && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
2517
+ "div",
2518
+ {
2519
+ style: {
2520
+ display: "flex",
2521
+ alignItems: "center",
2522
+ justifyContent: "space-between",
2523
+ fontSize: "11px",
2524
+ padding: "4px 8px",
2525
+ borderRadius: "4px",
2526
+ background: "rgba(255,255,255,0.05)",
2527
+ border: "1px solid rgba(255,255,255,0.1)"
2528
+ },
2529
+ children: [
2530
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
2531
+ "Contrast: ",
2532
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("strong", { children: [
2533
+ contrastResult.ratio.toFixed(2),
2534
+ ":1"
2535
+ ] })
2536
+ ] }),
2537
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
2538
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
2539
+ "span",
2540
+ {
2541
+ style: {
2542
+ color: contrastResult.aa ? "#10b981" : "#ef4444",
2543
+ fontWeight: 600
2544
+ },
2545
+ children: [
2546
+ "AA ",
2547
+ contrastResult.aa ? "\u2713" : "\u2717"
2548
+ ]
2549
+ }
2550
+ ),
2551
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
2552
+ "span",
2553
+ {
2554
+ style: {
2555
+ color: contrastResult.aaa ? "#10b981" : "#ef4444",
2556
+ fontWeight: 600
2557
+ },
2558
+ children: [
2559
+ "AAA ",
2560
+ contrastResult.aaa ? "\u2713" : "\u2717"
2561
+ ]
2562
+ }
2563
+ )
2564
+ ] })
2565
+ ]
2566
+ }
2567
+ ),
2568
+ swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2569
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
2570
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2571
+ "button",
2572
+ {
2573
+ type: "button",
2574
+ "data-testid": "color-picker-swatch",
2575
+ title: color,
2576
+ disabled,
2577
+ "aria-label": `Color ${color}`,
2578
+ onClick: () => {
2579
+ onChange(color);
2580
+ recordRecent(color);
2581
+ },
2582
+ style: {
2583
+ width: "18px",
2584
+ height: "18px",
2585
+ borderRadius: "3px",
2586
+ backgroundColor: color,
2587
+ border: color.toLowerCase() === value.toLowerCase() ? "2px solid #ffffff" : "1px solid rgba(255,255,255,0.2)",
2588
+ cursor: disabled ? "default" : "pointer",
2589
+ padding: 0,
2590
+ outline: "none"
2591
+ }
2592
+ },
2593
+ `${color}-${idx}`
2594
+ )) })
2595
+ ] }),
2596
+ activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2597
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
2598
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2599
+ "button",
2600
+ {
2601
+ type: "button",
2602
+ "data-testid": "color-picker-recent",
2603
+ disabled,
2604
+ "aria-label": `Color ${color}`,
2605
+ onClick: () => {
2606
+ onChange(color);
2607
+ recordRecent(color);
2608
+ },
2609
+ style: {
2610
+ width: "18px",
2611
+ height: "18px",
2612
+ borderRadius: "3px",
2613
+ backgroundColor: color,
2614
+ border: color.toLowerCase() === value.toLowerCase() ? "2px solid #ffffff" : "1px solid rgba(255,255,255,0.2)",
2615
+ cursor: disabled ? "default" : "pointer",
2616
+ padding: 0,
2617
+ outline: "none"
2618
+ }
2619
+ },
2620
+ `recent-${color}-${idx}`
2621
+ )) })
2622
+ ] })
2623
+ ]
2624
+ }
2625
+ );
2626
+ };
2627
+
2628
+ // src/color/DualColorPicker.tsx
2629
+ var import_react23 = require("react");
2630
+ var import_color2 = require("@pixerate/editor/color");
2631
+ var import_jsx_runtime10 = require("react/jsx-runtime");
2632
+ function DualColorPicker({
2633
+ value,
2634
+ onChange,
2635
+ onGestureStart,
2636
+ onGestureEnd,
2637
+ scheme: controlledScheme,
2638
+ onSchemeChange,
2639
+ surfaces = import_color2.DEFAULT_SCHEME_SURFACES,
2640
+ contrastAgainst,
2641
+ alpha = false,
2642
+ swatches,
2643
+ disabled = false,
2644
+ className = ""
2645
+ }) {
2646
+ const sameId = (0, import_react23.useId)();
2647
+ const [internalScheme, setInternalScheme] = (0, import_react23.useState)("light");
2648
+ const activeScheme = controlledScheme ?? internalScheme;
2649
+ const handleSchemeSelect = (nextScheme) => {
2650
+ if (onSchemeChange) {
2651
+ onSchemeChange(nextScheme);
2652
+ } else {
2653
+ setInternalScheme(nextScheme);
2654
+ }
2655
+ };
2656
+ const dual = (0, import_color2.normalizeDualColor)(value) ?? { light: "#000000", dark: "#000000" };
2657
+ const isSame = dual.light.toLowerCase() === dual.dark.toLowerCase();
2658
+ const [sameInBoth, setSameInBoth] = (0, import_react23.useState)(isSame);
2659
+ const handleSameToggle = (e) => {
2660
+ const nextSame = e.target.checked;
2661
+ setSameInBoth(nextSame);
2662
+ if (nextSame) {
2663
+ const activeVal = activeScheme === "dark" ? dual.dark : dual.light;
2664
+ onChange({ light: activeVal, dark: activeVal });
2665
+ }
2666
+ };
2667
+ const handleDerive = () => {
2668
+ if (disabled) return;
2669
+ onGestureStart?.();
2670
+ const currentActive = activeScheme === "dark" ? dual.dark : dual.light;
2671
+ const derived = (0, import_color2.deriveDualColor)(currentActive, {
2672
+ from: activeScheme,
2673
+ // An unreadable surfaces prop falls back to the defaults rather than throwing.
2674
+ surfaces: (0, import_color2.normalizeDualColor)(surfaces) ?? import_color2.DEFAULT_SCHEME_SURFACES
2675
+ });
2676
+ onChange(derived);
2677
+ onGestureEnd?.();
2678
+ };
2679
+ const handleInnerChange = (hex) => {
2680
+ if (sameInBoth) {
2681
+ onChange({ light: hex, dark: hex });
2682
+ } else {
2683
+ const updated = (0, import_color2.setDualColorSide)(dual, activeScheme, hex);
2684
+ onChange(updated);
2685
+ }
2686
+ };
2687
+ const activeColor = activeScheme === "dark" ? dual.dark : dual.light;
2688
+ const activeContrastTarget = contrastAgainst ? (0, import_color2.resolveColor)(contrastAgainst, activeScheme) ?? void 0 : void 0;
2689
+ const dualContrast = contrastAgainst && (0, import_color2.normalizeDualColor)(contrastAgainst) ? (0, import_color2.checkDualColorContrast)(dual, contrastAgainst) : null;
2690
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2691
+ "div",
2692
+ {
2693
+ className: `pixerate-dual-color-picker ${className}`,
2694
+ style: {
2695
+ display: "flex",
2696
+ flexDirection: "column",
2697
+ gap: "12px",
2698
+ padding: "12px",
2699
+ background: "#1a1d24",
2700
+ color: "#e2e8f0",
2701
+ borderRadius: "10px",
2702
+ boxShadow: "0 4px 12px rgba(0,0,0,0.3)",
2703
+ width: "260px",
2704
+ fontFamily: "system-ui, -apple-system, sans-serif",
2705
+ fontSize: "13px",
2706
+ boxSizing: "border-box"
2707
+ },
2708
+ children: [
2709
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2710
+ "div",
2711
+ {
2712
+ role: "tablist",
2713
+ "aria-label": "Color scheme mode",
2714
+ style: {
2715
+ display: "flex",
2716
+ background: "#111318",
2717
+ borderRadius: "6px",
2718
+ padding: "2px",
2719
+ gap: "2px"
2720
+ },
2721
+ children: [
2722
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2723
+ "button",
2724
+ {
2725
+ type: "button",
2726
+ role: "tab",
2727
+ "aria-selected": activeScheme === "light",
2728
+ onClick: () => handleSchemeSelect("light"),
2729
+ disabled,
2730
+ style: {
2731
+ flex: 1,
2732
+ padding: "6px 8px",
2733
+ border: "none",
2734
+ borderRadius: "4px",
2735
+ background: activeScheme === "light" ? "#2d3342" : "transparent",
2736
+ color: activeScheme === "light" ? "#ffffff" : "#8c95a6",
2737
+ fontWeight: activeScheme === "light" ? 600 : 400,
2738
+ cursor: disabled ? "not-allowed" : "pointer",
2739
+ fontSize: "12px",
2740
+ transition: "all 0.15s ease"
2741
+ },
2742
+ children: "Light"
2743
+ }
2744
+ ),
2745
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2746
+ "button",
2747
+ {
2748
+ type: "button",
2749
+ role: "tab",
2750
+ "aria-selected": activeScheme === "dark",
2751
+ onClick: () => handleSchemeSelect("dark"),
2752
+ disabled,
2753
+ style: {
2754
+ flex: 1,
2755
+ padding: "6px 8px",
2756
+ border: "none",
2757
+ borderRadius: "4px",
2758
+ background: activeScheme === "dark" ? "#2d3342" : "transparent",
2759
+ color: activeScheme === "dark" ? "#ffffff" : "#8c95a6",
2760
+ fontWeight: activeScheme === "dark" ? 600 : 400,
2761
+ cursor: disabled ? "not-allowed" : "pointer",
2762
+ fontSize: "12px",
2763
+ transition: "all 0.15s ease"
2764
+ },
2765
+ children: "Dark"
2766
+ }
2767
+ )
2768
+ ]
2769
+ }
2770
+ ),
2771
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
2772
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2773
+ "button",
2774
+ {
2775
+ type: "button",
2776
+ onClick: () => handleSchemeSelect("light"),
2777
+ disabled,
2778
+ title: "Edit light mode colour",
2779
+ style: {
2780
+ flex: 1,
2781
+ display: "flex",
2782
+ flexDirection: "column",
2783
+ alignItems: "center",
2784
+ gap: "6px",
2785
+ padding: "8px",
2786
+ background: surfaces.light,
2787
+ color: "#000000",
2788
+ border: activeScheme === "light" ? "2px solid #3b82f6" : "1px solid #333842",
2789
+ borderRadius: "6px",
2790
+ cursor: disabled ? "not-allowed" : "pointer",
2791
+ outline: "none"
2792
+ },
2793
+ children: [
2794
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2795
+ "span",
2796
+ {
2797
+ style: {
2798
+ width: "100%",
2799
+ height: "24px",
2800
+ borderRadius: "4px",
2801
+ background: dual.light,
2802
+ border: "1px solid rgba(0,0,0,0.15)"
2803
+ }
2804
+ }
2805
+ ),
2806
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
2807
+ ]
2808
+ }
2809
+ ),
2810
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2811
+ "button",
2812
+ {
2813
+ type: "button",
2814
+ onClick: () => handleSchemeSelect("dark"),
2815
+ disabled,
2816
+ title: "Edit dark mode colour",
2817
+ style: {
2818
+ flex: 1,
2819
+ display: "flex",
2820
+ flexDirection: "column",
2821
+ alignItems: "center",
2822
+ gap: "6px",
2823
+ padding: "8px",
2824
+ background: surfaces.dark,
2825
+ color: "#ffffff",
2826
+ border: activeScheme === "dark" ? "2px solid #3b82f6" : "1px solid #333842",
2827
+ borderRadius: "6px",
2828
+ cursor: disabled ? "not-allowed" : "pointer",
2829
+ outline: "none"
2830
+ },
2831
+ children: [
2832
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2833
+ "span",
2834
+ {
2835
+ style: {
2836
+ width: "100%",
2837
+ height: "24px",
2838
+ borderRadius: "4px",
2839
+ background: dual.dark,
2840
+ border: "1px solid rgba(255,255,255,0.15)"
2841
+ }
2842
+ }
2843
+ ),
2844
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
2845
+ ]
2846
+ }
2847
+ )
2848
+ ] }),
2849
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2850
+ "div",
2851
+ {
2852
+ style: {
2853
+ display: "flex",
2854
+ alignItems: "center",
2855
+ justifyContent: "space-between",
2856
+ gap: "8px",
2857
+ padding: "2px 0"
2858
+ },
2859
+ children: [
2860
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2861
+ "label",
2862
+ {
2863
+ htmlFor: sameId,
2864
+ style: {
2865
+ display: "flex",
2866
+ alignItems: "center",
2867
+ gap: "6px",
2868
+ cursor: disabled ? "not-allowed" : "pointer",
2869
+ userSelect: "none",
2870
+ fontSize: "12px",
2871
+ color: "#c4cad4"
2872
+ },
2873
+ children: [
2874
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2875
+ "input",
2876
+ {
2877
+ id: sameId,
2878
+ type: "checkbox",
2879
+ checked: sameInBoth,
2880
+ onChange: handleSameToggle,
2881
+ disabled,
2882
+ style: { cursor: disabled ? "not-allowed" : "pointer" }
2883
+ }
2884
+ ),
2885
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Same in both" })
2886
+ ]
2887
+ }
2888
+ ),
2889
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2890
+ "button",
2891
+ {
2892
+ type: "button",
2893
+ onClick: handleDerive,
2894
+ disabled,
2895
+ style: {
2896
+ padding: "4px 10px",
2897
+ background: "#2d3342",
2898
+ color: "#e2e8f0",
2899
+ border: "1px solid #3b4252",
2900
+ borderRadius: "4px",
2901
+ fontSize: "11px",
2902
+ fontWeight: 500,
2903
+ cursor: disabled ? "not-allowed" : "pointer"
2904
+ },
2905
+ children: "Derive"
2906
+ }
2907
+ )
2908
+ ]
2909
+ }
2910
+ ),
2911
+ dualContrast && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2912
+ "div",
2913
+ {
2914
+ "data-testid": "dual-contrast-summary",
2915
+ style: {
2916
+ display: "flex",
2917
+ justifyContent: "space-between",
2918
+ background: "#111318",
2919
+ padding: "6px 8px",
2920
+ borderRadius: "6px",
2921
+ fontSize: "11px",
2922
+ color: "#8c95a6"
2923
+ },
2924
+ children: [
2925
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
2926
+ "Light:",
2927
+ " ",
2928
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
2929
+ dualContrast.light.ratio.toFixed(2),
2930
+ " (",
2931
+ dualContrast.light.level,
2932
+ ")"
2933
+ ] })
2934
+ ] }),
2935
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
2936
+ "Dark:",
2937
+ " ",
2938
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
2939
+ dualContrast.dark.ratio.toFixed(2),
2940
+ " (",
2941
+ dualContrast.dark.level,
2942
+ ")"
2943
+ ] })
2944
+ ] })
2945
+ ]
2946
+ }
2947
+ ),
2948
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2949
+ ColorPicker,
2950
+ {
2951
+ value: activeColor,
2952
+ onChange: handleInnerChange,
2953
+ onGestureStart,
2954
+ onGestureEnd,
2955
+ contrastAgainst: activeContrastTarget,
2956
+ alpha,
2957
+ swatches,
2958
+ disabled
2959
+ }
2960
+ )
2961
+ ]
2962
+ }
2963
+ );
2964
+ }
2965
+
2966
+ // src/color/useColorScheme.ts
2967
+ var import_react24 = require("react");
2968
+ var import_color3 = require("@pixerate/editor/color");
2969
+ function getSnapshot(attribute) {
2970
+ if (typeof window === "undefined" || typeof document === "undefined") {
2971
+ return "light";
2972
+ }
2973
+ if (attribute) {
2974
+ const el = document.documentElement;
2975
+ if (attribute === "class") {
2976
+ return el.classList.contains("dark") ? "dark" : "light";
2977
+ }
2978
+ const val = el.getAttribute(attribute);
2979
+ return val === "dark" ? "dark" : "light";
2980
+ }
2981
+ if (typeof window.matchMedia === "function") {
2982
+ return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
2983
+ }
2984
+ return "light";
2985
+ }
2986
+ function getServerSnapshot() {
2987
+ return "light";
2988
+ }
2989
+ function useColorScheme(options) {
2990
+ const override = options?.override;
2991
+ const attribute = options?.attribute;
2992
+ const subscribe = (0, import_react24.useMemo)(() => {
2993
+ return (callback) => {
2994
+ if (typeof window === "undefined" || typeof document === "undefined") {
2995
+ return () => {
2996
+ };
2997
+ }
2998
+ if (attribute) {
2999
+ const observer = new MutationObserver(() => {
3000
+ callback();
3001
+ });
3002
+ observer.observe(document.documentElement, {
3003
+ attributes: true,
3004
+ attributeFilter: [attribute]
3005
+ });
3006
+ return () => observer.disconnect();
3007
+ }
3008
+ if (typeof window.matchMedia === "function") {
3009
+ const mql = window.matchMedia("(prefers-color-scheme: dark)");
3010
+ const handler = () => callback();
3011
+ mql.addEventListener("change", handler);
3012
+ return () => mql.removeEventListener("change", handler);
3013
+ }
3014
+ return () => {
3015
+ };
3016
+ };
3017
+ }, [attribute]);
3018
+ const detected = (0, import_react24.useSyncExternalStore)(
3019
+ subscribe,
3020
+ () => getSnapshot(attribute),
3021
+ getServerSnapshot
3022
+ );
3023
+ return override ?? detected;
3024
+ }
3025
+ function useResolvedColor(value, scheme) {
3026
+ const detectedScheme = useColorScheme();
3027
+ const activeScheme = scheme ?? detectedScheme;
3028
+ return (0, import_color3.resolveColor)(value, activeScheme);
3029
+ }
3030
+
3031
+ // src/color/index.ts
3032
+ __reExport(color_exports, require("@pixerate/editor/color"));
3033
+
3034
+ // src/parameters/fields.tsx
3035
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1994
3036
  var parameterInputClass = "h-7 w-full min-w-0 rounded-md border border-input bg-background px-2 text-xs text-foreground tabular-nums focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50";
1995
3037
  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";
1996
3038
  var rangeClass = "h-4 w-full min-w-0 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50";
@@ -2014,7 +3056,7 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
2014
3056
  onKeyDown: keyDown,
2015
3057
  ...rest
2016
3058
  };
2017
- return multiline ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("textarea", { ...props, className: `${props.className} h-auto min-h-[3.5rem] py-1` }, value) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", { type: "text", ...props }, value);
3059
+ return multiline ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("textarea", { ...props, className: `${props.className} h-auto min-h-[3.5rem] py-1` }, value) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { type: "text", ...props }, value);
2018
3060
  }
2019
3061
  var plainNumber = (field, value) => (0, import_parameters.formatParameterNumber)({ ...field, unit: void 0 }, value);
2020
3062
  function ParameterNumberInput({
@@ -2025,8 +3067,8 @@ function ParameterNumberInput({
2025
3067
  id,
2026
3068
  "aria-label": ariaLabel
2027
3069
  }) {
2028
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
2029
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3070
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
3071
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2030
3072
  ParameterCommitInput,
2031
3073
  {
2032
3074
  id,
@@ -2048,21 +3090,21 @@ function ParameterNumberInput({
2048
3090
  }
2049
3091
  }
2050
3092
  ),
2051
- field.unit && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
3093
+ field.unit && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
2052
3094
  ] });
2053
3095
  }
2054
3096
  function ParameterSlider(props) {
2055
3097
  const { field, value, onChange, onGestureStart, onGestureEnd, disabled } = props;
2056
- const dragging = (0, import_react22.useRef)(false);
3098
+ const dragging = (0, import_react25.useRef)(false);
2057
3099
  const end = () => {
2058
3100
  if (!dragging.current) return;
2059
3101
  dragging.current = false;
2060
3102
  onGestureEnd?.();
2061
3103
  };
2062
- if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ParameterNumberInput, { ...props });
3104
+ if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterNumberInput, { ...props });
2063
3105
  const step = (0, import_parameters.parameterStep)(field);
2064
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2", children: [
2065
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3106
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-2", children: [
3107
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2066
3108
  "input",
2067
3109
  {
2068
3110
  type: "range",
@@ -2085,11 +3127,11 @@ function ParameterSlider(props) {
2085
3127
  onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field, Number(e.target.value)))
2086
3128
  }
2087
3129
  ),
2088
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
3130
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
2089
3131
  ] });
2090
3132
  }
2091
3133
  function ParameterToggle({ field, value, onChange, disabled, id }) {
2092
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3134
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2093
3135
  "button",
2094
3136
  {
2095
3137
  type: "button",
@@ -2100,7 +3142,7 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
2100
3142
  disabled: disabled || field.readOnly,
2101
3143
  onClick: () => onChange(!value),
2102
3144
  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"}`,
2103
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3145
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2104
3146
  "span",
2105
3147
  {
2106
3148
  className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
@@ -2113,7 +3155,7 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
2113
3155
  const options = (0, import_parameters.getChoiceOptions)(field);
2114
3156
  const off = disabled || field.readOnly;
2115
3157
  if (field.control === "segmented") {
2116
- return /* @__PURE__ */ (0, import_jsx_runtime9.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_runtime9.jsx)(
3158
+ return /* @__PURE__ */ (0, import_jsx_runtime11.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_runtime11.jsx)(
2117
3159
  "button",
2118
3160
  {
2119
3161
  type: "button",
@@ -2129,7 +3171,7 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
2129
3171
  )) });
2130
3172
  }
2131
3173
  const index = options.findIndex((o) => o.value === value);
2132
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3174
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2133
3175
  "select",
2134
3176
  {
2135
3177
  id,
@@ -2141,53 +3183,64 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
2141
3183
  if (option) onChange(option.value);
2142
3184
  },
2143
3185
  className: parameterInputClass,
2144
- children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: String(i), title: o.description, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
3186
+ children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: String(i), title: o.description, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
2145
3187
  }
2146
3188
  );
2147
3189
  }
2148
3190
  function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id }) {
2149
- const picking = (0, import_react22.useRef)(false);
3191
+ const [open, setOpen] = (0, import_react25.useState)(false);
3192
+ const containerRef = (0, import_react25.useRef)(null);
3193
+ const buttonRef = (0, import_react25.useRef)(null);
3194
+ const popoverRef = (0, import_react25.useRef)(null);
2150
3195
  const alpha = !!field.alpha;
2151
3196
  const hex = (0, import_parameters.normalizeHexColor)(value, true) ?? "#000000ff";
2152
3197
  const rgb = hex.slice(0, 7);
2153
- const a = hex.slice(7);
3198
+ const shown = alpha ? hex : rgb;
2154
3199
  const off = disabled || field.readOnly;
2155
- const start = () => {
2156
- if (picking.current) return;
2157
- picking.current = true;
2158
- onGestureStart?.();
2159
- };
2160
- const end = () => {
2161
- if (!picking.current) return;
2162
- picking.current = false;
2163
- onGestureEnd?.();
2164
- };
2165
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-1.5", children: [
2166
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2", children: [
2167
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { 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]", children: [
2168
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "absolute inset-0", style: { background: alpha ? hex : rgb } }),
2169
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2170
- "input",
2171
- {
2172
- type: "color",
2173
- "aria-label": (0, import_parameters.parameterLabel)(field),
2174
- value: rgb,
2175
- disabled: off,
2176
- className: "absolute inset-0 h-full w-full cursor-pointer opacity-0 disabled:cursor-not-allowed",
2177
- onChange: (e) => {
2178
- start();
2179
- onChange(alpha ? `${e.target.value}${a}` : e.target.value);
2180
- },
2181
- onBlur: end
2182
- }
2183
- )
2184
- ] }),
2185
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3200
+ const name = (0, import_parameters.parameterLabel)(field);
3201
+ (0, import_react25.useEffect)(() => {
3202
+ if (!open) return;
3203
+ const onPointerDown = (e) => {
3204
+ if (containerRef.current && !containerRef.current.contains(e.target)) {
3205
+ setOpen(false);
3206
+ }
3207
+ };
3208
+ const onKeyDown = (e) => {
3209
+ if (e.key === "Escape") {
3210
+ e.stopPropagation();
3211
+ setOpen(false);
3212
+ buttonRef.current?.focus();
3213
+ }
3214
+ };
3215
+ window.addEventListener("pointerdown", onPointerDown, true);
3216
+ window.addEventListener("keydown", onKeyDown, true);
3217
+ return () => {
3218
+ window.removeEventListener("pointerdown", onPointerDown, true);
3219
+ window.removeEventListener("keydown", onKeyDown, true);
3220
+ };
3221
+ }, [open]);
3222
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
3223
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-2", children: [
3224
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3225
+ "button",
3226
+ {
3227
+ ref: buttonRef,
3228
+ type: "button",
3229
+ "aria-label": name,
3230
+ "aria-expanded": open,
3231
+ "aria-haspopup": "dialog",
3232
+ disabled: off,
3233
+ onClick: () => setOpen((prev) => !prev),
3234
+ 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",
3235
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
3236
+ }
3237
+ ),
3238
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2186
3239
  ParameterCommitInput,
2187
3240
  {
2188
3241
  id,
2189
- "aria-label": `${(0, import_parameters.parameterLabel)(field)} hex`,
2190
- value: alpha ? hex : rgb,
3242
+ "aria-label": `${name} hex`,
3243
+ value: shown,
2191
3244
  disabled: off,
2192
3245
  spellCheck: false,
2193
3246
  className: `${parameterInputClass} font-mono`,
@@ -2198,51 +3251,43 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
2198
3251
  }
2199
3252
  )
2200
3253
  ] }),
2201
- alpha && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2202
- "input",
3254
+ open && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3255
+ "div",
2203
3256
  {
2204
- type: "range",
2205
- "aria-label": `${(0, import_parameters.parameterLabel)(field)} opacity`,
2206
- min: 0,
2207
- max: 255,
2208
- step: 1,
2209
- value: parseInt(a, 16),
2210
- disabled: off,
2211
- className: rangeClass,
2212
- onPointerDown: start,
2213
- onPointerUp: end,
2214
- onPointerCancel: end,
2215
- onBlur: end,
2216
- onChange: (e) => onChange(`${rgb}${Number(e.target.value).toString(16).padStart(2, "0")}`)
2217
- }
2218
- ),
2219
- field.swatches && field.swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex flex-wrap gap-1", children: field.swatches.map((s) => {
2220
- const swatch = (0, import_parameters.normalizeHexColor)(s, alpha);
2221
- if (!swatch) return null;
2222
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2223
- "button",
2224
- {
2225
- type: "button",
2226
- title: swatch,
2227
- "aria-label": `${(0, import_parameters.parameterLabel)(field)} ${swatch}`,
2228
- "aria-pressed": swatch === (alpha ? hex : rgb),
2229
- disabled: off,
2230
- onClick: () => onChange(swatch),
2231
- className: "h-5 w-5 rounded border border-input aria-pressed:ring-1 aria-pressed:ring-primary",
2232
- style: { background: swatch }
3257
+ ref: popoverRef,
3258
+ role: "dialog",
3259
+ "aria-label": name,
3260
+ tabIndex: -1,
3261
+ onBlur: (e) => {
3262
+ if (popoverRef.current && !popoverRef.current.contains(e.relatedTarget)) {
3263
+ setOpen(false);
3264
+ }
2233
3265
  },
2234
- s
2235
- );
2236
- }) })
3266
+ 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",
3267
+ style: { background: "var(--popover, var(--background, #fff))" },
3268
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3269
+ ColorPicker,
3270
+ {
3271
+ value: shown,
3272
+ alpha,
3273
+ swatches: field.swatches,
3274
+ disabled: off,
3275
+ onChange,
3276
+ onGestureStart,
3277
+ onGestureEnd
3278
+ }
3279
+ )
3280
+ }
3281
+ )
2237
3282
  ] });
2238
3283
  }
2239
3284
  function ParameterVector({ field, value, onChange, disabled, id }) {
2240
3285
  const size = (0, import_parameters.vectorSize)(field);
2241
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
3286
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
2242
3287
  const component = (0, import_parameters.vectorComponentField)(field, i);
2243
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
2244
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
2245
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3288
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
3289
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
3290
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2246
3291
  ParameterNumberInput,
2247
3292
  {
2248
3293
  field: component,
@@ -2259,11 +3304,11 @@ function ParameterVector({ field, value, onChange, disabled, id }) {
2259
3304
  function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
2260
3305
  const off = disabled || field.readOnly;
2261
3306
  const name = (0, import_parameters.parameterLabel)(field);
2262
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-1.5", children: [
2263
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2", children: [
2264
- /* @__PURE__ */ (0, import_jsx_runtime9.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_runtime9.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
2265
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
2266
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3307
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "space-y-1.5", children: [
3308
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-2", children: [
3309
+ /* @__PURE__ */ (0, import_jsx_runtime11.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_runtime11.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
3310
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
3311
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2267
3312
  ParameterCommitInput,
2268
3313
  {
2269
3314
  id,
@@ -2274,10 +3319,10 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
2274
3319
  onCommit: (text) => onChange(text.trim())
2275
3320
  }
2276
3321
  ),
2277
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex gap-1", children: [
2278
- resolveFile && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`, children: [
3322
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex gap-1", children: [
3323
+ resolveFile && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`, children: [
2279
3324
  "Choose file\u2026",
2280
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3325
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2281
3326
  "input",
2282
3327
  {
2283
3328
  type: "file",
@@ -2293,11 +3338,11 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
2293
3338
  }
2294
3339
  )
2295
3340
  ] }),
2296
- value && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: parameterButtonClass, disabled: off, onClick: () => onChange(""), "aria-label": `Clear ${name}`, children: "Clear" })
3341
+ value && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: parameterButtonClass, disabled: off, onClick: () => onChange(""), "aria-label": `Clear ${name}`, children: "Clear" })
2297
3342
  ] })
2298
3343
  ] })
2299
3344
  ] }),
2300
- field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3345
+ field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2301
3346
  "button",
2302
3347
  {
2303
3348
  type: "button",
@@ -2307,14 +3352,14 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
2307
3352
  disabled: off,
2308
3353
  onClick: () => onChange(o.url),
2309
3354
  className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
2310
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
3355
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
2311
3356
  },
2312
3357
  o.url
2313
3358
  )) })
2314
3359
  ] });
2315
3360
  }
2316
3361
  function ParameterText({ field, value, onChange, disabled, id }) {
2317
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3362
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2318
3363
  ParameterCommitInput,
2319
3364
  {
2320
3365
  id,
@@ -2333,31 +3378,42 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
2333
3378
  switch (field.type) {
2334
3379
  case "number":
2335
3380
  case "int":
2336
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
3381
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
2337
3382
  case "boolean":
2338
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
3383
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
2339
3384
  case "choice":
2340
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
3385
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
2341
3386
  case "color":
2342
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
3387
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
2343
3388
  case "vector":
2344
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
3389
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
2345
3390
  case "image":
2346
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
3391
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
2347
3392
  case "text":
2348
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ParameterText, { field, value, onChange: set, ...rest });
3393
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ParameterText, { field, value, onChange: set, ...rest });
2349
3394
  }
2350
3395
  }
2351
3396
 
2352
3397
  // src/effects/EffectParameters.tsx
2353
- var import_jsx_runtime10 = require("react/jsx-runtime");
2354
- function EffectParameters({ description, values, onChange, onReset, keyframed, onPreset, disabled = false, className = "" }) {
2355
- const fields = (0, import_react23.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
2356
- const idBase = (0, import_react23.useId)();
2357
- const gesture = import_react23.default.useRef(null);
2358
- const count = import_react23.default.useRef(0);
2359
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
2360
- onPreset && description.presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3398
+ var import_jsx_runtime12 = require("react/jsx-runtime");
3399
+ function EffectParameters({
3400
+ description,
3401
+ values,
3402
+ onChange,
3403
+ onReset,
3404
+ keyframed,
3405
+ onPreset,
3406
+ onPresetName,
3407
+ renderControlAddon,
3408
+ disabled = false,
3409
+ className = ""
3410
+ }) {
3411
+ const fields = (0, import_react26.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
3412
+ const idBase = (0, import_react26.useId)();
3413
+ const gesture = import_react26.default.useRef(null);
3414
+ const count = import_react26.default.useRef(0);
3415
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
3416
+ (onPreset || onPresetName) && description.presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2361
3417
  "select",
2362
3418
  {
2363
3419
  className: "w-full rounded border border-border bg-transparent px-1 py-0.5 text-xs",
@@ -2365,12 +3421,18 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
2365
3421
  value: "",
2366
3422
  disabled,
2367
3423
  onChange: (e) => {
2368
- const preset = description.presets.find((p) => p.name === e.currentTarget.value);
2369
- if (preset) onPreset({ ...description.defaults, ...preset.values });
3424
+ const name = e.currentTarget.value;
3425
+ if (!name) return;
3426
+ if (onPresetName) {
3427
+ onPresetName(name);
3428
+ } else if (onPreset) {
3429
+ const preset = description.presets.find((p) => p.name === name);
3430
+ if (preset) onPreset({ ...description.defaults, ...preset.values });
3431
+ }
2370
3432
  },
2371
3433
  children: [
2372
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "", children: "Presets\u2026" }),
2373
- description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: p.name, children: p.name }, p.name))
3434
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "", children: "Presets\u2026" }),
3435
+ description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: p.name, children: p.name }, p.name))
2374
3436
  ]
2375
3437
  }
2376
3438
  ),
@@ -2380,13 +3442,14 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
2380
3442
  const keyed = keyframed?.has(field.id) ?? false;
2381
3443
  const value = (0, import_effects3.effectFieldValue)(field, values[field.id]);
2382
3444
  const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field.default);
2383
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
2384
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1.5", children: [
2385
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
2386
- keyed && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
2387
- onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime10.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" })
3445
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
3446
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1.5", children: [
3447
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
3448
+ keyed && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
3449
+ renderControlAddon?.(field.id),
3450
+ onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime12.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" })
2388
3451
  ] }),
2389
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3452
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2390
3453
  ParameterFieldControl,
2391
3454
  {
2392
3455
  field,
@@ -2400,46 +3463,46 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
2400
3463
  )
2401
3464
  ] }, field.id);
2402
3465
  }),
2403
- !fields.length && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
3466
+ !fields.length && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
2404
3467
  ] });
2405
3468
  }
2406
3469
 
2407
3470
  // src/canvas/CanvasEffects.tsx
2408
- var import_jsx_runtime11 = require("react/jsx-runtime");
2409
- var ProviderContext = (0, import_react24.createContext)(null);
3471
+ var import_jsx_runtime13 = require("react/jsx-runtime");
3472
+ var ProviderContext = (0, import_react27.createContext)(null);
2410
3473
  function CanvasEffectsProvider({ provider, children }) {
2411
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ProviderContext.Provider, { value: provider ?? null, children });
3474
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ProviderContext.Provider, { value: provider ?? null, children });
2412
3475
  }
2413
- var useCanvasEffectsProviderContext = () => (0, import_react24.useContext)(ProviderContext);
3476
+ var useCanvasEffectsProviderContext = () => (0, import_react27.useContext)(ProviderContext);
2414
3477
  function CanvasNodeEffectLayer({ effect, width, height, clipPath, clipTransform }) {
2415
3478
  const provider = useCanvasEffectsProviderContext();
2416
- const ref = (0, import_react24.useRef)(null);
2417
- const [failed, setFailed] = (0, import_react24.useState)(false);
3479
+ const ref = (0, import_react27.useRef)(null);
3480
+ const [failed, setFailed] = (0, import_react27.useState)(false);
2418
3481
  const dpr = typeof window !== "undefined" ? Math.min(2, window.devicePixelRatio || 1) : 1;
2419
3482
  const pw = Math.max(1, Math.round(width * dpr));
2420
3483
  const ph = Math.max(1, Math.round(height * dpr));
2421
3484
  const key = JSON.stringify(effect);
2422
- (0, import_react24.useEffect)(() => {
3485
+ (0, import_react27.useEffect)(() => {
2423
3486
  const canvas2 = ref.current;
2424
3487
  if (!provider || !canvas2) return;
2425
3488
  setFailed(false);
2426
3489
  const run = (0, import_canvas14.runCanvasNodeEffect)({ provider, effect, target: canvas2, onError: () => setFailed(true) });
2427
3490
  return () => run.stop();
2428
3491
  }, [provider, key, pw, ph]);
2429
- const clipId = (0, import_react24.useMemo)(() => `pixerate-effect-clip-${Math.random().toString(36).slice(2)}`, []);
3492
+ const clipId = (0, import_react27.useMemo)(() => `pixerate-effect-clip-${Math.random().toString(36).slice(2)}`, []);
2430
3493
  if (!provider || failed || !(width > 0 && height > 0)) return null;
2431
3494
  const style = { position: "absolute", inset: 0, width: "100%", height: "100%", pointerEvents: "none", opacity: effect.opacity ?? 1 };
2432
- const canvas = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("canvas", { ref, width: pw, height: ph, style: { width: "100%", height: "100%", display: "block" }, "data-canvas-effect": effect.effect });
2433
- if (effect.mode === "overlay" || !clipPath) return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style, children: canvas });
2434
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("svg", { style, viewBox: `0 0 ${width} ${height}`, preserveAspectRatio: "none", "aria-hidden": "true", children: [
2435
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("clipPath", { id: clipId, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: clipPath, transform: clipTransform }) }) }),
2436
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("foreignObject", { x: 0, y: 0, width, height, clipPath: `url(#${clipId})`, children: canvas })
3495
+ const canvas = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("canvas", { ref, width: pw, height: ph, style: { width: "100%", height: "100%", display: "block" }, "data-canvas-effect": effect.effect });
3496
+ if (effect.mode === "overlay" || !clipPath) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style, children: canvas });
3497
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("svg", { style, viewBox: `0 0 ${width} ${height}`, preserveAspectRatio: "none", "aria-hidden": "true", children: [
3498
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("clipPath", { id: clipId, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: clipPath, transform: clipTransform }) }) }),
3499
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("foreignObject", { x: 0, y: 0, width, height, clipPath: `url(#${clipId})`, children: canvas })
2437
3500
  ] });
2438
3501
  }
2439
3502
  function useCanvasEffects(options) {
2440
- const opts = (0, import_react24.useRef)(options);
3503
+ const opts = (0, import_react27.useRef)(options);
2441
3504
  opts.current = options;
2442
- const controller = (0, import_react24.useMemo)(
3505
+ const controller = (0, import_react27.useMemo)(
2443
3506
  () => (0, import_canvas14.createCanvasEffectsController)({
2444
3507
  getNodes: () => opts.current.getNodes(),
2445
3508
  setNodes: (n) => opts.current.setNodes(n),
@@ -2450,7 +3513,7 @@ function useCanvasEffects(options) {
2450
3513
  }),
2451
3514
  []
2452
3515
  );
2453
- (0, import_react24.useEffect)(() => {
3516
+ (0, import_react27.useEffect)(() => {
2454
3517
  if (!options.effects) return;
2455
3518
  return controller.useEffects(options.effects);
2456
3519
  }, [controller, options.effects]);
@@ -2458,7 +3521,7 @@ function useCanvasEffects(options) {
2458
3521
  }
2459
3522
  function useCanvasEffectsTools(registry, controller, options = {}) {
2460
3523
  const { id, namespace, readOnly, subscribe } = options;
2461
- (0, import_react24.useEffect)(() => {
3524
+ (0, import_react27.useEffect)(() => {
2462
3525
  if (!registry) return;
2463
3526
  return registry.register((0, import_canvas14.createCanvasEffectsToolProvider)(controller, { id, namespace, readOnly, subscribe }));
2464
3527
  }, [registry, controller, id, namespace, readOnly, subscribe]);
@@ -2466,12 +3529,12 @@ function useCanvasEffectsTools(registry, controller, options = {}) {
2466
3529
  var btn = "rounded border border-border px-1.5 py-0.5 text-[11px] disabled:opacity-40";
2467
3530
  function Controls({ controller, nodeId, effect }) {
2468
3531
  const { description, error } = useEffectDescription(controller.effectsProvider, effect.effect);
2469
- const [message, setMessage] = (0, import_react24.useState)(null);
3532
+ const [message, setMessage] = (0, import_react27.useState)(null);
2470
3533
  const run = (work) => void work.then(() => setMessage(null), (e) => setMessage(e instanceof Error ? e.message : String(e)));
2471
- if (error) return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-[11px] text-amber-500", children: error });
2472
- if (!description) return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
2473
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
2474
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3534
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-[11px] text-amber-500", children: error });
3535
+ if (!description) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
3536
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
3537
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2475
3538
  EffectParameters,
2476
3539
  {
2477
3540
  description,
@@ -2481,75 +3544,75 @@ function Controls({ controller, nodeId, effect }) {
2481
3544
  onPreset: (v) => run(controller.updateNodeEffect(nodeId, { values: v }))
2482
3545
  }
2483
3546
  ),
2484
- message && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
3547
+ message && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
2485
3548
  ] });
2486
3549
  }
2487
3550
  function CanvasEffectsPanel({ controller, nodeId, shape, sceneId, className = "" }) {
2488
- const [, setTick] = (0, import_react24.useState)(0);
2489
- (0, import_react24.useEffect)(() => controller.effects.subscribe(() => setTick((n) => n + 1)), [controller]);
3551
+ const [, setTick] = (0, import_react27.useState)(0);
3552
+ (0, import_react27.useEffect)(() => controller.effects.subscribe(() => setTick((n) => n + 1)), [controller]);
2490
3553
  const provider = controller.effectsProvider;
2491
- const [browse, setBrowse] = (0, import_react24.useState)(null);
2492
- const [message, setMessage] = (0, import_react24.useState)(null);
3554
+ const [browse, setBrowse] = (0, import_react27.useState)(null);
3555
+ const [message, setMessage] = (0, import_react27.useState)(null);
2493
3556
  const run = (work) => {
2494
3557
  setMessage(null);
2495
3558
  Promise.resolve().then(work).then(() => setTick((n) => n + 1), (e) => setMessage(e instanceof Error ? e.message : String(e)));
2496
3559
  };
2497
3560
  const effect = (0, import_canvas14.isShapeDescription)(shape) ? shape.effect : void 0;
2498
3561
  const transition = sceneId ? controller.sceneTransition(sceneId) : void 0;
2499
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Canvas effects", "data-canvas-effects": "", children: [
2500
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
2501
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "flex-1 font-semibold", children: "Effects" }),
2502
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: btn, disabled: !provider || !nodeId || !shape, "aria-pressed": browse === "fill", onClick: () => setBrowse(browse === "fill" ? null : "fill"), children: "Fill\u2026" }),
2503
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: btn, disabled: !provider || !nodeId || !shape, "aria-pressed": browse === "overlay", onClick: () => setBrowse(browse === "overlay" ? null : "overlay"), children: "Overlay\u2026" }),
2504
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: btn, disabled: !provider || !sceneId, "aria-pressed": browse === "transition", onClick: () => setBrowse(browse === "transition" ? null : "transition"), children: "Scene transition\u2026" })
3562
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Canvas effects", "data-canvas-effects": "", children: [
3563
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
3564
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "flex-1 font-semibold", children: "Effects" }),
3565
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: btn, disabled: !provider || !nodeId || !shape, "aria-pressed": browse === "fill", onClick: () => setBrowse(browse === "fill" ? null : "fill"), children: "Fill\u2026" }),
3566
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: btn, disabled: !provider || !nodeId || !shape, "aria-pressed": browse === "overlay", onClick: () => setBrowse(browse === "overlay" ? null : "overlay"), children: "Overlay\u2026" }),
3567
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: btn, disabled: !provider || !sceneId, "aria-pressed": browse === "transition", onClick: () => setBrowse(browse === "transition" ? null : "transition"), children: "Scene transition\u2026" })
2505
3568
  ] }),
2506
- !provider && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects on the canvas are kept." }),
2507
- browse === "fill" && nodeId && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(EffectsBrowser, { provider, uses: ["generator", "interactive"], title: "Fills", onPick: (e) => (setBrowse(null), run(() => controller.applyNodeEffect(nodeId, e.id, { mode: "fill" }))) }),
2508
- browse === "overlay" && nodeId && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(EffectsBrowser, { provider, uses: ["overlay", "title", "interactive", "generator"], title: "Overlays", onPick: (e) => (setBrowse(null), run(() => controller.applyNodeEffect(nodeId, e.id, { mode: "overlay" }))) }),
2509
- browse === "transition" && sceneId && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(EffectsBrowser, { provider, uses: ["transition"], title: "Transitions", onPick: (e) => (setBrowse(null), run(() => controller.setSceneTransition(sceneId, e.id))) }),
2510
- effect && nodeId && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "space-y-1 rounded border border-border p-1", "data-canvas-node-effect": nodeId, children: [
2511
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-1", children: [
2512
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "min-w-0 flex-1 truncate font-medium", children: [
3569
+ !provider && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects on the canvas are kept." }),
3570
+ browse === "fill" && nodeId && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EffectsBrowser, { provider, uses: ["generator", "interactive"], title: "Fills", onPick: (e) => (setBrowse(null), run(() => controller.applyNodeEffect(nodeId, e.id, { mode: "fill" }))) }),
3571
+ browse === "overlay" && nodeId && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EffectsBrowser, { provider, uses: ["overlay", "title", "interactive", "generator"], title: "Overlays", onPick: (e) => (setBrowse(null), run(() => controller.applyNodeEffect(nodeId, e.id, { mode: "overlay" }))) }),
3572
+ browse === "transition" && sceneId && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EffectsBrowser, { provider, uses: ["transition"], title: "Transitions", onPick: (e) => (setBrowse(null), run(() => controller.setSceneTransition(sceneId, e.id))) }),
3573
+ effect && nodeId && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "space-y-1 rounded border border-border p-1", "data-canvas-node-effect": nodeId, children: [
3574
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1", children: [
3575
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "min-w-0 flex-1 truncate font-medium", children: [
2513
3576
  effect.name ?? effect.effect,
2514
3577
  " ",
2515
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "text-muted-foreground", children: [
3578
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "text-muted-foreground", children: [
2516
3579
  "\xB7 ",
2517
3580
  effect.mode
2518
3581
  ] })
2519
3582
  ] }),
2520
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex items-center gap-1", children: [
2521
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { type: "checkbox", checked: effect.playing !== false, "aria-label": "Play", onChange: (e) => {
3583
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center gap-1", children: [
3584
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "checkbox", checked: effect.playing !== false, "aria-label": "Play", onChange: (e) => {
2522
3585
  const playing = e.currentTarget.checked;
2523
3586
  run(() => controller.updateNodeEffect(nodeId, { playing }));
2524
3587
  } }),
2525
3588
  " Play"
2526
3589
  ] }),
2527
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: btn, "aria-label": "Remove effect", onClick: () => run(() => controller.removeNodeEffect(nodeId)), children: "\u2715" })
3590
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: btn, "aria-label": "Remove effect", onClick: () => run(() => controller.removeNodeEffect(nodeId)), children: "\u2715" })
2528
3591
  ] }),
2529
- provider && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Controls, { controller, nodeId, effect })
3592
+ provider && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Controls, { controller, nodeId, effect })
2530
3593
  ] }),
2531
- sceneId && transition && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-1", "data-canvas-scene-transition": sceneId, children: [
2532
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "min-w-0 flex-1 truncate", children: [
3594
+ sceneId && transition && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1", "data-canvas-scene-transition": sceneId, children: [
3595
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "min-w-0 flex-1 truncate", children: [
2533
3596
  "Into scene: ",
2534
3597
  transition.name ?? transition.effect,
2535
3598
  " (",
2536
3599
  transition.duration ?? 600,
2537
3600
  " ms)"
2538
3601
  ] }),
2539
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: btn, "aria-label": "Remove transition", onClick: () => run(() => controller.setSceneTransition(sceneId, null)), children: "\u2715" })
3602
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: btn, "aria-label": "Remove transition", onClick: () => run(() => controller.setSceneTransition(sceneId, null)), children: "\u2715" })
2540
3603
  ] }),
2541
- message && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
3604
+ message && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
2542
3605
  ] });
2543
3606
  }
2544
3607
 
2545
3608
  // src/canvas/ShapeNode.tsx
2546
- var import_jsx_runtime12 = require("react/jsx-runtime");
3609
+ var import_jsx_runtime14 = require("react/jsx-runtime");
2547
3610
  function ShapeNode({ id, data, width, height, selected, className = "", children, positionAbsoluteX, positionAbsoluteY }) {
2548
3611
  const shape = data?.shape;
2549
3612
  const brushImage = useShapeBrushstroke((0, import_canvas15.isShapeDescription)(shape) ? shape : null, width, height, { x: positionAbsoluteX ?? 0, y: positionAbsoluteY ?? 0 });
2550
3613
  if (!(0, import_canvas15.isShapeDescription)(shape)) return null;
2551
3614
  const render = (0, import_canvas15.getShapeRenderData)(shape, { width, height }, { id: id || data?.id });
2552
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3615
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2553
3616
  "div",
2554
3617
  {
2555
3618
  className: `pixerate-shape-node ${className}`.trim(),
@@ -2557,7 +3620,7 @@ function ShapeNode({ id, data, width, height, selected, className = "", children
2557
3620
  "data-selected": selected ? "true" : void 0,
2558
3621
  style: { position: "relative", width: "100%", height: "100%" },
2559
3622
  children: [
2560
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3623
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2561
3624
  "svg",
2562
3625
  {
2563
3626
  viewBox: render.viewBox,
@@ -2567,13 +3630,13 @@ function ShapeNode({ id, data, width, height, selected, className = "", children
2567
3630
  style: { display: "block", overflow: "visible" },
2568
3631
  "aria-hidden": "true",
2569
3632
  children: [
2570
- (render.fillGradient || render.strokeGradient) && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("defs", { children: [
2571
- render.fillGradient && render.fillGradient.type === "linear" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("linearGradient", { id: render.fillGradient.id, ...render.fillGradient.attrs, children: render.fillGradient.stops.map((stop, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("stop", { offset: stop.offset, stopColor: stop.stopColor, stopOpacity: stop.stopOpacity }, i)) }),
2572
- render.fillGradient && render.fillGradient.type === "radial" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("radialGradient", { id: render.fillGradient.id, ...render.fillGradient.attrs, children: render.fillGradient.stops.map((stop, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("stop", { offset: stop.offset, stopColor: stop.stopColor, stopOpacity: stop.stopOpacity }, i)) }),
2573
- render.strokeGradient && render.strokeGradient.type === "linear" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("linearGradient", { id: render.strokeGradient.id, ...render.strokeGradient.attrs, children: render.strokeGradient.stops.map((stop, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("stop", { offset: stop.offset, stopColor: stop.stopColor, stopOpacity: stop.stopOpacity }, i)) }),
2574
- render.strokeGradient && render.strokeGradient.type === "radial" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("radialGradient", { id: render.strokeGradient.id, ...render.strokeGradient.attrs, children: render.strokeGradient.stops.map((stop, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("stop", { offset: stop.offset, stopColor: stop.stopColor, stopOpacity: stop.stopOpacity }, i)) })
3633
+ (render.fillGradient || render.strokeGradient) && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("defs", { children: [
3634
+ render.fillGradient && render.fillGradient.type === "linear" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("linearGradient", { id: render.fillGradient.id, ...render.fillGradient.attrs, children: render.fillGradient.stops.map((stop, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("stop", { offset: stop.offset, stopColor: stop.stopColor, stopOpacity: stop.stopOpacity }, i)) }),
3635
+ render.fillGradient && render.fillGradient.type === "radial" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("radialGradient", { id: render.fillGradient.id, ...render.fillGradient.attrs, children: render.fillGradient.stops.map((stop, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("stop", { offset: stop.offset, stopColor: stop.stopColor, stopOpacity: stop.stopOpacity }, i)) }),
3636
+ render.strokeGradient && render.strokeGradient.type === "linear" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("linearGradient", { id: render.strokeGradient.id, ...render.strokeGradient.attrs, children: render.strokeGradient.stops.map((stop, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("stop", { offset: stop.offset, stopColor: stop.stopColor, stopOpacity: stop.stopOpacity }, i)) }),
3637
+ render.strokeGradient && render.strokeGradient.type === "radial" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("radialGradient", { id: render.strokeGradient.id, ...render.strokeGradient.attrs, children: render.strokeGradient.stops.map((stop, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("stop", { offset: stop.offset, stopColor: stop.stopColor, stopOpacity: stop.stopOpacity }, i)) })
2575
3638
  ] }),
2576
- brushImage ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("g", { transform: render.transform, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3639
+ brushImage ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("g", { transform: render.transform, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2577
3640
  "image",
2578
3641
  {
2579
3642
  className: "pixerate-shape-brushstroke",
@@ -2585,7 +3648,7 @@ function ShapeNode({ id, data, width, height, selected, className = "", children
2585
3648
  preserveAspectRatio: "none",
2586
3649
  opacity: render.opacity
2587
3650
  }
2588
- ) }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3651
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2589
3652
  "path",
2590
3653
  {
2591
3654
  d: render.d,
@@ -2603,7 +3666,7 @@ function ShapeNode({ id, data, width, height, selected, className = "", children
2603
3666
  ]
2604
3667
  }
2605
3668
  ),
2606
- shape.effect && width && height ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CanvasNodeEffectLayer, { effect: shape.effect, width, height, clipPath: render.d, clipTransform: render.transform }) : null,
3669
+ shape.effect && width && height ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CanvasNodeEffectLayer, { effect: shape.effect, width, height, clipPath: render.d, clipTransform: render.transform }) : null,
2607
3670
  children
2608
3671
  ]
2609
3672
  }
@@ -2617,15 +3680,15 @@ var import_canvas31 = require("@pixerate/editor/canvas");
2617
3680
  var import_canvas32 = require("@pixerate/editor/canvas");
2618
3681
 
2619
3682
  // src/canvas/useCanvasAutoLayout.ts
2620
- var import_react25 = require("react");
3683
+ var import_react28 = require("react");
2621
3684
  var import_canvas16 = require("@pixerate/editor/canvas");
2622
3685
  function useCanvasAutoLayout(options) {
2623
- const [guides, setGuides] = (0, import_react25.useState)([]);
2624
- const nodesRef = (0, import_react25.useRef)(options.nodes);
3686
+ const [guides, setGuides] = (0, import_react28.useState)([]);
3687
+ const nodesRef = (0, import_react28.useRef)(options.nodes);
2625
3688
  nodesRef.current = options.nodes;
2626
- const optionsRef = (0, import_react25.useRef)(options);
3689
+ const optionsRef = (0, import_react28.useRef)(options);
2627
3690
  optionsRef.current = options;
2628
- const controller = (0, import_react25.useMemo)(
3691
+ const controller = (0, import_react28.useMemo)(
2629
3692
  () => (0, import_canvas16.createCanvasAutoLayoutController)({
2630
3693
  getNodes: () => nodesRef.current,
2631
3694
  setNodes: (next) => {
@@ -2651,10 +3714,10 @@ function useCanvasAutoLayout(options) {
2651
3714
  }),
2652
3715
  []
2653
3716
  );
2654
- (0, import_react25.useLayoutEffect)(() => {
3717
+ (0, import_react28.useLayoutEffect)(() => {
2655
3718
  if (controller.hasPending) controller.flush();
2656
3719
  }, [options.nodes, controller]);
2657
- return (0, import_react25.useMemo)(
3720
+ return (0, import_react28.useMemo)(
2658
3721
  () => ({
2659
3722
  ...controller,
2660
3723
  /** Drop marker of the active reorder drag (flow coordinates). */
@@ -2668,15 +3731,15 @@ function useCanvasAutoLayout(options) {
2668
3731
  }
2669
3732
 
2670
3733
  // src/canvas/useCanvasTokens.ts
2671
- var import_react26 = require("react");
3734
+ var import_react29 = require("react");
2672
3735
  var import_canvas17 = require("@pixerate/editor/canvas");
2673
3736
  function useCanvasTokens(options) {
2674
3737
  const { store, nodes, setNodes, modes, properties } = options;
2675
- const state = (0, import_react26.useSyncExternalStore)(store.subscribe, store.getState, store.getState);
2676
- const latest = (0, import_react26.useRef)({ nodes, setNodes, modes, properties });
3738
+ const state = (0, import_react29.useSyncExternalStore)(store.subscribe, store.getState, store.getState);
3739
+ const latest = (0, import_react29.useRef)({ nodes, setNodes, modes, properties });
2677
3740
  latest.current = { nodes, setNodes, modes, properties };
2678
3741
  const opts = () => ({ modes: latest.current.modes, properties: latest.current.properties });
2679
- (0, import_react26.useEffect)(
3742
+ (0, import_react29.useEffect)(
2680
3743
  () => store.subscribe((event) => {
2681
3744
  if (event.deletedVariableIds.length === 0) return;
2682
3745
  latest.current.setNodes((prev) => (0, import_canvas17.detachTokenBindings)(prev, event.previous, event.deletedVariableIds, opts()));
@@ -2685,11 +3748,11 @@ function useCanvasTokens(options) {
2685
3748
  [store]
2686
3749
  );
2687
3750
  const modesKey = JSON.stringify(modes ?? {});
2688
- (0, import_react26.useEffect)(() => {
3751
+ (0, import_react29.useEffect)(() => {
2689
3752
  const next = (0, import_canvas17.resolveCanvasTokens)(nodes, state, opts());
2690
3753
  if (next !== nodes) setNodes(next);
2691
3754
  }, [nodes, state, modesKey, properties]);
2692
- const bind = (0, import_react26.useCallback)(
3755
+ const bind = (0, import_react29.useCallback)(
2693
3756
  (ids, propertyKey, variableId) => {
2694
3757
  const next = (0, import_canvas17.bindCanvasToken)(latest.current.nodes, ids, propertyKey, variableId, store.getState(), opts());
2695
3758
  if (next !== latest.current.nodes) latest.current.setNodes(next);
@@ -2697,7 +3760,7 @@ function useCanvasTokens(options) {
2697
3760
  // eslint-disable-next-line react-hooks/exhaustive-deps
2698
3761
  [store]
2699
3762
  );
2700
- const setMode = (0, import_react26.useCallback)(
3763
+ const setMode = (0, import_react29.useCallback)(
2701
3764
  (ids, collectionId, modeId) => {
2702
3765
  const next = (0, import_canvas17.setCanvasTokenMode)(latest.current.nodes, ids, collectionId, modeId, store.getState(), opts());
2703
3766
  if (next !== latest.current.nodes) latest.current.setNodes(next);
@@ -2705,7 +3768,7 @@ function useCanvasTokens(options) {
2705
3768
  // eslint-disable-next-line react-hooks/exhaustive-deps
2706
3769
  [store]
2707
3770
  );
2708
- const modesOf = (0, import_react26.useCallback)(
3771
+ const modesOf = (0, import_react29.useCallback)(
2709
3772
  (nodeId) => {
2710
3773
  const node = latest.current.nodes.find((n) => n.id === nodeId);
2711
3774
  return node ? (0, import_canvas17.getEffectiveTokenModes)(node, latest.current.nodes, store.getState(), opts()) : {};
@@ -2719,7 +3782,7 @@ function useCanvasTokens(options) {
2719
3782
  // src/canvas/TokenBindingPicker.tsx
2720
3783
  var import_canvas18 = require("@pixerate/editor/canvas");
2721
3784
  var import_tokens = require("@pixerate/editor/tokens");
2722
- var import_jsx_runtime13 = require("react/jsx-runtime");
3785
+ var import_jsx_runtime15 = require("react/jsx-runtime");
2723
3786
  function TokenBindingPicker({
2724
3787
  state,
2725
3788
  nodes,
@@ -2736,15 +3799,15 @@ function TokenBindingPicker({
2736
3799
  let rows = (0, import_canvas18.getBindableTokenProperties)(first, options);
2737
3800
  if (properties) rows = properties.map((key) => rows.find((p) => p.key === key)).filter((p) => !!p);
2738
3801
  const modes = (0, import_canvas18.getEffectiveTokenModes)(first, nodes, state, options);
2739
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { "data-token-binding-picker": "", className: `flex flex-col gap-1 text-xs text-foreground ${className}`, children: [
3802
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { "data-token-binding-picker": "", className: `flex flex-col gap-1 text-xs text-foreground ${className}`, children: [
2740
3803
  rows.map((property) => {
2741
3804
  const ids = new Set(selected.map((n) => (0, import_canvas18.getNodeTokenBindings)(n)[property.key] ?? ""));
2742
3805
  const value = ids.size === 1 ? [...ids][0] : "__mixed";
2743
3806
  const candidates = (0, import_canvas18.getTokensForProperty)(state, property, first);
2744
3807
  const resolved = value && value !== "__mixed" ? (0, import_tokens.resolveToken)(state, value, modes) : null;
2745
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center gap-2", "data-token-property": property.key, children: [
2746
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "w-28 shrink-0 text-muted-foreground", children: property.label }),
2747
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3808
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-2", "data-token-property": property.key, children: [
3809
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-28 shrink-0 text-muted-foreground", children: property.label }),
3810
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2748
3811
  "select",
2749
3812
  {
2750
3813
  "aria-label": `${property.label} variable`,
@@ -2759,11 +3822,11 @@ function TokenBindingPicker({
2759
3822
  }
2760
3823
  },
2761
3824
  children: [
2762
- value === "__mixed" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "__mixed", children: "Mixed" }) : null,
2763
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "", children: "None" }),
3825
+ value === "__mixed" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "__mixed", children: "Mixed" }) : null,
3826
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "", children: "None" }),
2764
3827
  candidates.map((v) => {
2765
3828
  const collection = state.collections.find((c) => c.id === v.collectionId);
2766
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("option", { value: v.id, children: [
3829
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("option", { value: v.id, children: [
2767
3830
  v.name,
2768
3831
  collection && state.collections.length > 1 ? ` (${collection.name})` : ""
2769
3832
  ] }, v.id);
@@ -2771,17 +3834,17 @@ function TokenBindingPicker({
2771
3834
  ]
2772
3835
  }
2773
3836
  ),
2774
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "w-16 shrink-0 truncate text-right text-muted-foreground", "data-token-resolved": "", children: resolved?.ok ? property.type === "color" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3837
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-16 shrink-0 truncate text-right text-muted-foreground", "data-token-resolved": "", children: resolved?.ok ? property.type === "color" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2775
3838
  "span",
2776
3839
  {
2777
3840
  className: "inline-block h-3 w-3 rounded border border-border align-middle",
2778
3841
  style: { background: String(resolved.value) },
2779
3842
  title: String(resolved.value)
2780
3843
  }
2781
- ) : String(resolved.value) : resolved ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { title: resolved.message, children: "\u26A0" }) : null })
3844
+ ) : String(resolved.value) : resolved ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { title: resolved.message, children: "\u26A0" }) : null })
2782
3845
  ] }, property.key);
2783
3846
  }),
2784
- state.collections.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-muted-foreground", children: "No variables yet." }) : null
3847
+ state.collections.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-muted-foreground", children: "No variables yet." }) : null
2785
3848
  ] });
2786
3849
  }
2787
3850
  function TokenModeSwitcher({
@@ -2799,12 +3862,12 @@ function TokenModeSwitcher({
2799
3862
  const parent = first.parentId ? nodes.find((n) => n.id === first.parentId) : void 0;
2800
3863
  const inherited = parent ? (0, import_canvas18.getEffectiveTokenModes)(parent, nodes, state, options) : { ...options.modes };
2801
3864
  const collections = state.collections.filter((c) => showSingleMode || c.modes.length > 1);
2802
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { "data-token-mode-switcher": "", className: `flex flex-col gap-1 text-xs text-foreground ${className}`, children: collections.map((collection) => {
3865
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { "data-token-mode-switcher": "", className: `flex flex-col gap-1 text-xs text-foreground ${className}`, children: collections.map((collection) => {
2803
3866
  const auto = (0, import_tokens.getCurrentMode)(collection, inherited);
2804
3867
  const explicit = collection.modes.some((m) => m.id === own[collection.id]) ? own[collection.id] : "";
2805
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center gap-2", "data-token-collection": collection.id, children: [
2806
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "w-28 shrink-0 truncate text-muted-foreground", children: collection.name }),
2807
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3868
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-2", "data-token-collection": collection.id, children: [
3869
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-28 shrink-0 truncate text-muted-foreground", children: collection.name }),
3870
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2808
3871
  "select",
2809
3872
  {
2810
3873
  "aria-label": `${collection.name} mode`,
@@ -2812,12 +3875,12 @@ function TokenModeSwitcher({
2812
3875
  value: explicit,
2813
3876
  onChange: (e) => onChange((0, import_canvas18.setCanvasTokenMode)(nodes, nodeIds, collection.id, e.currentTarget.value || null, state, options)),
2814
3877
  children: [
2815
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("option", { value: "", children: [
3878
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("option", { value: "", children: [
2816
3879
  "Auto (",
2817
3880
  auto.name,
2818
3881
  ")"
2819
3882
  ] }),
2820
- collection.modes.map((m) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: m.id, children: m.name }, m.id))
3883
+ collection.modes.map((m) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: m.id, children: m.name }, m.id))
2821
3884
  ]
2822
3885
  }
2823
3886
  )
@@ -2829,14 +3892,14 @@ function TokenModeSwitcher({
2829
3892
  var import_canvas33 = require("@pixerate/editor/canvas");
2830
3893
 
2831
3894
  // src/canvas/useCanvasAnimation.ts
2832
- var import_react27 = require("react");
3895
+ var import_react30 = require("react");
2833
3896
  var import_canvas19 = require("@pixerate/editor/canvas");
2834
3897
  function useCanvasAnimation(options) {
2835
- const nodesRef = (0, import_react27.useRef)(options.nodes);
3898
+ const nodesRef = (0, import_react30.useRef)(options.nodes);
2836
3899
  nodesRef.current = options.nodes;
2837
- const optionsRef = (0, import_react27.useRef)(options);
3900
+ const optionsRef = (0, import_react30.useRef)(options);
2838
3901
  optionsRef.current = options;
2839
- const controller = (0, import_react27.useMemo)(
3902
+ const controller = (0, import_react30.useMemo)(
2840
3903
  () => (0, import_canvas19.createCanvasAnimationController)({
2841
3904
  getNodes: () => nodesRef.current,
2842
3905
  setNodes: (next) => {
@@ -2863,26 +3926,26 @@ function useCanvasAnimation(options) {
2863
3926
  }),
2864
3927
  []
2865
3928
  );
2866
- (0, import_react27.useEffect)(() => () => controller.destroy(), [controller]);
2867
- (0, import_react27.useEffect)(() => {
3929
+ (0, import_react30.useEffect)(() => () => controller.destroy(), [controller]);
3930
+ (0, import_react30.useEffect)(() => {
2868
3931
  if (options.loop !== void 0) controller.setLoop(options.loop);
2869
3932
  }, [controller, options.loop]);
2870
- (0, import_react27.useEffect)(() => {
3933
+ (0, import_react30.useEffect)(() => {
2871
3934
  if (options.playbackRate !== void 0) controller.setPlaybackRate(options.playbackRate);
2872
3935
  }, [controller, options.playbackRate]);
2873
- (0, import_react27.useEffect)(() => {
3936
+ (0, import_react30.useEffect)(() => {
2874
3937
  if (options.recording !== void 0) controller.setRecording(options.recording);
2875
3938
  }, [controller, options.recording]);
2876
- const state = (0, import_react27.useSyncExternalStore)(
3939
+ const state = (0, import_react30.useSyncExternalStore)(
2877
3940
  (listener) => controller.subscribe(listener),
2878
3941
  () => controller.getState(),
2879
3942
  () => controller.getState()
2880
3943
  );
2881
- (0, import_react27.useEffect)(() => {
3944
+ (0, import_react30.useEffect)(() => {
2882
3945
  controller.refresh();
2883
3946
  }, [controller, options.nodes]);
2884
- const displayNodes = (0, import_react27.useMemo)(() => controller.display(options.nodes), [controller, options.nodes, state.time]);
2885
- return (0, import_react27.useMemo)(
3947
+ const displayNodes = (0, import_react30.useMemo)(() => controller.display(options.nodes), [controller, options.nodes, state.time]);
3948
+ return (0, import_react30.useMemo)(
2886
3949
  () => ({
2887
3950
  ...controller,
2888
3951
  state,
@@ -2903,9 +3966,9 @@ function useCanvasAnimation(options) {
2903
3966
  }
2904
3967
 
2905
3968
  // src/canvas/AnimationTimeline.tsx
2906
- var import_react28 = require("react");
3969
+ var import_react31 = require("react");
2907
3970
  var import_canvas20 = require("@pixerate/editor/canvas");
2908
- var import_jsx_runtime14 = require("react/jsx-runtime");
3971
+ var import_jsx_runtime16 = require("react/jsx-runtime");
2909
3972
  var LOOP_LABELS = { none: "Once", loop: "Loop", "ping-pong": "Ping-pong" };
2910
3973
  var easingValue = (easing) => typeof easing === "string" ? easing : easing ? "custom" : "linear";
2911
3974
  function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8, labelOf, className = "" }) {
@@ -2919,8 +3982,8 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
2919
3982
  for (const row of rows) for (const k of row.keyframes) if (k.selected && k.ref.property === first.property && k.ref.nodeId === first.nodeId) return easingValue(k.easing);
2920
3983
  return "";
2921
3984
  })();
2922
- const dragRef = (0, import_react28.useRef)(null);
2923
- (0, import_react28.useEffect)(() => {
3985
+ const dragRef = (0, import_react31.useRef)(null);
3986
+ (0, import_react31.useEffect)(() => {
2924
3987
  const onKey = (event) => {
2925
3988
  if (event.key === "Escape" && dragRef.current) {
2926
3989
  dragRef.current = null;
@@ -2976,10 +4039,10 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
2976
4039
  const btn2 = "rounded border border-border px-2 py-0.5 text-xs hover:bg-muted disabled:opacity-50";
2977
4040
  const playheadX = (0, import_canvas20.timeToX)(state.time, duration, width);
2978
4041
  const labelWidth = 120;
2979
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { "data-animation-timeline": "", className: `flex flex-col gap-1 text-xs text-foreground ${className}`, tabIndex: 0, onKeyDown: onTimelineKey, children: [
2980
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "toolbar", "aria-label": "Animation", children: [
2981
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: btn2, "data-action": "toggle-play", "aria-label": state.playing ? "Pause" : "Play", onClick: () => animation.toggle(), children: state.playing ? "\u275A\u275A" : "\u25B6" }),
2982
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4042
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { "data-animation-timeline": "", className: `flex flex-col gap-1 text-xs text-foreground ${className}`, tabIndex: 0, onKeyDown: onTimelineKey, children: [
4043
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "toolbar", "aria-label": "Animation", children: [
4044
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: btn2, "data-action": "toggle-play", "aria-label": state.playing ? "Pause" : "Play", onClick: () => animation.toggle(), children: state.playing ? "\u275A\u275A" : "\u25B6" }),
4045
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2983
4046
  "button",
2984
4047
  {
2985
4048
  type: "button",
@@ -2991,13 +4054,13 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
2991
4054
  children: "\u25CF Rec"
2992
4055
  }
2993
4056
  ),
2994
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: btn2, "data-action": "add-keyframe", onClick: () => animation.addKeyframe(), children: "\u25C6 Key" }),
2995
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { "data-time": "", className: "tabular-nums text-muted-foreground", children: [
4057
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: btn2, "data-action": "add-keyframe", onClick: () => animation.addKeyframe(), children: "\u25C6 Key" }),
4058
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { "data-time": "", className: "tabular-nums text-muted-foreground", children: [
2996
4059
  (0, import_canvas20.formatAnimationTime)(state.time),
2997
4060
  " / ",
2998
4061
  (0, import_canvas20.formatAnimationTime)(duration)
2999
4062
  ] }),
3000
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
4063
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3001
4064
  "select",
3002
4065
  {
3003
4066
  "aria-label": "Easing",
@@ -3007,13 +4070,13 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
3007
4070
  disabled: state.selection.length === 0,
3008
4071
  onChange: (e) => e.target.value && e.target.value !== "custom" && animation.setEasing(e.target.value),
3009
4072
  children: [
3010
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", children: "Easing\u2026" }),
3011
- import_canvas20.ANIMATION_EASING_PRESETS.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: preset, children: import_canvas20.ANIMATION_EASING_LABELS[preset] }, preset)),
3012
- selectedEasing === "custom" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "custom", children: "Custom" }) : null
4073
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "", children: "Easing\u2026" }),
4074
+ import_canvas20.ANIMATION_EASING_PRESETS.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: preset, children: import_canvas20.ANIMATION_EASING_LABELS[preset] }, preset)),
4075
+ selectedEasing === "custom" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "custom", children: "Custom" }) : null
3013
4076
  ]
3014
4077
  }
3015
4078
  ),
3016
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4079
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3017
4080
  "select",
3018
4081
  {
3019
4082
  "aria-label": "Loop",
@@ -3021,13 +4084,13 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
3021
4084
  className: "rounded border border-border bg-background px-1 py-0.5",
3022
4085
  value: state.loop,
3023
4086
  onChange: (e) => animation.setLoop(e.target.value),
3024
- children: Object.keys(LOOP_LABELS).map((mode) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: mode, children: LOOP_LABELS[mode] }, mode))
4087
+ children: Object.keys(LOOP_LABELS).map((mode) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: mode, children: LOOP_LABELS[mode] }, mode))
3025
4088
  }
3026
4089
  )
3027
4090
  ] }),
3028
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex", children: [
3029
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { width: labelWidth }, className: "shrink-0" }),
3030
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
4091
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex", children: [
4092
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { width: labelWidth }, className: "shrink-0" }),
4093
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3031
4094
  "div",
3032
4095
  {
3033
4096
  "data-timeline-ruler": "",
@@ -3035,15 +4098,15 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
3035
4098
  style: { width },
3036
4099
  onPointerDown: onRulerDown,
3037
4100
  children: [
3038
- ticks.map((tick) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "absolute top-0 -translate-x-1/2 text-[10px] text-muted-foreground", style: { left: tick.x }, children: tick.label }, tick.time)),
3039
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { "data-playhead": "", className: "absolute top-0 h-5 w-px bg-red-500", style: { left: playheadX } })
4101
+ ticks.map((tick) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "absolute top-0 -translate-x-1/2 text-[10px] text-muted-foreground", style: { left: tick.x }, children: tick.label }, tick.time)),
4102
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { "data-playhead": "", className: "absolute top-0 h-5 w-px bg-red-500", style: { left: playheadX } })
3040
4103
  ]
3041
4104
  }
3042
4105
  )
3043
4106
  ] }),
3044
- rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-muted-foreground", "data-timeline-empty": "", children: "Select an animated node, or press \u25C6 Key to add a keyframe." }) : rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center", "data-track": row.id, children: [
3045
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex shrink-0 items-center gap-1 truncate pr-2", style: { width: labelWidth }, title: `${row.nodeLabel} \xB7 ${row.label}`, children: [
3046
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4107
+ rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-muted-foreground", "data-timeline-empty": "", children: "Select an animated node, or press \u25C6 Key to add a keyframe." }) : rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center", "data-track": row.id, children: [
4108
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex shrink-0 items-center gap-1 truncate pr-2", style: { width: labelWidth }, title: `${row.nodeLabel} \xB7 ${row.label}`, children: [
4109
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3047
4110
  "input",
3048
4111
  {
3049
4112
  type: "checkbox",
@@ -3052,15 +4115,15 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
3052
4115
  onChange: (e) => animation.setTrackEnabled(row.nodeId, row.property, e.target.checked)
3053
4116
  }
3054
4117
  ),
3055
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "truncate", children: [
4118
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "truncate", children: [
3056
4119
  rows.filter((r) => r.nodeId === row.nodeId).length < rows.length ? `${row.nodeLabel} \xB7 ` : "",
3057
4120
  row.label
3058
4121
  ] })
3059
4122
  ] }),
3060
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { "data-lane": "", className: `relative h-5 rounded bg-muted/40 ${row.enabled ? "" : "opacity-50"}`, style: { width }, children: [
3061
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "pointer-events-none absolute top-0 h-5 w-px bg-red-500/60", style: { left: playheadX } }),
3062
- state.drag?.target != null ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { "data-snap-target": "", className: "pointer-events-none absolute top-0 h-5 w-px bg-sky-400", style: { left: (0, import_canvas20.timeToX)(state.drag.target, duration, width) } }) : null,
3063
- row.keyframes.map((k) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4123
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { "data-lane": "", className: `relative h-5 rounded bg-muted/40 ${row.enabled ? "" : "opacity-50"}`, style: { width }, children: [
4124
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "pointer-events-none absolute top-0 h-5 w-px bg-red-500/60", style: { left: playheadX } }),
4125
+ state.drag?.target != null ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { "data-snap-target": "", className: "pointer-events-none absolute top-0 h-5 w-px bg-sky-400", style: { left: (0, import_canvas20.timeToX)(state.drag.target, duration, width) } }) : null,
4126
+ row.keyframes.map((k) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3064
4127
  "button",
3065
4128
  {
3066
4129
  type: "button",
@@ -3083,14 +4146,14 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
3083
4146
  var import_canvas34 = require("@pixerate/editor/canvas");
3084
4147
 
3085
4148
  // src/canvas/useCanvasComponents.ts
3086
- var import_react29 = require("react");
4149
+ var import_react32 = require("react");
3087
4150
  var import_canvas21 = require("@pixerate/editor/canvas");
3088
4151
  function useCanvasComponents(options) {
3089
- const nodesRef = (0, import_react29.useRef)(options.nodes);
4152
+ const nodesRef = (0, import_react32.useRef)(options.nodes);
3090
4153
  nodesRef.current = options.nodes;
3091
- const optionsRef = (0, import_react29.useRef)(options);
4154
+ const optionsRef = (0, import_react32.useRef)(options);
3092
4155
  optionsRef.current = options;
3093
- const controller = (0, import_react29.useMemo)(
4156
+ const controller = (0, import_react32.useMemo)(
3094
4157
  () => (0, import_canvas21.createCanvasComponentsController)({
3095
4158
  getNodes: () => nodesRef.current,
3096
4159
  setNodes: (next) => {
@@ -3119,18 +4182,18 @@ function useCanvasComponents(options) {
3119
4182
  }),
3120
4183
  []
3121
4184
  );
3122
- (0, import_react29.useLayoutEffect)(() => {
4185
+ (0, import_react32.useLayoutEffect)(() => {
3123
4186
  if (optionsRef.current.autoSync !== false) controller.sync();
3124
4187
  }, [options.nodes, controller]);
3125
4188
  return controller;
3126
4189
  }
3127
4190
 
3128
4191
  // src/canvas/CanvasComponentsPanel.tsx
3129
- var import_react30 = require("react");
4192
+ var import_react33 = require("react");
3130
4193
  var import_canvas22 = require("@pixerate/editor/canvas");
3131
- var import_jsx_runtime15 = require("react/jsx-runtime");
4194
+ var import_jsx_runtime17 = require("react/jsx-runtime");
3132
4195
  function InlineField({ value, label, onCommit }) {
3133
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4196
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3134
4197
  "input",
3135
4198
  {
3136
4199
  type: "text",
@@ -3161,10 +4224,10 @@ function CanvasComponentsPanel({
3161
4224
  search = true,
3162
4225
  className = ""
3163
4226
  }) {
3164
- const [query, setQuery] = (0, import_react30.useState)("");
3165
- const [propsOpen, setPropsOpen] = (0, import_react30.useState)(null);
3166
- const [menuFor, setMenuFor] = (0, import_react30.useState)(null);
3167
- const [editing, setEditing] = (0, import_react30.useState)(null);
4227
+ const [query, setQuery] = (0, import_react33.useState)("");
4228
+ const [propsOpen, setPropsOpen] = (0, import_react33.useState)(null);
4229
+ const [menuFor, setMenuFor] = (0, import_react33.useState)(null);
4230
+ const [editing, setEditing] = (0, import_react33.useState)(null);
3168
4231
  const { components: all, sets } = (0, import_canvas22.listCanvasComponents)(nodes);
3169
4232
  const q = query.trim().toLowerCase();
3170
4233
  const match = (name) => !q || name.toLowerCase().includes(q);
@@ -3176,7 +4239,7 @@ function CanvasComponentsPanel({
3176
4239
  };
3177
4240
  const small = "shrink-0 rounded px-1 text-[10px] text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-40";
3178
4241
  const menuItem = "rounded px-2 py-0.5 text-left hover:bg-muted disabled:opacity-40";
3179
- const item = (id, name, count, extra = {}, onContextMenu) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
4242
+ const item = (id, name, count, extra = {}, onContextMenu) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3180
4243
  "button",
3181
4244
  {
3182
4245
  type: "button",
@@ -3193,17 +4256,17 @@ function CanvasComponentsPanel({
3193
4256
  e.dataTransfer.effectAllowed = "copy";
3194
4257
  },
3195
4258
  children: [
3196
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "truncate", children: [
3197
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { "aria-hidden": true, className: "mr-1 text-muted-foreground", children: "\u25C7" }),
4259
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "truncate", children: [
4260
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { "aria-hidden": true, className: "mr-1 text-muted-foreground", children: "\u25C7" }),
3198
4261
  name
3199
4262
  ] }),
3200
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-[10px] text-muted-foreground", "data-instance-count": "", children: count })
4263
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-[10px] text-muted-foreground", "data-instance-count": "", children: count })
3201
4264
  ]
3202
4265
  },
3203
4266
  id
3204
4267
  );
3205
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { "data-components-panel": "", className: `flex flex-col gap-1 text-xs text-foreground ${className}`, children: [
3206
- search ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4268
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { "data-components-panel": "", className: `flex flex-col gap-1 text-xs text-foreground ${className}`, children: [
4269
+ search ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3207
4270
  "input",
3208
4271
  {
3209
4272
  type: "search",
@@ -3213,11 +4276,11 @@ function CanvasComponentsPanel({
3213
4276
  onInput: (e) => setQuery(e.target.value)
3214
4277
  }
3215
4278
  ) : null,
3216
- shownSets.map((set) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { "data-component-set": set.id, className: "flex flex-col", children: [
3217
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-1", children: [
4279
+ shownSets.map((set) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { "data-component-set": set.id, className: "flex flex-col", children: [
4280
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-1", children: [
3218
4281
  item(set.id, set.name, set.variants.reduce((sum, v) => sum + v.instanceCount, 0), { "data-kind": "set" }),
3219
- components ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
3220
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4282
+ components ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
4283
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3221
4284
  "button",
3222
4285
  {
3223
4286
  type: "button",
@@ -3229,7 +4292,7 @@ function CanvasComponentsPanel({
3229
4292
  children: "+\xA0Variant"
3230
4293
  }
3231
4294
  ),
3232
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4295
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3233
4296
  "button",
3234
4297
  {
3235
4298
  type: "button",
@@ -3244,8 +4307,8 @@ function CanvasComponentsPanel({
3244
4307
  )
3245
4308
  ] }) : null
3246
4309
  ] }),
3247
- components && propsOpen === set.id ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { "data-variant-properties": set.id, className: "ml-3 flex flex-col gap-1 border-l border-border py-1 pl-2", children: set.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { "data-variant-option": option.name, className: "flex flex-col gap-0.5", children: [
3248
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4310
+ components && propsOpen === set.id ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { "data-variant-properties": set.id, className: "ml-3 flex flex-col gap-1 border-l border-border py-1 pl-2", children: set.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { "data-variant-option": option.name, className: "flex flex-col gap-0.5", children: [
4311
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3249
4312
  InlineField,
3250
4313
  {
3251
4314
  value: option.name,
@@ -3253,7 +4316,7 @@ function CanvasComponentsPanel({
3253
4316
  onCommit: (next) => report(components.renameVariantProperty(option.name, next, set.id))
3254
4317
  }
3255
4318
  ),
3256
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "ml-2 flex flex-wrap gap-1", children: option.values.map((value) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4319
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "ml-2 flex flex-wrap gap-1", children: option.values.map((value) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3257
4320
  InlineField,
3258
4321
  {
3259
4322
  value,
@@ -3263,8 +4326,8 @@ function CanvasComponentsPanel({
3263
4326
  value
3264
4327
  )) })
3265
4328
  ] }, option.name)) }) : null,
3266
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "ml-3 flex flex-col border-l border-border pl-1", children: set.variants.map((v) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { "data-variant-row": v.id, className: "flex flex-col", children: [
3267
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-1", children: [
4329
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "ml-3 flex flex-col border-l border-border pl-1", children: set.variants.map((v) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { "data-variant-row": v.id, className: "flex flex-col", children: [
4330
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-1", children: [
3268
4331
  item(
3269
4332
  v.id,
3270
4333
  v.name,
@@ -3275,7 +4338,7 @@ function CanvasComponentsPanel({
3275
4338
  setMenuFor(v.id);
3276
4339
  } : void 0
3277
4340
  ),
3278
- components ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4341
+ components ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3279
4342
  "button",
3280
4343
  {
3281
4344
  type: "button",
@@ -3289,8 +4352,8 @@ function CanvasComponentsPanel({
3289
4352
  }
3290
4353
  ) : null
3291
4354
  ] }),
3292
- components && menuFor === v.id ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { role: "menu", "data-variant-menu": v.id, className: "ml-2 flex flex-col rounded border border-border bg-background p-1 shadow", children: [
3293
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4355
+ components && menuFor === v.id ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { role: "menu", "data-variant-menu": v.id, className: "ml-2 flex flex-col rounded border border-border bg-background p-1 shadow", children: [
4356
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3294
4357
  "button",
3295
4358
  {
3296
4359
  type: "button",
@@ -3304,7 +4367,7 @@ function CanvasComponentsPanel({
3304
4367
  children: "Edit values\u2026"
3305
4368
  }
3306
4369
  ),
3307
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4370
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3308
4371
  "button",
3309
4372
  {
3310
4373
  type: "button",
@@ -3318,7 +4381,7 @@ function CanvasComponentsPanel({
3318
4381
  children: "Duplicate"
3319
4382
  }
3320
4383
  ),
3321
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4384
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3322
4385
  "button",
3323
4386
  {
3324
4387
  type: "button",
@@ -3335,7 +4398,7 @@ function CanvasComponentsPanel({
3335
4398
  }
3336
4399
  )
3337
4400
  ] }) : null,
3338
- components && editing === v.id ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
4401
+ components && editing === v.id ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3339
4402
  "form",
3340
4403
  {
3341
4404
  "data-variant-editor": v.id,
@@ -3349,9 +4412,9 @@ function CanvasComponentsPanel({
3349
4412
  if (report(components.setVariantProperties(values, v.id))) setEditing(null);
3350
4413
  },
3351
4414
  children: [
3352
- set.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-2", children: [
3353
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-16 shrink-0 truncate text-muted-foreground", children: option.name }),
3354
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4415
+ set.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-2", children: [
4416
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-16 shrink-0 truncate text-muted-foreground", children: option.name }),
4417
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3355
4418
  "input",
3356
4419
  {
3357
4420
  type: "text",
@@ -3362,9 +4425,9 @@ function CanvasComponentsPanel({
3362
4425
  }
3363
4426
  )
3364
4427
  ] }, option.name)),
3365
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex gap-1", children: [
3366
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "submit", className: "rounded border border-border px-2 py-0.5 hover:bg-muted", "data-action": "save-variant", children: "Save" }),
3367
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "rounded px-2 py-0.5 hover:bg-muted", "data-action": "cancel-variant", onClick: () => setEditing(null), children: "Cancel" })
4428
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex gap-1", children: [
4429
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "submit", className: "rounded border border-border px-2 py-0.5 hover:bg-muted", "data-action": "save-variant", children: "Save" }),
4430
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: "rounded px-2 py-0.5 hover:bg-muted", "data-action": "cancel-variant", onClick: () => setEditing(null), children: "Cancel" })
3368
4431
  ] })
3369
4432
  ]
3370
4433
  }
@@ -3372,7 +4435,7 @@ function CanvasComponentsPanel({
3372
4435
  ] }, v.id)) })
3373
4436
  ] }, set.id)),
3374
4437
  lone.map((c) => item(c.id, c.name, c.instanceCount, { "data-kind": "component" })),
3375
- all.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-muted-foreground", children: "No components yet. Select a frame and choose Create Component." }) : null
4438
+ all.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-muted-foreground", children: "No components yet. Select a frame and choose Create Component." }) : null
3376
4439
  ] });
3377
4440
  }
3378
4441
  function CanvasInstanceInspector({
@@ -3391,27 +4454,27 @@ function CanvasInstanceInspector({
3391
4454
  const allComponents = (0, import_canvas22.listCanvasComponents)(nodes).components;
3392
4455
  const linked = info.status === "linked";
3393
4456
  const btn2 = "rounded border border-border px-2 py-0.5 text-xs hover:bg-muted disabled:opacity-40";
3394
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { "data-instance-inspector": "", "data-instance-id": info.id, className: `flex flex-col gap-2 text-xs text-foreground ${className}`, children: [
3395
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
3396
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "truncate font-medium", "data-instance-main": "", children: linked ? info.componentName : "Main component missing" }),
3397
- info.nested ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-muted-foreground", children: "Nested" }) : null
4457
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { "data-instance-inspector": "", "data-instance-id": info.id, className: `flex flex-col gap-2 text-xs text-foreground ${className}`, children: [
4458
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
4459
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "truncate font-medium", "data-instance-main": "", children: linked ? info.componentName : "Main component missing" }),
4460
+ info.nested ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-muted-foreground", children: "Nested" }) : null
3398
4461
  ] }),
3399
- info.variantOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-2", "data-variant-property": option.name, children: [
3400
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-24 shrink-0 truncate text-muted-foreground", children: option.name }),
3401
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4462
+ info.variantOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-2", "data-variant-property": option.name, children: [
4463
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-24 shrink-0 truncate text-muted-foreground", children: option.name }),
4464
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3402
4465
  "select",
3403
4466
  {
3404
4467
  "aria-label": `${option.name} variant`,
3405
4468
  className: "min-w-0 flex-1 rounded border border-border bg-background px-1 py-0.5 text-xs",
3406
4469
  value: info.variant[option.name] ?? "",
3407
4470
  onChange: (e) => setProp(option.name, e.currentTarget.value),
3408
- children: option.values.map((v) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: v, children: v }, v))
4471
+ children: option.values.map((v) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: v, children: v }, v))
3409
4472
  }
3410
4473
  )
3411
4474
  ] }, option.name)),
3412
- info.properties.map((p) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-2", "data-component-property": p.name, children: [
3413
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-24 shrink-0 truncate text-muted-foreground", children: p.name }),
3414
- p.type === "boolean" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "checkbox", "aria-label": p.name, checked: p.value === true, onChange: (e) => setProp(p.name, e.currentTarget.checked) }) : p.type === "text" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4475
+ info.properties.map((p) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-2", "data-component-property": p.name, children: [
4476
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-24 shrink-0 truncate text-muted-foreground", children: p.name }),
4477
+ p.type === "boolean" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "checkbox", "aria-label": p.name, checked: p.value === true, onChange: (e) => setProp(p.name, e.currentTarget.checked) }) : p.type === "text" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3415
4478
  "input",
3416
4479
  {
3417
4480
  type: "text",
@@ -3426,22 +4489,22 @@ function CanvasInstanceInspector({
3426
4489
  }
3427
4490
  },
3428
4491
  String(p.value)
3429
- ) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4492
+ ) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3430
4493
  "select",
3431
4494
  {
3432
4495
  "aria-label": p.name,
3433
4496
  className: "min-w-0 flex-1 rounded border border-border bg-background px-1 py-0.5 text-xs",
3434
4497
  value: String(p.value),
3435
4498
  onChange: (e) => setProp(p.name, e.currentTarget.value),
3436
- children: allComponents.filter((c) => !p.preferred?.length || p.preferred.includes(c.id) || c.id === p.value).map((c) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: c.id, children: c.name }, c.id))
4499
+ children: allComponents.filter((c) => !p.preferred?.length || p.preferred.includes(c.id) || c.id === p.value).map((c) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: c.id, children: c.name }, c.id))
3437
4500
  }
3438
4501
  )
3439
4502
  ] }, p.name)),
3440
- info.overrides.length ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-col gap-1", "data-instance-overrides": "", children: [
3441
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-muted-foreground", children: "Overrides" }),
3442
- info.overrides.map((o) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-override-layer": o.id, children: [
3443
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "mr-1 truncate", children: o.name }),
3444
- o.groups.map((g) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
4503
+ info.overrides.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-col gap-1", "data-instance-overrides": "", children: [
4504
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-muted-foreground", children: "Overrides" }),
4505
+ info.overrides.map((o) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-override-layer": o.id, children: [
4506
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "mr-1 truncate", children: o.name }),
4507
+ o.groups.map((g) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3445
4508
  "button",
3446
4509
  {
3447
4510
  type: "button",
@@ -3458,11 +4521,11 @@ function CanvasInstanceInspector({
3458
4521
  ))
3459
4522
  ] }, o.id))
3460
4523
  ] }) : null,
3461
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
3462
- linked ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
3463
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: btn2, "data-action": "reset", onClick: () => report(components.resetOverrides(info.id)), children: "Reset all" }),
3464
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: btn2, "data-action": "go-to-main", onClick: () => components.goToMainComponent(info.id), children: "Go to main" }),
3465
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4524
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
4525
+ linked ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
4526
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: btn2, "data-action": "reset", onClick: () => report(components.resetOverrides(info.id)), children: "Reset all" }),
4527
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: btn2, "data-action": "go-to-main", onClick: () => components.goToMainComponent(info.id), children: "Go to main" }),
4528
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3466
4529
  "button",
3467
4530
  {
3468
4531
  type: "button",
@@ -3473,8 +4536,8 @@ function CanvasInstanceInspector({
3473
4536
  children: "Push changes"
3474
4537
  }
3475
4538
  )
3476
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: btn2, "data-action": "restore", onClick: () => report(components.restoreMainComponent(info.rootId)), children: "Restore main component" }),
3477
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4539
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: btn2, "data-action": "restore", onClick: () => report(components.restoreMainComponent(info.rootId)), children: "Restore main component" }),
4540
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3478
4541
  "button",
3479
4542
  {
3480
4543
  type: "button",
@@ -3494,9 +4557,9 @@ function CanvasInstanceInspector({
3494
4557
  var import_canvas35 = require("@pixerate/editor/canvas");
3495
4558
 
3496
4559
  // src/canvas/MermaidFamilyScene.tsx
3497
- var import_react31 = require("react");
4560
+ var import_react34 = require("react");
3498
4561
  var import_canvas23 = require("@pixerate/editor/canvas");
3499
- var import_jsx_runtime16 = require("react/jsx-runtime");
4562
+ var import_jsx_runtime18 = require("react/jsx-runtime");
3500
4563
  function MermaidFamilyScene({
3501
4564
  scene,
3502
4565
  padding = 16,
@@ -3509,7 +4572,7 @@ function MermaidFamilyScene({
3509
4572
  style,
3510
4573
  title
3511
4574
  }) {
3512
- const uid = (0, import_react31.useId)().replace(/:/g, "");
4575
+ const uid = (0, import_react34.useId)().replace(/:/g, "");
3513
4576
  const marker = (kind) => kind ? `url(#${uid}-${kind})` : void 0;
3514
4577
  const x = scene.x - padding;
3515
4578
  const y = scene.y - padding;
@@ -3527,7 +4590,7 @@ function MermaidFamilyScene({
3527
4590
  cursor: "pointer"
3528
4591
  } : { pointerEvents: "none" };
3529
4592
  const stroke = (mark) => mark.selected ? { stroke: selectionColor, strokeWidth: Math.max(2, mark.strokeWidth ?? 0) } : { stroke: mark.stroke, strokeWidth: mark.strokeWidth };
3530
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
4593
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3531
4594
  "svg",
3532
4595
  {
3533
4596
  className: `pixerate-diagram-scene ${className}`.trim(),
@@ -3540,15 +4603,15 @@ function MermaidFamilyScene({
3540
4603
  style: { display: "block", maxWidth: "100%", height: "auto", overflow: "visible", ...style },
3541
4604
  onClick: interactive ? (event) => onSelect?.(null, event) : void 0,
3542
4605
  children: [
3543
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("defs", { children: [
3544
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("marker", { id: `${uid}-arrowclosed`, viewBox: "0 0 10 10", refX: "9", refY: "5", markerWidth: "8", markerHeight: "8", orient: "auto-start-reverse", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M0,0 L10,5 L0,10 Z", style: { fill: markerColor } }) }),
3545
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("marker", { id: `${uid}-arrow`, viewBox: "0 0 10 10", refX: "9", refY: "5", markerWidth: "8", markerHeight: "8", orient: "auto-start-reverse", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M0,0 L10,5 L0,10", style: { fill: "none", stroke: markerColor, strokeWidth: 1.5 } }) })
4606
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("defs", { children: [
4607
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("marker", { id: `${uid}-arrowclosed`, viewBox: "0 0 10 10", refX: "9", refY: "5", markerWidth: "8", markerHeight: "8", orient: "auto-start-reverse", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M0,0 L10,5 L0,10 Z", style: { fill: markerColor } }) }),
4608
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("marker", { id: `${uid}-arrow`, viewBox: "0 0 10 10", refX: "9", refY: "5", markerWidth: "8", markerHeight: "8", orient: "auto-start-reverse", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M0,0 L10,5 L0,10", style: { fill: "none", stroke: markerColor, strokeWidth: 1.5 } }) })
3546
4609
  ] }),
3547
4610
  scene.marks.map((mark) => {
3548
4611
  const common = { "data-role": mark.role, "data-target": mark.target, "data-selected": mark.selected ? "" : void 0, opacity: mark.opacity, ...handlers(mark) };
3549
4612
  switch (mark.kind) {
3550
4613
  case "rect":
3551
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4614
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3552
4615
  "rect",
3553
4616
  {
3554
4617
  ...common,
@@ -3563,9 +4626,9 @@ function MermaidFamilyScene({
3563
4626
  mark.key
3564
4627
  );
3565
4628
  case "circle":
3566
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("circle", { ...common, cx: mark.cx, cy: mark.cy, r: mark.r, style: { fill: mark.fill, ...stroke(mark) } }, mark.key);
4629
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("circle", { ...common, cx: mark.cx, cy: mark.cy, r: mark.r, style: { fill: mark.fill, ...stroke(mark) } }, mark.key);
3567
4630
  case "line":
3568
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4631
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3569
4632
  "line",
3570
4633
  {
3571
4634
  ...common,
@@ -3581,7 +4644,7 @@ function MermaidFamilyScene({
3581
4644
  mark.key
3582
4645
  );
3583
4646
  case "path":
3584
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4647
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3585
4648
  "path",
3586
4649
  {
3587
4650
  ...common,
@@ -3595,7 +4658,7 @@ function MermaidFamilyScene({
3595
4658
  mark.key
3596
4659
  );
3597
4660
  case "text":
3598
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4661
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3599
4662
  "text",
3600
4663
  {
3601
4664
  ...common,
@@ -3623,14 +4686,14 @@ function MermaidFamilyScene({
3623
4686
  }
3624
4687
 
3625
4688
  // src/canvas/useMermaidDiagram.ts
3626
- var import_react32 = require("react");
4689
+ var import_react35 = require("react");
3627
4690
  var import_diagram = require("@pixerate/editor/diagram");
3628
4691
  var import_canvas24 = require("@pixerate/editor/canvas");
3629
4692
  function useDiagramState(controller) {
3630
- return (0, import_react32.useSyncExternalStore)(controller.subscribe, controller.getState, controller.getState);
4693
+ return (0, import_react35.useSyncExternalStore)(controller.subscribe, controller.getState, controller.getState);
3631
4694
  }
3632
4695
  function useMermaidDiagram(controllerOrOptions = {}, view = {}) {
3633
- const own = (0, import_react32.useRef)(null);
4696
+ const own = (0, import_react35.useRef)(null);
3634
4697
  let controller;
3635
4698
  if (controllerOrOptions instanceof import_diagram.DiagramController) controller = controllerOrOptions;
3636
4699
  else {
@@ -3640,21 +4703,21 @@ function useMermaidDiagram(controllerOrOptions = {}, view = {}) {
3640
4703
  const layoutOptions = (controllerOrOptions instanceof import_diagram.DiagramController ? void 0 : controllerOrOptions.layoutOptions) ?? view.layoutOptions;
3641
4704
  const sceneTheme = (controllerOrOptions instanceof import_diagram.DiagramController ? void 0 : controllerOrOptions.sceneTheme) ?? view.sceneTheme;
3642
4705
  const state = useDiagramState(controller);
3643
- const editorDocument = (0, import_react32.useMemo)(() => (0, import_diagram.createDiagramEditorDocument)(controller), [controller]);
3644
- (0, import_react32.useEffect)(() => () => editorDocument.destroy(), [editorDocument]);
3645
- const canvas = (0, import_react32.useMemo)(
4706
+ const editorDocument = (0, import_react35.useMemo)(() => (0, import_diagram.createDiagramEditorDocument)(controller), [controller]);
4707
+ (0, import_react35.useEffect)(() => () => editorDocument.destroy(), [editorDocument]);
4708
+ const canvas = (0, import_react35.useMemo)(
3646
4709
  () => (0, import_canvas24.mermaidToCanvas)(state.document, { ...layoutOptions, editable: state.editable }),
3647
4710
  // eslint-disable-next-line react-hooks/exhaustive-deps
3648
4711
  [state.document, state.editable]
3649
4712
  );
3650
- const scene = (0, import_react32.useMemo)(
4713
+ const scene = (0, import_react35.useMemo)(
3651
4714
  () => state.document.tier === "editable" ? (0, import_canvas24.familySceneFromLayout)(state.document.family, state.document.graph, canvas.layout, { theme: { ...import_canvas24.CSS_VARIABLE_DIAGRAM_SCENE_THEME, ...sceneTheme }, selection: state.selection }) : null,
3652
4715
  // eslint-disable-next-line react-hooks/exhaustive-deps
3653
4716
  [state.document, canvas.layout, state.selection]
3654
4717
  );
3655
- const layoutRef = (0, import_react32.useRef)(canvas.layout);
4718
+ const layoutRef = (0, import_react35.useRef)(canvas.layout);
3656
4719
  layoutRef.current = canvas.layout;
3657
- const actions = (0, import_react32.useMemo)(
4720
+ const actions = (0, import_react35.useMemo)(
3658
4721
  () => ({
3659
4722
  apply: (ops, label) => controller.apply(ops, label),
3660
4723
  load: (source, options) => controller.load(source, options),
@@ -3691,13 +4754,13 @@ function useMermaidDiagram(controllerOrOptions = {}, view = {}) {
3691
4754
  }
3692
4755
  function useMermaidStream(source, options = {}) {
3693
4756
  const { complete = false, duration = 300, ...layoutOptions } = options;
3694
- const stream = (0, import_react32.useRef)(null);
4757
+ const stream = (0, import_react35.useRef)(null);
3695
4758
  if (!stream.current) stream.current = new import_canvas24.DiagramStream(layoutOptions);
3696
- const result = (0, import_react32.useMemo)(() => stream.current.update(source, complete), [source, complete]);
3697
- const [shown, setShown] = (0, import_react32.useState)({ layout: result.layout, settled: true });
3698
- const shownRef = (0, import_react32.useRef)(shown.layout);
4759
+ const result = (0, import_react35.useMemo)(() => stream.current.update(source, complete), [source, complete]);
4760
+ const [shown, setShown] = (0, import_react35.useState)({ layout: result.layout, settled: true });
4761
+ const shownRef = (0, import_react35.useRef)(shown.layout);
3699
4762
  shownRef.current = shown.layout;
3700
- (0, import_react32.useEffect)(() => {
4763
+ (0, import_react35.useEffect)(() => {
3701
4764
  const target = result.layout;
3702
4765
  if (!target) return setShown({ layout: null, settled: true });
3703
4766
  const from = shownRef.current;
@@ -3714,7 +4777,7 @@ function useMermaidStream(source, options = {}) {
3714
4777
  return () => cancelAnimationFrame(frame);
3715
4778
  }, [result.layout, duration]);
3716
4779
  const doc = result.document.tier === "editable" ? result.document : null;
3717
- const canvas = (0, import_react32.useMemo)(() => {
4780
+ const canvas = (0, import_react35.useMemo)(() => {
3718
4781
  if (!doc || !shown.layout) return { nodes: [], edges: [] };
3719
4782
  const placed = new Set(Object.keys(shown.layout.positions));
3720
4783
  const graph = {
@@ -3730,7 +4793,7 @@ function useMermaidStream(source, options = {}) {
3730
4793
 
3731
4794
  // src/canvas/MermaidDiagramNode.tsx
3732
4795
  var import_canvas25 = require("@pixerate/editor/canvas");
3733
- var import_jsx_runtime17 = require("react/jsx-runtime");
4796
+ var import_jsx_runtime19 = require("react/jsx-runtime");
3734
4797
  function mermaidNodeStyle(styles = {}, selected = false) {
3735
4798
  const paint = (0, import_canvas25.mermaidNodePaint)(styles, selected);
3736
4799
  const { color, "stroke-width": strokeWidth, "stroke-dasharray": strokeDasharray, ...vars } = paint;
@@ -3740,7 +4803,7 @@ function MermaidDiagramNode({ data, width = 160, height = 56, selected, classNam
3740
4803
  const node = data.node;
3741
4804
  if (!node) return null;
3742
4805
  const members = (0, import_canvas25.mermaidNodeMembers)(node.data);
3743
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
4806
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
3744
4807
  "div",
3745
4808
  {
3746
4809
  className: `pixerate-diagram-node ${className}`.trim(),
@@ -3748,14 +4811,14 @@ function MermaidDiagramNode({ data, width = 160, height = 56, selected, classNam
3748
4811
  "data-selected": selected ? "true" : void 0,
3749
4812
  style: { position: "relative", width: "100%", height: "100%", ...mermaidNodeStyle(data.resolvedStyles, selected) },
3750
4813
  children: [
3751
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", { viewBox: `0 0 ${width} ${height}`, preserveAspectRatio: "none", width: "100%", height: "100%", style: { position: "absolute", inset: 0, overflow: "visible" }, "aria-hidden": "true", children: (0, import_canvas25.mermaidShapePaths)(node.shape, width, height).map((path, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: path.d, style: { ...import_canvas25.MERMAID_SHAPE_PAINT[path.paint], vectorEffect: "non-scaling-stroke" } }, i)) }),
3752
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
4814
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { viewBox: `0 0 ${width} ${height}`, preserveAspectRatio: "none", width: "100%", height: "100%", style: { position: "absolute", inset: 0, overflow: "visible" }, "aria-hidden": "true", children: (0, import_canvas25.mermaidShapePaths)(node.shape, width, height).map((path, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: path.d, style: { ...import_canvas25.MERMAID_SHAPE_PAINT[path.paint], vectorEffect: "non-scaling-stroke" } }, i)) }),
4815
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
3753
4816
  "div",
3754
4817
  {
3755
4818
  style: { position: "relative", display: "flex", flexDirection: "column", alignItems: "center", justifyContent: members.length ? "flex-start" : "center", height: "100%", padding: "6px 10px", boxSizing: "border-box", fontSize: 13, lineHeight: 1.3, textAlign: "center", pointerEvents: "none" },
3756
4819
  children: [
3757
- (0, import_canvas25.mermaidLabelLines)(node.label).map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { fontWeight: members.length ? 600 : void 0 }, children: line }, i)),
3758
- members.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { alignSelf: "stretch", marginTop: 4, paddingTop: 4, borderTop: "1px solid var(--pixerate-diagram-node-border)", textAlign: "left", fontSize: 12 }, children: members.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: m }, i)) })
4820
+ (0, import_canvas25.mermaidLabelLines)(node.label).map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { style: { fontWeight: members.length ? 600 : void 0 }, children: line }, i)),
4821
+ members.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: { alignSelf: "stretch", marginTop: 4, paddingTop: 4, borderTop: "1px solid var(--pixerate-diagram-node-border)", textAlign: "left", fontSize: 12 }, children: members.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: m }, i)) })
3759
4822
  ]
3760
4823
  }
3761
4824
  ),
@@ -3767,7 +4830,7 @@ function MermaidDiagramNode({ data, width = 160, height = 56, selected, classNam
3767
4830
  function MermaidDiagramGroup({ data, selected, className = "", children }) {
3768
4831
  const group = data.group;
3769
4832
  if (!group) return null;
3770
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
4833
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
3771
4834
  "div",
3772
4835
  {
3773
4836
  className: `pixerate-diagram-group ${className}`.trim(),
@@ -3782,7 +4845,7 @@ function MermaidDiagramGroup({ data, selected, className = "", children }) {
3782
4845
  color: data.resolvedStyles?.color ?? "var(--muted-foreground, #475569)"
3783
4846
  },
3784
4847
  children: [
3785
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { padding: "6px 10px", fontSize: 12, fontWeight: 600 }, children: (0, import_canvas25.mermaidLabelLines)(group.label).join(" ") }),
4848
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: { padding: "6px 10px", fontSize: 12, fontWeight: 600 }, children: (0, import_canvas25.mermaidLabelLines)(group.label).join(" ") }),
3786
4849
  children
3787
4850
  ]
3788
4851
  }
@@ -3790,29 +4853,29 @@ function MermaidDiagramGroup({ data, selected, className = "", children }) {
3790
4853
  }
3791
4854
 
3792
4855
  // src/canvas/MermaidThumbnail.tsx
3793
- var import_react33 = require("react");
4856
+ var import_react36 = require("react");
3794
4857
  var import_diagram2 = require("@pixerate/editor/diagram");
3795
4858
  var import_canvas26 = require("@pixerate/editor/canvas");
3796
- var import_jsx_runtime18 = require("react/jsx-runtime");
4859
+ var import_jsx_runtime20 = require("react/jsx-runtime");
3797
4860
  function MermaidThumbnail({ source, className = "", fallback = null, ...options }) {
3798
- const doc = (0, import_react33.useMemo)(() => typeof source === "string" ? (0, import_diagram2.parseMermaid)(source) : source, [source]);
4861
+ const doc = (0, import_react36.useMemo)(() => typeof source === "string" ? (0, import_diagram2.parseMermaid)(source) : source, [source]);
3799
4862
  const key = JSON.stringify(options);
3800
- const drawn = (0, import_react33.useMemo)(
4863
+ const drawn = (0, import_react36.useMemo)(
3801
4864
  () => doc.tier === "editable" && doc.graph.nodes.length ? (0, import_canvas26.mermaidThumbnailSvg)(doc, options) : null,
3802
4865
  // eslint-disable-next-line react-hooks/exhaustive-deps
3803
4866
  [doc, key]
3804
4867
  );
3805
- if (!drawn) return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, { children: fallback });
3806
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: `pixerate-diagram-thumbnail ${className}`.trim(), style: { display: "inline-block", lineHeight: 0 }, dangerouslySetInnerHTML: { __html: drawn.svg } });
4868
+ if (!drawn) return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children: fallback });
4869
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: `pixerate-diagram-thumbnail ${className}`.trim(), style: { display: "inline-block", lineHeight: 0 }, dangerouslySetInnerHTML: { __html: drawn.svg } });
3807
4870
  }
3808
4871
 
3809
4872
  // src/canvas/useDiagramDirector.ts
3810
- var import_react34 = require("react");
4873
+ var import_react37 = require("react");
3811
4874
  var import_diagram3 = require("@pixerate/editor/diagram");
3812
4875
  function useDiagramDirector(controller, options) {
3813
- const placement = (0, import_react34.useRef)(options.placement);
4876
+ const placement = (0, import_react37.useRef)(options.placement);
3814
4877
  placement.current = options.placement;
3815
- const ref = (0, import_react34.useRef)(null);
4878
+ const ref = (0, import_react37.useRef)(null);
3816
4879
  if (!ref.current) {
3817
4880
  const presence = new import_diagram3.PresenceStore();
3818
4881
  ref.current = {
@@ -3823,17 +4886,17 @@ function useDiagramDirector(controller, options) {
3823
4886
  return ref.current;
3824
4887
  }
3825
4888
  function usePresenceState(presence) {
3826
- return (0, import_react34.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
4889
+ return (0, import_react37.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
3827
4890
  }
3828
4891
 
3829
4892
  // src/canvas/DiagramPresenceLayer.tsx
3830
- var import_jsx_runtime19 = require("react/jsx-runtime");
4893
+ var import_jsx_runtime21 = require("react/jsx-runtime");
3831
4894
  function DiagramPresenceLayer({ presence, viewport, className = "" }) {
3832
4895
  const { actors } = usePresenceState(presence);
3833
4896
  if (!actors.length) return null;
3834
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: `pixerate-diagram-presence ${className}`.trim(), "aria-hidden": "true", style: { position: "absolute", inset: 0, pointerEvents: "none", overflow: "hidden", zIndex: 50 }, children: actors.map((a) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${a.x * viewport.zoom + viewport.x}px, ${a.y * viewport.zoom + viewport.y}px)` }, children: [
3835
- /* @__PURE__ */ (0, import_jsx_runtime19.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" }, children: /* @__PURE__ */ (0, import_jsx_runtime19.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 } }) }),
3836
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { style: { position: "absolute", left: 14, top: 16, whiteSpace: "nowrap", borderRadius: 4, padding: "1px 6px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.message ?? a.name })
4897
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: `pixerate-diagram-presence ${className}`.trim(), "aria-hidden": "true", style: { position: "absolute", inset: 0, pointerEvents: "none", overflow: "hidden", zIndex: 50 }, children: actors.map((a) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${a.x * viewport.zoom + viewport.x}px, ${a.y * viewport.zoom + viewport.y}px)` }, children: [
4898
+ /* @__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" }, 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 } }) }),
4899
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { position: "absolute", left: 14, top: 16, whiteSpace: "nowrap", borderRadius: 4, padding: "1px 6px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.message ?? a.name })
3837
4900
  ] }, a.id)) });
3838
4901
  }
3839
4902
  // Annotate the CommonJS export names for ESM import in node: