@elabs-ai/components-flow 4.1.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.
- package/README.md +2 -1
- package/dist/canvas-shell/canvas-shell.js +13 -0
- package/dist/canvas-shell/canvas-shell.js.map +1 -0
- package/dist/canvas-shell/clamped-fit-offset.js +8 -0
- package/dist/canvas-shell/clamped-fit-offset.js.map +1 -0
- package/dist/canvas-shell/index.js +14 -0
- package/dist/canvas-shell/index.js.map +1 -0
- package/dist/canvas-shell/use-measured-nodes.js +8 -0
- package/dist/canvas-shell/use-measured-nodes.js.map +1 -0
- package/dist/chunk-3BTU2VWZ.js +42 -0
- package/dist/chunk-3BTU2VWZ.js.map +1 -0
- package/dist/chunk-3LK6OOXE.js +2 -0
- package/dist/chunk-3LK6OOXE.js.map +1 -0
- package/dist/chunk-3M3FQAD4.js +105 -0
- package/dist/chunk-3M3FQAD4.js.map +1 -0
- package/dist/chunk-3Y5TCGC3.js +2 -0
- package/dist/chunk-3Y5TCGC3.js.map +1 -0
- package/dist/chunk-4VYHZM3S.js +108 -0
- package/dist/chunk-4VYHZM3S.js.map +1 -0
- package/dist/chunk-5TVVM4GR.js +45 -0
- package/dist/chunk-5TVVM4GR.js.map +1 -0
- package/dist/chunk-5XT73MQQ.js +2 -0
- package/dist/chunk-5XT73MQQ.js.map +1 -0
- package/dist/chunk-6LQD5Y5R.js +24 -0
- package/dist/chunk-6LQD5Y5R.js.map +1 -0
- package/dist/chunk-6SR26QY2.js +18 -0
- package/dist/chunk-6SR26QY2.js.map +1 -0
- package/dist/chunk-75JJK6BH.js +157 -0
- package/dist/chunk-75JJK6BH.js.map +1 -0
- package/dist/chunk-A66JBW4X.js +2 -0
- package/dist/chunk-A66JBW4X.js.map +1 -0
- package/dist/chunk-A7AFM3LI.js +72 -0
- package/dist/chunk-A7AFM3LI.js.map +1 -0
- package/dist/chunk-ADHLQF56.js +2 -0
- package/dist/chunk-ADHLQF56.js.map +1 -0
- package/dist/chunk-ATO4LXJF.js +75 -0
- package/dist/chunk-ATO4LXJF.js.map +1 -0
- package/dist/chunk-ATXVXTMZ.js +227 -0
- package/dist/chunk-ATXVXTMZ.js.map +1 -0
- package/dist/chunk-B6IUPZU7.js +2 -0
- package/dist/chunk-B6IUPZU7.js.map +1 -0
- package/dist/chunk-BJ7UMCD3.js +53 -0
- package/dist/chunk-BJ7UMCD3.js.map +1 -0
- package/dist/chunk-BWGYV4JZ.js +2 -0
- package/dist/chunk-BWGYV4JZ.js.map +1 -0
- package/dist/chunk-CWNO63LQ.js +109 -0
- package/dist/chunk-CWNO63LQ.js.map +1 -0
- package/dist/chunk-DHPUXKCZ.js +76 -0
- package/dist/chunk-DHPUXKCZ.js.map +1 -0
- package/dist/chunk-DNX7G3KA.js +185 -0
- package/dist/chunk-DNX7G3KA.js.map +1 -0
- package/dist/chunk-DNZRAJAQ.js +41 -0
- package/dist/chunk-DNZRAJAQ.js.map +1 -0
- package/dist/chunk-ELCLRVD4.js +2 -0
- package/dist/chunk-ELCLRVD4.js.map +1 -0
- package/dist/chunk-ELOADZSX.js +2 -0
- package/dist/chunk-ELOADZSX.js.map +1 -0
- package/dist/chunk-EUNV2MR5.js +21 -0
- package/dist/chunk-EUNV2MR5.js.map +1 -0
- package/dist/chunk-FAFQ5KLB.js +43 -0
- package/dist/chunk-FAFQ5KLB.js.map +1 -0
- package/dist/chunk-FIRO6Y3R.js +128 -0
- package/dist/chunk-FIRO6Y3R.js.map +1 -0
- package/dist/chunk-GE73WQUK.js +2 -0
- package/dist/chunk-GE73WQUK.js.map +1 -0
- package/dist/chunk-GIARAOU6.js +39 -0
- package/dist/chunk-GIARAOU6.js.map +1 -0
- package/dist/chunk-HTLTCCFA.js +73 -0
- package/dist/chunk-HTLTCCFA.js.map +1 -0
- package/dist/chunk-I53W3CFN.js +56 -0
- package/dist/chunk-I53W3CFN.js.map +1 -0
- package/dist/chunk-IJVFPUXO.js +2 -0
- package/dist/chunk-IJVFPUXO.js.map +1 -0
- package/dist/chunk-JUPMOISE.js +51 -0
- package/dist/chunk-JUPMOISE.js.map +1 -0
- package/dist/chunk-K5RPSVO6.js +167 -0
- package/dist/chunk-K5RPSVO6.js.map +1 -0
- package/dist/chunk-K6U27YJ6.js +78 -0
- package/dist/chunk-K6U27YJ6.js.map +1 -0
- package/dist/chunk-KDVMGMAK.js +2 -0
- package/dist/chunk-KDVMGMAK.js.map +1 -0
- package/dist/chunk-LQOZCOK3.js +74 -0
- package/dist/chunk-LQOZCOK3.js.map +1 -0
- package/dist/chunk-NAQWNX2A.js +102 -0
- package/dist/chunk-NAQWNX2A.js.map +1 -0
- package/dist/chunk-NVJVWGUS.js +152 -0
- package/dist/chunk-NVJVWGUS.js.map +1 -0
- package/dist/chunk-O2F3R3PV.js +2 -0
- package/dist/chunk-O2F3R3PV.js.map +1 -0
- package/dist/chunk-OMFQHMA6.js +2 -0
- package/dist/chunk-OMFQHMA6.js.map +1 -0
- package/dist/chunk-PE6JXVOX.js +2 -0
- package/dist/chunk-PE6JXVOX.js.map +1 -0
- package/dist/chunk-ROJEIIA4.js +52 -0
- package/dist/chunk-ROJEIIA4.js.map +1 -0
- package/dist/chunk-ROYAQKJA.js +9 -0
- package/dist/chunk-ROYAQKJA.js.map +1 -0
- package/dist/chunk-SHCZK4DO.js +45 -0
- package/dist/chunk-SHCZK4DO.js.map +1 -0
- package/dist/chunk-SXXJV6YJ.js +79 -0
- package/dist/chunk-SXXJV6YJ.js.map +1 -0
- package/dist/chunk-T7S7NJFD.js +287 -0
- package/dist/chunk-T7S7NJFD.js.map +1 -0
- package/dist/chunk-TEZ3OXAY.js +63 -0
- package/dist/chunk-TEZ3OXAY.js.map +1 -0
- package/dist/chunk-TGWPM2CG.js +199 -0
- package/dist/chunk-TGWPM2CG.js.map +1 -0
- package/dist/chunk-TSB6RE7L.js +2 -0
- package/dist/chunk-TSB6RE7L.js.map +1 -0
- package/dist/chunk-UPV2MT4O.js +2 -0
- package/dist/chunk-UPV2MT4O.js.map +1 -0
- package/dist/chunk-UZJZY4A5.js +2 -0
- package/dist/chunk-UZJZY4A5.js.map +1 -0
- package/dist/chunk-W3TQMUGX.js +2 -0
- package/dist/chunk-W3TQMUGX.js.map +1 -0
- package/dist/chunk-WN46RIOC.js +29 -0
- package/dist/chunk-WN46RIOC.js.map +1 -0
- package/dist/chunk-XZFE2YYH.js +70 -0
- package/dist/chunk-XZFE2YYH.js.map +1 -0
- package/dist/chunk-YG3KXTZW.js +2 -0
- package/dist/chunk-YG3KXTZW.js.map +1 -0
- package/dist/chunk-ZATVF42E.js +65 -0
- package/dist/chunk-ZATVF42E.js.map +1 -0
- package/dist/chunk-ZXZTLQIX.js +19 -0
- package/dist/chunk-ZXZTLQIX.js.map +1 -0
- package/dist/flow-button-edge/flow-button-edge.js +10 -0
- package/dist/flow-button-edge/flow-button-edge.js.map +1 -0
- package/dist/flow-button-edge/index.js +11 -0
- package/dist/flow-button-edge/index.js.map +1 -0
- package/dist/flow-edge/flow-edge.js +10 -0
- package/dist/flow-edge/flow-edge.js.map +1 -0
- package/dist/flow-edge/index.js +11 -0
- package/dist/flow-edge/index.js.map +1 -0
- package/dist/flow-edge-path/flow-edge-path.js +12 -0
- package/dist/flow-edge-path/flow-edge-path.js.map +1 -0
- package/dist/flow-edge-path/index.js +13 -0
- package/dist/flow-edge-path/index.js.map +1 -0
- package/dist/flow-edge-tokens/edge-path-sampler.js +10 -0
- package/dist/flow-edge-tokens/edge-path-sampler.js.map +1 -0
- package/dist/flow-edge-tokens/flow-edge-tokens.js +12 -0
- package/dist/flow-edge-tokens/flow-edge-tokens.js.map +1 -0
- package/dist/flow-edge-tokens/index.js +17 -0
- package/dist/flow-edge-tokens/index.js.map +1 -0
- package/dist/flow-floating-edge/floating-edge-geometry.js +8 -0
- package/dist/flow-floating-edge/floating-edge-geometry.js.map +1 -0
- package/dist/flow-floating-edge/flow-floating-edge.js +11 -0
- package/dist/flow-floating-edge/flow-floating-edge.js.map +1 -0
- package/dist/flow-floating-edge/index.js +15 -0
- package/dist/flow-floating-edge/index.js.map +1 -0
- package/dist/flow-group-node/flow-group-node.js +12 -0
- package/dist/flow-group-node/flow-group-node.js.map +1 -0
- package/dist/flow-group-node/index.js +13 -0
- package/dist/flow-group-node/index.js.map +1 -0
- package/dist/flow-handle/flow-handle-anchor.js +8 -0
- package/dist/flow-handle/flow-handle-anchor.js.map +1 -0
- package/dist/flow-handle/index.js +9 -0
- package/dist/flow-handle/index.js.map +1 -0
- package/dist/flow-layout/backbone.js +8 -0
- package/dist/flow-layout/backbone.js.map +1 -0
- package/dist/flow-layout/flow-layout.js +10 -0
- package/dist/flow-layout/flow-layout.js.map +1 -0
- package/dist/flow-layout/index.js +21 -0
- package/dist/flow-layout/index.js.map +1 -0
- package/dist/flow-layout/layout-flow-elk.js +9 -0
- package/dist/flow-layout/layout-flow-elk.js.map +1 -0
- package/dist/flow-layout/layout-graph.js +9 -0
- package/dist/flow-layout/layout-graph.js.map +1 -0
- package/dist/flow-layout/use-auto-layout.js +10 -0
- package/dist/flow-layout/use-auto-layout.js.map +1 -0
- package/dist/flow-layout/use-flow-layout.js +9 -0
- package/dist/flow-layout/use-flow-layout.js.map +1 -0
- package/dist/flow-mini-map/flow-mini-map.js +8 -0
- package/dist/flow-mini-map/flow-mini-map.js.map +1 -0
- package/dist/flow-mini-map/index.js +9 -0
- package/dist/flow-mini-map/index.js.map +1 -0
- package/dist/flow-node/flow-node.js +11 -0
- package/dist/flow-node/flow-node.js.map +1 -0
- package/dist/flow-node/index.js +12 -0
- package/dist/flow-node/index.js.map +1 -0
- package/dist/flow-placeholder-node/flow-placeholder-node.js +9 -0
- package/dist/flow-placeholder-node/flow-placeholder-node.js.map +1 -0
- package/dist/flow-placeholder-node/index.js +10 -0
- package/dist/flow-placeholder-node/index.js.map +1 -0
- package/dist/flow-self-loop-edge/flow-self-loop-edge.js +20 -0
- package/dist/flow-self-loop-edge/flow-self-loop-edge.js.map +1 -0
- package/dist/flow-self-loop-edge/index.js +28 -0
- package/dist/flow-self-loop-edge/index.js.map +1 -0
- package/dist/flow-self-loop-edge/self-loop-geometry.js +12 -0
- package/dist/flow-self-loop-edge/self-loop-geometry.js.map +1 -0
- package/dist/flow-smart-edge/flow-smart-edge.js +11 -0
- package/dist/flow-smart-edge/flow-smart-edge.js.map +1 -0
- package/dist/flow-smart-edge/index.js +25 -0
- package/dist/flow-smart-edge/index.js.map +1 -0
- package/dist/flow-smart-edge/smart-edge-geometry.js +18 -0
- package/dist/flow-smart-edge/smart-edge-geometry.js.map +1 -0
- package/dist/flow-weighted-edge/back-edge-geometry.js +8 -0
- package/dist/flow-weighted-edge/back-edge-geometry.js.map +1 -0
- package/dist/flow-weighted-edge/edge-aria.js +10 -0
- package/dist/flow-weighted-edge/edge-aria.js.map +1 -0
- package/dist/flow-weighted-edge/edge-label-pill.js +8 -0
- package/dist/flow-weighted-edge/edge-label-pill.js.map +1 -0
- package/dist/flow-weighted-edge/flow-weighted-edge.js +16 -0
- package/dist/flow-weighted-edge/flow-weighted-edge.js.map +1 -0
- package/dist/flow-weighted-edge/index.js +34 -0
- package/dist/flow-weighted-edge/index.js.map +1 -0
- package/dist/flow-weighted-edge/weight-scale.js +10 -0
- package/dist/flow-weighted-edge/weight-scale.js.map +1 -0
- package/dist/helper-lines/get-helper-lines.js +8 -0
- package/dist/helper-lines/get-helper-lines.js.map +1 -0
- package/dist/helper-lines/helper-lines.js +9 -0
- package/dist/helper-lines/helper-lines.js.map +1 -0
- package/dist/helper-lines/index.js +17 -0
- package/dist/helper-lines/index.js.map +1 -0
- package/dist/helper-lines/use-helper-lines.js +10 -0
- package/dist/helper-lines/use-helper-lines.js.map +1 -0
- package/dist/index.d.ts +241 -2
- package/dist/index.js +167 -2306
- package/dist/index.js.map +1 -1
- package/dist/inspector-panel/index.js +9 -0
- package/dist/inspector-panel/index.js.map +1 -0
- package/dist/inspector-panel/inspector-panel.js +8 -0
- package/dist/inspector-panel/inspector-panel.js.map +1 -0
- package/dist/legend/index.js +10 -0
- package/dist/legend/index.js.map +1 -0
- package/dist/legend/legend.js +9 -0
- package/dist/legend/legend.js.map +1 -0
- package/dist/use-flow-groups/group-operations.js +20 -0
- package/dist/use-flow-groups/group-operations.js.map +1 -0
- package/dist/use-flow-groups/index.js +25 -0
- package/dist/use-flow-groups/index.js.map +1 -0
- package/dist/use-flow-groups/use-flow-groups.js +9 -0
- package/dist/use-flow-groups/use-flow-groups.js.map +1 -0
- package/dist/zoom-controls/index.js +9 -0
- package/dist/zoom-controls/index.js.map +1 -0
- package/dist/zoom-controls/zoom-controls.js +8 -0
- package/dist/zoom-controls/zoom-controls.js.map +1 -0
- package/package.json +14 -7
- package/src/__contract__/inspector-panel.contract.test.tsx +49 -0
- package/src/__contract__/legend.contract.test.tsx +49 -0
- package/src/canvas-shell/canvas-shell.stories.tsx +1 -0
- package/src/canvas-shell/canvas-shell.tsx +51 -4
- package/src/canvas-shell/clamped-fit-offset.test.ts +25 -0
- package/src/canvas-shell/clamped-fit-offset.ts +30 -0
- package/src/custom-nodes/custom-nodes.stories.tsx +718 -0
- package/src/flow-edge-tokens/edge-path-sampler.test.ts +108 -0
- package/src/flow-edge-tokens/edge-path-sampler.ts +362 -0
- package/src/flow-edge-tokens/flow-edge-tokens.stories.tsx +312 -0
- package/src/flow-edge-tokens/flow-edge-tokens.test.tsx +115 -0
- package/src/flow-edge-tokens/flow-edge-tokens.tsx +94 -0
- package/src/flow-edge-tokens/index.ts +12 -0
- package/src/flow-layout/backbone.test.ts +88 -0
- package/src/flow-layout/backbone.ts +58 -0
- package/src/flow-layout/layout-flow-elk.stories.tsx +154 -0
- package/src/flow-layout/layout-flow-elk.test.ts +152 -0
- package/src/flow-layout/layout-flow-elk.ts +399 -0
- package/src/flow-mini-map/flow-mini-map.stories.tsx +20 -0
- package/src/flow-node/flow-node.stories.tsx +40 -1
- package/src/flow-self-loop-edge/flow-self-loop-edge.test.tsx +38 -0
- package/src/flow-self-loop-edge/flow-self-loop-edge.tsx +7 -0
- package/src/flow-weighted-edge/edge-label-pill.test.tsx +20 -0
- package/src/flow-weighted-edge/flow-weighted-edge.stories.tsx +1 -0
- package/src/flow-weighted-edge/flow-weighted-edge.test.tsx +40 -0
- package/src/flow-weighted-edge/flow-weighted-edge.tsx +7 -0
- package/src/index.ts +13 -0
- package/src/inspector-panel/inspector-panel.tsx +9 -6
- package/src/legend/legend.test.tsx +11 -0
- package/src/legend/legend.tsx +15 -7
- 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 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -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 @@
|
|
|
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;
|
|
@@ -762,7 +771,11 @@ interface LegendScaleProps {
|
|
|
762
771
|
kind: "width" | "color";
|
|
763
772
|
/** `[min, max]` of the underlying value the ramp represents. */
|
|
764
773
|
domain: [number, number];
|
|
765
|
-
/**
|
|
774
|
+
/**
|
|
775
|
+
* Formats a domain value for display at a tick.
|
|
776
|
+
* @default the active `LocaleProvider` locale's `formatNumber` (host locale
|
|
777
|
+
* when no provider is mounted) — never a hardcoded `toLocaleString()`.
|
|
778
|
+
*/
|
|
766
779
|
format?: (value: number) => string;
|
|
767
780
|
/**
|
|
768
781
|
* Sample count for `kind: "width"`: `"minmax"` draws a min/max pair of
|
|
@@ -931,6 +944,93 @@ interface UseFlowGroupsResult {
|
|
|
931
944
|
*/
|
|
932
945
|
declare function useFlowGroups<NodeType extends Node = Node, EdgeType extends Edge = Edge>(): UseFlowGroupsResult;
|
|
933
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
|
+
|
|
934
1034
|
interface EdgeLabelPillProps extends ComponentPropsWithoutRef<"button"> {
|
|
935
1035
|
/** Primary label, e.g. a frequency count ("128×"). */
|
|
936
1036
|
label?: string;
|
|
@@ -1002,6 +1102,11 @@ interface FlowWeightedEdgeData extends Record<string, unknown> {
|
|
|
1002
1102
|
* own root button from outside this component, without a new semantic prop here.
|
|
1003
1103
|
*/
|
|
1004
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[];
|
|
1005
1110
|
}
|
|
1006
1111
|
type BrandFlowWeightedEdge = Edge<FlowWeightedEdgeData, "weighted">;
|
|
1007
1112
|
/**
|
|
@@ -1222,6 +1327,11 @@ interface FlowSelfLoopEdgeData extends Record<string, unknown> {
|
|
|
1222
1327
|
* own root button from outside this component, without a new semantic prop here.
|
|
1223
1328
|
*/
|
|
1224
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[];
|
|
1225
1335
|
}
|
|
1226
1336
|
type BrandFlowSelfLoopEdge = Edge<FlowSelfLoopEdgeData, "self-loop">;
|
|
1227
1337
|
/**
|
|
@@ -1345,4 +1455,133 @@ interface SelfLoopHandleAnchor {
|
|
|
1345
1455
|
*/
|
|
1346
1456
|
declare function selfLoopHandleArc(anchor: SelfLoopHandleAnchor, loopRadius: number): SelfLoopPath;
|
|
1347
1457
|
|
|
1348
|
-
|
|
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 };
|