umlimator 0.16.1 → 0.18.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/README.md CHANGED
@@ -43,6 +43,13 @@ drill-down, a data pipeline, an AI agent's skills, and host pages for embedding,
43
43
  - **The page's pieces, embedded**: the standalone page's views list, details panel, legend and hint line, each one a
44
44
  `render()` option, around the map in the host's own page.
45
45
  - **Editing** (opt-in): gestures emit `change` events; the host applies them and calls `update()`.
46
+ - **UML class diagrams** (0.18.0, the first of 28 diagram types): a typed model drawn in UML's notation, classes with
47
+ their attributes and operations, interfaces, enumerations, data types, notes, and associations with roles,
48
+ multiplicities, composition, aggregation and navigable ends, generalization, realization and dependency; laid out by
49
+ itself, pinned where you pin it. Edited on the canvas (members as one line of UML text, a palette, a relationship
50
+ picker), each gesture an `edit` event the host applies with `apply()`; checked by the class diagram's rules; read from
51
+ and written to Mermaid's `classDiagram` ([`examples/sales-classes.json`](examples/sales-classes.json),
52
+ [what it covers](docs/conformance/uml-class.md)).
46
53
  - **Export**: any view as a stand-alone SVG or PNG, in the browser or from the CLI; the whole map as one PDF to hand in
47
54
  for a review: a cover with the contents, each view with its legend and tables of its cards, lines and boxes, then the
48
55
  rules (`umlimator.py pdf`).
@@ -65,7 +72,7 @@ drill-down, a data pipeline, an AI agent's skills, and host pages for embedding,
65
72
  npm install umlimator
66
73
  ```
67
74
 
68
- Or from GitHub, at a tag or any commit: `"umlimator": "github:zintaen/umlimator#v0.16.1"`. npm 12 refuses git
75
+ Or from GitHub, at a tag or any commit: `"umlimator": "github:zintaen/umlimator#v0.18.0"`. npm 12 refuses git
69
76
  dependencies unless the project opts in, so that also needs `allow-git=root` in the `.npmrc` next to `package.json`.
70
77
 
71
78
  ## Embed
@@ -114,6 +121,9 @@ function MapView({ model, onSelect }) {
114
121
  `map.shapes` reads the notation shown and sets another (`null`: each view's own again); the cards are drawn again from
115
122
  the geometry they have, with the camera, selection and marks kept, and nothing is laid out.
116
123
  - `editable: true` turns on editing gestures ([docs/editing.md](docs/editing.md); `examples/edit.html` is a working host).
124
+ - `import { render, apply, history } from 'umlimator/all'` draws diagram types too: a class diagram, whose gestures emit
125
+ `edit` transactions that `apply(model, e.commands)` turns into the next model (`examples/class-editor.html` is a
126
+ working host). `umlimator` alone draws maps, and a typed view as plain cards with a warning.
117
127
  - `diff(before, after)` returns `after` with each card and line marked added, changed or removed, what changed in words,
118
128
  and the views that show it; `drift(model, observed)` marks the lines traffic ran on that nobody drew, and the drawn ones
119
129
  that carried nothing. Both are models to draw, in Node too. `update()` eases into the next model (`examples/timelapse.html`);
@@ -189,6 +199,10 @@ A model has shared `nodes` and `edges`, and `views` that each show a subset, wit
189
199
  path. The full schema is `engine/references/schema.md` (§ Map model); `examples/bookshop.json` uses most of it.
190
200
  A model file that starts with `"$schema": "<path to>/umlimator.schema.json"` (exported as `umlimator/schema.json`)
191
201
  gets completion and checks in editors, and `validate(model)` lists its errors and warnings, each with where it is.
202
+ `"schemaVersion": 2` marks a model that may hold typed elements and typed views (`docs/diagrams/model.md`). A view whose
203
+ `diagram` is `"uml.class"` is a UML class diagram, drawn by `umlimator/all` and the CLI; a type not drawn yet shows its
204
+ nodes as plain cards, with a warning. A model with no `schemaVersion` is a map, as always, and a version newer than the
205
+ module reads is an error.
192
206
 
193
207
  Card kinds: `frontend`, `backend`, `ai`, `database`, `queue`, `security`, `cloud`, `external` and `file` (skill-map
194
208
  kinds such as `public`, `lane`, `script`, `hook` and `board` work too). Fields beyond the schema:
@@ -223,6 +237,19 @@ kinds such as `public`, `lane`, `script`, `hook` and `board` work too). Fields b
223
237
  | model | `stories` | walk-throughs: steps that each set the view, camera, selection, highlight, tour and caption |
224
238
  | model | `lenses` | ways to look at the map: what `pick` picks (by id, kind, box, owner or `line` kind) lit, the rest dimmed; `color: "owner"` rings cards by owner |
225
239
 
240
+ In a version-2 model, a class diagram (`examples/sales-classes.json`; every field in
241
+ [`docs/conformance/uml-class.md`](docs/conformance/uml-class.md)):
242
+
243
+ | On | Field | What it does |
244
+ |---|---|---|
245
+ | node, member, edge | `type` | what it is: `uml.Class`, `uml.Interface`, `uml.Enumeration`, `uml.DataType`, `uml.PrimitiveType`, `uml.Package`, `uml.Comment`; members `uml.Property`, `uml.Operation`, `uml.EnumerationLiteral`; lines `uml.Association`, `uml.Generalization`, `uml.InterfaceRealization`, `uml.Dependency`, `uml.CommentLink` |
246
+ | node | `members` | its attributes, operations or literals, in order, each `{ id, type, label, props }` |
247
+ | node | `parent` | the package that owns it |
248
+ | node, member, edge | `props` | the type's own fields: `isAbstract`, `stereotypes`; a member's `visibility`, `valueType`, `multiplicity`, `default`, `isStatic`, `isDerived`, `parameters`, `returnType`; an association's `ends.from` and `ends.to` (`role`, `multiplicity`, `aggregation`, `navigable`) |
249
+ | view | `diagram` | `"uml.class"`: the view is a class diagram |
250
+ | view | `direction` | `"down"` lays it out top to bottom, the general class above (default `"right"`) |
251
+ | view | `present` | per element: `collapsed` compartments, and at most `rows` rows each, then "+k more" |
252
+
226
253
  ## Command line
227
254
 
228
255
  ```bash
@@ -237,6 +264,8 @@ python3 umlimator.py timelapse model.json --out history.html # the mode
237
264
  python3 umlimator.py check page.html --expand # also each view with each stacked card unfolded
238
265
  python3 umlimator.py record bike-share.html --story ride --out ride.png # bike-share's story as an animated PNG, its tours riding
239
266
  python3 umlimator.py import workspace.dsl --out model.json # a diagram you have already, as a model
267
+ python3 umlimator.py import classes.mmd --out classes.json # a Mermaid classDiagram, as a UML class diagram (needs Node)
268
+ python3 umlimator.py render examples/sales-classes.json --out classes.html # a class diagram's page; stills, check and pdf take it too
240
269
  docker compose config --format json > compose.json && python3 umlimator.py import compose.json --out model.json
241
270
  kubectl get deploy,sts,svc,ing -A -o json > cluster.json && python3 umlimator.py import cluster.json --out model.json
242
271
  python3 umlimator.py pdf page.html --out map.pdf # every view in one PDF: a cover, each view with its tables, the rules
@@ -248,7 +277,7 @@ python3 umlimator.py mcp model.json # an MCP
248
277
 
249
278
  `import` reads Structurizr DSL (people, systems, containers and components, their relationships, and the workspace's
250
279
  views), C4-PlantUML (its element, relationship and boundary macros), Mermaid (`flowchart` or `graph`, and `C4Context`,
251
- `C4Container` or `C4Component`), and the JSON of `docker compose config` (services, `depends_on`, networks) and of
280
+ `C4Container` or `C4Component`; a `classDiagram` becomes a UML class diagram, read through Node), and the JSON of `docker compose config` (services, `depends_on`, networks) and of
252
281
  `kubectl get` (workloads, Services, Ingresses). It tells the format from the content, then the extension; `--format`
253
282
  decides. Groups, boundaries, subgraphs, networks and namespaces become boxes; Structurizr's views stay views, a card
254
283
  opening the view below it; `examples/clinic.json` is `examples/clinic.dsl`, imported. What each element becomes, and
@@ -299,7 +328,7 @@ jobs:
299
328
  runs-on: ubuntu-latest
300
329
  steps:
301
330
  - uses: actions/checkout@v4
302
- - uses: zintaen/umlimator@v0.16.1
331
+ - uses: zintaen/umlimator@v0.18.0
303
332
  with:
304
333
  models: "docs/*.json" # optional: where the models are (default: every .json that is a map model)
305
334
  ```
@@ -371,6 +400,7 @@ With `UMLIMATOR_OFFLINE=1` the CLI fetches nothing: a logo not in the cache keep
371
400
  ## Development
372
401
 
373
402
  ```bash
403
+ npm run build # src/ into lib/umlimator.js and lib/umlimator-all.js: edit the sources, commit all three
374
404
  node --test # layout() in Node: the bench views' geometry and the layout rules
375
405
  python3 tests/embed.py # render() in headless Chrome: events, keyboard, colours, contrast, editing, the element
376
406
  python3 bench/bench.py --check-determinism --expect bench/expected.json --max-ms m50=2000
@@ -379,7 +409,8 @@ python3 bench/bench.py --check-determinism --expect bench/expected.json --max-ms
379
409
  The bench lays out fixed models (10 to 69 cards, and 50 modules with 100 lines) in headless Chrome and reports the
380
410
  time per phase, the layout check's issues and a hash of the geometry. `--expect` fails on a view that no longer draws as
381
411
  recorded in `bench/expected.json`; a change that moves lines on purpose refreshes it with `--write-expected`. CI runs
382
- all of the above, and checks that the files copied from upstream (`engine/scripts`, `engine/references`,
412
+ all of the above, fails when `lib/umlimator.js` is not what `src/` builds or a source uses a name it does not import,
413
+ and checks that the files copied from upstream (`engine/scripts`, `engine/references`,
383
414
  `tools/fetch_icons.py`) are unmodified.
384
415
 
385
416
  To release, bump `package.json`'s version in a PR and add that version's `## X.Y.Z: …` section to
@@ -392,7 +423,8 @@ umlimator.py CLI: render, stills, check, record, pdf, pin-icons,
392
423
  umlimator_import.py import's readers: Structurizr DSL, C4-PlantUML, Mermaid, compose and Kubernetes JSON
393
424
  umlimator_mcp.py the MCP server that `umlimator.py mcp` runs
394
425
  action.yml the diff Action: what a pull request changes in its maps, posted on it
395
- lib/ the module (umlimator.js), its types, the default theme, <umlimator-map> and the docs plugins
426
+ src/ the module's sources, by layer: core, draw, layout, map, canvas, page (tools/build.mjs joins them)
427
+ lib/ the module (umlimator.js; umlimator-all.js with every diagram family; both built and committed), its types, the default theme, <umlimator-map> and the docs plugins
396
428
  engine/ the page templates the CLI inlines the module into; the upstream renderer and schema
397
429
  docs/ the module's API and the editing design; docs/diagrams/: the plan for 28 diagram types (not built yet)
398
430
  tests/, bench/ tests, benchmark models and results
@@ -10,7 +10,7 @@ umlimator contains, or builds on, the work below. Each entry says what is used a
10
10
 
11
11
  ## EricTechPro/super-board, `/visual` skill
12
12
 
13
- `lib/umlimator.js` and `engine/assets/template.html` derive from super-board's `skills/visual/assets/template.html`
13
+ `src/` (built into `lib/umlimator.js`) and `engine/assets/template.html` derive from super-board's `skills/visual/assets/template.html`
14
14
  at commit `d0b7d5a` (29 Oct 2026), modified by umlimator (the changes are in its git history and `docs/module-api.md`);
15
15
  `engine/scripts/visual.py` and `engine/references/` are copied from that commit unmodified. Source:
16
16
  https://github.com/EricTechPro/super-board