umlimator 0.17.0 → 0.19.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,21 @@ 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)). From 0.19.0 a package owning classes the view shows is a box holding
53
+ them, and names are qualified (`sales::Order`).
54
+ - **UML object and package diagrams** (0.19.0): instances with their slots (`order1042 : Order`, underlined;
55
+ `status = placed`) and links with names and roles ([`examples/order-objects.json`](examples/order-objects.json),
56
+ [what it covers](docs/conformance/uml-object.md)); packages as boxes holding what they own, at any depth, or as
57
+ closed folders, with «import», «access», «merge» and dependencies between them
58
+ ([`examples/bookshop-packages.json`](examples/bookshop-packages.json), [what it covers](docs/conformance/uml-package.md)).
59
+ Ownership is edited by dropping an element into a box, or with the Owner field; both are checked by their types'
60
+ rules, and the PDF's tables list slots and element kinds.
46
61
  - **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
62
  for a review: a cover with the contents, each view with its legend and tables of its cards, lines and boxes, then the
48
63
  rules (`umlimator.py pdf`).
@@ -65,7 +80,7 @@ drill-down, a data pipeline, an AI agent's skills, and host pages for embedding,
65
80
  npm install umlimator
66
81
  ```
67
82
 
68
- Or from GitHub, at a tag or any commit: `"umlimator": "github:zintaen/umlimator#v0.17.0"`. npm 12 refuses git
83
+ Or from GitHub, at a tag or any commit: `"umlimator": "github:zintaen/umlimator#v0.19.0"`. npm 12 refuses git
69
84
  dependencies unless the project opts in, so that also needs `allow-git=root` in the `.npmrc` next to `package.json`.
70
85
 
71
86
  ## Embed
@@ -114,6 +129,9 @@ function MapView({ model, onSelect }) {
114
129
  `map.shapes` reads the notation shown and sets another (`null`: each view's own again); the cards are drawn again from
115
130
  the geometry they have, with the camera, selection and marks kept, and nothing is laid out.
116
131
  - `editable: true` turns on editing gestures ([docs/editing.md](docs/editing.md); `examples/edit.html` is a working host).
132
+ - `import { render, apply, history } from 'umlimator/all'` draws diagram types too: a class, object or package diagram, whose gestures emit
133
+ `edit` transactions that `apply(model, e.commands)` turns into the next model (`examples/class-editor.html` is a
134
+ working host). `umlimator` alone draws maps, and a typed view as plain cards with a warning.
117
135
  - `diff(before, after)` returns `after` with each card and line marked added, changed or removed, what changed in words,
118
136
  and the views that show it; `drift(model, observed)` marks the lines traffic ran on that nobody drew, and the drawn ones
119
137
  that carried nothing. Both are models to draw, in Node too. `update()` eases into the next model (`examples/timelapse.html`);
@@ -189,9 +207,11 @@ A model has shared `nodes` and `edges`, and `views` that each show a subset, wit
189
207
  path. The full schema is `engine/references/schema.md` (§ Map model); `examples/bookshop.json` uses most of it.
190
208
  A model file that starts with `"$schema": "<path to>/umlimator.schema.json"` (exported as `umlimator/schema.json`)
191
209
  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.
210
+ `"schemaVersion": 2` marks a model that may hold typed elements and typed views (`docs/diagrams/model.md`). A view whose
211
+ `diagram` is `"uml.class"`, `"uml.object"` or `"uml.package"` is a UML class, object or package diagram, drawn by
212
+ `umlimator/all` and the CLI; a type not drawn yet shows its
213
+ nodes as plain cards, with a warning. A model with no `schemaVersion` is a map, as always, and a version newer than the
214
+ module reads is an error.
195
215
 
196
216
  Card kinds: `frontend`, `backend`, `ai`, `database`, `queue`, `security`, `cloud`, `external` and `file` (skill-map
197
217
  kinds such as `public`, `lane`, `script`, `hook` and `board` work too). Fields beyond the schema:
@@ -226,6 +246,24 @@ kinds such as `public`, `lane`, `script`, `hook` and `board` work too). Fields b
226
246
  | model | `stories` | walk-throughs: steps that each set the view, camera, selection, highlight, tour and caption |
227
247
  | 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
248
 
249
+ In a version-2 model, a class diagram (`examples/sales-classes.json`; every field in
250
+ [`docs/conformance/uml-class.md`](docs/conformance/uml-class.md)), an object diagram (`examples/order-objects.json`,
251
+ [`uml-object.md`](docs/conformance/uml-object.md)) and a package diagram (`examples/bookshop-packages.json`,
252
+ [`uml-package.md`](docs/conformance/uml-package.md)):
253
+
254
+ | On | Field | What it does |
255
+ |---|---|---|
256
+ | 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` |
257
+ | node | `members` | its attributes, operations or literals, in order, each `{ id, type, label, props }` |
258
+ | node, member, edge | `type`, from 0.19.0 | an object diagram's `uml.InstanceSpecification`, its members `uml.Slot`, lines `uml.Link`; a package diagram's `uml.Package` and the classifiers above, lines `uml.PackageImport`, `uml.PackageMerge`, `uml.Dependency` |
259
+ | node | `parent` | the package that owns it: from 0.19.0 drawn as a box holding it when the view shows both |
260
+ | node, member, edge | `props`, from 0.19.0 | an instance's `classifier` (a name, as text); a slot's `value`; a link's `association` and its ends' `role`; a package import's `visibility`, `public` («import») or `private` («access») |
261
+ | 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`) |
262
+ | view | `diagram` | `"uml.class"`, `"uml.object"` or `"uml.package"`: the view is a class, object or package diagram |
263
+ | view | `subject` | the package the view shows the inside of: names are qualified from it |
264
+ | view | `direction` | `"down"` lays it out top to bottom, the general class above (default `"right"`) |
265
+ | view | `present` | per element: `collapsed` compartments, and at most `rows` rows each, then "+k more" |
266
+
229
267
  ## Command line
230
268
 
231
269
  ```bash
@@ -240,6 +278,8 @@ python3 umlimator.py timelapse model.json --out history.html # the mode
240
278
  python3 umlimator.py check page.html --expand # also each view with each stacked card unfolded
241
279
  python3 umlimator.py record bike-share.html --story ride --out ride.png # bike-share's story as an animated PNG, its tours riding
242
280
  python3 umlimator.py import workspace.dsl --out model.json # a diagram you have already, as a model
281
+ python3 umlimator.py import classes.mmd --out classes.json # a Mermaid classDiagram, as a UML class diagram (needs Node)
282
+ python3 umlimator.py render examples/sales-classes.json --out classes.html # a class diagram's page; stills, check and pdf take it too
243
283
  docker compose config --format json > compose.json && python3 umlimator.py import compose.json --out model.json
244
284
  kubectl get deploy,sts,svc,ing -A -o json > cluster.json && python3 umlimator.py import cluster.json --out model.json
245
285
  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 +291,7 @@ python3 umlimator.py mcp model.json # an MCP
251
291
 
252
292
  `import` reads Structurizr DSL (people, systems, containers and components, their relationships, and the workspace's
253
293
  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
294
+ `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
295
  `kubectl get` (workloads, Services, Ingresses). It tells the format from the content, then the extension; `--format`
256
296
  decides. Groups, boundaries, subgraphs, networks and namespaces become boxes; Structurizr's views stay views, a card
257
297
  opening the view below it; `examples/clinic.json` is `examples/clinic.dsl`, imported. What each element becomes, and
@@ -302,7 +342,7 @@ jobs:
302
342
  runs-on: ubuntu-latest
303
343
  steps:
304
344
  - uses: actions/checkout@v4
305
- - uses: zintaen/umlimator@v0.17.0
345
+ - uses: zintaen/umlimator@v0.19.0
306
346
  with:
307
347
  models: "docs/*.json" # optional: where the models are (default: every .json that is a map model)
308
348
  ```
@@ -400,7 +440,7 @@ action.yml the diff Action: what a pull request changes in its
400
440
  src/ the module's sources, by layer: core, draw, layout, map, canvas, page (tools/build.mjs joins them)
401
441
  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
402
442
  engine/ the page templates the CLI inlines the module into; the upstream renderer and schema
403
- docs/ the module's API and the editing design; docs/diagrams/: the plan for 28 diagram types (not built yet)
443
+ docs/ the module's API and the editing design; docs/conformance/: what each diagram type covers; docs/diagrams/: the plan for 28 diagram types
404
444
  tests/, bench/ tests, benchmark models and results
405
445
  icons/ line icons and the logo manifest (sources and hashes only)
406
446
  examples/ made-up systems: models, host pages and a Node script (live: zintaen.github.io/umlimator)