@meltemi/diagrams-layout-elk 0.0.0-stage → 1.9.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Architecture Studio contributors
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,51 @@
1
- # Temporary Holding Version
1
+ # @meltemi/diagrams-layout-elk
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The adapter of the [Eclipse Layout Kernel](https://eclipse.dev/elk/) (elkjs, EPL-2.0) for
4
+ `@meltemi/diagrams-layout`: automatic arrangement with ports, groups and label space, run
5
+ synchronously so that layouts are deterministic.
6
+
7
+ It is part of [Meltemi Diagrams](https://github.com/askenaz-dev/meltemi-diagrams#readme), diagrams as code with a canvas, motion and
8
+ exports. Every package of the product has the same version.
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ npm install @meltemi/diagrams-layout-elk
14
+ ```
15
+
16
+ Node 22.12.0 or later. The package is an ES module with type declarations.
17
+
18
+ ## Use
19
+
20
+ ```ts
21
+ import { layoutDiagram } from "@meltemi/diagrams-layout";
22
+ import { createElkEngine } from "@meltemi/diagrams-layout-elk";
23
+ import { compile } from "@meltemi/diagrams-model";
24
+
25
+ const text = `language "0.2"
26
+
27
+ diagram shop: flow {
28
+ web["Web shop"]
29
+ api["Orders API"]
30
+ db[("Orders")]
31
+ web -> api: "HTTPS" as call
32
+ api -> db: "SQL" as store
33
+ }
34
+ `;
35
+
36
+ const compilation = compile(text);
37
+ const { scene } = layoutDiagram(compilation, compilation.document.diagrams[0]!, {
38
+ engine: createElkEngine(),
39
+ });
40
+ console.log(scene!.width > 0 && scene!.height > 0); // true
41
+ ```
42
+
43
+ ## Documentation
44
+
45
+ - [Layout](https://github.com/askenaz-dev/meltemi-diagrams/blob/main/docs/language/layout.md)
46
+ - [Decision 0015](https://github.com/askenaz-dev/meltemi-diagrams/blob/main/docs/decisions/0015-layout-engine.md)
47
+ - [All documentation](https://github.com/askenaz-dev/meltemi-diagrams/blob/main/docs/README.md)
48
+
49
+ ## Licence
50
+
51
+ MIT. Third-party components and their licences are listed in [THIRD_PARTY_LICENSES.md](https://github.com/askenaz-dev/meltemi-diagrams/blob/main/THIRD_PARTY_LICENSES.md).
@@ -0,0 +1,66 @@
1
+ import type { ArrangeRequest, LayoutEngine } from "@meltemi/diagrams-layout";
2
+ export declare const PACKAGE_NAME = "@meltemi/diagrams-layout-elk";
3
+ /** The pinned ELK build; the adapter relies on its worker's synchronous dispatcher. */
4
+ export declare const ELK_VERSION = "0.12.0";
5
+ interface ElkPoint {
6
+ x: number;
7
+ y: number;
8
+ }
9
+ interface ElkNode {
10
+ id: string;
11
+ x?: number;
12
+ y?: number;
13
+ width?: number;
14
+ height?: number;
15
+ layoutOptions?: Record<string, string>;
16
+ children?: ElkNode[];
17
+ ports?: {
18
+ id: string;
19
+ x?: number;
20
+ y?: number;
21
+ width: number;
22
+ height: number;
23
+ layoutOptions?: Record<string, string>;
24
+ }[];
25
+ edges?: ElkEdge[];
26
+ }
27
+ interface ElkEdge {
28
+ id: string;
29
+ sources: string[];
30
+ targets: string[];
31
+ layoutOptions?: Record<string, string>;
32
+ container?: string;
33
+ labels?: {
34
+ id: string;
35
+ width: number;
36
+ height: number;
37
+ text: string;
38
+ layoutOptions?: Record<string, string>;
39
+ }[];
40
+ sections?: {
41
+ startPoint: ElkPoint;
42
+ endPoint: ElkPoint;
43
+ bendPoints?: ElkPoint[];
44
+ }[];
45
+ }
46
+ /** Options of `createElkEngine`. */
47
+ export interface ElkEngineOptions {
48
+ /**
49
+ * Returns the exports of `elkjs/lib/elk-worker.min.js`. Under Node the installed package is
50
+ * loaded by default; bundled hosts ship the file next to their bundle or bundle the module, and
51
+ * browsers must give it.
52
+ */
53
+ readonly loadWorker?: () => unknown;
54
+ }
55
+ /**
56
+ * Loads `elk-worker.min.js` from a file as a CommonJS module, with `self` hidden. The file starts
57
+ * ELK as a real web worker when `self` exists and `document` does not, which is the case in the VS
58
+ * Code extension host; it would then export nothing and take over `self.onmessage`.
59
+ */
60
+ export declare function loadElkWorkerFile(path: string): unknown;
61
+ /** The ELK graph of a request: compound groups, nodes with fixed-position ports, edges. */
62
+ export declare function elkGraph(request: ArrangeRequest): ElkNode;
63
+ /** A layout engine backed by ELK's layered algorithm (elkjs, EPL-2.0). */
64
+ export declare function createElkEngine(options?: ElkEngineOptions): LayoutEngine;
65
+ export {};
66
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,cAAc,EAEd,YAAY,EACb,MAAM,0BAA0B,CAAC;AAElC,eAAO,MAAM,YAAY,iCAAiC,CAAC;AAE3D,uFAAuF;A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AQ,EAAE,QAAQ,CAAC;QAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,CAAA;KAAE,EAAE,CAAC;CACpF;AAwBD,oCAAoC;AACpC,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC;CACrC;AAsBD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAYvD;AA6ED,2FAA2F;AAC3F,wBAAgB,QAAQ,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAiLzD;AA2BD,0EAA0E;AAC1E,wBAAgB,eAAe,CAAC,OAAO,GAAE,gBAAqB,GAAG,YAAY,CA0C5E"}
package/dist/index.js ADDED
@@ -0,0 +1,343 @@
1
+ export const PACKAGE_NAME = "@meltemi/diagrams-layout-elk";
2
+ /** The pinned ELK build; the adapter relies on its worker's synchronous dispatcher. */
3
+ export const ELK_VERSION = "0.12.0";
4
+ const DIRECTIONS = {
5
+ LR: "RIGHT",
6
+ RL: "LEFT",
7
+ TB: "DOWN",
8
+ BT: "UP",
9
+ };
10
+ const SIDES = {
11
+ north: "NORTH",
12
+ south: "SOUTH",
13
+ east: "EAST",
14
+ west: "WEST",
15
+ };
16
+ /** Ports are points on the node border; ELK needs a size, so they are 1 px squares. */
17
+ const PORT_SIZE = 1;
18
+ /**
19
+ * A module built into Node, reached when called so that the package loads in browsers too.
20
+ * Undefined outside Node.
21
+ */
22
+ function nodeModule(id) {
23
+ const process = globalThis
24
+ .process;
25
+ return process?.getBuiltinModule?.(id);
26
+ }
27
+ function requireNode(id) {
28
+ const module = nodeModule(id);
29
+ if (!module) {
30
+ throw new Error("The ELK worker can only be read from the installed elkjs under Node; pass `loadWorker` to createElkEngine.");
31
+ }
32
+ return module;
33
+ }
34
+ /**
35
+ * Loads `elk-worker.min.js` from a file as a CommonJS module, with `self` hidden. The file starts
36
+ * ELK as a real web worker when `self` exists and `document` does not, which is the case in the VS
37
+ * Code extension host; it would then export nothing and take over `self.onmessage`.
38
+ */
39
+ export function loadElkWorkerFile(path) {
40
+ const { readFileSync } = requireNode("node:fs");
41
+ const source = readFileSync(path, "utf8");
42
+ const module = { exports: {} };
43
+ // The worker is plain script code shipped with elkjs; it is evaluated once per engine.
44
+ const run = new Function("module", "exports", "self", source);
45
+ run(module, module.exports, undefined);
46
+ return module.exports;
47
+ }
48
+ /** Loads the worker module of the installed `elkjs`. */
49
+ function installedWorker() {
50
+ const { createRequire } = requireNode("node:module");
51
+ const require = createRequire(import.meta.url);
52
+ return loadElkWorkerFile(require.resolve("elkjs/lib/elk-worker.min.js"));
53
+ }
54
+ /** Starts an ELK worker and registers the layered algorithm. */
55
+ function startWorker(load) {
56
+ const exports = load();
57
+ const Worker = (typeof exports === "function" ? exports : exports?.default);
58
+ if (typeof Worker !== "function") {
59
+ throw new Error(`The ELK worker module does not export a worker; elkjs ${ELK_VERSION} is required.`);
60
+ }
61
+ const instance = new Worker();
62
+ if (typeof instance.dispatcher?.dispatch !== "function") {
63
+ throw new Error(`elkjs ${ELK_VERSION} is required; the installed version has no synchronous dispatcher.`);
64
+ }
65
+ instance.onmessage = () => undefined;
66
+ instance.dispatcher.dispatch({ data: { cmd: "register", id: 0, algorithms: ["layered"] } });
67
+ return instance;
68
+ }
69
+ /** Runs ELK on a graph and returns the laid-out graph, synchronously. */
70
+ function layoutGraph(elk, graph) {
71
+ let result;
72
+ let failure;
73
+ elk.onmessage = (message) => {
74
+ if (message.data.error)
75
+ failure = message.data.error;
76
+ else
77
+ result = message.data.data;
78
+ };
79
+ try {
80
+ elk.dispatcher.dispatch({
81
+ data: { cmd: "layout", id: 1, graph, layoutOptions: {}, options: {} },
82
+ });
83
+ }
84
+ catch (error) {
85
+ failure = error;
86
+ }
87
+ if (failure !== undefined || !result) {
88
+ const message = failure?.message ??
89
+ failure?.g ??
90
+ String(failure ?? "no result");
91
+ throw new Error(message);
92
+ }
93
+ return result;
94
+ }
95
+ const portId = (node, port) => `${node}\u0000${port}`;
96
+ /** Sides where relations enter and leave a box, by direction. */
97
+ const FLOW_SIDES = {
98
+ LR: { in: "west", out: "east" },
99
+ RL: { in: "east", out: "west" },
100
+ TB: { in: "north", out: "south" },
101
+ BT: { in: "south", out: "north" },
102
+ };
103
+ const COMPASS = new Set(["north", "south", "east", "west"]);
104
+ /** The ELK graph of a request: compound groups, nodes with fixed-position ports, edges. */
105
+ export function elkGraph(request) {
106
+ const root = {
107
+ id: "\u0000root",
108
+ layoutOptions: {
109
+ "elk.algorithm": "layered",
110
+ "elk.direction": DIRECTIONS[request.direction],
111
+ "elk.hierarchyHandling": "INCLUDE_CHILDREN",
112
+ "elk.edgeRouting": "ORTHOGONAL",
113
+ "elk.spacing.nodeNode": String(request.spacing.node),
114
+ "elk.layered.spacing.nodeNodeBetweenLayers": String(request.spacing.layer),
115
+ "elk.spacing.edgeEdge": String(request.spacing.edge),
116
+ "elk.layered.spacing.edgeEdgeBetweenLayers": String(request.spacing.edge),
117
+ "elk.spacing.edgeNode": "20",
118
+ "elk.layered.spacing.edgeNodeBetweenLayers": "20",
119
+ "elk.layered.considerModelOrder.strategy": "NODES_AND_EDGES",
120
+ "elk.layered.crossingMinimization.forceNodeModelOrder": "true",
121
+ "elk.randomSeed": "1",
122
+ // Trees: every parent centred over its children.
123
+ ...(request.algorithm === "tree"
124
+ ? {
125
+ "elk.layered.nodePlacement.strategy": "BRANDES_KOEPF",
126
+ "elk.layered.nodePlacement.bk.fixedAlignment": "BALANCED",
127
+ }
128
+ : {}),
129
+ },
130
+ children: [],
131
+ edges: [],
132
+ };
133
+ const containers = new Map([["", root]]);
134
+ // Groups lay out their children with the same spacing as the root.
135
+ const spacing = Object.fromEntries(Object.entries(root.layoutOptions).filter(([key]) => key.includes(".spacing.")));
136
+ for (const group of request.groups) {
137
+ containers.set(group.id, {
138
+ id: group.id,
139
+ layoutOptions: {
140
+ ...spacing,
141
+ "elk.padding": `[top=${group.padding.top},left=${group.padding.left},bottom=${group.padding.bottom},right=${group.padding.right}]`,
142
+ // A written size is the least the group gets, its children centred inside.
143
+ ...(group.minimum
144
+ ? {
145
+ "elk.nodeSize.constraints": "MINIMUM_SIZE",
146
+ "elk.nodeSize.minimum": `(${group.minimum.width}, ${group.minimum.height})`,
147
+ "elk.contentAlignment": "[H_CENTER, V_CENTER]",
148
+ }
149
+ : {}),
150
+ },
151
+ children: [],
152
+ });
153
+ }
154
+ // Groups nest in their parents; a group whose parent is missing goes to the root.
155
+ for (const group of request.groups) {
156
+ const parent = containers.get(group.parent ?? "") ?? root;
157
+ parent.children.push(containers.get(group.id));
158
+ }
159
+ // Named ports are points that every relation using them shares. A compass port only names a
160
+ // side, so each relation end gets its own port there and ELK spreads them along the side. A
161
+ // box with ports gets a port for its other relation ends too, in the middle of the side where
162
+ // relations enter or leave: ELK would otherwise attach them to a corner.
163
+ const flow = FLOW_SIDES[request.direction];
164
+ const byId = new Map(request.nodes.map((n) => [n.id, n]));
165
+ const named = (node) => byId.get(node)?.ports.filter((p) => !COMPASS.has(p.id)) ?? [];
166
+ const constrained = new Set(request.edges.flatMap((e) => [
167
+ ...(e.sourcePort ? [e.source] : []),
168
+ ...(e.targetPort ? [e.target] : []),
169
+ ]));
170
+ for (const node of request.nodes)
171
+ if (named(node.id).length > 0)
172
+ constrained.add(node.id);
173
+ const endPorts = new Map();
174
+ const endpoint = (edge, node, port, end) => {
175
+ if (port && !COMPASS.has(port))
176
+ return portId(node, port);
177
+ if (!constrained.has(node))
178
+ return node;
179
+ const side = (port ?? (end === "source" ? flow.out : flow.in));
180
+ const id = `\u0001${edge}\u0001${end}`;
181
+ endPorts.set(node, [...(endPorts.get(node) ?? []), { id, side }]);
182
+ return portId(node, id);
183
+ };
184
+ const edges = request.edges.map((edge) => ({
185
+ edge,
186
+ source: endpoint(edge.id, edge.source, edge.sourcePort, "source"),
187
+ target: endpoint(edge.id, edge.target, edge.targetPort, "target"),
188
+ }));
189
+ for (const node of request.nodes) {
190
+ const ports = [...named(node.id)];
191
+ // Relation ends share their side evenly, in the order of the relations.
192
+ const ends = endPorts.get(node.id) ?? [];
193
+ for (const end of ends) {
194
+ const same = ends.filter((e) => e.side === end.side);
195
+ const position = (same.indexOf(end) + 1) / (same.length + 1);
196
+ ports.push({ id: end.id, side: end.side, position });
197
+ }
198
+ // Named ports keep their exact positions; otherwise ELK may reorder ports along a side.
199
+ const constraint = ports.length === 0 ? "UNDEFINED" : named(node.id).length > 0 ? "FIXED_POS" : "FIXED_SIDE";
200
+ const elkNode = {
201
+ id: node.id,
202
+ width: node.width,
203
+ height: node.height,
204
+ layoutOptions: { "elk.portConstraints": constraint },
205
+ ports: ports.map((port) => {
206
+ const horizontal = port.side === "north" || port.side === "south";
207
+ const x = port.side === "west"
208
+ ? -PORT_SIZE
209
+ : port.side === "east"
210
+ ? node.width
211
+ : node.width * port.position;
212
+ const y = port.side === "north"
213
+ ? -PORT_SIZE
214
+ : port.side === "south"
215
+ ? node.height
216
+ : node.height * port.position;
217
+ return {
218
+ id: portId(node.id, port.id),
219
+ x: horizontal ? x - PORT_SIZE / 2 : x,
220
+ y: horizontal ? y : y - PORT_SIZE / 2,
221
+ width: PORT_SIZE,
222
+ height: PORT_SIZE,
223
+ layoutOptions: { "elk.port.side": SIDES[port.side] },
224
+ };
225
+ }),
226
+ };
227
+ (containers.get(node.parent ?? "") ?? root).children.push(elkNode);
228
+ }
229
+ // Groups are containers: relation ends on their sides get ports whose places ELK chooses.
230
+ for (const group of request.groups) {
231
+ const ends = endPorts.get(group.id);
232
+ if (!ends)
233
+ continue;
234
+ const container = containers.get(group.id);
235
+ container.layoutOptions = { ...container.layoutOptions, "elk.portConstraints": "FIXED_SIDE" };
236
+ container.ports = ends.map((end) => ({
237
+ id: portId(group.id, end.id),
238
+ width: PORT_SIZE,
239
+ height: PORT_SIZE,
240
+ layoutOptions: { "elk.port.side": SIDES[end.side] },
241
+ }));
242
+ }
243
+ for (const { edge, source, target } of edges) {
244
+ root.edges.push({
245
+ id: edge.id,
246
+ sources: [source],
247
+ targets: [target],
248
+ // A centred label gets its own space between the layers.
249
+ ...(edge.label
250
+ ? {
251
+ labels: [
252
+ {
253
+ id: `${edge.id}\u0000label`,
254
+ width: edge.label.width,
255
+ height: edge.label.height,
256
+ // ELK ignores labels without text.
257
+ text: edge.id,
258
+ layoutOptions: { "elk.edgeLabels.placement": "CENTER" },
259
+ },
260
+ ],
261
+ }
262
+ : {}),
263
+ layoutOptions: edge.primary
264
+ ? {
265
+ "elk.layered.priority.straightness": "10",
266
+ "elk.layered.priority.direction": "10",
267
+ }
268
+ : {
269
+ "elk.layered.priority.straightness": "0",
270
+ "elk.layered.priority.direction": "0",
271
+ },
272
+ });
273
+ }
274
+ return root;
275
+ }
276
+ /**
277
+ * Absolute positions of the nodes of a laid-out graph, the offsets of every container and the
278
+ * boxes of the containers below the root.
279
+ */
280
+ function collect(node, offset, centers, offsets, boxes) {
281
+ offsets.set(node.id, offset);
282
+ for (const child of node.children ?? []) {
283
+ const origin = { x: offset.x + (child.x ?? 0), y: offset.y + (child.y ?? 0) };
284
+ if (child.children) {
285
+ boxes.set(child.id, { ...origin, width: child.width ?? 0, height: child.height ?? 0 });
286
+ collect(child, origin, centers, offsets, boxes);
287
+ }
288
+ else
289
+ centers.set(child.id, {
290
+ x: origin.x + (child.width ?? 0) / 2,
291
+ y: origin.y + (child.height ?? 0) / 2,
292
+ });
293
+ }
294
+ }
295
+ /** A layout engine backed by ELK's layered algorithm (elkjs, EPL-2.0). */
296
+ export function createElkEngine(options = {}) {
297
+ // The worker loads on first use: about 80 ms that hosts without automatic diagrams never pay.
298
+ let worker;
299
+ return {
300
+ name: "ELK",
301
+ arrange(request) {
302
+ worker ??= startWorker(options.loadWorker ?? installedWorker);
303
+ const graph = layoutGraph(worker, elkGraph(request));
304
+ const nodeCenters = new Map();
305
+ const offsets = new Map();
306
+ const containers = new Map();
307
+ collect(graph, { x: 0, y: 0 }, nodeCenters, offsets, containers);
308
+ const centers = new Map();
309
+ for (const node of request.nodes) {
310
+ const center = nodeCenters.get(node.id);
311
+ if (center)
312
+ centers.set(node.id, { x: round(center.x), y: round(center.y) });
313
+ }
314
+ const routes = new Map();
315
+ for (const edge of graph.edges ?? []) {
316
+ const section = edge.sections?.[0];
317
+ if (!section)
318
+ continue;
319
+ // Edge coordinates are relative to the edge's container.
320
+ const origin = offsets.get(edge.container ?? graph.id) ?? { x: 0, y: 0 };
321
+ const points = [section.startPoint, ...(section.bendPoints ?? []), section.endPoint].map((p) => ({ x: round(p.x + origin.x), y: round(p.y + origin.y) }));
322
+ routes.set(edge.id, points);
323
+ }
324
+ const groups = new Map();
325
+ for (const group of request.groups) {
326
+ const box = containers.get(group.id);
327
+ if (!box)
328
+ continue;
329
+ groups.set(group.id, {
330
+ x: round(box.x),
331
+ y: round(box.y),
332
+ width: round(box.width),
333
+ height: round(box.height),
334
+ });
335
+ }
336
+ return { centers, routes, groups };
337
+ },
338
+ };
339
+ }
340
+ function round(value) {
341
+ return Math.round(value * 100) / 100;
342
+ }
343
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,YAAY,GAAG,8BAA8B,CAAC;AAE3D,uFAAuF;AACvF,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC;AA+CpC,MAAM,UAAU,GAA0D;IACxE,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,IAAI;CACT,CAAC;AAEF,MAAM,KAAK,GAAqC;IAC9C,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;CACb,CAAC;AAEF,uFAAuF;AACvF,MAAM,SAAS,GAAG,CAAC,CAAC;AAYpB;;;GAGG;AACH,SAAS,UAAU,CAAI,EAAU;IAC/B,MAAM,OAAO,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MAAM,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;gBACrC,IAAI,CAAC,GAAG;oBAAE,SAAS;gBACnB,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE;oBACnB,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;oBACf,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;oBACf,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC;oBACvB,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC;iBAC1B,CAAC,CAAC;YACL,CAAC;YACD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QACrC,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,KAAK,CAAC,KAAa;IAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AACvC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,43 @@
1
1
  {
2
2
  "name": "@meltemi/diagrams-layout-elk",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.9.0",
4
+ "description": "The ELK layout engine adapter of Meltemi Diagrams (ELK is EPL-2.0).",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/askenaz-dev/meltemi-diagrams.git",
9
+ "directory": "packages/layout-elk"
10
+ },
11
+ "homepage": "https://github.com/askenaz-dev/meltemi-diagrams/tree/main/packages/layout-elk#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/askenaz-dev/meltemi-diagrams/issues"
14
+ },
15
+ "engines": {
16
+ "node": ">=22.12.0"
17
+ },
18
+ "type": "module",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "default": "./dist/index.js"
23
+ }
24
+ },
25
+ "files": [
26
+ "dist"
27
+ ],
28
+ "dependencies": {
29
+ "elkjs": "0.12.0",
30
+ "@meltemi/diagrams-layout": "1.9.0"
31
+ },
32
+ "devDependencies": {
33
+ "esbuild": "0.28.2",
34
+ "@meltemi/diagrams-model": "1.9.0"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "scripts": {
40
+ "build": "tsc -p tsconfig.build.json",
41
+ "typecheck": "tsc -p tsconfig.json"
42
+ }
6
43
  }