@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
package/dist/xml.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A minimal XML tree, and the two escapes that make it safe to write.
|
|
3
|
+
*
|
|
4
|
+
* Sixty lines rather than a dependency, and rather than an import from
|
|
5
|
+
* `gfx/bpmn`: BPMN's writer carries verbatim FRAGMENTS an importer handed it
|
|
6
|
+
* (the foreign-matter contract of `docs/adr/0012` D1), and that unescaped node
|
|
7
|
+
* is the one thing in its tree that must never be constructible from a string
|
|
8
|
+
* nobody serialized. UML writes no fragments — it has no importer yet — so its
|
|
9
|
+
* tree has no such node, and sharing the module would mean sharing an escape
|
|
10
|
+
* hatch this writer has no use for. A copy of eight obvious functions is the
|
|
11
|
+
* cheaper half of that trade.
|
|
12
|
+
*
|
|
13
|
+
* Pure: strings in, strings out, no `std`, no DOM (`DOMParser` appears only in
|
|
14
|
+
* the SPECS, where it checks that what we wrote actually parses).
|
|
15
|
+
*/
|
|
16
|
+
/** An element with attributes and children. */
|
|
17
|
+
export function el(name, attrs = {}, children = []) {
|
|
18
|
+
return { name, attrs, children };
|
|
19
|
+
}
|
|
20
|
+
/** An element whose content is character data. */
|
|
21
|
+
export function textEl(name, text, attrs = {}) {
|
|
22
|
+
return { name, attrs, children: [], text };
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Character DATA — the three characters that would otherwise start markup.
|
|
26
|
+
*
|
|
27
|
+
* A newline, a tab and a carriage return are left exactly as they are, which is
|
|
28
|
+
* what makes a multi-line note body faithful: inside an element, whitespace is
|
|
29
|
+
* content.
|
|
30
|
+
*/
|
|
31
|
+
export function escapeText(value) {
|
|
32
|
+
return value
|
|
33
|
+
.replaceAll('&', '&')
|
|
34
|
+
.replaceAll('<', '<')
|
|
35
|
+
.replaceAll('>', '>');
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* An attribute VALUE, which needs strictly more than character data does.
|
|
39
|
+
*
|
|
40
|
+
* The quotes are the obvious half. The other half loses data silently: XML 1.0
|
|
41
|
+
* §3.3.3 makes every conformant parser replace a literal `#xA`, `#xD` or `#x9`
|
|
42
|
+
* in an attribute value with a SPACE before anyone sees it —
|
|
43
|
+
* attribute-value normalization, and it is not optional. Only a character
|
|
44
|
+
* reference survives it.
|
|
45
|
+
*
|
|
46
|
+
* That matters here because a multi-line label is ordinary on this canvas (it is
|
|
47
|
+
* how a class name fits in its box) and `name` is where nearly all of them go:
|
|
48
|
+
* every classifier, every operation, every comment `body`. Written raw, a
|
|
49
|
+
* two-line note comes back as one line, with no warning and no way for the
|
|
50
|
+
* author to tell. Written as ` ` it comes back as it went in.
|
|
51
|
+
*/
|
|
52
|
+
export function escapeAttr(value) {
|
|
53
|
+
return escapeText(value)
|
|
54
|
+
.replaceAll('"', '"')
|
|
55
|
+
.replaceAll("'", ''')
|
|
56
|
+
.replaceAll('\n', ' ')
|
|
57
|
+
.replaceAll('\r', ' ')
|
|
58
|
+
.replaceAll('\t', '	');
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* One element and everything under it, indented.
|
|
62
|
+
*
|
|
63
|
+
* Attribute ORDER is insertion order, which is what makes a golden test a
|
|
64
|
+
* readable diff rather than a hash: the writer builds `xmi:type` then `xmi:id`
|
|
65
|
+
* then `name` on every element, so two runs of the same model are the same
|
|
66
|
+
* bytes.
|
|
67
|
+
*/
|
|
68
|
+
export function serializeElement(node, indent = '') {
|
|
69
|
+
const attrs = Object.entries(node.attrs)
|
|
70
|
+
.filter(([, value]) => value !== undefined)
|
|
71
|
+
.map(([key, value]) => ` ${key}="${escapeAttr(String(value))}"`)
|
|
72
|
+
.join('');
|
|
73
|
+
if (node.text !== undefined) {
|
|
74
|
+
return `${indent}<${node.name}${attrs}>${escapeText(node.text)}</${node.name}>`;
|
|
75
|
+
}
|
|
76
|
+
if (node.children.length === 0) {
|
|
77
|
+
return `${indent}<${node.name}${attrs}/>`;
|
|
78
|
+
}
|
|
79
|
+
const inner = node.children
|
|
80
|
+
.map(child => serializeElement(child, `${indent} `))
|
|
81
|
+
.join('\n');
|
|
82
|
+
return `${indent}<${node.name}${attrs}>\n${inner}\n${indent}</${node.name}>`;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* A whole document: the prolog, the root, and a trailing newline.
|
|
86
|
+
*
|
|
87
|
+
* The encoding is DECLARED rather than assumed. An XMI file is handed to tools
|
|
88
|
+
* that read bytes off a disk with no HTTP header to tell them anything, and the
|
|
89
|
+
* default for an undeclared document is UTF-8 only by the XML spec's good
|
|
90
|
+
* grace — several readers in this space guess the platform codepage instead,
|
|
91
|
+
* and a `«interface»` that arrives as mojibake is a keyword that has stopped
|
|
92
|
+
* meaning anything.
|
|
93
|
+
*/
|
|
94
|
+
export function serializeDocument(root) {
|
|
95
|
+
return `<?xml version="1.0" encoding="UTF-8"?>\n${serializeElement(root)}\n`;
|
|
96
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@formicoidea/labre-framework-uml",
|
|
3
|
+
"description": "Labre uml framework for @formicoidea/labre-core.",
|
|
4
|
+
"version": "0.42.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"author": "lajola",
|
|
8
|
+
"contributors": [
|
|
9
|
+
"toeverything"
|
|
10
|
+
],
|
|
11
|
+
"license": "MPL-2.0",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./view": {
|
|
18
|
+
"types": "./dist/view.d.ts",
|
|
19
|
+
"import": "./dist/view.js"
|
|
20
|
+
},
|
|
21
|
+
"./descriptor": {
|
|
22
|
+
"types": "./dist/descriptor.d.ts",
|
|
23
|
+
"import": "./dist/descriptor.js"
|
|
24
|
+
},
|
|
25
|
+
"./commands-manifest": {
|
|
26
|
+
"types": "./dist/commands-manifest.d.ts",
|
|
27
|
+
"import": "./dist/commands-manifest.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@formicoidea/labre-core": "0.42.0",
|
|
35
|
+
"@formicoidea/labre-ddd-shared": "0.42.0",
|
|
36
|
+
"lit": "^3.2.0"
|
|
37
|
+
}
|
|
38
|
+
}
|