@elabs-ai/components-flow 4.2.0 → 5.0.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 (263) hide show
  1. package/README.md +2 -1
  2. package/dist/canvas-shell/canvas-shell.js +13 -0
  3. package/dist/canvas-shell/canvas-shell.js.map +1 -0
  4. package/dist/canvas-shell/clamped-fit-offset.js +8 -0
  5. package/dist/canvas-shell/clamped-fit-offset.js.map +1 -0
  6. package/dist/canvas-shell/index.js +14 -0
  7. package/dist/canvas-shell/index.js.map +1 -0
  8. package/dist/canvas-shell/use-measured-nodes.js +8 -0
  9. package/dist/canvas-shell/use-measured-nodes.js.map +1 -0
  10. package/dist/chunk-3BTU2VWZ.js +42 -0
  11. package/dist/chunk-3BTU2VWZ.js.map +1 -0
  12. package/dist/chunk-3LK6OOXE.js +2 -0
  13. package/dist/chunk-3LK6OOXE.js.map +1 -0
  14. package/dist/chunk-3M3FQAD4.js +105 -0
  15. package/dist/chunk-3M3FQAD4.js.map +1 -0
  16. package/dist/chunk-3Y5TCGC3.js +2 -0
  17. package/dist/chunk-3Y5TCGC3.js.map +1 -0
  18. package/dist/chunk-4VYHZM3S.js +108 -0
  19. package/dist/chunk-4VYHZM3S.js.map +1 -0
  20. package/dist/chunk-5TVVM4GR.js +45 -0
  21. package/dist/chunk-5TVVM4GR.js.map +1 -0
  22. package/dist/chunk-5XT73MQQ.js +2 -0
  23. package/dist/chunk-5XT73MQQ.js.map +1 -0
  24. package/dist/chunk-6LQD5Y5R.js +24 -0
  25. package/dist/chunk-6LQD5Y5R.js.map +1 -0
  26. package/dist/chunk-6SR26QY2.js +18 -0
  27. package/dist/chunk-6SR26QY2.js.map +1 -0
  28. package/dist/chunk-75JJK6BH.js +157 -0
  29. package/dist/chunk-75JJK6BH.js.map +1 -0
  30. package/dist/chunk-A66JBW4X.js +2 -0
  31. package/dist/chunk-A66JBW4X.js.map +1 -0
  32. package/dist/chunk-A7AFM3LI.js +72 -0
  33. package/dist/chunk-A7AFM3LI.js.map +1 -0
  34. package/dist/chunk-ADHLQF56.js +2 -0
  35. package/dist/chunk-ADHLQF56.js.map +1 -0
  36. package/dist/chunk-ATO4LXJF.js +75 -0
  37. package/dist/chunk-ATO4LXJF.js.map +1 -0
  38. package/dist/chunk-ATXVXTMZ.js +227 -0
  39. package/dist/chunk-ATXVXTMZ.js.map +1 -0
  40. package/dist/chunk-B6IUPZU7.js +2 -0
  41. package/dist/chunk-B6IUPZU7.js.map +1 -0
  42. package/dist/chunk-BJ7UMCD3.js +53 -0
  43. package/dist/chunk-BJ7UMCD3.js.map +1 -0
  44. package/dist/chunk-BWGYV4JZ.js +2 -0
  45. package/dist/chunk-BWGYV4JZ.js.map +1 -0
  46. package/dist/chunk-CWNO63LQ.js +109 -0
  47. package/dist/chunk-CWNO63LQ.js.map +1 -0
  48. package/dist/chunk-DHPUXKCZ.js +76 -0
  49. package/dist/chunk-DHPUXKCZ.js.map +1 -0
  50. package/dist/chunk-DNX7G3KA.js +185 -0
  51. package/dist/chunk-DNX7G3KA.js.map +1 -0
  52. package/dist/chunk-DNZRAJAQ.js +41 -0
  53. package/dist/chunk-DNZRAJAQ.js.map +1 -0
  54. package/dist/chunk-ELCLRVD4.js +2 -0
  55. package/dist/chunk-ELCLRVD4.js.map +1 -0
  56. package/dist/chunk-ELOADZSX.js +2 -0
  57. package/dist/chunk-ELOADZSX.js.map +1 -0
  58. package/dist/chunk-EUNV2MR5.js +21 -0
  59. package/dist/chunk-EUNV2MR5.js.map +1 -0
  60. package/dist/chunk-FAFQ5KLB.js +43 -0
  61. package/dist/chunk-FAFQ5KLB.js.map +1 -0
  62. package/dist/chunk-FIRO6Y3R.js +128 -0
  63. package/dist/chunk-FIRO6Y3R.js.map +1 -0
  64. package/dist/chunk-GE73WQUK.js +2 -0
  65. package/dist/chunk-GE73WQUK.js.map +1 -0
  66. package/dist/chunk-GIARAOU6.js +39 -0
  67. package/dist/chunk-GIARAOU6.js.map +1 -0
  68. package/dist/chunk-HTLTCCFA.js +73 -0
  69. package/dist/chunk-HTLTCCFA.js.map +1 -0
  70. package/dist/chunk-I53W3CFN.js +56 -0
  71. package/dist/chunk-I53W3CFN.js.map +1 -0
  72. package/dist/chunk-IJVFPUXO.js +2 -0
  73. package/dist/chunk-IJVFPUXO.js.map +1 -0
  74. package/dist/chunk-JUPMOISE.js +51 -0
  75. package/dist/chunk-JUPMOISE.js.map +1 -0
  76. package/dist/chunk-K5RPSVO6.js +167 -0
  77. package/dist/chunk-K5RPSVO6.js.map +1 -0
  78. package/dist/chunk-K6U27YJ6.js +78 -0
  79. package/dist/chunk-K6U27YJ6.js.map +1 -0
  80. package/dist/chunk-KDVMGMAK.js +2 -0
  81. package/dist/chunk-KDVMGMAK.js.map +1 -0
  82. package/dist/chunk-LQOZCOK3.js +74 -0
  83. package/dist/chunk-LQOZCOK3.js.map +1 -0
  84. package/dist/chunk-NAQWNX2A.js +102 -0
  85. package/dist/chunk-NAQWNX2A.js.map +1 -0
  86. package/dist/chunk-NVJVWGUS.js +152 -0
  87. package/dist/chunk-NVJVWGUS.js.map +1 -0
  88. package/dist/chunk-O2F3R3PV.js +2 -0
  89. package/dist/chunk-O2F3R3PV.js.map +1 -0
  90. package/dist/chunk-OMFQHMA6.js +2 -0
  91. package/dist/chunk-OMFQHMA6.js.map +1 -0
  92. package/dist/chunk-PE6JXVOX.js +2 -0
  93. package/dist/chunk-PE6JXVOX.js.map +1 -0
  94. package/dist/chunk-ROJEIIA4.js +52 -0
  95. package/dist/chunk-ROJEIIA4.js.map +1 -0
  96. package/dist/chunk-ROYAQKJA.js +9 -0
  97. package/dist/chunk-ROYAQKJA.js.map +1 -0
  98. package/dist/chunk-SHCZK4DO.js +45 -0
  99. package/dist/chunk-SHCZK4DO.js.map +1 -0
  100. package/dist/chunk-SXXJV6YJ.js +79 -0
  101. package/dist/chunk-SXXJV6YJ.js.map +1 -0
  102. package/dist/chunk-T7S7NJFD.js +287 -0
  103. package/dist/chunk-T7S7NJFD.js.map +1 -0
  104. package/dist/chunk-TEZ3OXAY.js +63 -0
  105. package/dist/chunk-TEZ3OXAY.js.map +1 -0
  106. package/dist/chunk-TGWPM2CG.js +199 -0
  107. package/dist/chunk-TGWPM2CG.js.map +1 -0
  108. package/dist/chunk-TSB6RE7L.js +2 -0
  109. package/dist/chunk-TSB6RE7L.js.map +1 -0
  110. package/dist/chunk-UPV2MT4O.js +2 -0
  111. package/dist/chunk-UPV2MT4O.js.map +1 -0
  112. package/dist/chunk-UZJZY4A5.js +2 -0
  113. package/dist/chunk-UZJZY4A5.js.map +1 -0
  114. package/dist/chunk-W3TQMUGX.js +2 -0
  115. package/dist/chunk-W3TQMUGX.js.map +1 -0
  116. package/dist/chunk-WN46RIOC.js +29 -0
  117. package/dist/chunk-WN46RIOC.js.map +1 -0
  118. package/dist/chunk-XZFE2YYH.js +70 -0
  119. package/dist/chunk-XZFE2YYH.js.map +1 -0
  120. package/dist/chunk-YG3KXTZW.js +2 -0
  121. package/dist/chunk-YG3KXTZW.js.map +1 -0
  122. package/dist/chunk-ZATVF42E.js +65 -0
  123. package/dist/chunk-ZATVF42E.js.map +1 -0
  124. package/dist/chunk-ZXZTLQIX.js +19 -0
  125. package/dist/chunk-ZXZTLQIX.js.map +1 -0
  126. package/dist/flow-button-edge/flow-button-edge.js +10 -0
  127. package/dist/flow-button-edge/flow-button-edge.js.map +1 -0
  128. package/dist/flow-button-edge/index.js +11 -0
  129. package/dist/flow-button-edge/index.js.map +1 -0
  130. package/dist/flow-edge/flow-edge.js +10 -0
  131. package/dist/flow-edge/flow-edge.js.map +1 -0
  132. package/dist/flow-edge/index.js +11 -0
  133. package/dist/flow-edge/index.js.map +1 -0
  134. package/dist/flow-edge-path/flow-edge-path.js +12 -0
  135. package/dist/flow-edge-path/flow-edge-path.js.map +1 -0
  136. package/dist/flow-edge-path/index.js +13 -0
  137. package/dist/flow-edge-path/index.js.map +1 -0
  138. package/dist/flow-edge-tokens/edge-path-sampler.js +10 -0
  139. package/dist/flow-edge-tokens/edge-path-sampler.js.map +1 -0
  140. package/dist/flow-edge-tokens/flow-edge-tokens.js +12 -0
  141. package/dist/flow-edge-tokens/flow-edge-tokens.js.map +1 -0
  142. package/dist/flow-edge-tokens/index.js +17 -0
  143. package/dist/flow-edge-tokens/index.js.map +1 -0
  144. package/dist/flow-floating-edge/floating-edge-geometry.js +8 -0
  145. package/dist/flow-floating-edge/floating-edge-geometry.js.map +1 -0
  146. package/dist/flow-floating-edge/flow-floating-edge.js +11 -0
  147. package/dist/flow-floating-edge/flow-floating-edge.js.map +1 -0
  148. package/dist/flow-floating-edge/index.js +15 -0
  149. package/dist/flow-floating-edge/index.js.map +1 -0
  150. package/dist/flow-group-node/flow-group-node.js +12 -0
  151. package/dist/flow-group-node/flow-group-node.js.map +1 -0
  152. package/dist/flow-group-node/index.js +13 -0
  153. package/dist/flow-group-node/index.js.map +1 -0
  154. package/dist/flow-handle/flow-handle-anchor.js +8 -0
  155. package/dist/flow-handle/flow-handle-anchor.js.map +1 -0
  156. package/dist/flow-handle/index.js +9 -0
  157. package/dist/flow-handle/index.js.map +1 -0
  158. package/dist/flow-layout/backbone.js +8 -0
  159. package/dist/flow-layout/backbone.js.map +1 -0
  160. package/dist/flow-layout/flow-layout.js +10 -0
  161. package/dist/flow-layout/flow-layout.js.map +1 -0
  162. package/dist/flow-layout/index.js +21 -0
  163. package/dist/flow-layout/index.js.map +1 -0
  164. package/dist/flow-layout/layout-flow-elk.js +9 -0
  165. package/dist/flow-layout/layout-flow-elk.js.map +1 -0
  166. package/dist/flow-layout/layout-graph.js +9 -0
  167. package/dist/flow-layout/layout-graph.js.map +1 -0
  168. package/dist/flow-layout/use-auto-layout.js +10 -0
  169. package/dist/flow-layout/use-auto-layout.js.map +1 -0
  170. package/dist/flow-layout/use-flow-layout.js +9 -0
  171. package/dist/flow-layout/use-flow-layout.js.map +1 -0
  172. package/dist/flow-mini-map/flow-mini-map.js +8 -0
  173. package/dist/flow-mini-map/flow-mini-map.js.map +1 -0
  174. package/dist/flow-mini-map/index.js +9 -0
  175. package/dist/flow-mini-map/index.js.map +1 -0
  176. package/dist/flow-node/flow-node.js +11 -0
  177. package/dist/flow-node/flow-node.js.map +1 -0
  178. package/dist/flow-node/index.js +12 -0
  179. package/dist/flow-node/index.js.map +1 -0
  180. package/dist/flow-placeholder-node/flow-placeholder-node.js +9 -0
  181. package/dist/flow-placeholder-node/flow-placeholder-node.js.map +1 -0
  182. package/dist/flow-placeholder-node/index.js +10 -0
  183. package/dist/flow-placeholder-node/index.js.map +1 -0
  184. package/dist/flow-self-loop-edge/flow-self-loop-edge.js +20 -0
  185. package/dist/flow-self-loop-edge/flow-self-loop-edge.js.map +1 -0
  186. package/dist/flow-self-loop-edge/index.js +28 -0
  187. package/dist/flow-self-loop-edge/index.js.map +1 -0
  188. package/dist/flow-self-loop-edge/self-loop-geometry.js +12 -0
  189. package/dist/flow-self-loop-edge/self-loop-geometry.js.map +1 -0
  190. package/dist/flow-smart-edge/flow-smart-edge.js +11 -0
  191. package/dist/flow-smart-edge/flow-smart-edge.js.map +1 -0
  192. package/dist/flow-smart-edge/index.js +25 -0
  193. package/dist/flow-smart-edge/index.js.map +1 -0
  194. package/dist/flow-smart-edge/smart-edge-geometry.js +18 -0
  195. package/dist/flow-smart-edge/smart-edge-geometry.js.map +1 -0
  196. package/dist/flow-weighted-edge/back-edge-geometry.js +8 -0
  197. package/dist/flow-weighted-edge/back-edge-geometry.js.map +1 -0
  198. package/dist/flow-weighted-edge/edge-aria.js +10 -0
  199. package/dist/flow-weighted-edge/edge-aria.js.map +1 -0
  200. package/dist/flow-weighted-edge/edge-label-pill.js +8 -0
  201. package/dist/flow-weighted-edge/edge-label-pill.js.map +1 -0
  202. package/dist/flow-weighted-edge/flow-weighted-edge.js +16 -0
  203. package/dist/flow-weighted-edge/flow-weighted-edge.js.map +1 -0
  204. package/dist/flow-weighted-edge/index.js +34 -0
  205. package/dist/flow-weighted-edge/index.js.map +1 -0
  206. package/dist/flow-weighted-edge/weight-scale.js +10 -0
  207. package/dist/flow-weighted-edge/weight-scale.js.map +1 -0
  208. package/dist/helper-lines/get-helper-lines.js +8 -0
  209. package/dist/helper-lines/get-helper-lines.js.map +1 -0
  210. package/dist/helper-lines/helper-lines.js +9 -0
  211. package/dist/helper-lines/helper-lines.js.map +1 -0
  212. package/dist/helper-lines/index.js +17 -0
  213. package/dist/helper-lines/index.js.map +1 -0
  214. package/dist/helper-lines/use-helper-lines.js +10 -0
  215. package/dist/helper-lines/use-helper-lines.js.map +1 -0
  216. package/dist/index.d.ts +236 -1
  217. package/dist/index.js +167 -2311
  218. package/dist/index.js.map +1 -1
  219. package/dist/inspector-panel/index.js +9 -0
  220. package/dist/inspector-panel/index.js.map +1 -0
  221. package/dist/inspector-panel/inspector-panel.js +8 -0
  222. package/dist/inspector-panel/inspector-panel.js.map +1 -0
  223. package/dist/legend/index.js +10 -0
  224. package/dist/legend/index.js.map +1 -0
  225. package/dist/legend/legend.js +9 -0
  226. package/dist/legend/legend.js.map +1 -0
  227. package/dist/use-flow-groups/group-operations.js +20 -0
  228. package/dist/use-flow-groups/group-operations.js.map +1 -0
  229. package/dist/use-flow-groups/index.js +25 -0
  230. package/dist/use-flow-groups/index.js.map +1 -0
  231. package/dist/use-flow-groups/use-flow-groups.js +9 -0
  232. package/dist/use-flow-groups/use-flow-groups.js.map +1 -0
  233. package/dist/zoom-controls/index.js +9 -0
  234. package/dist/zoom-controls/index.js.map +1 -0
  235. package/dist/zoom-controls/zoom-controls.js +8 -0
  236. package/dist/zoom-controls/zoom-controls.js.map +1 -0
  237. package/package.json +13 -6
  238. package/src/canvas-shell/canvas-shell.stories.tsx +1 -0
  239. package/src/canvas-shell/canvas-shell.tsx +51 -4
  240. package/src/canvas-shell/clamped-fit-offset.test.ts +25 -0
  241. package/src/canvas-shell/clamped-fit-offset.ts +30 -0
  242. package/src/custom-nodes/custom-nodes.stories.tsx +718 -0
  243. package/src/flow-edge-tokens/edge-path-sampler.test.ts +108 -0
  244. package/src/flow-edge-tokens/edge-path-sampler.ts +362 -0
  245. package/src/flow-edge-tokens/flow-edge-tokens.stories.tsx +312 -0
  246. package/src/flow-edge-tokens/flow-edge-tokens.test.tsx +115 -0
  247. package/src/flow-edge-tokens/flow-edge-tokens.tsx +94 -0
  248. package/src/flow-edge-tokens/index.ts +12 -0
  249. package/src/flow-layout/backbone.test.ts +88 -0
  250. package/src/flow-layout/backbone.ts +58 -0
  251. package/src/flow-layout/layout-flow-elk.stories.tsx +154 -0
  252. package/src/flow-layout/layout-flow-elk.test.ts +152 -0
  253. package/src/flow-layout/layout-flow-elk.ts +399 -0
  254. package/src/flow-mini-map/flow-mini-map.stories.tsx +10 -7
  255. package/src/flow-node/flow-node.stories.tsx +40 -1
  256. package/src/flow-self-loop-edge/flow-self-loop-edge.test.tsx +38 -0
  257. package/src/flow-self-loop-edge/flow-self-loop-edge.tsx +7 -0
  258. package/src/flow-weighted-edge/edge-label-pill.test.tsx +20 -0
  259. package/src/flow-weighted-edge/flow-weighted-edge.stories.tsx +1 -0
  260. package/src/flow-weighted-edge/flow-weighted-edge.test.tsx +40 -0
  261. package/src/flow-weighted-edge/flow-weighted-edge.tsx +7 -0
  262. package/src/index.ts +13 -0
  263. package/src/templates-flow-workspace.stories.tsx +7 -2
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import "../chunk-W3TQMUGX.js";
3
+ import {
4
+ buildWeightedEdgeAriaLabel,
5
+ withWeightedEdgeAria
6
+ } from "../chunk-FAFQ5KLB.js";
7
+ import {
8
+ FlowWeightedEdge
9
+ } from "../chunk-K5RPSVO6.js";
10
+ import {
11
+ backEdgeDetour
12
+ } from "../chunk-ZXZTLQIX.js";
13
+ import {
14
+ EdgeLabelPill
15
+ } from "../chunk-I53W3CFN.js";
16
+ import {
17
+ DEFAULT_EDGE_WIDTH_RANGE,
18
+ computeEdgeWeightScale
19
+ } from "../chunk-3BTU2VWZ.js";
20
+ import "../chunk-YG3KXTZW.js";
21
+ import "../chunk-ROJEIIA4.js";
22
+ import "../chunk-T7S7NJFD.js";
23
+ import "../chunk-KDVMGMAK.js";
24
+ import "../chunk-SXXJV6YJ.js";
25
+ export {
26
+ DEFAULT_EDGE_WIDTH_RANGE,
27
+ EdgeLabelPill,
28
+ FlowWeightedEdge,
29
+ backEdgeDetour,
30
+ buildWeightedEdgeAriaLabel,
31
+ computeEdgeWeightScale,
32
+ withWeightedEdgeAria
33
+ };
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import {
3
+ DEFAULT_EDGE_WIDTH_RANGE,
4
+ computeEdgeWeightScale
5
+ } from "../chunk-3BTU2VWZ.js";
6
+ export {
7
+ DEFAULT_EDGE_WIDTH_RANGE,
8
+ computeEdgeWeightScale
9
+ };
10
+ //# sourceMappingURL=weight-scale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ import {
3
+ getHelperLines
4
+ } from "../chunk-DNZRAJAQ.js";
5
+ export {
6
+ getHelperLines
7
+ };
8
+ //# sourceMappingURL=get-helper-lines.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ "use client";
3
+ import {
4
+ HelperLines
5
+ } from "../chunk-BJ7UMCD3.js";
6
+ export {
7
+ HelperLines
8
+ };
9
+ //# sourceMappingURL=helper-lines.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import "../chunk-GE73WQUK.js";
3
+ import {
4
+ useHelperLines
5
+ } from "../chunk-ZATVF42E.js";
6
+ import {
7
+ getHelperLines
8
+ } from "../chunk-DNZRAJAQ.js";
9
+ import {
10
+ HelperLines
11
+ } from "../chunk-BJ7UMCD3.js";
12
+ export {
13
+ HelperLines,
14
+ getHelperLines,
15
+ useHelperLines
16
+ };
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ "use client";
3
+ import {
4
+ useHelperLines
5
+ } from "../chunk-ZATVF42E.js";
6
+ import "../chunk-DNZRAJAQ.js";
7
+ export {
8
+ useHelperLines
9
+ };
10
+ //# sourceMappingURL=use-helper-lines.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/dist/index.d.ts CHANGED
@@ -35,6 +35,15 @@ interface CanvasShellProps<NodeType extends Node = Node, EdgeType extends Edge =
35
35
  fitViewKey?: string | number;
36
36
  /** Options for the {@link fitViewKey} re-fit. Ignored without one. */
37
37
  fitViewKeyOptions?: FitViewOptions;
38
+ /**
39
+ * Which nodes a CLAMPED {@link fitViewKey} re-fit keeps in view — typically where the
40
+ * diagram begins. A fit that cannot shrink far enough (a `minZoom` floor) is pinned to the
41
+ * content's top-left corner by default, which is where a top-down layout starts; a
42
+ * left-to-right layout starts at the left edge but at mid-height, so pinning to the top
43
+ * opens on an empty corner. With anchors, each overflowing axis centres the anchor nodes
44
+ * instead, without ever scrolling past the content's own edge. Unset: today's corner pin.
45
+ */
46
+ fitViewAnchorNodeIds?: readonly string[];
38
47
  /** Overlays rendered inside the flow (ZoomControls, Legend, Panels). */
39
48
  children?: ReactNode;
40
49
  className?: string;
@@ -935,6 +944,93 @@ interface UseFlowGroupsResult {
935
944
  */
936
945
  declare function useFlowGroups<NodeType extends Node = Node, EdgeType extends Edge = Edge>(): UseFlowGroupsResult;
937
946
 
947
+ /** Default token radius, in px. */
948
+ declare const DEFAULT_EDGE_TOKEN_RADIUS = 4;
949
+ interface FlowEdgeToken {
950
+ /** Stable identity (e.g. a case id). Keys the rendered marker, so a token keeps its element — and its transition — as it moves. */
951
+ id: string;
952
+ /** Position along the path's arc length: `0` = source end, `1` = target end. Clamped; a non-finite value sits at `0`. */
953
+ progress: number;
954
+ /** Marker radius in px — e.g. scaled by congestion. @default 4 */
955
+ radius?: number;
956
+ }
957
+ interface FlowEdgeTokensProps extends Omit<SVGProps<SVGGElement>, "ref" | "children"> {
958
+ /** SVG path `d` the tokens travel along — the same string the edge draws. */
959
+ path: string;
960
+ /** Tokens to place. The parent owns `progress`; this part keeps no clock. */
961
+ tokens: readonly FlowEdgeToken[];
962
+ }
963
+ /**
964
+ * Markers ("tokens") placed along an edge's path — the presentational primitive
965
+ * behind process replay. Each token is a circle at `progress` (0..1) of the
966
+ * path's arc length.
967
+ *
968
+ * **Parent-driven, no internal clock.** Nothing here animates on its own: the
969
+ * parent re-renders with new `progress` values (from a slider, a playback loop,
970
+ * a play function). Position is a pure function of `(path, progress)` — see
971
+ * `createEdgePathSampler` — so every render is deterministic and identical in
972
+ * jsdom, on the server and in the browser.
973
+ *
974
+ * Between two renders a token glides with a short `duration-fast` transform
975
+ * transition, so a parent stepping at a coarse rate still reads as motion. Under
976
+ * reduced motion (`useReducedMotion()`: the ThemeProvider preference, else the
977
+ * OS setting) the transition class is not rendered at all and a token jumps
978
+ * straight to its new position; the `duration-fast` token also collapses to
979
+ * `--motion-min` through the global motion gate (`data-motion-pref`).
980
+ *
981
+ * **Decorative to assistive technology.** The group is `aria-hidden` and ignores
982
+ * pointer events: a moving dot has no stable meaning to announce. The consumer
983
+ * owns the text alternative (a live case count, a summary). Colour is the one
984
+ * `--primary` fill for every token, with a `--background` halo so a token stays
985
+ * distinct from the edge stroke beneath it.
986
+ *
987
+ * Existing brand edges render this for you from `data.tokens`
988
+ * (`FlowWeightedEdge`, `FlowSelfLoopEdge`); a custom edge renders it after its
989
+ * `FlowEdgePath` with the same `path` string.
990
+ */
991
+ declare const FlowEdgeTokens: react.ForwardRefExoticComponent<FlowEdgeTokensProps & react.RefAttributes<SVGGElement>>;
992
+
993
+ /**
994
+ * Pure SVG path sampling — the position maths behind `FlowEdgeTokens`.
995
+ *
996
+ * `SVGGeometryElement.getPointAtLength` would do the same job in a browser, but
997
+ * it needs a mounted element (so a layout effect and a second render) and jsdom
998
+ * implements none of it. Parsing the `d` string here keeps a token's position a
999
+ * plain function of `(path, progress)`: identical on the server, in jsdom and in
1000
+ * every browser, and testable without a DOM.
1001
+ *
1002
+ * Supports every path command (`M L H V C S Q T A Z`, absolute and relative) in
1003
+ * the spellings React Flow's path helpers emit (`M0,0 C…`, `M 0,0L …`, `M0 0`).
1004
+ * Curves and arcs are flattened into a polyline fine enough that a token sits on
1005
+ * the drawn stroke; progress is measured along that polyline's arc length, so a
1006
+ * token moves at an even speed regardless of how the curve's control points are
1007
+ * spaced.
1008
+ */
1009
+ interface EdgePathPoint {
1010
+ x: number;
1011
+ y: number;
1012
+ }
1013
+ interface EdgePathSampler {
1014
+ /** Total arc length of the path, in px. */
1015
+ length: number;
1016
+ /** The point at `progress` (0..1) of the path's arc length. Out-of-range or non-finite progress is clamped. */
1017
+ pointAt: (progress: number) => EdgePathPoint;
1018
+ }
1019
+ /**
1020
+ * Flatten a path `d` string into subpath polylines. Each subpath starts at its
1021
+ * `M`. Parsing stops at the first malformed argument; everything before it is kept.
1022
+ */
1023
+ declare function flattenEdgePath(d: string): EdgePathPoint[][];
1024
+ /**
1025
+ * Build a sampler for a path `d` string, or `null` when the string describes no
1026
+ * geometry at all (empty, or not a path). A path that is a single point has
1027
+ * length 0 and samples to that point for every progress.
1028
+ *
1029
+ * Subpaths are walked in order and the jump between them is not counted — a
1030
+ * token never travels through the gap an `M` leaves.
1031
+ */
1032
+ declare function createEdgePathSampler(d: string): EdgePathSampler | null;
1033
+
938
1034
  interface EdgeLabelPillProps extends ComponentPropsWithoutRef<"button"> {
939
1035
  /** Primary label, e.g. a frequency count ("128×"). */
940
1036
  label?: string;
@@ -1006,6 +1102,11 @@ interface FlowWeightedEdgeData extends Record<string, unknown> {
1006
1102
  * own root button from outside this component, without a new semantic prop here.
1007
1103
  */
1008
1104
  labelProps?: Omit<EdgeLabelPillProps, "label" | "secondaryLabel" | "x" | "y" | "selected">;
1105
+ /**
1106
+ * Markers travelling along this edge's computed path (see `FlowEdgeTokens`). The parent
1107
+ * drives each token's `progress`; omitted or empty renders exactly the edge without them.
1108
+ */
1109
+ tokens?: readonly FlowEdgeToken[];
1009
1110
  }
1010
1111
  type BrandFlowWeightedEdge = Edge<FlowWeightedEdgeData, "weighted">;
1011
1112
  /**
@@ -1226,6 +1327,11 @@ interface FlowSelfLoopEdgeData extends Record<string, unknown> {
1226
1327
  * own root button from outside this component, without a new semantic prop here.
1227
1328
  */
1228
1329
  labelProps?: Omit<EdgeLabelPillProps, "label" | "secondaryLabel" | "x" | "y" | "selected">;
1330
+ /**
1331
+ * Markers travelling along the loop's computed arc (see `FlowEdgeTokens`). The parent
1332
+ * drives each token's `progress`; omitted or empty renders exactly the edge without them.
1333
+ */
1334
+ tokens?: readonly FlowEdgeToken[];
1229
1335
  }
1230
1336
  type BrandFlowSelfLoopEdge = Edge<FlowSelfLoopEdgeData, "self-loop">;
1231
1337
  /**
@@ -1349,4 +1455,133 @@ interface SelfLoopHandleAnchor {
1349
1455
  */
1350
1456
  declare function selfLoopHandleArc(anchor: SelfLoopHandleAnchor, loopRadius: number): SelfLoopPath;
1351
1457
 
1352
- export { type BackEdgeAxis, type BackEdgeNodeRect, type BrandFlowButtonEdge, type BrandFlowGroupNode, type BrandFlowNode, type BrandFlowPlaceholderNode, type BrandFlowSelfLoopEdge, type BrandFlowWeightedEdge, CanvasShell, type CanvasShellProps, type ClosestAnchors, type ClosestHandles, DEFAULT_EDGE_WIDTH_RANGE, DEFAULT_LOOP_RADIUS, EdgeLabelPill, type EdgeLabelPillProps, type EdgeParams, type EdgeWeightScaleOptions, FLOW_ALL_SIDE_HANDLES, FLOW_EDGE_FOCUS_CONTOUR_WIDTH, FLOW_EDGE_FOCUS_RING_WIDTH, FLOW_GROUP_NODE_TYPE, FLOW_HANDLE_ANCHOR_CLASS, type FloatingEdgeData, type FloatingNodeGeometry, FlowButtonEdge, type FlowButtonEdgeData, FlowEdge, FlowEdgePath, type FlowEdgePathProps, FlowFloatingEdge, FlowGroupNode, type FlowGroupNodeData, type FlowGroupOperationResult, type FlowGroupProxyEdgeData, type FlowGroupTone, type FlowHandleSide, type FlowLayoutDirection, type FlowLayoutOptions, type FlowLayoutResult, FlowMiniMap, type FlowMiniMapProps, FlowNode, type FlowNodeData, type FlowNodeHandles, FlowPlaceholderNode, type FlowPlaceholderNodeData, FlowSelfLoopEdge, type FlowSelfLoopEdgeData, FlowSmartEdge, FlowWeightedEdge, type FlowWeightedEdgeData, type GroupNodesOptions, type GroupOptions, HANDLE_SIDES, type HandleAnchor, type HelperLineRect, HelperLines, type HelperLinesProps, type HelperLinesResult, InspectorPanel, type InspectorPanelProps, type LayoutAlgorithm, type LayoutOptions, type LayoutSpacing, Legend, type LegendCategoricalProps, type LegendItem, type LegendProps, type LegendScaleProps, type NodeRect, type SelfLoopAnchor, type SelfLoopHandleAnchor, type SelfLoopPath, type UseFlowGroupsResult, type UseFlowLayoutResult, type UseHelperLinesOptions, type UseHelperLinesResult, type WeightedEdgeAriaOptions, type WeightedEdgeLike, ZoomControls, type ZoomControlsProps, backEdgeDetour, buildWeightedEdgeAriaLabel, collapseGroup, computeEdgeWeightScale, expandGroup, getEdgeParams, getHelperLines, groupNodes, handlePoint, isFlowGroupProxyEdge, layoutFlow, layoutGraph, pickClosestAnchors, pickClosestHandles, positionToSide, selfLoopHandleArc, selfLoopPath, sideToPosition, toggleGroupCollapsed, ungroup, useAutoLayout, useFlowGroups, useFlowLayout, useHelperLines, withWeightedEdgeAria };
1458
+ /**
1459
+ * One path through the graph to lay out on a single straight line (RM-067).
1460
+ *
1461
+ * Produced by {@link pinBackbone}, consumed by `layoutFlowElk`'s `backbone` option. Plain
1462
+ * data, so it clones, serializes and memoizes like any other layout input.
1463
+ */
1464
+ interface FlowElkBackbone {
1465
+ /** Node ids on the pinned path, in path order. */
1466
+ nodeIds: string[];
1467
+ /** Ids of the edges joining consecutive pinned nodes, in path order. */
1468
+ edgeIds: string[];
1469
+ }
1470
+ /**
1471
+ * Pin a variant's activity sequence to one straight row (LR/RL) or column (TB/BT) — the
1472
+ * Apromore-style "backbone" layout (RM-067).
1473
+ *
1474
+ * A pre-pass, not a layout: hand the result to `layoutFlowElk` as `backbone` and the rest of
1475
+ * the graph lays out around it. ELK gets the joining edges at the highest straightness
1476
+ * priority, then every layer holding a pinned node is translated as a whole along the
1477
+ * cross axis so the pinned nodes share one line — a whole-layer shift, so no two nodes of
1478
+ * a layer can ever be pushed onto each other.
1479
+ *
1480
+ * `variant` is the sequence of NODE IDS — for a process graph, the most frequent variant's
1481
+ * activities, which are the activity nodes' ids. An id with no node is skipped; a repeated
1482
+ * activity (rework inside the variant) is pinned once, at its first occurrence, because a
1483
+ * node cannot sit on a straight line twice.
1484
+ *
1485
+ * @example
1486
+ * ```ts
1487
+ * const backbone = pinBackbone(nodes, edges, variants[0].activities);
1488
+ * const { nodes: laidOut } = await layoutFlowElk(nodes, edges, { direction: "LR", backbone });
1489
+ * ```
1490
+ */
1491
+ declare function pinBackbone(nodes: readonly Node[], edges: readonly Edge[], variant: readonly string[]): FlowElkBackbone;
1492
+
1493
+ /**
1494
+ * elkjs layout adapter — RM-067.
1495
+ *
1496
+ * dagre has no self-loop layout, no edge routing and weak compound nodes. ELK (Eclipse
1497
+ * Layout Kernel, EPL-2.0) has all three, and it is large — so it is an OPTIONAL peer of this
1498
+ * package, reached ONLY through `import()` inside {@link layoutFlowElk}'s body. A consumer
1499
+ * that never calls it never downloads it, and a consumer that calls it without installing
1500
+ * elkjs gets `layoutFlow`'s dagre answer plus a development-only console warning, never a
1501
+ * crash.
1502
+ *
1503
+ * The default engine runs inline on the calling thread (elkjs's own in-thread worker
1504
+ * stand-in). The package deliberately ships NO worker entry: a `new Worker(new URL(…,
1505
+ * import.meta.url))` pointing at a file the tsup build does not emit breaks some consumer
1506
+ * bundlers at build time. A host that wants the layout off the main thread supplies
1507
+ * `loadEngine` with its own worker, e.g.
1508
+ *
1509
+ * ```ts
1510
+ * loadEngine: async () => {
1511
+ * const { default: ELK } = await import("elkjs/lib/elk-api.js");
1512
+ * return new ELK({ workerUrl: new URL("elkjs/lib/elk-worker.min.js", import.meta.url).href });
1513
+ * }
1514
+ * ```
1515
+ *
1516
+ * No remote origin is involved either way.
1517
+ */
1518
+ /** Options for {@link layoutFlowElk}. */
1519
+ interface FlowLayoutElkOptions {
1520
+ /** Layout direction. @default "TB" */
1521
+ direction?: FlowLayoutDirection;
1522
+ /** How ELK routes edges. @default "splines" */
1523
+ edgeRouting?: "orthogonal" | "splines";
1524
+ /** Route back-edges as ELK feedback edges (around the graph, not through it). @default true */
1525
+ feedbackEdges?: boolean;
1526
+ /** Gap between nodes in the same layer. @default 48 */
1527
+ nodeSpacing?: number;
1528
+ /** Gap between layers. @default 72 */
1529
+ rankSpacing?: number;
1530
+ /**
1531
+ * Compound nodes. Each `id` names a node already in `nodes` (typically a `FlowGroupNode`);
1532
+ * its `children` are laid out inside it and come back with `parentId` set, positioned
1533
+ * relative to the group, and the group comes back sized to fit them.
1534
+ */
1535
+ groups?: {
1536
+ id: string;
1537
+ children: string[];
1538
+ }[];
1539
+ /** A pinned straight path — see `pinBackbone`. */
1540
+ backbone?: FlowElkBackbone;
1541
+ /**
1542
+ * Supply the engine yourself: a host with its own worker URL, or a test. Rejecting (for
1543
+ * example because elkjs is not installed) falls back to dagre exactly like the default
1544
+ * loader does.
1545
+ */
1546
+ loadEngine?: () => Promise<FlowElkEngine>;
1547
+ }
1548
+ /** A graph in ELK's JSON format — the minimal shape this adapter reads and writes. */
1549
+ interface FlowElkGraph {
1550
+ id: string;
1551
+ x?: number;
1552
+ y?: number;
1553
+ width?: number;
1554
+ height?: number;
1555
+ layoutOptions?: Record<string, string>;
1556
+ children?: FlowElkGraph[];
1557
+ edges?: {
1558
+ id: string;
1559
+ sources: string[];
1560
+ targets: string[];
1561
+ layoutOptions?: Record<string, string>;
1562
+ }[];
1563
+ }
1564
+ /** A running ELK engine. `new ELK()` from elkjs satisfies it. */
1565
+ interface FlowElkEngine {
1566
+ layout(graph: FlowElkGraph): Promise<FlowElkGraph>;
1567
+ }
1568
+ /** What {@link layoutFlowElk} answers — `layoutFlow`'s result plus which engine produced it. */
1569
+ interface FlowLayoutElkResult<NodeType extends Node = Node, EdgeType extends Edge = Edge> extends FlowLayoutResult<NodeType, EdgeType> {
1570
+ /** `"elk"`, or `"dagre"` when elkjs could not be loaded or failed and dagre answered. */
1571
+ engine: "elk" | "dagre";
1572
+ }
1573
+ /**
1574
+ * Lay a graph out with ELK's layered algorithm — `layoutFlow`'s async sibling.
1575
+ *
1576
+ * Same result shape as `layoutFlow` (`nodes`, `edges`, `backEdges`, `selfLoops`), so a
1577
+ * caller can swap engines without a different consumption path; `engine` says which one
1578
+ * actually answered. Self-loops are laid out by ELK (it routes them around their node) and
1579
+ * still reported in `selfLoops`; `backEdges` are the edges whose source sits at or after
1580
+ * their target along the layout direction.
1581
+ *
1582
+ * elkjs is imported lazily inside this function. If it is not installed, or ELK throws,
1583
+ * the result is `layoutFlow`'s dagre layout with `engine: "dagre"`.
1584
+ */
1585
+ declare function layoutFlowElk<NodeType extends Node = Node, EdgeType extends Edge = Edge>(nodes: NodeType[], edges: EdgeType[], options?: FlowLayoutElkOptions): Promise<FlowLayoutElkResult<NodeType, EdgeType>>;
1586
+
1587
+ export { type BackEdgeAxis, type BackEdgeNodeRect, type BrandFlowButtonEdge, type BrandFlowGroupNode, type BrandFlowNode, type BrandFlowPlaceholderNode, type BrandFlowSelfLoopEdge, type BrandFlowWeightedEdge, CanvasShell, type CanvasShellProps, type ClosestAnchors, type ClosestHandles, DEFAULT_EDGE_TOKEN_RADIUS, DEFAULT_EDGE_WIDTH_RANGE, DEFAULT_LOOP_RADIUS, EdgeLabelPill, type EdgeLabelPillProps, type EdgeParams, type EdgePathPoint, type EdgePathSampler, type EdgeWeightScaleOptions, FLOW_ALL_SIDE_HANDLES, FLOW_EDGE_FOCUS_CONTOUR_WIDTH, FLOW_EDGE_FOCUS_RING_WIDTH, FLOW_GROUP_NODE_TYPE, FLOW_HANDLE_ANCHOR_CLASS, type FloatingEdgeData, type FloatingNodeGeometry, FlowButtonEdge, type FlowButtonEdgeData, FlowEdge, FlowEdgePath, type FlowEdgePathProps, type FlowEdgeToken, FlowEdgeTokens, type FlowEdgeTokensProps, type FlowElkBackbone, type FlowElkEngine, type FlowElkGraph, FlowFloatingEdge, FlowGroupNode, type FlowGroupNodeData, type FlowGroupOperationResult, type FlowGroupProxyEdgeData, type FlowGroupTone, type FlowHandleSide, type FlowLayoutDirection, type FlowLayoutElkOptions, type FlowLayoutElkResult, type FlowLayoutOptions, type FlowLayoutResult, FlowMiniMap, type FlowMiniMapProps, FlowNode, type FlowNodeData, type FlowNodeHandles, FlowPlaceholderNode, type FlowPlaceholderNodeData, FlowSelfLoopEdge, type FlowSelfLoopEdgeData, FlowSmartEdge, FlowWeightedEdge, type FlowWeightedEdgeData, type GroupNodesOptions, type GroupOptions, HANDLE_SIDES, type HandleAnchor, type HelperLineRect, HelperLines, type HelperLinesProps, type HelperLinesResult, InspectorPanel, type InspectorPanelProps, type LayoutAlgorithm, type LayoutOptions, type LayoutSpacing, Legend, type LegendCategoricalProps, type LegendItem, type LegendProps, type LegendScaleProps, type NodeRect, type SelfLoopAnchor, type SelfLoopHandleAnchor, type SelfLoopPath, type UseFlowGroupsResult, type UseFlowLayoutResult, type UseHelperLinesOptions, type UseHelperLinesResult, type WeightedEdgeAriaOptions, type WeightedEdgeLike, ZoomControls, type ZoomControlsProps, backEdgeDetour, buildWeightedEdgeAriaLabel, collapseGroup, computeEdgeWeightScale, createEdgePathSampler, expandGroup, flattenEdgePath, getEdgeParams, getHelperLines, groupNodes, handlePoint, isFlowGroupProxyEdge, layoutFlow, layoutFlowElk, layoutGraph, pickClosestAnchors, pickClosestHandles, pinBackbone, positionToSide, selfLoopHandleArc, selfLoopPath, sideToPosition, toggleGroupCollapsed, ungroup, useAutoLayout, useFlowGroups, useFlowLayout, useHelperLines, withWeightedEdgeAria };