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 +37 -5
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/lib/umlimator-all.js +6908 -0
- package/lib/umlimator.d.ts +69 -0
- package/lib/umlimator.js +4446 -3862
- package/lib/umlimator.schema.json +236 -0
- package/package.json +3 -2
package/lib/umlimator.d.ts
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
/** A map model: engine/references/schema.md § Map model, plus the README's umlimator fields. Never mutated. */
|
|
4
4
|
export interface MapModel {
|
|
5
|
+
/** 1 (or none): a map, read as always. 2: it may hold typed elements and typed views (docs/diagrams/model.md). A newer
|
|
6
|
+
* version is an error: validate() says so and migrate() throws (0.17.0). */
|
|
7
|
+
schemaVersion?: number;
|
|
5
8
|
title?: string;
|
|
6
9
|
root?: string;
|
|
7
10
|
nodes: MapNode[];
|
|
@@ -39,8 +42,42 @@ export interface MapNode {
|
|
|
39
42
|
owner?: string;
|
|
40
43
|
/** The card's own shape, in every notation (0.15.0); without it, the notation draws the card by its kind. */
|
|
41
44
|
shape?: Shape;
|
|
45
|
+
/** In schema version 2 (0.17.0) a node may also be a typed Element: type, parent, props, members. */
|
|
42
46
|
[key: string]: unknown;
|
|
43
47
|
}
|
|
48
|
+
/** A typed element in schema version 2's envelope (docs/diagrams/model.md §1): a node, a member, a typed edge, a
|
|
49
|
+
* fragment. Nodes, edges, members and fragments share one id space; an id never contains "->". A typed edge is an
|
|
50
|
+
* Element with `from` and `to`, which may name a member. A typed view is a MapView with `diagram` (uml.class), and may
|
|
51
|
+
* have `subject`, `direction` ('right' | 'down'), `notation`, `present`, `fragments` and `timeline`. umlimator/all draws `uml.class` (0.18.0); other types draw as plain cards. */
|
|
52
|
+
export interface Element {
|
|
53
|
+
id: string; type: string; label?: string; parent?: string; props?: Record<string, unknown>; members?: Element[];
|
|
54
|
+
[key: string]: unknown;
|
|
55
|
+
}
|
|
56
|
+
/** The class diagram's vocabulary (a view with `diagram: 'uml.class'`, drawn by umlimator/all from 0.18.0;
|
|
57
|
+
* docs/conformance/uml-class.md). These describe what `type` and `props` hold; validate() reports what breaks the type's
|
|
58
|
+
* rules, and a field written otherwise is kept as it is. */
|
|
59
|
+
export type UmlClassElementType = 'uml.Class' | 'uml.Interface' | 'uml.Enumeration' | 'uml.DataType' | 'uml.PrimitiveType' | 'uml.Package' | 'uml.Comment';
|
|
60
|
+
export type UmlClassMemberType = 'uml.Property' | 'uml.Operation' | 'uml.EnumerationLiteral';
|
|
61
|
+
/** From the client to the supplier: a generalization from the specific to the general, a realization to the interface,
|
|
62
|
+
* a comment link from the comment. */
|
|
63
|
+
export type UmlClassLineType = 'uml.Association' | 'uml.Generalization' | 'uml.InterfaceRealization' | 'uml.Dependency' | 'uml.CommentLink';
|
|
64
|
+
export type UmlVisibility = 'public' | 'private' | 'protected' | 'package';
|
|
65
|
+
/** A classifier's or a package's props. Stereotypes are drawn «in guillemets»; any UML element or line may have them. */
|
|
66
|
+
export interface UmlClassifierProps { isAbstract?: boolean; stereotypes?: string[]; [key: string]: unknown }
|
|
67
|
+
/** An attribute's props: its UML text `+ {static} /total: Money [1] = 0` as fields. Types and defaults are text. */
|
|
68
|
+
export interface UmlPropertyProps { visibility?: UmlVisibility; valueType?: string; multiplicity?: string; default?: string; isStatic?: boolean; isDerived?: boolean; stereotypes?: string[]; [key: string]: unknown }
|
|
69
|
+
/** An operation's props: `+ {static} place(at: Date, in qty: Int): Order` as fields. */
|
|
70
|
+
export interface UmlOperationProps {
|
|
71
|
+
visibility?: UmlVisibility; parameters?: { name: string; valueType?: string; direction?: 'in' | 'out' | 'inout' | 'return' }[];
|
|
72
|
+
returnType?: string; isStatic?: boolean; isAbstract?: boolean; stereotypes?: string[]; [key: string]: unknown;
|
|
73
|
+
}
|
|
74
|
+
/** One end of an association. A multiplicity is 1, *, n..m or n..*, kept as written; a composite end's is at most 1. */
|
|
75
|
+
export interface UmlAssociationEnd { role?: string; multiplicity?: string; aggregation?: 'none' | 'shared' | 'composite'; navigable?: boolean }
|
|
76
|
+
/** A line's props: an association's two ends, and stereotypes («use» on a dependency). */
|
|
77
|
+
export interface UmlLineProps { ends?: { from?: UmlAssociationEnd; to?: UmlAssociationEnd }; stereotypes?: string[]; [key: string]: unknown }
|
|
78
|
+
/** What a typed view shows of one element, in its `present` by the element's id: compartments not drawn, divider and
|
|
79
|
+
* all, and at most `rows` rows in each, then "+k more". */
|
|
80
|
+
export interface UmlPresent { collapsed?: ('attributes' | 'operations' | 'literals')[]; rows?: number }
|
|
44
81
|
/** What a line means, drawn as its colour: calls (the default), feeds (hands work on), triggers (suggests, offers, fires),
|
|
45
82
|
* state (reads or writes a file, board or config: a thinner line, a muted label, no flow) and guard (a hook steps in).
|
|
46
83
|
* Colours are --um-w-<kind>. An edge's `style` (emphasis, dashed, security) wins over its kind's colour. */
|
|
@@ -111,6 +148,10 @@ export interface Events {
|
|
|
111
148
|
open: { target: Ref; view: string; preventDefault(): void }; // view: the one the card opens, which may not be in the model yet
|
|
112
149
|
viewchange: { view: string; from: string };
|
|
113
150
|
change: Change; // only with `editable`
|
|
151
|
+
/** A gesture on a typed view (a schema version 2 view whose `diagram` is set and is not 'map'), with `editable`
|
|
152
|
+
* (0.17.0): a transaction for the host to apply with apply(model, commands) and hand back with update(). Nothing is
|
|
153
|
+
* drawn before. Map views emit `change`, never this. */
|
|
154
|
+
edit: { view: string; commands: Command[] };
|
|
114
155
|
/** E or Alt + click on a stacked card, or the ⤡ tab of the box it unfolded into (#71): before the card unfolds in place
|
|
115
156
|
* (expanded: true) or folds back (false). view: the card's inner view, which may not be in the model yet; the card
|
|
116
157
|
* unfolds once it is: the update() that brings it unfolds the card (here or later), or expand(). preventDefault(): no change. */
|
|
@@ -347,6 +388,34 @@ export function layout(model: MapModel, viewId: string, options?: { repair?: boo
|
|
|
347
388
|
* a view a card opens that the host has not loaded yet, a line from a card or box to itself, which is not drawn). The JSON Schema is umlimator/schema.json. */
|
|
348
389
|
export interface Problem { level: 'error' | 'warning'; path: string; message: string }
|
|
349
390
|
export function validate(model: MapModel): Problem[];
|
|
391
|
+
/** The model at the schema version this release reads (0.17.0). Versions 1 and 2 come back unchanged; lines with no id
|
|
392
|
+
* keep their positional names. Throws on a newer version (a whole number above 2). */
|
|
393
|
+
export function migrate<M extends MapModel>(model: M): M;
|
|
394
|
+
/** A command on the model (0.17.0). `path` is a dotted path, or a list of keys when a key holds a dot; `value`
|
|
395
|
+
* undefined removes the field. `id`, `members`, `parent`, `from` and `to` change by their own commands, not by set. */
|
|
396
|
+
export type Command =
|
|
397
|
+
| { op: 'set'; id: string; path: string | string[]; value: unknown }
|
|
398
|
+
| { op: 'set'; view: string; path: string | string[]; value: unknown }
|
|
399
|
+
| { op: 'add'; element: { id: string; [key: string]: unknown }; owner?: string; index?: number; view?: string; in?: 'model' }
|
|
400
|
+
/** 0.18.0: into the view's own list for its kind: a line or an item in `edges`, a node in `nodes`, else `fragments` */
|
|
401
|
+
| { op: 'add'; element: { id: string; [key: string]: unknown }; view: string; index?: number; in: 'view'; owner?: never }
|
|
402
|
+
| { op: 'move'; id: string; index: number; owner?: string; view?: never }
|
|
403
|
+
| { op: 'move'; id: string; view: string; index: number; owner?: never }
|
|
404
|
+
| { op: 'hide'; id: string; view: string }
|
|
405
|
+
| { op: 'delete'; id: string }
|
|
406
|
+
| { op: 'reparent'; id: string; parent: string | null };
|
|
407
|
+
/** The model after a transaction: one command, or a list run in order, on a copy (0.17.0). A command that cannot run
|
|
408
|
+
* throws, and none of the transaction is applied. `delete` takes with it the element's members, what it owns, the lines
|
|
409
|
+
* to them and every place that names them (references()); one already gone in the same transaction is passed over.
|
|
410
|
+
* `hide` takes it out of one view with all the view says of it. Undo is the model before: keep it with history().
|
|
411
|
+
* From 0.18.0 `delete` gives what the element held and that stays its nearest owner left, and a diagram type's declared
|
|
412
|
+
* references cascade (a reply with its call) or drop (an id out of a list). */
|
|
413
|
+
export function apply<M extends MapModel>(model: M, commands: Command | Command[]): M;
|
|
414
|
+
/** Where a model names an element, other than the element itself (0.17.0): the keys from the model down to the place
|
|
415
|
+
* (['views', 0, 'nodeIds', 2]) and what it is: 'end', 'parent', 'part', 'view', 'pin', 'present', 'override',
|
|
416
|
+
* 'subject', 'story', 'lens', 'rule' or (0.18.0) 'prop', a property a diagram type declares; later releases may add kinds. */
|
|
417
|
+
export interface Reference { path: (string | number)[]; kind: string }
|
|
418
|
+
export function references(model: MapModel, id: string): Reference[];
|
|
350
419
|
/** One issue of the layout check: its message, as the page's check words it, and the cards, lines and boxes it is about
|
|
351
420
|
* (exactly those, even where two cards share a label). */
|
|
352
421
|
export interface CheckIssue { message: string; targets: Ref[] }
|