@pixerate/editor-react 0.193.0 → 0.195.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.
@@ -1837,7 +1837,132 @@ function ShapeNode({ id, data, width, height, selected, className = "", children
1837
1837
  );
1838
1838
  }
1839
1839
 
1840
+ // src/canvas/AnimatedEdge.tsx
1841
+ import { useEffect as useEffect12, useMemo as useMemo11, useState as useState9 } from "react";
1842
+ import {
1843
+ getCanvasEdgeAnimation,
1844
+ getCanvasEdgeAnimationRender,
1845
+ getCanvasEdgePath,
1846
+ resolveCanvasEdgeAnimation
1847
+ } from "@pixerate/editor/canvas";
1848
+ import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
1849
+ var REDUCED_MOTION = "(prefers-reduced-motion: reduce)";
1850
+ function usePrefersReducedMotion() {
1851
+ const [reduced, setReduced] = useState9(() => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(REDUCED_MOTION).matches);
1852
+ useEffect12(() => {
1853
+ if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
1854
+ const query = window.matchMedia(REDUCED_MOTION);
1855
+ const update = () => setReduced(query.matches);
1856
+ update();
1857
+ query.addEventListener?.("change", update);
1858
+ return () => query.removeEventListener?.("change", update);
1859
+ }, []);
1860
+ return reduced;
1861
+ }
1862
+ function EdgeAnimation({ animation, path, id, stroke, reducedMotion }) {
1863
+ const prefersReduced = usePrefersReducedMotion();
1864
+ const render = useMemo11(() => {
1865
+ if (!animation) return null;
1866
+ try {
1867
+ return getCanvasEdgeAnimationRender(animation, { path, id, stroke, reducedMotion: reducedMotion ?? prefersReduced });
1868
+ } catch {
1869
+ return null;
1870
+ }
1871
+ }, [animation, path, id, stroke, reducedMotion, prefersReduced]);
1872
+ if (!render) return null;
1873
+ const pathId = `pixerate-edge-path-${id.replace(/[^a-zA-Z0-9_-]/g, "_")}`;
1874
+ return /* @__PURE__ */ jsxs6("g", { className: "pixerate-edge-animation", "data-edge-animation": render.kind, "data-moving": render.moving ? "true" : "false", style: { pointerEvents: "none" }, children: [
1875
+ /* @__PURE__ */ jsxs6("defs", { children: [
1876
+ /* @__PURE__ */ jsx7("path", { id: pathId, d: path }),
1877
+ render.glowFilter && /* @__PURE__ */ jsxs6(
1878
+ "filter",
1879
+ {
1880
+ id: render.glowFilter.id,
1881
+ filterUnits: "userSpaceOnUse",
1882
+ x: render.glowFilter.x,
1883
+ y: render.glowFilter.y,
1884
+ width: render.glowFilter.width,
1885
+ height: render.glowFilter.height,
1886
+ children: [
1887
+ /* @__PURE__ */ jsx7("feGaussianBlur", { stdDeviation: render.glowFilter.stdDeviation, result: "blur" }),
1888
+ /* @__PURE__ */ jsxs6("feMerge", { children: [
1889
+ /* @__PURE__ */ jsx7("feMergeNode", { in: "blur" }),
1890
+ /* @__PURE__ */ jsx7("feMergeNode", { in: "SourceGraphic" })
1891
+ ] })
1892
+ ]
1893
+ }
1894
+ )
1895
+ ] }),
1896
+ render.elements.map(
1897
+ (el) => el.type === "dot" ? render.moving ? /* @__PURE__ */ jsx7("circle", { r: el.r, fill: el.fill, filter: el.filter, children: /* @__PURE__ */ jsx7(
1898
+ "animateMotion",
1899
+ {
1900
+ dur: `${el.motion.dur}s`,
1901
+ begin: `${el.motion.begin}s`,
1902
+ repeatCount: "indefinite",
1903
+ keyPoints: el.motion.keyPoints,
1904
+ keyTimes: el.motion.keyTimes,
1905
+ calcMode: "linear",
1906
+ children: /* @__PURE__ */ jsx7("mpath", { href: `#${pathId}` })
1907
+ }
1908
+ ) }, el.key) : /* @__PURE__ */ jsx7("circle", { cx: el.at.x, cy: el.at.y, r: el.r, fill: el.fill, filter: el.filter }, el.key) : /* @__PURE__ */ jsx7(
1909
+ "path",
1910
+ {
1911
+ d: path,
1912
+ fill: "none",
1913
+ stroke: el.stroke,
1914
+ strokeWidth: el.strokeWidth,
1915
+ strokeLinecap: el.strokeLinecap,
1916
+ strokeDasharray: el.strokeDasharray,
1917
+ strokeDashoffset: el.strokeDashoffset,
1918
+ strokeOpacity: el.opacity,
1919
+ filter: el.filter,
1920
+ children: render.moving && el.animate.map((a) => /* @__PURE__ */ jsx7("animate", { attributeName: a.attributeName, values: a.values, dur: `${a.dur}s`, begin: `${a.begin}s`, repeatCount: "indefinite" }, a.attributeName))
1921
+ },
1922
+ el.key
1923
+ )
1924
+ )
1925
+ ] });
1926
+ }
1927
+ function AnimatedEdge(props) {
1928
+ const { id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, data, label, labelStyle, style, markerStart, markerEnd, interactionWidth = 20, reducedMotion } = props;
1929
+ const { path, labelX, labelY } = getCanvasEdgePath({ sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, type: data?.pathType });
1930
+ const animation = getCanvasEdgeAnimation({ data });
1931
+ const stroke = typeof style?.stroke === "string" ? style.stroke : void 0;
1932
+ const trackOpacity = animation ? resolveCanvasEdgeAnimation(animation).trackOpacity : 1;
1933
+ return /* @__PURE__ */ jsxs6(Fragment2, { children: [
1934
+ /* @__PURE__ */ jsx7(
1935
+ "path",
1936
+ {
1937
+ id,
1938
+ d: path,
1939
+ fill: "none",
1940
+ className: "react-flow__edge-path",
1941
+ style: { ...style, ...trackOpacity !== 1 ? { strokeOpacity: trackOpacity } : {} },
1942
+ markerStart,
1943
+ markerEnd
1944
+ }
1945
+ ),
1946
+ interactionWidth > 0 && /* @__PURE__ */ jsx7("path", { d: path, fill: "none", strokeOpacity: 0, strokeWidth: interactionWidth, className: "react-flow__edge-interaction" }),
1947
+ /* @__PURE__ */ jsx7(EdgeAnimation, { animation, path, id, stroke: stroke ?? "var(--xy-edge-stroke, #b1b1b7)", reducedMotion }),
1948
+ label !== void 0 && label !== null && label !== "" && /* @__PURE__ */ jsx7("text", { x: labelX, y: labelY, textAnchor: "middle", dominantBaseline: "central", className: "react-flow__edge-text", style: labelStyle, children: label })
1949
+ ] });
1950
+ }
1951
+
1840
1952
  // src/canvas/index.ts
1953
+ import {
1954
+ CANVAS_EDGE_ANIMATION_KINDS,
1955
+ CANVAS_EDGE_ANIMATION_SCHEMA,
1956
+ createCanvasEdgeAnimationToolProvider,
1957
+ getCanvasEdgeAnimation as getCanvasEdgeAnimation2,
1958
+ getCanvasEdgeAnimationRender as getCanvasEdgeAnimationRender2,
1959
+ getCanvasEdgePath as getCanvasEdgePath2,
1960
+ measureSvgPath,
1961
+ normalizeCanvasEdgeAnimation,
1962
+ resolveCanvasEdgeAnimation as resolveCanvasEdgeAnimation2,
1963
+ sampleCanvasEdgeAnimation,
1964
+ setCanvasEdgeAnimation
1965
+ } from "@pixerate/editor/canvas";
1841
1966
  import {
1842
1967
  combineShapeNodes,
1843
1968
  canCombineShapeNodes,
@@ -1966,17 +2091,17 @@ import {
1966
2091
  } from "@pixerate/editor/canvas";
1967
2092
 
1968
2093
  // src/canvas/useCanvasAutoLayout.ts
1969
- import { useLayoutEffect, useMemo as useMemo11, useRef as useRef15, useState as useState9 } from "react";
2094
+ import { useLayoutEffect, useMemo as useMemo12, useRef as useRef15, useState as useState10 } from "react";
1970
2095
  import {
1971
2096
  createCanvasAutoLayoutController
1972
2097
  } from "@pixerate/editor/canvas";
1973
2098
  function useCanvasAutoLayout(options) {
1974
- const [guides, setGuides] = useState9([]);
2099
+ const [guides, setGuides] = useState10([]);
1975
2100
  const nodesRef = useRef15(options.nodes);
1976
2101
  nodesRef.current = options.nodes;
1977
2102
  const optionsRef = useRef15(options);
1978
2103
  optionsRef.current = options;
1979
- const controller = useMemo11(
2104
+ const controller = useMemo12(
1980
2105
  () => createCanvasAutoLayoutController({
1981
2106
  getNodes: () => nodesRef.current,
1982
2107
  setNodes: (next) => {
@@ -2005,7 +2130,7 @@ function useCanvasAutoLayout(options) {
2005
2130
  useLayoutEffect(() => {
2006
2131
  if (controller.hasPending) controller.flush();
2007
2132
  }, [options.nodes, controller]);
2008
- return useMemo11(
2133
+ return useMemo12(
2009
2134
  () => ({
2010
2135
  ...controller,
2011
2136
  /** Drop marker of the active reorder drag (flow coordinates). */
@@ -2019,7 +2144,7 @@ function useCanvasAutoLayout(options) {
2019
2144
  }
2020
2145
 
2021
2146
  // src/canvas/useCanvasTokens.ts
2022
- import { useCallback as useCallback9, useEffect as useEffect12, useRef as useRef16, useSyncExternalStore as useSyncExternalStore3 } from "react";
2147
+ import { useCallback as useCallback9, useEffect as useEffect13, useRef as useRef16, useSyncExternalStore as useSyncExternalStore3 } from "react";
2023
2148
  import {
2024
2149
  bindCanvasToken,
2025
2150
  detachTokenBindings,
@@ -2033,7 +2158,7 @@ function useCanvasTokens(options) {
2033
2158
  const latest = useRef16({ nodes, setNodes, modes, properties });
2034
2159
  latest.current = { nodes, setNodes, modes, properties };
2035
2160
  const opts = () => ({ modes: latest.current.modes, properties: latest.current.properties });
2036
- useEffect12(
2161
+ useEffect13(
2037
2162
  () => store.subscribe((event) => {
2038
2163
  if (event.deletedVariableIds.length === 0) return;
2039
2164
  latest.current.setNodes((prev) => detachTokenBindings(prev, event.previous, event.deletedVariableIds, opts()));
@@ -2042,7 +2167,7 @@ function useCanvasTokens(options) {
2042
2167
  [store]
2043
2168
  );
2044
2169
  const modesKey = JSON.stringify(modes ?? {});
2045
- useEffect12(() => {
2170
+ useEffect13(() => {
2046
2171
  const next = resolveCanvasTokens(nodes, state, opts());
2047
2172
  if (next !== nodes) setNodes(next);
2048
2173
  }, [nodes, state, modesKey, properties]);
@@ -2084,7 +2209,7 @@ import {
2084
2209
  getTokensForProperty
2085
2210
  } from "@pixerate/editor/canvas";
2086
2211
  import { getCurrentMode, resolveToken } from "@pixerate/editor/tokens";
2087
- import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
2212
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
2088
2213
  function TokenBindingPicker({
2089
2214
  state,
2090
2215
  nodes,
@@ -2101,15 +2226,15 @@ function TokenBindingPicker({
2101
2226
  let rows = getBindableTokenProperties(first, options);
2102
2227
  if (properties) rows = properties.map((key) => rows.find((p) => p.key === key)).filter((p) => !!p);
2103
2228
  const modes = getEffectiveTokenModes2(first, nodes, state, options);
2104
- return /* @__PURE__ */ jsxs6("div", { "data-token-binding-picker": "", className: `flex flex-col gap-1 text-xs text-foreground ${className}`, children: [
2229
+ return /* @__PURE__ */ jsxs7("div", { "data-token-binding-picker": "", className: `flex flex-col gap-1 text-xs text-foreground ${className}`, children: [
2105
2230
  rows.map((property) => {
2106
2231
  const ids = new Set(selected.map((n) => getNodeTokenBindings(n)[property.key] ?? ""));
2107
2232
  const value = ids.size === 1 ? [...ids][0] : "__mixed";
2108
2233
  const candidates = getTokensForProperty(state, property, first);
2109
2234
  const resolved = value && value !== "__mixed" ? resolveToken(state, value, modes) : null;
2110
- return /* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-2", "data-token-property": property.key, children: [
2111
- /* @__PURE__ */ jsx7("span", { className: "w-28 shrink-0 text-muted-foreground", children: property.label }),
2112
- /* @__PURE__ */ jsxs6(
2235
+ return /* @__PURE__ */ jsxs7("label", { className: "flex items-center gap-2", "data-token-property": property.key, children: [
2236
+ /* @__PURE__ */ jsx8("span", { className: "w-28 shrink-0 text-muted-foreground", children: property.label }),
2237
+ /* @__PURE__ */ jsxs7(
2113
2238
  "select",
2114
2239
  {
2115
2240
  "aria-label": `${property.label} variable`,
@@ -2124,11 +2249,11 @@ function TokenBindingPicker({
2124
2249
  }
2125
2250
  },
2126
2251
  children: [
2127
- value === "__mixed" ? /* @__PURE__ */ jsx7("option", { value: "__mixed", children: "Mixed" }) : null,
2128
- /* @__PURE__ */ jsx7("option", { value: "", children: "None" }),
2252
+ value === "__mixed" ? /* @__PURE__ */ jsx8("option", { value: "__mixed", children: "Mixed" }) : null,
2253
+ /* @__PURE__ */ jsx8("option", { value: "", children: "None" }),
2129
2254
  candidates.map((v) => {
2130
2255
  const collection = state.collections.find((c) => c.id === v.collectionId);
2131
- return /* @__PURE__ */ jsxs6("option", { value: v.id, children: [
2256
+ return /* @__PURE__ */ jsxs7("option", { value: v.id, children: [
2132
2257
  v.name,
2133
2258
  collection && state.collections.length > 1 ? ` (${collection.name})` : ""
2134
2259
  ] }, v.id);
@@ -2136,17 +2261,17 @@ function TokenBindingPicker({
2136
2261
  ]
2137
2262
  }
2138
2263
  ),
2139
- /* @__PURE__ */ jsx7("span", { className: "w-16 shrink-0 truncate text-right text-muted-foreground", "data-token-resolved": "", children: resolved?.ok ? property.type === "color" ? /* @__PURE__ */ jsx7(
2264
+ /* @__PURE__ */ jsx8("span", { className: "w-16 shrink-0 truncate text-right text-muted-foreground", "data-token-resolved": "", children: resolved?.ok ? property.type === "color" ? /* @__PURE__ */ jsx8(
2140
2265
  "span",
2141
2266
  {
2142
2267
  className: "inline-block h-3 w-3 rounded border border-border align-middle",
2143
2268
  style: { background: String(resolved.value) },
2144
2269
  title: String(resolved.value)
2145
2270
  }
2146
- ) : String(resolved.value) : resolved ? /* @__PURE__ */ jsx7("span", { title: resolved.message, children: "\u26A0" }) : null })
2271
+ ) : String(resolved.value) : resolved ? /* @__PURE__ */ jsx8("span", { title: resolved.message, children: "\u26A0" }) : null })
2147
2272
  ] }, property.key);
2148
2273
  }),
2149
- state.collections.length === 0 ? /* @__PURE__ */ jsx7("p", { className: "text-muted-foreground", children: "No variables yet." }) : null
2274
+ state.collections.length === 0 ? /* @__PURE__ */ jsx8("p", { className: "text-muted-foreground", children: "No variables yet." }) : null
2150
2275
  ] });
2151
2276
  }
2152
2277
  function TokenModeSwitcher({
@@ -2164,12 +2289,12 @@ function TokenModeSwitcher({
2164
2289
  const parent = first.parentId ? nodes.find((n) => n.id === first.parentId) : void 0;
2165
2290
  const inherited = parent ? getEffectiveTokenModes2(parent, nodes, state, options) : { ...options.modes };
2166
2291
  const collections = state.collections.filter((c) => showSingleMode || c.modes.length > 1);
2167
- return /* @__PURE__ */ jsx7("div", { "data-token-mode-switcher": "", className: `flex flex-col gap-1 text-xs text-foreground ${className}`, children: collections.map((collection) => {
2292
+ return /* @__PURE__ */ jsx8("div", { "data-token-mode-switcher": "", className: `flex flex-col gap-1 text-xs text-foreground ${className}`, children: collections.map((collection) => {
2168
2293
  const auto = getCurrentMode(collection, inherited);
2169
2294
  const explicit = collection.modes.some((m) => m.id === own[collection.id]) ? own[collection.id] : "";
2170
- return /* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-2", "data-token-collection": collection.id, children: [
2171
- /* @__PURE__ */ jsx7("span", { className: "w-28 shrink-0 truncate text-muted-foreground", children: collection.name }),
2172
- /* @__PURE__ */ jsxs6(
2295
+ return /* @__PURE__ */ jsxs7("label", { className: "flex items-center gap-2", "data-token-collection": collection.id, children: [
2296
+ /* @__PURE__ */ jsx8("span", { className: "w-28 shrink-0 truncate text-muted-foreground", children: collection.name }),
2297
+ /* @__PURE__ */ jsxs7(
2173
2298
  "select",
2174
2299
  {
2175
2300
  "aria-label": `${collection.name} mode`,
@@ -2177,12 +2302,12 @@ function TokenModeSwitcher({
2177
2302
  value: explicit,
2178
2303
  onChange: (e) => onChange(setCanvasTokenMode2(nodes, nodeIds, collection.id, e.currentTarget.value || null, state, options)),
2179
2304
  children: [
2180
- /* @__PURE__ */ jsxs6("option", { value: "", children: [
2305
+ /* @__PURE__ */ jsxs7("option", { value: "", children: [
2181
2306
  "Auto (",
2182
2307
  auto.name,
2183
2308
  ")"
2184
2309
  ] }),
2185
- collection.modes.map((m) => /* @__PURE__ */ jsx7("option", { value: m.id, children: m.name }, m.id))
2310
+ collection.modes.map((m) => /* @__PURE__ */ jsx8("option", { value: m.id, children: m.name }, m.id))
2186
2311
  ]
2187
2312
  }
2188
2313
  )
@@ -2213,7 +2338,7 @@ import {
2213
2338
  } from "@pixerate/editor/canvas";
2214
2339
 
2215
2340
  // src/canvas/useCanvasAnimation.ts
2216
- import { useEffect as useEffect13, useMemo as useMemo12, useRef as useRef17, useSyncExternalStore as useSyncExternalStore4 } from "react";
2341
+ import { useEffect as useEffect14, useMemo as useMemo13, useRef as useRef17, useSyncExternalStore as useSyncExternalStore4 } from "react";
2217
2342
  import {
2218
2343
  createCanvasAnimationController
2219
2344
  } from "@pixerate/editor/canvas";
@@ -2222,7 +2347,7 @@ function useCanvasAnimation(options) {
2222
2347
  nodesRef.current = options.nodes;
2223
2348
  const optionsRef = useRef17(options);
2224
2349
  optionsRef.current = options;
2225
- const controller = useMemo12(
2350
+ const controller = useMemo13(
2226
2351
  () => createCanvasAnimationController({
2227
2352
  getNodes: () => nodesRef.current,
2228
2353
  setNodes: (next) => {
@@ -2249,14 +2374,14 @@ function useCanvasAnimation(options) {
2249
2374
  }),
2250
2375
  []
2251
2376
  );
2252
- useEffect13(() => () => controller.destroy(), [controller]);
2253
- useEffect13(() => {
2377
+ useEffect14(() => () => controller.destroy(), [controller]);
2378
+ useEffect14(() => {
2254
2379
  if (options.loop !== void 0) controller.setLoop(options.loop);
2255
2380
  }, [controller, options.loop]);
2256
- useEffect13(() => {
2381
+ useEffect14(() => {
2257
2382
  if (options.playbackRate !== void 0) controller.setPlaybackRate(options.playbackRate);
2258
2383
  }, [controller, options.playbackRate]);
2259
- useEffect13(() => {
2384
+ useEffect14(() => {
2260
2385
  if (options.recording !== void 0) controller.setRecording(options.recording);
2261
2386
  }, [controller, options.recording]);
2262
2387
  const state = useSyncExternalStore4(
@@ -2264,11 +2389,11 @@ function useCanvasAnimation(options) {
2264
2389
  () => controller.getState(),
2265
2390
  () => controller.getState()
2266
2391
  );
2267
- useEffect13(() => {
2392
+ useEffect14(() => {
2268
2393
  controller.refresh();
2269
2394
  }, [controller, options.nodes]);
2270
- const displayNodes = useMemo12(() => controller.display(options.nodes), [controller, options.nodes, state.time]);
2271
- return useMemo12(
2395
+ const displayNodes = useMemo13(() => controller.display(options.nodes), [controller, options.nodes, state.time]);
2396
+ return useMemo13(
2272
2397
  () => ({
2273
2398
  ...controller,
2274
2399
  state,
@@ -2289,7 +2414,7 @@ function useCanvasAnimation(options) {
2289
2414
  }
2290
2415
 
2291
2416
  // src/canvas/AnimationTimeline.tsx
2292
- import { useEffect as useEffect14, useRef as useRef18 } from "react";
2417
+ import { useEffect as useEffect15, useRef as useRef18 } from "react";
2293
2418
  import {
2294
2419
  ANIMATION_EASING_LABELS,
2295
2420
  ANIMATION_EASING_PRESETS,
@@ -2298,7 +2423,7 @@ import {
2298
2423
  timeToX,
2299
2424
  xToTime
2300
2425
  } from "@pixerate/editor/canvas";
2301
- import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
2426
+ import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
2302
2427
  var LOOP_LABELS = { none: "Once", loop: "Loop", "ping-pong": "Ping-pong" };
2303
2428
  var easingValue = (easing) => typeof easing === "string" ? easing : easing ? "custom" : "linear";
2304
2429
  function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8, labelOf, className = "" }) {
@@ -2313,7 +2438,7 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
2313
2438
  return "";
2314
2439
  })();
2315
2440
  const dragRef = useRef18(null);
2316
- useEffect14(() => {
2441
+ useEffect15(() => {
2317
2442
  const onKey = (event) => {
2318
2443
  if (event.key === "Escape" && dragRef.current) {
2319
2444
  dragRef.current = null;
@@ -2369,10 +2494,10 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
2369
2494
  const btn2 = "rounded border border-border px-2 py-0.5 text-xs hover:bg-muted disabled:opacity-50";
2370
2495
  const playheadX = timeToX(state.time, duration, width);
2371
2496
  const labelWidth = 120;
2372
- return /* @__PURE__ */ jsxs7("div", { "data-animation-timeline": "", className: `flex flex-col gap-1 text-xs text-foreground ${className}`, tabIndex: 0, onKeyDown: onTimelineKey, children: [
2373
- /* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap items-center gap-2", role: "toolbar", "aria-label": "Animation", children: [
2374
- /* @__PURE__ */ jsx8("button", { type: "button", className: btn2, "data-action": "toggle-play", "aria-label": state.playing ? "Pause" : "Play", onClick: () => animation.toggle(), children: state.playing ? "\u275A\u275A" : "\u25B6" }),
2375
- /* @__PURE__ */ jsx8(
2497
+ return /* @__PURE__ */ jsxs8("div", { "data-animation-timeline": "", className: `flex flex-col gap-1 text-xs text-foreground ${className}`, tabIndex: 0, onKeyDown: onTimelineKey, children: [
2498
+ /* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap items-center gap-2", role: "toolbar", "aria-label": "Animation", children: [
2499
+ /* @__PURE__ */ jsx9("button", { type: "button", className: btn2, "data-action": "toggle-play", "aria-label": state.playing ? "Pause" : "Play", onClick: () => animation.toggle(), children: state.playing ? "\u275A\u275A" : "\u25B6" }),
2500
+ /* @__PURE__ */ jsx9(
2376
2501
  "button",
2377
2502
  {
2378
2503
  type: "button",
@@ -2384,13 +2509,13 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
2384
2509
  children: "\u25CF Rec"
2385
2510
  }
2386
2511
  ),
2387
- /* @__PURE__ */ jsx8("button", { type: "button", className: btn2, "data-action": "add-keyframe", onClick: () => animation.addKeyframe(), children: "\u25C6 Key" }),
2388
- /* @__PURE__ */ jsxs7("span", { "data-time": "", className: "tabular-nums text-muted-foreground", children: [
2512
+ /* @__PURE__ */ jsx9("button", { type: "button", className: btn2, "data-action": "add-keyframe", onClick: () => animation.addKeyframe(), children: "\u25C6 Key" }),
2513
+ /* @__PURE__ */ jsxs8("span", { "data-time": "", className: "tabular-nums text-muted-foreground", children: [
2389
2514
  formatAnimationTime(state.time),
2390
2515
  " / ",
2391
2516
  formatAnimationTime(duration)
2392
2517
  ] }),
2393
- /* @__PURE__ */ jsxs7(
2518
+ /* @__PURE__ */ jsxs8(
2394
2519
  "select",
2395
2520
  {
2396
2521
  "aria-label": "Easing",
@@ -2400,13 +2525,13 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
2400
2525
  disabled: state.selection.length === 0,
2401
2526
  onChange: (e) => e.target.value && e.target.value !== "custom" && animation.setEasing(e.target.value),
2402
2527
  children: [
2403
- /* @__PURE__ */ jsx8("option", { value: "", children: "Easing\u2026" }),
2404
- ANIMATION_EASING_PRESETS.map((preset) => /* @__PURE__ */ jsx8("option", { value: preset, children: ANIMATION_EASING_LABELS[preset] }, preset)),
2405
- selectedEasing === "custom" ? /* @__PURE__ */ jsx8("option", { value: "custom", children: "Custom" }) : null
2528
+ /* @__PURE__ */ jsx9("option", { value: "", children: "Easing\u2026" }),
2529
+ ANIMATION_EASING_PRESETS.map((preset) => /* @__PURE__ */ jsx9("option", { value: preset, children: ANIMATION_EASING_LABELS[preset] }, preset)),
2530
+ selectedEasing === "custom" ? /* @__PURE__ */ jsx9("option", { value: "custom", children: "Custom" }) : null
2406
2531
  ]
2407
2532
  }
2408
2533
  ),
2409
- /* @__PURE__ */ jsx8(
2534
+ /* @__PURE__ */ jsx9(
2410
2535
  "select",
2411
2536
  {
2412
2537
  "aria-label": "Loop",
@@ -2414,13 +2539,13 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
2414
2539
  className: "rounded border border-border bg-background px-1 py-0.5",
2415
2540
  value: state.loop,
2416
2541
  onChange: (e) => animation.setLoop(e.target.value),
2417
- children: Object.keys(LOOP_LABELS).map((mode) => /* @__PURE__ */ jsx8("option", { value: mode, children: LOOP_LABELS[mode] }, mode))
2542
+ children: Object.keys(LOOP_LABELS).map((mode) => /* @__PURE__ */ jsx9("option", { value: mode, children: LOOP_LABELS[mode] }, mode))
2418
2543
  }
2419
2544
  )
2420
2545
  ] }),
2421
- /* @__PURE__ */ jsxs7("div", { className: "flex", children: [
2422
- /* @__PURE__ */ jsx8("div", { style: { width: labelWidth }, className: "shrink-0" }),
2423
- /* @__PURE__ */ jsxs7(
2546
+ /* @__PURE__ */ jsxs8("div", { className: "flex", children: [
2547
+ /* @__PURE__ */ jsx9("div", { style: { width: labelWidth }, className: "shrink-0" }),
2548
+ /* @__PURE__ */ jsxs8(
2424
2549
  "div",
2425
2550
  {
2426
2551
  "data-timeline-ruler": "",
@@ -2428,15 +2553,15 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
2428
2553
  style: { width },
2429
2554
  onPointerDown: onRulerDown,
2430
2555
  children: [
2431
- ticks.map((tick) => /* @__PURE__ */ jsx8("span", { className: "absolute top-0 -translate-x-1/2 text-[10px] text-muted-foreground", style: { left: tick.x }, children: tick.label }, tick.time)),
2432
- /* @__PURE__ */ jsx8("div", { "data-playhead": "", className: "absolute top-0 h-5 w-px bg-red-500", style: { left: playheadX } })
2556
+ ticks.map((tick) => /* @__PURE__ */ jsx9("span", { className: "absolute top-0 -translate-x-1/2 text-[10px] text-muted-foreground", style: { left: tick.x }, children: tick.label }, tick.time)),
2557
+ /* @__PURE__ */ jsx9("div", { "data-playhead": "", className: "absolute top-0 h-5 w-px bg-red-500", style: { left: playheadX } })
2433
2558
  ]
2434
2559
  }
2435
2560
  )
2436
2561
  ] }),
2437
- rows.length === 0 ? /* @__PURE__ */ jsx8("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__ */ jsxs7("div", { className: "flex items-center", "data-track": row.id, children: [
2438
- /* @__PURE__ */ jsxs7("label", { className: "flex shrink-0 items-center gap-1 truncate pr-2", style: { width: labelWidth }, title: `${row.nodeLabel} \xB7 ${row.label}`, children: [
2439
- /* @__PURE__ */ jsx8(
2562
+ rows.length === 0 ? /* @__PURE__ */ jsx9("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__ */ jsxs8("div", { className: "flex items-center", "data-track": row.id, children: [
2563
+ /* @__PURE__ */ jsxs8("label", { className: "flex shrink-0 items-center gap-1 truncate pr-2", style: { width: labelWidth }, title: `${row.nodeLabel} \xB7 ${row.label}`, children: [
2564
+ /* @__PURE__ */ jsx9(
2440
2565
  "input",
2441
2566
  {
2442
2567
  type: "checkbox",
@@ -2445,15 +2570,15 @@ function AnimationTimeline({ animation, nodeIds, width = 360, snapThreshold = 8,
2445
2570
  onChange: (e) => animation.setTrackEnabled(row.nodeId, row.property, e.target.checked)
2446
2571
  }
2447
2572
  ),
2448
- /* @__PURE__ */ jsxs7("span", { className: "truncate", children: [
2573
+ /* @__PURE__ */ jsxs8("span", { className: "truncate", children: [
2449
2574
  rows.filter((r) => r.nodeId === row.nodeId).length < rows.length ? `${row.nodeLabel} \xB7 ` : "",
2450
2575
  row.label
2451
2576
  ] })
2452
2577
  ] }),
2453
- /* @__PURE__ */ jsxs7("div", { "data-lane": "", className: `relative h-5 rounded bg-muted/40 ${row.enabled ? "" : "opacity-50"}`, style: { width }, children: [
2454
- /* @__PURE__ */ jsx8("div", { className: "pointer-events-none absolute top-0 h-5 w-px bg-red-500/60", style: { left: playheadX } }),
2455
- state.drag?.target != null ? /* @__PURE__ */ jsx8("div", { "data-snap-target": "", className: "pointer-events-none absolute top-0 h-5 w-px bg-sky-400", style: { left: timeToX(state.drag.target, duration, width) } }) : null,
2456
- row.keyframes.map((k) => /* @__PURE__ */ jsx8(
2578
+ /* @__PURE__ */ jsxs8("div", { "data-lane": "", className: `relative h-5 rounded bg-muted/40 ${row.enabled ? "" : "opacity-50"}`, style: { width }, children: [
2579
+ /* @__PURE__ */ jsx9("div", { className: "pointer-events-none absolute top-0 h-5 w-px bg-red-500/60", style: { left: playheadX } }),
2580
+ state.drag?.target != null ? /* @__PURE__ */ jsx9("div", { "data-snap-target": "", className: "pointer-events-none absolute top-0 h-5 w-px bg-sky-400", style: { left: timeToX(state.drag.target, duration, width) } }) : null,
2581
+ row.keyframes.map((k) => /* @__PURE__ */ jsx9(
2457
2582
  "button",
2458
2583
  {
2459
2584
  type: "button",
@@ -2551,7 +2676,7 @@ import {
2551
2676
  } from "@pixerate/editor/canvas";
2552
2677
 
2553
2678
  // src/canvas/useCanvasComponents.ts
2554
- import { useLayoutEffect as useLayoutEffect2, useMemo as useMemo13, useRef as useRef19 } from "react";
2679
+ import { useLayoutEffect as useLayoutEffect2, useMemo as useMemo14, useRef as useRef19 } from "react";
2555
2680
  import {
2556
2681
  createCanvasComponentsController
2557
2682
  } from "@pixerate/editor/canvas";
@@ -2560,7 +2685,7 @@ function useCanvasComponents(options) {
2560
2685
  nodesRef.current = options.nodes;
2561
2686
  const optionsRef = useRef19(options);
2562
2687
  optionsRef.current = options;
2563
- const controller = useMemo13(
2688
+ const controller = useMemo14(
2564
2689
  () => createCanvasComponentsController({
2565
2690
  getNodes: () => nodesRef.current,
2566
2691
  setNodes: (next) => {
@@ -2596,15 +2721,15 @@ function useCanvasComponents(options) {
2596
2721
  }
2597
2722
 
2598
2723
  // src/canvas/CanvasComponentsPanel.tsx
2599
- import { useState as useState10 } from "react";
2724
+ import { useState as useState11 } from "react";
2600
2725
  import {
2601
2726
  CANVAS_COMPONENT_DRAG_TYPE,
2602
2727
  inspectCanvasInstance,
2603
2728
  listCanvasComponents
2604
2729
  } from "@pixerate/editor/canvas";
2605
- import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
2730
+ import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
2606
2731
  function InlineField({ value, label, onCommit }) {
2607
- return /* @__PURE__ */ jsx9(
2732
+ return /* @__PURE__ */ jsx10(
2608
2733
  "input",
2609
2734
  {
2610
2735
  type: "text",
@@ -2635,10 +2760,10 @@ function CanvasComponentsPanel({
2635
2760
  search = true,
2636
2761
  className = ""
2637
2762
  }) {
2638
- const [query, setQuery] = useState10("");
2639
- const [propsOpen, setPropsOpen] = useState10(null);
2640
- const [menuFor, setMenuFor] = useState10(null);
2641
- const [editing, setEditing] = useState10(null);
2763
+ const [query, setQuery] = useState11("");
2764
+ const [propsOpen, setPropsOpen] = useState11(null);
2765
+ const [menuFor, setMenuFor] = useState11(null);
2766
+ const [editing, setEditing] = useState11(null);
2642
2767
  const { components: all, sets } = listCanvasComponents(nodes);
2643
2768
  const q = query.trim().toLowerCase();
2644
2769
  const match = (name) => !q || name.toLowerCase().includes(q);
@@ -2650,7 +2775,7 @@ function CanvasComponentsPanel({
2650
2775
  };
2651
2776
  const small = "shrink-0 rounded px-1 text-[10px] text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-40";
2652
2777
  const menuItem = "rounded px-2 py-0.5 text-left hover:bg-muted disabled:opacity-40";
2653
- const item = (id, name, count, extra = {}, onContextMenu) => /* @__PURE__ */ jsxs8(
2778
+ const item = (id, name, count, extra = {}, onContextMenu) => /* @__PURE__ */ jsxs9(
2654
2779
  "button",
2655
2780
  {
2656
2781
  type: "button",
@@ -2667,17 +2792,17 @@ function CanvasComponentsPanel({
2667
2792
  e.dataTransfer.effectAllowed = "copy";
2668
2793
  },
2669
2794
  children: [
2670
- /* @__PURE__ */ jsxs8("span", { className: "truncate", children: [
2671
- /* @__PURE__ */ jsx9("span", { "aria-hidden": true, className: "mr-1 text-muted-foreground", children: "\u25C7" }),
2795
+ /* @__PURE__ */ jsxs9("span", { className: "truncate", children: [
2796
+ /* @__PURE__ */ jsx10("span", { "aria-hidden": true, className: "mr-1 text-muted-foreground", children: "\u25C7" }),
2672
2797
  name
2673
2798
  ] }),
2674
- /* @__PURE__ */ jsx9("span", { className: "text-[10px] text-muted-foreground", "data-instance-count": "", children: count })
2799
+ /* @__PURE__ */ jsx10("span", { className: "text-[10px] text-muted-foreground", "data-instance-count": "", children: count })
2675
2800
  ]
2676
2801
  },
2677
2802
  id
2678
2803
  );
2679
- return /* @__PURE__ */ jsxs8("div", { "data-components-panel": "", className: `flex flex-col gap-1 text-xs text-foreground ${className}`, children: [
2680
- search ? /* @__PURE__ */ jsx9(
2804
+ return /* @__PURE__ */ jsxs9("div", { "data-components-panel": "", className: `flex flex-col gap-1 text-xs text-foreground ${className}`, children: [
2805
+ search ? /* @__PURE__ */ jsx10(
2681
2806
  "input",
2682
2807
  {
2683
2808
  type: "search",
@@ -2687,11 +2812,11 @@ function CanvasComponentsPanel({
2687
2812
  onInput: (e) => setQuery(e.target.value)
2688
2813
  }
2689
2814
  ) : null,
2690
- shownSets.map((set) => /* @__PURE__ */ jsxs8("div", { "data-component-set": set.id, className: "flex flex-col", children: [
2691
- /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-1", children: [
2815
+ shownSets.map((set) => /* @__PURE__ */ jsxs9("div", { "data-component-set": set.id, className: "flex flex-col", children: [
2816
+ /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1", children: [
2692
2817
  item(set.id, set.name, set.variants.reduce((sum, v) => sum + v.instanceCount, 0), { "data-kind": "set" }),
2693
- components ? /* @__PURE__ */ jsxs8(Fragment2, { children: [
2694
- /* @__PURE__ */ jsx9(
2818
+ components ? /* @__PURE__ */ jsxs9(Fragment3, { children: [
2819
+ /* @__PURE__ */ jsx10(
2695
2820
  "button",
2696
2821
  {
2697
2822
  type: "button",
@@ -2703,7 +2828,7 @@ function CanvasComponentsPanel({
2703
2828
  children: "+\xA0Variant"
2704
2829
  }
2705
2830
  ),
2706
- /* @__PURE__ */ jsx9(
2831
+ /* @__PURE__ */ jsx10(
2707
2832
  "button",
2708
2833
  {
2709
2834
  type: "button",
@@ -2718,8 +2843,8 @@ function CanvasComponentsPanel({
2718
2843
  )
2719
2844
  ] }) : null
2720
2845
  ] }),
2721
- components && propsOpen === set.id ? /* @__PURE__ */ jsx9("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__ */ jsxs8("div", { "data-variant-option": option.name, className: "flex flex-col gap-0.5", children: [
2722
- /* @__PURE__ */ jsx9(
2846
+ components && propsOpen === set.id ? /* @__PURE__ */ jsx10("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__ */ jsxs9("div", { "data-variant-option": option.name, className: "flex flex-col gap-0.5", children: [
2847
+ /* @__PURE__ */ jsx10(
2723
2848
  InlineField,
2724
2849
  {
2725
2850
  value: option.name,
@@ -2727,7 +2852,7 @@ function CanvasComponentsPanel({
2727
2852
  onCommit: (next) => report(components.renameVariantProperty(option.name, next, set.id))
2728
2853
  }
2729
2854
  ),
2730
- /* @__PURE__ */ jsx9("div", { className: "ml-2 flex flex-wrap gap-1", children: option.values.map((value) => /* @__PURE__ */ jsx9(
2855
+ /* @__PURE__ */ jsx10("div", { className: "ml-2 flex flex-wrap gap-1", children: option.values.map((value) => /* @__PURE__ */ jsx10(
2731
2856
  InlineField,
2732
2857
  {
2733
2858
  value,
@@ -2737,8 +2862,8 @@ function CanvasComponentsPanel({
2737
2862
  value
2738
2863
  )) })
2739
2864
  ] }, option.name)) }) : null,
2740
- /* @__PURE__ */ jsx9("div", { className: "ml-3 flex flex-col border-l border-border pl-1", children: set.variants.map((v) => /* @__PURE__ */ jsxs8("div", { "data-variant-row": v.id, className: "flex flex-col", children: [
2741
- /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-1", children: [
2865
+ /* @__PURE__ */ jsx10("div", { className: "ml-3 flex flex-col border-l border-border pl-1", children: set.variants.map((v) => /* @__PURE__ */ jsxs9("div", { "data-variant-row": v.id, className: "flex flex-col", children: [
2866
+ /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1", children: [
2742
2867
  item(
2743
2868
  v.id,
2744
2869
  v.name,
@@ -2749,7 +2874,7 @@ function CanvasComponentsPanel({
2749
2874
  setMenuFor(v.id);
2750
2875
  } : void 0
2751
2876
  ),
2752
- components ? /* @__PURE__ */ jsx9(
2877
+ components ? /* @__PURE__ */ jsx10(
2753
2878
  "button",
2754
2879
  {
2755
2880
  type: "button",
@@ -2763,8 +2888,8 @@ function CanvasComponentsPanel({
2763
2888
  }
2764
2889
  ) : null
2765
2890
  ] }),
2766
- components && menuFor === v.id ? /* @__PURE__ */ jsxs8("div", { role: "menu", "data-variant-menu": v.id, className: "ml-2 flex flex-col rounded border border-border bg-background p-1 shadow", children: [
2767
- /* @__PURE__ */ jsx9(
2891
+ components && menuFor === v.id ? /* @__PURE__ */ jsxs9("div", { role: "menu", "data-variant-menu": v.id, className: "ml-2 flex flex-col rounded border border-border bg-background p-1 shadow", children: [
2892
+ /* @__PURE__ */ jsx10(
2768
2893
  "button",
2769
2894
  {
2770
2895
  type: "button",
@@ -2778,7 +2903,7 @@ function CanvasComponentsPanel({
2778
2903
  children: "Edit values\u2026"
2779
2904
  }
2780
2905
  ),
2781
- /* @__PURE__ */ jsx9(
2906
+ /* @__PURE__ */ jsx10(
2782
2907
  "button",
2783
2908
  {
2784
2909
  type: "button",
@@ -2792,7 +2917,7 @@ function CanvasComponentsPanel({
2792
2917
  children: "Duplicate"
2793
2918
  }
2794
2919
  ),
2795
- /* @__PURE__ */ jsx9(
2920
+ /* @__PURE__ */ jsx10(
2796
2921
  "button",
2797
2922
  {
2798
2923
  type: "button",
@@ -2809,7 +2934,7 @@ function CanvasComponentsPanel({
2809
2934
  }
2810
2935
  )
2811
2936
  ] }) : null,
2812
- components && editing === v.id ? /* @__PURE__ */ jsxs8(
2937
+ components && editing === v.id ? /* @__PURE__ */ jsxs9(
2813
2938
  "form",
2814
2939
  {
2815
2940
  "data-variant-editor": v.id,
@@ -2823,9 +2948,9 @@ function CanvasComponentsPanel({
2823
2948
  if (report(components.setVariantProperties(values, v.id))) setEditing(null);
2824
2949
  },
2825
2950
  children: [
2826
- set.options.map((option) => /* @__PURE__ */ jsxs8("label", { className: "flex items-center gap-2", children: [
2827
- /* @__PURE__ */ jsx9("span", { className: "w-16 shrink-0 truncate text-muted-foreground", children: option.name }),
2828
- /* @__PURE__ */ jsx9(
2951
+ set.options.map((option) => /* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-2", children: [
2952
+ /* @__PURE__ */ jsx10("span", { className: "w-16 shrink-0 truncate text-muted-foreground", children: option.name }),
2953
+ /* @__PURE__ */ jsx10(
2829
2954
  "input",
2830
2955
  {
2831
2956
  type: "text",
@@ -2836,9 +2961,9 @@ function CanvasComponentsPanel({
2836
2961
  }
2837
2962
  )
2838
2963
  ] }, option.name)),
2839
- /* @__PURE__ */ jsxs8("div", { className: "flex gap-1", children: [
2840
- /* @__PURE__ */ jsx9("button", { type: "submit", className: "rounded border border-border px-2 py-0.5 hover:bg-muted", "data-action": "save-variant", children: "Save" }),
2841
- /* @__PURE__ */ jsx9("button", { type: "button", className: "rounded px-2 py-0.5 hover:bg-muted", "data-action": "cancel-variant", onClick: () => setEditing(null), children: "Cancel" })
2964
+ /* @__PURE__ */ jsxs9("div", { className: "flex gap-1", children: [
2965
+ /* @__PURE__ */ jsx10("button", { type: "submit", className: "rounded border border-border px-2 py-0.5 hover:bg-muted", "data-action": "save-variant", children: "Save" }),
2966
+ /* @__PURE__ */ jsx10("button", { type: "button", className: "rounded px-2 py-0.5 hover:bg-muted", "data-action": "cancel-variant", onClick: () => setEditing(null), children: "Cancel" })
2842
2967
  ] })
2843
2968
  ]
2844
2969
  }
@@ -2846,7 +2971,7 @@ function CanvasComponentsPanel({
2846
2971
  ] }, v.id)) })
2847
2972
  ] }, set.id)),
2848
2973
  lone.map((c) => item(c.id, c.name, c.instanceCount, { "data-kind": "component" })),
2849
- all.length === 0 ? /* @__PURE__ */ jsx9("p", { className: "text-muted-foreground", children: "No components yet. Select a frame and choose Create Component." }) : null
2974
+ all.length === 0 ? /* @__PURE__ */ jsx10("p", { className: "text-muted-foreground", children: "No components yet. Select a frame and choose Create Component." }) : null
2850
2975
  ] });
2851
2976
  }
2852
2977
  function CanvasInstanceInspector({
@@ -2865,27 +2990,27 @@ function CanvasInstanceInspector({
2865
2990
  const allComponents = listCanvasComponents(nodes).components;
2866
2991
  const linked = info.status === "linked";
2867
2992
  const btn2 = "rounded border border-border px-2 py-0.5 text-xs hover:bg-muted disabled:opacity-40";
2868
- return /* @__PURE__ */ jsxs8("div", { "data-instance-inspector": "", "data-instance-id": info.id, className: `flex flex-col gap-2 text-xs text-foreground ${className}`, children: [
2869
- /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between gap-2", children: [
2870
- /* @__PURE__ */ jsx9("span", { className: "truncate font-medium", "data-instance-main": "", children: linked ? info.componentName : "Main component missing" }),
2871
- info.nested ? /* @__PURE__ */ jsx9("span", { className: "text-muted-foreground", children: "Nested" }) : null
2993
+ return /* @__PURE__ */ jsxs9("div", { "data-instance-inspector": "", "data-instance-id": info.id, className: `flex flex-col gap-2 text-xs text-foreground ${className}`, children: [
2994
+ /* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-between gap-2", children: [
2995
+ /* @__PURE__ */ jsx10("span", { className: "truncate font-medium", "data-instance-main": "", children: linked ? info.componentName : "Main component missing" }),
2996
+ info.nested ? /* @__PURE__ */ jsx10("span", { className: "text-muted-foreground", children: "Nested" }) : null
2872
2997
  ] }),
2873
- info.variantOptions.map((option) => /* @__PURE__ */ jsxs8("label", { className: "flex items-center gap-2", "data-variant-property": option.name, children: [
2874
- /* @__PURE__ */ jsx9("span", { className: "w-24 shrink-0 truncate text-muted-foreground", children: option.name }),
2875
- /* @__PURE__ */ jsx9(
2998
+ info.variantOptions.map((option) => /* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-2", "data-variant-property": option.name, children: [
2999
+ /* @__PURE__ */ jsx10("span", { className: "w-24 shrink-0 truncate text-muted-foreground", children: option.name }),
3000
+ /* @__PURE__ */ jsx10(
2876
3001
  "select",
2877
3002
  {
2878
3003
  "aria-label": `${option.name} variant`,
2879
3004
  className: "min-w-0 flex-1 rounded border border-border bg-background px-1 py-0.5 text-xs",
2880
3005
  value: info.variant[option.name] ?? "",
2881
3006
  onChange: (e) => setProp(option.name, e.currentTarget.value),
2882
- children: option.values.map((v) => /* @__PURE__ */ jsx9("option", { value: v, children: v }, v))
3007
+ children: option.values.map((v) => /* @__PURE__ */ jsx10("option", { value: v, children: v }, v))
2883
3008
  }
2884
3009
  )
2885
3010
  ] }, option.name)),
2886
- info.properties.map((p) => /* @__PURE__ */ jsxs8("label", { className: "flex items-center gap-2", "data-component-property": p.name, children: [
2887
- /* @__PURE__ */ jsx9("span", { className: "w-24 shrink-0 truncate text-muted-foreground", children: p.name }),
2888
- p.type === "boolean" ? /* @__PURE__ */ jsx9("input", { type: "checkbox", "aria-label": p.name, checked: p.value === true, onChange: (e) => setProp(p.name, e.currentTarget.checked) }) : p.type === "text" ? /* @__PURE__ */ jsx9(
3011
+ info.properties.map((p) => /* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-2", "data-component-property": p.name, children: [
3012
+ /* @__PURE__ */ jsx10("span", { className: "w-24 shrink-0 truncate text-muted-foreground", children: p.name }),
3013
+ p.type === "boolean" ? /* @__PURE__ */ jsx10("input", { type: "checkbox", "aria-label": p.name, checked: p.value === true, onChange: (e) => setProp(p.name, e.currentTarget.checked) }) : p.type === "text" ? /* @__PURE__ */ jsx10(
2889
3014
  "input",
2890
3015
  {
2891
3016
  type: "text",
@@ -2900,22 +3025,22 @@ function CanvasInstanceInspector({
2900
3025
  }
2901
3026
  },
2902
3027
  String(p.value)
2903
- ) : /* @__PURE__ */ jsx9(
3028
+ ) : /* @__PURE__ */ jsx10(
2904
3029
  "select",
2905
3030
  {
2906
3031
  "aria-label": p.name,
2907
3032
  className: "min-w-0 flex-1 rounded border border-border bg-background px-1 py-0.5 text-xs",
2908
3033
  value: String(p.value),
2909
3034
  onChange: (e) => setProp(p.name, e.currentTarget.value),
2910
- children: allComponents.filter((c) => !p.preferred?.length || p.preferred.includes(c.id) || c.id === p.value).map((c) => /* @__PURE__ */ jsx9("option", { value: c.id, children: c.name }, c.id))
3035
+ children: allComponents.filter((c) => !p.preferred?.length || p.preferred.includes(c.id) || c.id === p.value).map((c) => /* @__PURE__ */ jsx10("option", { value: c.id, children: c.name }, c.id))
2911
3036
  }
2912
3037
  )
2913
3038
  ] }, p.name)),
2914
- info.overrides.length ? /* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-1", "data-instance-overrides": "", children: [
2915
- /* @__PURE__ */ jsx9("span", { className: "text-muted-foreground", children: "Overrides" }),
2916
- info.overrides.map((o) => /* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap items-center gap-1", "data-override-layer": o.id, children: [
2917
- /* @__PURE__ */ jsx9("span", { className: "mr-1 truncate", children: o.name }),
2918
- o.groups.map((g) => /* @__PURE__ */ jsxs8(
3039
+ info.overrides.length ? /* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-1", "data-instance-overrides": "", children: [
3040
+ /* @__PURE__ */ jsx10("span", { className: "text-muted-foreground", children: "Overrides" }),
3041
+ info.overrides.map((o) => /* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap items-center gap-1", "data-override-layer": o.id, children: [
3042
+ /* @__PURE__ */ jsx10("span", { className: "mr-1 truncate", children: o.name }),
3043
+ o.groups.map((g) => /* @__PURE__ */ jsxs9(
2919
3044
  "button",
2920
3045
  {
2921
3046
  type: "button",
@@ -2932,11 +3057,11 @@ function CanvasInstanceInspector({
2932
3057
  ))
2933
3058
  ] }, o.id))
2934
3059
  ] }) : null,
2935
- /* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap gap-1", children: [
2936
- linked ? /* @__PURE__ */ jsxs8(Fragment2, { children: [
2937
- /* @__PURE__ */ jsx9("button", { type: "button", className: btn2, "data-action": "reset", onClick: () => report(components.resetOverrides(info.id)), children: "Reset all" }),
2938
- /* @__PURE__ */ jsx9("button", { type: "button", className: btn2, "data-action": "go-to-main", onClick: () => components.goToMainComponent(info.id), children: "Go to main" }),
2939
- /* @__PURE__ */ jsx9(
3060
+ /* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap gap-1", children: [
3061
+ linked ? /* @__PURE__ */ jsxs9(Fragment3, { children: [
3062
+ /* @__PURE__ */ jsx10("button", { type: "button", className: btn2, "data-action": "reset", onClick: () => report(components.resetOverrides(info.id)), children: "Reset all" }),
3063
+ /* @__PURE__ */ jsx10("button", { type: "button", className: btn2, "data-action": "go-to-main", onClick: () => components.goToMainComponent(info.id), children: "Go to main" }),
3064
+ /* @__PURE__ */ jsx10(
2940
3065
  "button",
2941
3066
  {
2942
3067
  type: "button",
@@ -2947,8 +3072,8 @@ function CanvasInstanceInspector({
2947
3072
  children: "Push changes"
2948
3073
  }
2949
3074
  )
2950
- ] }) : /* @__PURE__ */ jsx9("button", { type: "button", className: btn2, "data-action": "restore", onClick: () => report(components.restoreMainComponent(info.rootId)), children: "Restore main component" }),
2951
- /* @__PURE__ */ jsx9(
3075
+ ] }) : /* @__PURE__ */ jsx10("button", { type: "button", className: btn2, "data-action": "restore", onClick: () => report(components.restoreMainComponent(info.rootId)), children: "Restore main component" }),
3076
+ /* @__PURE__ */ jsx10(
2952
3077
  "button",
2953
3078
  {
2954
3079
  type: "button",
@@ -3030,7 +3155,7 @@ import {
3030
3155
  // src/canvas/MermaidFamilyScene.tsx
3031
3156
  import { useId } from "react";
3032
3157
  import { diagramTextBaseline } from "@pixerate/editor/canvas";
3033
- import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
3158
+ import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
3034
3159
  function MermaidFamilyScene({
3035
3160
  scene,
3036
3161
  padding = 16,
@@ -3061,7 +3186,7 @@ function MermaidFamilyScene({
3061
3186
  cursor: "pointer"
3062
3187
  } : { pointerEvents: "none" };
3063
3188
  const stroke = (mark) => mark.selected ? { stroke: selectionColor, strokeWidth: Math.max(2, mark.strokeWidth ?? 0) } : { stroke: mark.stroke, strokeWidth: mark.strokeWidth };
3064
- return /* @__PURE__ */ jsxs9(
3189
+ return /* @__PURE__ */ jsxs10(
3065
3190
  "svg",
3066
3191
  {
3067
3192
  className: `pixerate-diagram-scene ${className}`.trim(),
@@ -3074,15 +3199,15 @@ function MermaidFamilyScene({
3074
3199
  style: { display: "block", maxWidth: "100%", height: "auto", overflow: "visible", ...style },
3075
3200
  onClick: interactive ? (event) => onSelect?.(null, event) : void 0,
3076
3201
  children: [
3077
- /* @__PURE__ */ jsxs9("defs", { children: [
3078
- /* @__PURE__ */ jsx10("marker", { id: `${uid}-arrowclosed`, viewBox: "0 0 10 10", refX: "9", refY: "5", markerWidth: "8", markerHeight: "8", orient: "auto-start-reverse", children: /* @__PURE__ */ jsx10("path", { d: "M0,0 L10,5 L0,10 Z", style: { fill: markerColor } }) }),
3079
- /* @__PURE__ */ jsx10("marker", { id: `${uid}-arrow`, viewBox: "0 0 10 10", refX: "9", refY: "5", markerWidth: "8", markerHeight: "8", orient: "auto-start-reverse", children: /* @__PURE__ */ jsx10("path", { d: "M0,0 L10,5 L0,10", style: { fill: "none", stroke: markerColor, strokeWidth: 1.5 } }) })
3202
+ /* @__PURE__ */ jsxs10("defs", { children: [
3203
+ /* @__PURE__ */ jsx11("marker", { id: `${uid}-arrowclosed`, viewBox: "0 0 10 10", refX: "9", refY: "5", markerWidth: "8", markerHeight: "8", orient: "auto-start-reverse", children: /* @__PURE__ */ jsx11("path", { d: "M0,0 L10,5 L0,10 Z", style: { fill: markerColor } }) }),
3204
+ /* @__PURE__ */ jsx11("marker", { id: `${uid}-arrow`, viewBox: "0 0 10 10", refX: "9", refY: "5", markerWidth: "8", markerHeight: "8", orient: "auto-start-reverse", children: /* @__PURE__ */ jsx11("path", { d: "M0,0 L10,5 L0,10", style: { fill: "none", stroke: markerColor, strokeWidth: 1.5 } }) })
3080
3205
  ] }),
3081
3206
  scene.marks.map((mark) => {
3082
3207
  const common = { "data-role": mark.role, "data-target": mark.target, "data-selected": mark.selected ? "" : void 0, opacity: mark.opacity, ...handlers(mark) };
3083
3208
  switch (mark.kind) {
3084
3209
  case "rect":
3085
- return /* @__PURE__ */ jsx10(
3210
+ return /* @__PURE__ */ jsx11(
3086
3211
  "rect",
3087
3212
  {
3088
3213
  ...common,
@@ -3097,9 +3222,9 @@ function MermaidFamilyScene({
3097
3222
  mark.key
3098
3223
  );
3099
3224
  case "circle":
3100
- return /* @__PURE__ */ jsx10("circle", { ...common, cx: mark.cx, cy: mark.cy, r: mark.r, style: { fill: mark.fill, ...stroke(mark) } }, mark.key);
3225
+ return /* @__PURE__ */ jsx11("circle", { ...common, cx: mark.cx, cy: mark.cy, r: mark.r, style: { fill: mark.fill, ...stroke(mark) } }, mark.key);
3101
3226
  case "line":
3102
- return /* @__PURE__ */ jsx10(
3227
+ return /* @__PURE__ */ jsx11(
3103
3228
  "line",
3104
3229
  {
3105
3230
  ...common,
@@ -3115,7 +3240,7 @@ function MermaidFamilyScene({
3115
3240
  mark.key
3116
3241
  );
3117
3242
  case "path":
3118
- return /* @__PURE__ */ jsx10(
3243
+ return /* @__PURE__ */ jsx11(
3119
3244
  "path",
3120
3245
  {
3121
3246
  ...common,
@@ -3129,7 +3254,7 @@ function MermaidFamilyScene({
3129
3254
  mark.key
3130
3255
  );
3131
3256
  case "text":
3132
- return /* @__PURE__ */ jsx10(
3257
+ return /* @__PURE__ */ jsx11(
3133
3258
  "text",
3134
3259
  {
3135
3260
  ...common,
@@ -3157,7 +3282,7 @@ function MermaidFamilyScene({
3157
3282
  }
3158
3283
 
3159
3284
  // src/canvas/useMermaidDiagram.ts
3160
- import { useEffect as useEffect15, useMemo as useMemo14, useRef as useRef20, useState as useState11, useSyncExternalStore as useSyncExternalStore5 } from "react";
3285
+ import { useEffect as useEffect16, useMemo as useMemo15, useRef as useRef20, useState as useState12, useSyncExternalStore as useSyncExternalStore5 } from "react";
3161
3286
  import {
3162
3287
  DiagramController,
3163
3288
  createDiagramEditorDocument
@@ -3186,21 +3311,21 @@ function useMermaidDiagram(controllerOrOptions = {}, view = {}) {
3186
3311
  const layoutOptions = (controllerOrOptions instanceof DiagramController ? void 0 : controllerOrOptions.layoutOptions) ?? view.layoutOptions;
3187
3312
  const sceneTheme = (controllerOrOptions instanceof DiagramController ? void 0 : controllerOrOptions.sceneTheme) ?? view.sceneTheme;
3188
3313
  const state = useDiagramState(controller);
3189
- const editorDocument = useMemo14(() => createDiagramEditorDocument(controller), [controller]);
3190
- useEffect15(() => () => editorDocument.destroy(), [editorDocument]);
3191
- const canvas = useMemo14(
3314
+ const editorDocument = useMemo15(() => createDiagramEditorDocument(controller), [controller]);
3315
+ useEffect16(() => () => editorDocument.destroy(), [editorDocument]);
3316
+ const canvas = useMemo15(
3192
3317
  () => mermaidToCanvas(state.document, { ...layoutOptions, editable: state.editable }),
3193
3318
  // eslint-disable-next-line react-hooks/exhaustive-deps
3194
3319
  [state.document, state.editable]
3195
3320
  );
3196
- const scene = useMemo14(
3321
+ const scene = useMemo15(
3197
3322
  () => state.document.tier === "editable" ? familySceneFromLayout(state.document.family, state.document.graph, canvas.layout, { theme: { ...CSS_VARIABLE_DIAGRAM_SCENE_THEME, ...sceneTheme }, selection: state.selection }) : null,
3198
3323
  // eslint-disable-next-line react-hooks/exhaustive-deps
3199
3324
  [state.document, canvas.layout, state.selection]
3200
3325
  );
3201
3326
  const layoutRef = useRef20(canvas.layout);
3202
3327
  layoutRef.current = canvas.layout;
3203
- const actions = useMemo14(
3328
+ const actions = useMemo15(
3204
3329
  () => ({
3205
3330
  apply: (ops, label) => controller.apply(ops, label),
3206
3331
  load: (source, options) => controller.load(source, options),
@@ -3239,11 +3364,11 @@ function useMermaidStream(source, options = {}) {
3239
3364
  const { complete = false, duration = 300, ...layoutOptions } = options;
3240
3365
  const stream = useRef20(null);
3241
3366
  if (!stream.current) stream.current = new DiagramStream(layoutOptions);
3242
- const result = useMemo14(() => stream.current.update(source, complete), [source, complete]);
3243
- const [shown, setShown] = useState11({ layout: result.layout, settled: true });
3367
+ const result = useMemo15(() => stream.current.update(source, complete), [source, complete]);
3368
+ const [shown, setShown] = useState12({ layout: result.layout, settled: true });
3244
3369
  const shownRef = useRef20(shown.layout);
3245
3370
  shownRef.current = shown.layout;
3246
- useEffect15(() => {
3371
+ useEffect16(() => {
3247
3372
  const target = result.layout;
3248
3373
  if (!target) return setShown({ layout: null, settled: true });
3249
3374
  const from = shownRef.current;
@@ -3260,7 +3385,7 @@ function useMermaidStream(source, options = {}) {
3260
3385
  return () => cancelAnimationFrame(frame);
3261
3386
  }, [result.layout, duration]);
3262
3387
  const doc = result.document.tier === "editable" ? result.document : null;
3263
- const canvas = useMemo14(() => {
3388
+ const canvas = useMemo15(() => {
3264
3389
  if (!doc || !shown.layout) return { nodes: [], edges: [] };
3265
3390
  const placed = new Set(Object.keys(shown.layout.positions));
3266
3391
  const graph = {
@@ -3276,7 +3401,7 @@ function useMermaidStream(source, options = {}) {
3276
3401
 
3277
3402
  // src/canvas/MermaidDiagramNode.tsx
3278
3403
  import { MERMAID_SHAPE_PAINT, mermaidLabelLines, mermaidNodeMembers, mermaidNodePaint, mermaidShapePaths } from "@pixerate/editor/canvas";
3279
- import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
3404
+ import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
3280
3405
  function mermaidNodeStyle(styles = {}, selected = false) {
3281
3406
  const paint = mermaidNodePaint(styles, selected);
3282
3407
  const { color, "stroke-width": strokeWidth, "stroke-dasharray": strokeDasharray, ...vars } = paint;
@@ -3286,7 +3411,7 @@ function MermaidDiagramNode({ data, width = 160, height = 56, selected, classNam
3286
3411
  const node = data.node;
3287
3412
  if (!node) return null;
3288
3413
  const members = mermaidNodeMembers(node.data);
3289
- return /* @__PURE__ */ jsxs10(
3414
+ return /* @__PURE__ */ jsxs11(
3290
3415
  "div",
3291
3416
  {
3292
3417
  className: `pixerate-diagram-node ${className}`.trim(),
@@ -3294,14 +3419,14 @@ function MermaidDiagramNode({ data, width = 160, height = 56, selected, classNam
3294
3419
  "data-selected": selected ? "true" : void 0,
3295
3420
  style: { position: "relative", width: "100%", height: "100%", ...mermaidNodeStyle(data.resolvedStyles, selected) },
3296
3421
  children: [
3297
- /* @__PURE__ */ jsx11("svg", { viewBox: `0 0 ${width} ${height}`, preserveAspectRatio: "none", width: "100%", height: "100%", style: { position: "absolute", inset: 0, overflow: "visible" }, "aria-hidden": "true", children: mermaidShapePaths(node.shape, width, height).map((path, i) => /* @__PURE__ */ jsx11("path", { d: path.d, style: { ...MERMAID_SHAPE_PAINT[path.paint], vectorEffect: "non-scaling-stroke" } }, i)) }),
3298
- /* @__PURE__ */ jsxs10(
3422
+ /* @__PURE__ */ jsx12("svg", { viewBox: `0 0 ${width} ${height}`, preserveAspectRatio: "none", width: "100%", height: "100%", style: { position: "absolute", inset: 0, overflow: "visible" }, "aria-hidden": "true", children: mermaidShapePaths(node.shape, width, height).map((path, i) => /* @__PURE__ */ jsx12("path", { d: path.d, style: { ...MERMAID_SHAPE_PAINT[path.paint], vectorEffect: "non-scaling-stroke" } }, i)) }),
3423
+ /* @__PURE__ */ jsxs11(
3299
3424
  "div",
3300
3425
  {
3301
3426
  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" },
3302
3427
  children: [
3303
- mermaidLabelLines(node.label).map((line, i) => /* @__PURE__ */ jsx11("span", { style: { fontWeight: members.length ? 600 : void 0 }, children: line }, i)),
3304
- members.length > 0 && /* @__PURE__ */ jsx11("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__ */ jsx11("div", { children: m }, i)) })
3428
+ mermaidLabelLines(node.label).map((line, i) => /* @__PURE__ */ jsx12("span", { style: { fontWeight: members.length ? 600 : void 0 }, children: line }, i)),
3429
+ members.length > 0 && /* @__PURE__ */ jsx12("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__ */ jsx12("div", { children: m }, i)) })
3305
3430
  ]
3306
3431
  }
3307
3432
  ),
@@ -3313,7 +3438,7 @@ function MermaidDiagramNode({ data, width = 160, height = 56, selected, classNam
3313
3438
  function MermaidDiagramGroup({ data, selected, className = "", children }) {
3314
3439
  const group = data.group;
3315
3440
  if (!group) return null;
3316
- return /* @__PURE__ */ jsxs10(
3441
+ return /* @__PURE__ */ jsxs11(
3317
3442
  "div",
3318
3443
  {
3319
3444
  className: `pixerate-diagram-group ${className}`.trim(),
@@ -3328,7 +3453,7 @@ function MermaidDiagramGroup({ data, selected, className = "", children }) {
3328
3453
  color: data.resolvedStyles?.color ?? "var(--muted-foreground, #475569)"
3329
3454
  },
3330
3455
  children: [
3331
- /* @__PURE__ */ jsx11("div", { style: { padding: "6px 10px", fontSize: 12, fontWeight: 600 }, children: mermaidLabelLines(group.label).join(" ") }),
3456
+ /* @__PURE__ */ jsx12("div", { style: { padding: "6px 10px", fontSize: 12, fontWeight: 600 }, children: mermaidLabelLines(group.label).join(" ") }),
3332
3457
  children
3333
3458
  ]
3334
3459
  }
@@ -3336,20 +3461,20 @@ function MermaidDiagramGroup({ data, selected, className = "", children }) {
3336
3461
  }
3337
3462
 
3338
3463
  // src/canvas/MermaidThumbnail.tsx
3339
- import { useMemo as useMemo15 } from "react";
3464
+ import { useMemo as useMemo16 } from "react";
3340
3465
  import { parseMermaid } from "@pixerate/editor/diagram";
3341
3466
  import { mermaidThumbnailSvg } from "@pixerate/editor/canvas";
3342
- import { Fragment as Fragment3, jsx as jsx12 } from "react/jsx-runtime";
3467
+ import { Fragment as Fragment4, jsx as jsx13 } from "react/jsx-runtime";
3343
3468
  function MermaidThumbnail({ source, className = "", fallback = null, ...options }) {
3344
- const doc = useMemo15(() => typeof source === "string" ? parseMermaid(source) : source, [source]);
3469
+ const doc = useMemo16(() => typeof source === "string" ? parseMermaid(source) : source, [source]);
3345
3470
  const key = JSON.stringify(options);
3346
- const drawn = useMemo15(
3471
+ const drawn = useMemo16(
3347
3472
  () => doc.tier === "editable" && doc.graph.nodes.length ? mermaidThumbnailSvg(doc, options) : null,
3348
3473
  // eslint-disable-next-line react-hooks/exhaustive-deps
3349
3474
  [doc, key]
3350
3475
  );
3351
- if (!drawn) return /* @__PURE__ */ jsx12(Fragment3, { children: fallback });
3352
- return /* @__PURE__ */ jsx12("span", { className: `pixerate-diagram-thumbnail ${className}`.trim(), style: { display: "inline-block", lineHeight: 0 }, dangerouslySetInnerHTML: { __html: drawn.svg } });
3476
+ if (!drawn) return /* @__PURE__ */ jsx13(Fragment4, { children: fallback });
3477
+ return /* @__PURE__ */ jsx13("span", { className: `pixerate-diagram-thumbnail ${className}`.trim(), style: { display: "inline-block", lineHeight: 0 }, dangerouslySetInnerHTML: { __html: drawn.svg } });
3353
3478
  }
3354
3479
 
3355
3480
  // src/canvas/useDiagramDirector.ts
@@ -3373,18 +3498,18 @@ function usePresenceState(presence) {
3373
3498
  }
3374
3499
 
3375
3500
  // src/canvas/DiagramPresenceLayer.tsx
3376
- import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
3501
+ import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
3377
3502
  function DiagramPresenceLayer({ presence, viewport, className = "" }) {
3378
3503
  const { actors } = usePresenceState(presence);
3379
3504
  if (!actors.length) return null;
3380
- return /* @__PURE__ */ jsx13("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__ */ jsxs11("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: [
3381
- /* @__PURE__ */ jsx13("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__ */ jsx13("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 } }) }),
3382
- /* @__PURE__ */ jsx13("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 })
3505
+ return /* @__PURE__ */ jsx14("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__ */ jsxs12("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: [
3506
+ /* @__PURE__ */ jsx14("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__ */ jsx14("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 } }) }),
3507
+ /* @__PURE__ */ jsx14("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 })
3383
3508
  ] }, a.id)) });
3384
3509
  }
3385
3510
 
3386
3511
  // src/canvas/useCanvasProposals.ts
3387
- import { useEffect as useEffect16, useMemo as useMemo16, useRef as useRef22, useState as useState12, useSyncExternalStore as useSyncExternalStore7 } from "react";
3512
+ import { useEffect as useEffect17, useMemo as useMemo17, useRef as useRef22, useState as useState13, useSyncExternalStore as useSyncExternalStore7 } from "react";
3388
3513
  import {
3389
3514
  createCanvasChangeFeed,
3390
3515
  createCanvasProposals
@@ -3418,8 +3543,8 @@ function useCanvasProposals(options) {
3418
3543
  }
3419
3544
  const store = storeRef.current;
3420
3545
  const state = useSyncExternalStore7(store.subscribe, store.getState, store.getState);
3421
- const view = useMemo16(() => store.withGhosts(options.nodes, options.edges), [store, state, options.nodes, options.edges]);
3422
- return useMemo16(
3546
+ const view = useMemo17(() => store.withGhosts(options.nodes, options.edges), [store, state, options.nodes, options.edges]);
3547
+ return useMemo17(
3423
3548
  () => ({
3424
3549
  store,
3425
3550
  proposals: state.proposals,
@@ -3435,8 +3560,8 @@ function useCanvasProposals(options) {
3435
3560
  function useCanvasChangeFeed(options) {
3436
3561
  const latest = useRef22(options);
3437
3562
  latest.current = options;
3438
- const [last, setLast] = useState12(null);
3439
- const feed = useMemo16(
3563
+ const [last, setLast] = useState13(null);
3564
+ const feed = useMemo17(
3440
3565
  () => createCanvasChangeFeed({
3441
3566
  getNodes: () => latest.current.nodes,
3442
3567
  getEdges: () => latest.current.edges,
@@ -3444,8 +3569,8 @@ function useCanvasChangeFeed(options) {
3444
3569
  }),
3445
3570
  []
3446
3571
  );
3447
- useEffect16(() => options.history?.onCommit(feed.noteCommit), [feed, options.history]);
3448
- useEffect16(() => {
3572
+ useEffect17(() => options.history?.onCommit(feed.noteCommit), [feed, options.history]);
3573
+ useEffect17(() => {
3449
3574
  const change = feed.check();
3450
3575
  if (!change) return;
3451
3576
  setLast(change);
@@ -3469,10 +3594,13 @@ export {
3469
3594
  ANIMATION_TIME_EPSILON,
3470
3595
  AUTO_LAYOUT_DATA_KEY,
3471
3596
  AgentPresenceLayer,
3597
+ AnimatedEdge,
3472
3598
  AnimationEditError,
3473
3599
  AnimationPlayer,
3474
3600
  AnimationTimeline,
3475
3601
  CANVAS_COMPONENT_DRAG_TYPE2 as CANVAS_COMPONENT_DRAG_TYPE,
3602
+ CANVAS_EDGE_ANIMATION_KINDS,
3603
+ CANVAS_EDGE_ANIMATION_SCHEMA,
3476
3604
  CANVAS_GRADIENT_PRESETS,
3477
3605
  CANVAS_PROPOSAL_CLASS,
3478
3606
  CANVAS_TOKEN_PROPERTIES,
@@ -3490,6 +3618,7 @@ export {
3490
3618
  CanvasScenesStore2 as CanvasScenesStore,
3491
3619
  DEFAULT_ARRANGE_SHORTCUTS,
3492
3620
  DiagramPresenceLayer,
3621
+ EdgeAnimation,
3493
3622
  MAX_KEYFRAME_REFS,
3494
3623
  ManualClock,
3495
3624
  MermaidDiagramGroup,
@@ -3560,6 +3689,7 @@ export {
3560
3689
  createCanvasComponent,
3561
3690
  createCanvasComponentsController2 as createCanvasComponentsController,
3562
3691
  createCanvasDrawController2 as createCanvasDrawController,
3692
+ createCanvasEdgeAnimationToolProvider,
3563
3693
  createCanvasExplosionStateController2 as createCanvasExplosionStateController,
3564
3694
  createCanvasExplosionToolProvider,
3565
3695
  createCanvasInstance,
@@ -3619,6 +3749,9 @@ export {
3619
3749
  getBindableTokenProperties2 as getBindableTokenProperties,
3620
3750
  getBrushedShapeSvg,
3621
3751
  getCanvasComponentDragId,
3752
+ getCanvasEdgeAnimation2 as getCanvasEdgeAnimation,
3753
+ getCanvasEdgeAnimationRender2 as getCanvasEdgeAnimationRender,
3754
+ getCanvasEdgePath2 as getCanvasEdgePath,
3622
3755
  getCanvasTokenProperty,
3623
3756
  getCenteredNodePosition2 as getCenteredNodePosition,
3624
3757
  getChildLayout,
@@ -3693,6 +3826,7 @@ export {
3693
3826
  measureBetween,
3694
3827
  measureLabel,
3695
3828
  measureSelection2 as measureSelection,
3829
+ measureSvgPath,
3696
3830
  measureToLine,
3697
3831
  mergeNodeUpdates,
3698
3832
  mermaidNodeStyle,
@@ -3704,6 +3838,7 @@ export {
3704
3838
  nearestHandlePositions,
3705
3839
  nodeSizeOf,
3706
3840
  normalizeBezierPath,
3841
+ normalizeCanvasEdgeAnimation,
3707
3842
  normalizeKeyframes,
3708
3843
  offsetPath,
3709
3844
  offsetShapeNodes,
@@ -3752,6 +3887,7 @@ export {
3752
3887
  repositionNodesTo,
3753
3888
  resetCanvasInstanceOverrides,
3754
3889
  resizeHandleAxes,
3890
+ resolveCanvasEdgeAnimation2 as resolveCanvasEdgeAnimation,
3755
3891
  resolveCanvasGradient2 as resolveCanvasGradient,
3756
3892
  resolveCanvasTokens2 as resolveCanvasTokens,
3757
3893
  resolveEasing,
@@ -3762,9 +3898,11 @@ export {
3762
3898
  ringSignedArea,
3763
3899
  runMultiNodeTransition2 as runMultiNodeTransition,
3764
3900
  sampleAnimationFrames,
3901
+ sampleCanvasEdgeAnimation,
3765
3902
  scaleKeyframes,
3766
3903
  serializeCanvasNodes2 as serializeCanvasNodes,
3767
3904
  setCanvasComponentProperty,
3905
+ setCanvasEdgeAnimation,
3768
3906
  setCanvasInstanceProperties,
3769
3907
  setCanvasTokenMode3 as setCanvasTokenMode,
3770
3908
  setCanvasVariantProperties,
@@ -3833,6 +3971,7 @@ export {
3833
3971
  useDiagramState,
3834
3972
  useMermaidDiagram,
3835
3973
  useMermaidStream,
3974
+ usePrefersReducedMotion,
3836
3975
  usePresenceState,
3837
3976
  useShapeBrushstroke,
3838
3977
  useStreamingCanvas,