@formicoidea/labre-framework-uml 0.42.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.
Files changed (114) hide show
  1. package/LICENSE +384 -0
  2. package/dist/actions.d.ts +430 -0
  3. package/dist/actions.js +724 -0
  4. package/dist/background.d.ts +153 -0
  5. package/dist/background.js +557 -0
  6. package/dist/board-hit.d.ts +137 -0
  7. package/dist/board-hit.js +191 -0
  8. package/dist/commands-manifest.d.ts +19 -0
  9. package/dist/commands-manifest.js +571 -0
  10. package/dist/commands.d.ts +4 -0
  11. package/dist/commands.js +983 -0
  12. package/dist/component.d.ts +521 -0
  13. package/dist/component.js +708 -0
  14. package/dist/consts.d.ts +365 -0
  15. package/dist/consts.js +463 -0
  16. package/dist/descriptor.d.ts +12 -0
  17. package/dist/descriptor.js +10 -0
  18. package/dist/drawio-decode.d.ts +32 -0
  19. package/dist/drawio-decode.js +96 -0
  20. package/dist/drawio-import.d.ts +133 -0
  21. package/dist/drawio-import.js +885 -0
  22. package/dist/edge-morph.d.ts +154 -0
  23. package/dist/edge-morph.js +153 -0
  24. package/dist/edge-styles.d.ts +78 -0
  25. package/dist/edge-styles.js +210 -0
  26. package/dist/effects.d.ts +9 -0
  27. package/dist/effects.js +6 -0
  28. package/dist/element-renderer.d.ts +64 -0
  29. package/dist/element-renderer.js +114 -0
  30. package/dist/element-view.d.ts +234 -0
  31. package/dist/element-view.js +430 -0
  32. package/dist/export.d.ts +61 -0
  33. package/dist/export.js +41 -0
  34. package/dist/filename.d.ts +17 -0
  35. package/dist/filename.js +26 -0
  36. package/dist/frame-tag.d.ts +70 -0
  37. package/dist/frame-tag.js +78 -0
  38. package/dist/grammar.d.ts +695 -0
  39. package/dist/grammar.js +1436 -0
  40. package/dist/import.d.ts +306 -0
  41. package/dist/import.js +1270 -0
  42. package/dist/index.d.ts +47 -0
  43. package/dist/index.js +67 -0
  44. package/dist/interchange.d.ts +125 -0
  45. package/dist/interchange.js +372 -0
  46. package/dist/keywords.d.ts +204 -0
  47. package/dist/keywords.js +361 -0
  48. package/dist/kinds.d.ts +73 -0
  49. package/dist/kinds.js +91 -0
  50. package/dist/legend.d.ts +30 -0
  51. package/dist/legend.js +255 -0
  52. package/dist/model.d.ts +862 -0
  53. package/dist/model.js +1316 -0
  54. package/dist/morph.d.ts +178 -0
  55. package/dist/morph.js +496 -0
  56. package/dist/node/act-glyphs.d.ts +30 -0
  57. package/dist/node/act-glyphs.js +142 -0
  58. package/dist/node/compartment-watcher.d.ts +107 -0
  59. package/dist/node/compartment-watcher.js +163 -0
  60. package/dist/node/fit.d.ts +85 -0
  61. package/dist/node/fit.js +129 -0
  62. package/dist/node/node-renderer.d.ts +49 -0
  63. package/dist/node/node-renderer.js +611 -0
  64. package/dist/node/node-view.d.ts +51 -0
  65. package/dist/node/node-view.js +89 -0
  66. package/dist/node/paint.d.ts +84 -0
  67. package/dist/node/paint.js +143 -0
  68. package/dist/node/sd-glyphs.d.ts +36 -0
  69. package/dist/node/sd-glyphs.js +79 -0
  70. package/dist/node/stm-glyphs.d.ts +22 -0
  71. package/dist/node/stm-glyphs.js +111 -0
  72. package/dist/node/tier-metrics.d.ts +38 -0
  73. package/dist/node/tier-metrics.js +45 -0
  74. package/dist/operators.d.ts +45 -0
  75. package/dist/operators.js +75 -0
  76. package/dist/plantuml-import.d.ts +113 -0
  77. package/dist/plantuml-import.js +1723 -0
  78. package/dist/plantuml.d.ts +94 -0
  79. package/dist/plantuml.js +985 -0
  80. package/dist/presets.d.ts +149 -0
  81. package/dist/presets.js +302 -0
  82. package/dist/profiles.d.ts +2 -0
  83. package/dist/profiles.js +358 -0
  84. package/dist/reading.d.ts +160 -0
  85. package/dist/reading.js +648 -0
  86. package/dist/roles.d.ts +257 -0
  87. package/dist/roles.js +997 -0
  88. package/dist/rules.d.ts +267 -0
  89. package/dist/rules.js +3090 -0
  90. package/dist/templates.d.ts +2 -0
  91. package/dist/templates.js +197 -0
  92. package/dist/toolbar/config.d.ts +228 -0
  93. package/dist/toolbar/config.js +833 -0
  94. package/dist/toolbar/icons.d.ts +440 -0
  95. package/dist/toolbar/icons.js +711 -0
  96. package/dist/toolbar/senior-tool.d.ts +11 -0
  97. package/dist/toolbar/senior-tool.js +21 -0
  98. package/dist/toolbar/uml-menu.d.ts +17 -0
  99. package/dist/toolbar/uml-menu.js +20 -0
  100. package/dist/toolbar/uml-senior-button.d.ts +18 -0
  101. package/dist/toolbar/uml-senior-button.js +22 -0
  102. package/dist/translations.d.ts +27 -0
  103. package/dist/translations.js +117 -0
  104. package/dist/view.d.ts +33 -0
  105. package/dist/view.js +236 -0
  106. package/dist/xmi-import.d.ts +174 -0
  107. package/dist/xmi-import.js +2268 -0
  108. package/dist/xmi.d.ts +61 -0
  109. package/dist/xmi.js +1860 -0
  110. package/dist/xml-reader.d.ts +157 -0
  111. package/dist/xml-reader.js +430 -0
  112. package/dist/xml.d.ts +72 -0
  113. package/dist/xml.js +96 -0
  114. package/package.json +38 -0
@@ -0,0 +1,257 @@
1
+ import type { UmlNodeKind } from '@formicoidea/labre-core/model';
2
+ import type { RoleDefs, RoleId } from '@formicoidea/labre-core/std/gfx';
3
+ /**
4
+ * UML role vocabulary.
5
+ *
6
+ * A role is the semantic identity of a UML artefact, and here — as in C4 — it is
7
+ * the only thing that carries it. Four of the sixteen node kinds are drawn as
8
+ * the SAME rectangle: a class, an interface, an enumeration and an object differ by
9
+ * the keyword written above the name, and a rule that read the shape would find
10
+ * a box and learn nothing. The `kind` discriminant answers a different question
11
+ * (which glyph to paint, which compartments to lay out); the role answers what
12
+ * the box MEANS.
13
+ *
14
+ * Hierarchy is DATA (`parent`), never TS inheritance, and only where UML 2.5.1
15
+ * itself makes the statement.
16
+ *
17
+ * ## The three specialisation chains, and why there are only three
18
+ *
19
+ * **`uml:classifier`** is the spec's own generalisation: §9.2 makes Class,
20
+ * Interface and DataType (of which Enumeration is one) all Classifiers, and the
21
+ * notation follows — the compartmented rectangle of §11.4.4 is drawn identically
22
+ * for the three, with the keyword line as the discriminator. So a rule written
23
+ * about "classifiers must be named" reaches all three for free through
24
+ * `roleIsA`.
25
+ *
26
+ * `uml:object` is deliberately NOT under it. An object is an
27
+ * InstanceSpecification (§9.8) — it is an INSTANCE of a classifier, not a kind
28
+ * of one — and filing it in the chain would make every rule about classifiers
29
+ * fall on instances, which is the opposite of what the spec says. It shares the
30
+ * rectangle and nothing else, which is exactly the trap this vocabulary exists
31
+ * to avoid.
32
+ *
33
+ * **`uml:association`** is the second, and it is §11.5.4: aggregation and
34
+ * composition ARE associations — the same solid line, with a diamond at the
35
+ * whole's end saying which flavour of part-of it is. `aggregationKind` is a
36
+ * property of an association end in the metamodel, not a different relationship,
37
+ * so a rule about associations must reach both.
38
+ *
39
+ * Generalization, realization, dependency, include and extend are FLAT, and not
40
+ * children of the association either. They are different metaclasses drawn with
41
+ * different lines (§9.9.4, §10.4.4, §7.8.4, §18.1.4) — a generalization is not a
42
+ * kind of association, and an include is not a kind of dependency for our
43
+ * purposes even though the metamodel derives it from DirectedRelationship:
44
+ * flattening what the reader sees as four distinct notations would let one rule
45
+ * silently police all of them.
46
+ *
47
+ * `uml:anchor` is the note attachment of Annex A — the dotted line that ties a
48
+ * comment to what it comments on. Flat, verbless and undirected.
49
+ *
50
+ * **`uml:node`** is the third, and it arrived with the deployment artefacts of
51
+ * phase 2. §19.4 derives both Device and ExecutionEnvironment from Node, and the
52
+ * notation follows: all three are the same 3-D cube, told apart by a keyword
53
+ * (`«device»`, `«executionEnvironment»`). So a rule written about what may be
54
+ * deployed on a node reaches the three for free.
55
+ *
56
+ * It differs from `uml:classifier` in one respect, and the difference is the
57
+ * spec's own: a Node is INSTANTIABLE, so unlike the abstract classifier this
58
+ * parent is ALSO stamped on elements — `kind: 'node'` maps onto it. A role that
59
+ * is both a parent and a drawing is unusual in this library, and it is exactly
60
+ * what §19.4 describes.
61
+ *
62
+ * The other phase-2 artefacts are flat, and each for a stated reason.
63
+ * `uml:component` is a structured Classifier in the metamodel (§11.6) and stays
64
+ * OUT of `uml:classifier` all the same: the notation draws it as its own figure
65
+ * — the two-tabbed icon of §11.6.4 — and the class-diagram rules written on
66
+ * classifiers (a name compartment, features, visibility) are not the sentences a
67
+ * component diagram is audited by. `uml:artifact` is flat for the reason
68
+ * `uml:object` is: it is a physical file, not a kind of anything else drawn
69
+ * here. `uml:port`, `uml:provided-interface` and `uml:required-interface` are
70
+ * parts and glyphs attached to a component (§11.3.4, §10.4.4), not
71
+ * specialisations of it.
72
+ *
73
+ * `uml:communication-path` is FLAT under nothing, and that is the one place this
74
+ * file knowingly departs from the metamodel: §19.4 derives CommunicationPath
75
+ * from Association. The same call the file already makes for include and extend,
76
+ * which the metamodel derives from DirectedRelationship — what a reader sees is
77
+ * a DIFFERENT NOTATION between different things (a line between two cubes, not
78
+ * between two classifiers), and filing it under the association would hand every
79
+ * class-diagram association rule a deployment diagram to police. Recorded here
80
+ * rather than left to be rediscovered.
81
+ *
82
+ * **`uml:control-node`** and **`uml:pseudostate`** are the fourth and fifth,
83
+ * and they arrived with the behaviour artefacts of phase 2. §15.3.4 groups the
84
+ * five shapes that ROUTE an activity's flow (initial, activity final, flow
85
+ * final, decision, fork) under ControlNode, and §14.2.4 groups the seven that
86
+ * route a state machine's transitions (choice, junction, the two histories,
87
+ * entry and exit points, terminate) under Pseudostate. Both parents are
88
+ * ABSTRACT — stamped on nothing, like `uml:classifier` and unlike `uml:node` —
89
+ * because the sentences they exist for ("carries no name", "is never where the
90
+ * machine rests") are true of all of them and of none of them in particular.
91
+ *
92
+ * `uml:initial` is filed under `uml:control-node` because §15.3.4 puts it
93
+ * there, and it is ALSO the role a state machine's initial pseudostate carries:
94
+ * §14.2.4 draws the identical filled disc and means the identical thing by it.
95
+ * That cross-family reading is deliberate — one rule, `uml.initial-single`,
96
+ * then polices both diagrams — and it is recorded on the def so nobody later
97
+ * "fixes" it by splitting the two.
98
+ *
99
+ * `uml:action` and `uml:state` are FLAT, and pointedly not each other's
100
+ * relatives although both are drawn as a round-cornered rectangle: an action is
101
+ * work that happens, a state is a condition that holds. `uml:object-node` is
102
+ * flat for the reason `uml:object` is, and is not the same role as it: an
103
+ * instance specification and a value flowing between actions are different
104
+ * metaclasses sharing a rectangle. `uml:final-state` is flat and drawn exactly
105
+ * like `uml:activity-final`, kept apart because a rule about one must never be
106
+ * handed the other.
107
+ *
108
+ * ## The frames
109
+ *
110
+ * `uml:diagram`, `uml:subject`, `uml:partition` (the swimlane of §15.6.4) and
111
+ * `uml:region` (the composite state of §14.2.4) are parent-less, the same call
112
+ * `c4:board`,
113
+ * `wardley:map` and `bpmn:pool` all make: they are the FRAME the elements are
114
+ * drawn in and drawn round, and a rule written on the artefacts must never fall
115
+ * on the sheet holding them. They are declared `kind: 'node'` for the same
116
+ * reason `c4:board` is — a frame is measured by its bounds — and
117
+ * `packages/affine/all/src/__tests__/reading-coverage.unit.spec.ts` records both
118
+ * as frames so that the reading-profile coverage test does not ask a sheet to
119
+ * read itself back as a sentence.
120
+ *
121
+ * ## Compatibility
122
+ *
123
+ * Nothing is backfilled. A diagram drawn before today carries no role, so it is
124
+ * never evaluated and never says a word (PRD principle 8).
125
+ */
126
+ /** Every role this framework declares. */
127
+ export type UmlRole = 'classifier' | 'class' | 'interface' | 'enumeration' | 'object' | 'package' | 'note' | 'actor' | 'use-case' | 'component' | 'port' | 'provided-interface' | 'required-interface' | 'artifact' | 'node' | 'device' | 'execution-environment' | 'control-node' | 'action' | 'initial' | 'activity-final' | 'flow-final' | 'decision' | 'fork' | 'object-node' | 'send-signal' | 'accept-event' | 'time-event' | 'state' | 'final-state' | 'pseudostate' | 'choice' | 'junction' | 'shallow-history' | 'deep-history' | 'entry-point' | 'exit-point' | 'terminate' | 'lifeline' | 'execution' | 'destruction' | 'name' | 'attributes' | 'operations' | 'label' | 'lifeline-ident' | 'diagram' | 'subject' | 'partition' | 'region' | 'fragment' | 'operand' | 'association' | 'aggregation' | 'composition' | 'generalization' | 'realization' | 'dependency' | 'anchor' | 'include' | 'extend' | 'deploy' | 'manifest' | 'communication-path' | 'control-flow' | 'object-flow' | 'transition' | 'message' | 'message-sync' | 'message-async' | 'message-reply' | 'message-create' | 'message-delete';
128
+ export type UmlRoleId = `uml:${UmlRole}`;
129
+ /**
130
+ * Role ids, keyed by their own name.
131
+ *
132
+ * Keyed by the ROLE and not by the `kind`: UML has thirty-eight node kinds and
133
+ * forty-one node roles, because `uml:classifier`, `uml:control-node` and
134
+ * `uml:pseudostate` are parents nothing is ever drawn as. ({@link
135
+ * UML_ROLE.node} is a parent too, and IS drawn — §19.4 makes a Node
136
+ * instantiable — so it does not add a role of its own.)
137
+ * {@link UML_ROLE_OF_KIND} is the bridge, and it is the only place the two
138
+ * vocabularies meet.
139
+ */
140
+ export declare const UML_ROLE: {
141
+ readonly classifier: "uml:classifier";
142
+ readonly class: "uml:class";
143
+ readonly interface: "uml:interface";
144
+ readonly enumeration: "uml:enumeration";
145
+ readonly object: "uml:object";
146
+ readonly package: "uml:package";
147
+ readonly note: "uml:note";
148
+ readonly actor: "uml:actor";
149
+ readonly 'use-case': "uml:use-case";
150
+ readonly component: "uml:component";
151
+ readonly port: "uml:port";
152
+ readonly 'provided-interface': "uml:provided-interface";
153
+ readonly 'required-interface': "uml:required-interface";
154
+ readonly artifact: "uml:artifact";
155
+ readonly node: "uml:node";
156
+ readonly device: "uml:device";
157
+ readonly 'execution-environment': "uml:execution-environment";
158
+ readonly 'control-node': "uml:control-node";
159
+ readonly action: "uml:action";
160
+ readonly initial: "uml:initial";
161
+ readonly 'activity-final': "uml:activity-final";
162
+ readonly 'flow-final': "uml:flow-final";
163
+ readonly decision: "uml:decision";
164
+ readonly fork: "uml:fork";
165
+ readonly 'object-node': "uml:object-node";
166
+ readonly 'send-signal': "uml:send-signal";
167
+ readonly 'accept-event': "uml:accept-event";
168
+ readonly 'time-event': "uml:time-event";
169
+ readonly state: "uml:state";
170
+ readonly 'final-state': "uml:final-state";
171
+ readonly pseudostate: "uml:pseudostate";
172
+ readonly choice: "uml:choice";
173
+ readonly junction: "uml:junction";
174
+ readonly 'shallow-history': "uml:shallow-history";
175
+ readonly 'deep-history': "uml:deep-history";
176
+ readonly 'entry-point': "uml:entry-point";
177
+ readonly 'exit-point': "uml:exit-point";
178
+ readonly terminate: "uml:terminate";
179
+ readonly lifeline: "uml:lifeline";
180
+ readonly execution: "uml:execution";
181
+ readonly destruction: "uml:destruction";
182
+ readonly name: "uml:name";
183
+ readonly attributes: "uml:attributes";
184
+ readonly operations: "uml:operations";
185
+ readonly label: "uml:label";
186
+ readonly 'lifeline-ident': "uml:lifeline-ident";
187
+ readonly diagram: "uml:diagram";
188
+ readonly subject: "uml:subject";
189
+ readonly partition: "uml:partition";
190
+ readonly region: "uml:region";
191
+ readonly fragment: "uml:fragment";
192
+ readonly operand: "uml:operand";
193
+ readonly association: "uml:association";
194
+ readonly aggregation: "uml:aggregation";
195
+ readonly composition: "uml:composition";
196
+ readonly generalization: "uml:generalization";
197
+ readonly realization: "uml:realization";
198
+ readonly dependency: "uml:dependency";
199
+ readonly anchor: "uml:anchor";
200
+ readonly include: "uml:include";
201
+ readonly extend: "uml:extend";
202
+ readonly deploy: "uml:deploy";
203
+ readonly manifest: "uml:manifest";
204
+ readonly 'communication-path': "uml:communication-path";
205
+ readonly 'control-flow': "uml:control-flow";
206
+ readonly 'object-flow': "uml:object-flow";
207
+ readonly transition: "uml:transition";
208
+ readonly message: "uml:message";
209
+ readonly 'message-sync': "uml:message-sync";
210
+ readonly 'message-async': "uml:message-async";
211
+ readonly 'message-reply': "uml:message-reply";
212
+ readonly 'message-create': "uml:message-create";
213
+ readonly 'message-delete': "uml:message-delete";
214
+ };
215
+ /**
216
+ * i18n key stem of a role id: `uml:class` → `com.labre.uml.role.class`.
217
+ *
218
+ * Exported because the creation sites seed an artefact's NAME from the same key
219
+ * a role labels itself with (a diagram drawn in a French host should not be
220
+ * called "Diagram"): one key for the role and for the seed, because they are the
221
+ * same noun and a host must not be asked to word it twice.
222
+ */
223
+ export declare const umlRoleKey: (local: string) => string;
224
+ /** The diagram frame's own key, read by `createUmlDiagram` to seed its name. */
225
+ export declare const umlDiagramRoleKey: string;
226
+ /** The subject's own key, read by `createUmlSubject` to seed its name. */
227
+ export declare const umlSubjectRoleKey: string;
228
+ /** The partition's own key, read by `createUmlPartition` to seed its name. */
229
+ export declare const umlPartitionRoleKey: string;
230
+ /** The composite state's own key, read by `createUmlRegion` to seed its name. */
231
+ export declare const umlRegionRoleKey: string;
232
+ /**
233
+ * The combined fragment's own key.
234
+ *
235
+ * Unlike the four above it seeds NO name — §17.6.4 writes a guard only where
236
+ * there is one, so `UmlFragmentElementModel.name` starts empty — and the key is
237
+ * exported for the toolbar and the templates, which still have to call the
238
+ * thing something in the user's language.
239
+ */
240
+ export declare const umlFragmentRoleKey: string;
241
+ export declare const UML_ROLES: RoleDefs;
242
+ /**
243
+ * The `kind` discriminant → the role it means.
244
+ *
245
+ * `kind` drives the renderer and is what the palette writes; the ROLE is the
246
+ * semantic authority. The two are posted side by side at every creation site,
247
+ * the way C4, BPMN and Wardley already do it, and this table is the single place
248
+ * that says which kind means which role. Total over {@link UmlNodeKind} by its
249
+ * type, so a new kind cannot land without being given a meaning.
250
+ *
251
+ * One kind, one role, with none collapsed — unlike C4, where four kinds are a
252
+ * second DRAWING of a level. Here the thirty-eight kinds are thirty-eight
253
+ * different artefacts of the specification, and the three roles with no kind of
254
+ * their own — `uml:classifier`, `uml:control-node`, `uml:pseudostate` — are
255
+ * ancestors rather than any of them.
256
+ */
257
+ export declare const UML_ROLE_OF_KIND: Record<UmlNodeKind, RoleId>;