@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
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('<', '&lt;')
35
+ .replaceAll('>', '&gt;');
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 `&#10;` it comes back as it went in.
51
+ */
52
+ export function escapeAttr(value) {
53
+ return escapeText(value)
54
+ .replaceAll('"', '&quot;')
55
+ .replaceAll("'", '&apos;')
56
+ .replaceAll('\n', '&#10;')
57
+ .replaceAll('\r', '&#13;')
58
+ .replaceAll('\t', '&#9;');
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
+ }