elkrb 1.0.2 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.adoc +371 -0
  3. data/LICENSE +25 -0
  4. data/README.adoc +695 -557
  5. data/exe/elkrb +36 -2
  6. data/lib/elkrb/atomic_destination.rb +53 -0
  7. data/lib/elkrb/best_effort_write.rb +49 -0
  8. data/lib/elkrb/cli/layout_flag_options.rb +54 -0
  9. data/lib/elkrb/cli.rb +155 -82
  10. data/lib/elkrb/command_resolver.rb +186 -0
  11. data/lib/elkrb/commands/batch_command.rb +28 -5
  12. data/lib/elkrb/commands/convert_command.rb +22 -52
  13. data/lib/elkrb/commands/diagram_command.rb +234 -102
  14. data/lib/elkrb/commands/options_command.rb +87 -0
  15. data/lib/elkrb/commands/render_command.rb +6 -1
  16. data/lib/elkrb/commands/validate_command.rb +146 -91
  17. data/lib/elkrb/errors.rb +20 -1
  18. data/lib/elkrb/format_sniffer.rb +362 -0
  19. data/lib/elkrb/geometry/bezier.rb +14 -4
  20. data/lib/elkrb/geometry/point.rb +5 -6
  21. data/lib/elkrb/geometry/rectangle.rb +2 -2
  22. data/lib/elkrb/graph/deep_stringify_keys.rb +30 -0
  23. data/lib/elkrb/graph/edge.rb +89 -3
  24. data/lib/elkrb/graph/graph.rb +43 -15
  25. data/lib/elkrb/graph/label.rb +16 -2
  26. data/lib/elkrb/graph/node.rb +13 -2
  27. data/lib/elkrb/graph/node_constraints.rb +139 -8
  28. data/lib/elkrb/graph/normalize_option_keys.rb +39 -0
  29. data/lib/elkrb/graph/port.rb +29 -21
  30. data/lib/elkrb/graph/read_only_mapping.rb +21 -0
  31. data/lib/elkrb/graphviz_wrapper.rb +152 -44
  32. data/lib/elkrb/layout/algorithm_registry.rb +65 -8
  33. data/lib/elkrb/layout/algorithms/base_algorithm.rb +74 -74
  34. data/lib/elkrb/layout/algorithms/box.rb +47 -20
  35. data/lib/elkrb/layout/algorithms/disco.rb +150 -61
  36. data/lib/elkrb/layout/algorithms/fixed.rb +70 -10
  37. data/lib/elkrb/layout/algorithms/force.rb +145 -86
  38. data/lib/elkrb/layout/algorithms/layered/bk/aligner.rb +104 -0
  39. data/lib/elkrb/layout/algorithms/layered/bk/compactor.rb +87 -0
  40. data/lib/elkrb/layout/algorithms/layered/bk/view.rb +103 -0
  41. data/lib/elkrb/layout/algorithms/layered/bk_node_placer.rb +170 -0
  42. data/lib/elkrb/layout/algorithms/layered/components.rb +170 -0
  43. data/lib/elkrb/layout/algorithms/layered/crossing_minimizer.rb +306 -0
  44. data/lib/elkrb/layout/algorithms/layered/cycle_breaker.rb +118 -49
  45. data/lib/elkrb/layout/algorithms/layered/discovery_order.rb +75 -0
  46. data/lib/elkrb/layout/algorithms/layered/dummy_slot.rb +31 -0
  47. data/lib/elkrb/layout/algorithms/layered/layer_assigner.rb +188 -48
  48. data/lib/elkrb/layout/algorithms/layered/layer_constraints.rb +82 -0
  49. data/lib/elkrb/layout/algorithms/layered/layer_sweep.rb +195 -0
  50. data/lib/elkrb/layout/algorithms/layered/node_placer.rb +251 -36
  51. data/lib/elkrb/layout/algorithms/layered/orthogonal/gap_solver.rb +219 -0
  52. data/lib/elkrb/layout/algorithms/layered/orthogonal/hyper_edge_segment.rb +152 -0
  53. data/lib/elkrb/layout/algorithms/layered/orthogonal/junction_points.rb +58 -0
  54. data/lib/elkrb/layout/algorithms/layered/orthogonal/segment_order.rb +134 -0
  55. data/lib/elkrb/layout/algorithms/layered/orthogonal_router.rb +253 -0
  56. data/lib/elkrb/layout/algorithms/layered/port_order.rb +188 -0
  57. data/lib/elkrb/layout/algorithms/layered/port_spread.rb +42 -0
  58. data/lib/elkrb/layout/algorithms/layered.rb +553 -13
  59. data/lib/elkrb/layout/algorithms/libavoid.rb +951 -187
  60. data/lib/elkrb/layout/algorithms/mrtree.rb +585 -65
  61. data/lib/elkrb/layout/algorithms/radial.rb +188 -29
  62. data/lib/elkrb/layout/algorithms/random.rb +131 -17
  63. data/lib/elkrb/layout/algorithms/rectpacking.rb +28 -40
  64. data/lib/elkrb/layout/algorithms/spore_compaction.rb +57 -100
  65. data/lib/elkrb/layout/algorithms/spore_overlap.rb +78 -84
  66. data/lib/elkrb/layout/algorithms/stress.rb +391 -84
  67. data/lib/elkrb/layout/algorithms/topdown_packing.rb +95 -31
  68. data/lib/elkrb/layout/algorithms/vertiflex.rb +12 -47
  69. data/lib/elkrb/layout/constraints/alignment_constraint.rb +49 -12
  70. data/lib/elkrb/layout/constraints/base_constraint.rb +3 -15
  71. data/lib/elkrb/layout/constraints/constraint_processor.rb +9 -23
  72. data/lib/elkrb/layout/constraints/fixed_position_constraint.rb +22 -13
  73. data/lib/elkrb/layout/constraints/layer_constraint.rb +10 -33
  74. data/lib/elkrb/layout/constraints/relative_position_constraint.rb +94 -50
  75. data/lib/elkrb/layout/edge_router.rb +533 -337
  76. data/lib/elkrb/layout/hierarchical_processor.rb +19 -276
  77. data/lib/elkrb/layout/java_random.rb +59 -0
  78. data/lib/elkrb/layout/label_placer.rb +165 -157
  79. data/lib/elkrb/layout/layout_engine.rb +46 -23
  80. data/lib/elkrb/layout/node_index.rb +149 -0
  81. data/lib/elkrb/layout/polyomino/component_compactor.rb +138 -0
  82. data/lib/elkrb/layout/polyomino/footprint.rb +94 -0
  83. data/lib/elkrb/layout/polyomino/grid.rb +106 -0
  84. data/lib/elkrb/layout/polyomino/packer.rb +95 -0
  85. data/lib/elkrb/layout/polyomino/piece.rb +52 -0
  86. data/lib/elkrb/layout/port_constraint_processor.rb +131 -44
  87. data/lib/elkrb/layout/spore/body.rb +65 -0
  88. data/lib/elkrb/layout/spore/depth_first_compaction.rb +127 -0
  89. data/lib/elkrb/layout/spore/edge_cost.rb +69 -0
  90. data/lib/elkrb/layout/spore/gap.rb +76 -0
  91. data/lib/elkrb/layout/spore/geometry.rb +104 -0
  92. data/lib/elkrb/layout/spore/overlap_sweep.rb +90 -0
  93. data/lib/elkrb/layout/spore/placement.rb +57 -0
  94. data/lib/elkrb/layout/spore/rays.rb +119 -0
  95. data/lib/elkrb/layout/spore/spanning_tree.rb +53 -0
  96. data/lib/elkrb/layout/spore/triangulation.rb +159 -0
  97. data/lib/elkrb/layout_flags.rb +69 -0
  98. data/lib/elkrb/options/decimal.rb +50 -0
  99. data/lib/elkrb/options/element_options.rb +43 -0
  100. data/lib/elkrb/options/elk_padding.rb +20 -14
  101. data/lib/elkrb/options/k_vector.rb +6 -7
  102. data/lib/elkrb/options/k_vector_chain.rb +12 -20
  103. data/lib/elkrb/options/option_map.rb +85 -0
  104. data/lib/elkrb/options/registry.rb +336 -0
  105. data/lib/elkrb/options/resolver.rb +151 -0
  106. data/lib/elkrb/options/spellings.rb +62 -0
  107. data/lib/elkrb/options/unhonoured_report.rb +194 -0
  108. data/lib/elkrb/parsers/elkt/lexer.rb +309 -0
  109. data/lib/elkrb/parsers/elkt/parser.rb +424 -0
  110. data/lib/elkrb/parsers/elkt/resolver.rb +142 -0
  111. data/lib/elkrb/parsers/elkt/token.rb +40 -0
  112. data/lib/elkrb/parsers/elkt_parser.rb +32 -230
  113. data/lib/elkrb/serializers/dot_serializer.rb +342 -54
  114. data/lib/elkrb/serializers/elkt_serializer.rb +386 -155
  115. data/lib/elkrb/version.rb +1 -1
  116. data/lib/elkrb.rb +60 -61
  117. metadata +71 -49
  118. data/.rspec +0 -3
  119. data/.rubocop.yml +0 -11
  120. data/Gemfile +0 -13
  121. data/Rakefile +0 -64
  122. data/benchmarks/README.md +0 -172
  123. data/benchmarks/elkjs_benchmark.js +0 -140
  124. data/benchmarks/elkrb_benchmark.rb +0 -145
  125. data/benchmarks/fixtures/graphs.json +0 -10777
  126. data/benchmarks/generate_report.rb +0 -241
  127. data/benchmarks/generate_test_graphs.rb +0 -154
  128. data/benchmarks/results/elkrb_results.json +0 -280
  129. data/benchmarks/results/elkrb_summary.json +0 -285
  130. data/elkrb.gemspec +0 -39
  131. data/examples/dot_export_demo.rb +0 -133
  132. data/examples/hierarchical_graph.rb +0 -19
  133. data/examples/layout_constraints_demo.rb +0 -272
  134. data/examples/port_constraints_demo.rb +0 -291
  135. data/examples/self_loop_demo.rb +0 -391
  136. data/examples/simple_graph.rb +0 -50
  137. data/examples/spline_routing_demo.rb +0 -235
  138. data/lib/elkrb/graph/layout_options.rb +0 -247
  139. data/sig/elkrb/constraints.rbs +0 -114
  140. data/sig/elkrb/geometry.rbs +0 -61
  141. data/sig/elkrb/graph.rbs +0 -112
  142. data/sig/elkrb/layout.rbs +0 -107
  143. data/sig/elkrb/options.rbs +0 -81
  144. data/sig/elkrb.rbs +0 -32
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e5a30fa3cb9ab9ca9651c2c87944d17066d693b964c4e6a14ddc492c18ff5a4
4
- data.tar.gz: 614b7cb739cc6910aab4787eba5d44bc38efb5381288215216e17c810426ca29
3
+ metadata.gz: 56dca5568676af3dcdaf9f5a4fe3675fcd6710e408d3a93f788f7fe412949655
4
+ data.tar.gz: 8b996680adf2fd9b516f3a96a7997f431869193a63d7b227293ed9de0c61176b
5
5
  SHA512:
6
- metadata.gz: 4c970cc8b6f352be593017faafcaf838b80e2c4071cf220d80e318a8ca87ed0f1febb2ed229e22b5d12b30b1ba84505fd8abd77ad46c53193a9a6972c83b566e
7
- data.tar.gz: e143892acab5429c1345ed987388d5e5d4fd7457380b56514436bac1f178f1031d14d1827744c4308f921ea4cee276b97c308b85f306df68f5b4dfaaa59c7313
6
+ metadata.gz: 7e8cb2d796c37c92ce9703b4c1a0dc3b004006923718b6c2ee765ce64f28f72d061f29a1dfbb2b37fae9d94fd40a43b478b40a85267753e60081422ba2d975ba
7
+ data.tar.gz: c43ffbc85dcd2bc83d45147594e8b7f60dd7222196a5f062154c5bab94ebe1759110598c9bb2839447c7345d0de147c0caa3f1ac21194ff053d657b8cbba2e29
data/CHANGELOG.adoc ADDED
@@ -0,0 +1,371 @@
1
+ = Changelog
2
+
3
+ All notable changes to Elkrb are recorded here.
4
+
5
+ == 2.0.1 (2026-11-02)
6
+
7
+ * The layered algorithm honours `elk.alignment` on a node: LEFT or RIGHT in a
8
+ horizontal layout, TOP or BOTTOM in a vertical one, and CENTER, place the
9
+ node at that side of its layer instead of centring it. The default,
10
+ AUTOMATIC, is unchanged.
11
+
12
+ == 2.0.0 (2026-10-10)
13
+
14
+ === Breaking changes
15
+
16
+ * `NodeConstraints` now writes YAML in snake_case, like every other model in
17
+ the gem. `fixedPosition`, `alignGroup`, `alignDirection`, `relativeTo`,
18
+ `relativeOffset` and `positionPriority` are still read, so old documents keep
19
+ parsing, but they are no longer produced. Code that reads the camelCase keys
20
+ out of generated YAML must be updated. JSON and the other key-value formats
21
+ are unchanged and stay camelCase.
22
+
23
+ * `Elkrb.layout` and `Elkrb::Layout::LayoutEngine.layout` now raise
24
+ `ArgumentError` when the graph is neither a `Hash` nor an
25
+ `Elkrb::Graph::Graph`. Before, other objects were accepted and failed later
26
+ with a `NoMethodError`, or silently did nothing. Anything passing a wrapper
27
+ or a duck-typed graph has to pass a real `Graph` now.
28
+
29
+ * Ruby 3.3 or newer is required. Older Rubies cannot load `lutaml-model` 0.8.
30
+
31
+ * `Elkrb::Graph::LayoutOptions` and its typed getters are gone. `layoutOptions`
32
+ is an open map read by id, so pass a plain String-keyed Hash. Writing a
33
+ Symbol key into the returned map in place now stores the Symbol as given;
34
+ use String keys, or assign the whole map through the setter, which still
35
+ normalises. (#4, #10)
36
+ +
37
+ [source,ruby]
38
+ ----
39
+ # before
40
+ Elkrb::Graph::LayoutOptions.new(algorithm: "layered")
41
+ # after
42
+ { "elk.algorithm" => "layered" }
43
+ ----
44
+
45
+ * Unparseable ELKT raises `Elkrb::ParseError` with a line and column. It used
46
+ to return an empty graph. Rescue `Elkrb::ParseError` where you relied on
47
+ the empty graph. (#17)
48
+ +
49
+ [source,ruby]
50
+ ----
51
+ Elkrb::Parsers::ElktParser.parse("<html><body>not elkt</body></html>")
52
+ # before: {"id":"root","layoutOptions":{},"children":[],"edges":[]}
53
+ # after: Elkrb::ParseError: Unexpected character "<" at line 1, column 1
54
+ ----
55
+
56
+ * Layered defaults to direction `RIGHT` with a 20px gap between layers, and
57
+ cross-axis positions are centred. Set `"elk.direction": "DOWN"` and
58
+ `"elk.layered.spacing.nodeNodeBetweenLayers": 60` to approximate 1.x.
59
+ Layered reads the direction from `elk.direction` and, as a registered alias,
60
+ from the bare `direction` key. (#58)
61
+ +
62
+ Two nodes joined by one edge, default options:
63
+ +
64
+ [source,text]
65
+ ----
66
+ before: a (12, 12) b (12, 102)
67
+ after: a (12, 12) b (62, 12)
68
+ ----
69
+
70
+ * Edge sections start and end on node borders instead of node centres, section
71
+ ids change from `<edge>_section_0` to `<edge>_s0`, and sections gain
72
+ `incomingShape` and `outgoingShape`. Renderers that clipped centre-based
73
+ lines themselves should stop doing so. (#67)
74
+ +
75
+ [source,text]
76
+ ----
77
+ before: {"id":"e_section_0","startPoint":{"x":27.0,"y":27.0},"endPoint":{"x":27.0,"y":117.0}}
78
+ after: {"id":"e_s0","startPoint":{"x":42.0,"y":27.0},"endPoint":{"x":62.0,"y":27.0},
79
+ "incomingShape":"a","outgoingShape":"b"}
80
+ ----
81
+
82
+ * Label `x` and `y` are relative to their owner (node, port or edge) instead of
83
+ absolute, so add the owner's position when drawing. A node label with no
84
+ `elk.nodeLabels.placement` stays at (0, 0); set
85
+ `"elk.nodeLabels.placement": "[H_CENTER,V_CENTER,INSIDE]"` to keep it
86
+ centred. (#65)
87
+ +
88
+ A 60x40 node at (12,12) with a 10x10 label:
89
+ +
90
+ [source,text]
91
+ ----
92
+ before: {"text":"A","x":37.0,"y":27.0}
93
+ after, no placement option: {"text":"A","x":0.0,"y":0.0}
94
+ after, placement as above: {"text":"A","x":25.0,"y":15.0}
95
+ ----
96
+
97
+ * The `_constraint_*` and `_assigned_layer` scratch keys no longer appear in
98
+ output `properties`, and constraint violations go through `Elkrb.logger`
99
+ instead of `Kernel#warn`. `ConstraintProcessor.new` takes `spacing:` and
100
+ `BaseConstraint#applies_to?` is removed. Stop reading the scratch keys.
101
+ (#66)
102
+ +
103
+ [source,text]
104
+ ----
105
+ before: {"id":"a","constraints":{"fixedPosition":false,"layer":1,"positionPriority":0},
106
+ "properties":{"_constraint_layer":1}}
107
+ after: {"id":"a","constraints":{"fixedPosition":false,"layer":1,"positionPriority":0}}
108
+ ----
109
+
110
+ * mrtree and radial coordinates follow ELK's geometry. mrtree honours
111
+ `elk.direction`, and radial reads the graph's edges and centres the root.
112
+ There is nothing to migrate; the old coordinates did not match ELK. (#55)
113
+ +
114
+ Root `r` with children `c1` and `c2`, 30x30 nodes, mrtree:
115
+ +
116
+ [source,text]
117
+ ----
118
+ before: r (12, 12) c1 (12, 102) c2 (62, 102)
119
+ after: r (45, 20) c1 (20, 70) c2 (70, 70)
120
+ ----
121
+
122
+ * Force layout runs a deterministic Fruchterman-Reingold simulation using node
123
+ sizes, with ELK's 50px default padding; explicit padding still wins. Every
124
+ force coordinate changes. (#69)
125
+ +
126
+ The same graph with `"elk.algorithm": "force"`:
127
+ +
128
+ [source,text]
129
+ ----
130
+ before: r (12, 12) c1 (12, 102) c2 (62, 102)
131
+ after: r (115.648, 106.874) c1 (50, 163.785) c2 (181.253, 50)
132
+ ----
133
+
134
+ * libavoid keeps nodes that already have a position and places only the
135
+ unplaced ones, in a grid to the right of the placed nodes. To get a full
136
+ re-layout, position every node or none. (#60)
137
+ +
138
+ `a` at (5, 7), `b` at (200, 9) and an unplaced `c`:
139
+ +
140
+ [source,text]
141
+ ----
142
+ before: a (12, 12) b (62, 12) c (112, 12)
143
+ after: a (12, 12) b (207, 14) c (257, 12)
144
+ ----
145
+
146
+ * An edge written with the elkjs primitive keys `source` and `target` is now a
147
+ real edge, so the graph lays out differently. (#16)
148
+ +
149
+ [source,text]
150
+ ----
151
+ before: {"id":"e"}
152
+ after: {"id":"e","sources":["a"],"targets":["b"],
153
+ "sections":[{"id":"e_s0","startPoint":{"x":42.0,"y":27.0},
154
+ "endPoint":{"x":62.0,"y":27.0},
155
+ "incomingShape":"a","outgoingShape":"b"}]}
156
+ ----
157
+
158
+ * Ports are placed on their node's border. Each port now carries `x`, `y` and
159
+ `side`, and `offset` is filled in, where before a port had only `index` and
160
+ `offset: 0`. Edge sections that start or end at a port move to match. Code
161
+ that computed port positions itself should read these fields. (#70)
162
+ +
163
+ Node `a` with a 6x6 port `p`, edge `p` to `b`:
164
+ +
165
+ [source,text]
166
+ ----
167
+ before: port {"id":"p","index":0,"offset":0.0}
168
+ section start (12.0, 12.0)
169
+ after: port {"id":"p","x":30.0,"y":12.0,"side":"EAST","index":0,"offset":12.0}
170
+ section start (48.0, 27.0)
171
+ ----
172
+
173
+ * Layered orders the nodes within a layer by a barycenter sweep, so cross-axis
174
+ coordinates move whenever a layer holds more than one node.
175
+ `elk.layered.crossingMinimization.strategy` and
176
+ `elk.layered.considerModelOrder.strategy` are now honoured. Set
177
+ `elk.layered.crossingMinimization.strategy` to `NONE` to get insertion order
178
+ back. (#72)
179
+ +
180
+ Edges `a` to `d` and `b` to `c`, default options:
181
+ +
182
+ [source,text]
183
+ ----
184
+ before: a (12, 12) b (12, 62) c (62, 12) d (62, 62)
185
+ after: a (12, 12) b (12, 62) c (62, 62) d (62, 12)
186
+ after, NONE: a (12, 12) b (12, 62) c (62, 12) d (62, 62)
187
+ ----
188
+
189
+ * Self-loops leave and enter the node border and are routed outside the node
190
+ instead of retracing themselves, and their section id changes from
191
+ `<edge>_section_0` to `<edge>_s0`. An edge between two ports of the same node
192
+ is now routed as a loop too. Code that matches the old section id or the old
193
+ geometry must accept the new one. (#74)
194
+ +
195
+ Node `a` (30x30) with an edge from `a` to `a`:
196
+ +
197
+ [source,text]
198
+ ----
199
+ before: {"id":"e_section_0","startPoint":{"x":42.0,"y":27.0},"endPoint":{"x":42.0,"y":37.0},
200
+ "bendPoints":[{"x":74.0,"y":27.0},{"x":74.0,"y":-5.0},{"x":74.0,"y":59.0},{"x":42.0,"y":32.0}]}
201
+ after: {"id":"e_s0","startPoint":{"x":42.0,"y":22.0},"endPoint":{"x":42.0,"y":32.0},
202
+ "bendPoints":[{"x":74.0,"y":22.0},{"x":74.0,"y":32.0}],
203
+ "incomingShape":"a","outgoingShape":"a"}
204
+ ----
205
+
206
+ * `elkrb layout` rejects an unknown switch with `Unknown switches "--bogus"`
207
+ and a `Try: elkrb help layout` line. It used to read the switch as the input
208
+ file and fail with "no such file". `layout --output out.yml` now writes YAML,
209
+ where it wrote JSON; pass `--format json` to keep JSON. (#62)
210
+ +
211
+ `elkrb layout --bogus graph.json`:
212
+ +
213
+ [source,text]
214
+ ----
215
+ before: ERROR: "elkrb layout" was called with arguments ["--bogus", "graph.json"]
216
+ after: Unknown switches "--bogus"
217
+ Try: elkrb help layout
218
+ ----
219
+
220
+ * `sig/` is deleted and `rbs` is no longer a runtime dependency; the
221
+ signatures did not load. The gem ships an explicit file list (`lib`, `exe`,
222
+ `README.adoc`, `LICENSE`, `CHANGELOG.adoc`) instead of every tracked file,
223
+ so benchmarks, examples, docs and dotfiles are no longer packaged. (#77, #84)
224
+
225
+ * Layered routes an edge that spans more than one layer around the nodes in
226
+ between, through a dummy lane with bend points. Nodes in the spanned layers
227
+ can move on the cross axis to make room. Nothing to migrate: the old route
228
+ could cross straight through a node. (#76)
229
+ +
230
+ Edges a->b, b->c and a->c, default options:
231
+ +
232
+ [source,text]
233
+ ----
234
+ before: b (62, 12) a->c bends []
235
+ after: b (62, 37) a->c bends [(77, 2)]
236
+ ----
237
+
238
+ * A graph's own `elk.algorithm` now wins over the `algorithm:` keyword of
239
+ `Elkrb.layout`. Before, the keyword won and the graph's value was ignored.
240
+ The keyword is now the fallback for graphs that name no algorithm. To force
241
+ an algorithm on a graph that already names one, set `elk.algorithm` on the
242
+ graph. (#50)
243
+ +
244
+ A graph with `"elk.algorithm": "box"`, two 30x30 nodes, called with
245
+ `algorithm: "force"`:
246
+ +
247
+ [source,text]
248
+ ----
249
+ before: runs force a (12, 12) b (23.09, 14.34)
250
+ after: runs box a (15, 15) b (60, 15)
251
+ ----
252
+
253
+ * A duplicate node id, or a duplicate port id, within one level raises
254
+ `Elkrb::ValidationError` (`duplicate id: a`). Before, a duplicate node
255
+ failed with a `NoMethodError` and a duplicate port was silently accepted.
256
+ The same id may still appear at different levels. Duplicate edge ids are
257
+ not checked. (#5)
258
+
259
+ * Layered raises `Elkrb::UnsupportedConfigurationException` for an edge with
260
+ more than one source or more than one target (`layered does not support
261
+ hyperedges (edge e)`); it used to lay the graph out.
262
+ Layered also no longer rewrites your edges to break cycles, so a back edge
263
+ keeps its source and target and `properties["reversed"]` is never written.
264
+ Stop reading that key.
265
+ +
266
+ [source,text]
267
+ ----
268
+ cycle a->b, b->c, c->a
269
+ before: e3 {"sources":["a"],"targets":["c"],"properties":{"reversed":true}}
270
+ after: e3 {"sources":["c"],"targets":["a"]}
271
+ ----
272
+
273
+ * The `hierarchical` option does nothing. Hierarchy is detected from nodes that
274
+ have `children`, as before when the option was unset, and `hierarchical`
275
+ is now reported as an unknown option under `strict: true`. A compound node
276
+ is laid out before its parent level, so the parent level places its siblings
277
+ against the compound's computed size instead of the `width` and `height` it
278
+ declared. A compound that names its own `elk.algorithm` is still laid out by
279
+ it, but an unknown name now raises `Elkrb::AlgorithmNotFoundError` where
280
+ the parent's algorithm used to be used quietly. (#63)
281
+ +
282
+ Compound `c` declaring 500x500 and holding two 20x20 nodes, with a sibling
283
+ `z` linked from `c`:
284
+ +
285
+ [source,text]
286
+ ----
287
+ before: c 84x44 z (532, 252)
288
+ after: c 84x44 z (116, 24)
289
+ ----
290
+
291
+ * `fixed` keeps each node where its `x` and `y` put it, and reads
292
+ `elk.position`. It used to move the nodes so the top-left one sat at the
293
+ padding origin and to ignore `elk.position`. `box` uses a different packing,
294
+ so box coordinates and the graph size change. (#59)
295
+ +
296
+ [source,text]
297
+ ----
298
+ fixed, a at (100, 50) and b at (200, 80):
299
+ before: a (12, 12) b (112, 42)
300
+ after: a (100, 50) b (200, 80)
301
+
302
+ box, four 30x30 nodes:
303
+ before: 154x104 n0 (12, 12) n1 (62, 12) n2 (112, 12) n3 (12, 62)
304
+ after: 105x105 n0 (15, 15) n1 (60, 15) n2 (15, 60) n3 (60, 60)
305
+ ----
306
+
307
+ === Added
308
+
309
+ * Edges read the elkjs primitive endpoint keys `source`, `target`,
310
+ `sourcePort` and `targetPort` in every format, YAML included. A blank port
311
+ value is ignored, so a real `source` or `target` still wins. Output stays
312
+ `sources` and `targets` only.
313
+
314
+ * `junctionPoints`, `container`, `incomingSections` and `outgoingSections` on
315
+ edges, and `properties` on labels, are no longer dropped when parsing.
316
+
317
+ * `elkrb options [ALGORITHM]` lists every layout option with its type,
318
+ default, status, aliases and the algorithms that read it; `--json` prints
319
+ the same as JSON. `elkrb algorithms --json` is new. `batch` and `diagram`
320
+ accept the same layout flags as `layout`, including `--spacing`
321
+ and `--layer-spacing`. (#62)
322
+
323
+ * A `LICENSE` file (BSD-2-Clause, as the gemspec already declared) ships with
324
+ the gem. (#77)
325
+
326
+ === Fixed
327
+
328
+ * `Rectangle#position` and `Rectangle#center` no longer raise.
329
+
330
+ * `Bezier.calculate_curve` with fewer than two sample points returns copies of
331
+ the two endpoints instead of the caller's own `Point` objects. Its fifth
332
+ parameter is now named `sample_count`, which is what it always counted.
333
+
334
+ * Validation now checks nested container scopes, collection shapes, finite
335
+ dimensions and option enum values. It rejects ambiguous hierarchical edge
336
+ endpoints, and the `HORIZONTAL` and `VERTICAL` direction aliases produce
337
+ valid layouts. Validation output remains readable on US-ASCII terminals.
338
+
339
+ * Failed conversions and Graphviz renders preserve an existing destination
340
+ instead of replacing it with a partial result.
341
+
342
+ * ELKT output preserves representable graph geometry, edge sections, ports and
343
+ hierarchy. DOT output keeps same-named nodes in different hierarchy scopes
344
+ distinct and routes scoped and hierarchical port endpoints without creating
345
+ phantom nodes.
346
+
347
+ * `elk.selfLoopOffset` is honoured when it is carried by an edge or its node.
348
+
349
+ === Changed
350
+
351
+ * `lutaml-model` is now capped below 0.9.
352
+
353
+ * Layered layout uses ELK-style Brandes-Kopf placement, layer sweeps, discovery
354
+ and port ordering, per-gap orthogonal routing with junction points, and
355
+ connected-component packing. Node coordinates and edge routes can differ
356
+ from earlier releases.
357
+
358
+ * DisCo defaults to ELK's polyomino component compaction. Set the component
359
+ arrangement or compaction strategy to `ROW` to retain row arrangement.
360
+
361
+ * SPOrE overlap removal and compaction follow Java ELK's triangulation and tree
362
+ algorithms and honour their registered processing options.
363
+
364
+ * Stress layout uses ELK-compatible deterministic seeding and the weighted
365
+ stress objective. Large line-metric graphs with the default iteration limit
366
+ use an exact projection, avoiding the previous quadratic timeout.
367
+
368
+ === Security
369
+
370
+ * Release automation uses SHA-pinned actions, least-privilege jobs and
371
+ RubyGems OIDC trusted publishing instead of a long-lived API key.
data/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ BSD 2-Clause License
2
+
3
+ Copyright (c) Ribose Inc.
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.