@statelyai/layout 0.1.2 → 0.2.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 +82 -4
- package/dist/elkjs/index.cjs +8 -0
- package/dist/elkjs/index.d.cts +146 -0
- package/dist/elkjs/index.d.mts +42 -39
- package/dist/elkjs/index.mjs +2 -1483
- 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-BVnDwnBQ.cjs +1551 -0
- package/dist/elkjs-CFlfkEBz.mjs +1528 -0
- package/dist/{index-8xYkohbz.d.mts → index-BSH2bloA.d.mts} +77 -3
- package/dist/index-CG712jzV.d.cts +1286 -0
- package/dist/index.cjs +188 -0
- package/dist/index.d.cts +77 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +24 -25
- package/dist/layered/index.cjs +38 -0
- package/dist/layered/index.d.cts +2 -0
- package/dist/layered/index.d.mts +1 -1
- package/dist/layered/index.mjs +1 -1
- package/dist/{layered-COIyXvwb.mjs → layered-Bz2nWmVp.mjs} +2298 -45
- package/dist/layered-Cf9Rn8l7.cjs +12061 -0
- package/dist/layout-engine-BNex9jxg.cjs +712 -0
- package/dist/{spore-BeKUA1Mb.mjs → layout-engine-WbC0YjjT.mjs} +159 -5
- package/dist/public-types-B8rAALJq.d.mts +109 -0
- package/dist/public-types-CVB0hXGk.d.cts +109 -0
- package/dist/worker-client-D3HMK33r.cjs +98 -0
- package/dist/worker-client-DAT_z2OR.d.mts +19 -0
- package/dist/worker-client-DVhklF6A.d.cts +19 -0
- package/dist/worker-client-DkwS4sHx.mjs +92 -0
- package/package.json +39 -9
- package/src/authoring/coordinates.ts +106 -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 +100 -37
- package/src/elkjs/main.ts +19 -0
- package/src/elkjs/public-types.ts +125 -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 +13 -0
- package/src/internal/elkjs-compatibility.ts +17 -0
- package/src/internal/layout-engine.ts +126 -0
- package/src/layered/index.ts +31 -3
- package/src/layered/strategies.ts +68 -3
- package/src/layout.ts +35 -28
- package/src/packing.ts +22 -0
- package/src/random.ts +75 -3
- package/src/types.ts +17 -2
package/NOTICE.md
CHANGED
|
@@ -16,3 +16,46 @@ https://github.com/eclipse/elk-models. Those examples are available under the
|
|
|
16
16
|
Eclipse Public License 2.0. Their ELKT graph source and upstream paths are
|
|
17
17
|
preserved in the generated example catalog; the upstream repository retains
|
|
18
18
|
the original per-file notices.
|
|
19
|
+
|
|
20
|
+
## Kiwi constraint solver
|
|
21
|
+
|
|
22
|
+
Runtime bundles include `@lume/kiwi` 0.4.4 (https://github.com/lume/kiwi).
|
|
23
|
+
|
|
24
|
+
```text
|
|
25
|
+
=========================
|
|
26
|
+
The Kiwi licensing terms
|
|
27
|
+
=========================
|
|
28
|
+
Kiwi is licensed under the terms of the Modified BSD License (also known as
|
|
29
|
+
New or Revised BSD), as follows:
|
|
30
|
+
|
|
31
|
+
Copyright (c) 2013, Nucleic Development Team
|
|
32
|
+
Copyright (c) 2021, Joseph Orbegoso Pea
|
|
33
|
+
Copyright (c) 2021, LUME
|
|
34
|
+
|
|
35
|
+
All rights reserved.
|
|
36
|
+
|
|
37
|
+
Redistribution and use in source and binary forms, with or without
|
|
38
|
+
modification, are permitted provided that the following conditions are met:
|
|
39
|
+
|
|
40
|
+
Redistributions of source code must retain the above copyright notice, this
|
|
41
|
+
list of conditions and the following disclaimer.
|
|
42
|
+
|
|
43
|
+
Redistributions in binary form must reproduce the above copyright notice, this
|
|
44
|
+
list of conditions and the following disclaimer in the documentation and/or
|
|
45
|
+
other materials provided with the distribution.
|
|
46
|
+
|
|
47
|
+
Neither the name of the Nucleic Development Team nor the names of its
|
|
48
|
+
contributors may be used to endorse or promote products derived from this
|
|
49
|
+
software without specific prior written permission.
|
|
50
|
+
|
|
51
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
52
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
53
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
54
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
|
55
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
56
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
57
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
58
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
59
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
60
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
61
|
+
```
|
package/README.md
CHANGED
|
@@ -16,8 +16,9 @@ layered inventory with one simplified typed name per ELK option. Flat and
|
|
|
16
16
|
compound graphs, cross-hierarchy edges, ports, labels, self-loops, wrapping,
|
|
17
17
|
four directions, constraints, and replaceable phases are differential-tested
|
|
18
18
|
against elkjs, including a curated complex state-machine corpus in both primary
|
|
19
|
-
layout orientations.
|
|
20
|
-
|
|
19
|
+
layout orientations. Native layered layout also supports partial selection,
|
|
20
|
+
route-only execution, and geometric constraints. Incremental layout remains
|
|
21
|
+
explicitly unsupported.
|
|
21
22
|
|
|
22
23
|
## Install
|
|
23
24
|
|
|
@@ -54,6 +55,48 @@ result.diagnostics;
|
|
|
54
55
|
result.metrics;
|
|
55
56
|
```
|
|
56
57
|
|
|
58
|
+
## Layout while authoring
|
|
59
|
+
|
|
60
|
+
<!-- partial scopes and geometry constraints from src/types.ts and src/constraints.ts -->
|
|
61
|
+
|
|
62
|
+
Select nodes and edges independently. Edge selection never moves endpoints:
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
import { c, getLayout } from "@statelyai/layout";
|
|
66
|
+
|
|
67
|
+
const result = await getLayout({
|
|
68
|
+
graph,
|
|
69
|
+
scope: {
|
|
70
|
+
mode: "partial",
|
|
71
|
+
edgeIds: ["ab", "bc"],
|
|
72
|
+
edgeGeometry: "labels",
|
|
73
|
+
routing: "selected",
|
|
74
|
+
},
|
|
75
|
+
constraints: [
|
|
76
|
+
c.align({
|
|
77
|
+
id: "label-centers",
|
|
78
|
+
entities: [
|
|
79
|
+
{ edgeId: "ab", part: "label" },
|
|
80
|
+
{ edgeId: "bc", part: "label" },
|
|
81
|
+
],
|
|
82
|
+
axis: "x",
|
|
83
|
+
anchor: "center",
|
|
84
|
+
}),
|
|
85
|
+
],
|
|
86
|
+
});
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
`nodeIds` permits position changes; `edgeIds` permits routes, label positions,
|
|
90
|
+
or both. `routing: "affected"` (default) also repairs edges affected by moved
|
|
91
|
+
nodes, within `edgeGeometry` permissions. Unselected nodes, dimensions, ports,
|
|
92
|
+
and topology remain fixed. Results include field-specific graph patches and
|
|
93
|
+
repair/conflict diagnostics. Constraints support alignment, distribution, pins,
|
|
94
|
+
linear equalities/inequalities, and route waypoints.
|
|
95
|
+
|
|
96
|
+
See [authoring layout](docs/authoring-layout.md) for baseline requirements,
|
|
97
|
+
selection semantics, routing limits, and examples. Existing ELK compatibility
|
|
98
|
+
behavior is unchanged.
|
|
99
|
+
|
|
57
100
|
## elkjs compatibility
|
|
58
101
|
|
|
59
102
|
<!-- elkjs-compatible entry point and layered mapping exports from package.json#exports and src/layered/index.ts -->
|
|
@@ -67,9 +110,29 @@ const elk = new ELK();
|
|
|
67
110
|
const legacyResult = await elk.layout(elkJsonGraph);
|
|
68
111
|
```
|
|
69
112
|
|
|
113
|
+
Migration-compatible package aliases are also available for
|
|
114
|
+
`lib/main.js`, `lib/elk-api.js`, `lib/elk.bundled.js`, `lib/elk-worker.js`,
|
|
115
|
+
and `lib/elk-worker.min.js`. The worker entries implement elkjs's message
|
|
116
|
+
protocol in-process, including custom `workerFactory` construction and
|
|
117
|
+
termination. Both ESM imports and the original CommonJS `require()` style are
|
|
118
|
+
supported. Worker calls merge constructor defaults with per-layout overrides;
|
|
119
|
+
terminal worker errors reject pending and later requests.
|
|
120
|
+
|
|
70
121
|
The adapter accepts ELK JSON and option aliases, translates to
|
|
71
122
|
`@statelyai/graph`, runs native algorithms, and translates the result back.
|
|
72
|
-
Native algorithms never consume ELK JSON directly.
|
|
123
|
+
Native algorithms never consume ELK JSON directly. `getLayout` and the
|
|
124
|
+
compatibility adapter dispatch through one typed internal engine; direct native
|
|
125
|
+
functions expose those same algorithm implementations. ELK-specific defaults
|
|
126
|
+
and quirks remain local to the pinned compatibility adapter.
|
|
127
|
+
|
|
128
|
+
Compatibility policies currently preserve exact elkjs 0.11.1 Random geometry
|
|
129
|
+
and Box SIMPLE geometry, including provider bounds and whether edge sections
|
|
130
|
+
are routed or left authored. Rectangle Packing has an exact default baseline;
|
|
131
|
+
its full Java packing strategy remains in progress.
|
|
132
|
+
|
|
133
|
+
The compatibility entry's named graph, edge, option, and result types are
|
|
134
|
+
mutually assignable with the declarations shipped by `elkjs@0.11.1`. Its
|
|
135
|
+
default class also accepts the library's broader internal graph inputs.
|
|
73
136
|
|
|
74
137
|
<!-- fixed-port placement and inline center-label guarantees from src/layered/index.ts and src/layered/strategies.ts -->
|
|
75
138
|
|
|
@@ -153,13 +216,28 @@ pnpm install
|
|
|
153
216
|
pnpm verify
|
|
154
217
|
pnpm bench
|
|
155
218
|
pnpm demo
|
|
219
|
+
pnpm storybook
|
|
156
220
|
pnpm changeset
|
|
157
221
|
pnpm release
|
|
158
222
|
```
|
|
159
223
|
|
|
160
224
|
`pnpm verify` checks Oxfmt, Oxlint, source and repository TypeScript projects,
|
|
161
225
|
generated layered-option and demo-corpus freshness, tests,
|
|
162
|
-
declarations/runtime builds,
|
|
226
|
+
declarations/runtime builds, demo and Storybook bundles, and the packed package surface.
|
|
227
|
+
|
|
228
|
+
<!-- authoring stories derived from stories/*.stories.tsx and package.json#scripts -->
|
|
229
|
+
|
|
230
|
+
`pnpm storybook` opens the authoring workbench at `http://127.0.0.1:6018`.
|
|
231
|
+
The **Layout / Partial selection** story starts with a fully laid-out graph.
|
|
232
|
+
Click nodes (or select the review branch), choose a direction, and press
|
|
233
|
+
**Auto-layout selection**. Unselected nodes remain fixed; dashed outlines show
|
|
234
|
+
previous positions. Reset restores the original full layout.
|
|
235
|
+
|
|
236
|
+
Eight additional stories cover edge-only routing, independently editable constraint groups,
|
|
237
|
+
selected-node placement, affected-route repair, constraint conflicts, overlap
|
|
238
|
+
diagnostics, nested coordinates, and unsupported incremental layout. Controls
|
|
239
|
+
rerun the real API; each story shows matched before/after geometry, patches, and
|
|
240
|
+
current limitations. `pnpm storybook:build` writes a static build to `dist-storybook`.
|
|
163
241
|
|
|
164
242
|
<!-- exported source compatibility derived from tsconfig.json -->
|
|
165
243
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
require('../layered-Cf9Rn8l7.cjs');
|
|
3
|
+
const require_elkjs = require('../elkjs-BVnDwnBQ.cjs');
|
|
4
|
+
|
|
5
|
+
exports.compileStatechartLayout = require_elkjs.compileStatechartLayout;
|
|
6
|
+
exports.default = require_elkjs.ELK;
|
|
7
|
+
exports.layoutStatechart = require_elkjs.layoutStatechart;
|
|
8
|
+
exports.scoreStatechartLayout = require_elkjs.scoreStatechartLayout;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { _ as ElkShape, a as ElkEdgeSection, c as ElkLabel, d as ElkLayoutCategoryDescription, f as ElkLayoutOptionDescription, g as ElkPrimitiveEdge, h as ElkPort, i as ElkEdge, l as ElkLayoutAlgorithmDescription, m as ElkPoint, n as ELKConstructorArguments, o as ElkExtendedEdge, p as ElkNode, r as ElkCommonDescription, s as ElkGraphElement, t as ELK, u as ElkLayoutArguments, v as LaidOutElkNode, y as LayoutOptions } from "../public-types-CVB0hXGk.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/elkjs/types.d.ts
|
|
4
|
+
type ElkId = string | number;
|
|
5
|
+
interface ElkGraphElement$1 {
|
|
6
|
+
id?: ElkId;
|
|
7
|
+
layoutOptions?: Record<string, unknown>;
|
|
8
|
+
properties?: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
interface ElkPoint$1 {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
}
|
|
14
|
+
interface ElkShape$1 extends ElkGraphElement$1 {
|
|
15
|
+
x?: number;
|
|
16
|
+
y?: number;
|
|
17
|
+
width?: number;
|
|
18
|
+
height?: number;
|
|
19
|
+
}
|
|
20
|
+
interface ElkLabel$1 extends ElkShape$1 {
|
|
21
|
+
text?: string;
|
|
22
|
+
}
|
|
23
|
+
interface ElkPort$1 extends ElkShape$1 {
|
|
24
|
+
labels?: ElkLabel$1[];
|
|
25
|
+
}
|
|
26
|
+
interface ElkEdgeSection$1 extends ElkGraphElement$1 {
|
|
27
|
+
startPoint: ElkPoint$1;
|
|
28
|
+
endPoint: ElkPoint$1;
|
|
29
|
+
bendPoints?: ElkPoint$1[];
|
|
30
|
+
incomingShape?: ElkId;
|
|
31
|
+
outgoingShape?: ElkId;
|
|
32
|
+
}
|
|
33
|
+
interface ElkEdge$1 extends ElkGraphElement$1 {
|
|
34
|
+
sources?: ElkId[];
|
|
35
|
+
targets?: ElkId[];
|
|
36
|
+
source?: ElkId;
|
|
37
|
+
target?: ElkId;
|
|
38
|
+
sourcePort?: ElkId;
|
|
39
|
+
targetPort?: ElkId;
|
|
40
|
+
labels?: ElkLabel$1[];
|
|
41
|
+
sections?: ElkEdgeSection$1[];
|
|
42
|
+
junctionPoints?: ElkPoint$1[];
|
|
43
|
+
}
|
|
44
|
+
interface ElkNode$1 extends ElkShape$1 {
|
|
45
|
+
labels?: ElkLabel$1[];
|
|
46
|
+
ports?: ElkPort$1[];
|
|
47
|
+
children?: ElkNode$1[];
|
|
48
|
+
edges?: ElkEdge$1[];
|
|
49
|
+
logging?: ElkLogging;
|
|
50
|
+
}
|
|
51
|
+
interface ElkLogging {
|
|
52
|
+
name?: string;
|
|
53
|
+
executionTime?: number;
|
|
54
|
+
logs?: string[];
|
|
55
|
+
children?: ElkLogging[];
|
|
56
|
+
}
|
|
57
|
+
interface ElkLayoutArguments$1 {
|
|
58
|
+
layoutOptions?: Record<string, unknown>;
|
|
59
|
+
logging?: boolean;
|
|
60
|
+
measureExecutionTime?: boolean;
|
|
61
|
+
}
|
|
62
|
+
interface ElkConstructorArguments {
|
|
63
|
+
defaultLayoutOptions?: Record<string, unknown>;
|
|
64
|
+
algorithms?: string[];
|
|
65
|
+
workerUrl?: string;
|
|
66
|
+
workerFactory?: (url?: string) => unknown;
|
|
67
|
+
}
|
|
68
|
+
interface ElkCommonDescription$1 {
|
|
69
|
+
id?: string;
|
|
70
|
+
name?: string;
|
|
71
|
+
description?: string;
|
|
72
|
+
}
|
|
73
|
+
interface ElkLayoutAlgorithmDescription$1 extends ElkCommonDescription$1 {
|
|
74
|
+
category?: string;
|
|
75
|
+
knownOptions?: string[];
|
|
76
|
+
supportedFeatures?: string[];
|
|
77
|
+
}
|
|
78
|
+
interface ElkLayoutOptionDescription$1 extends ElkCommonDescription$1 {
|
|
79
|
+
group?: string;
|
|
80
|
+
type?: string;
|
|
81
|
+
targets?: string[];
|
|
82
|
+
}
|
|
83
|
+
interface ElkLayoutCategoryDescription$1 extends ElkCommonDescription$1 {
|
|
84
|
+
knownLayouters?: string[];
|
|
85
|
+
}
|
|
86
|
+
type LaidOutElkNode$1<T extends ElkNode$1> = Omit<T, "children" | "edges"> & Omit<ElkNode$1, "children" | "edges"> & {
|
|
87
|
+
children?: Array<NonNullable<T["children"]>[number] & ElkNode$1>;
|
|
88
|
+
edges?: Array<NonNullable<T["edges"]>[number] & ElkEdge$1>;
|
|
89
|
+
};
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/elkjs/statechart.d.ts
|
|
92
|
+
interface StatechartScope {
|
|
93
|
+
/** Direct child of this container; never inferred from state names. */
|
|
94
|
+
initialNodeId?: ElkId;
|
|
95
|
+
/** Connected direct-child path. Explicit paths resolve branching ambiguity. */
|
|
96
|
+
preferredPath?: readonly ElkId[];
|
|
97
|
+
direction?: "UP" | "DOWN" | "LEFT" | "RIGHT";
|
|
98
|
+
}
|
|
99
|
+
interface StatechartLayoutOptions {
|
|
100
|
+
scopes: Readonly<Record<string, StatechartScope>>;
|
|
101
|
+
/** Total engine calls, including baseline; integer from 1 to 3. Default 3. */
|
|
102
|
+
maxAttempts?: number;
|
|
103
|
+
}
|
|
104
|
+
interface StatechartLayoutScore {
|
|
105
|
+
invalid: number;
|
|
106
|
+
overlaps: number;
|
|
107
|
+
pathOrder: number;
|
|
108
|
+
crossings: number;
|
|
109
|
+
bends: number;
|
|
110
|
+
routeLength: number;
|
|
111
|
+
}
|
|
112
|
+
interface StatechartLayoutPlan {
|
|
113
|
+
graph: ElkNode$1;
|
|
114
|
+
paths: Record<string, ElkId[]>;
|
|
115
|
+
commonExits: Record<string, ElkId[]>;
|
|
116
|
+
}
|
|
117
|
+
/** Compile semantic hints into settings implemented by this package's ELK adapter. */
|
|
118
|
+
declare function compileStatechartLayout(input: ElkNode$1, scopes: StatechartLayoutOptions["scopes"]): StatechartLayoutPlan;
|
|
119
|
+
/** Diagnostic objective, not a proof of geometric validity. Coordinates are container-relative. */
|
|
120
|
+
declare function scoreStatechartLayout(graph: ElkNode$1, paths?: StatechartLayoutPlan["paths"]): StatechartLayoutScore;
|
|
121
|
+
/** Each attempt starts from original input. No post-layout geometry edits. */
|
|
122
|
+
declare function layoutStatechart<T extends ElkNode$1>(input: T, options: StatechartLayoutOptions): Promise<{
|
|
123
|
+
attempts: {
|
|
124
|
+
kind: "baseline" | "policy" | "spacing";
|
|
125
|
+
score: StatechartLayoutScore;
|
|
126
|
+
}[];
|
|
127
|
+
paths: Record<string, ElkId[]>;
|
|
128
|
+
commonExits: Record<string, ElkId[]>;
|
|
129
|
+
graph: LaidOutElkNode$1<T>;
|
|
130
|
+
score: StatechartLayoutScore;
|
|
131
|
+
attempt: number;
|
|
132
|
+
}>;
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/elkjs/index.d.ts
|
|
135
|
+
declare class ELK$1 {
|
|
136
|
+
#private;
|
|
137
|
+
constructor(options?: ElkConstructorArguments);
|
|
138
|
+
knownLayoutAlgorithms(): Promise<ElkLayoutAlgorithmDescription$1[]>;
|
|
139
|
+
knownLayoutOptions(): Promise<ElkLayoutOptionDescription$1[]>;
|
|
140
|
+
knownLayoutCategories(): Promise<ElkLayoutCategoryDescription$1[]>;
|
|
141
|
+
terminateWorker(): void;
|
|
142
|
+
layout<T extends ElkNode>(graph: T, arguments_?: ElkLayoutArguments): Promise<ElkNode & LaidOutElkNode<T>>;
|
|
143
|
+
layout<T extends ElkNode$1>(graph: T, arguments_?: ElkLayoutArguments$1): Promise<LaidOutElkNode$1<T>>;
|
|
144
|
+
}
|
|
145
|
+
//#endregion
|
|
146
|
+
export { type ELK, type ELKConstructorArguments, type ElkCommonDescription, type ElkEdge, type ElkEdgeSection, type ElkExtendedEdge, type ElkGraphElement, type ElkId, type ElkLabel, type ElkLayoutAlgorithmDescription, type ElkLayoutArguments, type ElkLayoutCategoryDescription, type ElkLayoutOptionDescription, type ElkLogging, type ElkNode, type ElkPoint, type ElkPort, type ElkPrimitiveEdge, type ElkShape, type LaidOutElkNode, type LayoutOptions, type StatechartLayoutOptions, type StatechartLayoutPlan, type StatechartLayoutScore, type StatechartScope, compileStatechartLayout, ELK$1 as default, layoutStatechart, scoreStatechartLayout };
|
package/dist/elkjs/index.d.mts
CHANGED
|
@@ -1,49 +1,51 @@
|
|
|
1
|
+
import { _ as ElkShape, a as ElkEdgeSection, c as ElkLabel, d as ElkLayoutCategoryDescription, f as ElkLayoutOptionDescription, g as ElkPrimitiveEdge, h as ElkPort, i as ElkEdge, l as ElkLayoutAlgorithmDescription, m as ElkPoint, n as ELKConstructorArguments, o as ElkExtendedEdge, p as ElkNode, r as ElkCommonDescription, s as ElkGraphElement, t as ELK, u as ElkLayoutArguments, v as LaidOutElkNode, y as LayoutOptions } from "../public-types-B8rAALJq.mjs";
|
|
2
|
+
|
|
1
3
|
//#region src/elkjs/types.d.ts
|
|
2
4
|
type ElkId = string | number;
|
|
3
|
-
interface ElkGraphElement {
|
|
5
|
+
interface ElkGraphElement$1 {
|
|
4
6
|
id?: ElkId;
|
|
5
7
|
layoutOptions?: Record<string, unknown>;
|
|
6
8
|
properties?: Record<string, unknown>;
|
|
7
9
|
}
|
|
8
|
-
interface ElkPoint {
|
|
10
|
+
interface ElkPoint$1 {
|
|
9
11
|
x: number;
|
|
10
12
|
y: number;
|
|
11
13
|
}
|
|
12
|
-
interface ElkShape extends ElkGraphElement {
|
|
14
|
+
interface ElkShape$1 extends ElkGraphElement$1 {
|
|
13
15
|
x?: number;
|
|
14
16
|
y?: number;
|
|
15
17
|
width?: number;
|
|
16
18
|
height?: number;
|
|
17
19
|
}
|
|
18
|
-
interface ElkLabel extends ElkShape {
|
|
20
|
+
interface ElkLabel$1 extends ElkShape$1 {
|
|
19
21
|
text?: string;
|
|
20
22
|
}
|
|
21
|
-
interface ElkPort extends ElkShape {
|
|
22
|
-
labels?: ElkLabel[];
|
|
23
|
+
interface ElkPort$1 extends ElkShape$1 {
|
|
24
|
+
labels?: ElkLabel$1[];
|
|
23
25
|
}
|
|
24
|
-
interface ElkEdgeSection extends ElkGraphElement {
|
|
25
|
-
startPoint: ElkPoint;
|
|
26
|
-
endPoint: ElkPoint;
|
|
27
|
-
bendPoints?: ElkPoint[];
|
|
26
|
+
interface ElkEdgeSection$1 extends ElkGraphElement$1 {
|
|
27
|
+
startPoint: ElkPoint$1;
|
|
28
|
+
endPoint: ElkPoint$1;
|
|
29
|
+
bendPoints?: ElkPoint$1[];
|
|
28
30
|
incomingShape?: ElkId;
|
|
29
31
|
outgoingShape?: ElkId;
|
|
30
32
|
}
|
|
31
|
-
interface ElkEdge extends ElkGraphElement {
|
|
33
|
+
interface ElkEdge$1 extends ElkGraphElement$1 {
|
|
32
34
|
sources?: ElkId[];
|
|
33
35
|
targets?: ElkId[];
|
|
34
36
|
source?: ElkId;
|
|
35
37
|
target?: ElkId;
|
|
36
38
|
sourcePort?: ElkId;
|
|
37
39
|
targetPort?: ElkId;
|
|
38
|
-
labels?: ElkLabel[];
|
|
39
|
-
sections?: ElkEdgeSection[];
|
|
40
|
-
junctionPoints?: ElkPoint[];
|
|
41
|
-
}
|
|
42
|
-
interface ElkNode extends ElkShape {
|
|
43
|
-
labels?: ElkLabel[];
|
|
44
|
-
ports?: ElkPort[];
|
|
45
|
-
children?: ElkNode[];
|
|
46
|
-
edges?: ElkEdge[];
|
|
40
|
+
labels?: ElkLabel$1[];
|
|
41
|
+
sections?: ElkEdgeSection$1[];
|
|
42
|
+
junctionPoints?: ElkPoint$1[];
|
|
43
|
+
}
|
|
44
|
+
interface ElkNode$1 extends ElkShape$1 {
|
|
45
|
+
labels?: ElkLabel$1[];
|
|
46
|
+
ports?: ElkPort$1[];
|
|
47
|
+
children?: ElkNode$1[];
|
|
48
|
+
edges?: ElkEdge$1[];
|
|
47
49
|
logging?: ElkLogging;
|
|
48
50
|
}
|
|
49
51
|
interface ElkLogging {
|
|
@@ -52,7 +54,7 @@ interface ElkLogging {
|
|
|
52
54
|
logs?: string[];
|
|
53
55
|
children?: ElkLogging[];
|
|
54
56
|
}
|
|
55
|
-
interface ElkLayoutArguments {
|
|
57
|
+
interface ElkLayoutArguments$1 {
|
|
56
58
|
layoutOptions?: Record<string, unknown>;
|
|
57
59
|
logging?: boolean;
|
|
58
60
|
measureExecutionTime?: boolean;
|
|
@@ -63,27 +65,27 @@ interface ElkConstructorArguments {
|
|
|
63
65
|
workerUrl?: string;
|
|
64
66
|
workerFactory?: (url?: string) => unknown;
|
|
65
67
|
}
|
|
66
|
-
interface ElkCommonDescription {
|
|
68
|
+
interface ElkCommonDescription$1 {
|
|
67
69
|
id?: string;
|
|
68
70
|
name?: string;
|
|
69
71
|
description?: string;
|
|
70
72
|
}
|
|
71
|
-
interface ElkLayoutAlgorithmDescription extends ElkCommonDescription {
|
|
73
|
+
interface ElkLayoutAlgorithmDescription$1 extends ElkCommonDescription$1 {
|
|
72
74
|
category?: string;
|
|
73
75
|
knownOptions?: string[];
|
|
74
76
|
supportedFeatures?: string[];
|
|
75
77
|
}
|
|
76
|
-
interface ElkLayoutOptionDescription extends ElkCommonDescription {
|
|
78
|
+
interface ElkLayoutOptionDescription$1 extends ElkCommonDescription$1 {
|
|
77
79
|
group?: string;
|
|
78
80
|
type?: string;
|
|
79
81
|
targets?: string[];
|
|
80
82
|
}
|
|
81
|
-
interface ElkLayoutCategoryDescription extends ElkCommonDescription {
|
|
83
|
+
interface ElkLayoutCategoryDescription$1 extends ElkCommonDescription$1 {
|
|
82
84
|
knownLayouters?: string[];
|
|
83
85
|
}
|
|
84
|
-
type LaidOutElkNode<T extends ElkNode> = Omit<T, "children" | "edges"> & Omit<ElkNode, "children" | "edges"> & {
|
|
85
|
-
children?: Array<NonNullable<T["children"]>[number] & ElkNode>;
|
|
86
|
-
edges?: Array<NonNullable<T["edges"]>[number] & ElkEdge>;
|
|
86
|
+
type LaidOutElkNode$1<T extends ElkNode$1> = Omit<T, "children" | "edges"> & Omit<ElkNode$1, "children" | "edges"> & {
|
|
87
|
+
children?: Array<NonNullable<T["children"]>[number] & ElkNode$1>;
|
|
88
|
+
edges?: Array<NonNullable<T["edges"]>[number] & ElkEdge$1>;
|
|
87
89
|
};
|
|
88
90
|
//#endregion
|
|
89
91
|
//#region src/elkjs/statechart.d.ts
|
|
@@ -108,36 +110,37 @@ interface StatechartLayoutScore {
|
|
|
108
110
|
routeLength: number;
|
|
109
111
|
}
|
|
110
112
|
interface StatechartLayoutPlan {
|
|
111
|
-
graph: ElkNode;
|
|
113
|
+
graph: ElkNode$1;
|
|
112
114
|
paths: Record<string, ElkId[]>;
|
|
113
115
|
commonExits: Record<string, ElkId[]>;
|
|
114
116
|
}
|
|
115
117
|
/** Compile semantic hints into settings implemented by this package's ELK adapter. */
|
|
116
|
-
declare function compileStatechartLayout(input: ElkNode, scopes: StatechartLayoutOptions["scopes"]): StatechartLayoutPlan;
|
|
118
|
+
declare function compileStatechartLayout(input: ElkNode$1, scopes: StatechartLayoutOptions["scopes"]): StatechartLayoutPlan;
|
|
117
119
|
/** Diagnostic objective, not a proof of geometric validity. Coordinates are container-relative. */
|
|
118
|
-
declare function scoreStatechartLayout(graph: ElkNode, paths?: StatechartLayoutPlan["paths"]): StatechartLayoutScore;
|
|
120
|
+
declare function scoreStatechartLayout(graph: ElkNode$1, paths?: StatechartLayoutPlan["paths"]): StatechartLayoutScore;
|
|
119
121
|
/** Each attempt starts from original input. No post-layout geometry edits. */
|
|
120
|
-
declare function layoutStatechart<T extends ElkNode>(input: T, options: StatechartLayoutOptions): Promise<{
|
|
122
|
+
declare function layoutStatechart<T extends ElkNode$1>(input: T, options: StatechartLayoutOptions): Promise<{
|
|
121
123
|
attempts: {
|
|
122
124
|
kind: "baseline" | "policy" | "spacing";
|
|
123
125
|
score: StatechartLayoutScore;
|
|
124
126
|
}[];
|
|
125
127
|
paths: Record<string, ElkId[]>;
|
|
126
128
|
commonExits: Record<string, ElkId[]>;
|
|
127
|
-
graph: LaidOutElkNode<T>;
|
|
129
|
+
graph: LaidOutElkNode$1<T>;
|
|
128
130
|
score: StatechartLayoutScore;
|
|
129
131
|
attempt: number;
|
|
130
132
|
}>;
|
|
131
133
|
//#endregion
|
|
132
134
|
//#region src/elkjs/index.d.ts
|
|
133
|
-
declare class ELK {
|
|
135
|
+
declare class ELK$1 {
|
|
134
136
|
#private;
|
|
135
137
|
constructor(options?: ElkConstructorArguments);
|
|
136
|
-
knownLayoutAlgorithms(): Promise<ElkLayoutAlgorithmDescription[]>;
|
|
137
|
-
knownLayoutOptions(): Promise<ElkLayoutOptionDescription[]>;
|
|
138
|
-
knownLayoutCategories(): Promise<ElkLayoutCategoryDescription[]>;
|
|
138
|
+
knownLayoutAlgorithms(): Promise<ElkLayoutAlgorithmDescription$1[]>;
|
|
139
|
+
knownLayoutOptions(): Promise<ElkLayoutOptionDescription$1[]>;
|
|
140
|
+
knownLayoutCategories(): Promise<ElkLayoutCategoryDescription$1[]>;
|
|
139
141
|
terminateWorker(): void;
|
|
140
|
-
layout<T extends ElkNode>(graph: T, arguments_?: ElkLayoutArguments): Promise<LaidOutElkNode<T>>;
|
|
142
|
+
layout<T extends ElkNode>(graph: T, arguments_?: ElkLayoutArguments): Promise<ElkNode & LaidOutElkNode<T>>;
|
|
143
|
+
layout<T extends ElkNode$1>(graph: T, arguments_?: ElkLayoutArguments$1): Promise<LaidOutElkNode$1<T>>;
|
|
141
144
|
}
|
|
142
145
|
//#endregion
|
|
143
|
-
export { type
|
|
146
|
+
export { type ELK, type ELKConstructorArguments, type ElkCommonDescription, type ElkEdge, type ElkEdgeSection, type ElkExtendedEdge, type ElkGraphElement, type ElkId, type ElkLabel, type ElkLayoutAlgorithmDescription, type ElkLayoutArguments, type ElkLayoutCategoryDescription, type ElkLayoutOptionDescription, type ElkLogging, type ElkNode, type ElkPoint, type ElkPort, type ElkPrimitiveEdge, type ElkShape, type LaidOutElkNode, type LayoutOptions, type StatechartLayoutOptions, type StatechartLayoutPlan, type StatechartLayoutScore, type StatechartScope, compileStatechartLayout, ELK$1 as default, layoutStatechart, scoreStatechartLayout };
|