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.
@@ -48,11 +48,36 @@ export interface MapNode {
48
48
  /** A typed element in schema version 2's envelope (docs/diagrams/model.md §1): a node, a member, a typed edge, a
49
49
  * fragment. Nodes, edges, members and fragments share one id space; an id never contains "->". A typed edge is an
50
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`. None is drawn yet. */
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
52
  export interface Element {
53
53
  id: string; type: string; label?: string; parent?: string; props?: Record<string, unknown>; members?: Element[];
54
54
  [key: string]: unknown;
55
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 }
56
81
  /** What a line means, drawn as its colour: calls (the default), feeds (hands work on), triggers (suggests, offers, fires),
57
82
  * state (reads or writes a file, board or config: a thinner line, a muted label, no flow) and guard (a hook steps in).
58
83
  * Colours are --um-w-<kind>. An edge's `style` (emphasis, dashed, security) wins over its kind's colour. */
@@ -371,7 +396,9 @@ export function migrate<M extends MapModel>(model: M): M;
371
396
  export type Command =
372
397
  | { op: 'set'; id: string; path: string | string[]; value: unknown }
373
398
  | { op: 'set'; view: string; path: string | string[]; value: unknown }
374
- | { op: 'add'; element: { id: string; [key: string]: unknown }; owner?: string; index?: number; view?: string }
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 }
375
402
  | { op: 'move'; id: string; index: number; owner?: string; view?: never }
376
403
  | { op: 'move'; id: string; view: string; index: number; owner?: never }
377
404
  | { op: 'hide'; id: string; view: string }
@@ -380,11 +407,13 @@ export type Command =
380
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
381
408
  * throws, and none of the transaction is applied. `delete` takes with it the element's members, what it owns, the lines
382
409
  * to them and every place that names them (references()); one already gone in the same transaction is passed over.
383
- * `hide` takes it out of one view with all the view says of it. Undo is the model before: keep it with history(). */
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). */
384
413
  export function apply<M extends MapModel>(model: M, commands: Command | Command[]): M;
385
414
  /** Where a model names an element, other than the element itself (0.17.0): the keys from the model down to the place
386
415
  * (['views', 0, 'nodeIds', 2]) and what it is: 'end', 'parent', 'part', 'view', 'pin', 'present', 'override',
387
- * 'subject', 'story', 'lens' or 'rule'; later releases may add kinds. */
416
+ * 'subject', 'story', 'lens', 'rule' or (0.18.0) 'prop', a property a diagram type declares; later releases may add kinds. */
388
417
  export interface Reference { path: (string | number)[]; kind: string }
389
418
  export function references(model: MapModel, id: string): Reference[];
390
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