umlimator 0.18.0 → 0.20.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
@@ -49,7 +49,25 @@ drill-down, a data pipeline, an AI agent's skills, and host pages for embedding,
49
49
  itself, pinned where you pin it. Edited on the canvas (members as one line of UML text, a palette, a relationship
50
50
  picker), each gesture an `edit` event the host applies with `apply()`; checked by the class diagram's rules; read from
51
51
  and written to Mermaid's `classDiagram` ([`examples/sales-classes.json`](examples/sales-classes.json),
52
- [what it covers](docs/conformance/uml-class.md)).
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.
61
+ - **UML sequence and communication diagrams** (0.20.0): lifelines on a time axis with calls, async messages, replies,
62
+ creates and deletes, activation bars derived from the messages, `alt`, `opt`, `loop`, `par` and `break` frames with
63
+ their guards, and interaction uses ([`examples/checkout-sequence.json`](examples/checkout-sequence.json),
64
+ [what it covers](docs/conformance/uml-sequence.md)); the same interaction as lifelines joined by connectors, each
65
+ link's messages a stack of numbered rows (1, 1.1, 1.1.2) ([`examples/checkout-communication.json`](examples/checkout-communication.json),
66
+ [what it covers](docs/conformance/uml-communication.md)). Messages are inserted, moved in time, wrapped in a frame and
67
+ deleted on the canvas, by pointer and by key, each gesture an `edit` event; checked by the types' rules; a sequence
68
+ diagram is read from and written to Mermaid's `sequenceDiagram`, and an OpenTelemetry trace becomes one
69
+ (`umlimator.py trace --diagram uml.sequence`). The MCP server, the `map-repo` skill and the diff Action learn these
70
+ types in one package after 0.20.0; until then a reorder of a view's messages shows in a diff as changed, not moved.
53
71
  - **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
54
72
  for a review: a cover with the contents, each view with its legend and tables of its cards, lines and boxes, then the
55
73
  rules (`umlimator.py pdf`).
@@ -72,7 +90,7 @@ drill-down, a data pipeline, an AI agent's skills, and host pages for embedding,
72
90
  npm install umlimator
73
91
  ```
74
92
 
75
- Or from GitHub, at a tag or any commit: `"umlimator": "github:zintaen/umlimator#v0.18.0"`. npm 12 refuses git
93
+ Or from GitHub, at a tag or any commit: `"umlimator": "github:zintaen/umlimator#v0.20.0"`. npm 12 refuses git
76
94
  dependencies unless the project opts in, so that also needs `allow-git=root` in the `.npmrc` next to `package.json`.
77
95
 
78
96
  ## Embed
@@ -121,7 +139,7 @@ function MapView({ model, onSelect }) {
121
139
  `map.shapes` reads the notation shown and sets another (`null`: each view's own again); the cards are drawn again from
122
140
  the geometry they have, with the camera, selection and marks kept, and nothing is laid out.
123
141
  - `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
142
+ - `import { render, apply, history } from 'umlimator/all'` draws diagram types too: a class, object, package, sequence or communication diagram, whose gestures emit
125
143
  `edit` transactions that `apply(model, e.commands)` turns into the next model (`examples/class-editor.html` is a
126
144
  working host). `umlimator` alone draws maps, and a typed view as plain cards with a warning.
127
145
  - `diff(before, after)` returns `after` with each card and line marked added, changed or removed, what changed in words,
@@ -200,7 +218,8 @@ path. The full schema is `engine/references/schema.md` (§ Map model); `examples
200
218
  A model file that starts with `"$schema": "<path to>/umlimator.schema.json"` (exported as `umlimator/schema.json`)
201
219
  gets completion and checks in editors, and `validate(model)` lists its errors and warnings, each with where it is.
202
220
  `"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
221
+ `diagram` is `"uml.class"`, `"uml.object"`, `"uml.package"`, `"uml.sequence"` or `"uml.communication"` is a UML class, object,
222
+ package, sequence or communication diagram, drawn by `umlimator/all` and the CLI; a type not drawn yet shows its
204
223
  nodes as plain cards, with a warning. A model with no `schemaVersion` is a map, as always, and a version newer than the
205
224
  module reads is an error.
206
225
 
@@ -238,18 +257,36 @@ kinds such as `public`, `lane`, `script`, `hook` and `board` work too). Fields b
238
257
  | 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 |
239
258
 
240
259
  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)):
260
+ [`docs/conformance/uml-class.md`](docs/conformance/uml-class.md)), an object diagram (`examples/order-objects.json`,
261
+ [`uml-object.md`](docs/conformance/uml-object.md)) and a package diagram (`examples/bookshop-packages.json`,
262
+ [`uml-package.md`](docs/conformance/uml-package.md)):
242
263
 
243
264
  | On | Field | What it does |
244
265
  |---|---|---|
245
266
  | 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
267
  | node | `members` | its attributes, operations or literals, in order, each `{ id, type, label, props }` |
247
- | node | `parent` | the package that owns it |
268
+ | 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` |
269
+ | node | `parent` | the package that owns it: from 0.19.0 drawn as a box holding it when the view shows both |
270
+ | 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») |
248
271
  | 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 |
272
+ | view | `diagram` | `"uml.class"`, `"uml.object"` or `"uml.package"`: the view is a class, object or package diagram |
273
+ | view | `subject` | the package the view shows the inside of: names are qualified from it |
250
274
  | view | `direction` | `"down"` lays it out top to bottom, the general class above (default `"right"`) |
251
275
  | view | `present` | per element: `collapsed` compartments, and at most `rows` rows each, then "+k more" |
252
276
 
277
+ A sequence diagram (`examples/checkout-sequence.json`, [`docs/conformance/uml-sequence.md`](docs/conformance/uml-sequence.md))
278
+ and a communication diagram (`examples/checkout-communication.json`,
279
+ [`docs/conformance/uml-communication.md`](docs/conformance/uml-communication.md)), from 0.20.0:
280
+
281
+ | On | Field | What it does |
282
+ |---|---|---|
283
+ | node | `type` | `uml.Lifeline`; its `props.represents` is what it is an instance of, drawn `name : Type` |
284
+ | edge | `type` | `uml.Message`; on a communication view also `uml.Connector`, the link messages are sent along |
285
+ | edge | `props` | a message's `sort` (`call`, `async`, `reply`, `create`, `delete`) and a reply's `replyTo`, the call it answers |
286
+ | view | `diagram` | `"uml.sequence"` or `"uml.communication"` |
287
+ | view | `edges` | a sequence view's messages and interaction uses (`uml.InteractionUse`, `props.covers`), inline and in time order; a communication view's connectors, then its messages, by id, in order. Bars and numbers are derived |
288
+ | view | `fragments` | a sequence view's combined fragments (`uml.CombinedFragment`, `props.operator`), each with its operands as `members` (`label` the guard); a message's or fragment's `parent` is its operand |
289
+
253
290
  ## Command line
254
291
 
255
292
  ```bash
@@ -265,11 +302,13 @@ python3 umlimator.py check page.html --expand # also ea
265
302
  python3 umlimator.py record bike-share.html --story ride --out ride.png # bike-share's story as an animated PNG, its tours riding
266
303
  python3 umlimator.py import workspace.dsl --out model.json # a diagram you have already, as a model
267
304
  python3 umlimator.py import classes.mmd --out classes.json # a Mermaid classDiagram, as a UML class diagram (needs Node)
305
+ python3 umlimator.py import checkout.mmd --out checkout.json # a Mermaid sequenceDiagram, as a UML sequence diagram (needs Node)
268
306
  python3 umlimator.py render examples/sales-classes.json --out classes.html # a class diagram's page; stills, check and pdf take it too
269
307
  docker compose config --format json > compose.json && python3 umlimator.py import compose.json --out model.json
270
308
  kubectl get deploy,sts,svc,ing -A -o json > cluster.json && python3 umlimator.py import cluster.json --out model.json
271
309
  python3 umlimator.py pdf page.html --out map.pdf # every view in one PDF: a cover, each view with its tables, the rules
272
310
  python3 umlimator.py trace model.json trace.json --view ride-end --match match.json --out model.json # an OTLP trace kept as a numbered view
311
+ python3 umlimator.py trace model.json trace.json --view ride-end --match match.json --diagram uml.sequence --out traced.json # ... as a UML sequence diagram, in a version-2 model
273
312
  python3 umlimator.py mcp model.json # an MCP server over stdio, for an AI assistant (below)
274
313
  ```
275
314
 
@@ -277,7 +316,8 @@ python3 umlimator.py mcp model.json # an MCP
277
316
 
278
317
  `import` reads Structurizr DSL (people, systems, containers and components, their relationships, and the workspace's
279
318
  views), C4-PlantUML (its element, relationship and boundary macros), Mermaid (`flowchart` or `graph`, and `C4Context`,
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
319
+ `C4Container` or `C4Component`; a `classDiagram` becomes a UML class diagram and a `sequenceDiagram` a UML sequence
320
+ diagram, each read through Node), and the JSON of `docker compose config` (services, `depends_on`, networks) and of
281
321
  `kubectl get` (workloads, Services, Ingresses). It tells the format from the content, then the extension; `--format`
282
322
  decides. Groups, boundaries, subgraphs, networks and namespaces become boxes; Structurizr's views stay views, a card
283
323
  opening the view below it; `examples/clinic.json` is `examples/clinic.dsl`, imported. What each element becomes, and
@@ -328,7 +368,7 @@ jobs:
328
368
  runs-on: ubuntu-latest
329
369
  steps:
330
370
  - uses: actions/checkout@v4
331
- - uses: zintaen/umlimator@v0.18.0
371
+ - uses: zintaen/umlimator@v0.20.0
332
372
  with:
333
373
  models: "docs/*.json" # optional: where the models are (default: every .json that is a map model)
334
374
  ```
@@ -426,7 +466,7 @@ action.yml the diff Action: what a pull request changes in its
426
466
  src/ the module's sources, by layer: core, draw, layout, map, canvas, page (tools/build.mjs joins them)
427
467
  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
428
468
  engine/ the page templates the CLI inlines the module into; the upstream renderer and schema
429
- docs/ the module's API and the editing design; docs/diagrams/: the plan for 28 diagram types (not built yet)
469
+ docs/ the module's API and the editing design; docs/conformance/: what each diagram type covers; docs/diagrams/: the plan for 28 diagram types
430
470
  tests/, bench/ tests, benchmark models and results
431
471
  icons/ line icons and the logo manifest (sources and hashes only)
432
472
  examples/ made-up systems: models, host pages and a Node script (live: zintaen.github.io/umlimator)