@statelyai/layout 0.1.3 → 0.3.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/NOTICE.md +43 -0
- package/README.md +153 -6
- package/dist/elkjs/index.cjs +9 -0
- package/dist/elkjs/index.d.cts +155 -0
- package/dist/elkjs/index.d.mts +51 -39
- package/dist/elkjs/index.mjs +3 -1484
- package/dist/elkjs/main.cjs +17 -0
- package/dist/elkjs/main.d.cts +10 -0
- package/dist/elkjs/main.d.mts +11 -0
- package/dist/elkjs/main.mjs +17 -0
- package/dist/elkjs/worker-api.cjs +3 -0
- package/dist/elkjs/worker-api.d.cts +3 -0
- package/dist/elkjs/worker-api.d.mts +3 -0
- package/dist/elkjs/worker-api.mjs +3 -0
- package/dist/elkjs/worker.cjs +86 -0
- package/dist/elkjs/worker.d.cts +17 -0
- package/dist/elkjs/worker.d.mts +17 -0
- package/dist/elkjs/worker.mjs +86 -0
- package/dist/elkjs-DaHMISnQ.mjs +1677 -0
- package/dist/elkjs-dMghiiWW.cjs +1706 -0
- package/dist/index-BEA_pzeT.d.cts +72 -0
- package/dist/{index-8xYkohbz.d.mts → index-D9dhxrRl.d.cts} +111 -5
- package/dist/index-DNTLRsDl.d.mts +72 -0
- package/dist/index-DNixtE3h.d.mts +1318 -0
- package/dist/index.cjs +215 -0
- package/dist/index.d.cts +78 -0
- package/dist/index.d.mts +4 -3
- package/dist/index.mjs +25 -25
- package/dist/layered/index.cjs +38 -0
- package/dist/layered/index.d.cts +3 -0
- package/dist/layered/index.d.mts +3 -2
- package/dist/layered/index.mjs +1 -1
- package/dist/layered-B2buJqMf.cjs +12009 -0
- package/dist/{layered-CoeH9LRO.mjs → layered-DGFTeQSl.mjs} +2323 -149
- package/dist/{spore-BtTSZbb6.mjs → layout-engine-Cs5tatA6.mjs} +159 -5
- package/dist/layout-engine-Dn1PiFwP.cjs +712 -0
- package/dist/public-types-9NCPoqbp.d.mts +109 -0
- package/dist/public-types-BcRZoJE3.d.cts +109 -0
- package/dist/routing/index.cjs +28 -0
- package/dist/routing/index.d.cts +3 -0
- package/dist/routing/index.d.mts +3 -0
- package/dist/routing/index.mjs +3 -0
- package/dist/routing-A2hrK9MP.mjs +2396 -0
- package/dist/routing-ujEP7Qh6.cjs +2606 -0
- package/dist/types-CT2akdK0.d.mts +133 -0
- package/dist/types-uxPlGRof.d.cts +133 -0
- package/dist/worker-client-BNjwT1AJ.mjs +92 -0
- package/dist/worker-client-BwGGRD5y.d.mts +19 -0
- package/dist/worker-client-D4oEvhAl.cjs +98 -0
- package/dist/worker-client-D4zNyPEI.d.cts +19 -0
- package/package.json +45 -10
- package/src/authoring/coordinates.ts +114 -0
- package/src/authoring/partial.ts +584 -0
- package/src/authoring/routing.ts +211 -0
- package/src/box.ts +22 -0
- package/src/constraints.ts +222 -0
- package/src/elkjs/index.ts +104 -39
- package/src/elkjs/main.ts +19 -0
- package/src/elkjs/public-types.ts +125 -0
- package/src/elkjs/routes.ts +147 -0
- package/src/elkjs/worker-api.ts +29 -0
- package/src/elkjs/worker-client.ts +138 -0
- package/src/elkjs/worker.ts +117 -0
- package/src/index.ts +19 -0
- package/src/internal/elkjs-compatibility.ts +17 -0
- package/src/internal/layout-engine.ts +126 -0
- package/src/layered/compound.ts +417 -0
- package/src/layered/index.ts +58 -105
- package/src/layered/types.ts +21 -0
- package/src/layout.ts +35 -28
- package/src/packing.ts +22 -0
- package/src/random.ts +75 -3
- package/src/routing/adapters.ts +111 -0
- package/src/routing/algorithms.ts +676 -0
- package/src/routing/coordination.ts +86 -0
- package/src/routing/engine.ts +473 -0
- package/src/routing/index.ts +68 -0
- package/src/routing/layout-cache.ts +65 -0
- package/src/routing/model.ts +218 -0
- package/src/routing/path.ts +324 -0
- package/src/routing/persistent.ts +117 -0
- package/src/routing/search.ts +276 -0
- package/src/routing/spatial.ts +78 -0
- package/src/routing/types.ts +146 -0
- package/src/types.ts +17 -2
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { a as RouteBounds, c as RoutePath, l as RoutePoint, n as NativeRoutingStrategy, r as Route, s as RoutePatch } from "./types-uxPlGRof.cjs";
|
|
2
|
+
import { GraphPatch, VisualGraph } from "@statelyai/graph";
|
|
3
|
+
|
|
4
|
+
//#region src/routing/engine.d.ts
|
|
5
|
+
declare function applyRoutePatches(routes: ReadonlyMap<string, Route>, patches: readonly RoutePatch[]): ReadonlyMap<string, Route>;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/routing/path.d.ts
|
|
8
|
+
declare function pathFromPoints(points: readonly RoutePoint[]): RoutePath;
|
|
9
|
+
interface FlattenPathOptions {
|
|
10
|
+
readonly tolerance?: number;
|
|
11
|
+
readonly maxSegments?: number;
|
|
12
|
+
}
|
|
13
|
+
/** Adaptive, bounded-error polyline approximation. Throws rather than silently exceeding tolerance. */
|
|
14
|
+
declare function flattenPath(path: RoutePath, options?: FlattenPathOptions): RoutePoint[];
|
|
15
|
+
/** Conservative bounds: control hulls and full ellipse envelopes contain every curve. */
|
|
16
|
+
declare function getPathBounds(path: RoutePath): RouteBounds;
|
|
17
|
+
declare function getPathLength(path: RoutePath, options?: FlattenPathOptions): number;
|
|
18
|
+
declare function getPointAtLength(path: RoutePath, length: number, options?: FlattenPathOptions): RoutePoint;
|
|
19
|
+
declare function getTangentAtLength(path: RoutePath, length: number, options?: FlattenPathOptions): RoutePoint;
|
|
20
|
+
/** Round line-to-line corners only; existing curves and path endpoints are retained. */
|
|
21
|
+
declare function roundCorners(path: RoutePath, options: {
|
|
22
|
+
readonly radius: number;
|
|
23
|
+
}): RoutePath;
|
|
24
|
+
declare function toSvgPath(path: RoutePath, options?: {
|
|
25
|
+
readonly radius?: number;
|
|
26
|
+
readonly precision?: number;
|
|
27
|
+
}): string;
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/routing/adapters.d.ts
|
|
30
|
+
/** ELK/native spline output: start, then repeating control1/control2/end triples. */
|
|
31
|
+
declare function pathFromSplinePoints(points: readonly RoutePoint[]): RoutePath;
|
|
32
|
+
/** Normalize routes from any native layout algorithm, without running layout again. */
|
|
33
|
+
declare function getLayoutRoutes(graph: VisualGraph): ReadonlyMap<string, Route>;
|
|
34
|
+
/** One polyline per section preserves label gaps and branching for simple renderers. */
|
|
35
|
+
declare function routeToPolylines(route: Route, options?: {
|
|
36
|
+
readonly tolerance?: number;
|
|
37
|
+
}): readonly (readonly RoutePoint[])[];
|
|
38
|
+
/** Compatibility for single-section native consumers. Refuses to erase gaps or topology. */
|
|
39
|
+
declare function routeToGraphPatch(route: Route, options?: {
|
|
40
|
+
readonly tolerance?: number;
|
|
41
|
+
readonly offset?: RoutePoint;
|
|
42
|
+
}): GraphPatch;
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/routing/index.d.ts
|
|
45
|
+
declare const straightRouting: NativeRoutingStrategy;
|
|
46
|
+
declare const bezierRouting: NativeRoutingStrategy;
|
|
47
|
+
declare const orthogonalRouting: NativeRoutingStrategy;
|
|
48
|
+
declare const polylineRouting: NativeRoutingStrategy;
|
|
49
|
+
declare const octilinearRouting: NativeRoutingStrategy;
|
|
50
|
+
declare const curvedRouting: NativeRoutingStrategy;
|
|
51
|
+
declare const organicRouting: NativeRoutingStrategy;
|
|
52
|
+
declare const parallelRouting: NativeRoutingStrategy;
|
|
53
|
+
declare const selfLoopRouting: NativeRoutingStrategy;
|
|
54
|
+
declare const fanRouting: NativeRoutingStrategy;
|
|
55
|
+
declare const busRouting: NativeRoutingStrategy;
|
|
56
|
+
declare const bundleRouting: NativeRoutingStrategy;
|
|
57
|
+
declare const routingStrategies: Readonly<{
|
|
58
|
+
straight: NativeRoutingStrategy;
|
|
59
|
+
bezier: NativeRoutingStrategy;
|
|
60
|
+
orthogonal: NativeRoutingStrategy;
|
|
61
|
+
polyline: NativeRoutingStrategy;
|
|
62
|
+
octilinear: NativeRoutingStrategy;
|
|
63
|
+
curved: NativeRoutingStrategy;
|
|
64
|
+
organic: NativeRoutingStrategy;
|
|
65
|
+
parallel: NativeRoutingStrategy;
|
|
66
|
+
"self-loop": NativeRoutingStrategy;
|
|
67
|
+
fan: NativeRoutingStrategy;
|
|
68
|
+
bus: NativeRoutingStrategy;
|
|
69
|
+
bundle: NativeRoutingStrategy;
|
|
70
|
+
}>;
|
|
71
|
+
//#endregion
|
|
72
|
+
export { getTangentAtLength as C, applyRoutePatches as D, toSvgPath as E, getPointAtLength as S, roundCorners as T, routeToPolylines as _, fanRouting as a, getPathBounds as b, orthogonalRouting as c, routingStrategies as d, selfLoopRouting as f, routeToGraphPatch as g, pathFromSplinePoints as h, curvedRouting as i, parallelRouting as l, getLayoutRoutes as m, bundleRouting as n, octilinearRouting as o, straightRouting as p, busRouting as r, organicRouting as s, bezierRouting as t, polylineRouting as u, FlattenPathOptions as v, pathFromPoints as w, getPathLength as x, flattenPath as y };
|
|
@@ -1,6 +1,67 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as Route } from "./types-uxPlGRof.cjs";
|
|
2
2
|
import { EntityRect, Graph, GraphEdge, GraphNode, GraphPatch, GraphPort, Point, VisualGraph } from "@statelyai/graph";
|
|
3
|
+
import { LayoutConstraints } from "@statelyai/graph/layout";
|
|
3
4
|
|
|
5
|
+
//#region src/constraints.d.ts
|
|
6
|
+
type GeometryReference = {
|
|
7
|
+
nodeId: string;
|
|
8
|
+
} | {
|
|
9
|
+
edgeId: string;
|
|
10
|
+
part: "label";
|
|
11
|
+
};
|
|
12
|
+
type ConstraintStrength = "required" | "strong" | "medium" | "weak";
|
|
13
|
+
type GeometryAttribute = "x" | "y" | "centerX" | "centerY" | "right" | "bottom";
|
|
14
|
+
interface ConstraintBase {
|
|
15
|
+
id: string;
|
|
16
|
+
strength?: ConstraintStrength;
|
|
17
|
+
}
|
|
18
|
+
interface AlignConstraint extends ConstraintBase {
|
|
19
|
+
kind: "align";
|
|
20
|
+
entities: readonly GeometryReference[];
|
|
21
|
+
axis: "x" | "y";
|
|
22
|
+
anchor?: "start" | "center" | "end";
|
|
23
|
+
}
|
|
24
|
+
interface DistributeConstraint extends ConstraintBase {
|
|
25
|
+
kind: "distribute";
|
|
26
|
+
entities: readonly GeometryReference[];
|
|
27
|
+
axis: "x" | "y";
|
|
28
|
+
spacing?: "gaps" | "centers";
|
|
29
|
+
gap?: number;
|
|
30
|
+
}
|
|
31
|
+
interface PinConstraint extends ConstraintBase {
|
|
32
|
+
kind: "pin";
|
|
33
|
+
entity: GeometryReference;
|
|
34
|
+
x?: number;
|
|
35
|
+
y?: number;
|
|
36
|
+
}
|
|
37
|
+
interface LinearConstraint extends ConstraintBase {
|
|
38
|
+
kind: "linear";
|
|
39
|
+
terms: readonly {
|
|
40
|
+
entity: GeometryReference;
|
|
41
|
+
attribute: GeometryAttribute;
|
|
42
|
+
coefficient: number;
|
|
43
|
+
}[];
|
|
44
|
+
relation: "eq" | "le" | "ge";
|
|
45
|
+
value: number;
|
|
46
|
+
}
|
|
47
|
+
interface WaypointConstraint extends ConstraintBase {
|
|
48
|
+
kind: "waypoint";
|
|
49
|
+
edgeId: string;
|
|
50
|
+
point: {
|
|
51
|
+
x: number;
|
|
52
|
+
y: number;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
type LayoutConstraint = AlignConstraint | DistributeConstraint | PinConstraint | LinearConstraint | WaypointConstraint;
|
|
56
|
+
/** Serializable constraint constructors; graph geometry stays in @statelyai/graph. */
|
|
57
|
+
declare const c: {
|
|
58
|
+
align: (value: Omit<AlignConstraint, "kind">) => AlignConstraint;
|
|
59
|
+
distribute: (value: Omit<DistributeConstraint, "kind">) => DistributeConstraint;
|
|
60
|
+
pin: (value: Omit<PinConstraint, "kind">) => PinConstraint;
|
|
61
|
+
linear: (value: Omit<LinearConstraint, "kind">) => LinearConstraint;
|
|
62
|
+
waypoint: (value: Omit<WaypointConstraint, "kind">) => WaypointConstraint;
|
|
63
|
+
};
|
|
64
|
+
//#endregion
|
|
4
65
|
//#region src/types.d.ts
|
|
5
66
|
type AnyGraph = Graph<unknown, unknown, unknown, unknown>;
|
|
6
67
|
type LayoutDirection = "up" | "down" | "left" | "right";
|
|
@@ -11,8 +72,16 @@ type LayoutScope = {
|
|
|
11
72
|
previous: VisualGraph;
|
|
12
73
|
} | {
|
|
13
74
|
mode: "partial";
|
|
14
|
-
|
|
15
|
-
|
|
75
|
+
/** Missing current geometry falls back to these matching entity IDs. */
|
|
76
|
+
previous?: VisualGraph;
|
|
77
|
+
/** Position permission only. Omitted or empty selects no nodes. */
|
|
78
|
+
nodeIds?: readonly string[];
|
|
79
|
+
/** Edge selection never grants permission to move endpoints. */
|
|
80
|
+
edgeIds?: readonly string[];
|
|
81
|
+
/** Defaults to affected; automatic changes obey edgeGeometry. */
|
|
82
|
+
routing?: "selected" | "affected";
|
|
83
|
+
/** Defaults to both; dimensions remain fixed. */
|
|
84
|
+
edgeGeometry?: "routes" | "labels" | "both";
|
|
16
85
|
} | {
|
|
17
86
|
mode: "route-only";
|
|
18
87
|
previous: VisualGraph;
|
|
@@ -24,6 +93,8 @@ interface LayoutDiagnostic {
|
|
|
24
93
|
message: string;
|
|
25
94
|
entityIds?: readonly string[];
|
|
26
95
|
phase?: string;
|
|
96
|
+
constraintIds?: readonly string[];
|
|
97
|
+
geometry?: "node" | "routes" | "labels";
|
|
27
98
|
}
|
|
28
99
|
interface LayoutPhaseMetrics {
|
|
29
100
|
id: string;
|
|
@@ -36,6 +107,8 @@ interface LayoutMetrics {
|
|
|
36
107
|
phases: readonly LayoutPhaseMetrics[];
|
|
37
108
|
}
|
|
38
109
|
interface LayoutCapabilities {
|
|
110
|
+
/** Common geometry constraints; absent means unsupported. */
|
|
111
|
+
constraints?: boolean;
|
|
39
112
|
full: boolean;
|
|
40
113
|
incremental: boolean;
|
|
41
114
|
partial: boolean;
|
|
@@ -50,6 +123,7 @@ interface LayoutAlgorithm<Options = unknown> {
|
|
|
50
123
|
}
|
|
51
124
|
interface LayoutExecutionContext {
|
|
52
125
|
readonly scope: LayoutScope;
|
|
126
|
+
readonly constraints?: readonly LayoutConstraint[];
|
|
53
127
|
readonly signal?: AbortSignal;
|
|
54
128
|
readonly diagnostics: LayoutDiagnostic[];
|
|
55
129
|
measurePhase<T>(id: string, run: () => T): T;
|
|
@@ -60,6 +134,7 @@ interface LayoutRequest<N = unknown, E = unknown, G = unknown, P = unknown, O =
|
|
|
60
134
|
algorithm?: string | LayoutAlgorithm<O>;
|
|
61
135
|
options?: O;
|
|
62
136
|
scope?: LayoutScope;
|
|
137
|
+
constraints?: readonly LayoutConstraint[];
|
|
63
138
|
signal?: AbortSignal;
|
|
64
139
|
}
|
|
65
140
|
interface LayoutResult<N = unknown, E = unknown, G = unknown, P = unknown> {
|
|
@@ -1125,8 +1200,30 @@ interface LayeredStrategies {
|
|
|
1125
1200
|
placeNodes?: NodePlacer;
|
|
1126
1201
|
routeEdges?: EdgeRouter;
|
|
1127
1202
|
}
|
|
1203
|
+
/** Geometry reserved while laying out a compound, before its ancestors. */
|
|
1204
|
+
interface CompoundLayoutOptions {
|
|
1205
|
+
padding?: number | Partial<LayoutPadding>;
|
|
1206
|
+
direction?: LayoutDirection;
|
|
1207
|
+
header?: NodeSize & {
|
|
1208
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
1209
|
+
};
|
|
1210
|
+
minContentSize?: Partial<NodeSize>;
|
|
1211
|
+
}
|
|
1212
|
+
interface CompoundLayoutGeometry {
|
|
1213
|
+
/** Parent-relative outer rectangle; header/content are relative to this rectangle. */
|
|
1214
|
+
bounds: EntityRect;
|
|
1215
|
+
header?: EntityRect;
|
|
1216
|
+
content: EntityRect;
|
|
1217
|
+
}
|
|
1218
|
+
interface CompoundEdgeAttachment {
|
|
1219
|
+
/** Content attachments leave toward the interior; outer attachments leave outward. */
|
|
1220
|
+
source?: "content" | "outer";
|
|
1221
|
+
target?: "content" | "outer";
|
|
1222
|
+
}
|
|
1128
1223
|
interface LayeredLayoutOptions {
|
|
1129
1224
|
direction?: LayoutDirection;
|
|
1225
|
+
compound?: (node: GraphNode) => CompoundLayoutOptions | undefined;
|
|
1226
|
+
edgeAttachment?: (edge: GraphEdge) => CompoundEdgeAttachment | undefined;
|
|
1130
1227
|
spacing?: Partial<LayeredSpacing>;
|
|
1131
1228
|
padding?: number | Partial<LayoutPadding>;
|
|
1132
1229
|
constraints?: LayoutConstraints;
|
|
@@ -1143,6 +1240,15 @@ interface LayeredLayoutOptions {
|
|
|
1143
1240
|
portSettings?: (port: GraphPort, node: GraphNode) => ElkLayeredOptionValueByName | undefined;
|
|
1144
1241
|
}
|
|
1145
1242
|
//#endregion
|
|
1243
|
+
//#region src/layered/compound.d.ts
|
|
1244
|
+
type CompoundVisualGraph<N = unknown, E = unknown, G = unknown, P = unknown> = VisualGraph<N, E, G, P> & {
|
|
1245
|
+
/** Nodes remain parent-relative; edge rectangles and points are world-space. */
|
|
1246
|
+
readonly edgeCoordinateSpace?: "world";
|
|
1247
|
+
readonly compoundGeometry: ReadonlyMap<string, CompoundLayoutGeometry>;
|
|
1248
|
+
/** World-space route sections preserve label gaps and fallback diagnostics. */
|
|
1249
|
+
readonly compoundRoutes: ReadonlyMap<string, Route>;
|
|
1250
|
+
};
|
|
1251
|
+
//#endregion
|
|
1146
1252
|
//#region src/layered/strategies.d.ts
|
|
1147
1253
|
declare const breakCyclesWithDepthFirstSearch: CycleBreaker;
|
|
1148
1254
|
declare const breakCyclesGreedily: CycleBreaker;
|
|
@@ -1206,7 +1312,7 @@ declare function placeNodesWithNetworkSimplex(input: LayeredPhaseInput, order: L
|
|
|
1206
1312
|
* Supports flat and nested graphs, cycles, ports, self-loops, four directions,
|
|
1207
1313
|
* custom phase strategies, and all layered edge-routing styles.
|
|
1208
1314
|
*/
|
|
1209
|
-
declare function getLayeredLayout<N, E, G, P>(graph: Graph<N, E, G, P> | VisualGraph<N, E, G, P>, options?: LayeredLayoutOptions):
|
|
1315
|
+
declare function getLayeredLayout<N, E, G, P>(graph: Graph<N, E, G, P> | VisualGraph<N, E, G, P>, options?: LayeredLayoutOptions): CompoundVisualGraph<N, E, G, P>;
|
|
1210
1316
|
declare const layeredAlgorithm: LayoutAlgorithm<LayeredLayoutOptions>;
|
|
1211
1317
|
//#endregion
|
|
1212
|
-
export {
|
|
1318
|
+
export { CrossingMinimizationStrategy as $, routeEdgesOrthogonally as A, PinConstraint as At, EdgeRouter as B, breakCyclesWithModelOrderDepthFirstSearch as C, AlignConstraint as Ct, minimizeCrossingsWithModelOrder as D, GeometryReference as Dt, minimizeCrossingsWithMedian as E, GeometryAttribute as Et, CompoundEdgeAttachment as F, LayeredLayoutOptions as G, LayerAssigner as H, CompoundLayoutGeometry as I, LayeredStrategies as J, LayeredPhaseInput as K, CompoundLayoutOptions as L, routeEdgesWithSplines as M, c as Mt, CompoundVisualGraph as N, placeNodesInLayers as O, LayoutConstraint as Ot, AcyclicOrientation as P, NodeSize as Q, CrossingMinimizer as R, breakCyclesWithModelOrderBreadthFirstSearch as S, LayoutScope as St, minimizeCrossingsWithBarycenter as T, DistributeConstraint as Tt, LayerAssignment as U, EdgeRoutes as V, LayerOrder as W, NodePlacement as X, LayoutPadding as Y, NodePlacer as Z, breakCyclesByStronglyConnectedNodeType as _, LayoutExecutionContext as _t, placeNodesWithBrandesKoepf as a, fromElkLayeredOptionId as at, breakCyclesInteractively as b, LayoutRequest as bt, assignLayersWithNetworkSimplex as c, ElkLayeredOptionId as ct, assignLayersByLongestPath as d, elkLayeredOptionDefinitions as dt, CycleBreakingStrategy as et, assignLayersByLongestPathToSink as f, AnyGraph as ft, breakCyclesByStronglyConnectedConnectivity as g, LayoutDirection as gt, breakCyclesByModelOrder as h, LayoutDiagnostic as ht, placeNodesWithLinearSegments as i, NodePlacementStrategy as it, routeEdgesWithPolylines as j, WaypointConstraint as jt, placeNodesInteractively as k, LinearConstraint as kt, assignLayersByBreadthFirstModelOrder as l, ElkLayeredOptionName as lt, assignLayersWithCoffmanGraham as m, LayoutCapabilities as mt, layeredAlgorithm as n, LayeredAdvancedOptions as nt, assignLayersWithStretchWidth as o, toElkLayeredOptions as ot, assignLayersInteractively as p, LayoutAlgorithm as pt, LayeredSpacing as q, placeNodesWithNetworkSimplex as r, LayeringStrategy as rt, assignLayersWithMinWidth as s, elkLayeredEnumValues as st, getLayeredLayout as t, EdgeRoutingStyle as tt, assignLayersByDepthFirstModelOrder as u, ElkLayeredOptionValueByName as ut, breakCyclesGreedily as v, LayoutMetrics as vt, minimizeCrossingsInteractively as w, ConstraintStrength as wt, breakCyclesWithDepthFirstSearch as x, LayoutResult as xt, breakCyclesGreedilyByModelOrder as y, LayoutPhaseMetrics as yt, CycleBreaker as z };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { a as RouteBounds, c as RoutePath, l as RoutePoint, n as NativeRoutingStrategy, r as Route, s as RoutePatch } from "./types-CT2akdK0.mjs";
|
|
2
|
+
import { GraphPatch, VisualGraph } from "@statelyai/graph";
|
|
3
|
+
|
|
4
|
+
//#region src/routing/engine.d.ts
|
|
5
|
+
declare function applyRoutePatches(routes: ReadonlyMap<string, Route>, patches: readonly RoutePatch[]): ReadonlyMap<string, Route>;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/routing/path.d.ts
|
|
8
|
+
declare function pathFromPoints(points: readonly RoutePoint[]): RoutePath;
|
|
9
|
+
interface FlattenPathOptions {
|
|
10
|
+
readonly tolerance?: number;
|
|
11
|
+
readonly maxSegments?: number;
|
|
12
|
+
}
|
|
13
|
+
/** Adaptive, bounded-error polyline approximation. Throws rather than silently exceeding tolerance. */
|
|
14
|
+
declare function flattenPath(path: RoutePath, options?: FlattenPathOptions): RoutePoint[];
|
|
15
|
+
/** Conservative bounds: control hulls and full ellipse envelopes contain every curve. */
|
|
16
|
+
declare function getPathBounds(path: RoutePath): RouteBounds;
|
|
17
|
+
declare function getPathLength(path: RoutePath, options?: FlattenPathOptions): number;
|
|
18
|
+
declare function getPointAtLength(path: RoutePath, length: number, options?: FlattenPathOptions): RoutePoint;
|
|
19
|
+
declare function getTangentAtLength(path: RoutePath, length: number, options?: FlattenPathOptions): RoutePoint;
|
|
20
|
+
/** Round line-to-line corners only; existing curves and path endpoints are retained. */
|
|
21
|
+
declare function roundCorners(path: RoutePath, options: {
|
|
22
|
+
readonly radius: number;
|
|
23
|
+
}): RoutePath;
|
|
24
|
+
declare function toSvgPath(path: RoutePath, options?: {
|
|
25
|
+
readonly radius?: number;
|
|
26
|
+
readonly precision?: number;
|
|
27
|
+
}): string;
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/routing/adapters.d.ts
|
|
30
|
+
/** ELK/native spline output: start, then repeating control1/control2/end triples. */
|
|
31
|
+
declare function pathFromSplinePoints(points: readonly RoutePoint[]): RoutePath;
|
|
32
|
+
/** Normalize routes from any native layout algorithm, without running layout again. */
|
|
33
|
+
declare function getLayoutRoutes(graph: VisualGraph): ReadonlyMap<string, Route>;
|
|
34
|
+
/** One polyline per section preserves label gaps and branching for simple renderers. */
|
|
35
|
+
declare function routeToPolylines(route: Route, options?: {
|
|
36
|
+
readonly tolerance?: number;
|
|
37
|
+
}): readonly (readonly RoutePoint[])[];
|
|
38
|
+
/** Compatibility for single-section native consumers. Refuses to erase gaps or topology. */
|
|
39
|
+
declare function routeToGraphPatch(route: Route, options?: {
|
|
40
|
+
readonly tolerance?: number;
|
|
41
|
+
readonly offset?: RoutePoint;
|
|
42
|
+
}): GraphPatch;
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/routing/index.d.ts
|
|
45
|
+
declare const straightRouting: NativeRoutingStrategy;
|
|
46
|
+
declare const bezierRouting: NativeRoutingStrategy;
|
|
47
|
+
declare const orthogonalRouting: NativeRoutingStrategy;
|
|
48
|
+
declare const polylineRouting: NativeRoutingStrategy;
|
|
49
|
+
declare const octilinearRouting: NativeRoutingStrategy;
|
|
50
|
+
declare const curvedRouting: NativeRoutingStrategy;
|
|
51
|
+
declare const organicRouting: NativeRoutingStrategy;
|
|
52
|
+
declare const parallelRouting: NativeRoutingStrategy;
|
|
53
|
+
declare const selfLoopRouting: NativeRoutingStrategy;
|
|
54
|
+
declare const fanRouting: NativeRoutingStrategy;
|
|
55
|
+
declare const busRouting: NativeRoutingStrategy;
|
|
56
|
+
declare const bundleRouting: NativeRoutingStrategy;
|
|
57
|
+
declare const routingStrategies: Readonly<{
|
|
58
|
+
straight: NativeRoutingStrategy;
|
|
59
|
+
bezier: NativeRoutingStrategy;
|
|
60
|
+
orthogonal: NativeRoutingStrategy;
|
|
61
|
+
polyline: NativeRoutingStrategy;
|
|
62
|
+
octilinear: NativeRoutingStrategy;
|
|
63
|
+
curved: NativeRoutingStrategy;
|
|
64
|
+
organic: NativeRoutingStrategy;
|
|
65
|
+
parallel: NativeRoutingStrategy;
|
|
66
|
+
"self-loop": NativeRoutingStrategy;
|
|
67
|
+
fan: NativeRoutingStrategy;
|
|
68
|
+
bus: NativeRoutingStrategy;
|
|
69
|
+
bundle: NativeRoutingStrategy;
|
|
70
|
+
}>;
|
|
71
|
+
//#endregion
|
|
72
|
+
export { getTangentAtLength as C, applyRoutePatches as D, toSvgPath as E, getPointAtLength as S, roundCorners as T, routeToPolylines as _, fanRouting as a, getPathBounds as b, orthogonalRouting as c, routingStrategies as d, selfLoopRouting as f, routeToGraphPatch as g, pathFromSplinePoints as h, curvedRouting as i, parallelRouting as l, getLayoutRoutes as m, bundleRouting as n, octilinearRouting as o, straightRouting as p, busRouting as r, organicRouting as s, bezierRouting as t, polylineRouting as u, FlattenPathOptions as v, pathFromPoints as w, getPathLength as x, flattenPath as y };
|