@multiplatform.one/node-graph 8.2.2 → 8.4.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 (159) hide show
  1. package/dist/cjs/NodeGraph.native.js.map +1 -1
  2. package/dist/cjs/bench/frameSampler.native.js.map +1 -1
  3. package/dist/cjs/bench/generateGraph.native.js.map +1 -1
  4. package/dist/cjs/diagnostics/GraphDiagnostics.native.js.map +1 -1
  5. package/dist/cjs/diagnostics/LiveGraphDiagnostics.native.js.map +1 -1
  6. package/dist/cjs/diagnostics/fromWire.native.js.map +1 -1
  7. package/dist/cjs/diagnostics/lastError.native.js.map +1 -1
  8. package/dist/cjs/diagnostics/types.native.js.map +1 -1
  9. package/dist/cjs/diagnostics/useGraphDiagnostics.native.js.map +1 -1
  10. package/dist/cjs/dom/GraphDomLayout.native.js.map +1 -1
  11. package/dist/cjs/dom/boot.native.js.map +1 -1
  12. package/dist/cjs/dom/wire.native.js.map +1 -1
  13. package/dist/cjs/edges/GraphEdge.cjs +21 -50
  14. package/dist/cjs/edges/GraphEdge.native.js +23 -50
  15. package/dist/cjs/edges/GraphEdge.native.js.map +1 -1
  16. package/dist/cjs/edges/edgeKinds.native.js.map +1 -1
  17. package/dist/cjs/edges/edgePath.cjs +94 -0
  18. package/dist/cjs/edges/edgePath.native.js +98 -0
  19. package/dist/cjs/edges/edgePath.native.js.map +1 -0
  20. package/dist/cjs/edges/edgeRoute.cjs +886 -0
  21. package/dist/cjs/edges/edgeRoute.native.js +1399 -0
  22. package/dist/cjs/edges/edgeRoute.native.js.map +1 -0
  23. package/dist/cjs/edges/edgeStyle.native.js.map +1 -1
  24. package/dist/cjs/edges/useEdgeObstacles.cjs +78 -0
  25. package/dist/cjs/edges/useEdgeObstacles.native.js +110 -0
  26. package/dist/cjs/edges/useEdgeObstacles.native.js.map +1 -0
  27. package/dist/cjs/index.native.js.map +1 -1
  28. package/dist/cjs/interaction/lassoIntercept.native.js.map +1 -1
  29. package/dist/cjs/interaction/legalTargets.native.js.map +1 -1
  30. package/dist/cjs/interaction/snapAlignment.native.js.map +1 -1
  31. package/dist/cjs/interaction/snapChanges.native.js.map +1 -1
  32. package/dist/cjs/interaction/spatialHash.native.js.map +1 -1
  33. package/dist/cjs/interaction/useLassoSelect.native.js.map +1 -1
  34. package/dist/cjs/knobs/KnobEnvelopeProvider.native.js.map +1 -1
  35. package/dist/cjs/knobs/envelope.native.js.map +1 -1
  36. package/dist/cjs/knobs/graphKnobs.native.js.map +1 -1
  37. package/dist/cjs/knobs/useKnobEnvelope.native.js.map +1 -1
  38. package/dist/cjs/layout/dagre.native.js.map +1 -1
  39. package/dist/cjs/layout/layout.native.js.map +1 -1
  40. package/dist/cjs/layout/runner.native.js.map +1 -1
  41. package/dist/cjs/layout/structuredCloneShim.native.js.map +1 -1
  42. package/dist/cjs/layout/types.native.js.map +1 -1
  43. package/dist/cjs/layout/worker.entry.native.js.map +1 -1
  44. package/dist/cjs/layout/worker.generated.native.js.map +1 -1
  45. package/dist/cjs/model/commands.native.js.map +1 -1
  46. package/dist/cjs/model/connect.native.js.map +1 -1
  47. package/dist/cjs/model/document.native.js.map +1 -1
  48. package/dist/cjs/model/history.native.js.map +1 -1
  49. package/dist/cjs/model/index.native.js.map +1 -1
  50. package/dist/cjs/model/schema.native.js.map +1 -1
  51. package/dist/cjs/model/select.native.js.map +1 -1
  52. package/dist/cjs/model/serialize.native.js.map +1 -1
  53. package/dist/cjs/native/DomOnlyStory.native.js.map +1 -1
  54. package/dist/cjs/native/GraphToolbar.native.js.map +1 -1
  55. package/dist/cjs/native/domEntryRegistry.native.js.map +1 -1
  56. package/dist/cjs/native/graphChildren.native.js.map +1 -1
  57. package/dist/cjs/nodes/GraphNode.native.js.map +1 -1
  58. package/dist/cjs/nodes/GraphPort.native.js.map +1 -1
  59. package/dist/cjs/nodes/handleGeometry.native.js.map +1 -1
  60. package/dist/cjs/nodes/lod.native.js.map +1 -1
  61. package/dist/cjs/nodes/nodeMeasure.native.js.map +1 -1
  62. package/dist/cjs/nodes/overviewNode.native.js.map +1 -1
  63. package/dist/cjs/react-flow/ConnectionPuck.native.js.map +1 -1
  64. package/dist/cjs/react-flow/GraphActions.native.js.map +1 -1
  65. package/dist/cjs/react-flow/GraphCommandBridge.native.js.map +1 -1
  66. package/dist/cjs/react-flow/GraphNodeHost.native.js.map +1 -1
  67. package/dist/cjs/react-flow/GraphPaintProbe.native.js.map +1 -1
  68. package/dist/cjs/react-flow/GraphZoomVar.native.js.map +1 -1
  69. package/dist/cjs/react-flow/LassoOverlay.native.js.map +1 -1
  70. package/dist/cjs/react-flow/NodeGraphWeb.native.js.map +1 -1
  71. package/dist/cjs/react-flow/SnapGuides.native.js.map +1 -1
  72. package/dist/cjs/react-flow/demoControlBody.native.js.map +1 -1
  73. package/dist/cjs/react-flow/demoNodeBody.native.js.map +1 -1
  74. package/dist/cjs/react-flow/fixtures.native.js.map +1 -1
  75. package/dist/cjs/react-flow/flowAdapter.native.js.map +1 -1
  76. package/dist/cjs/react-flow/graphHandle.native.js.map +1 -1
  77. package/dist/cjs/react-flow/nodeCensus.native.js.map +1 -1
  78. package/dist/cjs/react-flow/useGraphController.native.js.map +1 -1
  79. package/dist/cjs/react-flow/xy.cjs +4 -3
  80. package/dist/cjs/react-flow/xy.native.js +4 -3
  81. package/dist/cjs/react-flow/xy.native.js.map +1 -1
  82. package/dist/cjs/react-flow/xyPaths.cjs +31 -0
  83. package/dist/cjs/react-flow/xyPaths.native.js +34 -0
  84. package/dist/cjs/react-flow/xyPaths.native.js.map +1 -0
  85. package/dist/cjs/theme/GraphFaces.native.js.map +1 -1
  86. package/dist/cjs/theme/GraphVarsStyle.native.js.map +1 -1
  87. package/dist/cjs/theme/faces.generated.native.js.map +1 -1
  88. package/dist/cjs/theme/faces.native.js.map +1 -1
  89. package/dist/cjs/theme/graphVars.native.js.map +1 -1
  90. package/dist/esm/edges/GraphEdge.mjs +23 -52
  91. package/dist/esm/edges/GraphEdge.mjs.map +1 -1
  92. package/dist/esm/edges/GraphEdge.native.js +25 -52
  93. package/dist/esm/edges/GraphEdge.native.js.map +1 -1
  94. package/dist/esm/edges/edgePath.mjs +68 -0
  95. package/dist/esm/edges/edgePath.mjs.map +1 -0
  96. package/dist/esm/edges/edgePath.native.js +69 -0
  97. package/dist/esm/edges/edgePath.native.js.map +1 -0
  98. package/dist/esm/edges/edgeRoute.mjs +857 -0
  99. package/dist/esm/edges/edgeRoute.mjs.map +1 -0
  100. package/dist/esm/edges/edgeRoute.native.js +1367 -0
  101. package/dist/esm/edges/edgeRoute.native.js.map +1 -0
  102. package/dist/esm/edges/useEdgeObstacles.mjs +52 -0
  103. package/dist/esm/edges/useEdgeObstacles.mjs.map +1 -0
  104. package/dist/esm/edges/useEdgeObstacles.native.js +81 -0
  105. package/dist/esm/edges/useEdgeObstacles.native.js.map +1 -0
  106. package/dist/esm/react-flow/xy.mjs +2 -1
  107. package/dist/esm/react-flow/xy.mjs.map +1 -1
  108. package/dist/esm/react-flow/xy.native.js +2 -1
  109. package/dist/esm/react-flow/xy.native.js.map +1 -1
  110. package/dist/esm/react-flow/xyPaths.mjs +3 -0
  111. package/dist/esm/react-flow/xyPaths.mjs.map +1 -0
  112. package/dist/esm/react-flow/xyPaths.native.js +3 -0
  113. package/dist/esm/react-flow/xyPaths.native.js.map +1 -0
  114. package/dist/jsx/edges/GraphEdge.mjs +23 -52
  115. package/dist/jsx/edges/GraphEdge.mjs.map +1 -1
  116. package/dist/jsx/edges/GraphEdge.native.js +23 -50
  117. package/dist/jsx/edges/GraphEdge.native.js.map +1 -1
  118. package/dist/jsx/edges/edgePath.mjs +68 -0
  119. package/dist/jsx/edges/edgePath.mjs.map +1 -0
  120. package/dist/jsx/edges/edgePath.native.js +98 -0
  121. package/dist/jsx/edges/edgePath.native.js.map +1 -0
  122. package/dist/jsx/edges/edgeRoute.mjs +857 -0
  123. package/dist/jsx/edges/edgeRoute.mjs.map +1 -0
  124. package/dist/jsx/edges/edgeRoute.native.js +1399 -0
  125. package/dist/jsx/edges/edgeRoute.native.js.map +1 -0
  126. package/dist/jsx/edges/useEdgeObstacles.mjs +52 -0
  127. package/dist/jsx/edges/useEdgeObstacles.mjs.map +1 -0
  128. package/dist/jsx/edges/useEdgeObstacles.native.js +110 -0
  129. package/dist/jsx/edges/useEdgeObstacles.native.js.map +1 -0
  130. package/dist/jsx/react-flow/xy.mjs +2 -1
  131. package/dist/jsx/react-flow/xy.mjs.map +1 -1
  132. package/dist/jsx/react-flow/xy.native.js +4 -3
  133. package/dist/jsx/react-flow/xy.native.js.map +1 -1
  134. package/dist/jsx/react-flow/xyPaths.mjs +3 -0
  135. package/dist/jsx/react-flow/xyPaths.mjs.map +1 -0
  136. package/dist/jsx/react-flow/xyPaths.native.js +34 -0
  137. package/dist/jsx/react-flow/xyPaths.native.js.map +1 -0
  138. package/package.json +6 -6
  139. package/src/edges/GraphEdge.tsx +18 -61
  140. package/src/edges/edgePath.ts +84 -0
  141. package/src/edges/edgeRoute.spec.ts +631 -0
  142. package/src/edges/edgeRoute.ts +980 -0
  143. package/src/edges/useEdgeObstacles.ts +71 -0
  144. package/src/react-flow/NodeGraphWeb.stories.tsx +80 -0
  145. package/src/react-flow/xy.ts +1 -3
  146. package/src/react-flow/xyPaths.ts +9 -0
  147. package/src/theme/graphVars.spec.ts +1 -0
  148. package/types/edges/GraphEdge.d.ts +1 -16
  149. package/types/edges/GraphEdge.d.ts.map +1 -1
  150. package/types/edges/edgePath.d.ts +25 -0
  151. package/types/edges/edgePath.d.ts.map +1 -0
  152. package/types/edges/edgeRoute.d.ts +77 -0
  153. package/types/edges/edgeRoute.d.ts.map +1 -0
  154. package/types/edges/useEdgeObstacles.d.ts +45 -0
  155. package/types/edges/useEdgeObstacles.d.ts.map +1 -0
  156. package/types/react-flow/xy.d.ts +2 -1
  157. package/types/react-flow/xy.d.ts.map +1 -1
  158. package/types/react-flow/xyPaths.d.ts +9 -0
  159. package/types/react-flow/xyPaths.d.ts.map +1 -0
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Every measured node box, in flow units, for the edge router (FZ-9208).
3
+ *
4
+ * One list per `nodes` array: React Flow hands a new array on every change,
5
+ * so the WeakMap below builds the boxes once per change and every edge shares
6
+ * them, together with the spatial index `edgeRoute` keys on the same array.
7
+ * A node with no measured size yet is left out; it has no box to avoid.
8
+ * The edge list rides along so edges sharing a gap get their own tracks
9
+ * (FZ-9291); it changes identity on its own, so it keys a second level.
10
+ */
11
+
12
+ import { useStore } from "../react-flow/xy";
13
+ import { edgeClearance } from "./edgeRoute";
14
+ import type { EdgeLink, EdgeObstacle, EdgeObstacles } from "./edgeRoute";
15
+
16
+ interface StoreNode {
17
+ readonly id: string;
18
+ readonly hidden?: boolean;
19
+ readonly measured?: { readonly width?: number; readonly height?: number };
20
+ }
21
+
22
+ interface StoreInternalNode {
23
+ readonly internals: { readonly positionAbsolute: { readonly x: number; readonly y: number } };
24
+ readonly measured?: { readonly width?: number; readonly height?: number };
25
+ }
26
+
27
+ interface StoreEdge {
28
+ readonly source: string;
29
+ readonly target: string;
30
+ readonly hidden?: boolean;
31
+ }
32
+
33
+ interface ObstacleState {
34
+ readonly nodes: readonly StoreNode[];
35
+ readonly edges?: readonly StoreEdge[];
36
+ readonly nodeLookup: ReadonlyMap<string, StoreInternalNode>;
37
+ }
38
+
39
+ const cache = new WeakMap<readonly StoreNode[], WeakMap<readonly StoreEdge[], EdgeObstacles>>();
40
+ const noEdges: readonly StoreEdge[] = [];
41
+
42
+ export function edgeObstaclesFor(state: ObstacleState): EdgeObstacles {
43
+ const edges = state.edges ?? noEdges;
44
+ let byEdges = cache.get(state.nodes);
45
+ if (!byEdges) {
46
+ byEdges = new WeakMap();
47
+ cache.set(state.nodes, byEdges);
48
+ }
49
+ const known = byEdges.get(edges);
50
+ if (known) return known;
51
+ const boxes: EdgeObstacle[] = [];
52
+ for (const node of state.nodes) {
53
+ if (node.hidden) continue;
54
+ const internal = state.nodeLookup.get(node.id);
55
+ const width = internal?.measured?.width ?? node.measured?.width;
56
+ const height = internal?.measured?.height ?? node.measured?.height;
57
+ if (!internal || !width || !height) continue;
58
+ const { x, y } = internal.internals.positionAbsolute;
59
+ boxes.push({ id: node.id, x, y, width, height });
60
+ }
61
+ const links: EdgeLink[] = edges
62
+ .filter((edge) => !edge.hidden)
63
+ .map(({ source, target }) => ({ source, target }));
64
+ const obstacles = { boxes, clearance: edgeClearance, links };
65
+ byEdges.set(edges, obstacles);
66
+ return obstacles;
67
+ }
68
+
69
+ export function useEdgeObstacles(): EdgeObstacles {
70
+ return useStore((state) => edgeObstaclesFor(state as unknown as ObstacleState));
71
+ }
@@ -97,6 +97,86 @@ export const TypedEdges: Story = {
97
97
  ),
98
98
  };
99
99
 
100
+ /**
101
+ * Five sources feeding two sinks across one gap, with the sinks' fans
102
+ * crossing (FZ-9291). Before the router planned tracks, every flow edge took
103
+ * the gap's middle line and the two fans read as one bus.
104
+ */
105
+ function fanInDocument(): Doc {
106
+ const sources = Array.from({ length: 5 }, (_, index) => ({
107
+ id: `s${index}`,
108
+ kind: "source",
109
+ position: { x: 0, y: index * 160 },
110
+ data: { table: `orders_${index}` },
111
+ }));
112
+ const sinks = [
113
+ { id: "a", kind: "sink", position: { x: 360, y: 80 }, data: { target: "warehouse_a" } },
114
+ { id: "b", kind: "sink", position: { x: 360, y: 400 }, data: { target: "warehouse_b" } },
115
+ ];
116
+ const into: readonly [string, string][] = [
117
+ ["s0", "a"],
118
+ ["s1", "a"],
119
+ ["s3", "a"],
120
+ ["s2", "b"],
121
+ ["s4", "b"],
122
+ ];
123
+ return {
124
+ version: 1,
125
+ nodes: [...sources, ...sinks] as Doc["nodes"],
126
+ edges: into.map(
127
+ ([source, target]) =>
128
+ ({
129
+ id: `${source}->${target}`,
130
+ kind: "flow",
131
+ source: { node: source, port: "rows" },
132
+ target: { node: target, port: "in" },
133
+ data: {},
134
+ }) as Doc["edges"][number],
135
+ ),
136
+ };
137
+ }
138
+
139
+ export const FanIn: Story = {
140
+ render: () => (
141
+ <Canvas height={900}>
142
+ <NodeGraph schema={schema} defaultDocument={fanInDocument()}>
143
+ <Background />
144
+ </NodeGraph>
145
+ </Canvas>
146
+ ),
147
+ };
148
+
149
+ /** FanIn plus a third rank, with two edges that skip the sinks' rank and pass it between them. */
150
+ function rankSkipDocument(): Doc {
151
+ const base = fanInDocument();
152
+ const flow = (source: string, port: string, target: string) =>
153
+ ({
154
+ id: `${source}->${target}`,
155
+ kind: "flow",
156
+ source: { node: source, port },
157
+ target: { node: target, port: "in" },
158
+ data: {},
159
+ }) as Doc["edges"][number];
160
+ return {
161
+ version: 1,
162
+ nodes: [
163
+ ...base.nodes,
164
+ { id: "c", kind: "sink", position: { x: 720, y: 240 }, data: { target: "report" } },
165
+ ] as Doc["nodes"],
166
+ edges: [...base.edges, flow("s0", "rows", "c"), flow("s4", "rows", "c")],
167
+ };
168
+ }
169
+
170
+ export const RankSkip: Story = {
171
+ render: () => (
172
+ <Canvas height={900}>
173
+ <NodeGraph schema={schema} defaultDocument={rankSkipDocument()}>
174
+ <Background />
175
+ </NodeGraph>
176
+ </Canvas>
177
+ ),
178
+ };
179
+
100
180
  /**
101
181
  * Two hundred nodes. This is where `onlyRenderVisibleElements` earns its
102
182
  * default: count `.react-flow__node` in the inspector against the 200 in the
@@ -25,6 +25,7 @@
25
25
  */
26
26
 
27
27
  export { getHandlePosition } from "@xyflow/system";
28
+ export { getBezierPath, getSmoothStepPath, getStraightPath } from "./xyPaths";
28
29
  export type { Handle as HandleBounds, InternalNodeBase } from "@xyflow/system";
29
30
 
30
31
  export {
@@ -34,9 +35,6 @@ export {
34
35
  BaseEdge,
35
36
  Controls,
36
37
  EdgeLabelRenderer,
37
- getBezierPath,
38
- getSmoothStepPath,
39
- getStraightPath,
40
38
  Handle,
41
39
  MarkerType,
42
40
  MiniMap,
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The pure half of `xy.ts`: the edge path builders and `Position`, from
3
+ * `@xyflow/system`, which `@xyflow/react` re-exports unchanged. `edges/edgePath.ts`
4
+ * imports them from here so a read-only graph can draw NodeGraph's exact paths
5
+ * on Hermes without evaluating `@xyflow/react` (FZ-8149). `xy.ts` re-exports this
6
+ * file, so it stays the one place a React Flow upgrade is reconciled.
7
+ */
8
+
9
+ export { getBezierPath, getSmoothStepPath, getStraightPath, Position } from "@xyflow/system";
@@ -90,6 +90,7 @@ const fixtureRaw: Record<string, string> = {
90
90
  color: "hsl(0, 0%, 9.0%)",
91
91
  color1: "#ffffff",
92
92
  color4: "hsl(0, 0%, 94.1%)",
93
+ color5: "hsl(0, 0%, 92.0%)",
93
94
  color6: "hsl(0, 0%, 90.0%)",
94
95
  color8: "#cfcfcf",
95
96
  color9: "hsl(0, 0%, 56.1%)",
@@ -12,7 +12,7 @@
12
12
  */
13
13
  import type { Animation, BorderWidth } from "@multiplatform.one/theme";
14
14
  import type { EdgeProps } from "../react-flow/xy";
15
- import type { EdgePathKind } from "./edgeStyle";
15
+ export { buildEdgePath } from "./edgePath";
16
16
  export declare const graphEdgeType = "mpGraphEdge";
17
17
  export interface GraphEdgeData {
18
18
  /** The model's `edge.kind`. */
@@ -21,20 +21,6 @@ export interface GraphEdgeData {
21
21
  readonly appearance?: string;
22
22
  readonly label?: string;
23
23
  }
24
- interface PathGeometry {
25
- readonly sourceX: number;
26
- readonly sourceY: number;
27
- readonly targetX: number;
28
- readonly targetY: number;
29
- readonly sourcePosition: EdgeProps["sourcePosition"];
30
- readonly targetPosition: EdgeProps["targetPosition"];
31
- }
32
- /**
33
- * `step` is `getSmoothStepPath` with a zero corner radius — React Flow has no
34
- * separate step builder, and the design's table names four path SHAPES, not
35
- * four functions.
36
- */
37
- export declare function buildEdgePath(path: EdgePathKind, geometry: PathGeometry): [d: string, labelX: number, labelY: number];
38
24
  /**
39
25
  * The raw knob values an edge paints from.
40
26
  *
@@ -55,5 +41,4 @@ export declare const GraphEdge: import("react").MemoExoticComponent<typeof Graph
55
41
  export declare const graphEdgeTypes: {
56
42
  readonly mpGraphEdge: import("react").MemoExoticComponent<typeof GraphEdgeComponent>;
57
43
  };
58
- export {};
59
44
  //# sourceMappingURL=GraphEdge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GraphEdge.d.ts","sourceRoot":"","sources":["../../src/edges/GraphEdge.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAUvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,KAAK,EAAE,YAAY,EAAa,MAAM,aAAa,CAAC;AAE3D,eAAO,MAAM,aAAa,gBAAgB,CAAC;AAE3C,MAAM,WAAW,aAAa;IAC5B,+BAA+B;IAC/B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,uEAAuE;IACvE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,YAAY;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,cAAc,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;IACrD,QAAQ,CAAC,cAAc,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;CACtD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,YAAY,GACrB,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAgC7C;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,IAAI;IAAE,WAAW,EAAE,WAAW,CAAC;IAAC,SAAS,EAAE,SAAS,CAAA;CAAE,CAIjF;AA0BD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,2CAgElD;AA+BD,eAAO,MAAM,SAAS,gEAA2B,CAAC;AAElD,qDAAqD;AACrD,eAAO,MAAM,cAAc;;CAA0C,CAAC"}
1
+ {"version":3,"file":"GraphEdge.d.ts","sourceRoot":"","sources":["../../src/edges/GraphEdge.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAIvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAMlD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,eAAO,MAAM,aAAa,gBAAgB,CAAC;AAE3C,MAAM,WAAW,aAAa;IAC5B,+BAA+B;IAC/B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,uEAAuE;IACvE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,IAAI;IAAE,WAAW,EAAE,WAAW,CAAC;IAAC,SAAS,EAAE,SAAS,CAAA;CAAE,CAIjF;AA0BD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,2CA0ElD;AA+BD,eAAO,MAAM,SAAS,gEAA2B,CAAC;AAElD,qDAAqD;AACrD,eAAO,MAAM,cAAc;;CAA0C,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The `d` string every graph edge draws, with no React Flow runtime and no
3
+ * store. GraphEdge reads obstacles from the React Flow store and calls this;
4
+ * a read-only layout passes its own node boxes (FZ-8149), so both draw the
5
+ * same path and reroute the same way.
6
+ */
7
+ import type { Position } from "../react-flow/xyPaths";
8
+ import type { EdgeObstacles } from "./edgeRoute";
9
+ import type { EdgePathKind } from "./edgeStyle";
10
+ export interface PathGeometry {
11
+ readonly sourceX: number;
12
+ readonly sourceY: number;
13
+ readonly targetX: number;
14
+ readonly targetY: number;
15
+ readonly sourcePosition: Position;
16
+ readonly targetPosition: Position;
17
+ }
18
+ /**
19
+ * `step` is `getSmoothStepPath` with a zero corner radius — React Flow has no
20
+ * separate step builder, and the design's table names four path SHAPES, not
21
+ * four functions.
22
+ */
23
+ export declare function buildEdgePath(path: EdgePathKind, geometry: PathGeometry, obstacles?: EdgeObstacles): [d: string, labelX: number, labelY: number];
24
+ export declare function buildFlowPath(path: EdgePathKind, geometry: PathGeometry): [d: string, labelX: number, labelY: number];
25
+ //# sourceMappingURL=edgePath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edgePath.d.ts","sourceRoot":"","sources":["../../src/edges/edgePath.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,KAAK,EAAY,aAAa,EAAY,MAAM,aAAa,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC;IAClC,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC;CACnC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,YAAY,EACtB,SAAS,CAAC,EAAE,aAAa,GACxB,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAe7C;AAED,wBAAgB,aAAa,CAC3B,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,YAAY,GACrB,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAgC7C"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Keeps an edge out of every node box (FZ-9208).
3
+ *
4
+ * React Flow's path builders see the two port points and nothing else, so a
5
+ * backward edge (target left of its source) bends out and cuts back across
6
+ * whatever sits between, and a smoothstep's middle run lands on whichever node
7
+ * border happens to sit at the midpoint. Edges paint under nodes, so both read
8
+ * as a line that vanishes into one box and reappears out of another.
9
+ *
10
+ * The router keeps React Flow's own path whenever it stays `clearance` away
11
+ * from every box outside the port stubs, so the common forward edge looks
12
+ * exactly as before. Only a path that intrudes is replaced, by an orthogonal
13
+ * route found with A* over the gaps between the inflated boxes, drawn in the
14
+ * kind's own corner style.
15
+ *
16
+ * Pure: no DOM, no React, no `@xyflow`, so it runs in vitest under Node.
17
+ */
18
+ import type { Rect } from "../model/document";
19
+ import type { EdgePathKind } from "./edgeStyle";
20
+ /**
21
+ * Flow units between an edge and any node box it passes. Main's rows are 24
22
+ * apart, so this leaves an 8-unit channel down the middle of the tightest gap
23
+ * the demo graphs lay out.
24
+ */
25
+ export declare const edgeClearance = 8;
26
+ export interface EdgeObstacle extends Rect {
27
+ readonly id: string;
28
+ }
29
+ /** A graph edge by its two node ids. */
30
+ export interface EdgeLink {
31
+ readonly source: string;
32
+ readonly target: string;
33
+ }
34
+ export interface EdgeObstacles {
35
+ readonly boxes: readonly EdgeObstacle[];
36
+ readonly clearance: number;
37
+ /**
38
+ * Every edge in the graph. With them, edges that cross the same gap between
39
+ * two ranks get tracks of their own instead of all taking the gap's middle
40
+ * (FZ-9291). Without them each edge is routed as if it were alone.
41
+ */
42
+ readonly links?: readonly EdgeLink[];
43
+ }
44
+ export type EdgeSide = "left" | "right" | "top" | "bottom";
45
+ export interface EdgeEnds {
46
+ readonly sourceX: number;
47
+ readonly sourceY: number;
48
+ readonly targetX: number;
49
+ readonly targetY: number;
50
+ readonly sourceSide: EdgeSide;
51
+ readonly targetSide: EdgeSide;
52
+ }
53
+ interface Point {
54
+ readonly x: number;
55
+ readonly y: number;
56
+ }
57
+ /** Points along an absolute M/L/Q/C path, the commands React Flow writes. */
58
+ export declare function samplePath(d: string): Point[];
59
+ /**
60
+ * True when a sample outside either port stub comes within `clearance` of a
61
+ * box. The stub is the stretch from the port to `clearance` past its own frame.
62
+ */
63
+ export declare function pathIntrudes(d: string, ends: EdgeEnds, obstacles: EdgeObstacles): boolean;
64
+ /**
65
+ * A route around the boxes, as `[d, labelX, labelY]`, or `null` when there is
66
+ * none in reach, in which case the caller keeps React Flow's path.
67
+ */
68
+ export declare function routeAroundBoxes(path: EdgePathKind, ends: EdgeEnds, obstacles: EdgeObstacles): [d: string, labelX: number, labelY: number] | null;
69
+ /**
70
+ * A step or smoothstep edge on its own tracks across the gaps it crosses, as
71
+ * `[d, labelX, labelY]`, through a virtual point in each rank it skips.
72
+ * `null` when the edge crosses its gap alone, has no course, or a run would
73
+ * come inside the clearance, in which case the caller routes it as before.
74
+ */
75
+ export declare function routeOnTrack(path: EdgePathKind, ends: EdgeEnds, obstacles: EdgeObstacles): [d: string, labelX: number, labelY: number] | null;
76
+ export {};
77
+ //# sourceMappingURL=edgeRoute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edgeRoute.d.ts","sourceRoot":"","sources":["../../src/edges/edgeRoute.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAG9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD;;;;GAIG;AACH,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B,MAAM,WAAW,YAAa,SAAQ,IAAI;IACxC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED,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AG,IAAI,CAiCpD;AAyTD;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE,QAAQ,EACd,SAAS,EAAE,aAAa,GACvB,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CA8CpD"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Every measured node box, in flow units, for the edge router (FZ-9208).
3
+ *
4
+ * One list per `nodes` array: React Flow hands a new array on every change,
5
+ * so the WeakMap below builds the boxes once per change and every edge shares
6
+ * them, together with the spatial index `edgeRoute` keys on the same array.
7
+ * A node with no measured size yet is left out; it has no box to avoid.
8
+ * The edge list rides along so edges sharing a gap get their own tracks
9
+ * (FZ-9291); it changes identity on its own, so it keys a second level.
10
+ */
11
+ import type { EdgeObstacles } from "./edgeRoute";
12
+ interface StoreNode {
13
+ readonly id: string;
14
+ readonly hidden?: boolean;
15
+ readonly measured?: {
16
+ readonly width?: number;
17
+ readonly height?: number;
18
+ };
19
+ }
20
+ interface StoreInternalNode {
21
+ readonly internals: {
22
+ readonly positionAbsolute: {
23
+ readonly x: number;
24
+ readonly y: number;
25
+ };
26
+ };
27
+ readonly measured?: {
28
+ readonly width?: number;
29
+ readonly height?: number;
30
+ };
31
+ }
32
+ interface StoreEdge {
33
+ readonly source: string;
34
+ readonly target: string;
35
+ readonly hidden?: boolean;
36
+ }
37
+ interface ObstacleState {
38
+ readonly nodes: readonly StoreNode[];
39
+ readonly edges?: readonly StoreEdge[];
40
+ readonly nodeLookup: ReadonlyMap<string, StoreInternalNode>;
41
+ }
42
+ export declare function edgeObstaclesFor(state: ObstacleState): EdgeObstacles;
43
+ export declare function useEdgeObstacles(): EdgeObstacles;
44
+ export {};
45
+ //# sourceMappingURL=useEdgeObstacles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useEdgeObstacles.d.ts","sourceRoot":"","sources":["../../src/edges/useEd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
24
  * fails if the two ever split.
25
25
  */
26
26
  export { getHandlePosition } from "@xyflow/system";
27
+ export { getBezierPath, getSmoothStepPath, getStraightPath } from "./xyPaths";
27
28
  export type { Handle as HandleBounds, InternalNodeBase } from "@xyflow/system";
28
- export { applyEdgeChanges, applyNodeChanges, Background, BaseEdge, Controls, EdgeLabelRenderer, getBezierPath, getSmoothStepPath, getStraightPath, Handle, MarkerType, MiniMap, Position, ReactFlow, ReactFlowProvider, SelectionMode, useEdgesState, useNodesState, useReactFlow, useStore, useStoreApi, useUpdateNodeInternals,
29
+ export { applyEdgeChanges, applyNodeChanges, Background, BaseEdge, Controls, EdgeLabelRenderer, Handle, MarkerType, MiniMap, Position, ReactFlow, ReactFlowProvider, SelectionMode, useEdgesState, useNodesState, useReactFlow, useStore, useStoreApi, useUpdateNodeInternals,
29
30
  /**
30
31
  * The guide layer has to live INSIDE `.react-flow__viewport` so the pan and
31
32
  * zoom transform applies to it for free (design §7.2 S10). This portal is the
@@ -1 +1 @@
1
- {"version":3,"file":"xy.d.ts","sourceRoot":"","sources":["../../src/react-flow/xy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,YAAY,EAAE,MAAM,IAAI,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAE/E,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,MAAM,EACN,UAAU,EACV,OAAO,EACP,QAAQ,EACR,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,sBAAsB;AACtB;;;;;GAKG;AACH,cAAc,GACf,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,SAAS,EACT,UAAU,EACV,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BAAiB,EACjB,QAAQ,EACR,UAAU,GACX,MAAM,eAAe,CAAC;AAEvB;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,YAAY,CAAC;AAEvC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AAEzD;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AAEzD;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,0BAA0B,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The pure half of `xy.ts`: the edge path builders and `Position`, from
3
+ * `@xyflow/system`, which `@xyflow/react` re-exports unchanged. `edges/edgePath.ts`
4
+ * imports them from here so a read-only graph can draw NodeGraph's exact paths
5
+ * on Hermes without evaluating `@xyflow/react` (FZ-8149). `xy.ts` re-exports this
6
+ * file, so it stays the one place a React Flow upgrade is reconciled.
7
+ */
8
+ export { getBezierPath, getSmoothStepPath, getStraightPath, Position } from "@xyflow/system";
9
+ //# sourceMappingURL=xyPaths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xyPaths.d.ts","sourceRoot":"","sources":["../../src/react-flow/xyPaths.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC"}