@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.
- package/LICENSE +384 -0
- package/dist/actions.d.ts +430 -0
- package/dist/actions.js +724 -0
- package/dist/background.d.ts +153 -0
- package/dist/background.js +557 -0
- package/dist/board-hit.d.ts +137 -0
- package/dist/board-hit.js +191 -0
- package/dist/commands-manifest.d.ts +19 -0
- package/dist/commands-manifest.js +571 -0
- package/dist/commands.d.ts +4 -0
- package/dist/commands.js +983 -0
- package/dist/component.d.ts +521 -0
- package/dist/component.js +708 -0
- package/dist/consts.d.ts +365 -0
- package/dist/consts.js +463 -0
- package/dist/descriptor.d.ts +12 -0
- package/dist/descriptor.js +10 -0
- package/dist/drawio-decode.d.ts +32 -0
- package/dist/drawio-decode.js +96 -0
- package/dist/drawio-import.d.ts +133 -0
- package/dist/drawio-import.js +885 -0
- package/dist/edge-morph.d.ts +154 -0
- package/dist/edge-morph.js +153 -0
- package/dist/edge-styles.d.ts +78 -0
- package/dist/edge-styles.js +210 -0
- package/dist/effects.d.ts +9 -0
- package/dist/effects.js +6 -0
- package/dist/element-renderer.d.ts +64 -0
- package/dist/element-renderer.js +114 -0
- package/dist/element-view.d.ts +234 -0
- package/dist/element-view.js +430 -0
- package/dist/export.d.ts +61 -0
- package/dist/export.js +41 -0
- package/dist/filename.d.ts +17 -0
- package/dist/filename.js +26 -0
- package/dist/frame-tag.d.ts +70 -0
- package/dist/frame-tag.js +78 -0
- package/dist/grammar.d.ts +695 -0
- package/dist/grammar.js +1436 -0
- package/dist/import.d.ts +306 -0
- package/dist/import.js +1270 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +67 -0
- package/dist/interchange.d.ts +125 -0
- package/dist/interchange.js +372 -0
- package/dist/keywords.d.ts +204 -0
- package/dist/keywords.js +361 -0
- package/dist/kinds.d.ts +73 -0
- package/dist/kinds.js +91 -0
- package/dist/legend.d.ts +30 -0
- package/dist/legend.js +255 -0
- package/dist/model.d.ts +862 -0
- package/dist/model.js +1316 -0
- package/dist/morph.d.ts +178 -0
- package/dist/morph.js +496 -0
- package/dist/node/act-glyphs.d.ts +30 -0
- package/dist/node/act-glyphs.js +142 -0
- package/dist/node/compartment-watcher.d.ts +107 -0
- package/dist/node/compartment-watcher.js +163 -0
- package/dist/node/fit.d.ts +85 -0
- package/dist/node/fit.js +129 -0
- package/dist/node/node-renderer.d.ts +49 -0
- package/dist/node/node-renderer.js +611 -0
- package/dist/node/node-view.d.ts +51 -0
- package/dist/node/node-view.js +89 -0
- package/dist/node/paint.d.ts +84 -0
- package/dist/node/paint.js +143 -0
- package/dist/node/sd-glyphs.d.ts +36 -0
- package/dist/node/sd-glyphs.js +79 -0
- package/dist/node/stm-glyphs.d.ts +22 -0
- package/dist/node/stm-glyphs.js +111 -0
- package/dist/node/tier-metrics.d.ts +38 -0
- package/dist/node/tier-metrics.js +45 -0
- package/dist/operators.d.ts +45 -0
- package/dist/operators.js +75 -0
- package/dist/plantuml-import.d.ts +113 -0
- package/dist/plantuml-import.js +1723 -0
- package/dist/plantuml.d.ts +94 -0
- package/dist/plantuml.js +985 -0
- package/dist/presets.d.ts +149 -0
- package/dist/presets.js +302 -0
- package/dist/profiles.d.ts +2 -0
- package/dist/profiles.js +358 -0
- package/dist/reading.d.ts +160 -0
- package/dist/reading.js +648 -0
- package/dist/roles.d.ts +257 -0
- package/dist/roles.js +997 -0
- package/dist/rules.d.ts +267 -0
- package/dist/rules.js +3090 -0
- package/dist/templates.d.ts +2 -0
- package/dist/templates.js +197 -0
- package/dist/toolbar/config.d.ts +228 -0
- package/dist/toolbar/config.js +833 -0
- package/dist/toolbar/icons.d.ts +440 -0
- package/dist/toolbar/icons.js +711 -0
- package/dist/toolbar/senior-tool.d.ts +11 -0
- package/dist/toolbar/senior-tool.js +21 -0
- package/dist/toolbar/uml-menu.d.ts +17 -0
- package/dist/toolbar/uml-menu.js +20 -0
- package/dist/toolbar/uml-senior-button.d.ts +18 -0
- package/dist/toolbar/uml-senior-button.js +22 -0
- package/dist/translations.d.ts +27 -0
- package/dist/translations.js +117 -0
- package/dist/view.d.ts +33 -0
- package/dist/view.js +236 -0
- package/dist/xmi-import.d.ts +174 -0
- package/dist/xmi-import.js +2268 -0
- package/dist/xmi.d.ts +61 -0
- package/dist/xmi.js +1860 -0
- package/dist/xml-reader.d.ts +157 -0
- package/dist/xml-reader.js +430 -0
- package/dist/xml.d.ts +72 -0
- package/dist/xml.js +96 -0
- package/package.json +38 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import type { InterchangeImportContext, InterchangeReport, SerializedElementProps } from '@formicoidea/labre-core/blocks/surface';
|
|
2
|
+
import type { ForeignInterchange } from '@formicoidea/labre-core/std/gfx';
|
|
3
|
+
import type { UmlBox } from './component.js';
|
|
4
|
+
import type { UmlModel } from './model.js';
|
|
5
|
+
/**
|
|
6
|
+
* An **XMI 2.5.1 document, read back as models** — the inverse of `xmi.ts`.
|
|
7
|
+
*
|
|
8
|
+
* ## The promise, and its exact shape
|
|
9
|
+
*
|
|
10
|
+
* The file our writer produces imports back to the model it was written from.
|
|
11
|
+
* That is the round-trip `__tests__/xmi-import.unit.spec.ts` pins golden by
|
|
12
|
+
* golden, and it is the only promise worth making about an interchange pair:
|
|
13
|
+
* an architect who exports a sheet, opens it in Papyrus and brings it back must
|
|
14
|
+
* find the same diagram, not a plausible one.
|
|
15
|
+
*
|
|
16
|
+
* What does NOT come back is what the writer never wrote (`xmi.ts`'s header
|
|
17
|
+
* says so in as many words): **not one coordinate**. A UML model file carries a
|
|
18
|
+
* model; the picture stays in Labre. So an import of our own export has no
|
|
19
|
+
* geometry, the materializer invents a layout, and the report says so (ADR 0012
|
|
20
|
+
* D4 — "it never claims a position it invented came from the file"). A file
|
|
21
|
+
* from a tool that DOES ship diagram interchange — Papyrus's `.notation`, a
|
|
22
|
+
* `umldi` island — is read for its shapes' bounds, and those are used verbatim.
|
|
23
|
+
*
|
|
24
|
+
* ## Preservation is the whole point (ADR 0012 D1, D2, D5)
|
|
25
|
+
*
|
|
26
|
+
* Everything this reader does not map is **quarantined verbatim**: the file's
|
|
27
|
+
* own bytes, sliced out of the source ({@link xmlFragmentOf}), filed under the
|
|
28
|
+
* nearest mapped ancestor's source id, and carried in the document forever.
|
|
29
|
+
*
|
|
30
|
+
* Quarantined and not *carried*, and the difference is not a hedge. D1's
|
|
31
|
+
* "carried" state promises re-emission in place, and this framework has no
|
|
32
|
+
* writer that could keep that promise: `xmi.ts` builds a document out of the IR
|
|
33
|
+
* alone and has no slot anywhere in it for a verbatim fragment. A state that
|
|
34
|
+
* says "kept, and deliberately not written back" is exactly D5's, and saying so
|
|
35
|
+
* is better than filing a fragment under a promise nothing can honour. The day
|
|
36
|
+
* the writer learns to splice fragments, the classification moves — the DATA
|
|
37
|
+
* does not, because it is all still there.
|
|
38
|
+
*
|
|
39
|
+
* Unknown ATTRIBUTES on an element that *was* mapped are carried rather than
|
|
40
|
+
* quarantined, under {@link ForeignInterchange.attrs}, because an attribute has
|
|
41
|
+
* somewhere to go back to and because tranche H reads association-end
|
|
42
|
+
* multiplicities out of exactly that slot.
|
|
43
|
+
*
|
|
44
|
+
* ## What is knowingly lost, and it is one thing
|
|
45
|
+
*
|
|
46
|
+
* **Containment.** A `packagedElement` inside a `uml:Package`, an
|
|
47
|
+
* `ownedUseCase` inside its subject: both are statements, and on this canvas
|
|
48
|
+
* both are made by DRAWING one box inside another — `xmi.ts`'s `containerOf`
|
|
49
|
+
* reads them off geometry and nothing stores them. A model file carries no
|
|
50
|
+
* geometry, so a sheet imported from one is laid out side by side and a second
|
|
51
|
+
* export writes the elements as siblings. Nothing is destroyed and nothing is
|
|
52
|
+
* mis-stated; the nesting is simply not re-drawn, and the report says so in the
|
|
53
|
+
* user's words so they can put the box back in one drag. A file that DOES carry
|
|
54
|
+
* diagram interchange keeps its nesting, because then the geometry is there.
|
|
55
|
+
*
|
|
56
|
+
* The round trip is therefore a **fixed point after one cycle**, which is D3's
|
|
57
|
+
* own phrase for identity and holds here for shape as well: export, import,
|
|
58
|
+
* export — and every export after that is byte-identical.
|
|
59
|
+
*
|
|
60
|
+
* ## Tolerant everywhere, refusing nowhere
|
|
61
|
+
*
|
|
62
|
+
* No throw, in any input. A root nobody recognises produces an empty result and
|
|
63
|
+
* a note; a half-written file produces what it said and a note; an association
|
|
64
|
+
* with one end produces a note and no relation. The reason is BPMN's inverted:
|
|
65
|
+
* that reader can refuse a `.dmn` because a `<definitions>` in the wrong
|
|
66
|
+
* namespace is provably another format, whereas "UML-ish XML" has a dozen
|
|
67
|
+
* dialects and refusing one of them over a spelling would refuse a real model.
|
|
68
|
+
*
|
|
69
|
+
* ## Pure
|
|
70
|
+
*
|
|
71
|
+
* A string in, records out. No `std`, no DOM (the tokenizer is `xml-reader.ts`,
|
|
72
|
+
* written for this reason), no clock, no randomness — `docs/adr/0012` P3.
|
|
73
|
+
*/
|
|
74
|
+
/** One diagram's worth of geometry, by SOURCE id — `{}` for a file with none. */
|
|
75
|
+
export type UmlXmiLayout = Record<string, UmlBox>;
|
|
76
|
+
export interface UmlXmiImport {
|
|
77
|
+
/**
|
|
78
|
+
* One model per top-level package, in document order.
|
|
79
|
+
*
|
|
80
|
+
* A package per diagram is what the writer produces (`diagramPackage`), and
|
|
81
|
+
* the only reading that keeps four sheets four sheets: a `uml:Model` whose
|
|
82
|
+
* classifiers hang loose is one namespace, and ADR 0017 refuses that merge on
|
|
83
|
+
* the canvas. A file with no packages at all — which is what Papyrus writes
|
|
84
|
+
* for a single-diagram model — is read as ONE model off the root.
|
|
85
|
+
*/
|
|
86
|
+
models: UmlModel[];
|
|
87
|
+
/** Where the file's own diagram interchange, if any, drew each source id. */
|
|
88
|
+
layout: UmlXmiLayout;
|
|
89
|
+
/**
|
|
90
|
+
* What the file declares INSIDE what — child source id → container source id.
|
|
91
|
+
*
|
|
92
|
+
* An XMI model states containment structurally (`packagedElement`,
|
|
93
|
+
* `ownedUseCase`) and, unless it carries a `umldi` diagram, says nothing at
|
|
94
|
+
* all about where any of it is drawn. On this canvas containment IS geometry —
|
|
95
|
+
* `xmi.ts`'s own `containerOf` reads it back off the boxes — so the statement
|
|
96
|
+
* has to reach the materializer's invented layout or it is lost on the first
|
|
97
|
+
* export: a package imported empty, and every class of it laid out beside it.
|
|
98
|
+
*
|
|
99
|
+
* Handed over rather than applied here for the reason {@link foreign} is: this
|
|
100
|
+
* reader has no layout engine, and the one that has is shared with the other
|
|
101
|
+
* two formats.
|
|
102
|
+
*/
|
|
103
|
+
containment: Record<string, string>;
|
|
104
|
+
/**
|
|
105
|
+
* Foreign matter, by the source id of the element it rides on (D2).
|
|
106
|
+
*
|
|
107
|
+
* The materializer owns the id map — it is the only thing that knows which
|
|
108
|
+
* serialized element props stand for which IR node — so it owns the
|
|
109
|
+
* attachment too, and this is handed to it rather than applied here.
|
|
110
|
+
*/
|
|
111
|
+
foreign: Record<string, ForeignInterchange>;
|
|
112
|
+
report: InterchangeReport;
|
|
113
|
+
}
|
|
114
|
+
/** The reasons a fragment is kept and not written back (ADR 0012 D5). */
|
|
115
|
+
export declare const UML_XMI_QUARANTINE_REASON: {
|
|
116
|
+
readonly unmapped: string;
|
|
117
|
+
readonly danglingEnd: string;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* The remarks this reader raises whose wording is FIXED, as `[key, English]`
|
|
121
|
+
* pairs — the same table, the same shape and the same reasons as
|
|
122
|
+
* `UML_PLANTUML_REMARKS` (`plantuml-import.ts`, where the contract is written
|
|
123
|
+
* out) and BPMN's own `BPMN_IMPORT_REMARKS`: one entry per SHAPE of sentence,
|
|
124
|
+
* `{{name}}` holes filled at the call site by `InterchangeNote.messageParams`,
|
|
125
|
+
* the English kept here as the fallback so a playground with no catalogue
|
|
126
|
+
* reads exactly what it read before.
|
|
127
|
+
*
|
|
128
|
+
* {@link UML_XMI_QUARANTINE_REASON} above is NOT part of it, and cannot be:
|
|
129
|
+
* its plain string is also written verbatim into
|
|
130
|
+
* `ForeignInterchange.quarantined[].reason` — data, never translated — so it
|
|
131
|
+
* cannot become a `[key, english]` pair without breaking that contract. BPMN
|
|
132
|
+
* carries the identical constraint on its own quarantine reasons.
|
|
133
|
+
*/
|
|
134
|
+
export declare const UML_XMI_REMARKS: {
|
|
135
|
+
readonly mintedId: readonly ["com.labre.uml.import.xmi.minted-id", "<{{tag}}> carries no xmi:id, so one was minted for it. Nothing in the file can refer to it, and nothing does."];
|
|
136
|
+
readonly unlistedOperator: readonly ["com.labre.uml.import.xmi.unlisted-operator", "This combined fragment's operator is \"{{operator}}\", which UML 2.5.1 §17.6.4 does not list. It is drawn as an \"alt\" and the file's own word is kept beside it."];
|
|
137
|
+
readonly undrawnOccurrence: readonly ["com.labre.uml.import.xmi.undrawn-occurrence", "A message in \"{{name}}\" names an occurrence this sheet has no lifeline for, so it is not drawn. The file still says it, and nothing was removed from the document."];
|
|
138
|
+
readonly wrongRoot: readonly ["com.labre.uml.import.xmi.wrong-root", "A UML interchange file opens on <uml:Model> or <uml:Package>; this one opens on <{{tag}}>. Nothing was imported."];
|
|
139
|
+
readonly noXml: readonly ["com.labre.uml.import.xmi.no-xml", "There is no XML element in this file, so there is no model in it."];
|
|
140
|
+
readonly offSheetRelation: readonly ["com.labre.uml.import.xmi.off-sheet-relation", "A {{kind}} in \"{{name}}\" runs to an element that is not on this sheet, so it is not drawn. The file still says it, and nothing was removed from the document."];
|
|
141
|
+
readonly modelWithoutDiagram: readonly ["com.labre.uml.import.xmi.model-without-diagram", "This file carries a model and no diagram, which is what the UML interchange format is for. Every position on the canvas was invented; none of them came from the file."];
|
|
142
|
+
readonly nestedWithoutDrawing: readonly ["com.labre.uml.import.xmi.nested-without-drawing", "{{count}} element(s) are declared inside another in this file — a class in a package, a use case in its subject. Labre states that by DRAWING one box inside the other, and this file carries no drawing, so they were laid out side by side. Move them into the box to say it again."];
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Read an XMI 2.5.1 document as models plus a report.
|
|
146
|
+
*
|
|
147
|
+
* See the module comment for the contract, and `docs/adr/0012` D1–D6 for why it
|
|
148
|
+
* is this contract and not a shorter one.
|
|
149
|
+
*/
|
|
150
|
+
export declare function importXmi(source: string, context?: InterchangeImportContext): UmlXmiImport;
|
|
151
|
+
/**
|
|
152
|
+
* The materializer's elements, each carrying what the file said about it.
|
|
153
|
+
*
|
|
154
|
+
* ## Why this is a second pass and not an argument
|
|
155
|
+
*
|
|
156
|
+
* `umlElementsFromModel` already writes `interchange[formatId] = { id }` on
|
|
157
|
+
* every element it mints — the source id, verbatim, which is D3's fixed point —
|
|
158
|
+
* so the id map this needs is not a thing the parser has to be told: it is
|
|
159
|
+
* written on the elements. Merging here keeps the materializer one function of
|
|
160
|
+
* one IR, shared by three importers, none of which has to know what the others
|
|
161
|
+
* carry.
|
|
162
|
+
*
|
|
163
|
+
* The payload is written as ONE whole blob per format, never patched field by
|
|
164
|
+
* field: the `Y.Map` entry is the entire record, so a partial update is a
|
|
165
|
+
* last-write-wins overwrite of everything (D2).
|
|
166
|
+
*
|
|
167
|
+
* ## The residue (D6)
|
|
168
|
+
*
|
|
169
|
+
* A payload whose source id matched no element — the document-scope matter, a
|
|
170
|
+
* quarantined fragment off an element that was never drawn — rides on the FIRST
|
|
171
|
+
* element, which for this materializer is the first sheet's frame. Its accepted
|
|
172
|
+
* asymmetry is D6's own: delete that frame and what it carried goes with it.
|
|
173
|
+
*/
|
|
174
|
+
export declare function umlElementsWithForeign(elements: readonly SerializedElementProps[], foreign: Readonly<Record<string, ForeignInterchange>>, formatId: string): SerializedElementProps[];
|