@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,45 @@
1
+ import type { UmlFragmentOperator } from '@formicoidea/labre-core/model';
2
+ /**
3
+ * The INTERACTION OPERATOR a combined fragment declares, as the picker offers
4
+ * it — DATA, exactly like `UML_DIAGRAM_KIND_MENU` in `kinds.ts`, and shaped the
5
+ * same way for the same reason: the manifest walks declarations, so every key
6
+ * below reaches a host's catalogue without being restated anywhere.
7
+ *
8
+ * ## The operator is the whole of what a fragment says
9
+ *
10
+ * §17.6.4 draws every combined fragment as the same rectangle with the same
11
+ * cut-corner pentagon in its corner. An `alt` and a `loop` are one picture and
12
+ * two entirely different statements, and the only thing that separates them is
13
+ * the word in the tag — so picking one here changes what the box MEANS, not how
14
+ * it looks. That is why this is a picker on a stored field and not a morph
15
+ * between elements (`morph.ts` is for artefacts that are drawn differently).
16
+ *
17
+ * ## Thirteen, and the thirteenth is not an operator
18
+ *
19
+ * Twelve of these are §17.6.4's own `InteractionOperatorKind`. `ref` is
20
+ * §17.7.4's InteractionUse — a different metaclass, drawn as the same rectangle
21
+ * with the same pentagon — and it is offered from the same menu because that is
22
+ * where every tool puts it and where every architect looks for it. The model's
23
+ * own union records the same choice.
24
+ *
25
+ * ## The order
26
+ *
27
+ * The four an architect actually draws first (`alt`, `opt`, `loop`, `par`),
28
+ * then `ref`, which is the next most reached for; then the rest of §17.6.4 in
29
+ * its own order. A menu that listed twelve operators alphabetically would put
30
+ * `assert` above `alt`, which is a list sorted for a machine.
31
+ */
32
+ export interface UmlFragmentOperatorOption {
33
+ /** What gets written in the pentagon. Never `undefined`: the field is required. */
34
+ operator: UmlFragmentOperator;
35
+ /** i18n key of the entry's words; resolved by the host. */
36
+ labelKey: string;
37
+ /** The framework's own wording, for a host that ships no catalogue. */
38
+ labelFallback: string;
39
+ }
40
+ /** The picker, whole: its heading and its thirteen entries. */
41
+ export declare const UML_FRAGMENT_OPERATOR_MENU: {
42
+ labelKey: string;
43
+ labelFallback: string;
44
+ options: readonly UmlFragmentOperatorOption[];
45
+ };
@@ -0,0 +1,75 @@
1
+ /** i18n key stem: `alt` → `com.labre.uml.operator.alt`. */
2
+ const operatorKey = (name) => `com.labre.uml.operator.${name}`;
3
+ /** The picker, whole: its heading and its thirteen entries. */
4
+ export const UML_FRAGMENT_OPERATOR_MENU = {
5
+ labelKey: operatorKey('section'),
6
+ labelFallback: 'Operator',
7
+ options: [
8
+ {
9
+ operator: 'alt',
10
+ labelKey: operatorKey('alt'),
11
+ labelFallback: 'Alternatives',
12
+ },
13
+ {
14
+ operator: 'opt',
15
+ labelKey: operatorKey('opt'),
16
+ labelFallback: 'Option',
17
+ },
18
+ {
19
+ operator: 'loop',
20
+ labelKey: operatorKey('loop'),
21
+ labelFallback: 'Loop',
22
+ },
23
+ {
24
+ operator: 'par',
25
+ labelKey: operatorKey('par'),
26
+ labelFallback: 'Parallel',
27
+ },
28
+ {
29
+ // §17.7.4, not §17.6.4 — see the header on why it is in this menu.
30
+ operator: 'ref',
31
+ labelKey: operatorKey('ref'),
32
+ labelFallback: 'Interaction use',
33
+ },
34
+ {
35
+ operator: 'break',
36
+ labelKey: operatorKey('break'),
37
+ labelFallback: 'Break',
38
+ },
39
+ {
40
+ operator: 'critical',
41
+ labelKey: operatorKey('critical'),
42
+ labelFallback: 'Critical region',
43
+ },
44
+ {
45
+ operator: 'seq',
46
+ labelKey: operatorKey('seq'),
47
+ labelFallback: 'Weak sequencing',
48
+ },
49
+ {
50
+ operator: 'strict',
51
+ labelKey: operatorKey('strict'),
52
+ labelFallback: 'Strict sequencing',
53
+ },
54
+ {
55
+ operator: 'neg',
56
+ labelKey: operatorKey('neg'),
57
+ labelFallback: 'Negative',
58
+ },
59
+ {
60
+ operator: 'assert',
61
+ labelKey: operatorKey('assert'),
62
+ labelFallback: 'Assertion',
63
+ },
64
+ {
65
+ operator: 'ignore',
66
+ labelKey: operatorKey('ignore'),
67
+ labelFallback: 'Ignore',
68
+ },
69
+ {
70
+ operator: 'consider',
71
+ labelKey: operatorKey('consider'),
72
+ labelFallback: 'Consider',
73
+ },
74
+ ],
75
+ };
@@ -0,0 +1,113 @@
1
+ import type { InterchangeNote } from '@formicoidea/labre-core/blocks/surface';
2
+ import type { UmlModel } from './model.js';
3
+ /**
4
+ * **PlantUML source, read back** — the inverse of `plantuml.ts` over the
5
+ * vocabulary that writer emits, and a tolerant reading of the rest of the
6
+ * language (`docs/adr/0012`, D1–D6).
7
+ *
8
+ * ## What it is for, and it is not symmetry
9
+ *
10
+ * A `.puml` is the format UML diagrams actually live in: it sits in a `docs/`
11
+ * folder beside the code, it diffs line by line in review, and every
12
+ * architecture repository already has some. An importer is what turns that
13
+ * corpus into boards somebody can edit, and it is the only one of the three
14
+ * readers whose input a human wrote by hand — which is why the contract below is
15
+ * "never throw" rather than "refuse what is malformed".
16
+ *
17
+ * ## Never a throw, always a report
18
+ *
19
+ * PlantUML is a large language with a preprocessor, sprites, styles, JSON and
20
+ * YAML diagrams and a dozen shorthands per relationship. This reads the UML
21
+ * subset and files EVERY line it does not understand as a `carried` remark
22
+ * naming the line, so an import of a file half of which is `!include` and
23
+ * `skinparam` produces the diagram it does understand and tells the user
24
+ * precisely what it left on the floor. The alternative — an exception — would
25
+ * turn one unknown directive into a file nobody can open.
26
+ *
27
+ * That is a deliberate departure from `gfx/bpmn/src/import.ts`, which throws: an
28
+ * XML document either is a BPMN interchange file or is not, and there is a root
29
+ * element to ask. A text file has no such question to answer.
30
+ *
31
+ * ## The fixed point
32
+ *
33
+ * Our own export re-imports to the model it was written from, and re-exports to
34
+ * the same bytes. `__tests__/import-roundtrip.unit.spec.ts` pins it on the
35
+ * phase-1 fixtures and `__tests__/plantuml-import.unit.spec.ts` on the corpus
36
+ * file an earlier build actually produced. That property is what makes a `.puml`
37
+ * a place a Labre board can be kept.
38
+ *
39
+ * ## The loss table
40
+ *
41
+ * | what | state | after a round trip |
42
+ * | ------------------------------------------------------- | -------- | ------------------ |
43
+ * | classes, interfaces, enums, objects and their members | mapped | drawn, and written back verbatim |
44
+ * | packages, subjects, actors, use cases, notes | mapped | drawn, and nested as the file nested them |
45
+ * | every relationship operator, and the keyword on it | mapped | the role, and the arrow it is drawn as |
46
+ * | components, artifacts, cubes, declared interfaces | mapped | drawn; a lollipop comes back as `interface` + the two arrows §10.4.4 says it IS |
47
+ * | state machines — states, pseudostates, transitions | mapped | drawn on an `stm` sheet |
48
+ * | end multiplicities (`"1" -- "0..*"`) | carried | named in the report. The IR has no end labels until tranche H, so they are not drawn and not written back |
49
+ * | `skinparam`, `!include`, styles, sprites, preprocessor | carried | named in the report, one line each. A theme in an exported file overrides the repository it lands in, which is why this pack writes none |
50
+ * | the alias a declaration was written under | mapped | kept as the element's source id (D3); the export re-derives an alias from the NAME, so a file whose aliases are hashes comes back readable |
51
+ * | **layout** | invented | PlantUML carries no coordinates. Rows by generalization depth, containers sized to fit — and the report says so (D4) |
52
+ * | a direction hint inside an arrow (`-down->`) | **lost** | read as the plain arrow: Labre lays the diagram out itself |
53
+ * | `hide`, `remove`, `together`, layout directives | carried | named; they say how to DRAW, and the drawing is the board's |
54
+ */
55
+ export interface UmlPlantumlImport {
56
+ /**
57
+ * One model per `@startuml … @enduml` block.
58
+ *
59
+ * A LIST and not one model, because `exportUmlPlantuml` writes one document
60
+ * per diagram and concatenates them: a file holding four blocks is four
61
+ * sheets, and collapsing them would lose exactly the fact ADR 0017 is about.
62
+ * A source with no `@startuml` at all is read as one unwrapped block, which is
63
+ * what half the snippets in the wild are.
64
+ */
65
+ models: UmlModel[];
66
+ notes: InterchangeNote[];
67
+ }
68
+ /**
69
+ * The remarks this reader raises whose wording is FIXED, as `[key, English]`
70
+ * pairs — one entry per SHAPE of sentence, never one per exact string: a
71
+ * remark that names something out of the file (a line of PlantUML, a
72
+ * declaration's alias) carries `{{name}}` holes in the fallback here, filled
73
+ * at the call site by `messageParams` (`InterchangeNote.messageParams`) —
74
+ * never by minting a new key for every value the file happens to carry.
75
+ *
76
+ * A reader is a pure function of text (`docs/adr/0012`, P3) and has no `std`,
77
+ * so it cannot ask the host's catalogue for anything: it declares the key
78
+ * (and, where the sentence has a hole, the params) on the note, and
79
+ * `reportInterchangeImport` resolves both when it draws the report
80
+ * (`InterchangeNote.messageKey` / `.messageParams`). The English string stays
81
+ * here and stays the fallback, so the console table and a playground with no
82
+ * catalogue read exactly what they read before: `translateKey` fills a `{{…}}`
83
+ * hole from `messageParams` even with no `TranslationProvider` registered
84
+ * (`fillPlaceholders`), so the ENGLISH sentence a call site builds is
85
+ * unchanged by giving it a key. BPMN's `BPMN_IMPORT_REMARKS` is the same table
86
+ * for the same reasons, and this one is written to match it — including
87
+ * declaring it in the reader's OWN file rather than in a shared one, so the
88
+ * wording sits beside the line that raises it.
89
+ *
90
+ * Plural wording is the host's: where a count can be 0, 1 or many, the
91
+ * fallback stays grammatically neutral (`'{{count}} element(s)'`) rather than
92
+ * picking English's own singular/plural.
93
+ *
94
+ * They are contributed to the manifest by `./translations.ts`, with the
95
+ * framework, because they ship in the UML bundle rather than in core.
96
+ */
97
+ export declare const UML_PLANTUML_REMARKS: {
98
+ readonly relationEnd: readonly ["com.labre.uml.import.plantuml.relation-end", "The {{side}} end of the {{kind}} between \"{{left}}\" and \"{{right}}\" is written \"{{raw}}\". It is drawn on the board, but UML gives that relationship's ends no multiplicity, so no export writes it."];
99
+ readonly duplicateDeclaration: readonly ["com.labre.uml.import.plantuml.duplicate-declaration", "This document declares \"{{name}}\" twice. The second declaration was read as a separate artefact under an id of Labre's own."];
100
+ readonly renderDirective: readonly ["com.labre.uml.import.plantuml.render-directive", "\"{{line}}\" says how to DRAW the diagram. Labre's canvas has a look of its own, so the directive is recorded here and not applied."];
101
+ readonly unreadLine: readonly ["com.labre.uml.import.plantuml.unread-line", "Labre does not read \"{{line}}\", so it is not on the board. The line is recorded here exactly as the file wrote it."];
102
+ readonly stateSyntax: readonly ["com.labre.uml.import.plantuml.state-syntax", "\"{{heading}}\" is written in PlantUML's state-diagram syntax, which Labre reads as a state machine. The frame keeps the kind the title gave it."];
103
+ readonly autonumber: readonly ["com.labre.uml.import.plantuml.autonumber", "\"{{line}}\" numbers the messages as the renderer draws them. A Labre board writes no numbers on its arrows, so the directive is recorded here and not applied."];
104
+ readonly inventedSequenceLayout: readonly ["com.labre.uml.import.plantuml.invented-sequence-layout", "PlantUML carries no coordinates, so \"{{heading}}\" was laid out by Labre — the participants side by side in the order the file declares them, and one step down the page per message. The ORDER is the file's; the positions are ours."];
105
+ readonly inventedLayout: readonly ["com.labre.uml.import.plantuml.invented-layout", "PlantUML carries no coordinates, so \"{{heading}}\" was laid out by Labre — in rows by generalization depth, with every container sized to fit what it holds. The positions are ours, not the file's."];
106
+ };
107
+ /**
108
+ * Read PlantUML source as one model per `@startuml … @enduml` block.
109
+ *
110
+ * Pure: a string in, records out. No `std`, no DOM, no clock, no randomness —
111
+ * the same source always produces the same models, down to the coordinates.
112
+ */
113
+ export declare function importPlantuml(source: string): UmlPlantumlImport;