urban-archimate 0.1.0__tar.gz
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.
- urban_archimate-0.1.0/.gitignore +13 -0
- urban_archimate-0.1.0/PKG-INFO +32 -0
- urban_archimate-0.1.0/README.md +20 -0
- urban_archimate-0.1.0/pyproject.toml +29 -0
- urban_archimate-0.1.0/urban_archimate/__init__.py +31 -0
- urban_archimate-0.1.0/urban_archimate/static/hydrated-model.schema.json +251 -0
- urban_archimate-0.1.0/urban_archimate/static/types/contract/types.d.ts +308 -0
- urban_archimate-0.1.0/urban_archimate/static/types/editor/UrbanArchimateEditor.d.ts +99 -0
- urban_archimate-0.1.0/urban_archimate/static/types/editor/build-moddle.d.ts +30 -0
- urban_archimate-0.1.0/urban_archimate/static/types/editor/derive-model.d.ts +32 -0
- urban_archimate-0.1.0/urban_archimate/static/types/editor/editing-module.d.ts +45 -0
- urban_archimate-0.1.0/urban_archimate/static/types/editor/placement.d.ts +46 -0
- urban_archimate-0.1.0/urban_archimate/static/types/editor/save-graphics.d.ts +9 -0
- urban_archimate-0.1.0/urban_archimate/static/types/exchange/export.d.ts +7 -0
- urban_archimate-0.1.0/urban_archimate/static/types/index.d.ts +14 -0
- urban_archimate-0.1.0/urban_archimate/static/types/model/dehydrate.d.ts +7 -0
- urban_archimate-0.1.0/urban_archimate/static/types/model/errors.d.ts +9 -0
- urban_archimate-0.1.0/urban_archimate/static/types/model/geometry.d.ts +23 -0
- urban_archimate-0.1.0/urban_archimate/static/types/model/load.d.ts +11 -0
- urban_archimate-0.1.0/urban_archimate/static/types/model/validate.d.ts +11 -0
- urban_archimate-0.1.0/urban_archimate/static/types/property-grid/PropertyGrid.d.ts +37 -0
- urban_archimate-0.1.0/urban_archimate/static/types/property-grid/archimate-attributes.d.ts +24 -0
- urban_archimate-0.1.0/urban_archimate/static/types/rules/engine.d.ts +99 -0
- urban_archimate-0.1.0/urban_archimate/static/types/rules/paths.d.ts +18 -0
- urban_archimate-0.1.0/urban_archimate/static/types/toolbox/Toolbox.d.ts +43 -0
- urban_archimate-0.1.0/urban_archimate/static/types/view-tabs/ViewTabs.d.ts +26 -0
- urban_archimate-0.1.0/urban_archimate/static/types/web-component/UrbanArchimateElement.d.ts +45 -0
- urban_archimate-0.1.0/urban_archimate/static/urban-archimate.js +30862 -0
- urban_archimate-0.1.0/urban_archimate/static/urban-archimate.js.map +1 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: urban-archimate
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: ArchiMate diagram editor web component (<urban-archimate>), served from FastAPI / Starlette
|
|
5
|
+
Project-URL: Repository, https://github.com/gaelgael5/urban-archimate
|
|
6
|
+
Author: urban-archimate contributors
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Keywords: archimate,diagram,fastapi,starlette,web-component
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
|
+
Requires-Dist: starlette>=0.37
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
|
|
13
|
+
# urban-archimate (paquet Python)
|
|
14
|
+
|
|
15
|
+
Éditeur de diagrammes ArchiMate® en composant web (`<urban-archimate>`),
|
|
16
|
+
embarqué dans un paquet Python et servi depuis FastAPI / Starlette :
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
import urban_archimate
|
|
20
|
+
|
|
21
|
+
urban_archimate.mount(app, "/api/archimate")
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```html
|
|
25
|
+
<script type="module" src="/api/archimate/urban-archimate.js"></script>
|
|
26
|
+
<urban-archimate></urban-archimate>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Les types TypeScript du contrat sont servis sous `/api/archimate/types/`.
|
|
30
|
+
|
|
31
|
+
Dépôt, documentation et contrat :
|
|
32
|
+
<https://github.com/gaelgael5/urban-archimate>.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# urban-archimate (paquet Python)
|
|
2
|
+
|
|
3
|
+
Éditeur de diagrammes ArchiMate® en composant web (`<urban-archimate>`),
|
|
4
|
+
embarqué dans un paquet Python et servi depuis FastAPI / Starlette :
|
|
5
|
+
|
|
6
|
+
```python
|
|
7
|
+
import urban_archimate
|
|
8
|
+
|
|
9
|
+
urban_archimate.mount(app, "/api/archimate")
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```html
|
|
13
|
+
<script type="module" src="/api/archimate/urban-archimate.js"></script>
|
|
14
|
+
<urban-archimate></urban-archimate>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Les types TypeScript du contrat sont servis sous `/api/archimate/types/`.
|
|
18
|
+
|
|
19
|
+
Dépôt, documentation et contrat :
|
|
20
|
+
<https://github.com/gaelgael5/urban-archimate>.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = [ "hatchling" ]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "urban-archimate"
|
|
7
|
+
dynamic = [ "version" ]
|
|
8
|
+
description = "ArchiMate diagram editor web component (<urban-archimate>), served from FastAPI / Starlette"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [ { name = "urban-archimate contributors" } ]
|
|
13
|
+
keywords = [ "archimate", "diagram", "web-component", "fastapi", "starlette" ]
|
|
14
|
+
dependencies = [
|
|
15
|
+
"starlette>=0.37"
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
[project.urls]
|
|
19
|
+
Repository = "https://github.com/gaelgael5/urban-archimate"
|
|
20
|
+
|
|
21
|
+
[tool.hatch.version]
|
|
22
|
+
path = "urban_archimate/__init__.py"
|
|
23
|
+
|
|
24
|
+
[tool.hatch.build.targets.wheel]
|
|
25
|
+
packages = [ "urban_archimate" ]
|
|
26
|
+
artifacts = [ "urban_archimate/static/**" ]
|
|
27
|
+
|
|
28
|
+
[tool.hatch.build.targets.sdist]
|
|
29
|
+
include = [ "urban_archimate/**", "README.md" ]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""urban-archimate — ArchiMate diagram editor web component.
|
|
2
|
+
|
|
3
|
+
The package embeds the built JS (and its TypeScript types) of the
|
|
4
|
+
``<urban-archimate>`` custom element, and serves them from a FastAPI /
|
|
5
|
+
Starlette application::
|
|
6
|
+
|
|
7
|
+
import urban_archimate
|
|
8
|
+
urban_archimate.mount(app, "/api/archimate")
|
|
9
|
+
|
|
10
|
+
The page then loads ``<path>/urban-archimate.js`` (ES module) and uses
|
|
11
|
+
the ``<urban-archimate>`` element.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
|
|
16
|
+
__version__ = "0.1.0"
|
|
17
|
+
|
|
18
|
+
STATIC_DIR = Path(__file__).parent / "static"
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def mount(app, path: str = "/api/archimate") -> None:
|
|
22
|
+
"""Serves the component's built assets at ``path``.
|
|
23
|
+
|
|
24
|
+
``app`` is a FastAPI or Starlette application. The JS module is
|
|
25
|
+
then available at ``{path}/urban-archimate.js`` and the TypeScript
|
|
26
|
+
types under ``{path}/types/``.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
from starlette.staticfiles import StaticFiles
|
|
30
|
+
|
|
31
|
+
app.mount(path, StaticFiles(directory=STATIC_DIR), name="urban-archimate")
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/gaelgael5/urban-archimate/schema/hydrated-model.schema.json",
|
|
4
|
+
"title": "Modèle hydraté urban-archimate",
|
|
5
|
+
"description": "Document du modèle dont chaque référence (règles, graphique, types, documents d'objets) porte son contenu en `data`. Les contrôles croisés (clé retenue absente des documents, ...) sont faits par le composant en plus de ce schéma.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"id": { "$ref": "#/$defs/cle" },
|
|
9
|
+
"nom": { "type": "string" },
|
|
10
|
+
"description": { "type": "string" },
|
|
11
|
+
"regles": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"properties": {
|
|
14
|
+
"chemin": { "type": "string", "minLength": 1 },
|
|
15
|
+
"data": { "$ref": "#/$defs/regles" }
|
|
16
|
+
},
|
|
17
|
+
"required": [ "chemin", "data" ],
|
|
18
|
+
"additionalProperties": false
|
|
19
|
+
},
|
|
20
|
+
"graphique": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"properties": {
|
|
23
|
+
"chemin": { "type": "string", "minLength": 1 },
|
|
24
|
+
"data": { "$ref": "#/$defs/graphique" }
|
|
25
|
+
},
|
|
26
|
+
"required": [ "chemin", "data" ],
|
|
27
|
+
"additionalProperties": false
|
|
28
|
+
},
|
|
29
|
+
"types": {
|
|
30
|
+
"type": "array",
|
|
31
|
+
"items": {
|
|
32
|
+
"type": "object",
|
|
33
|
+
"properties": {
|
|
34
|
+
"chemin": { "type": "string", "minLength": 1 },
|
|
35
|
+
"data": { "$ref": "#/$defs/schemaType" }
|
|
36
|
+
},
|
|
37
|
+
"required": [ "chemin", "data" ],
|
|
38
|
+
"additionalProperties": false
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"documents": {
|
|
42
|
+
"type": "array",
|
|
43
|
+
"items": {
|
|
44
|
+
"type": "object",
|
|
45
|
+
"properties": {
|
|
46
|
+
"chemin": { "type": "string", "minLength": 1 },
|
|
47
|
+
"data": { "$ref": "#/$defs/objet" }
|
|
48
|
+
},
|
|
49
|
+
"required": [ "chemin", "data" ],
|
|
50
|
+
"additionalProperties": false
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"elements": {
|
|
54
|
+
"type": "array",
|
|
55
|
+
"items": { "$ref": "#/$defs/cle" }
|
|
56
|
+
},
|
|
57
|
+
"relationships": {
|
|
58
|
+
"type": "array",
|
|
59
|
+
"items": { "$ref": "#/$defs/cle" }
|
|
60
|
+
},
|
|
61
|
+
"vues": {
|
|
62
|
+
"type": "array",
|
|
63
|
+
"items": { "$ref": "#/$defs/vue" }
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"required": [ "id", "regles", "graphique" ],
|
|
67
|
+
"additionalProperties": false,
|
|
68
|
+
"$defs": {
|
|
69
|
+
"cle": {
|
|
70
|
+
"type": "string",
|
|
71
|
+
"pattern": "^[A-Z0-9][A-Z0-9-]*$"
|
|
72
|
+
},
|
|
73
|
+
"objet": {
|
|
74
|
+
"type": "object",
|
|
75
|
+
"properties": {
|
|
76
|
+
"cle": { "$ref": "#/$defs/cle" },
|
|
77
|
+
"type": { "type": "string", "minLength": 1 },
|
|
78
|
+
"nom": { "type": "string" },
|
|
79
|
+
"documentation": { "type": "string" },
|
|
80
|
+
"source": { "$ref": "#/$defs/cle" },
|
|
81
|
+
"cible": { "$ref": "#/$defs/cle" },
|
|
82
|
+
"proprietes": { "type": "object" }
|
|
83
|
+
},
|
|
84
|
+
"required": [ "cle", "type" ],
|
|
85
|
+
"dependentRequired": {
|
|
86
|
+
"source": [ "cible" ],
|
|
87
|
+
"cible": [ "source" ]
|
|
88
|
+
},
|
|
89
|
+
"additionalProperties": false
|
|
90
|
+
},
|
|
91
|
+
"schemaType": {
|
|
92
|
+
"type": "object",
|
|
93
|
+
"properties": {
|
|
94
|
+
"title": { "type": "string" },
|
|
95
|
+
"x-archimate": { "type": "string", "minLength": 1 },
|
|
96
|
+
"properties": { "type": "object" },
|
|
97
|
+
"required": { "type": "array", "items": { "type": "string" } }
|
|
98
|
+
},
|
|
99
|
+
"required": [ "x-archimate" ]
|
|
100
|
+
},
|
|
101
|
+
"regles": {
|
|
102
|
+
"type": "object",
|
|
103
|
+
"properties": {
|
|
104
|
+
"lang": { "type": "string" },
|
|
105
|
+
"defaut": { "$ref": "#/$defs/blocRegle" },
|
|
106
|
+
"elements": { "type": "array", "items": { "$ref": "#/$defs/blocRegleType" } },
|
|
107
|
+
"relationships": { "type": "array", "items": { "$ref": "#/$defs/blocRegleType" } }
|
|
108
|
+
},
|
|
109
|
+
"additionalProperties": false
|
|
110
|
+
},
|
|
111
|
+
"blocRegle": {
|
|
112
|
+
"type": "object",
|
|
113
|
+
"properties": {
|
|
114
|
+
"name": { "type": "string" },
|
|
115
|
+
"documentation": { "type": "string" },
|
|
116
|
+
"properties": {
|
|
117
|
+
"type": "array",
|
|
118
|
+
"items": {
|
|
119
|
+
"type": "object",
|
|
120
|
+
"properties": {
|
|
121
|
+
"propertyDefinitionRef": { "type": "string", "minLength": 1 },
|
|
122
|
+
"value": { "type": "string", "minLength": 1 }
|
|
123
|
+
},
|
|
124
|
+
"required": [ "propertyDefinitionRef", "value" ],
|
|
125
|
+
"additionalProperties": false
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"blocRegleType": {
|
|
131
|
+
"allOf": [ { "$ref": "#/$defs/blocRegle" } ],
|
|
132
|
+
"type": "object",
|
|
133
|
+
"properties": {
|
|
134
|
+
"type": { "type": "string", "minLength": 1 }
|
|
135
|
+
},
|
|
136
|
+
"required": [ "type" ]
|
|
137
|
+
},
|
|
138
|
+
"vue": {
|
|
139
|
+
"type": "object",
|
|
140
|
+
"properties": {
|
|
141
|
+
"id": { "type": "string", "minLength": 1 },
|
|
142
|
+
"nom": { "type": "string" },
|
|
143
|
+
"point_de_vue": { "type": "string" },
|
|
144
|
+
"noeuds": { "type": "array", "items": { "$ref": "#/$defs/noeud" } },
|
|
145
|
+
"connexions": { "type": "array", "items": { "$ref": "#/$defs/connexion" } }
|
|
146
|
+
},
|
|
147
|
+
"required": [ "id" ],
|
|
148
|
+
"additionalProperties": false
|
|
149
|
+
},
|
|
150
|
+
"noeud": {
|
|
151
|
+
"type": "object",
|
|
152
|
+
"properties": {
|
|
153
|
+
"id": { "type": "string", "minLength": 1 },
|
|
154
|
+
"element": { "$ref": "#/$defs/cle" },
|
|
155
|
+
"note": { "type": "string" },
|
|
156
|
+
"cadre": { "type": "string" },
|
|
157
|
+
"enfants": { "type": "array", "items": { "$ref": "#/$defs/noeud" } }
|
|
158
|
+
},
|
|
159
|
+
"required": [ "id" ],
|
|
160
|
+
"oneOf": [
|
|
161
|
+
{ "required": [ "element" ] },
|
|
162
|
+
{ "required": [ "note" ] },
|
|
163
|
+
{ "required": [ "cadre" ] }
|
|
164
|
+
],
|
|
165
|
+
"additionalProperties": false
|
|
166
|
+
},
|
|
167
|
+
"connexion": {
|
|
168
|
+
"type": "object",
|
|
169
|
+
"properties": {
|
|
170
|
+
"id": { "type": "string", "minLength": 1 },
|
|
171
|
+
"relationship": { "$ref": "#/$defs/cle" },
|
|
172
|
+
"de": { "type": "string", "minLength": 1 },
|
|
173
|
+
"vers": { "type": "string", "minLength": 1 }
|
|
174
|
+
},
|
|
175
|
+
"required": [ "id", "relationship", "de", "vers" ],
|
|
176
|
+
"additionalProperties": false
|
|
177
|
+
},
|
|
178
|
+
"graphique": {
|
|
179
|
+
"type": "object",
|
|
180
|
+
"properties": {
|
|
181
|
+
"vues": {
|
|
182
|
+
"type": "object",
|
|
183
|
+
"additionalProperties": { "$ref": "#/$defs/vueGraphique" }
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
"additionalProperties": false
|
|
187
|
+
},
|
|
188
|
+
"vueGraphique": {
|
|
189
|
+
"type": "object",
|
|
190
|
+
"properties": {
|
|
191
|
+
"noeuds": {
|
|
192
|
+
"type": "object",
|
|
193
|
+
"additionalProperties": { "$ref": "#/$defs/geometrieNoeud" }
|
|
194
|
+
},
|
|
195
|
+
"connexions": {
|
|
196
|
+
"type": "object",
|
|
197
|
+
"additionalProperties": { "$ref": "#/$defs/geometrieConnexion" }
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
"additionalProperties": false
|
|
201
|
+
},
|
|
202
|
+
"geometrieNoeud": {
|
|
203
|
+
"type": "object",
|
|
204
|
+
"properties": {
|
|
205
|
+
"x": { "type": "number" },
|
|
206
|
+
"y": { "type": "number" },
|
|
207
|
+
"relatif": { "type": "string" },
|
|
208
|
+
"dx": { "type": "number" },
|
|
209
|
+
"dy": { "type": "number" },
|
|
210
|
+
"l": { "type": "number", "exclusiveMinimum": 0 },
|
|
211
|
+
"h": { "type": "number", "exclusiveMinimum": 0 }
|
|
212
|
+
},
|
|
213
|
+
"additionalProperties": false,
|
|
214
|
+
"allOf": [
|
|
215
|
+
{
|
|
216
|
+
"if": { "required": [ "relatif" ] },
|
|
217
|
+
"then": { "not": { "anyOf": [ { "required": [ "x" ] }, { "required": [ "y" ] } ] } }
|
|
218
|
+
}
|
|
219
|
+
]
|
|
220
|
+
},
|
|
221
|
+
"geometrieConnexion": {
|
|
222
|
+
"type": "object",
|
|
223
|
+
"properties": {
|
|
224
|
+
"ancre_source": { "enum": [ "gauche", "droite", "haut", "bas" ] },
|
|
225
|
+
"ancre_cible": { "enum": [ "gauche", "droite", "haut", "bas" ] },
|
|
226
|
+
"points": {
|
|
227
|
+
"type": "array",
|
|
228
|
+
"items": {
|
|
229
|
+
"type": "object",
|
|
230
|
+
"properties": {
|
|
231
|
+
"x": { "type": "number" },
|
|
232
|
+
"y": { "type": "number" }
|
|
233
|
+
},
|
|
234
|
+
"required": [ "x", "y" ],
|
|
235
|
+
"additionalProperties": false
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
"libelle": {
|
|
239
|
+
"type": "object",
|
|
240
|
+
"properties": {
|
|
241
|
+
"position": { "type": "number", "minimum": 0, "maximum": 1 },
|
|
242
|
+
"dx": { "type": "number" },
|
|
243
|
+
"dy": { "type": "number" }
|
|
244
|
+
},
|
|
245
|
+
"additionalProperties": false
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
"additionalProperties": false
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public contract of the urban-archimate component.
|
|
3
|
+
*
|
|
4
|
+
* The component receives a HYDRATED model: the model document in which
|
|
5
|
+
* every reference (rules, graphics, type schemas, object documents)
|
|
6
|
+
* carries its content under `data`. The host reads and writes the
|
|
7
|
+
* files and stays the only source of objects, types, translation rules
|
|
8
|
+
* and relationship rules. The component never touches the disk.
|
|
9
|
+
*
|
|
10
|
+
* The YAML structures and their French key names are shared with
|
|
11
|
+
* Ossie-studio (ticket "Format du modèle, du fichier de règles et du
|
|
12
|
+
* fichier graphique"). The API names (methods, events, delegates) are
|
|
13
|
+
* shared with urban-bpmn.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Functional key of an object or relation: uppercase letters, digits
|
|
17
|
+
* and dashes, unique in the host space (e.g. `APP-BOUTIQUE`).
|
|
18
|
+
*/
|
|
19
|
+
export type ObjectKey = string;
|
|
20
|
+
/** Pattern every {@link ObjectKey} must match. */
|
|
21
|
+
export declare const OBJECT_KEY_PATTERN: RegExp;
|
|
22
|
+
/**
|
|
23
|
+
* A reference hydrated by the host: the path of the file in the host
|
|
24
|
+
* space, plus its parsed content under `data`.
|
|
25
|
+
*/
|
|
26
|
+
export interface HydratedRef<T> {
|
|
27
|
+
/** Path of the file in the host space (identification only). */
|
|
28
|
+
chemin: string;
|
|
29
|
+
/** Parsed content of the file. */
|
|
30
|
+
data: T;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* An object of the host space (one document = one object). Relations
|
|
34
|
+
* are objects too, with `source` and `cible` in addition.
|
|
35
|
+
*/
|
|
36
|
+
export interface CartographyObject {
|
|
37
|
+
/** Functional key, unique in the host space. */
|
|
38
|
+
cle: ObjectKey;
|
|
39
|
+
/** Slug of a host space type (its schema gives the ArchiMate type). */
|
|
40
|
+
type: string;
|
|
41
|
+
/** Display name. */
|
|
42
|
+
nom?: string;
|
|
43
|
+
/** Markdown documentation. */
|
|
44
|
+
documentation?: string;
|
|
45
|
+
/** Source key (relations only). */
|
|
46
|
+
source?: ObjectKey;
|
|
47
|
+
/** Target key (relations only). A relation may target a relation. */
|
|
48
|
+
cible?: ObjectKey;
|
|
49
|
+
/** Added properties, validated by the schema of the type. */
|
|
50
|
+
proprietes?: Record<string, unknown>;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Schema of a host space type: a JSON Schema (2020-12) document with
|
|
54
|
+
* the ArchiMate type it is based on under `x-archimate`.
|
|
55
|
+
*/
|
|
56
|
+
export interface TypeSchema {
|
|
57
|
+
/** Display name of the type. */
|
|
58
|
+
title?: string;
|
|
59
|
+
/** ArchiMate type the host type is based on (e.g. `BusinessProcess`). */
|
|
60
|
+
'x-archimate': string;
|
|
61
|
+
/** Added properties only (JSON Schema property definitions). */
|
|
62
|
+
properties?: Record<string, unknown>;
|
|
63
|
+
/** Required property names. */
|
|
64
|
+
required?: string[];
|
|
65
|
+
[key: string]: unknown;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* A value path into the object (e.g. `$.nom`, `$.proprietes.acces`).
|
|
69
|
+
*/
|
|
70
|
+
export type ValuePath = string;
|
|
71
|
+
/** An ArchiMate property mapping inside a rule block. */
|
|
72
|
+
export interface RuleProperty {
|
|
73
|
+
propertyDefinitionRef: string;
|
|
74
|
+
value: ValuePath;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* One translation block: how an object of `type` becomes an ArchiMate
|
|
78
|
+
* element or relationship. Besides `name` / `documentation` /
|
|
79
|
+
* `properties`, a block may set ArchiMate attributes (`accessType`,
|
|
80
|
+
* `isDirected`, `modifier`, ...) whose values are value paths or
|
|
81
|
+
* literals already in ArchiMate form.
|
|
82
|
+
*/
|
|
83
|
+
export interface RuleBlock {
|
|
84
|
+
/** Host space type slug, or an ArchiMate type as fallback match. */
|
|
85
|
+
type?: string;
|
|
86
|
+
name?: ValuePath;
|
|
87
|
+
documentation?: ValuePath;
|
|
88
|
+
properties?: RuleProperty[];
|
|
89
|
+
[archimateAttribute: string]: unknown;
|
|
90
|
+
}
|
|
91
|
+
/** The rules file: how host objects become ArchiMate concepts. */
|
|
92
|
+
export interface RulesFile {
|
|
93
|
+
/** Language of the produced model (`xml:lang`). */
|
|
94
|
+
lang?: string;
|
|
95
|
+
/** Fallback block, provided by the host like the others. */
|
|
96
|
+
defaut?: RuleBlock;
|
|
97
|
+
elements?: RuleBlock[];
|
|
98
|
+
relationships?: RuleBlock[];
|
|
99
|
+
}
|
|
100
|
+
/** A node of a view: places an object, a note or a group frame. */
|
|
101
|
+
export interface ViewNode {
|
|
102
|
+
/** Node id, distinct from the object key (an object may appear twice). */
|
|
103
|
+
id: string;
|
|
104
|
+
/** Key of the object placed by this node. */
|
|
105
|
+
element?: ObjectKey;
|
|
106
|
+
/** Text of a note (view-only element). */
|
|
107
|
+
note?: string;
|
|
108
|
+
/** Label of a group frame (view-only element). */
|
|
109
|
+
cadre?: string;
|
|
110
|
+
/** Nested nodes. */
|
|
111
|
+
enfants?: ViewNode[];
|
|
112
|
+
}
|
|
113
|
+
/** A connection of a view: places a relation between two nodes. */
|
|
114
|
+
export interface ViewConnection {
|
|
115
|
+
/** Connection id. */
|
|
116
|
+
id: string;
|
|
117
|
+
/** Key of the relation placed by this connection. */
|
|
118
|
+
relationship: ObjectKey;
|
|
119
|
+
/** Source node id. */
|
|
120
|
+
de: string;
|
|
121
|
+
/** Target node id. */
|
|
122
|
+
vers: string;
|
|
123
|
+
}
|
|
124
|
+
/** A view of the model. */
|
|
125
|
+
export interface ModelView {
|
|
126
|
+
id: string;
|
|
127
|
+
nom?: string;
|
|
128
|
+
/** Optional ArchiMate viewpoint. */
|
|
129
|
+
point_de_vue?: string;
|
|
130
|
+
noeuds?: ViewNode[];
|
|
131
|
+
connexions?: ViewConnection[];
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The model document as stored by the host (no `data` anywhere):
|
|
135
|
+
* what {@link SaveResult.modele} returns.
|
|
136
|
+
*/
|
|
137
|
+
export interface Model {
|
|
138
|
+
id: string;
|
|
139
|
+
nom?: string;
|
|
140
|
+
description?: string;
|
|
141
|
+
/** Path of the rules file. */
|
|
142
|
+
regles: string;
|
|
143
|
+
/** Path of the graphics file. */
|
|
144
|
+
graphique: string;
|
|
145
|
+
/** Paths of the loaded object documents. */
|
|
146
|
+
documents?: string[];
|
|
147
|
+
/** Keys of the retained elements. */
|
|
148
|
+
elements?: ObjectKey[];
|
|
149
|
+
/** Keys of the retained relationships. */
|
|
150
|
+
relationships?: ObjectKey[];
|
|
151
|
+
vues?: ModelView[];
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* The hydrated model the host passes to the component: same document,
|
|
155
|
+
* with every reference carrying its content, plus the schemas of the
|
|
156
|
+
* object types present.
|
|
157
|
+
*/
|
|
158
|
+
export interface HydratedModel {
|
|
159
|
+
id: string;
|
|
160
|
+
nom?: string;
|
|
161
|
+
description?: string;
|
|
162
|
+
regles: HydratedRef<RulesFile>;
|
|
163
|
+
graphique: HydratedRef<GraphicsFile>;
|
|
164
|
+
/** Schemas of the object types present in the documents. */
|
|
165
|
+
types?: HydratedRef<TypeSchema>[];
|
|
166
|
+
/** One document = one object. */
|
|
167
|
+
documents?: HydratedRef<CartographyObject>[];
|
|
168
|
+
elements?: ObjectKey[];
|
|
169
|
+
relationships?: ObjectKey[];
|
|
170
|
+
vues?: ModelView[];
|
|
171
|
+
}
|
|
172
|
+
/** Absolute or relative geometry of a node. */
|
|
173
|
+
export interface NodeGeometry {
|
|
174
|
+
/** Absolute coordinates. */
|
|
175
|
+
x?: number;
|
|
176
|
+
y?: number;
|
|
177
|
+
/** Id of the node this geometry is relative to. */
|
|
178
|
+
relatif?: string;
|
|
179
|
+
/** Offsets when `relatif` is set. */
|
|
180
|
+
dx?: number;
|
|
181
|
+
dy?: number;
|
|
182
|
+
/** Width. */
|
|
183
|
+
l?: number;
|
|
184
|
+
/** Height. */
|
|
185
|
+
h?: number;
|
|
186
|
+
}
|
|
187
|
+
/** Anchor side of a connection end. */
|
|
188
|
+
export type Anchor = 'gauche' | 'droite' | 'haut' | 'bas';
|
|
189
|
+
/** Geometry of a connection. */
|
|
190
|
+
export interface ConnectionGeometry {
|
|
191
|
+
ancre_source?: Anchor;
|
|
192
|
+
ancre_cible?: Anchor;
|
|
193
|
+
/** Intermediate waypoints. */
|
|
194
|
+
points?: {
|
|
195
|
+
x: number;
|
|
196
|
+
y: number;
|
|
197
|
+
}[];
|
|
198
|
+
/** Position of the connection label. */
|
|
199
|
+
libelle?: {
|
|
200
|
+
position?: number;
|
|
201
|
+
dx?: number;
|
|
202
|
+
dy?: number;
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
/** Graphics of one view. */
|
|
206
|
+
export interface ViewGraphics {
|
|
207
|
+
noeuds?: Record<string, NodeGeometry>;
|
|
208
|
+
connexions?: Record<string, ConnectionGeometry>;
|
|
209
|
+
}
|
|
210
|
+
/** The graphics file: one entry per view of the model. */
|
|
211
|
+
export interface GraphicsFile {
|
|
212
|
+
vues?: Record<string, ViewGraphics>;
|
|
213
|
+
}
|
|
214
|
+
/** One tool of the toolbox. */
|
|
215
|
+
export interface Tool {
|
|
216
|
+
/** Key passed back to the drop delegate. */
|
|
217
|
+
cle: string;
|
|
218
|
+
libelle: string;
|
|
219
|
+
/** Icon provided by the host: an URL or inline SVG markup. */
|
|
220
|
+
icone?: string;
|
|
221
|
+
}
|
|
222
|
+
/** A group of tools. */
|
|
223
|
+
export interface ToolGroup {
|
|
224
|
+
id: string;
|
|
225
|
+
libelle?: string;
|
|
226
|
+
outils: Tool[];
|
|
227
|
+
}
|
|
228
|
+
/** Context passed to the toolbox delegate. */
|
|
229
|
+
export interface ToolboxContext {
|
|
230
|
+
/** Viewpoint of the current view, if any. */
|
|
231
|
+
pointDeVue?: string;
|
|
232
|
+
/** Id of the current view. */
|
|
233
|
+
vueId?: string;
|
|
234
|
+
}
|
|
235
|
+
/** What the host returns when a tool is dropped. */
|
|
236
|
+
export interface DropResult {
|
|
237
|
+
/** The object (path + data). */
|
|
238
|
+
objet: HydratedRef<CartographyObject>;
|
|
239
|
+
/** Schema of its type, if not already known to the component. */
|
|
240
|
+
schemaType?: HydratedRef<TypeSchema>;
|
|
241
|
+
/** Rule block for this type, if not already known to the component. */
|
|
242
|
+
regles?: RuleBlock;
|
|
243
|
+
}
|
|
244
|
+
/** One relation type allowed between two objects. */
|
|
245
|
+
export interface AllowedRelationType {
|
|
246
|
+
/** Host space relation type slug. */
|
|
247
|
+
type: string;
|
|
248
|
+
/** ArchiMate relationship type it is based on. */
|
|
249
|
+
archimate: string;
|
|
250
|
+
/** Display name. */
|
|
251
|
+
libelle?: string;
|
|
252
|
+
/** Schema of the relation type (drives the property grid). */
|
|
253
|
+
schema?: TypeSchema;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* The delegates the host provides. The component never invents what a
|
|
257
|
+
* delegate should have answered: a missing delegate disables the
|
|
258
|
+
* corresponding interaction.
|
|
259
|
+
*/
|
|
260
|
+
export interface Delegates {
|
|
261
|
+
/** Content of the toolbox for the current view. */
|
|
262
|
+
toolbox?: (context: ToolboxContext) => Promise<ToolGroup[]> | ToolGroup[];
|
|
263
|
+
/** Called once, with the tool key, when a tool is dropped. */
|
|
264
|
+
drop?: (cle: string) => Promise<DropResult> | DropResult;
|
|
265
|
+
/**
|
|
266
|
+
* Called once, with the two object keys, before two nodes are
|
|
267
|
+
* connected; returns the allowed relation types.
|
|
268
|
+
*/
|
|
269
|
+
allowedRelations?: (cleSource: ObjectKey, cleCible: ObjectKey) => Promise<AllowedRelationType[]> | AllowedRelationType[];
|
|
270
|
+
}
|
|
271
|
+
/** What the save method returns; the host writes the files. */
|
|
272
|
+
export interface SaveResult {
|
|
273
|
+
/** The model without any `data`, ready to write. */
|
|
274
|
+
modele: Model;
|
|
275
|
+
/** The graphics file content. */
|
|
276
|
+
graphique: GraphicsFile;
|
|
277
|
+
/**
|
|
278
|
+
* Relations drawn on the diagram that do not exist in the host space
|
|
279
|
+
* yet (full object data); the host creates the files. They stay out
|
|
280
|
+
* of `modele.documents` until the host hydrates them back.
|
|
281
|
+
*/
|
|
282
|
+
nouvellesRelations: CartographyObject[];
|
|
283
|
+
}
|
|
284
|
+
/** Emitted on every modification (for the host "modified" indicator). */
|
|
285
|
+
export interface ChangedEvent {
|
|
286
|
+
/** What changed: 'model' | 'graphics' | 'views'. */
|
|
287
|
+
scope: string;
|
|
288
|
+
}
|
|
289
|
+
/** Emitted when an element or connection is selected. */
|
|
290
|
+
export interface SelectionEvent {
|
|
291
|
+
/** Key of the selected object, if the selection maps to one. */
|
|
292
|
+
cle?: ObjectKey;
|
|
293
|
+
/** Node or connection id in the view. */
|
|
294
|
+
viewElementId?: string;
|
|
295
|
+
/** 'node' | 'connection' | 'note' | 'cadre' | null (cleared). */
|
|
296
|
+
kind?: string | null;
|
|
297
|
+
}
|
|
298
|
+
/** Event names used by the component. */
|
|
299
|
+
export type EventName = 'changed' | 'selection' | 'import.done';
|
|
300
|
+
/** A model refused at load carries the offending element's name. */
|
|
301
|
+
export interface ModelIssue {
|
|
302
|
+
/** Machine-readable code, e.g. 'cle-retenue-sans-document'. */
|
|
303
|
+
code: string;
|
|
304
|
+
/** Human message naming the offending element. */
|
|
305
|
+
message: string;
|
|
306
|
+
/** Key, node id or path of the offending element. */
|
|
307
|
+
element?: string;
|
|
308
|
+
}
|