umlimator 0.17.0 → 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.17.0"`. 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,9 +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.
192
- `"schemaVersion": 2` marks a model that may hold typed elements and typed views (`docs/diagrams/model.md`); none is
193
- drawn as such yet: a typed view shows its nodes as plain cards, with a warning. A model with no `schemaVersion` is a
194
- map, as always, and a version newer than the module reads is an error.
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.
195
206
 
196
207
  Card kinds: `frontend`, `backend`, `ai`, `database`, `queue`, `security`, `cloud`, `external` and `file` (skill-map
197
208
  kinds such as `public`, `lane`, `script`, `hook` and `board` work too). Fields beyond the schema:
@@ -226,6 +237,19 @@ kinds such as `public`, `lane`, `script`, `hook` and `board` work too). Fields b
226
237
  | model | `stories` | walk-throughs: steps that each set the view, camera, selection, highlight, tour and caption |
227
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 |
228
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
+
229
253
  ## Command line
230
254
 
231
255
  ```bash
@@ -240,6 +264,8 @@ python3 umlimator.py timelapse model.json --out history.html # the mode
240
264
  python3 umlimator.py check page.html --expand # also each view with each stacked card unfolded
241
265
  python3 umlimator.py record bike-share.html --story ride --out ride.png # bike-share's story as an animated PNG, its tours riding
242
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
243
269
  docker compose config --format json > compose.json && python3 umlimator.py import compose.json --out model.json
244
270
  kubectl get deploy,sts,svc,ing -A -o json > cluster.json && python3 umlimator.py import cluster.json --out model.json
245
271
  python3 umlimator.py pdf page.html --out map.pdf # every view in one PDF: a cover, each view with its tables, the rules
@@ -251,7 +277,7 @@ python3 umlimator.py mcp model.json # an MCP
251
277
 
252
278
  `import` reads Structurizr DSL (people, systems, containers and components, their relationships, and the workspace's
253
279
  views), C4-PlantUML (its element, relationship and boundary macros), Mermaid (`flowchart` or `graph`, and `C4Context`,
254
- `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
255
281
  `kubectl get` (workloads, Services, Ingresses). It tells the format from the content, then the extension; `--format`
256
282
  decides. Groups, boundaries, subgraphs, networks and namespaces become boxes; Structurizr's views stay views, a card
257
283
  opening the view below it; `examples/clinic.json` is `examples/clinic.dsl`, imported. What each element becomes, and
@@ -302,7 +328,7 @@ jobs:
302
328
  runs-on: ubuntu-latest
303
329
  steps:
304
330
  - uses: actions/checkout@v4
305
- - uses: zintaen/umlimator@v0.17.0
331
+ - uses: zintaen/umlimator@v0.18.0
306
332
  with:
307
333
  models: "docs/*.json" # optional: where the models are (default: every .json that is a map model)
308
334
  ```