@peter.prib/renderengine 0.0.0-stage → 0.2.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 (451) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +203 -2
  3. package/REFERENCE.md +2198 -0
  4. package/dist/renderengine-workspace.umd.js +46905 -0
  5. package/dist/renderengine.umd.js +42223 -0
  6. package/examples/archimate.html +66 -0
  7. package/examples/diagram-editor.html +51 -0
  8. package/package.json +65 -4
  9. package/src/BaseRenderer.js +57 -0
  10. package/src/CanvasRenderer.js +194 -0
  11. package/src/Mat4.js +111 -0
  12. package/src/OrbitCamera.js +57 -0
  13. package/src/RendererFactory.js +50 -0
  14. package/src/SVGRenderer.js +439 -0
  15. package/src/archimate.js +723 -0
  16. package/src/archimateArchiFormat.js +1693 -0
  17. package/src/archimateArchiTypes.js +72 -0
  18. package/src/archimateArchive.js +140 -0
  19. package/src/archimateCSV.js +127 -0
  20. package/src/archimateDrawio.js +182 -0
  21. package/src/archimateExchangeFormat.js +546 -0
  22. package/src/archimateRelationshipTable.js +93 -0
  23. package/src/archimateSpecializations.js +161 -0
  24. package/src/chartCatalog.js +589 -0
  25. package/src/charting/ArchimateDiagramEditor.js +1624 -0
  26. package/src/charting/ArchimateSpecializationSelector.js +134 -0
  27. package/src/charting/Axis.js +68 -0
  28. package/src/charting/CameraSeeder.js +30 -0
  29. package/src/charting/CatalogDialog.js +92 -0
  30. package/src/charting/Chart.js +37 -0
  31. package/src/charting/Chart3D.js +99 -0
  32. package/src/charting/ChartBox.js +80 -0
  33. package/src/charting/ChartData.js +27 -0
  34. package/src/charting/ChartRegistry.js +76 -0
  35. package/src/charting/CheckboxTreeSelector.js +304 -0
  36. package/src/charting/ColorField.js +107 -0
  37. package/src/charting/ColorPalette.js +88 -0
  38. package/src/charting/CommandHistory.js +176 -0
  39. package/src/charting/DataFilter.js +52 -0
  40. package/src/charting/Diagram.js +36 -0
  41. package/src/charting/Diagram3D.js +29 -0
  42. package/src/charting/DiagramClipboard.js +31 -0
  43. package/src/charting/DiagramEditor.js +3330 -0
  44. package/src/charting/DiagramEditorCommand.js +110 -0
  45. package/src/charting/DiagramEditorCommands.js +237 -0
  46. package/src/charting/DiagramEditorEdgeCommands.js +142 -0
  47. package/src/charting/DiagramEditorState.js +98 -0
  48. package/src/charting/DiagramRegistry.js +86 -0
  49. package/src/charting/DiagramTypeRegistry.js +326 -0
  50. package/src/charting/DiagramViewPropertiesDialog.js +46 -0
  51. package/src/charting/Edge.js +113 -0
  52. package/src/charting/ErrorBars.js +37 -0
  53. package/src/charting/FilterSystem.js +285 -0
  54. package/src/charting/FindReplaceDialog.js +139 -0
  55. package/src/charting/FormDialog.js +385 -0
  56. package/src/charting/Gauge.js +58 -0
  57. package/src/charting/Hierarchy.js +175 -0
  58. package/src/charting/HintPanel.js +86 -0
  59. package/src/charting/ImageSelector.js +148 -0
  60. package/src/charting/InteractionManager.js +725 -0
  61. package/src/charting/Legend.js +58 -0
  62. package/src/charting/MenuBar.js +62 -0
  63. package/src/charting/ModelFileFormat.js +115 -0
  64. package/src/charting/OrbitControls.js +77 -0
  65. package/src/charting/Palette.js +119 -0
  66. package/src/charting/PopupMenu.js +117 -0
  67. package/src/charting/PropertiesPanel.js +155 -0
  68. package/src/charting/PropertyListEditor.js +96 -0
  69. package/src/charting/PropertyLog.js +92 -0
  70. package/src/charting/SettingsCascade.js +93 -0
  71. package/src/charting/SettingsDialog.js +53 -0
  72. package/src/charting/SettingsManager.js +179 -0
  73. package/src/charting/SettingsViewPropertiesDialog.js +58 -0
  74. package/src/charting/ShapePaths.js +27 -0
  75. package/src/charting/Statistics.js +134 -0
  76. package/src/charting/TemplateCatalog.js +59 -0
  77. package/src/charting/TemplateLibrary.js +103 -0
  78. package/src/charting/TextStyle.js +168 -0
  79. package/src/charting/ViewFit.js +55 -0
  80. package/src/charting/ViewMenu.js +70 -0
  81. package/src/charting/ViewPropertiesDialog.js +77 -0
  82. package/src/charting/ViewTabStrip.js +81 -0
  83. package/src/charting/archimate/ArchiFileFormat.js +32 -0
  84. package/src/charting/archimate/ArchimateCanvasEditor.js +815 -0
  85. package/src/charting/archimate/ArchimateCsvFileFormat.js +35 -0
  86. package/src/charting/archimate/ArchimateEdge.js +137 -0
  87. package/src/charting/archimate/ArchimateElementTemplate.js +195 -0
  88. package/src/charting/archimate/ArchimatePalette.js +102 -0
  89. package/src/charting/archimate/CsvImportDialog.js +105 -0
  90. package/src/charting/archimate/CustomViewpoints.js +74 -0
  91. package/src/charting/archimate/DerivedEdge.js +29 -0
  92. package/src/charting/archimate/DrawioFileFormat.js +24 -0
  93. package/src/charting/archimate/ElementFilterRule.js +21 -0
  94. package/src/charting/archimate/ExchangeFileFormat.js +28 -0
  95. package/src/charting/archimate/ViewGroupTemplate.js +137 -0
  96. package/src/charting/archimate/ViewLineEdge.js +84 -0
  97. package/src/charting/archimate/ViewpointRule.js +45 -0
  98. package/src/charting/archimate/archimateFileFormats.js +12 -0
  99. package/src/charting/archimate/archimateNames.js +5 -0
  100. package/src/charting/archimate/csvMapping.js +122 -0
  101. package/src/charting/archimate/elementMenuItems.js +32 -0
  102. package/src/charting/archimate/elementProperties.js +146 -0
  103. package/src/charting/archimate/elementTypeChoices.js +7 -0
  104. package/src/charting/archimate/elementTypeGroups.js +19 -0
  105. package/src/charting/archimate/index.js +17 -0
  106. package/src/charting/archimate/specializationCatalogDialog.js +64 -0
  107. package/src/charting/archimate/typeGlyph.js +29 -0
  108. package/src/charting/arrangement/Arrangement.js +112 -0
  109. package/src/charting/arrangement/ArrangementCommand.js +29 -0
  110. package/src/charting/arrangement/BackgroundCommand.js +41 -0
  111. package/src/charting/arrangement/BackgroundGroup.js +18 -0
  112. package/src/charting/arrangement/GroupCommand.js +46 -0
  113. package/src/charting/arrangement/ItemGroup.js +62 -0
  114. package/src/charting/arrangement/LockCommand.js +32 -0
  115. package/src/charting/arrangement/UngroupCommand.js +27 -0
  116. package/src/charting/arrangement/alignment.js +88 -0
  117. package/src/charting/arrangement/arrangeMenuItems.js +25 -0
  118. package/src/charting/arrangement/index.js +11 -0
  119. package/src/charting/arrangement/layouts.js +233 -0
  120. package/src/charting/canvas/ArchiHint.js +78 -0
  121. package/src/charting/canvas/CanvasBoxKind.js +39 -0
  122. package/src/charting/canvas/CanvasPalette.js +49 -0
  123. package/src/charting/canvas/CanvasTemplateLibrary.js +61 -0
  124. package/src/charting/canvas/CanvasTemplateMenu.js +151 -0
  125. package/src/charting/canvas/EditHintCommand.js +28 -0
  126. package/src/charting/canvas/canvasBoxKinds.js +27 -0
  127. package/src/charting/canvas/canvasBoxMenuItems.js +40 -0
  128. package/src/charting/canvas/defaultCanvasTemplates.js +186 -0
  129. package/src/charting/canvas/diagramBoxKinds.js +12 -0
  130. package/src/charting/canvas/hintMenuItems.js +49 -0
  131. package/src/charting/charts/ArcGauge.js +55 -0
  132. package/src/charting/charts/AreaChart.js +71 -0
  133. package/src/charting/charts/BarChart.js +80 -0
  134. package/src/charting/charts/BarChart3D.js +56 -0
  135. package/src/charting/charts/BarChart3DOrbit.js +53 -0
  136. package/src/charting/charts/BarChartBase.js +70 -0
  137. package/src/charting/charts/BarGauge.js +42 -0
  138. package/src/charting/charts/BoxPlotChart.js +41 -0
  139. package/src/charting/charts/BubbleChart.js +99 -0
  140. package/src/charting/charts/BubbleChart3D.js +78 -0
  141. package/src/charting/charts/BulletGauge.js +87 -0
  142. package/src/charting/charts/CalendarHeatmapChart.js +204 -0
  143. package/src/charting/charts/CandlestickChart.js +54 -0
  144. package/src/charting/charts/ChordDiagram.js +130 -0
  145. package/src/charting/charts/DensityChart.js +73 -0
  146. package/src/charting/charts/DialGauge.js +65 -0
  147. package/src/charting/charts/DonutChart.js +15 -0
  148. package/src/charting/charts/FunnelChart.js +47 -0
  149. package/src/charting/charts/GanttChart.js +201 -0
  150. package/src/charting/charts/GaugeChart.js +175 -0
  151. package/src/charting/charts/GeoMapChart.js +146 -0
  152. package/src/charting/charts/GroupedBarChart.js +88 -0
  153. package/src/charting/charts/GroupedDistributionChart.js +70 -0
  154. package/src/charting/charts/HeatmapChart.js +80 -0
  155. package/src/charting/charts/HierarchyChart.js +39 -0
  156. package/src/charting/charts/HistogramChart.js +45 -0
  157. package/src/charting/charts/KpiTile.js +72 -0
  158. package/src/charting/charts/LagPlotChart.js +41 -0
  159. package/src/charting/charts/LineChart.js +124 -0
  160. package/src/charting/charts/MultiRingGauge.js +54 -0
  161. package/src/charting/charts/OutlineChart.js +95 -0
  162. package/src/charting/charts/ParallelCoordinatesChart.js +130 -0
  163. package/src/charting/charts/PieChart.js +56 -0
  164. package/src/charting/charts/PipeChart.js +88 -0
  165. package/src/charting/charts/PopulationPyramidChart.js +106 -0
  166. package/src/charting/charts/QQPlotChart.js +64 -0
  167. package/src/charting/charts/RadarChart.js +76 -0
  168. package/src/charting/charts/RadialBarChart.js +96 -0
  169. package/src/charting/charts/RingGauge.js +23 -0
  170. package/src/charting/charts/SankeyDiagram.js +174 -0
  171. package/src/charting/charts/ScatterChart.js +104 -0
  172. package/src/charting/charts/StackedAreaChart.js +15 -0
  173. package/src/charting/charts/StackedBarChart.js +33 -0
  174. package/src/charting/charts/StackedBarChart3DOrbit.js +58 -0
  175. package/src/charting/charts/StreamGraphChart.js +131 -0
  176. package/src/charting/charts/SunburstChart.js +57 -0
  177. package/src/charting/charts/ThermometerGauge.js +43 -0
  178. package/src/charting/charts/TreemapChart.js +54 -0
  179. package/src/charting/charts/ViolinChart.js +37 -0
  180. package/src/charting/charts/WaterfallChart.js +66 -0
  181. package/src/charting/charts/WordCloudChart.js +104 -0
  182. package/src/charting/diagramModel/AddViewCommand.js +33 -0
  183. package/src/charting/diagramModel/DiagramModel.js +39 -0
  184. package/src/charting/diagramModel/DiagramModelSearch.js +22 -0
  185. package/src/charting/diagramModel/DiagramView.js +50 -0
  186. package/src/charting/diagramModel/ModelHistory.js +43 -0
  187. package/src/charting/diagramModel/ModelReport.js +153 -0
  188. package/src/charting/diagramModel/ModelSearch.js +223 -0
  189. package/src/charting/diagramModel/RemoveViewCommand.js +25 -0
  190. package/src/charting/diagramModel/RenameViewCommand.js +21 -0
  191. package/src/charting/diagramModel/ReplaceTextCommand.js +25 -0
  192. package/src/charting/diagramModel/ViewSetChecker.js +34 -0
  193. package/src/charting/diagramModel/ViewSetModel.js +243 -0
  194. package/src/charting/diagramModel/index.js +6 -0
  195. package/src/charting/diagramModel/nameTransforms.js +29 -0
  196. package/src/charting/diagrams/ArchimateCommands.js +141 -0
  197. package/src/charting/diagrams/ArchimateDiagram.js +263 -0
  198. package/src/charting/diagrams/ArchimateModel.js +1155 -0
  199. package/src/charting/diagrams/ArchimateModelChecker.js +125 -0
  200. package/src/charting/diagrams/ArchimateModelReport.js +128 -0
  201. package/src/charting/diagrams/ArchimateModelSearch.js +41 -0
  202. package/src/charting/diagrams/ArchimateValidator.js +357 -0
  203. package/src/charting/diagrams/CanvasView.js +112 -0
  204. package/src/charting/diagrams/ContextMenu.js +37 -0
  205. package/src/charting/diagrams/DataModelDiagram.js +86 -0
  206. package/src/charting/diagrams/DataModelRelationshipStrategy.js +38 -0
  207. package/src/charting/diagrams/DerivedRelationships.js +102 -0
  208. package/src/charting/diagrams/EbnfDiagram.js +39 -0
  209. package/src/charting/diagrams/EdgeGeometry.js +553 -0
  210. package/src/charting/diagrams/EditViewItemCommand.js +128 -0
  211. package/src/charting/diagrams/ElementInstance.js +157 -0
  212. package/src/charting/diagrams/GraphDiagram.js +1340 -0
  213. package/src/charting/diagrams/GraphDiagram3D.js +152 -0
  214. package/src/charting/diagrams/GraphMetrics.js +81 -0
  215. package/src/charting/diagrams/GridOverlay.js +137 -0
  216. package/src/charting/diagrams/ImportRowsCommand.js +62 -0
  217. package/src/charting/diagrams/LabelHelper.js +108 -0
  218. package/src/charting/diagrams/MergeElementsCommand.js +101 -0
  219. package/src/charting/diagrams/NestInstanceCommand.js +34 -0
  220. package/src/charting/diagrams/NodeGeometry.js +158 -0
  221. package/src/charting/diagrams/PlaceItemsCommand.js +77 -0
  222. package/src/charting/diagrams/RadialLayout.js +101 -0
  223. package/src/charting/diagrams/RelationshipInstance.js +93 -0
  224. package/src/charting/diagrams/RemoveGroupFromViewCommand.js +28 -0
  225. package/src/charting/diagrams/RemoveLineCommand.js +27 -0
  226. package/src/charting/diagrams/ShowElementCommand.js +43 -0
  227. package/src/charting/diagrams/SvgCoordinate.js +17 -0
  228. package/src/charting/diagrams/SvgZoom.js +127 -0
  229. package/src/charting/diagrams/Tooltip.js +62 -0
  230. package/src/charting/diagrams/ViewConnectionInstance.js +102 -0
  231. package/src/charting/diagrams/ViewObjectInstance.js +56 -0
  232. package/src/charting/diagrams/commands/AddEdgeCommand.js +34 -0
  233. package/src/charting/diagrams/commands/AddNodeCommand.js +28 -0
  234. package/src/charting/diagrams/commands/AddWaypointCommand.js +27 -0
  235. package/src/charting/diagrams/commands/CreateFolderCommand.js +27 -0
  236. package/src/charting/diagrams/commands/DeleteEdgeCommand.js +30 -0
  237. package/src/charting/diagrams/commands/DeleteFolderCommand.js +47 -0
  238. package/src/charting/diagrams/commands/DeleteNodeCommand.js +35 -0
  239. package/src/charting/diagrams/commands/DeleteWaypointCommand.js +24 -0
  240. package/src/charting/diagrams/commands/GraphCommand.js +65 -0
  241. package/src/charting/diagrams/commands/InvertEdgeCommand.js +24 -0
  242. package/src/charting/diagrams/commands/MoveNodeCommand.js +44 -0
  243. package/src/charting/diagrams/commands/MoveWaypointCommand.js +27 -0
  244. package/src/charting/diagrams/commands/RenameEdgeCommand.js +23 -0
  245. package/src/charting/diagrams/commands/RenameFolderCommand.js +31 -0
  246. package/src/charting/diagrams/commands/RenameNodeCommand.js +27 -0
  247. package/src/charting/diagrams/commands/ResizeNodeCommand.js +46 -0
  248. package/src/charting/diagrams/commands/UpdateEdgeSideCommand.js +40 -0
  249. package/src/charting/diagrams/commands/index.js +17 -0
  250. package/src/charting/diagrams/duplicates.js +49 -0
  251. package/src/charting/diagrams/nesting.js +30 -0
  252. package/src/charting/diagrams/roadmap.js +77 -0
  253. package/src/charting/edgeMarkers/ArrowMarker.js +15 -0
  254. package/src/charting/edgeMarkers/CircleMarker.js +13 -0
  255. package/src/charting/edgeMarkers/CrowsFootMarker.js +16 -0
  256. package/src/charting/edgeMarkers/DiamondMarker.js +15 -0
  257. package/src/charting/edgeMarkers/EdgeMarker.js +34 -0
  258. package/src/charting/edgeMarkers/HalfArrowMarker.js +8 -0
  259. package/src/charting/edgeMarkers/HollowDiamondMarker.js +18 -0
  260. package/src/charting/edgeMarkers/HollowTriangleMarker.js +18 -0
  261. package/src/charting/edgeMarkers/OpenArrowMarker.js +17 -0
  262. package/src/charting/edgeMarkers/index.js +27 -0
  263. package/src/charting/edgeStyle/EdgeStyleCascade.js +22 -0
  264. package/src/charting/edgeStyle/EdgeStyleDialog.js +51 -0
  265. package/src/charting/edgeStyle/EdgeStyleSchema.js +43 -0
  266. package/src/charting/edgeStyle/SetStyleCommand.js +12 -0
  267. package/src/charting/edgeStyle/index.js +4 -0
  268. package/src/charting/emphasis/EmphasisRule.js +42 -0
  269. package/src/charting/emphasis/HighlightRule.js +24 -0
  270. package/src/charting/gauges/ArcTrack.js +51 -0
  271. package/src/charting/gauges/GaugeAnimation.js +51 -0
  272. package/src/charting/gauges/GaugeBands.js +48 -0
  273. package/src/charting/gauges/GaugeScale.js +87 -0
  274. package/src/charting/gauges/GaugeTrack.js +44 -0
  275. package/src/charting/gauges/GaugeValue.js +61 -0
  276. package/src/charting/gauges/HorizontalTrack.js +14 -0
  277. package/src/charting/gauges/LinearTrack.js +29 -0
  278. package/src/charting/gauges/Sparkline.js +42 -0
  279. package/src/charting/gauges/VerticalTrack.js +17 -0
  280. package/src/charting/glyphs/ArrowGlyph.js +21 -0
  281. package/src/charting/glyphs/BatteryGlyph.js +18 -0
  282. package/src/charting/glyphs/ChevronGlyph.js +18 -0
  283. package/src/charting/glyphs/CircleGlyph.js +15 -0
  284. package/src/charting/glyphs/CloudGlyph.js +19 -0
  285. package/src/charting/glyphs/ComponentGlyph.js +18 -0
  286. package/src/charting/glyphs/ConstraintGlyph.js +24 -0
  287. package/src/charting/glyphs/ContractBoxGlyph.js +10 -0
  288. package/src/charting/glyphs/CubeGlyph.js +19 -0
  289. package/src/charting/glyphs/CylinderGlyph.js +19 -0
  290. package/src/charting/glyphs/DashedDoubleArrowGlyph.js +11 -0
  291. package/src/charting/glyphs/DeviceGlyph.js +17 -0
  292. package/src/charting/glyphs/DiamondGlyph.js +17 -0
  293. package/src/charting/glyphs/DocumentGlyph.js +17 -0
  294. package/src/charting/glyphs/DoubleArrowGlyph.js +23 -0
  295. package/src/charting/glyphs/DoubleCircleGlyph.js +24 -0
  296. package/src/charting/glyphs/EllipseGlyph.js +18 -0
  297. package/src/charting/glyphs/FactoryGlyph.js +20 -0
  298. package/src/charting/glyphs/FlagGlyph.js +16 -0
  299. package/src/charting/glyphs/GapCircleGlyph.js +17 -0
  300. package/src/charting/glyphs/GearGlyph.js +37 -0
  301. package/src/charting/glyphs/Glyph.js +98 -0
  302. package/src/charting/glyphs/GroupingBoxGlyph.js +13 -0
  303. package/src/charting/glyphs/HalfCircleGlyph.js +22 -0
  304. package/src/charting/glyphs/HexagonGlyph.js +28 -0
  305. package/src/charting/glyphs/IconGlyph.js +22 -0
  306. package/src/charting/glyphs/ImageGlyph.js +16 -0
  307. package/src/charting/glyphs/JunctionGlyph.js +17 -0
  308. package/src/charting/glyphs/LollipopGlyph.js +22 -0
  309. package/src/charting/glyphs/MagnifierGlyph.js +17 -0
  310. package/src/charting/glyphs/NoteGlyph.js +33 -0
  311. package/src/charting/glyphs/ObjectBoxGlyph.js +21 -0
  312. package/src/charting/glyphs/OrJunctionGlyph.js +17 -0
  313. package/src/charting/glyphs/ParallelogramGlyph.js +20 -0
  314. package/src/charting/glyphs/PersonGlyph.js +23 -0
  315. package/src/charting/glyphs/PillGlyph.js +23 -0
  316. package/src/charting/glyphs/PinGlyph.js +18 -0
  317. package/src/charting/glyphs/PrincipleGlyph.js +23 -0
  318. package/src/charting/glyphs/ProductBoxGlyph.js +16 -0
  319. package/src/charting/glyphs/RectGlyph.js +15 -0
  320. package/src/charting/glyphs/RoundedBoxGlyph.js +13 -0
  321. package/src/charting/glyphs/StackGlyph.js +14 -0
  322. package/src/charting/glyphs/StepsGlyph.js +20 -0
  323. package/src/charting/glyphs/StickFigureGlyph.js +32 -0
  324. package/src/charting/glyphs/SystemSoftwareBoxGlyph.js +16 -0
  325. package/src/charting/glyphs/TabbedBoxGlyph.js +37 -0
  326. package/src/charting/glyphs/TargetGlyph.js +23 -0
  327. package/src/charting/glyphs/WavyBoxGlyph.js +17 -0
  328. package/src/charting/glyphs/WheelGlyph.js +28 -0
  329. package/src/charting/glyphs/drawGlyph.js +28 -0
  330. package/src/charting/glyphs/glyphSvg.js +55 -0
  331. package/src/charting/glyphs/index.js +109 -0
  332. package/src/charting/modelTree/AnalysisPanel.js +159 -0
  333. package/src/charting/modelTree/DiagramTabs.js +217 -0
  334. package/src/charting/modelTree/ModelTree.js +164 -0
  335. package/src/charting/modelTree/ModelTreePanel.js +914 -0
  336. package/src/charting/modelTree/TreeBuilder.js +238 -0
  337. package/src/charting/modelTree/TreeModeRegistry.js +51 -0
  338. package/src/charting/modelTree/TreeViewMode.js +110 -0
  339. package/src/charting/modelTree/buildFilterTrees.js +138 -0
  340. package/src/charting/modelTree/modes/FlatTreeMode.js +46 -0
  341. package/src/charting/modelTree/modes/LayerGroupedTreeMode.js +62 -0
  342. package/src/charting/modelTree/modes/TypeGroupedTreeMode.js +60 -0
  343. package/src/charting/modelTree/treeLayers.js +11 -0
  344. package/src/charting/report/reportHtml.js +82 -0
  345. package/src/charting/report/reportViewer.js +118 -0
  346. package/src/charting/shapes/CircleShape.js +19 -0
  347. package/src/charting/shapes/PathShape.js +17 -0
  348. package/src/charting/shapes/RectShape.js +20 -0
  349. package/src/charting/shapes/Shape.js +20 -0
  350. package/src/charting/shapes/ShapeFactory.js +23 -0
  351. package/src/charting/storage/LocalJsonStore.js +43 -0
  352. package/src/charting/templates/ActorTemplate.js +36 -0
  353. package/src/charting/templates/BoxTemplate.js +27 -0
  354. package/src/charting/templates/CircleTemplate.js +18 -0
  355. package/src/charting/templates/ClassTemplate.js +20 -0
  356. package/src/charting/templates/CloudTemplate.js +43 -0
  357. package/src/charting/templates/ComponentTemplate.js +19 -0
  358. package/src/charting/templates/CylinderTemplate.js +30 -0
  359. package/src/charting/templates/DataStoreTemplate.js +16 -0
  360. package/src/charting/templates/DiamondTemplate.js +10 -0
  361. package/src/charting/templates/DocumentTemplate.js +32 -0
  362. package/src/charting/templates/EllipseTemplate.js +15 -0
  363. package/src/charting/templates/FinalStateTemplate.js +12 -0
  364. package/src/charting/templates/GlyphTemplate.js +47 -0
  365. package/src/charting/templates/HexagonTemplate.js +17 -0
  366. package/src/charting/templates/LifelineTemplate.js +20 -0
  367. package/src/charting/templates/ManualInputTemplate.js +12 -0
  368. package/src/charting/templates/NoteTemplate.js +23 -0
  369. package/src/charting/templates/OctagonTemplate.js +7 -0
  370. package/src/charting/templates/PackageTemplate.js +25 -0
  371. package/src/charting/templates/ParallelogramTemplate.js +11 -0
  372. package/src/charting/templates/PentagonTemplate.js +5 -0
  373. package/src/charting/templates/PolygonTemplate.js +18 -0
  374. package/src/charting/templates/PredefinedProcessTemplate.js +13 -0
  375. package/src/charting/templates/RectangleTemplate.js +28 -0
  376. package/src/charting/templates/RegularPolygonTemplate.js +21 -0
  377. package/src/charting/templates/RoundedRectangleTemplate.js +5 -0
  378. package/src/charting/templates/StadiumTemplate.js +8 -0
  379. package/src/charting/templates/StarTemplate.js +17 -0
  380. package/src/charting/templates/SwimlaneTemplate.js +18 -0
  381. package/src/charting/templates/Template.js +208 -0
  382. package/src/charting/templates/TrapezoidTemplate.js +11 -0
  383. package/src/charting/templates/TriangleTemplate.js +12 -0
  384. package/src/charting/templates/index.js +31 -0
  385. package/src/charting/templates/outline.js +59 -0
  386. package/src/charting/templates/svg.js +19 -0
  387. package/src/charting/textToShapes.js +61 -0
  388. package/src/charting/toolbar/ToolbarButton.js +38 -0
  389. package/src/charting/toolbar/ToolbarCheckbox.js +31 -0
  390. package/src/charting/toolbar/ToolbarItem.js +19 -0
  391. package/src/charting/toolbar/ToolbarMenu.js +36 -0
  392. package/src/charting/toolbar/ToolbarSelect.js +38 -0
  393. package/src/charting/toolbar/ToolbarSeparator.js +7 -0
  394. package/src/charting/toolbar/ToolbarText.js +22 -0
  395. package/src/charting/toolbar/index.js +8 -0
  396. package/src/charting/toolbar/pickFile.js +14 -0
  397. package/src/charting/viewDecorations.js +85 -0
  398. package/src/charting/zOrder.js +57 -0
  399. package/src/csvTable.js +61 -0
  400. package/src/datamodel.js +122 -0
  401. package/src/datawindow/BoundedWindow.js +36 -0
  402. package/src/datawindow/FlatDataWindow.js +34 -0
  403. package/src/datawindow/GraphDataWindow.js +40 -0
  404. package/src/datawindow/GroupedSampleDataWindow.js +16 -0
  405. package/src/datawindow/SeriesDataWindow.js +42 -0
  406. package/src/datawindow/index.js +31 -0
  407. package/src/diagramCatalog.js +30 -0
  408. package/src/ebnfDiagram.js +57 -0
  409. package/src/ebnfParser.js +129 -0
  410. package/src/exportImage.js +233 -0
  411. package/src/index.js +2636 -0
  412. package/src/itIcons.js +84 -0
  413. package/src/kernelExpr.js +243 -0
  414. package/src/propertiesDialog.js +463 -0
  415. package/src/railroadDiagram.js +571 -0
  416. package/src/treeModeCatalog.js +16 -0
  417. package/src/workspace/ContextBus.js +79 -0
  418. package/src/workspace/EditorShell.js +67 -0
  419. package/src/workspace/Part.js +163 -0
  420. package/src/workspace/PartFactory.js +49 -0
  421. package/src/workspace/PartRegistry.js +86 -0
  422. package/src/workspace/Workspace.js +321 -0
  423. package/src/workspace/archimateServices.js +33 -0
  424. package/src/workspace/dom.js +120 -0
  425. package/src/workspace/index.js +75 -0
  426. package/src/workspace/layout/GridNode.js +280 -0
  427. package/src/workspace/layout/LayoutNode.js +89 -0
  428. package/src/workspace/layout/PartNode.js +77 -0
  429. package/src/workspace/layout/SplitNode.js +114 -0
  430. package/src/workspace/layout/TabsNode.js +191 -0
  431. package/src/workspace/layout/index.js +24 -0
  432. package/src/workspace/parts/AdapterPart.js +33 -0
  433. package/src/workspace/parts/ArchimateCanvasPart.js +345 -0
  434. package/src/workspace/parts/ArchimateEditorPart.js +79 -0
  435. package/src/workspace/parts/ChartPart.js +115 -0
  436. package/src/workspace/parts/ContentPart.js +34 -0
  437. package/src/workspace/parts/DetailPart.js +46 -0
  438. package/src/workspace/parts/DiagramEditorPart.js +135 -0
  439. package/src/workspace/parts/EditorPart.js +388 -0
  440. package/src/workspace/parts/HtmlPart.js +25 -0
  441. package/src/workspace/parts/ListPart.js +57 -0
  442. package/src/workspace/parts/ModelFile.js +187 -0
  443. package/src/workspace/parts/ModelsPart.js +135 -0
  444. package/src/workspace/styles.js +258 -0
  445. package/src/workspace/themes.js +96 -0
  446. package/src/workspace/workArea.js +413 -0
  447. package/src/workspace/workAreaModel.js +197 -0
  448. package/src/workspace.js +16 -0
  449. package/src/zip/ZipArchive.js +160 -0
  450. package/src/zip/crc32.js +25 -0
  451. package/src/zip/inflate.js +159 -0
@@ -0,0 +1,723 @@
1
+ // Copyright 2026 Jaroslav Peter Prib, Purveyor of Excellence
2
+ /**
3
+ * ArchiMate notation — layers, the official element type catalog (each type
4
+ * a real object carrying its own layer, aspect, and icon — not a name in one
5
+ * lookup table and its layer in a second, separate one that could silently
6
+ * drift out of sync), and the 11 relationship types' line/arrowhead
7
+ * notation. Covers BOTH ArchiMate 3.2 and ArchiMate 4 — see "Two versions"
8
+ * below — every ArchimateNotation lookup takes an optional `version`
9
+ * (`'3.2'|'4'`, default `'4'`, `ArchimateNotation.versions()`).
10
+ *
11
+ * Kept in its own module, deliberately OO (ArchimateLayer/ArchimateElementType/
12
+ * ArchimateRelationshipType instances, queried through the ArchimateNotation
13
+ * registry below) rather than graphDiagram()'s usual flat string-keyed maps —
14
+ * this is domain data self-contained enough to own its own shape, and a
15
+ * type's layer being a genuine object reference (`type.layer`, not
16
+ * `TYPE_LAYERS[type.name]`) is what makes a dependent UI control trivial:
17
+ * `ArchimateNotation.typesInLayer(layer)` and `type.layer` are the same
18
+ * relationship read from either direction, so a "layer" dropdown and a
19
+ * "type" dropdown that must narrow to match it can never disagree.
20
+ *
21
+ * Colours, corner shapes, and relationship notations come from the spec's
22
+ * own "Appendix A: Summary of Language Notation" artwork, read out of the
23
+ * embedded LOSSLESS PNG figures (so the fills below are literal pixel
24
+ * values, not a sample off a rescaled page render); element/layer names
25
+ * cross-checked against a local jArchi scripting library's own element
26
+ * list. `notationShape` names each type's real outline from that same
27
+ * figure (see ArchimateElementType) — the emoji `icon` below is only the
28
+ * fallback badge for a type with no such shape.
29
+ *
30
+ * **Two versions.** ArchiMate 4 retires 19 of 3.2's element types: fifteen
31
+ * layer-specific behavior types (business-process/application-process/
32
+ * technology-process, and the same business-/application-/technology- split
33
+ * for function/service/interaction/event) collapse into five layer-
34
+ * INDEPENDENT "Common Domain" types (process/function/service/interaction/
35
+ * event — which layer one of these actually belongs to is no longer implied
36
+ * by its type name at all, so its `ArchimateElementType#layer` is `null`;
37
+ * the real layer must come from the element's own `layer` field); four more
38
+ * (contract, representation, constraint, gap) are retired outright, each
39
+ * replaced by an existing type (business-object, business-object,
40
+ * requirement, work-package respectively). `migrateElementToV4(element)`
41
+ * converts one 3.2-style element to its v4 equivalent — exactly the
42
+ * mapping (and property-tagging: `ArchiMate4_Domain`/`MigratedFrom` for a
43
+ * behavior consolidation, `LegacyType`/`Type` + `MigratedFrom` for a retired
44
+ * type) a jArchi "Migrate Model Elements from ArchiMate 3.2 to ArchiMate 4"
45
+ * script performs — `RenderEngine.archimateDiagram`'s own `archimateVersion`
46
+ * option (default `'4'`) runs every element through it automatically. Every
47
+ * other official 3.2 type (business-actor, application-component, goal,
48
+ * node, ...) — and all 11 relationship notations — are unchanged in v4.
49
+ */
50
+
51
+ /** One ArchiMate layer — a fill colour and a generic fallback icon (used
52
+ * only when neither an element nor its ArchimateElementType carries a more
53
+ * specific one). */
54
+ export class ArchimateLayer {
55
+ constructor(name, color, defaultIcon) {
56
+ this.name = name;
57
+ this.color = color;
58
+ this.defaultIcon = defaultIcon;
59
+ }
60
+ }
61
+
62
+ /** A handful of generic, aspect-wide alternative icons — shared across every
63
+ * type of that aspect, so ArchimateElementType#iconChoices has real
64
+ * alternatives to offer without hand-picking 3-4 unique glyphs for each of
65
+ * the ~55 official types individually. Rounds out a type's own specific
66
+ * icon (always choice 0 — the "ArchiMate standard" default) and its
67
+ * layer's own generic one. */
68
+ const ASPECT_ICONS = {
69
+ 'active-structure': ['🧍', '📦', '🔌'],
70
+ behavior: ['▶️', '🔄', '⚡'],
71
+ 'passive-structure': ['📄', '🗃️', '📁'],
72
+ motivation: ['🎯', '💭', '❗'],
73
+ other: ['🔀', '📍', '🗂️'],
74
+ };
75
+
76
+ /** One official ArchiMate element type — its own layer (a real
77
+ * ArchimateLayer reference, or `null` for an ArchiMate 4 "Common Domain"
78
+ * type — see the module's own doc comment — whose real layer isn't implied
79
+ * by its type name at all and must come from the element itself), `aspect`
80
+ * ('active-structure'|'behavior'|'passive-structure'|'motivation'|'other',
81
+ * driving box corner style — see `cornerStyle`), and a representative icon. */
82
+ export class ArchimateElementType {
83
+ constructor(name, layer, aspect, icon, notationShape, ownColor, description) {
84
+ this.name = name;
85
+ this.layer = layer;
86
+ this.aspect = aspect;
87
+ this.icon = icon;
88
+ // A fill of this type's OWN, overriding its layer's — the spec's own
89
+ // figure gives a few elements a colour their layer doesn't share
90
+ // (Plateau/Gap are green among the otherwise-pink Implementation &
91
+ // Migration elements; Grouping is unfilled; Junction is a plain
92
+ // black dot). `undefined` for everything else, which just takes the
93
+ // layer's colour — see the `color` getter.
94
+ this.ownColor = ownColor;
95
+ // The real ArchiMate notation's own distinct outline (graphDiagram
96
+ // `shape` value — see RenderEngine._nodeShapeEl) for this type, when
97
+ // one exists in the spec's own "Appendix A: Summary of Language
98
+ // Notation" (e.g. Process -> a plain arrow, Interface -> a lollipop,
99
+ // Node -> a 3D cube) — `undefined` for types the spec itself only
100
+ // ever shows as a plain box carrying a small mark — those get a
101
+ // box-with-mark shape of their own (object-box/contract-box/
102
+ // product-box/wavy-box/...), so EVERY official type now has a real
103
+ // vector glyph and archimateDiagram never falls back to an emoji for
104
+ // one. Used only when a diagram/element opts into
105
+ // `useDistinctShape` — see archimateDiagram's own option; the
106
+ // default everywhere else is still the plain box + corner icon.
107
+ this.notationShape = notationShape;
108
+ // Short human-readable explanation of what this element type means,
109
+ // suitable for a help tooltip in an authoring UI.
110
+ this.description = description;
111
+ }
112
+
113
+ /** This type's fill colour — its own (`ownColor`, for the handful the
114
+ * spec colours differently from their layer) if it has one, else its
115
+ * layer's, same as everywhere else (an element wanting a different
116
+ * colour still sets `color` on itself, which beats both); `undefined`
117
+ * for a layer-independent "Common Domain" type (`layer` is `null`) with
118
+ * no own colour — the element's own resolved layer supplies one
119
+ * instead, see RenderEngine._archimateLayerColor. */
120
+ get color() { return this.ownColor ?? this.layer?.color; }
121
+
122
+ /** A short list of reasonable icon alternatives for this type — choice
123
+ * 0 is always `this.icon` (the ArchiMate-standard default a plain
124
+ * element/`archimateDiagram` still falls back to on its own); the rest
125
+ * are generic icons shared by every type of the same aspect, then the
126
+ * layer's own generic default (skipped for a layer-independent "Common
127
+ * Domain" type, `layer` is `null`) — for a UI letting someone pick a
128
+ * different one than the standard (e.g. the Properties dialog's icon
129
+ * field in test/charts.html), never for automatic resolution, which
130
+ * always means choice 0 unless a diagram sets `options.iconChoiceIndex`
131
+ * (RenderEngine.archimateDiagram) to pick a different one for every
132
+ * element at once. */
133
+ get iconChoices() {
134
+ return [...new Set([this.icon, ...(ASPECT_ICONS[this.aspect] ?? []), this.layer?.defaultIcon].filter(Boolean))];
135
+ }
136
+
137
+ /** 'chamfered' for every Motivation-layer type regardless of aspect
138
+ * (every official Motivation element uses that shape); 'rounded' for
139
+ * `aspect: 'behavior'`; 'sharp' otherwise — matches
140
+ * RenderEngine._archimateCornerStyle's own rule, restated here as a
141
+ * property of the type itself now that aspect is known up front
142
+ * instead of an open per-element hint. A layer-independent "Common
143
+ * Domain" type (`layer` is `null`) can never be Motivation, so this
144
+ * still resolves correctly from `aspect` alone. */
145
+ get cornerStyle() {
146
+ if (this.layer?.name === 'motivation') return 'chamfered';
147
+ return this.aspect === 'behavior' ? 'rounded' : 'sharp';
148
+ }
149
+ }
150
+
151
+ /** Generic icon alternatives offered for an element with no recognised
152
+ * official `type` at all (so ArchimateElementType#iconChoices doesn't
153
+ * apply) — one from each aspect family plus a couple of layer defaults,
154
+ * just enough variety for a picker to be worth showing. */
155
+ export const GENERIC_ICON_CHOICES = [...new Set([
156
+ ...ASPECT_ICONS['active-structure'], ...ASPECT_ICONS.behavior, ...ASPECT_ICONS['passive-structure'],
157
+ ...ASPECT_ICONS.motivation, ...ASPECT_ICONS.other,
158
+ ])];
159
+
160
+ /** One ArchiMate relationship type's notation — `lineStyle`
161
+ * ('solid'|'dashed'|'dotted'), `arrowhead` (the target-end glyph), and
162
+ * `arrowheadStart` (an independent source-end glyph, e.g. composition's
163
+ * filled diamond at the "whole" end) — the same vocabulary graphDiagram's
164
+ * own `edge.lineStyle`/`arrowhead`/`arrowheadStart` options use. */
165
+ export class ArchimateRelationshipType {
166
+ constructor(name, lineStyle, arrowhead, arrowheadStart, description) {
167
+ this.name = name;
168
+ this.lineStyle = lineStyle;
169
+ this.arrowhead = arrowhead;
170
+ this.arrowheadStart = arrowheadStart;
171
+ // Short human-readable explanation of what this relationship means,
172
+ // suitable for a help tooltip in an authoring UI.
173
+ this.description = description;
174
+ }
175
+
176
+ /**
177
+ * This notation as line style values (EDGE_STYLE_PROPERTIES keys), its
178
+ * arrowheads as edge marker keys ('triangle-hollow' → 'trianglehollow',
179
+ * the same folding getEdgeMarker applies).
180
+ * @returns {{lineStyle: string, startMarker: string, endMarker: string}}
181
+ */
182
+ edgeStyle() {
183
+ const markerKey = (name) => (name ? String(name).toLowerCase().replace(/[^a-z]/g, '') : 'none');
184
+ return {
185
+ lineStyle: this.lineStyle,
186
+ startMarker: markerKey(this.arrowheadStart),
187
+ endMarker: markerKey(this.arrowhead),
188
+ };
189
+ }
190
+ }
191
+
192
+ // Exact fills, read out of the spec's own Appendix A artwork — the figures
193
+ // are embedded LOSSLESS PNGs, so these are the literal pixel values of the
194
+ // notation, not a sample off a rescaled/antialiased page render (which is
195
+ // what an earlier pass here did, against a different document, and got
196
+ // application/technology/composite visibly wrong).
197
+ const LAYERS = {
198
+ strategy: new ArchimateLayer('strategy', '#F5DEAA', '♟️'),
199
+ business: new ArchimateLayer('business', '#FFFFAF', '👤'),
200
+ application: new ArchimateLayer('application', '#AFFFFF', '⚙️'),
201
+ // Technology and Physical share one green in the spec's own figure.
202
+ technology: new ArchimateLayer('technology', '#AFFFAF', '🖥️'),
203
+ physical: new ArchimateLayer('physical', '#AFFFAF', '📦'),
204
+ motivation: new ArchimateLayer('motivation', '#CCCCFF', '🧭'),
205
+ implementation: new ArchimateLayer('implementation', '#FFE0E0', '🚀'),
206
+ // Composite has no single colour of its own — Location (its one filled
207
+ // element) is orange, while Grouping/Junction carry their own overrides
208
+ // below (an unfilled dashed box and a plain black dot respectively).
209
+ composite: new ArchimateLayer('composite', '#FFBF80', '▫️'),
210
+ other: new ArchimateLayer('other', '#E8E8E8', '▫️'),
211
+ };
212
+ // Accepted alias spellings — both point at the SAME layer object, not a copy.
213
+ LAYERS.infrastructure = LAYERS.technology;
214
+ LAYERS.migration = LAYERS.implementation;
215
+
216
+ const ELEMENT_TYPES_V3_2 = new Map();
217
+ /** name, layer key, aspect, icon, notationShape? — one row per official
218
+ * ArchiMate 3.2 element (see the class doc comment for where these were
219
+ * checked; `notationShape` cross-checked against the spec's own Appendix A,
220
+ * "Summary of Language Notation" — a `graphDiagram` shape name, or omitted
221
+ * for a type the spec only ever shows as a plain box, or whose real glyph
222
+ * is too compound to render cleanly as a whole-node shape here; a 6th,
223
+ * `ownColor`, overrides the layer's fill for the few the spec colours
224
+ * differently). */
225
+ const ELEMENT_TYPE_ROWS = [
226
+ // Strategy — Resource is the layer's one active-structure element
227
+ // (sharp corners); the other three are behavior (rounded).
228
+ ['resource', 'strategy', 'active-structure', '🔋', 'battery', undefined, 'An asset owned or controlled by an organization that helps achieve strategic goals.'],
229
+ ['capability', 'strategy', 'behavior', '🧱', 'steps', undefined, 'A stable ability an organization possesses to perform a particular activity.'],
230
+ ['course-of-action', 'strategy', 'behavior', '🏹', 'target', undefined, 'A strategic approach or plan chosen to achieve a goal.'],
231
+ ['value-stream', 'strategy', 'behavior', '➡️', 'flag', undefined, 'A sequence of activities that creates an overall result for a customer or stakeholder.'],
232
+ // Business
233
+ ['business-actor', 'business', 'active-structure', '🧍', 'stick-figure', undefined, 'An organizational entity, person, department, or role that performs behavior.'],
234
+ ['business-role', 'business', 'active-structure', '🎭', 'cylinder', undefined, 'A named responsibility assigned to an actor; the skills and permissions needed to perform behavior.'],
235
+ ['business-collaboration', 'business', 'active-structure', '🤝', 'double-circle', undefined, 'A temporary or permanent aggregation of two or more business roles that work together.'],
236
+ ['business-interface', 'business', 'active-structure', '🔌', 'lollipop', undefined, 'The point of access where business services are made available to the environment.'],
237
+ ['business-process', 'business', 'behavior', '▶️', 'arrow', undefined, 'A sequence of business behaviors that achieves a specific outcome such as a product or service.'],
238
+ ['business-function', 'business', 'behavior', '🔧', 'chevron', undefined, 'A collection of business behavior based on a chosen set of criteria such as resources or competencies.'],
239
+ ['business-interaction', 'business', 'behavior', '🔄', 'half-circle', undefined, 'A unit of collective business behavior performed by two or more business roles.'],
240
+ ['business-event', 'business', 'behavior', '⚡', 'flag', undefined, 'Something that happens and may trigger business behavior.'],
241
+ ['business-service', 'business', 'behavior', '🛎️', 'pill', undefined, 'A service that fulfills a business need for a customer or other internal/external user.'],
242
+ ['business-object', 'business', 'passive-structure', '📁', 'object-box', undefined, 'A passive element representing a concept used within a particular business domain.'],
243
+ ['contract', 'business', 'passive-structure', '📜', 'contract-box', undefined, 'A formal or informal specification of an agreement between a provider and a consumer.'],
244
+ ['representation', 'business', 'passive-structure', '🖼️', 'wavy-box', undefined, 'A perceptible form of the information carried by a business object.'],
245
+ ['product', 'business', 'passive-structure', '🏷️', 'product-box', undefined, 'A coherent collection of services and/or passive structure, accompanied by a contract.'],
246
+ // Application
247
+ ['application-component', 'application', 'active-structure', '🧩', 'component', undefined, 'A modular, deployable, and replaceable part of a software system that encapsulates its behavior and data.'],
248
+ ['application-collaboration', 'application', 'active-structure', '🔗', 'double-circle', undefined, 'An aggregate of two or more application components that work together.'],
249
+ ['application-interface', 'application', 'active-structure', '🔌', 'lollipop', undefined, 'The point of access where application services are made available to users or other applications.'],
250
+ ['application-function', 'application', 'behavior', '🔧', 'chevron', undefined, 'A cohesive group of application behavior that an automated component can perform.'],
251
+ ['application-process', 'application', 'behavior', '▶️', 'arrow', undefined, 'A sequence of application behaviors that achieves a specific outcome.'],
252
+ ['application-interaction', 'application', 'behavior', '🔄', 'half-circle', undefined, 'A unit of collective application behavior performed by components working together.'],
253
+ ['application-event', 'application', 'behavior', '⚡', 'flag', undefined, 'Something that happens in the application domain and may trigger application behavior.'],
254
+ ['application-service', 'application', 'behavior', '🛎️', 'pill', undefined, 'An externally visible unit of application functionality exposed to users or other applications.'],
255
+ ['data-object', 'application', 'passive-structure', '🗃️', 'object-box', undefined, 'A passive element suitable for automated processing, representing structured data.'],
256
+ // Technology
257
+ ['node', 'technology', 'active-structure', '📦', 'cube', undefined, 'A computational or physical resource that hosts, manipulates, or interacts with other technology elements.'],
258
+ ['device', 'technology', 'active-structure', '💻', 'device', undefined, 'A physical hardware resource upon which system software or artifacts may be stored or deployed.'],
259
+ ['system-software', 'technology', 'active-structure', '💿', 'system-software-box', undefined, 'Software that provides or contributes to an environment for storing, executing, and using software or data.'],
260
+ ['technology-collaboration', 'technology', 'active-structure', '🤝', 'double-circle', undefined, 'An aggregate of two or more technology active-structure elements that work together.'],
261
+ ['technology-interface', 'technology', 'active-structure', '🔌', 'lollipop', undefined, 'The point of access where technology services are made available.'],
262
+ ['path', 'technology', 'active-structure', '↔️', 'double-arrow-dashed', undefined, 'A link between two or more technology nodes along which data or material can flow.'],
263
+ ['communication-network', 'technology', 'active-structure', '📡', 'double-arrow', undefined, 'A set of structures and channels that connects technology nodes and enables communication.'],
264
+ ['technology-function', 'technology', 'behavior', '🔧', 'chevron', undefined, 'A collection of technology behavior that can be performed by a technology node.'],
265
+ ['technology-process', 'technology', 'behavior', '▶️', 'arrow', undefined, 'A sequence of technology behaviors that achieves a specific outcome.'],
266
+ ['technology-interaction', 'technology', 'behavior', '🔄', 'half-circle', undefined, 'A unit of collective technology behavior performed by nodes or components working together.'],
267
+ ['technology-event', 'technology', 'behavior', '⚡', 'flag', undefined, 'Something that happens in the technology domain and may trigger technology behavior.'],
268
+ ['technology-service', 'technology', 'behavior', '🛎️', 'pill', undefined, 'An externally visible unit of technology functionality exposed to users or other technology elements.'],
269
+ ['artifact', 'technology', 'passive-structure', '📄', 'document', undefined, 'A physical or digital piece of data that is used or produced in a software development or deployment process.'],
270
+ // Physical — no behavior elements at this layer, all structure.
271
+ ['equipment', 'physical', 'active-structure', '⚙️', 'gear', undefined, 'One or more physical machines, tools, or instruments that can create, use, store, move, or transform materials.'],
272
+ ['facility', 'physical', 'active-structure', '🏭', 'factory', undefined, 'A physical structure or environment used to house people, machines, or other physical resources.'],
273
+ ['distribution-network', 'physical', 'active-structure', '🚚', 'double-arrow', undefined, 'A network used to transport materials or physical goods between locations.'],
274
+ ['material', 'physical', 'passive-structure', '🪨', 'hexagon', undefined, 'Tangible physical matter used or consumed in the production of products or delivery of services.'],
275
+ // Motivation — aspect is nominal here; every Motivation type is
276
+ // chamfered regardless (see ArchimateElementType#cornerStyle).
277
+ ['stakeholder', 'motivation', 'motivation', '🧑', 'cylinder', undefined, 'An individual, team, organization, or class thereof with an interest in the outcome of the architecture.'],
278
+ ['driver', 'motivation', 'motivation', '🧭', 'wheel', undefined, 'Something that creates, motivates, and fuels change in an organization.'],
279
+ ['assessment', 'motivation', 'motivation', '🔍', 'magnifier', undefined, 'An analysis of the state of affairs of the enterprise with respect to a driver.'],
280
+ ['goal', 'motivation', 'motivation', '🎯', 'target', undefined, 'A high-level statement of intent or direction that an organization wants to reach.'],
281
+ ['outcome', 'motivation', 'motivation', '🏆', 'target', undefined, 'An end result that has been achieved or is intended to be achieved.'],
282
+ ['principle', 'motivation', 'motivation', '❗', 'principle', undefined, 'A normative property of all elements within a given context that directs design decisions.'],
283
+ ['requirement', 'motivation', 'motivation', '📋', 'parallelogram', undefined, 'A statement of need that must be realized by systems or elements.'],
284
+ ['constraint', 'motivation', 'motivation', '🚧', 'constraint', undefined, 'A restriction on the way in which a system is realized.'],
285
+ ['meaning', 'motivation', 'motivation', '💭', 'cloud', undefined, 'The knowledge or expertise present in, or the interpretation given to, a concept in a particular context.'],
286
+ ['value', 'motivation', 'motivation', '💎', 'ellipse', undefined, 'The relative worth, utility, or importance of a particular element or outcome.'],
287
+ // Implementation & Migration
288
+ ['work-package', 'implementation', 'behavior', '📋', 'rounded-box', undefined, 'A series of actions designed to accomplish a defined set of objectives or deliverables.'],
289
+ ['deliverable', 'implementation', 'passive-structure', '🎁', 'wavy-box', undefined, 'A precisely-defined result of a work package that is delivered to stakeholders.'],
290
+ ['implementation-event', 'implementation', 'behavior', '⚡', 'flag', undefined, 'A behavior element denoting a state change related to the implementation or migration process.'],
291
+ // Plateau/Gap are green in the spec's own figure, not their layer's pink.
292
+ ['plateau', 'implementation', 'other', '🏔️', 'stack', '#E0FFE0', 'A relatively stable state of the architecture that exists during a limited period of time.'],
293
+ ['gap', 'implementation', 'other', '⚠️', 'gap-circle', '#E0FFE0', 'A statement of difference between two plateaus, typically between baseline and target architecture.'],
294
+ // Composite / Other
295
+ ['location', 'composite', 'other', '📍', 'pin', undefined, 'A conceptual or physical place where elements are situated or where behavior takes place.'],
296
+ ['grouping', 'composite', 'other', '🗂️', 'grouping-box', '#FFFFFF', 'A generic way to group any set of elements that belong together for analysis or presentation.'],
297
+ ['junction', 'composite', 'other', '🔀', 'junction', undefined, 'A point at which relationships can be split or joined; used to connect multiple elements in a single flow.'],
298
+ ];
299
+ for (const [name, layerKey, aspect, icon, notationShape, ownColor, description] of ELEMENT_TYPE_ROWS) {
300
+ ELEMENT_TYPES_V3_2.set(name, new ArchimateElementType(name, LAYERS[layerKey], aspect, icon, notationShape, ownColor, description));
301
+ }
302
+
303
+ /** The 15 layer-specific ArchiMate 3.2 behavior types that ArchiMate 4
304
+ * consolidates into 5 layer-independent "Common Domain" ones — exactly the
305
+ * jArchi migration script's own `behaviorMapping` table (same keys/shape:
306
+ * `newType` + `originalLayer`, the value `migrateElementToV4` tags a
307
+ * migrated element's `ArchiMate4_Domain` property with). */
308
+ const V4_BEHAVIOR_MIGRATION = {
309
+ 'business-process': { newType: 'process', originalLayer: 'Business' },
310
+ 'application-process': { newType: 'process', originalLayer: 'Application' },
311
+ 'technology-process': { newType: 'process', originalLayer: 'Technology' },
312
+ 'business-function': { newType: 'function', originalLayer: 'Business' },
313
+ 'application-function': { newType: 'function', originalLayer: 'Application' },
314
+ 'technology-function': { newType: 'function', originalLayer: 'Technology' },
315
+ 'business-service': { newType: 'service', originalLayer: 'Business' },
316
+ 'application-service': { newType: 'service', originalLayer: 'Application' },
317
+ 'technology-service': { newType: 'service', originalLayer: 'Technology' },
318
+ 'business-interaction': { newType: 'interaction', originalLayer: 'Business' },
319
+ 'application-interaction': { newType: 'interaction', originalLayer: 'Application' },
320
+ 'technology-interaction': { newType: 'interaction', originalLayer: 'Technology' },
321
+ 'business-event': { newType: 'event', originalLayer: 'Business' },
322
+ 'application-event': { newType: 'event', originalLayer: 'Application' },
323
+ 'technology-event': { newType: 'event', originalLayer: 'Technology' },
324
+ };
325
+
326
+ /** The 4 ArchiMate 3.2 types ArchiMate 4 retires outright, each replaced by
327
+ * an existing type — exactly the jArchi migration script's own
328
+ * `legacyMapping` table (same keys/shape: `newType` + the `tag`/`value`
329
+ * property pair `migrateElementToV4` tags a migrated element with, e.g.
330
+ * `LegacyType: 'Contract'`). */
331
+ const V4_LEGACY_MIGRATION = {
332
+ contract: { newType: 'business-object', tag: 'LegacyType', value: 'Contract' },
333
+ representation: { newType: 'business-object', tag: 'LegacyType', value: 'Representation' },
334
+ constraint: { newType: 'requirement', tag: 'Type', value: 'Constraint' },
335
+ gap: { newType: 'work-package', tag: 'LegacyType', value: 'Gap' },
336
+ };
337
+
338
+ /** name, aspect, icon, notationShape — the 5 ArchiMate 4 "Common Domain"
339
+ * behavior types V4_BEHAVIOR_MIGRATION's 15 v3.2 types consolidate into.
340
+ * `layer` is `null` for all five (see ArchimateElementType's own doc
341
+ * comment) — icon/notationShape echo their v3.2 counterparts' own (the
342
+ * spec's notation for process/function/service/interaction/event is
343
+ * unchanged in v4, only which layers can use them changed). */
344
+ const V4_COMMON_DOMAIN_ROWS = [
345
+ ['process', 'behavior', '▶️', 'arrow'],
346
+ ['function', 'behavior', '🔧', 'chevron'],
347
+ ['service', 'behavior', '🛎️', 'pill'],
348
+ ['interaction', 'behavior', '🔄', 'half-circle'],
349
+ ['event', 'behavior', '⚡', 'flag'],
350
+ ];
351
+
352
+ /** The ArchiMate 4 element catalog — every ELEMENT_TYPES_V3_2 entry NOT
353
+ * retired/consolidated away (same ArchimateElementType objects — a type
354
+ * unaffected by the migration, e.g. business-actor, is identical in both
355
+ * versions, not a copy that could drift), plus the 5 Common Domain types
356
+ * above. Retired names (contract, business-process, ...) are deliberately
357
+ * ABSENT here, not aliased to their replacement — a v4 catalog lookup for
358
+ * one really shouldn't resolve to anything; migrateElementToV4 is the
359
+ * place that actually converts an element's `type` away from one, always
360
+ * run (for `archimateVersion: '4'`, the default) before any catalog
361
+ * lookup happens. */
362
+ const ELEMENT_TYPES_V4 = new Map();
363
+ for (const [name, type] of ELEMENT_TYPES_V3_2) {
364
+ if (V4_BEHAVIOR_MIGRATION[name] || V4_LEGACY_MIGRATION[name]) continue;
365
+ ELEMENT_TYPES_V4.set(name, type);
366
+ }
367
+ for (const [name, aspect, icon, notationShape] of V4_COMMON_DOMAIN_ROWS) {
368
+ ELEMENT_TYPES_V4.set(name, new ArchimateElementType(name, null, aspect, icon, notationShape));
369
+ }
370
+
371
+ const ELEMENT_TYPES_BY_VERSION = { '3.2': ELEMENT_TYPES_V3_2, '4': ELEMENT_TYPES_V4 };
372
+ function elementTypesFor(version) { return ELEMENT_TYPES_BY_VERSION[version] || ELEMENT_TYPES_V4; }
373
+
374
+ const RELATIONSHIP_TYPES = new Map();
375
+ /** name, lineStyle, arrowhead, arrowheadStart — the 11 official ArchiMate
376
+ * relationship notations (see the class doc comment for where these were
377
+ * checked). */
378
+ const RELATIONSHIP_TYPE_ROWS = [
379
+ ['composition', 'solid', 'none', 'diamond', 'A whole consists of parts; a part belongs to only one whole and shares its lifecycle.'],
380
+ ['aggregation', 'solid', 'none', 'diamond-hollow', 'A whole consists of parts; parts may belong to multiple wholes and have independent lifecycles.'],
381
+ ['assignment', 'solid', 'arrow', 'circle', 'Behavior or structure is assigned to an active-structure element (e.g., a role or component).'],
382
+ ['realization', 'dotted', 'triangle-hollow', undefined, 'A logical element is realized by a more concrete element.'],
383
+ ['specialization', 'solid', 'triangle-hollow', undefined, 'A specialized element is a specific kind of a more general element.'],
384
+ ['serving', 'solid', 'open-arrow', undefined, 'An element provides its behavior, value, or functionality to another element.'],
385
+ ['access', 'dotted', 'open-arrow', undefined, 'A behavior element reads or writes a passive-structure element.'],
386
+ ['influence', 'dashed', 'open-arrow', undefined, 'One element affects another, often used for drivers, goals, and outcomes.'],
387
+ ['triggering', 'solid', 'arrow', undefined, 'One element causes another element to start or happen.'],
388
+ ['flow', 'dashed', 'arrow', undefined, 'Something (information, value, or material) passes from one element to another.'],
389
+ ['association', 'solid', 'none', undefined, 'A generic, undirected link with no specific ArchiMate semantics.'],
390
+ // The spec's relationships figure shows association twice — plain
391
+ // (undirected, above) and with a single-barb arrow for the directed form.
392
+ ['association-directed', 'solid', 'open-arrow-half', undefined, 'A generic directed link with no specific ArchiMate semantics.'],
393
+ ];
394
+ for (const [name, lineStyle, arrowhead, arrowheadStart, description] of RELATIONSHIP_TYPE_ROWS) {
395
+ RELATIONSHIP_TYPES.set(name, new ArchimateRelationshipType(name, lineStyle, arrowhead, arrowheadStart, description));
396
+ }
397
+
398
+ /**
399
+ * Converts one ArchiMate 3.2-style `element` to its ArchiMate 4 equivalent —
400
+ * exactly the two mapping tables (V4_BEHAVIOR_MIGRATION/V4_LEGACY_MIGRATION)
401
+ * above, themselves a direct copy of a jArchi "Migrate Model Elements from
402
+ * ArchiMate 3.2 to ArchiMate 4" script's own `behaviorMapping`/
403
+ * `legacyMapping` objects. A layer-specific behavior type (business-process,
404
+ * application-function, ...) becomes its Common Domain equivalent (process,
405
+ * function, ...), tagged `ArchiMate4_Domain` with the original layer name
406
+ * (`'Business'`/`'Application'`/`'Technology'`) and `MigratedFrom` with the
407
+ * original type — plus, unlike the jArchi script (which relies on Archi's
408
+ * own model tree to still know an element's real layer after its type
409
+ * changes), an explicit `layer` field IS set here too, UNLESS the element
410
+ * already had its own (respecting that override) — needed because
411
+ * RenderEngine has no such tree; a Common Domain type's `ArchimateElementType
412
+ * #layer` is `null` (see the module's own doc comment), so without this the
413
+ * migrated element's layer/colour would silently fall through to 'other'. A
414
+ * retired type (contract, representation, constraint, gap) becomes its
415
+ * replacement type instead, tagged with what it used to be (`LegacyType`/
416
+ * `Type` + `MigratedFrom`, matching the jArchi script's own tag choice per
417
+ * type). Returns `element` UNCHANGED (same reference, no clone at all) for
418
+ * any other type — most v3.2 types (business-actor, application-component,
419
+ * goal, node, ...) are identical in v4 and need no migration.
420
+ * @param {object} element
421
+ * @returns {object}
422
+ */
423
+ export function migrateElementToV4(element) {
424
+ const type = element?.type;
425
+ if (typeof type !== 'string') return element;
426
+
427
+ const behaviorRule = V4_BEHAVIOR_MIGRATION[type];
428
+ if (behaviorRule) {
429
+ return {
430
+ ...element,
431
+ type: behaviorRule.newType,
432
+ layer: element.layer || behaviorRule.originalLayer.toLowerCase(),
433
+ ArchiMate4_Domain: behaviorRule.originalLayer,
434
+ MigratedFrom: type,
435
+ };
436
+ }
437
+ const legacyRule = V4_LEGACY_MIGRATION[type];
438
+ if (legacyRule) {
439
+ return { ...element, type: legacyRule.newType, [legacyRule.tag]: legacyRule.value, MigratedFrom: type };
440
+ }
441
+ return element;
442
+ }
443
+
444
+ /** V4_BEHAVIOR_MIGRATION backwards: 'process:business' -> 'business-process'. */
445
+ const V32_BEHAVIOR_TYPE = Object.fromEntries(Object.entries(V4_BEHAVIOR_MIGRATION)
446
+ .map(([oldType, { newType, originalLayer }]) => [`${newType}:${originalLayer.toLowerCase()}`, oldType]));
447
+
448
+ /**
449
+ * The ArchiMate 3.2 type an element is, for tools that know only 3.2 (Archi).
450
+ * A 3.2 type is itself; an element migrated by migrateElementToV4 goes back to
451
+ * what it was (`MigratedFrom`); an ArchiMate 4 Common Domain type takes its
452
+ * layer's 3.2 type (a business `process` is a `business-process`, an
453
+ * implementation `event` an `implementation-event`), business when it has no
454
+ * layer. Any other type (a custom one) is returned as it is.
455
+ * @param {object} element
456
+ * @returns {string}
457
+ */
458
+ export function archimate32Type(element) {
459
+ const type = element?.type;
460
+ if (typeof type !== 'string') return type;
461
+ if (ELEMENT_TYPES_V3_2.has(element.MigratedFrom)) return element.MigratedFrom;
462
+ if (ELEMENT_TYPES_V3_2.has(type)) return type;
463
+ const layer = String(element.layer || element.ArchiMate4_Domain || 'business').toLowerCase();
464
+ if (type === 'event' && layer === 'implementation') return 'implementation-event';
465
+ return V32_BEHAVIOR_TYPE[`${type}:${layer}`] ?? V32_BEHAVIOR_TYPE[`${type}:business`] ?? type;
466
+ }
467
+
468
+ /** The registry: every lookup archimateDiagram (and a caller building its
469
+ * own ArchiMate authoring UI — see the Properties dialog / Add Element
470
+ * dialog in test/charts.html) needs, all reading from the same underlying
471
+ * ArchimateLayer/ArchimateElementType/ArchimateRelationshipType objects
472
+ * above rather than parallel maps. Every element-type lookup below takes an
473
+ * optional `version` (`'3.2'|'4'`, default `'4'`, see `versions()`) — an
474
+ * unrecognised version falls back to `'4'` the same forgiving way an
475
+ * unrecognised relationship kind falls back to plain 'association'.
476
+ * Relationship notation and layers themselves are unchanged between
477
+ * versions, so those lookups take no `version` at all. */
478
+ export const ArchimateNotation = {
479
+ /** The two ArchiMate versions this registry knows — `'3.2'` and `4` (the
480
+ * DEFAULT everywhere a `version` parameter is optional). */
481
+ versions() { return ['3.2', '4']; },
482
+
483
+ /** Every distinct ArchimateLayer (alias spellings collapsed — 'infrastructure'
484
+ * and 'technology' are the same object, so this lists it once). */
485
+ layers() { return [...new Set(Object.values(LAYERS))]; },
486
+ /** An ArchimateLayer by name (including alias spellings), or undefined. */
487
+ layer(name) { return LAYERS[name]; },
488
+
489
+ /** Every ArchimateElementType for `version` (default `4`), in catalog order. */
490
+ elementTypes(version = '4') { return [...elementTypesFor(version).values()]; },
491
+ /** Just the names, e.g. for a <datalist>. */
492
+ elementTypeNames(version = '4') { return [...elementTypesFor(version).keys()]; },
493
+ /** An ArchimateElementType by its official name for `version`, or
494
+ * undefined for a custom/unofficial type string, or a type retired in
495
+ * that version (e.g. `elementType('contract', 4)` — see
496
+ * migrateElementToV4, the place a retired name actually gets converted
497
+ * away, before any catalog lookup). */
498
+ elementType(name, version = '4') { return elementTypesFor(version).get(name); },
499
+ /** Icon alternatives for `typeName` at `version` — a recognised official
500
+ * type's own ArchimateElementType#iconChoices (choice 0 the
501
+ * ArchiMate-standard default), or GENERIC_ICON_CHOICES for anything
502
+ * else (a custom type, or none at all) — what a UI's icon picker offers
503
+ * (e.g. the Properties dialog in test/charts.html), not automatic
504
+ * resolution (RenderEngine._archimateDefaultIcon), which always means
505
+ * choice 0 unless a diagram's own `options.iconChoiceIndex` says
506
+ * otherwise. */
507
+ iconChoices(typeName, version = '4') {
508
+ const type = elementTypesFor(version).get(typeName);
509
+ return type ? type.iconChoices : GENERIC_ICON_CHOICES;
510
+ },
511
+ /** Every ArchimateElementType belonging to `layerName` at `version` — the
512
+ * query a "type" dropdown that must narrow to match a chosen "layer"
513
+ * needs; reads the SAME `type.layer` relationship elementLayer() below
514
+ * derives from, so the two can never disagree. A Common Domain type
515
+ * (ArchiMate 4's process/function/service/interaction/event — `layer`
516
+ * is `null`) never matches any layer here, since it doesn't belong to
517
+ * one at the TYPE level at all — only a specific element instance does
518
+ * (via its own `layer` field). */
519
+ typesInLayer(layerName, version = '4') {
520
+ const layer = LAYERS[layerName];
521
+ return layer ? [...elementTypesFor(version).values()].filter(t => t.layer === layer) : [];
522
+ },
523
+
524
+ /** Every ArchimateRelationshipType. */
525
+ relationshipTypes() { return [...RELATIONSHIP_TYPES.values()]; },
526
+ /** Just the names. */
527
+ relationshipTypeNames() { return [...RELATIONSHIP_TYPES.keys()]; },
528
+ /** A relationship type by name — an unrecognised/missing `name` returns
529
+ * the plain 'association' notation rather than undefined, since every
530
+ * call site wants SOME notation to fall back to, not a null check. */
531
+ relationshipType(name) { return RELATIONSHIP_TYPES.get(name) || RELATIONSHIP_TYPES.get('association'); },
532
+
533
+ /** Human-readable description for an element `typeName` at `version`, or
534
+ * undefined for an unrecognised/retired type. */
535
+ describe(typeName, version = '4') {
536
+ const type = elementTypesFor(version).get(typeName);
537
+ return type?.description;
538
+ },
539
+ /** Human-readable description for a relationship `name`, or undefined for
540
+ * an unrecognised kind. */
541
+ describeRelationship(name) {
542
+ const rel = RELATIONSHIP_TYPES.get(name);
543
+ return rel?.description;
544
+ },
545
+
546
+ /** Which layer `element` belongs to at `version`, as a plain layer-name
547
+ * string (element.layer/type may reference a layer this registry has
548
+ * never heard of — a caller's own custom layer name is still valid
549
+ * input everywhere else in archimateDiagram, so this returns a string,
550
+ * not an ArchimateLayer, and never throws for an unknown one).
551
+ * Precedence: an explicit `element.layer` always wins (the ONLY source
552
+ * of truth for a Common Domain type, whose own layer is `null` — see
553
+ * the module's own doc comment); then `element.type` matched against
554
+ * `version`'s own catalog (ElementType#layer — most official names,
555
+ * e.g. 'goal'/'node'/'resource', do NOT start with their own layer's
556
+ * name, so the next rule alone would get them wrong); then the prefix
557
+ * of `type` before its first '-' (so a custom `type:'business-my-
558
+ * widget'` still implies 'business' with zero extra config, and a v4
559
+ * Common Domain element with neither `layer` nor a recognised type
560
+ * falls through here too, e.g. `type:'process'` has no '-' at all ->
561
+ * 'other'); neither present -> 'other'. */
562
+ elementLayer(element, version = '4') {
563
+ if (element?.layer) return element.layer;
564
+ const type = element?.type;
565
+ if (typeof type !== 'string') return 'other';
566
+ const known = elementTypesFor(version).get(type);
567
+ if (known?.layer) return known.layer.name;
568
+ const dash = type.indexOf('-');
569
+ return dash > 0 ? type.slice(0, dash) : 'other';
570
+ },
571
+
572
+
573
+ migrateElementToV4,
574
+ archimate32Type,
575
+ };
576
+
577
+
578
+ /**
579
+ * ArchiMate viewpoints — a catalog of standard viewpoints, and a user's own
580
+ * after them (`custom`, kept by CustomViewpoints). Each lists the element type
581
+ * names it allows, or a layer/aspect filter.
582
+ */
583
+ export const ARCHIMATE_STANDARD_VIEWPOINTS = [
584
+ {
585
+ name: 'All',
586
+ description: 'No restriction; every element type is allowed.',
587
+ allowedTypes: null,
588
+ },
589
+ {
590
+ name: 'Organization',
591
+ description: 'Structure of the enterprise: actors, roles, collaborations, interfaces and locations.',
592
+ allowedTypes: ['business-actor', 'business-role', 'business-collaboration', 'business-interface', 'location'],
593
+ },
594
+ {
595
+ name: 'Business Process Cooperation',
596
+ description: 'Business processes, functions, services and events, plus the actors/roles/objects they relate to.',
597
+ allowedTypes: ['business-actor', 'business-role', 'business-collaboration', 'business-interface',
598
+ 'business-process', 'business-function', 'business-interaction', 'business-event', 'business-service',
599
+ 'business-object', 'contract', 'representation', 'product', 'location'],
600
+ },
601
+ {
602
+ name: 'Product',
603
+ description: 'Products, services, contracts and the business objects they operate on.',
604
+ allowedTypes: ['business-service', 'business-process', 'business-function', 'business-event',
605
+ 'business-object', 'contract', 'representation', 'product', 'application-service', 'application-component'],
606
+ },
607
+ {
608
+ name: 'Application Cooperation',
609
+ description: 'Application components, collaborations, interfaces, functions, processes and services.',
610
+ allowedTypes: ['application-component', 'application-collaboration', 'application-interface',
611
+ 'application-function', 'application-process', 'application-interaction', 'application-event',
612
+ 'application-service', 'data-object'],
613
+ },
614
+ {
615
+ name: 'Application Usage',
616
+ description: 'How applications support business behavior.',
617
+ allowedTypes: ['business-process', 'business-function', 'business-interaction', 'business-event',
618
+ 'business-service', 'business-object', 'application-component', 'application-collaboration',
619
+ 'application-interface', 'application-function', 'application-process', 'application-interaction',
620
+ 'application-event', 'application-service', 'data-object'],
621
+ },
622
+ {
623
+ name: 'Technology',
624
+ description: 'Technology and infrastructure elements, including physical equipment.',
625
+ allowedTypes: ['node', 'device', 'system-software', 'technology-collaboration', 'technology-interface',
626
+ 'communication-network', 'path', 'technology-function', 'technology-process', 'technology-interaction',
627
+ 'technology-event', 'technology-service', 'technology-object', 'artifact', 'equipment', 'facility',
628
+ 'distribution-network', 'material'],
629
+ },
630
+ {
631
+ name: 'Motivation',
632
+ description: 'Stakeholders, drivers, assessments, goals, outcomes, principles, requirements and constraints.',
633
+ allowedTypes: ['stakeholder', 'driver', 'assessment', 'goal', 'outcome', 'principle', 'requirement',
634
+ 'constraint', 'meaning', 'value', 'risk'],
635
+ },
636
+ {
637
+ name: 'Strategy',
638
+ description: 'Capabilities, resources, value streams and courses of action.',
639
+ allowedTypes: ['resource', 'capability', 'course-of-action', 'value-stream'],
640
+ },
641
+ {
642
+ name: 'Implementation & Migration',
643
+ description: 'Work packages, deliverables, plateaus and gaps.',
644
+ allowedTypes: ['work-package', 'deliverable', 'plateau', 'gap'],
645
+ },
646
+ ];
647
+
648
+ export class ArchimateViewpoints {
649
+ static get standard() { return ARCHIMATE_STANDARD_VIEWPOINTS; }
650
+
651
+ static all(custom = []) {
652
+ return [...ARCHIMATE_STANDARD_VIEWPOINTS, ...custom];
653
+ }
654
+
655
+ static names(custom = []) {
656
+ return this.all(custom).map(v => v.name);
657
+ }
658
+
659
+ static byName(name, custom = []) {
660
+ return this.all(custom).find(v => v.name === name) || ARCHIMATE_STANDARD_VIEWPOINTS[0];
661
+ }
662
+
663
+ /**
664
+ * Element type names allowed by `viewpoint` at `version`.
665
+ * @param {object|string} viewpoint — viewpoint object or name
666
+ * @param {string} version — '3.2' or '4'
667
+ * @param {object[]} custom — additional custom viewpoints
668
+ * @returns {string[]}
669
+ */
670
+ static allowedElementTypes(viewpoint, version = '4', custom = []) {
671
+ const vp = typeof viewpoint === 'string' ? this.byName(viewpoint, custom) : viewpoint;
672
+ if (!vp || vp.name === 'All') return ArchimateNotation.elementTypeNames(version);
673
+ if (vp.allowedTypes) {
674
+ // Only return types that actually exist in this version's catalog.
675
+ const valid = new Set(ArchimateNotation.elementTypeNames(version));
676
+ return vp.allowedTypes.filter(t => valid.has(t));
677
+ }
678
+ return ArchimateNotation.elementTypes(version)
679
+ .filter(t => this._typeMatchesViewpoint(t, vp))
680
+ .map(t => t.name);
681
+ }
682
+
683
+ static _typeMatchesViewpoint(type, viewpoint) {
684
+ if (viewpoint.aspects && !viewpoint.aspects.includes(type.aspect)) return false;
685
+ if (viewpoint.layers) {
686
+ return viewpoint.layers.includes(type.layer?.name);
687
+ }
688
+ if (viewpoint.layer) {
689
+ return type.layer?.name === viewpoint.layer;
690
+ }
691
+ return true;
692
+ }
693
+
694
+
695
+ /**
696
+ * Returns true if `typeName` is allowed by `viewpoint` at `version`.
697
+ */
698
+ static isAllowed(typeName, viewpoint, version = '4', custom = []) {
699
+ const allowed = this.allowedElementTypes(viewpoint, version, custom);
700
+ return allowed.includes(typeName);
701
+ }
702
+
703
+ /**
704
+ * Validate a single element against a viewpoint. Returns a warning string
705
+ * if the element is not allowed, or undefined.
706
+ */
707
+ static validateElement(element, viewpoint, version = '4', custom = []) {
708
+ const vp = typeof viewpoint === 'string' ? this.byName(viewpoint, custom) : viewpoint;
709
+ if (!vp || vp.name === 'All') return undefined;
710
+ const typeName = element?.type;
711
+ if (typeof typeName !== 'string') return undefined;
712
+ const allowed = this.allowedElementTypes(vp, version, custom);
713
+ if (allowed.includes(typeName)) return undefined;
714
+ return `Type "${typeName}" is not allowed in the "${vp.name}" viewpoint.`;
715
+ }
716
+
717
+ /**
718
+ * Build a custom viewpoint object from a layer/aspect filter.
719
+ */
720
+ static custom({ name = 'Custom', description = '', layer = null, aspects = null, layers = null, allowedTypes = null } = {}) {
721
+ return { name, description, layer, aspects, layers, allowedTypes };
722
+ }
723
+ }