@opsydyn/foldkit-zloz-elk 0.0.0-stage → 0.5.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/CHANGELOG.md +50 -0
- package/LICENSE +21 -0
- package/README.md +118 -2
- package/THIRD-PARTY-NOTICES.md +13 -0
- package/dist/index.d.mts +14 -0
- package/dist/index.mjs +221 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +67 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
- Qualify loose-mode requests through shared core validation with real-engine endpoint-identity tests.
|
|
6
|
+
|
|
7
|
+
- Reserve declared group headings through padding/minimum size, with qualified DOWN compound-minimum normalization and nested/empty group coverage.
|
|
8
|
+
|
|
9
|
+
- Reserve caller-declared composite edge-label bounds in compound layouts and return validated world-coordinate boxes, including custom badges on unlabeled edges.
|
|
10
|
+
|
|
11
|
+
## [0.5.0](https://github.com/opsydyn/fold-kit-experiments/compare/foldkit-zloz-elk-v0.4.0...foldkit-zloz-elk-v0.5.0) (2026-11-15)
|
|
12
|
+
|
|
13
|
+
### Miscellaneous Chores
|
|
14
|
+
|
|
15
|
+
- **foldkit-zloz-elk:** Synchronize foldkit-zloz versions
|
|
16
|
+
|
|
17
|
+
## [0.4.0](https://github.com/opsydyn/fold-kit-experiments/compare/foldkit-zloz-elk-v0.3.0...foldkit-zloz-elk-v0.4.0) (2026-11-15)
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
- **zloz:** add opt-in ELK descriptor preview layout ([26b4732](https://github.com/opsydyn/fold-kit-experiments/commit/26b47325c4538a6137a20736c49ce793addca61b))
|
|
22
|
+
- **zloz:** measure label bounds with stale-result protection ([b184bde](https://github.com/opsydyn/fold-kit-experiments/commit/b184bdea255264078a2c81127c34fefcb2f949b4))
|
|
23
|
+
- **zloz:** qualify v2 portable adapter boundaries ([e19efa7](https://github.com/opsydyn/fold-kit-experiments/commit/e19efa782bcd22424d62ea545fafa8770120a49c))
|
|
24
|
+
- **zloz:** reserve explicit layout label bounds ([ecc2284](https://github.com/opsydyn/fold-kit-experiments/commit/ecc22846fdf3d69efc29046a183109323eb795e4))
|
|
25
|
+
- **zloz:** reserve group heading layout bounds ([e67a3e1](https://github.com/opsydyn/fold-kit-experiments/commit/e67a3e1f37ab9fa4d25d45543bb61693f99e39c3))
|
|
26
|
+
|
|
27
|
+
## [0.3.0](https://github.com/opsydyn/fold-kit-experiments/compare/foldkit-zloz-elk-v0.2.0...foldkit-zloz-elk-v0.3.0) (2026-11-10)
|
|
28
|
+
|
|
29
|
+
### Miscellaneous Chores
|
|
30
|
+
|
|
31
|
+
- **foldkit-zloz-elk:** Synchronize foldkit-zloz versions
|
|
32
|
+
|
|
33
|
+
## [0.2.0](https://github.com/opsydyn/fold-kit-experiments/compare/foldkit-zloz-elk-v0.1.1...foldkit-zloz-elk-v0.2.0) (2026-11-09)
|
|
34
|
+
|
|
35
|
+
### Miscellaneous Chores
|
|
36
|
+
|
|
37
|
+
- **foldkit-zloz-elk:** Synchronize foldkit-zloz versions
|
|
38
|
+
|
|
39
|
+
## [0.1.1](https://github.com/opsydyn/fold-kit-experiments/compare/foldkit-zloz-elk-v0.1.0...foldkit-zloz-elk-v0.1.1) (2026-11-09)
|
|
40
|
+
|
|
41
|
+
### Miscellaneous Chores
|
|
42
|
+
|
|
43
|
+
- **foldkit-zloz-elk:** Synchronize foldkit-zloz versions
|
|
44
|
+
|
|
45
|
+
## 0.1.0 (unreleased)
|
|
46
|
+
|
|
47
|
+
- Route fixed boundary projections and rejoin canonical custom anchors.
|
|
48
|
+
|
|
49
|
+
- Add a separately installable ELK Layered adapter with fixed port positions,
|
|
50
|
+
variable node sizes, orthogonal routes and caller-owned worker support.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Alan P Currie
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,119 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Foldkit Zloz ELK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Optional automatic layout for `@opsydyn/foldkit-zloz`. The adapter maps flat and nested graphs with fixed ports to ELK Layered. It returns node
|
|
4
|
+
positions, fitted group bounds, and orthogonal edge routes. It owns no UI, persistence, graph state or workflow execution.
|
|
5
|
+
|
|
6
|
+
Version 0.1.0 is a local release candidate; npm publication has not been performed.
|
|
7
|
+
|
|
8
|
+
## Install and use
|
|
9
|
+
|
|
10
|
+
After publication:
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm install @opsydyn/foldkit-zloz @opsydyn/foldkit-zloz-elk
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { createEditor, layoutRequest, applyLayout } from '@opsydyn/foldkit-zloz';
|
|
18
|
+
import { createElkLayout } from '@opsydyn/foldkit-zloz-elk';
|
|
19
|
+
|
|
20
|
+
const editor = createEditor({ nodes: [], edges: [] });
|
|
21
|
+
const active = layoutRequest(editor, 'arrange-1');
|
|
22
|
+
const layout = createElkLayout({ direction: 'RIGHT', spacing: 64 });
|
|
23
|
+
const result = await layout(active); // Run this work in a FoldKit Command.
|
|
24
|
+
const arranged = applyLayout(editor, active, result);
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
In an asynchronous application, the completion handler must use the **current**
|
|
28
|
+
editor and active request from the Model. Never capture those old values and write
|
|
29
|
+
them back on completion. Clear active requests on document replacement.
|
|
30
|
+
|
|
31
|
+
The default direction is RIGHT; DOWN is also supported. Node sizes and authored
|
|
32
|
+
port anchors remain authoritative. Legacy side/offset ports keep their
|
|
33
|
+
positions. Custom anchors are projected onto their declared side for ELK, then
|
|
34
|
+
route leads join back to the exact authored points. User IDs are mapped to independent internal IDs.
|
|
35
|
+
Input snapshots are not mutated. Engine failures reject the Promise; missing node
|
|
36
|
+
positions or invalid routes reject with `ZlozError` rather than inventing geometry.
|
|
37
|
+
|
|
38
|
+
## Worker ownership
|
|
39
|
+
|
|
40
|
+
The default bundled ELK runs **in process** and creates a fresh instance for each
|
|
41
|
+
call. Its Promise does not move computation off the UI thread. For larger graphs,
|
|
42
|
+
construct a worker-backed ELK instance using your bundler's worker configuration
|
|
43
|
+
and pass it as `createElkLayout({ elk })`. The caller owns and terminates that worker.
|
|
44
|
+
The adapter never terminates caller-owned resources. Command interruption alone
|
|
45
|
+
does not cancel ELK computation; request/revision checks prevent late publication.
|
|
46
|
+
See [ELK's worker documentation](https://github.com/kieler/elkjs#web-worker).
|
|
47
|
+
|
|
48
|
+
ELK is an external dependency, not bundled into this package. The core package
|
|
49
|
+
installs and works without it. Node 22+, ESM only. Initial compatibility is Zloz
|
|
50
|
+
0.1.0 and the pinned elkjs 0.12.1. Both Zloz packages release at the same version.
|
|
51
|
+
The adapter has no FoldKit or Effect peer.
|
|
52
|
+
|
|
53
|
+
The default adapter is qualified in Node and Chromium. Bun can compute layouts,
|
|
54
|
+
but elkjs 0.12.1's bundled fallback installs a global `self.onmessage` handler in
|
|
55
|
+
Bun 1.4.4, keeping a standalone process alive after completion. Use Node for CLI
|
|
56
|
+
layout jobs. The dependency-free core is separately tested in both Node and Bun.
|
|
57
|
+
|
|
58
|
+
## Scope and verification
|
|
59
|
+
|
|
60
|
+
Compound layout preserves group membership and routes directed edges across
|
|
61
|
+
boundaries. Zloz edges connect one source to one target. Compare representative
|
|
62
|
+
diagrams before upgrading ELK, since layout may vary by version.
|
|
63
|
+
|
|
64
|
+
Run `bun run --filter @opsydyn/foldkit-zloz-elk test`, `typecheck` and `pack:check`.
|
|
65
|
+
The core's packed consumer test installs both tarballs through npm and exercises
|
|
66
|
+
real layout plus the optional FoldKit renderer.
|
|
67
|
+
|
|
68
|
+
See [publication standards](https://github.com/opsydyn/fold-kit-experiments/blob/main/docs/releases/foldkit-zloz.md) and
|
|
69
|
+
[dependency notices](THIRD-PARTY-NOTICES.md).
|
|
70
|
+
|
|
71
|
+
### Compound preview layouts (unreleased)
|
|
72
|
+
|
|
73
|
+
Configured `direction` and `spacing` now apply to root **and group parent**
|
|
74
|
+
containers. A real-engine regression retains at least the requested inter-layer
|
|
75
|
+
gap for RIGHT and DOWN inside a boundary; nested-boundary routes and custom anchors
|
|
76
|
+
remain tested. This corrects grouped children silently using ELK defaults.
|
|
77
|
+
|
|
78
|
+
For a detached read-only editor, compose `layoutRequest`, `createElkLayout` and
|
|
79
|
+
core's `applyPreviewLayout`; use `applyLayout` for normal undoable editing. The
|
|
80
|
+
workbench opts into ELK on explicit request, with direction controls, logical
|
|
81
|
+
cancellation, geometry-only restoration and preserved source/findings. See
|
|
82
|
+
[qualification](../../apps/zloz-demo/evidence/alchemy-layout.md). Label dimensions
|
|
83
|
+
are not yet supplied to ELK, so this is not a universal label-collision guarantee.
|
|
84
|
+
|
|
85
|
+
### Custom label envelopes (unreleased)
|
|
86
|
+
|
|
87
|
+
Pass `layoutRequest(editor, id, { edgeLabels: [{ id: edgeId, size: { width: 176,
|
|
88
|
+
height: 36 } }] })` to reserve space for a composite label, including badges.
|
|
89
|
+
One envelope per existing edge is supported. ELK returns centered world-coordinate
|
|
90
|
+
boxes in `result.routes[*].label`; core validates and retains them on application.
|
|
91
|
+
Nested layouts use ROOT coordinates for both route points and labels. Unlabeled
|
|
92
|
+
custom content uses a private sizing token inside ELK, without changing graph text.
|
|
93
|
+
Omitting hints preserves the previous geometry-only behavior. Caller-supplied
|
|
94
|
+
engines must return the requested label IDs, dimensions and finite positions.
|
|
95
|
+
Supply sizes matching the actual renderer; arbitrary custom geometry, inaccurate
|
|
96
|
+
bounds and group headers are outside this space-reservation guarantee.
|
|
97
|
+
|
|
98
|
+
For intrinsic custom badges, core's `startLabelMeasurement`,
|
|
99
|
+
`updateLabelMeasurements` and `resolveLabelMeasurements` can supply the explicit
|
|
100
|
+
`edgeLabels` hints. The optional Foldkit view measures HTML border boxes only on
|
|
101
|
+
request. Recheck freshness before both starting ELK and applying its result; ELK
|
|
102
|
+
does not load fonts, inspect DOM or start measurement itself. See the
|
|
103
|
+
[core measured-label guide](../foldkit-zloz/README.md#opt-in-measured-label-bounds-unreleased).
|
|
104
|
+
|
|
105
|
+
### Group heading envelopes (unreleased)
|
|
106
|
+
|
|
107
|
+
Core requests may declare `groupHeaders` with an existing group ID, header `size`,
|
|
108
|
+
`padding: { top, right, bottom, left }` and a `gap` before children. ELK maps these
|
|
109
|
+
to parent padding and a minimum group size, including empty groups and headings
|
|
110
|
+
wider than their content. Core rejects results that violate the reserved area.
|
|
111
|
+
Share the same declaration with C4/DDD `groupHeader` renderer options. Omitted
|
|
112
|
+
hints keep the existing 52/24/24/24 parent padding.
|
|
113
|
+
|
|
114
|
+
The pinned elkjs 0.12.1 adapter corrects transposed minima for nonempty DOWN groups;
|
|
115
|
+
empty groups use physical axes. Wide/tall nested/empty and cross-boundary-edge
|
|
116
|
+
regressions qualify both directions. Requalify the correction when upgrading ELK
|
|
117
|
+
or supplying a worker from another version. No post-layout stretching is used.
|
|
118
|
+
These hints reserve child-node space; they do not guarantee arbitrary route or
|
|
119
|
+
custom-artwork collision avoidance.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
This package depends on the unmodified `elkjs` 0.12.1 npm package, distributed
|
|
4
|
+
separately by npm. Its declared licence is `EPL-2.0 OR GPL-3.0-or-later`; the EPL-2.0
|
|
5
|
+
option applies to this integration. Preserve upstream notices when redistributing
|
|
6
|
+
or bundling that dependency. The adapter's own source is MIT licensed.
|
|
7
|
+
|
|
8
|
+
ELK upstream: <https://github.com/kieler/elkjs>
|
|
9
|
+
|
|
10
|
+
ELK source and licensing: <https://github.com/kieler/elkjs/blob/master/LICENSE.md>
|
|
11
|
+
|
|
12
|
+
ELK is generated from the Eclipse Layout Kernel; its complete dependency notices
|
|
13
|
+
remain in the upstream package. This adapter does not modify or vendor ELK code.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LayoutEngine } from "@opsydyn/foldkit-zloz";
|
|
2
|
+
import { ELK } from "elkjs/lib/elk-api.js";
|
|
3
|
+
|
|
4
|
+
//#region src/index.d.ts
|
|
5
|
+
type ElkLayoutOptions = Readonly<{
|
|
6
|
+
direction?: 'RIGHT' | 'DOWN';
|
|
7
|
+
spacing?: number; /** Supply a worker-backed instance when needed; the caller owns its lifetime. */
|
|
8
|
+
elk?: Pick<ELK, 'layout'>;
|
|
9
|
+
}>;
|
|
10
|
+
/** Default invocations use in-process ELK. Caller-supplied worker instances remain caller-owned. */
|
|
11
|
+
declare function createElkLayout(options?: ElkLayoutOptions): LayoutEngine;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { ElkLayoutOptions, createElkLayout };
|
|
14
|
+
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { ZlozError, portBoundaryPosition, portPosition, resolveLayoutGroupHeader, validateLayoutRequest } from "@opsydyn/foldkit-zloz";
|
|
2
|
+
import ELK from "elkjs/lib/elk.bundled.js";
|
|
3
|
+
//#region src/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* Optional ELK layout adapter; the host owns request publication and worker lifetime.
|
|
6
|
+
* @module ELK
|
|
7
|
+
*/
|
|
8
|
+
function routePoints(sections, edgeId) {
|
|
9
|
+
const byId = new Map(sections.map((section) => [section.id, section]));
|
|
10
|
+
const visited = /* @__PURE__ */ new Set();
|
|
11
|
+
const points = [];
|
|
12
|
+
let current = sections.find((section) => !section.incomingSections?.length);
|
|
13
|
+
while (current && !visited.has(current.id)) {
|
|
14
|
+
visited.add(current.id);
|
|
15
|
+
const previous = points.at(-1);
|
|
16
|
+
if (previous && (Math.abs(previous.x - current.startPoint.x) > 1e-6 || Math.abs(previous.y - current.startPoint.y) > 1e-6)) break;
|
|
17
|
+
if (!previous) points.push(current.startPoint);
|
|
18
|
+
for (const bend of current.bendPoints ?? []) points.push(bend);
|
|
19
|
+
points.push(current.endPoint);
|
|
20
|
+
const outgoing = current.outgoingSections ?? [];
|
|
21
|
+
if (outgoing.length === 0 && visited.size === sections.length) return points.map(({ x, y }) => ({
|
|
22
|
+
x,
|
|
23
|
+
y
|
|
24
|
+
}));
|
|
25
|
+
const next = outgoing[0];
|
|
26
|
+
if (outgoing.length !== 1 || next === void 0) break;
|
|
27
|
+
current = byId.get(next);
|
|
28
|
+
}
|
|
29
|
+
throw new ZlozError("invalid-layout", `ELK omitted a continuous route for ${edgeId}`);
|
|
30
|
+
}
|
|
31
|
+
/** Default invocations use in-process ELK. Caller-supplied worker instances remain caller-owned. */
|
|
32
|
+
function createElkLayout(options = {}) {
|
|
33
|
+
const spacing = options.spacing ?? 64;
|
|
34
|
+
if (!Number.isFinite(spacing) || spacing <= 0) throw new ZlozError("invalid-layout", "Layout spacing must be positive and finite");
|
|
35
|
+
return async (request) => {
|
|
36
|
+
validateLayoutRequest(request);
|
|
37
|
+
const labelHints = new Map((request.edgeLabels ?? []).map((label) => [label.id, label]));
|
|
38
|
+
const groupHeaders = new Map((request.groupHeaders ?? []).map((header) => [header.id, header]));
|
|
39
|
+
const nodeIds = new Map(request.graph.nodes.map((node, index) => [node.id, `n:${index}`]));
|
|
40
|
+
const portIds = /* @__PURE__ */ new Map();
|
|
41
|
+
const hasGroups = request.graph.nodes.some((node) => node.kind === "group");
|
|
42
|
+
const layoutOptions = {
|
|
43
|
+
"elk.algorithm": "layered",
|
|
44
|
+
"elk.direction": options.direction ?? "RIGHT",
|
|
45
|
+
"elk.edgeRouting": "ORTHOGONAL",
|
|
46
|
+
"elk.spacing.nodeNode": String(spacing),
|
|
47
|
+
"elk.layered.spacing.nodeNodeBetweenLayers": String(spacing)
|
|
48
|
+
};
|
|
49
|
+
const children = [];
|
|
50
|
+
const elkNodes = new Map(request.graph.nodes.map((node, index) => {
|
|
51
|
+
if (node.kind === "group") {
|
|
52
|
+
const hint = groupHeaders.get(node.id);
|
|
53
|
+
const header = hint ? resolveLayoutGroupHeader(node, hint) : void 0;
|
|
54
|
+
const groupOptions = {
|
|
55
|
+
...layoutOptions,
|
|
56
|
+
"elk.padding": "[top=52,left=24,bottom=24,right=24]"
|
|
57
|
+
};
|
|
58
|
+
if (header) {
|
|
59
|
+
const p = header.contentPadding;
|
|
60
|
+
groupOptions["elk.padding"] = `[top=${p.top},left=${p.left},bottom=${p.bottom},right=${p.right}]`;
|
|
61
|
+
groupOptions["elk.nodeSize.constraints"] = "MINIMUM_SIZE";
|
|
62
|
+
const transposed = options.direction === "DOWN" && request.graph.nodes.some((child) => child.parentId === node.id);
|
|
63
|
+
const minimum = header.minimumSize;
|
|
64
|
+
groupOptions["elk.nodeSize.minimum"] = transposed ? `(${minimum.height},${minimum.width})` : `(${minimum.width},${minimum.height})`;
|
|
65
|
+
}
|
|
66
|
+
return [node.id, {
|
|
67
|
+
id: `n:${index}`,
|
|
68
|
+
width: node.size.width,
|
|
69
|
+
height: node.size.height,
|
|
70
|
+
children: [],
|
|
71
|
+
layoutOptions: groupOptions
|
|
72
|
+
}];
|
|
73
|
+
}
|
|
74
|
+
const ports = new Map(node.ports.map((port, at) => [port.id, `p:${index}:${at}`]));
|
|
75
|
+
portIds.set(node.id, ports);
|
|
76
|
+
return [node.id, {
|
|
77
|
+
id: `n:${index}`,
|
|
78
|
+
width: node.size.width,
|
|
79
|
+
height: node.size.height,
|
|
80
|
+
layoutOptions: { "elk.portConstraints": "FIXED_POS" },
|
|
81
|
+
ports: node.ports.map((port) => {
|
|
82
|
+
const point = portBoundaryPosition(node, port.id);
|
|
83
|
+
const side = {
|
|
84
|
+
left: "WEST",
|
|
85
|
+
right: "EAST",
|
|
86
|
+
top: "NORTH",
|
|
87
|
+
bottom: "SOUTH"
|
|
88
|
+
}[port.side];
|
|
89
|
+
return {
|
|
90
|
+
id: ports.get(port.id) ?? "",
|
|
91
|
+
width: 0,
|
|
92
|
+
height: 0,
|
|
93
|
+
x: point.x - node.position.x,
|
|
94
|
+
y: point.y - node.position.y,
|
|
95
|
+
layoutOptions: { "elk.port.side": side }
|
|
96
|
+
};
|
|
97
|
+
})
|
|
98
|
+
}];
|
|
99
|
+
}));
|
|
100
|
+
for (const node of request.graph.nodes) {
|
|
101
|
+
const elkNode = elkNodes.get(node.id);
|
|
102
|
+
if (!elkNode) throw new ZlozError("invalid-layout", `Missing input elkNode for ${node.id}`);
|
|
103
|
+
const siblings = node.parentId === void 0 ? children : elkNodes.get(node.parentId)?.children;
|
|
104
|
+
if (!siblings) throw new ZlozError("invalid-layout", `Missing parent elkNode for ${node.id}`);
|
|
105
|
+
siblings.push(elkNode);
|
|
106
|
+
}
|
|
107
|
+
const graph = {
|
|
108
|
+
id: "graph",
|
|
109
|
+
layoutOptions: {
|
|
110
|
+
...layoutOptions,
|
|
111
|
+
"elk.hierarchyHandling": hasGroups ? "INCLUDE_CHILDREN" : "SEPARATE_CHILDREN",
|
|
112
|
+
"elk.json.shapeCoords": "ROOT",
|
|
113
|
+
"elk.json.edgeCoords": "ROOT"
|
|
114
|
+
},
|
|
115
|
+
children,
|
|
116
|
+
edges: request.graph.edges.map((edge, index) => {
|
|
117
|
+
const base = {
|
|
118
|
+
id: `e:${index}`,
|
|
119
|
+
sources: [portIds.get(edge.source.node)?.get(edge.source.port) ?? ""],
|
|
120
|
+
targets: [portIds.get(edge.target.node)?.get(edge.target.port) ?? ""]
|
|
121
|
+
};
|
|
122
|
+
const hint = labelHints.get(edge.id);
|
|
123
|
+
return hint ? {
|
|
124
|
+
...base,
|
|
125
|
+
labels: [{
|
|
126
|
+
id: `l:${index}`,
|
|
127
|
+
text: edge.label?.trim() || "label",
|
|
128
|
+
width: hint.size.width,
|
|
129
|
+
height: hint.size.height,
|
|
130
|
+
layoutOptions: { "elk.edgeLabels.placement": "CENTER" }
|
|
131
|
+
}]
|
|
132
|
+
} : base;
|
|
133
|
+
})
|
|
134
|
+
};
|
|
135
|
+
const result = await (options.elk ?? new ELK()).layout(graph);
|
|
136
|
+
const laidOutNodes = /* @__PURE__ */ new Map();
|
|
137
|
+
const laidOutEdges = /* @__PURE__ */ new Map();
|
|
138
|
+
const laidOutLabels = /* @__PURE__ */ new Map();
|
|
139
|
+
const pending = [result];
|
|
140
|
+
while (pending.length > 0) {
|
|
141
|
+
const node = pending.pop();
|
|
142
|
+
if (!node) break;
|
|
143
|
+
laidOutNodes.set(node.id, node);
|
|
144
|
+
for (const edge of node.edges ?? []) {
|
|
145
|
+
laidOutEdges.set(edge.id, edge.sections ?? []);
|
|
146
|
+
laidOutLabels.set(edge.id, edge.labels ?? []);
|
|
147
|
+
}
|
|
148
|
+
for (const child of node.children ?? []) pending.push(child);
|
|
149
|
+
}
|
|
150
|
+
const positions = request.graph.nodes.map((node) => {
|
|
151
|
+
const laidOut = laidOutNodes.get(nodeIds.get(node.id) ?? "");
|
|
152
|
+
if (!laidOut || !Number.isFinite(laidOut.x) || !Number.isFinite(laidOut.y) || laidOut.x === void 0 || laidOut.y === void 0) throw new ZlozError("invalid-layout", `ELK omitted position for ${node.id}`);
|
|
153
|
+
const position = {
|
|
154
|
+
id: node.id,
|
|
155
|
+
x: laidOut.x,
|
|
156
|
+
y: laidOut.y
|
|
157
|
+
};
|
|
158
|
+
if (node.kind !== "group") return position;
|
|
159
|
+
const { width, height } = laidOut;
|
|
160
|
+
if (width === void 0 || height === void 0 || !Number.isFinite(width) || !Number.isFinite(height) || width <= 0 || height <= 0) throw new ZlozError("invalid-layout", `ELK returned invalid bounds for ${node.id}`);
|
|
161
|
+
return {
|
|
162
|
+
...position,
|
|
163
|
+
size: {
|
|
164
|
+
width,
|
|
165
|
+
height
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
});
|
|
169
|
+
const routes = request.graph.edges.map((edge, index) => {
|
|
170
|
+
const points = routePoints(laidOutEdges.get(`e:${index}`) ?? [], edge.id);
|
|
171
|
+
if (!points.every((point) => Number.isFinite(point.x) && Number.isFinite(point.y))) throw new ZlozError("invalid-layout", `ELK returned an invalid route for ${edge.id}`);
|
|
172
|
+
const sourceNode = request.graph.nodes.find((node) => node.id === edge.source.node);
|
|
173
|
+
const targetNode = request.graph.nodes.find((node) => node.id === edge.target.node);
|
|
174
|
+
const sourcePosition = positions.find((position) => position.id === edge.source.node);
|
|
175
|
+
const targetPosition = positions.find((position) => position.id === edge.target.node);
|
|
176
|
+
if (!sourceNode || !targetNode || !sourcePosition || !targetPosition) throw new ZlozError("invalid-layout", "Missing routed endpoint");
|
|
177
|
+
const anchored = [
|
|
178
|
+
portPosition({
|
|
179
|
+
...sourceNode,
|
|
180
|
+
position: sourcePosition
|
|
181
|
+
}, edge.source.port),
|
|
182
|
+
...points,
|
|
183
|
+
portPosition({
|
|
184
|
+
...targetNode,
|
|
185
|
+
position: targetPosition
|
|
186
|
+
}, edge.target.port)
|
|
187
|
+
];
|
|
188
|
+
const route = {
|
|
189
|
+
id: edge.id,
|
|
190
|
+
points: anchored.filter((point, index) => {
|
|
191
|
+
const previous = anchored[index - 1];
|
|
192
|
+
return !previous || previous.x !== point.x || previous.y !== point.y;
|
|
193
|
+
})
|
|
194
|
+
};
|
|
195
|
+
const hint = labelHints.get(edge.id);
|
|
196
|
+
if (!hint) return route;
|
|
197
|
+
const labels = laidOutLabels.get(`e:${index}`) ?? [], label = labels[0];
|
|
198
|
+
if (labels.length !== 1 || !label || label.id !== `l:${index}` || label.x === void 0 || label.y === void 0 || !Number.isFinite(label.x) || !Number.isFinite(label.y) || label.width !== hint.size.width || label.height !== hint.size.height) throw new ZlozError("invalid-layout", `ELK omitted a valid label box for ${edge.id}`);
|
|
199
|
+
return {
|
|
200
|
+
...route,
|
|
201
|
+
label: {
|
|
202
|
+
position: {
|
|
203
|
+
x: label.x + hint.size.width / 2,
|
|
204
|
+
y: label.y + hint.size.height / 2
|
|
205
|
+
},
|
|
206
|
+
size: { ...hint.size }
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
});
|
|
210
|
+
return {
|
|
211
|
+
requestId: request.requestId,
|
|
212
|
+
revision: request.revision,
|
|
213
|
+
positions,
|
|
214
|
+
routes
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
//#endregion
|
|
219
|
+
export { createElkLayout };
|
|
220
|
+
|
|
221
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * Optional ELK layout adapter; the host owns request publication and worker lifetime.\n * @module ELK\n */\nimport {\n ZlozError,\n portPosition,\n portBoundaryPosition,\n validateLayoutRequest,\n resolveLayoutGroupHeader,\n type EdgeRoute,\n type LayoutEngine,\n} from '@opsydyn/foldkit-zloz';\nimport type {\n ELK as ElkInstance,\n ElkNode,\n ElkEdgeSection,\n ElkLabel,\n LayoutOptions as ElkLayoutProperties,\n} from 'elkjs/lib/elk-api';\nimport ELK from 'elkjs/lib/elk.bundled.js';\n\nexport type ElkLayoutOptions = Readonly<{\n direction?: 'RIGHT' | 'DOWN';\n spacing?: number;\n /** Supply a worker-backed instance when needed; the caller owns its lifetime. */\n elk?: Pick<ElkInstance, 'layout'>;\n}>;\n\nfunction routePoints(sections: readonly ElkEdgeSection[], edgeId: string): EdgeRoute['points'] {\n const byId = new Map(sections.map((section) => [section.id, section]));\n const visited = new Set<string>();\n const points: Array<{ x: number; y: number }> = [];\n let current = sections.find((section) => !section.incomingSections?.length);\n while (current && !visited.has(current.id)) {\n visited.add(current.id);\n const previous = points.at(-1);\n if (\n previous &&\n (Math.abs(previous.x - current.startPoint.x) > 1e-6 ||\n Math.abs(previous.y - current.startPoint.y) > 1e-6)\n )\n break;\n if (!previous) points.push(current.startPoint);\n for (const bend of current.bendPoints ?? []) points.push(bend);\n points.push(current.endPoint);\n const outgoing = current.outgoingSections ?? [];\n if (outgoing.length === 0 && visited.size === sections.length)\n return points.map(({ x, y }) => ({ x, y }));\n const next = outgoing[0];\n if (outgoing.length !== 1 || next === undefined) break;\n current = byId.get(next);\n }\n throw new ZlozError('invalid-layout', `ELK omitted a continuous route for ${edgeId}`);\n}\n\n/** Default invocations use in-process ELK. Caller-supplied worker instances remain caller-owned. */\nexport function createElkLayout(options: ElkLayoutOptions = {}): LayoutEngine {\n const spacing = options.spacing ?? 64;\n if (!Number.isFinite(spacing) || spacing <= 0)\n throw new ZlozError('invalid-layout', 'Layout spacing must be positive and finite');\n return async (request) => {\n validateLayoutRequest(request);\n const labelHints = new Map((request.edgeLabels ?? []).map((label) => [label.id, label]));\n const groupHeaders = new Map((request.groupHeaders ?? []).map((header) => [header.id, header]));\n const nodeIds = new Map(request.graph.nodes.map((node, index) => [node.id, `n:${index}`]));\n const portIds = new Map<string, Map<string, string>>();\n const hasGroups = request.graph.nodes.some((node) => node.kind === 'group');\n const layoutOptions = {\n 'elk.algorithm': 'layered',\n 'elk.direction': options.direction ?? 'RIGHT',\n 'elk.edgeRouting': 'ORTHOGONAL',\n 'elk.spacing.nodeNode': String(spacing),\n 'elk.layered.spacing.nodeNodeBetweenLayers': String(spacing),\n } as const;\n const children: ElkNode[] = [];\n const elkNodes = new Map(\n request.graph.nodes.map((node, index): [string, ElkNode] => {\n if (node.kind === 'group') {\n const hint = groupHeaders.get(node.id);\n const header = hint ? resolveLayoutGroupHeader(node, hint) : undefined;\n const groupOptions: ElkLayoutProperties = {\n ...layoutOptions,\n 'elk.padding': '[top=52,left=24,bottom=24,right=24]',\n };\n if (header) {\n const p = header.contentPadding;\n groupOptions['elk.padding'] =\n `[top=${p.top},left=${p.left},bottom=${p.bottom},right=${p.right}]`;\n groupOptions['elk.nodeSize.constraints'] = 'MINIMUM_SIZE';\n // ELK 0.12.1 transposes compound graph minima in DOWN, but leaf/empty group minima remain physical.\n // Keep this correction behind the adapter; nested/empty, wide/tall real-engine regressions qualify upgrades.\n const transposed =\n options.direction === 'DOWN' &&\n request.graph.nodes.some((child) => child.parentId === node.id);\n const minimum = header.minimumSize;\n groupOptions['elk.nodeSize.minimum'] = transposed\n ? `(${minimum.height},${minimum.width})`\n : `(${minimum.width},${minimum.height})`;\n }\n return [\n node.id,\n {\n id: `n:${index}`,\n width: node.size.width,\n height: node.size.height,\n children: [],\n layoutOptions: groupOptions,\n },\n ];\n }\n const ports = new Map(node.ports.map((port, at) => [port.id, `p:${index}:${at}`]));\n portIds.set(node.id, ports);\n return [\n node.id,\n {\n id: `n:${index}`,\n width: node.size.width,\n height: node.size.height,\n layoutOptions: { 'elk.portConstraints': 'FIXED_POS' },\n ports: node.ports.map((port) => {\n const point = portBoundaryPosition(node, port.id);\n const side = { left: 'WEST', right: 'EAST', top: 'NORTH', bottom: 'SOUTH' }[\n port.side\n ];\n return {\n id: ports.get(port.id) ?? '',\n width: 0,\n height: 0,\n x: point.x - node.position.x,\n y: point.y - node.position.y,\n layoutOptions: { 'elk.port.side': side },\n };\n }),\n },\n ];\n }),\n );\n for (const node of request.graph.nodes) {\n const elkNode = elkNodes.get(node.id);\n if (!elkNode) throw new ZlozError('invalid-layout', `Missing input elkNode for ${node.id}`);\n const siblings =\n node.parentId === undefined ? children : elkNodes.get(node.parentId)?.children;\n if (!siblings) throw new ZlozError('invalid-layout', `Missing parent elkNode for ${node.id}`);\n siblings.push(elkNode);\n }\n const graph: ElkNode = {\n id: 'graph',\n layoutOptions: {\n ...layoutOptions,\n 'elk.hierarchyHandling': hasGroups ? 'INCLUDE_CHILDREN' : 'SEPARATE_CHILDREN',\n 'elk.json.shapeCoords': 'ROOT',\n 'elk.json.edgeCoords': 'ROOT',\n },\n children,\n edges: request.graph.edges.map((edge, index) => {\n const base = {\n id: `e:${index}`,\n sources: [portIds.get(edge.source.node)?.get(edge.source.port) ?? ''],\n targets: [portIds.get(edge.target.node)?.get(edge.target.port) ?? ''],\n };\n const hint = labelHints.get(edge.id);\n return hint\n ? {\n ...base,\n labels: [\n {\n id: `l:${index}`,\n text: edge.label?.trim() || 'label',\n width: hint.size.width,\n height: hint.size.height,\n layoutOptions: { 'elk.edgeLabels.placement': 'CENTER' },\n },\n ],\n }\n : base;\n }),\n };\n const elk = options.elk ?? new ELK();\n const result = await elk.layout(graph);\n const laidOutNodes = new Map<string, ElkNode>();\n const laidOutEdges = new Map<string, ElkEdgeSection[]>();\n const laidOutLabels = new Map<string, readonly ElkLabel[]>();\n const pending = [result];\n while (pending.length > 0) {\n const node = pending.pop();\n if (!node) break;\n laidOutNodes.set(node.id, node);\n for (const edge of node.edges ?? []) {\n laidOutEdges.set(edge.id, edge.sections ?? []);\n laidOutLabels.set(edge.id, edge.labels ?? []);\n }\n for (const child of node.children ?? []) pending.push(child);\n }\n const positions = request.graph.nodes.map((node) => {\n const laidOut = laidOutNodes.get(nodeIds.get(node.id) ?? '');\n if (\n !laidOut ||\n !Number.isFinite(laidOut.x) ||\n !Number.isFinite(laidOut.y) ||\n laidOut.x === undefined ||\n laidOut.y === undefined\n )\n throw new ZlozError('invalid-layout', `ELK omitted position for ${node.id}`);\n const position = { id: node.id, x: laidOut.x, y: laidOut.y };\n if (node.kind !== 'group') return position;\n const { width, height } = laidOut;\n if (\n width === undefined ||\n height === undefined ||\n !Number.isFinite(width) ||\n !Number.isFinite(height) ||\n width <= 0 ||\n height <= 0\n )\n throw new ZlozError('invalid-layout', `ELK returned invalid bounds for ${node.id}`);\n return { ...position, size: { width, height } };\n });\n const routes: EdgeRoute[] = request.graph.edges.map((edge, index) => {\n const sections = laidOutEdges.get(`e:${index}`) ?? [];\n const points = routePoints(sections, edge.id);\n if (!points.every((point) => Number.isFinite(point.x) && Number.isFinite(point.y)))\n throw new ZlozError('invalid-layout', `ELK returned an invalid route for ${edge.id}`);\n const sourceNode = request.graph.nodes.find((node) => node.id === edge.source.node);\n const targetNode = request.graph.nodes.find((node) => node.id === edge.target.node);\n const sourcePosition = positions.find((position) => position.id === edge.source.node);\n const targetPosition = positions.find((position) => position.id === edge.target.node);\n if (!sourceNode || !targetNode || !sourcePosition || !targetPosition)\n throw new ZlozError('invalid-layout', 'Missing routed endpoint');\n const anchored = [\n portPosition({ ...sourceNode, position: sourcePosition }, edge.source.port),\n ...points,\n portPosition({ ...targetNode, position: targetPosition }, edge.target.port),\n ];\n const route = {\n id: edge.id,\n points: anchored.filter((point, index) => {\n const previous = anchored[index - 1];\n return !previous || previous.x !== point.x || previous.y !== point.y;\n }),\n };\n const hint = labelHints.get(edge.id);\n if (!hint) return route;\n const labels = laidOutLabels.get(`e:${index}`) ?? [],\n label = labels[0];\n if (\n labels.length !== 1 ||\n !label ||\n label.id !== `l:${index}` ||\n label.x === undefined ||\n label.y === undefined ||\n !Number.isFinite(label.x) ||\n !Number.isFinite(label.y) ||\n label.width !== hint.size.width ||\n label.height !== hint.size.height\n )\n throw new ZlozError('invalid-layout', `ELK omitted a valid label box for ${edge.id}`);\n return {\n ...route,\n label: {\n position: { x: label.x + hint.size.width / 2, y: label.y + hint.size.height / 2 },\n size: { ...hint.size },\n },\n };\n });\n return { requestId: request.requestId, revision: request.revision, positions, routes };\n };\n}\n"],"mappings":";;;;;;;AA6BA,SAAS,YAAY,UAAqC,QAAqC;CAC7F,MAAM,OAAO,IAAI,IAAI,SAAS,KAAK,YAAY,CAAC,QAAQ,IAAI,QAAQ,CAAC,CAAC;CACtE,MAAM,0BAAU,IAAI,KAAa;CACjC,MAAM,SAA0C,EAAE;CAClD,IAAI,UAAU,SAAS,MAAM,YAAY,CAAC,QAAQ,kBAAkB,OAAO;AAC3E,QAAO,WAAW,CAAC,QAAQ,IAAI,QAAQ,GAAG,EAAE;AAC1C,UAAQ,IAAI,QAAQ,GAAG;EACvB,MAAM,WAAW,OAAO,GAAG,GAAG;AAC9B,MACE,aACC,KAAK,IAAI,SAAS,IAAI,QAAQ,WAAW,EAAE,GAAG,QAC7C,KAAK,IAAI,SAAS,IAAI,QAAQ,WAAW,EAAE,GAAG,MAEhD;AACF,MAAI,CAAC,SAAU,QAAO,KAAK,QAAQ,WAAW;AAC9C,OAAK,MAAM,QAAQ,QAAQ,cAAc,EAAE,CAAE,QAAO,KAAK,KAAK;AAC9D,SAAO,KAAK,QAAQ,SAAS;EAC7B,MAAM,WAAW,QAAQ,oBAAoB,EAAE;AAC/C,MAAI,SAAS,WAAW,KAAK,QAAQ,SAAS,SAAS,OACrD,QAAO,OAAO,KAAK,EAAE,GAAG,SAAS;GAAE;GAAG;GAAG,EAAE;EAC7C,MAAM,OAAO,SAAS;AACtB,MAAI,SAAS,WAAW,KAAK,SAAS,KAAA,EAAW;AACjD,YAAU,KAAK,IAAI,KAAK;;AAE1B,OAAM,IAAI,UAAU,kBAAkB,sCAAsC,SAAS;;;AAIvF,SAAgB,gBAAgB,UAA4B,EAAE,EAAgB;CAC5E,MAAM,U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HANGED
|
@@ -1,6 +1,69 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opsydyn/foldkit-zloz-elk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "Optional ELK layout adapter for Foldkit Zloz.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"diagram",
|
|
7
|
+
"flow",
|
|
8
|
+
"foldkit",
|
|
9
|
+
"graph",
|
|
10
|
+
"typescript"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/opsydyn/fold-kit-experiments/tree/main/packages/foldkit-zloz-elk#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/opsydyn/fold-kit-experiments/issues"
|
|
15
|
+
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"author": "Alan P Currie",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/opsydyn/fold-kit-experiments.git",
|
|
21
|
+
"directory": "packages/foldkit-zloz-elk"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"README.md",
|
|
26
|
+
"CHANGELOG.md",
|
|
27
|
+
"LICENSE",
|
|
28
|
+
"THIRD-PARTY-NOTICES.md",
|
|
29
|
+
"!dist/pack"
|
|
30
|
+
],
|
|
31
|
+
"type": "module",
|
|
32
|
+
"sideEffects": false,
|
|
33
|
+
"main": "./dist/index.mjs",
|
|
34
|
+
"types": "./dist/index.d.mts",
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"types": "./dist/index.d.mts",
|
|
38
|
+
"import": "./dist/index.mjs"
|
|
39
|
+
},
|
|
40
|
+
"./package.json": "./package.json"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "bun run --filter @opsydyn/foldkit-zloz build && tsdown",
|
|
47
|
+
"typecheck": "bun run --filter @opsydyn/foldkit-zloz build && tsc --noEmit",
|
|
48
|
+
"test": "bun test ./test",
|
|
49
|
+
"pack:check": "bun run build && publint && bun ../../tools/pack-zloz.ts foldkit-zloz-elk"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"elkjs": "0.12.1"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@arethetypeswrong/cli": "0.18.5",
|
|
56
|
+
"@opsydyn/foldkit-zloz": "0.5.0",
|
|
57
|
+
"@types/node": "^22.0.0",
|
|
58
|
+
"bun-types": "^1.3.14",
|
|
59
|
+
"publint": "0.3.25",
|
|
60
|
+
"tsdown": "^0.21.8",
|
|
61
|
+
"typescript": "^6.0.3"
|
|
62
|
+
},
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"@opsydyn/foldkit-zloz": "0.5.0"
|
|
65
|
+
},
|
|
66
|
+
"engines": {
|
|
67
|
+
"node": ">=22.0.0"
|
|
68
|
+
}
|
|
69
|
+
}
|