@grethel-labs/excaliplant 0.19.1 → 0.19.4

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 CHANGED
@@ -218,6 +218,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
218
218
 
219
219
  ### Fixed
220
220
 
221
+ - Release publishing now validates the npm token and package/tag version
222
+ before running the expensive release gate, skips `npm publish` when the
223
+ exact version is already present on npm, and still creates the GitHub
224
+ release/pages artifacts on idempotent release reruns.
221
225
  - Connection arrows now always inherit the **outline colour of their
222
226
  source box** (not the owning plane's colour), and arrowheads
223
227
  (`arrow`, `triangle`, `triangle_outline`, `diamond`,
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![node](https://img.shields.io/node/v/@grethel-labs/excaliplant.svg)](https://nodejs.org)
8
8
  [![license](https://img.shields.io/npm/l/@grethel-labs/excaliplant.svg)](./LICENSE)
9
9
 
10
- > PlantUML → ELK layout → Excalidraw renderer with a plugin-based parser.  ·  **v0.19.1**  ·  258 tests  ·  MIT
10
+ > PlantUML → ELK layout → Excalidraw renderer with a plugin-based parser.  ·  **v0.19.4**  ·  262 tests  ·  MIT
11
11
 
12
12
  `@grethel-labs/excaliplant` takes PlantUML source, runs it through a plugin-based
13
13
  parser, lays it out with [ELK](https://github.com/kieler/elkjs), and
@@ -138,6 +138,8 @@ icon placeholders.
138
138
 
139
139
  See the full [Sequence Diagram Component Coverage](./docs/sequence-components.md) for detailed examples and support matrix.
140
140
 
141
+ See the generated [Diagram Module Coverage Gallery](./docs/module-coverage.md) for rendered small and complex examples across diagram modules. The gallery includes SVG artefacts for edge cases, overlap-prone layouts, functional decisions, deliberate design choices, wild feature combinations, and repo-derived examples where the diagram type naturally maps to the source tree.
142
+
141
143
  ### UML graph diagram coverage
142
144
 
143
145
  Class diagrams support the common PlantUML class-family declarations
@@ -292,7 +294,7 @@ presentation, link, text-markup, skinparam, and `<style>` handling.
292
294
  npm test
293
295
  ```
294
296
 
295
- Ships with **258 tests** across functional, edge-case,
297
+ Ships with **262 tests** across functional, edge-case,
296
298
  security (XSS / ReDoS / prototype-pollution), and self-introspection
297
299
  suites.
298
300
 
@@ -395,21 +397,50 @@ excaliplant
395
397
  │ └── excaliplant.mjs
396
398
  ├── docs
397
399
  │ ├── ressources
400
+ │ │ ├── module-coverage
401
+ │ │ │ ├── archimate
402
+ │ │ │ ├── chart
403
+ │ │ │ ├── chen
404
+ │ │ │ ├── chronology
405
+ │ │ │ ├── class
406
+ │ │ │ ├── component
407
+ │ │ │ ├── deployment
408
+ │ │ │ ├── ditaa
409
+ │ │ │ ├── ebnf
410
+ │ │ │ ├── files
411
+ │ │ │ ├── gantt
412
+ │ │ │ ├── ie
413
+ │ │ │ ├── json
414
+ │ │ │ ├── math
415
+ │ │ │ ├── mindmap
416
+ │ │ │ ├── nwdiag
417
+ │ │ │ ├── object
418
+ │ │ │ ├── regex
419
+ │ │ │ ├── salt
420
+ │ │ │ ├── sequence
421
+ │ │ │ ├── state
422
+ │ │ │ ├── timing
423
+ │ │ │ ├── wbs
424
+ │ │ │ └── yaml
398
425
  │ │ └── sequence
399
426
  │ │ ├── puml
400
427
  │ │ └── svg
401
428
  │ ├── scripts
402
429
  │ │ ├── build-docs.mjs
430
+ │ │ ├── build-module-coverage.mjs
403
431
  │ │ ├── build-sequence-coverage.mjs
404
432
  │ │ ├── check-build-manifest.mjs
405
433
  │ │ ├── config.mjs
406
434
  │ │ ├── extract-api.mjs
407
435
  │ │ ├── extract-docs.mjs
408
436
  │ │ ├── file-tree.mjs
437
+ │ │ ├── module-coverage-sources.mjs
409
438
  │ │ └── self-diagrams.mjs
410
439
  │ ├── API.md
411
440
  │ ├── API.template.md.njk
412
441
  │ ├── README.template.md.njk
442
+ │ ├── module-coverage.md
443
+ │ ├── module-coverage.template.md.njk
413
444
  │ ├── sequence-components.md
414
445
  │ ├── sequence-components.template.md.njk
415
446
  │ └── src-structure-refactor-plan.md
@@ -792,6 +823,7 @@ excaliplant
792
823
  │ ├── functional_more.test.mjs
793
824
  │ ├── merge_driver.test.mjs
794
825
  │ ├── modular_architecture.test.mjs
826
+ │ ├── module_coverage.test.mjs
795
827
  │ ├── object_components.test.mjs
796
828
  │ ├── plantuml.test.mjs
797
829
  │ ├── security.test.mjs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grethel-labs/excaliplant",
3
- "version": "0.19.1",
3
+ "version": "0.19.4",
4
4
  "description": "PlantUML → ELK layout → Excalidraw renderer with a plugin-based parser.",
5
5
  "type": "module",
6
6
  "main": "index.mjs",
@@ -51,7 +51,7 @@
51
51
  },
52
52
  "scripts": {
53
53
  "pretest": "node scripts/clean-test-output.mjs",
54
- "test": "node --test tests/edge_cases.test.mjs tests/functional_more.test.mjs tests/merge_driver.test.mjs tests/modular_architecture.test.mjs tests/plantuml.test.mjs tests/security.test.mjs tests/self_introspection.test.mjs tests/sequence_components.test.mjs tests/class_components.test.mjs tests/component_components.test.mjs tests/deployment_components.test.mjs tests/usecase_components.test.mjs tests/object_components.test.mjs tests/state_components.test.mjs src/diagrams/timing/tests/timing_components.test.mjs src/diagrams/regex/tests/regex_components.test.mjs src/diagrams/ebnf/tests/ebnf_components.test.mjs src/diagrams/json/tests/json_components.test.mjs src/diagrams/yaml/tests/yaml_components.test.mjs src/diagrams/math/tests/math_components.test.mjs src/diagrams/nwdiag/tests/nwdiag_components.test.mjs src/diagrams/salt/tests/salt_components.test.mjs src/diagrams/archimate/tests/archimate_components.test.mjs src/diagrams/gantt/tests/gantt_components.test.mjs src/diagrams/mindmap/tests/mindmap_components.test.mjs src/diagrams/wbs/tests/wbs_components.test.mjs src/diagrams/chronology/tests/chronology_components.test.mjs src/diagrams/files/tests/files_components.test.mjs src/diagrams/ie/tests/ie_components.test.mjs src/diagrams/chen/tests/chen_components.test.mjs src/diagrams/ditaa/tests/ditaa_components.test.mjs src/diagrams/chart/tests/chart_components.test.mjs tests/style.test.mjs",
54
+ "test": "node --test tests/edge_cases.test.mjs tests/functional_more.test.mjs tests/merge_driver.test.mjs tests/modular_architecture.test.mjs tests/plantuml.test.mjs tests/security.test.mjs tests/self_introspection.test.mjs tests/module_coverage.test.mjs tests/sequence_components.test.mjs tests/class_components.test.mjs tests/component_components.test.mjs tests/deployment_components.test.mjs tests/usecase_components.test.mjs tests/object_components.test.mjs tests/state_components.test.mjs src/diagrams/timing/tests/timing_components.test.mjs src/diagrams/regex/tests/regex_components.test.mjs src/diagrams/ebnf/tests/ebnf_components.test.mjs src/diagrams/json/tests/json_components.test.mjs src/diagrams/yaml/tests/yaml_components.test.mjs src/diagrams/math/tests/math_components.test.mjs src/diagrams/nwdiag/tests/nwdiag_components.test.mjs src/diagrams/salt/tests/salt_components.test.mjs src/diagrams/archimate/tests/archimate_components.test.mjs src/diagrams/gantt/tests/gantt_components.test.mjs src/diagrams/mindmap/tests/mindmap_components.test.mjs src/diagrams/wbs/tests/wbs_components.test.mjs src/diagrams/chronology/tests/chronology_components.test.mjs src/diagrams/files/tests/files_components.test.mjs src/diagrams/ie/tests/ie_components.test.mjs src/diagrams/chen/tests/chen_components.test.mjs src/diagrams/ditaa/tests/ditaa_components.test.mjs src/diagrams/chart/tests/chart_components.test.mjs tests/style.test.mjs",
55
55
  "typecheck": "tsc -p tsconfig.json",
56
56
  "build:docs": "node docs/scripts/build-docs.mjs",
57
57
  "build:api": "node docs/scripts/build-docs.mjs",
@@ -17,6 +17,29 @@ Junction_Or JunctionOr
17
17
  archimate #Technology "VPN Server" as vpnServerA <<technology-device>>
18
18
  GO -up-> JunctionOr
19
19
  STOP -down-> JunctionAnd
20
+ @enduml`,
21
+ },
22
+ {
23
+ name: "feature-combination",
24
+ title: "Feature combination",
25
+ description:
26
+ "Combines ArchiMate elements, technology stereotypes, junctions, rectangles and labelled flows.",
27
+ source: `@startuml
28
+ archimate #Business "Documentation Reader" as reader <<business-actor>>
29
+ archimate #Application "excaliplant API" as api <<application-component>>
30
+ archimate #Technology "SVG Renderer" as svgRenderer <<technology-service>>
31
+ archimate #Technology "Generated Docs Site" as docsSite <<technology-artifact>>
32
+ rectangle ManualReview #lightgreen
33
+ rectangle ReleaseBlocked #red
34
+ Junction_And CoverageGate
35
+ Junction_Or DecisionPoint
36
+ reader --> api : submits PlantUML example
37
+ api --> svgRenderer : parses, lays out and renders
38
+ svgRenderer --> CoverageGate : emits SVG artifact with long label
39
+ CoverageGate --> ManualReview : examples are readable
40
+ CoverageGate --> DecisionPoint : issues found
41
+ DecisionPoint --> ReleaseBlocked : overlap or clipped text
42
+ DecisionPoint --> docsSite : publish gallery
20
43
  @enduml`,
21
44
  },
22
45
  ];
@@ -9,4 +9,23 @@ export const chartCoverageExamples = [
9
9
  name: "grouped",
10
10
  source: `@startchart\nh-axis [Q1, Q2]\nstackMode grouped\nbar "Revenue" [45, 62]\nbar "Profit" [35, 48]\n@endchart`,
11
11
  },
12
+ {
13
+ name: "feature-combination",
14
+ title: "Feature combination",
15
+ description:
16
+ "Combines axes, options, bars, lines, areas, scatter series, colours and uneven value ranges.",
17
+ source: `@startchart
18
+ title "Coverage health across modules"
19
+ h-axis [parser, model, layout, svg, docs]
20
+ v-axis 0 --> 100
21
+ legend right
22
+ grid true
23
+ annotation "Complex examples include overlap and label-fit decisions"
24
+ stackMode grouped
25
+ bar "Small fixtures" [90, 80, 75, 70, 85] #2c7fb8
26
+ line "Wild combinations" [40, 55, 65, 78, 92] #f03b20
27
+ area "Generated docs" [20, 35, 55, 80, 95] #31a354
28
+ scatter "Manual review points" [15, 60, 45, 88, 73] #756bb1
29
+ @endchart`,
30
+ },
12
31
  ];
@@ -26,6 +26,43 @@ relationship Birthplace {
26
26
  }
27
27
  Person -N- Birthplace
28
28
  Birthplace -1- Location
29
+ @endchen`,
30
+ },
31
+ {
32
+ name: "feature-combination",
33
+ title: "Feature combination",
34
+ description: "Combines Chen entities, relationships, keys, attributes and cardinality labels.",
35
+ source: `@startchen
36
+ left to right direction
37
+ entity Module {
38
+ documented
39
+ }
40
+ entity Example {
41
+ rendered
42
+ }
43
+ entity Test {
44
+ automated
45
+ }
46
+ relationship Covers {
47
+ }
48
+ relationship Validates {
49
+ }
50
+ key ModuleName {
51
+ }
52
+ attribute ExampleSource {
53
+ }
54
+ derived_attribute SvgArtifact {
55
+ }
56
+ multi_valued_attribute EdgeCases {
57
+ }
58
+ Module -1- Covers : owns coverage examples
59
+ Covers -N- Example : includes small and complex cases
60
+ Example -N- Validates : rendered through pipeline
61
+ Validates -N- Test : asserted by module coverage test
62
+ Module - ModuleName
63
+ Example - ExampleSource
64
+ Example - SvgArtifact
65
+ Example - EdgeCases
29
66
  @endchen`,
30
67
  },
31
68
  ];
@@ -14,6 +14,24 @@ export const chronologyCoverageExamples = [
14
14
  source: `@startchronology
15
15
  starts 2024-01-01
16
16
  [Implementation] lasts from 2024-01-02 to 2024-01-31
17
+ @endchronology`,
18
+ },
19
+ {
20
+ name: "feature-combination",
21
+ title: "Feature combination",
22
+ description: "Combines global bounds, milestone labels, ranges and labelled dependencies.",
23
+ source: `@startchronology
24
+ starts 2026-01-01
25
+ ends 2026-03-31
26
+ [Kickoff: module inventory] happens on 2026-01-05
27
+ [Coverage examples] lasts from 2026-01-06 to 2026-01-30
28
+ [SVG gallery: generated documentation] happens on 2026-02-03
29
+ [Regression test suite] lasts from 2026-02-04 to 2026-02-21
30
+ [Release review: examples, overlap checks and manifest] happens on 2026-03-02
31
+ [Kickoff] -> [Coverage examples] : source modules selected
32
+ [Coverage examples] -> [SVG gallery] : render all examples
33
+ [SVG gallery] -> [Regression test suite] : docs and tests share data
34
+ [Regression test suite] -> [Release review] : validation complete
17
35
  @endchronology`,
18
36
  },
19
37
  ];
@@ -6,4 +6,23 @@ export const ditaaCoverageExamples = [
6
6
  name: "inline-options",
7
7
  source: `@startuml\nditaa(--no-shadows, scale=0.7)\n+---+\n| A |\n+---+\n@enduml`,
8
8
  },
9
+ {
10
+ name: "feature-combination",
11
+ title: "Feature combination",
12
+ description:
13
+ "Combines inline options, dense ASCII layout, labels and arrow-like connectors in one rendered box.",
14
+ source: `@startuml
15
+ ditaa(--no-shadows, scale=0.8)
16
+ +-------------------+ +-----------------------+
17
+ | Parser examples | ----> | Shared coverage data |
18
+ | small fixtures | | small + wild cases |
19
+ +-------------------+ +-----------+-----------+
20
+ |
21
+ v
22
+ +-------------------+ +-----------------------+
23
+ | SVG gallery | <---- | module_coverage.test |
24
+ | generated docs | | render every example |
25
+ +-------------------+ +-----------------------+
26
+ @enduml`,
27
+ },
9
28
  ];
@@ -16,6 +16,23 @@ special = ? a ?;
16
16
  optional = [a];
17
17
  zero_or_more = {a};
18
18
  group = (a | b), c;
19
+ @endebnf`,
20
+ },
21
+ {
22
+ name: "feature-combination",
23
+ title: "Feature combination",
24
+ description:
25
+ "Combines terminals, non-terminals, alternatives, optional groups and repetitions in one grammar.",
26
+ source: `@startebnf
27
+ title Coverage example grammar
28
+ diagram = start, { statement }, end;
29
+ start = "@start", ("uml" | "json" | "yaml" | "mindmap");
30
+ statement = element | connection | note | style;
31
+ element = identifier, [alias], [stereotype];
32
+ connection = identifier, arrow, identifier, [ ":" , label ];
33
+ label = ? long human readable text that must stay inside the rendered node ?;
34
+ style = "skinparam", identifier, value;
35
+ end = "@end";
19
36
  @endebnf`,
20
37
  },
21
38
  ];
@@ -16,6 +16,25 @@ export const filesCoverageExamples = [
16
16
  /a/a1.txt
17
17
  /b/b0.txt
18
18
  /a/a2.txt
19
+ @endfiles`,
20
+ },
21
+ {
22
+ name: "feature-combination",
23
+ title: "Feature combination",
24
+ description:
25
+ "Combines repeated folders, deep paths, generated documentation outputs and test fixtures.",
26
+ source: `@startfiles
27
+ /src/diagrams/sequence/docs/coverage_examples.mjs
28
+ /src/diagrams/sequence/tests/sequence_components.test.mjs
29
+ /src/diagrams/component/docs/coverage_examples.mjs
30
+ /src/diagrams/component/tests/component_components.test.mjs
31
+ /src/diagrams/files/docs/coverage_examples.mjs
32
+ /docs/scripts/build-docs.mjs
33
+ /docs/scripts/build-module-coverage.mjs
34
+ /docs/module-coverage.md
35
+ /docs/ressources/module-coverage/files/svg/feature-combination.svg
36
+ /tests/module_coverage.test.mjs
37
+ /AGENTS.md
19
38
  @endfiles`,
20
39
  },
21
40
  ];
@@ -9,4 +9,24 @@ export const ganttCoverageExamples = [
9
9
  name: "dated-starts",
10
10
  source: `@startgantt\nProject starts 2020-07-01\n[Prototype design] requires 15 days\n[Prototype design] starts 2020-07-01\n@endgantt`,
11
11
  },
12
+ {
13
+ name: "feature-combination",
14
+ title: "Feature combination",
15
+ description:
16
+ "Combines project starts, explicit dates, milestones, dependencies and long dependency labels.",
17
+ source: `@startgantt
18
+ Project starts 2026-01-05
19
+ -- Repository release train --
20
+ [Audit current diagram modules] requires 4 days
21
+ [Audit current diagram modules] starts 2026-01-05
22
+ [Add small coverage examples] requires 5 days
23
+ [Add large combination examples] requires 6 days
24
+ [Render SVG documentation gallery] requires 3 days
25
+ [Release validation checkpoint] happens 2026-01-23
26
+ [Audit current diagram modules] then [Add small coverage examples] : parser fixtures are stable
27
+ [Add small coverage examples] then [Add large combination examples] : broaden edge cases
28
+ [Add large combination examples] then [Render SVG documentation gallery] : verify overlap, label fit and layout decisions
29
+ [Render SVG documentation gallery] then [Release validation checkpoint] : generated docs reviewed
30
+ @endgantt`,
31
+ },
12
32
  ];
@@ -19,6 +19,40 @@ entity Entität01 {
19
19
  * vorgeschriebenes_attribut
20
20
  optionales_attribut
21
21
  }
22
+ @enduml`,
23
+ },
24
+ {
25
+ name: "feature-combination",
26
+ title: "Feature combination",
27
+ description:
28
+ "Combines IE entities, attributes, dashed and solid crow-foot relationships and long labels.",
29
+ source: `@startuml
30
+ entity Customer {
31
+ * customer_id
32
+ --
33
+ * email
34
+ support_tier
35
+ }
36
+ entity Order {
37
+ * order_id
38
+ --
39
+ * placed_at
40
+ status
41
+ }
42
+ entity Invoice {
43
+ * invoice_id
44
+ --
45
+ total_amount
46
+ }
47
+ entity SupportTicket {
48
+ * ticket_id
49
+ --
50
+ severity
51
+ }
52
+ Customer ||--o{ Order : places many orders over time
53
+ Order ||--|| Invoice : produces billing record
54
+ Customer }o..o{ SupportTicket : may open optional support cases with long label
55
+ SupportTicket }|..|| Order : can reference one order
22
56
  @enduml`,
23
57
  },
24
58
  ];
@@ -20,6 +20,35 @@ export const jsonCoverageExamples = [
20
20
  "lastName": "Smith",
21
21
  "address": { "city": "New York" }
22
22
  }
23
+ @endjson`,
24
+ },
25
+ {
26
+ name: "feature-combination",
27
+ title: "Feature combination",
28
+ description:
29
+ "Combines nested objects, arrays, booleans, nulls, long strings and highlight directives.",
30
+ source: `@startjson
31
+ #highlight "coverage" / "modules" / 1 / "status"
32
+ {
33
+ "repository": "grethel-labs/excaliplant",
34
+ "coverage": {
35
+ "generatedDocs": true,
36
+ "modules": [
37
+ {
38
+ "kind": "sequence",
39
+ "status": "reference quality",
40
+ "examples": ["small", "fragment-heavy", "style-heavy"]
41
+ },
42
+ {
43
+ "kind": "files",
44
+ "status": "repo-derived dynamic example",
45
+ "examples": ["project-tree", "merged-paths", "feature-combination"]
46
+ }
47
+ ],
48
+ "reviewNotes": "Long values exercise wrapping and SVG table sizing decisions.",
49
+ "openRisk": null
50
+ }
51
+ }
23
52
  @endjson`,
24
53
  },
25
54
  ];
@@ -13,4 +13,16 @@ f(t)=(a_0)/2 + sum_(n=1)^oo a_n cos((n pi t)/L)
13
13
  \\sum_{i=0}^{n-1} (a_i + b_i^2)
14
14
  @endlatex`,
15
15
  },
16
+ {
17
+ name: "feature-combination",
18
+ title: "Feature combination",
19
+ description:
20
+ "Combines a title with a multiline formula and descriptive variables that force text wrapping.",
21
+ source: `@startmath
22
+ title Coverage score formula
23
+ coverage_score =
24
+ (small_examples + large_examples + rendered_svg_checks) /
25
+ max(1, supported_features + documented_design_decisions)
26
+ @endmath`,
27
+ },
16
28
  ];
@@ -16,6 +16,29 @@ export const mindmapCoverageExamples = [
16
16
  # root node
17
17
  ## first level
18
18
  ### second level
19
+ @endmindmap`,
20
+ },
21
+ {
22
+ name: "feature-combination",
23
+ title: "Feature combination",
24
+ description:
25
+ "Combines markdown hierarchy, long node labels, branch balancing directives and mixed depth.",
26
+ source: `@startmindmap
27
+ right side
28
+ # excaliplant coverage strategy
29
+ ## parser plugins
30
+ ### small examples per syntax rule
31
+ ### strict edge case fixtures with comments and quoted labels
32
+ ## layout validation
33
+ ### long labels that force wrapping inside generated SVG output
34
+ ### sibling branches that should keep readable separation
35
+ ## documentation
36
+ ### generated module coverage gallery
37
+ ### repo-derived examples that change with the source tree
38
+ left side
39
+ ## release confidence
40
+ ### local gates
41
+ ### rendered artifacts reviewed by humans and tests
19
42
  @endmindmap`,
20
43
  },
21
44
  ];
@@ -26,6 +26,33 @@ nwdiag {
26
26
  }
27
27
  web01 -- db01 : SQL
28
28
  }
29
+ @endnwdiag`,
30
+ },
31
+ {
32
+ name: "feature-combination",
33
+ title: "Feature combination",
34
+ description:
35
+ "Combines multiple networks, groups, node attributes and labelled cross-network links.",
36
+ source: `@startnwdiag
37
+ nwdiag {
38
+ network docs {
39
+ address = "10.0.10.0/24"
40
+ builder [address = "10.0.10.10", description = "docs build script"];
41
+ gallery [address = "10.0.10.20", shape = "storage", description = "module SVG gallery"];
42
+ }
43
+ network tests {
44
+ address = "10.0.20.0/24"
45
+ runner [address = "10.0.20.10", description = "node:test coverage renderer"];
46
+ fixtures [address = "10.0.20.30", description = "coverage_examples modules"];
47
+ }
48
+ group review {
49
+ maintainer [description = "manual SVG review"];
50
+ }
51
+ fixtures -- runner : every example renders
52
+ runner -- builder : shared coverage source data
53
+ builder -- gallery : writes generated SVG and puml
54
+ maintainer -- gallery : checks layout and label readability
55
+ }
29
56
  @endnwdiag`,
30
57
  },
31
58
  ];
@@ -13,6 +13,16 @@ title Regex literals and classes
13
13
  source: `@startregex
14
14
  title Regex groups and repetition
15
15
  ^(ab?)+|(?<word>\\p{L}{1,3})$
16
+ @endregex`,
17
+ },
18
+ {
19
+ name: "feature-combination",
20
+ title: "Feature combination",
21
+ description:
22
+ "Combines anchors, named groups, alternatives, classes, repetitions and escaped literals.",
23
+ source: `@startregex
24
+ title Coverage source matcher
25
+ ^(?<kind>sequence|component|files|json|yaml)[-_](?<case>small|large|wild|feature-combination)\\.(puml|svg)$|docs\\/ressources\\/module-coverage\\/.+
16
26
  @endregex`,
17
27
  },
18
28
  ];
@@ -25,6 +25,28 @@ export const saltCoverageExamples = [
25
25
  .
26
26
  " "
27
27
  }
28
+ @endsalt`,
29
+ },
30
+ {
31
+ name: "feature-combination",
32
+ title: "Feature combination",
33
+ description:
34
+ "Combines labels, buttons, radios, checkboxes, inputs, dropdowns, tabs and grid-like rows.",
35
+ source: `@startsalt
36
+ {
37
+ /Coverage/
38
+ [Render module gallery]
39
+ [X] Small examples exist
40
+ [X] Large combination examples exist
41
+ [] Manual SVG review pending
42
+ () Draft
43
+ (X) Ready
44
+ "Long free text field that should wrap into a readable rendered node"
45
+ ^release:minor^
46
+ | Module | Examples | SVG |
47
+ | sequence | many | generated |
48
+ | files | repo-derived | generated |
49
+ }
28
50
  @endsalt`,
29
51
  },
30
52
  ];
@@ -15,6 +15,28 @@ export const wbsCoverageExamples = [
15
15
  + New Job
16
16
  ++ Decide on Job Requirements
17
17
  +++ Identity gaps
18
+ @endwbs`,
19
+ },
20
+ {
21
+ name: "feature-combination",
22
+ title: "Feature combination",
23
+ description:
24
+ "Combines plus and star hierarchy styles with long work-package labels and uneven depth.",
25
+ source: `@startwbs
26
+ left direction
27
+ * Diagram module quality gate
28
+ ** Small focused fixtures
29
+ *** Parser acceptance examples
30
+ *** Renderer smoke SVGs
31
+ ** Large integration fixtures
32
+ *** Edge labels, nested containers and dense sibling groups
33
+ *** Wild combinations that document deliberate design decisions
34
+ + Dynamic documentation
35
+ ++ Repo-derived file coverage diagram
36
+ ++ Generated SVG gallery linked from README
37
+ + Release readiness
38
+ ++ Test every coverage example through renderPlantUml
39
+ +++ Keep generated docs in the build manifest
18
40
  @endwbs`,
19
41
  },
20
42
  ];
@@ -19,6 +19,32 @@ $size: Large
19
19
  &color: Red
20
20
  ❤: Heart
21
21
  ‰: Per mille
22
+ @endyaml`,
23
+ },
24
+ {
25
+ name: "feature-combination",
26
+ title: "Feature combination",
27
+ description:
28
+ "Combines nested mappings, sequences, booleans, nulls and long strings for data rendering.",
29
+ source: `@startyaml
30
+ repository: grethel-labs/excaliplant
31
+ coverage:
32
+ generatedDocs: true
33
+ modules:
34
+ - kind: sequence
35
+ profile: reference-quality
36
+ examples:
37
+ - small
38
+ - complex-fragments
39
+ - styled-lifecycle
40
+ - kind: files
41
+ profile: repo-derived-dynamic
42
+ examples:
43
+ - project-tree
44
+ - merged-paths
45
+ - feature-combination
46
+ reviewNotes: Long scalar values should remain readable in the generated SVG output.
47
+ openRisk: null
22
48
  @endyaml`,
23
49
  },
24
50
  ];
@@ -116,7 +116,8 @@ function sizeSubplane(sub, planeContentWidth) {
116
116
  */
117
117
  function sizeBox(box, width) {
118
118
  box.width = width;
119
- const innerWidth = Math.max(20, width - SIZING.boxPaddingX * 2);
119
+ let innerWidth = Math.max(20, width - SIZING.boxPaddingX * 2);
120
+ if (box.shape === "diamond") innerWidth = diamondTextWidth(width);
120
121
  // Auto-wrap the title so long labels stay inside the box. Manual
121
122
  // line breaks ("\n") are preserved by wrapping each segment
122
123
  // independently. `measureFitted` shrinks the font size when a
@@ -260,7 +261,7 @@ function sizeBox(box, width) {
260
261
  }
261
262
  break;
262
263
  case "diamond":
263
- shapeMin = Math.max(shapeMin, 72);
264
+ shapeMin = Math.max(shapeMin, 72, textHeight * 2.15);
264
265
  break;
265
266
  case "note":
266
267
  shapeMin = Math.max(shapeMin, 50);
@@ -312,6 +313,17 @@ function sizeBox(box, width) {
312
313
  box.height = Math.max(shapeMin, textHeight, connectionsHeight);
313
314
  }
314
315
 
316
+ /**
317
+ * Approximate the widest stable text band inside a diamond. A diamond's
318
+ * bounding box is much wider at the centre than near its top/bottom, so
319
+ * titles must wrap against a narrower measure than rectangular boxes.
320
+ * @param {number} width Diamond bounding-box width.
321
+ * @returns {number} Text width that stays visually inside the diamond.
322
+ */
323
+ function diamondTextWidth(width) {
324
+ return Math.max(40, Math.floor(width * 0.46));
325
+ }
326
+
315
327
  /**
316
328
  * Compute the inner content width of a plane based on its widest child.
317
329
  * @param {import("../model/diagram.mjs").Plane} plane Plane to inspect.
@@ -1171,19 +1171,79 @@ function renderRectangleShape(box, color, elements) {
1171
1171
  function renderDiamondShape(box, color, elements) {
1172
1172
  const cx = box.x + box.width / 2;
1173
1173
  const cy = box.y + box.height / 2;
1174
- elements.push(
1175
- line({
1176
- points: [
1177
- { x: cx, y: box.y },
1178
- { x: box.x + box.width, y: cy },
1179
- { x: cx, y: box.y + box.height },
1180
- { x: box.x, y: cy },
1181
- { x: cx, y: box.y },
1182
- ],
1183
- strokeColor: color.stroke,
1174
+ const outline = line({
1175
+ points: [
1176
+ { x: cx, y: box.y },
1177
+ { x: box.x + box.width, y: cy },
1178
+ { x: cx, y: box.y + box.height },
1179
+ { x: box.x, y: cy },
1180
+ { x: cx, y: box.y },
1181
+ ],
1182
+ strokeColor: color.stroke,
1183
+ });
1184
+ outline.customData = { role: "diamondShape", boxId: box.id };
1185
+ elements.push(outline);
1186
+ renderDiamondText(box, color, elements);
1187
+ }
1188
+
1189
+ /**
1190
+ * Render text in the central band of a diamond. Rectangular box padding
1191
+ * would place text into the narrowing top/bottom corners, where it can
1192
+ * visually cross the diagonal edges even though it fits the bounding box.
1193
+ * @param {Box} box Box being drawn.
1194
+ * @param {ColorTriple} color Colour triple supplying the text colour.
1195
+ * @param {ExcalElement[]} elements Excalidraw element list — mutated in place.
1196
+ * @returns {void}
1197
+ */
1198
+ function renderDiamondText(box, color, elements) {
1199
+ const textWidth = Math.max(40, Math.floor(box.width * 0.46));
1200
+ const cx = box.x + box.width / 2;
1201
+ const titleValue = box._wrappedTitle ?? String(box.title || "");
1202
+ const titleFontSize = box._wrappedTitleFontSize ?? FONT.sizeTitle;
1203
+ const titleHeight = titleValue.split("\n").length * titleFontSize * FONT.lineHeight;
1204
+ const stereotypeValue = box.stereotype ? `«${box.stereotype}»` : "";
1205
+ const stereotypeHeight = stereotypeValue ? FONT.sizeDescription * FONT.lineHeight : 0;
1206
+ const gap = stereotypeValue ? 2 : 0;
1207
+ const blockHeight = stereotypeHeight + gap + titleHeight;
1208
+ const top = box.y + (box.height - blockHeight) / 2;
1209
+ const x = cx - textWidth / 2;
1210
+
1211
+ if (stereotypeValue) {
1212
+ const stereotype = text({
1213
+ x,
1214
+ y: top,
1215
+ width: textWidth,
1216
+ height: stereotypeHeight,
1217
+ value: stereotypeValue,
1218
+ fontSize: FONT.sizeDescription,
1219
+ color: _activeGraphStyle.boxFontColor || color.stroke,
1220
+ align: "center",
1221
+ vAlign: "middle",
1222
+ });
1223
+ stereotype.customData = { role: "diamondStereotypeText", boxId: box.id };
1224
+ elements.push(stereotype);
1225
+ }
1226
+
1227
+ const title = applyLinkMetadata(
1228
+ text({
1229
+ x,
1230
+ y: top + stereotypeHeight + gap,
1231
+ width: textWidth,
1232
+ height: titleHeight,
1233
+ value: titleValue,
1234
+ fontSize: titleFontSize,
1235
+ color: _activeGraphStyle.boxFontColor || color.stroke,
1236
+ align: "center",
1237
+ vAlign: "middle",
1184
1238
  }),
1239
+ box,
1185
1240
  );
1186
- renderBoxText(box, color, elements);
1241
+ title.customData = {
1242
+ ...(title.customData || {}),
1243
+ role: "diamondTitleText",
1244
+ boxId: box.id,
1245
+ };
1246
+ elements.push(title);
1187
1247
  }
1188
1248
 
1189
1249
  /**
@@ -2218,36 +2278,104 @@ function boundsOverlap(a, b) {
2218
2278
  function renderConnectionEndpointLabels(conn) {
2219
2279
  if (!conn.path || conn.path.length < 2) return [];
2220
2280
  const endpoints = [
2221
- { name: "start", point: conn.path[0], label: conn.arrow.start.label },
2222
- { name: "end", point: conn.path[conn.path.length - 1], label: conn.arrow.end.label },
2281
+ {
2282
+ name: "start",
2283
+ point: conn.path[0],
2284
+ next: conn.path[1],
2285
+ label: conn.arrow.start.label,
2286
+ },
2287
+ {
2288
+ name: "end",
2289
+ point: conn.path[conn.path.length - 1],
2290
+ next: conn.path[conn.path.length - 2],
2291
+ label: conn.arrow.end.label,
2292
+ },
2223
2293
  ];
2224
2294
  const out = [];
2295
+ const lineColor = connectionStrokeColor(conn);
2225
2296
  for (const endpoint of endpoints) {
2226
2297
  if (!endpoint.label) continue;
2227
- const fontSize = FONT.sizeEdgeLabel;
2228
- const wrapped = measureSmartWrapped(endpoint.label, fontSize, 88);
2229
- const width = Math.max(20, wrapped.width + 4);
2230
- const height = Math.max(fontSize * FONT.lineHeight, wrapped.height);
2231
- const label = text({
2232
- x: endpoint.point.x - width / 2,
2233
- y: endpoint.point.y - height - 6,
2298
+ const fontSize = Math.max(FONT.sizeEdgeLabel + 2, FONT.sizeDescription);
2299
+ const wrapped = measureSmartFitted(endpoint.label, fontSize, 96, {
2300
+ minFontSize: Math.max(9, FONT.sizeEdgeLabel),
2301
+ });
2302
+ const padX = 5;
2303
+ const padY = 2;
2304
+ const width = Math.max(30, wrapped.width + padX * 2);
2305
+ const height = Math.max(fontSize * FONT.lineHeight, wrapped.height) + padY * 2;
2306
+ const labelCenter = endpointLabelCenter(endpoint.point, endpoint.next, width, height);
2307
+ const chip = rect({
2308
+ x: labelCenter.x - width / 2,
2309
+ y: labelCenter.y - height / 2,
2234
2310
  width,
2235
2311
  height,
2312
+ strokeColor: lineColor,
2313
+ backgroundColor: "#ffffff",
2314
+ });
2315
+ chip.roughness = 0;
2316
+ chip.roundness = null;
2317
+ chip.strokeWidth = 1;
2318
+ chip.customData = {
2319
+ role: "arrowEndpointLabelChip",
2320
+ connectionId: conn.id,
2321
+ endpoint: endpoint.name,
2322
+ lineColor,
2323
+ };
2324
+ out.push(chip);
2325
+
2326
+ const chipX = Number(chip.x);
2327
+ const chipY = Number(chip.y);
2328
+ const label = text({
2329
+ x: chipX + padX,
2330
+ y: chipY + padY,
2331
+ width: width - padX * 2,
2332
+ height: height - padY * 2,
2236
2333
  value: wrapped.lines.join("\n"),
2237
- fontSize,
2238
- color: _activeGraphStyle.edgeFontColor || "#334155",
2334
+ fontSize: wrapped.fontSize,
2335
+ color: _activeGraphStyle.edgeFontColor || lineColor,
2239
2336
  align: "center",
2337
+ vAlign: "middle",
2240
2338
  });
2241
2339
  label.customData = {
2242
2340
  role: "arrowEndpointLabel",
2243
2341
  connectionId: conn.id,
2244
2342
  endpoint: endpoint.name,
2343
+ lineColor,
2344
+ measuredWidth: wrapped.width,
2345
+ measuredHeight: wrapped.height,
2346
+ fittedFontSize: wrapped.fontSize,
2245
2347
  };
2246
2348
  out.push(label);
2247
2349
  }
2248
2350
  return out;
2249
2351
  }
2250
2352
 
2353
+ /**
2354
+ * Place an endpoint label just inside the routed edge rather than on the
2355
+ * element border. The perpendicular offset keeps the label from sitting
2356
+ * directly on top of the line.
2357
+ * @param {Pt} point Endpoint on the element edge.
2358
+ * @param {Pt} next Adjacent point along the routed edge.
2359
+ * @param {number} width Label chip width.
2360
+ * @param {number} height Label chip height.
2361
+ * @returns {Pt} Label centre.
2362
+ */
2363
+ function endpointLabelCenter(point, next, width, height) {
2364
+ const dx = next.x - point.x;
2365
+ const dy = next.y - point.y;
2366
+ const len = Math.max(1, Math.hypot(dx, dy));
2367
+ const ux = dx / len;
2368
+ const uy = dy / len;
2369
+ const nx = -uy;
2370
+ const ny = ux;
2371
+ const along = Math.min(34, Math.max(20, len * 0.22));
2372
+ const away = Math.max(9, Math.min(14, Math.min(width, height) * 0.45));
2373
+ return {
2374
+ x: point.x + ux * along + nx * away,
2375
+ y: point.y + uy * along + ny * away,
2376
+ };
2377
+ }
2378
+
2251
2379
  /**
2252
2380
  * Render a header tab on top of a plane / subplane.
2253
2381
  * @param {{parent:(Plane|Subplane),color:ColorTriple,title:string,fontSize:number,height:number,paddingX:number}} spec