@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.
- package/README.md +219 -213
- package/REFERENCE.md +272 -6
- package/dist/renderengine-workspace.umd.js +11980 -7421
- package/dist/renderengine.umd.js +8991 -5784
- package/examples/archimate.html +68 -66
- package/examples/data-model.html +534 -0
- package/package.json +70 -68
- package/src/bian.js +182 -0
- package/src/charting/CheckboxTreeSelector.js +373 -304
- package/src/charting/DiagramEditor.js +53 -32
- package/src/charting/DiagramTypeRegistry.js +13 -3
- package/src/charting/ModelCheckDialog.js +63 -0
- package/src/charting/ModelChecker.js +26 -0
- package/src/charting/ViewTabStrip.js +94 -81
- package/src/charting/archimate/ArchimateCanvasEditor.js +825 -815
- package/src/charting/archimate/ArchimateElementTemplate.js +208 -195
- package/src/charting/datamodel/BianLandscapeReader.js +185 -0
- package/src/charting/datamodel/BianSemanticApiReader.js +183 -0
- package/src/charting/datamodel/DataModel.js +645 -0
- package/src/charting/datamodel/DataModelChecker.js +92 -0
- package/src/charting/datamodel/DataModelCompared.js +127 -0
- package/src/charting/datamodel/DataModelContext.js +108 -0
- package/src/charting/datamodel/DataModelFileFormat.js +33 -0
- package/src/charting/datamodel/DataModelPerspective.js +129 -0
- package/src/charting/datamodel/DataType.js +108 -0
- package/src/charting/datamodel/EnumerationType.js +51 -0
- package/src/charting/datamodel/LevelMapping.js +38 -0
- package/src/charting/datamodel/LevelSchema.js +41 -0
- package/src/charting/datamodel/ServiceDomain.js +177 -0
- package/src/charting/datamodel/ServiceLandscape.js +104 -0
- package/src/charting/datamodel/StructuredType.js +63 -0
- package/src/charting/datamodel/index.js +15 -0
- package/src/charting/diagramModel/MergeModelCommand.js +43 -37
- package/src/charting/diagramModel/OpenViewList.js +75 -0
- package/src/charting/diagramModel/ViewSetChecker.js +22 -34
- package/src/charting/diagrams/DataModelDiagram.js +160 -86
- package/src/charting/diagrams/DataModelRelationshipStrategy.js +94 -38
- package/src/charting/diagrams/EdgeGeometry.js +578 -553
- package/src/charting/diagrams/GraphDiagram.js +11 -1
- package/src/charting/diagrams/NodeGeometry.js +169 -158
- package/src/charting/diagrams/nesting.js +31 -0
- package/src/charting/glyphs/PersonGlyph.js +24 -23
- package/src/charting/modelTree/ModelTree.js +202 -164
- package/src/charting/modelTree/ModelTreePanel.js +36 -3
- package/src/charting/modelTree/TreeViewMode.js +131 -110
- package/src/charting/modelTree/modes/FlatTreeMode.js +32 -46
- package/src/charting/modelTree/modes/LayerGroupedTreeMode.js +47 -62
- package/src/charting/modelTree/modes/TypeGroupedTreeMode.js +46 -60
- package/src/datamodel.js +132 -122
- package/src/diagramCatalog.js +35 -30
- package/src/index.js +2666 -2659
- package/src/workspace/EditorShell.js +166 -67
- package/src/workspace/PanelLayout.js +56 -0
- package/src/workspace/index.js +1 -0
- package/src/workspace/layout/TabsNode.js +205 -191
- package/src/workspace/parts/ArchimateCanvasPart.js +10 -9
- package/src/workspace/parts/ChartPart.js +6 -1
- package/src/workspace/parts/DataModelPart.js +544 -0
- package/src/workspace/parts/DiagramEditorPart.js +2 -8
- package/src/workspace/parts/EditorPart.js +461 -407
- package/src/workspace/parts/ModelFile.js +216 -187
- package/src/workspace/parts/ModelsPart.js +483 -192
- package/src/workspace/storage/BackupFolder.js +145 -0
- package/src/workspace/storage/KeyValueStore.js +92 -0
- package/src/workspace/storage/ModelLibrary.js +65 -0
- package/src/workspace/workArea.js +417 -413
- 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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
'0..1': '
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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
|
+
};
|
package/src/diagramCatalog.js
CHANGED
|
@@ -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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
]
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
+
}
|