@peter.prib/renderengine 0.2.5 → 0.2.7

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 (67) hide show
  1. package/README.md +219 -213
  2. package/REFERENCE.md +272 -6
  3. package/dist/renderengine-workspace.umd.js +11980 -7421
  4. package/dist/renderengine.umd.js +8991 -5784
  5. package/examples/archimate.html +68 -66
  6. package/examples/data-model.html +534 -0
  7. package/package.json +70 -68
  8. package/src/bian.js +182 -0
  9. package/src/charting/CheckboxTreeSelector.js +373 -304
  10. package/src/charting/DiagramEditor.js +53 -32
  11. package/src/charting/DiagramTypeRegistry.js +13 -3
  12. package/src/charting/ModelCheckDialog.js +63 -0
  13. package/src/charting/ModelChecker.js +26 -0
  14. package/src/charting/ViewTabStrip.js +94 -81
  15. package/src/charting/archimate/ArchimateCanvasEditor.js +825 -815
  16. package/src/charting/archimate/ArchimateElementTemplate.js +208 -195
  17. package/src/charting/datamodel/BianLandscapeReader.js +185 -0
  18. package/src/charting/datamodel/BianSemanticApiReader.js +183 -0
  19. package/src/charting/datamodel/DataModel.js +645 -0
  20. package/src/charting/datamodel/DataModelChecker.js +92 -0
  21. package/src/charting/datamodel/DataModelCompared.js +127 -0
  22. package/src/charting/datamodel/DataModelContext.js +108 -0
  23. package/src/charting/datamodel/DataModelFileFormat.js +33 -0
  24. package/src/charting/datamodel/DataModelPerspective.js +129 -0
  25. package/src/charting/datamodel/DataType.js +108 -0
  26. package/src/charting/datamodel/EnumerationType.js +51 -0
  27. package/src/charting/datamodel/LevelMapping.js +38 -0
  28. package/src/charting/datamodel/LevelSchema.js +41 -0
  29. package/src/charting/datamodel/ServiceDomain.js +177 -0
  30. package/src/charting/datamodel/ServiceLandscape.js +104 -0
  31. package/src/charting/datamodel/StructuredType.js +63 -0
  32. package/src/charting/datamodel/index.js +15 -0
  33. package/src/charting/diagramModel/MergeModelCommand.js +43 -37
  34. package/src/charting/diagramModel/OpenViewList.js +75 -0
  35. package/src/charting/diagramModel/ViewSetChecker.js +22 -34
  36. package/src/charting/diagrams/DataModelDiagram.js +160 -86
  37. package/src/charting/diagrams/DataModelRelationshipStrategy.js +94 -38
  38. package/src/charting/diagrams/EdgeGeometry.js +578 -553
  39. package/src/charting/diagrams/GraphDiagram.js +11 -1
  40. package/src/charting/diagrams/NodeGeometry.js +169 -158
  41. package/src/charting/diagrams/nesting.js +31 -0
  42. package/src/charting/glyphs/PersonGlyph.js +24 -23
  43. package/src/charting/modelTree/ModelTree.js +202 -164
  44. package/src/charting/modelTree/ModelTreePanel.js +36 -3
  45. package/src/charting/modelTree/TreeViewMode.js +131 -110
  46. package/src/charting/modelTree/modes/FlatTreeMode.js +32 -46
  47. package/src/charting/modelTree/modes/LayerGroupedTreeMode.js +47 -62
  48. package/src/charting/modelTree/modes/TypeGroupedTreeMode.js +46 -60
  49. package/src/datamodel.js +132 -122
  50. package/src/diagramCatalog.js +35 -30
  51. package/src/index.js +2666 -2659
  52. package/src/workspace/EditorShell.js +166 -67
  53. package/src/workspace/PanelLayout.js +56 -0
  54. package/src/workspace/index.js +1 -0
  55. package/src/workspace/layout/TabsNode.js +205 -191
  56. package/src/workspace/parts/ArchimateCanvasPart.js +10 -9
  57. package/src/workspace/parts/ChartPart.js +6 -1
  58. package/src/workspace/parts/DataModelPart.js +544 -0
  59. package/src/workspace/parts/DiagramEditorPart.js +2 -8
  60. package/src/workspace/parts/EditorPart.js +461 -407
  61. package/src/workspace/parts/ModelFile.js +216 -187
  62. package/src/workspace/parts/ModelsPart.js +483 -192
  63. package/src/workspace/storage/BackupFolder.js +145 -0
  64. package/src/workspace/storage/KeyValueStore.js +92 -0
  65. package/src/workspace/storage/ModelLibrary.js +65 -0
  66. package/src/workspace/workArea.js +417 -413
  67. package/src/yaml/YamlReader.js +372 -0
package/src/datamodel.js CHANGED
@@ -1,122 +1,132 @@
1
- // Copyright 2026 Jaroslav Peter Prib, Purveyor of Excellence
2
- /**
3
- * Data-modelling notation — deliberately its own file/OO module, same split
4
- * as src/archimate.js: keeps this domain's vocabulary (levels, notation
5
- * styles, cardinality) out of RenderEngine itself, queried through the
6
- * `DataModelNotation` registry rather than flat string-keyed maps.
7
- *
8
- * **Three levels, one entity.** A conceptual/logical/physical data model
9
- * isn't three unrelated diagrams — it's the same entities and relationships
10
- * shown at increasing fidelity. `dataModelDiagram` (see RenderEngine)
11
- * expresses that as ONE entity object carrying per-level detail
12
- * (`entity.logical.attributes`, `entity.physical.attributes`, ...) under a
13
- * shared `name`/`description` — the same "object" (level-agnostic identity)
14
- * vs "visual/detail" (this level's own presentation) split archimateDiagram
15
- * already draws between an element and its diagram — with `options.level`
16
- * picking which one's on screen. That's the cross-mapping: switching level
17
- * re-renders the SAME entities/relationships, not a second, separately
18
- * maintained diagram, so a conceptual entity, its logical attributes, and
19
- * its physical column types can never drift out of correspondence.
20
- *
21
- * **Three notations, one cardinality vocabulary.** A relationship's
22
- * cardinality at each end is stored once, as a UML-style multiplicity
23
- * string (`'0..1'|'1'|'0..*'|'*'|'1..*'`) — CARDINALITIES below — and each
24
- * `NotationStyle` renders it its own way: Chen turns the relationship
25
- * itself into a diamond-shaped node with a plain text label ('1'/'N') on
26
- * each connecting edge; Crow's Foot renders it as an arrowhead-style glyph
27
- * at the entity end (fork for "many", tick for "one", circle for
28
- * "optional" — see the `crowsfoot-*` markers in SVGRenderer.js); UML shows
29
- * the multiplicity string itself as a text label near that end
30
- * (`edge.sourceLabel`/`targetLabel`, a plain graphDiagram feature, not
31
- * data-model-specific). None of these are pixel-perfect renditions of the
32
- * real notations' full rule set (Chen's own attribute-oval convention,
33
- * every crow's-foot optionality combination, UML's aggregation/composition
34
- * diamonds) — they're a representative, genuinely-readable version of each,
35
- * the same calibration archimateDiagram's own icons use.
36
- */
37
-
38
- /** One data-modelling abstraction level. See DataModelNotation.levels(). */
39
- export class DataModelLevel {
40
- constructor(name, description) {
41
- this.name = name;
42
- this.description = description;
43
- }
44
- }
45
-
46
- /** The canonical cardinality vocabulary every NotationStyle renders
47
- * differently — UML-style multiplicity strings, since they're the only one
48
- * of the three notations expressive enough to BE the canonical form
49
- * without losing information (Chen/Crow's Foot each collapse some of these
50
- * distinctions on purpose). */
51
- const CARDINALITIES = new Set(['0..1', '1', '0..*', '*', '1..*']);
52
-
53
- function chenCardinalityLabel(cardinality) {
54
- return cardinality === '1' || cardinality === '0..1' ? '1' : 'N';
55
- }
56
-
57
- const CROWSFOOT_ARROWHEADS = {
58
- '1': 'crowsfoot-one',
59
- '0..1': 'crowsfoot-one-optional',
60
- '1..*': 'crowsfoot-many-mandatory',
61
- '0..*': 'crowsfoot-many',
62
- '*': 'crowsfoot-many',
63
- };
64
-
65
- /**
66
- * One drawing technique for entities/relationships — Chen, Crow's Foot, or
67
- * UML (class-diagram style). `entityShape` picks the graphDiagram node shape
68
- * (`'rect'` for a plain box, `'table'` for a header + attribute-rows card);
69
- * `relationshipAsNode` (Chen only) turns a relationship into its own
70
- * diamond-shaped node with two plain edges instead of one direct edge;
71
- * `cardinalityArrowhead`/`cardinalityLabel` (each `(cardinality) => value or
72
- * undefined`) pick how a relationship's own cardinality at one end renders
73
- * — at most one of the two is ever set for a given notation, the other
74
- * always returns undefined.
75
- */
76
- export class NotationStyle {
77
- constructor(name, { entityShape, relationshipAsNode, cardinalityArrowhead, cardinalityLabel }) {
78
- this.name = name;
79
- this.entityShape = entityShape;
80
- this.relationshipAsNode = relationshipAsNode;
81
- this.cardinalityArrowhead = cardinalityArrowhead;
82
- this.cardinalityLabel = cardinalityLabel;
83
- }
84
- }
85
-
86
- const LEVELS = {
87
- conceptual: new DataModelLevel('conceptual', 'Entities and their relationships only — no attributes, no keys, no types.'),
88
- logical: new DataModelLevel('logical', 'Attributes and keys, still database-agnostic — no column types or engine specifics.'),
89
- physical: new DataModelLevel('physical', 'Real column types, keys, and constraints as they exist in an actual database.'),
90
- };
91
-
92
- const NOTATIONS = {
93
- chen: new NotationStyle('chen', {
94
- entityShape: 'rect',
95
- relationshipAsNode: true,
96
- cardinalityArrowhead: () => undefined,
97
- cardinalityLabel: chenCardinalityLabel,
98
- }),
99
- crowsfoot: new NotationStyle('crowsfoot', {
100
- entityShape: 'table',
101
- relationshipAsNode: false,
102
- cardinalityArrowhead: (cardinality) => CROWSFOOT_ARROWHEADS[cardinality],
103
- cardinalityLabel: () => undefined,
104
- }),
105
- uml: new NotationStyle('uml', {
106
- entityShape: 'table',
107
- relationshipAsNode: false,
108
- cardinalityArrowhead: () => undefined,
109
- cardinalityLabel: (cardinality) => cardinality,
110
- }),
111
- };
112
-
113
- export const DataModelNotation = {
114
- levels() { return Object.values(LEVELS); },
115
- levelNames() { return Object.keys(LEVELS); },
116
- level(name) { return LEVELS[name]; },
117
- notations() { return Object.values(NOTATIONS); },
118
- notationNames() { return Object.keys(NOTATIONS); },
119
- notation(name) { return NOTATIONS[name] || NOTATIONS.crowsfoot; },
120
- isCardinality(value) { return CARDINALITIES.has(value); },
121
- cardinalities() { return [...CARDINALITIES]; },
122
- };
1
+ // Copyright 2026 Jaroslav Peter Prib, Purveyor of Excellence
2
+ /**
3
+ * Data-modelling notation — deliberately its own file/OO module, same split
4
+ * as src/archimate.js: keeps this domain's vocabulary (levels, notation
5
+ * styles, cardinality) out of RenderEngine itself, queried through the
6
+ * `DataModelNotation` registry rather than flat string-keyed maps.
7
+ *
8
+ * **Three levels, one entity.** A conceptual/logical/physical data model
9
+ * isn't three unrelated diagrams — it's the same entities and relationships
10
+ * shown at increasing fidelity. `dataModelDiagram` (see RenderEngine)
11
+ * expresses that as ONE entity object carrying per-level detail
12
+ * (`entity.logical.attributes`, `entity.physical.attributes`, ...) under a
13
+ * shared `name`/`description` — the same "object" (level-agnostic identity)
14
+ * vs "visual/detail" (this level's own presentation) split archimateDiagram
15
+ * already draws between an element and its diagram — with `options.level`
16
+ * picking which one's on screen. That's the cross-mapping: switching level
17
+ * re-renders the SAME entities/relationships, not a second, separately
18
+ * maintained diagram, so a conceptual entity, its logical attributes, and
19
+ * its physical column types can never drift out of correspondence.
20
+ *
21
+ * **Three notations, one cardinality vocabulary.** A relationship's
22
+ * cardinality at each end is stored once, as a UML-style multiplicity
23
+ * string (`'0..1'|'1'|'0..*'|'*'|'1..*'`) — CARDINALITIES below — and each
24
+ * `NotationStyle` renders it its own way: Chen turns the relationship
25
+ * itself into a diamond-shaped node with a plain text label ('1'/'N') on
26
+ * each connecting edge; Crow's Foot renders it as an arrowhead-style glyph
27
+ * at the entity end (fork for "many", tick for "one", circle for
28
+ * "optional" — see the `crowsfoot-*` markers in SVGRenderer.js); UML shows
29
+ * the multiplicity string itself as a text label near that end
30
+ * (`edge.sourceLabel`/`targetLabel`, a plain graphDiagram feature, not
31
+ * data-model-specific). None of these are pixel-perfect renditions of the
32
+ * real notations' full rule set (Chen's own attribute-oval convention,
33
+ * every crow's-foot optionality combination, UML's aggregation/composition
34
+ * diamonds) — they're a representative, genuinely-readable version of each,
35
+ * the same calibration archimateDiagram's own icons use.
36
+ */
37
+
38
+ /** One data-modelling abstraction level. See DataModelNotation.levels(). */
39
+ export class DataModelLevel {
40
+ constructor(name, description) {
41
+ this.name = name;
42
+ this.description = description;
43
+ }
44
+
45
+ /** What a menu calls it ('Conceptual'). */
46
+ get label() {
47
+ return this.name.charAt(0).toUpperCase() + this.name.slice(1);
48
+ }
49
+ }
50
+
51
+ /** The canonical cardinality vocabulary every NotationStyle renders
52
+ * differently — UML-style multiplicity strings, since they're the only one
53
+ * of the three notations expressive enough to BE the canonical form
54
+ * without losing information (Chen/Crow's Foot each collapse some of these
55
+ * distinctions on purpose). */
56
+ const CARDINALITIES = new Set(['0..1', '1', '0..*', '*', '1..*']);
57
+
58
+ function chenCardinalityLabel(cardinality) {
59
+ return cardinality === '1' || cardinality === '0..1' ? '1' : 'N';
60
+ }
61
+
62
+ const CROWSFOOT_ARROWHEADS = {
63
+ '1': 'crowsfoot-one',
64
+ '0..1': 'crowsfoot-one-optional',
65
+ '1..*': 'crowsfoot-many-mandatory',
66
+ '0..*': 'crowsfoot-many',
67
+ '*': 'crowsfoot-many',
68
+ };
69
+
70
+ /**
71
+ * One drawing technique for entities/relationships — Chen, Crow's Foot, or
72
+ * UML (class-diagram style). `entityShape` picks the graphDiagram node shape
73
+ * (`'rect'` for a plain box, `'table'` for a header + attribute-rows card);
74
+ * `relationshipAsNode` (Chen only) turns a relationship into its own
75
+ * diamond-shaped node with two plain edges instead of one direct edge;
76
+ * `cardinalityArrowhead`/`cardinalityLabel` (each `(cardinality) => value or
77
+ * undefined`) pick how a relationship's own cardinality at one end renders
78
+ * — at most one of the two is ever set for a given notation, the other
79
+ * always returns undefined.
80
+ */
81
+ export class NotationStyle {
82
+ constructor(name, { label = name, entityShape, relationshipAsNode, cardinalityArrowhead, cardinalityLabel }) {
83
+ this.name = name;
84
+ /** What a menu calls it ("Crow's Foot"). */
85
+ this.label = label;
86
+ this.entityShape = entityShape;
87
+ this.relationshipAsNode = relationshipAsNode;
88
+ this.cardinalityArrowhead = cardinalityArrowhead;
89
+ this.cardinalityLabel = cardinalityLabel;
90
+ }
91
+ }
92
+
93
+ const LEVELS = {
94
+ conceptual: new DataModelLevel('conceptual', 'Entities and their relationships only — no attributes, no keys, no types.'),
95
+ logical: new DataModelLevel('logical', 'Attributes and keys, still database-agnostic — no column types or engine specifics.'),
96
+ physical: new DataModelLevel('physical', 'Real column types, keys, and constraints as they exist in an actual database.'),
97
+ };
98
+
99
+ const NOTATIONS = {
100
+ chen: new NotationStyle('chen', {
101
+ label: 'Chen',
102
+ entityShape: 'rect',
103
+ relationshipAsNode: true,
104
+ cardinalityArrowhead: () => undefined,
105
+ cardinalityLabel: chenCardinalityLabel,
106
+ }),
107
+ crowsfoot: new NotationStyle('crowsfoot', {
108
+ label: "Crow's Foot",
109
+ entityShape: 'table',
110
+ relationshipAsNode: false,
111
+ cardinalityArrowhead: (cardinality) => CROWSFOOT_ARROWHEADS[cardinality],
112
+ cardinalityLabel: () => undefined,
113
+ }),
114
+ uml: new NotationStyle('uml', {
115
+ label: 'UML',
116
+ entityShape: 'table',
117
+ relationshipAsNode: false,
118
+ cardinalityArrowhead: () => undefined,
119
+ cardinalityLabel: (cardinality) => cardinality,
120
+ }),
121
+ };
122
+
123
+ export const DataModelNotation = {
124
+ levels() { return Object.values(LEVELS); },
125
+ levelNames() { return Object.keys(LEVELS); },
126
+ level(name) { return LEVELS[name]; },
127
+ notations() { return Object.values(NOTATIONS); },
128
+ notationNames() { return Object.keys(NOTATIONS); },
129
+ notation(name) { return NOTATIONS[name] || NOTATIONS.crowsfoot; },
130
+ isCardinality(value) { return CARDINALITIES.has(value); },
131
+ cardinalities() { return [...CARDINALITIES]; },
132
+ };
@@ -1,30 +1,35 @@
1
- /**
2
- * Single source of truth for "what diagram types does RenderEngine support".
3
- *
4
- * Mirrors src/chartCatalog.js: the registry is the object-oriented lookup
5
- * layer over the flat catalog, and `getDiagramCatalogEntry` is the legacy-style
6
- * helper kept for backward compatibility.
7
- */
8
-
9
- import { DiagramRegistry } from './charting/DiagramRegistry.js';
10
- import { GraphDiagram } from './charting/diagrams/GraphDiagram.js';
11
- import { GraphDiagram3D } from './charting/diagrams/GraphDiagram3D.js';
12
- import { ArchimateDiagram } from './charting/diagrams/ArchimateDiagram.js';
13
- import { DataModelDiagram } from './charting/diagrams/DataModelDiagram.js';
14
- import { EbnfDiagram } from './charting/diagrams/EbnfDiagram.js';
15
-
16
- export const DIAGRAM_CATALOG = [
17
- { key: 'graph', method: 'graphDiagram', DiagramClass: GraphDiagram },
18
- { key: 'graph3d', method: 'graphDiagram3D', DiagramClass: GraphDiagram3D },
19
- { key: 'archimate', method: 'archimateDiagram', DiagramClass: ArchimateDiagram },
20
- { key: 'dataModel', method: 'dataModelDiagram', DiagramClass: DataModelDiagram },
21
- { key: 'ebnf', method: 'ebnfDiagram', DiagramClass: EbnfDiagram },
22
- ];
23
-
24
- /** Canonical registry instance seeded with the built-in diagram types. */
25
- export const diagramRegistry = new DiagramRegistry(DIAGRAM_CATALOG);
26
-
27
- /** Look up one catalog entry by key, or undefined if the key is unknown. */
28
- export function getDiagramCatalogEntry(key) {
29
- return diagramRegistry.get(key);
30
- }
1
+ /**
2
+ * Single source of truth for "what diagram types does RenderEngine support".
3
+ *
4
+ * Mirrors src/chartCatalog.js: the registry is the object-oriented lookup
5
+ * layer over the flat catalog, and `getDiagramCatalogEntry` is the legacy-style
6
+ * helper kept for backward compatibility.
7
+ */
8
+
9
+ import { DiagramRegistry } from './charting/DiagramRegistry.js';
10
+ import { GraphDiagram } from './charting/diagrams/GraphDiagram.js';
11
+ import { GraphDiagram3D } from './charting/diagrams/GraphDiagram3D.js';
12
+ import { ArchimateDiagram } from './charting/diagrams/ArchimateDiagram.js';
13
+ import { DataModelDiagram } from './charting/diagrams/DataModelDiagram.js';
14
+ import { EbnfDiagram } from './charting/diagrams/EbnfDiagram.js';
15
+
16
+ /**
17
+ * Each entry: `key`, the RenderEngine `method` that draws it, its `DiagramClass`,
18
+ * and `args`: the options a registered diagram (RenderEngine#register) keeps its
19
+ * data in, in the order the method takes them before its options.
20
+ */
21
+ export const DIAGRAM_CATALOG = [
22
+ { key: 'graph', method: 'graphDiagram', DiagramClass: GraphDiagram, args: ['nodes', 'edges'] },
23
+ { key: 'graph3d', method: 'graphDiagram3D', DiagramClass: GraphDiagram3D, args: ['nodes', 'edges'] },
24
+ { key: 'archimate', method: 'archimateDiagram', DiagramClass: ArchimateDiagram, args: ['elements', 'relationships'] },
25
+ { key: 'dataModel', method: 'dataModelDiagram', DiagramClass: DataModelDiagram, args: ['entities', 'relationships'] },
26
+ { key: 'ebnf', method: 'ebnfDiagram', DiagramClass: EbnfDiagram, args: ['rule'] },
27
+ ];
28
+
29
+ /** Canonical registry instance seeded with the built-in diagram types. */
30
+ export const diagramRegistry = new DiagramRegistry(DIAGRAM_CATALOG);
31
+
32
+ /** Look up one catalog entry by key, or undefined if the key is unknown. */
33
+ export function getDiagramCatalogEntry(key) {
34
+ return diagramRegistry.get(key);
35
+ }