@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.
- package/LICENSE +21 -0
- package/README.md +203 -2
- package/REFERENCE.md +2198 -0
- package/dist/renderengine-workspace.umd.js +46905 -0
- package/dist/renderengine.umd.js +42223 -0
- package/examples/archimate.html +66 -0
- package/examples/diagram-editor.html +51 -0
- package/package.json +65 -4
- package/src/BaseRenderer.js +57 -0
- package/src/CanvasRenderer.js +194 -0
- package/src/Mat4.js +111 -0
- package/src/OrbitCamera.js +57 -0
- package/src/RendererFactory.js +50 -0
- package/src/SVGRenderer.js +439 -0
- package/src/archimate.js +723 -0
- package/src/archimateArchiFormat.js +1693 -0
- package/src/archimateArchiTypes.js +72 -0
- package/src/archimateArchive.js +140 -0
- package/src/archimateCSV.js +127 -0
- package/src/archimateDrawio.js +182 -0
- package/src/archimateExchangeFormat.js +546 -0
- package/src/archimateRelationshipTable.js +93 -0
- package/src/archimateSpecializations.js +161 -0
- package/src/chartCatalog.js +589 -0
- package/src/charting/ArchimateDiagramEditor.js +1624 -0
- package/src/charting/ArchimateSpecializationSelector.js +134 -0
- package/src/charting/Axis.js +68 -0
- package/src/charting/CameraSeeder.js +30 -0
- package/src/charting/CatalogDialog.js +92 -0
- package/src/charting/Chart.js +37 -0
- package/src/charting/Chart3D.js +99 -0
- package/src/charting/ChartBox.js +80 -0
- package/src/charting/ChartData.js +27 -0
- package/src/charting/ChartRegistry.js +76 -0
- package/src/charting/CheckboxTreeSelector.js +304 -0
- package/src/charting/ColorField.js +107 -0
- package/src/charting/ColorPalette.js +88 -0
- package/src/charting/CommandHistory.js +176 -0
- package/src/charting/DataFilter.js +52 -0
- package/src/charting/Diagram.js +36 -0
- package/src/charting/Diagram3D.js +29 -0
- package/src/charting/DiagramClipboard.js +31 -0
- package/src/charting/DiagramEditor.js +3330 -0
- package/src/charting/DiagramEditorCommand.js +110 -0
- package/src/charting/DiagramEditorCommands.js +237 -0
- package/src/charting/DiagramEditorEdgeCommands.js +142 -0
- package/src/charting/DiagramEditorState.js +98 -0
- package/src/charting/DiagramRegistry.js +86 -0
- package/src/charting/DiagramTypeRegistry.js +326 -0
- package/src/charting/DiagramViewPropertiesDialog.js +46 -0
- package/src/charting/Edge.js +113 -0
- package/src/charting/ErrorBars.js +37 -0
- package/src/charting/FilterSystem.js +285 -0
- package/src/charting/FindReplaceDialog.js +139 -0
- package/src/charting/FormDialog.js +385 -0
- package/src/charting/Gauge.js +58 -0
- package/src/charting/Hierarchy.js +175 -0
- package/src/charting/HintPanel.js +86 -0
- package/src/charting/ImageSelector.js +148 -0
- package/src/charting/InteractionManager.js +725 -0
- package/src/charting/Legend.js +58 -0
- package/src/charting/MenuBar.js +62 -0
- package/src/charting/ModelFileFormat.js +115 -0
- package/src/charting/OrbitControls.js +77 -0
- package/src/charting/Palette.js +119 -0
- package/src/charting/PopupMenu.js +117 -0
- package/src/charting/PropertiesPanel.js +155 -0
- package/src/charting/PropertyListEditor.js +96 -0
- package/src/charting/PropertyLog.js +92 -0
- package/src/charting/SettingsCascade.js +93 -0
- package/src/charting/SettingsDialog.js +53 -0
- package/src/charting/SettingsManager.js +179 -0
- package/src/charting/SettingsViewPropertiesDialog.js +58 -0
- package/src/charting/ShapePaths.js +27 -0
- package/src/charting/Statistics.js +134 -0
- package/src/charting/TemplateCatalog.js +59 -0
- package/src/charting/TemplateLibrary.js +103 -0
- package/src/charting/TextStyle.js +168 -0
- package/src/charting/ViewFit.js +55 -0
- package/src/charting/ViewMenu.js +70 -0
- package/src/charting/ViewPropertiesDialog.js +77 -0
- package/src/charting/ViewTabStrip.js +81 -0
- package/src/charting/archimate/ArchiFileFormat.js +32 -0
- package/src/charting/archimate/ArchimateCanvasEditor.js +815 -0
- package/src/charting/archimate/ArchimateCsvFileFormat.js +35 -0
- package/src/charting/archimate/ArchimateEdge.js +137 -0
- package/src/charting/archimate/ArchimateElementTemplate.js +195 -0
- package/src/charting/archimate/ArchimatePalette.js +102 -0
- package/src/charting/archimate/CsvImportDialog.js +105 -0
- package/src/charting/archimate/CustomViewpoints.js +74 -0
- package/src/charting/archimate/DerivedEdge.js +29 -0
- package/src/charting/archimate/DrawioFileFormat.js +24 -0
- package/src/charting/archimate/ElementFilterRule.js +21 -0
- package/src/charting/archimate/ExchangeFileFormat.js +28 -0
- package/src/charting/archimate/ViewGroupTemplate.js +137 -0
- package/src/charting/archimate/ViewLineEdge.js +84 -0
- package/src/charting/archimate/ViewpointRule.js +45 -0
- package/src/charting/archimate/archimateFileFormats.js +12 -0
- package/src/charting/archimate/archimateNames.js +5 -0
- package/src/charting/archimate/csvMapping.js +122 -0
- package/src/charting/archimate/elementMenuItems.js +32 -0
- package/src/charting/archimate/elementProperties.js +146 -0
- package/src/charting/archimate/elementTypeChoices.js +7 -0
- package/src/charting/archimate/elementTypeGroups.js +19 -0
- package/src/charting/archimate/index.js +17 -0
- package/src/charting/archimate/specializationCatalogDialog.js +64 -0
- package/src/charting/archimate/typeGlyph.js +29 -0
- package/src/charting/arrangement/Arrangement.js +112 -0
- package/src/charting/arrangement/ArrangementCommand.js +29 -0
- package/src/charting/arrangement/BackgroundCommand.js +41 -0
- package/src/charting/arrangement/BackgroundGroup.js +18 -0
- package/src/charting/arrangement/GroupCommand.js +46 -0
- package/src/charting/arrangement/ItemGroup.js +62 -0
- package/src/charting/arrangement/LockCommand.js +32 -0
- package/src/charting/arrangement/UngroupCommand.js +27 -0
- package/src/charting/arrangement/alignment.js +88 -0
- package/src/charting/arrangement/arrangeMenuItems.js +25 -0
- package/src/charting/arrangement/index.js +11 -0
- package/src/charting/arrangement/layouts.js +233 -0
- package/src/charting/canvas/ArchiHint.js +78 -0
- package/src/charting/canvas/CanvasBoxKind.js +39 -0
- package/src/charting/canvas/CanvasPalette.js +49 -0
- package/src/charting/canvas/CanvasTemplateLibrary.js +61 -0
- package/src/charting/canvas/CanvasTemplateMenu.js +151 -0
- package/src/charting/canvas/EditHintCommand.js +28 -0
- package/src/charting/canvas/canvasBoxKinds.js +27 -0
- package/src/charting/canvas/canvasBoxMenuItems.js +40 -0
- package/src/charting/canvas/defaultCanvasTemplates.js +186 -0
- package/src/charting/canvas/diagramBoxKinds.js +12 -0
- package/src/charting/canvas/hintMenuItems.js +49 -0
- package/src/charting/charts/ArcGauge.js +55 -0
- package/src/charting/charts/AreaChart.js +71 -0
- package/src/charting/charts/BarChart.js +80 -0
- package/src/charting/charts/BarChart3D.js +56 -0
- package/src/charting/charts/BarChart3DOrbit.js +53 -0
- package/src/charting/charts/BarChartBase.js +70 -0
- package/src/charting/charts/BarGauge.js +42 -0
- package/src/charting/charts/BoxPlotChart.js +41 -0
- package/src/charting/charts/BubbleChart.js +99 -0
- package/src/charting/charts/BubbleChart3D.js +78 -0
- package/src/charting/charts/BulletGauge.js +87 -0
- package/src/charting/charts/CalendarHeatmapChart.js +204 -0
- package/src/charting/charts/CandlestickChart.js +54 -0
- package/src/charting/charts/ChordDiagram.js +130 -0
- package/src/charting/charts/DensityChart.js +73 -0
- package/src/charting/charts/DialGauge.js +65 -0
- package/src/charting/charts/DonutChart.js +15 -0
- package/src/charting/charts/FunnelChart.js +47 -0
- package/src/charting/charts/GanttChart.js +201 -0
- package/src/charting/charts/GaugeChart.js +175 -0
- package/src/charting/charts/GeoMapChart.js +146 -0
- package/src/charting/charts/GroupedBarChart.js +88 -0
- package/src/charting/charts/GroupedDistributionChart.js +70 -0
- package/src/charting/charts/HeatmapChart.js +80 -0
- package/src/charting/charts/HierarchyChart.js +39 -0
- package/src/charting/charts/HistogramChart.js +45 -0
- package/src/charting/charts/KpiTile.js +72 -0
- package/src/charting/charts/LagPlotChart.js +41 -0
- package/src/charting/charts/LineChart.js +124 -0
- package/src/charting/charts/MultiRingGauge.js +54 -0
- package/src/charting/charts/OutlineChart.js +95 -0
- package/src/charting/charts/ParallelCoordinatesChart.js +130 -0
- package/src/charting/charts/PieChart.js +56 -0
- package/src/charting/charts/PipeChart.js +88 -0
- package/src/charting/charts/PopulationPyramidChart.js +106 -0
- package/src/charting/charts/QQPlotChart.js +64 -0
- package/src/charting/charts/RadarChart.js +76 -0
- package/src/charting/charts/RadialBarChart.js +96 -0
- package/src/charting/charts/RingGauge.js +23 -0
- package/src/charting/charts/SankeyDiagram.js +174 -0
- package/src/charting/charts/ScatterChart.js +104 -0
- package/src/charting/charts/StackedAreaChart.js +15 -0
- package/src/charting/charts/StackedBarChart.js +33 -0
- package/src/charting/charts/StackedBarChart3DOrbit.js +58 -0
- package/src/charting/charts/StreamGraphChart.js +131 -0
- package/src/charting/charts/SunburstChart.js +57 -0
- package/src/charting/charts/ThermometerGauge.js +43 -0
- package/src/charting/charts/TreemapChart.js +54 -0
- package/src/charting/charts/ViolinChart.js +37 -0
- package/src/charting/charts/WaterfallChart.js +66 -0
- package/src/charting/charts/WordCloudChart.js +104 -0
- package/src/charting/diagramModel/AddViewCommand.js +33 -0
- package/src/charting/diagramModel/DiagramModel.js +39 -0
- package/src/charting/diagramModel/DiagramModelSearch.js +22 -0
- package/src/charting/diagramModel/DiagramView.js +50 -0
- package/src/charting/diagramModel/ModelHistory.js +43 -0
- package/src/charting/diagramModel/ModelReport.js +153 -0
- package/src/charting/diagramModel/ModelSearch.js +223 -0
- package/src/charting/diagramModel/RemoveViewCommand.js +25 -0
- package/src/charting/diagramModel/RenameViewCommand.js +21 -0
- package/src/charting/diagramModel/ReplaceTextCommand.js +25 -0
- package/src/charting/diagramModel/ViewSetChecker.js +34 -0
- package/src/charting/diagramModel/ViewSetModel.js +243 -0
- package/src/charting/diagramModel/index.js +6 -0
- package/src/charting/diagramModel/nameTransforms.js +29 -0
- package/src/charting/diagrams/ArchimateCommands.js +141 -0
- package/src/charting/diagrams/ArchimateDiagram.js +263 -0
- package/src/charting/diagrams/ArchimateModel.js +1155 -0
- package/src/charting/diagrams/ArchimateModelChecker.js +125 -0
- package/src/charting/diagrams/ArchimateModelReport.js +128 -0
- package/src/charting/diagrams/ArchimateModelSearch.js +41 -0
- package/src/charting/diagrams/ArchimateValidator.js +357 -0
- package/src/charting/diagrams/CanvasView.js +112 -0
- package/src/charting/diagrams/ContextMenu.js +37 -0
- package/src/charting/diagrams/DataModelDiagram.js +86 -0
- package/src/charting/diagrams/DataModelRelationshipStrategy.js +38 -0
- package/src/charting/diagrams/DerivedRelationships.js +102 -0
- package/src/charting/diagrams/EbnfDiagram.js +39 -0
- package/src/charting/diagrams/EdgeGeometry.js +553 -0
- package/src/charting/diagrams/EditViewItemCommand.js +128 -0
- package/src/charting/diagrams/ElementInstance.js +157 -0
- package/src/charting/diagrams/GraphDiagram.js +1340 -0
- package/src/charting/diagrams/GraphDiagram3D.js +152 -0
- package/src/charting/diagrams/GraphMetrics.js +81 -0
- package/src/charting/diagrams/GridOverlay.js +137 -0
- package/src/charting/diagrams/ImportRowsCommand.js +62 -0
- package/src/charting/diagrams/LabelHelper.js +108 -0
- package/src/charting/diagrams/MergeElementsCommand.js +101 -0
- package/src/charting/diagrams/NestInstanceCommand.js +34 -0
- package/src/charting/diagrams/NodeGeometry.js +158 -0
- package/src/charting/diagrams/PlaceItemsCommand.js +77 -0
- package/src/charting/diagrams/RadialLayout.js +101 -0
- package/src/charting/diagrams/RelationshipInstance.js +93 -0
- package/src/charting/diagrams/RemoveGroupFromViewCommand.js +28 -0
- package/src/charting/diagrams/RemoveLineCommand.js +27 -0
- package/src/charting/diagrams/ShowElementCommand.js +43 -0
- package/src/charting/diagrams/SvgCoordinate.js +17 -0
- package/src/charting/diagrams/SvgZoom.js +127 -0
- package/src/charting/diagrams/Tooltip.js +62 -0
- package/src/charting/diagrams/ViewConnectionInstance.js +102 -0
- package/src/charting/diagrams/ViewObjectInstance.js +56 -0
- package/src/charting/diagrams/commands/AddEdgeCommand.js +34 -0
- package/src/charting/diagrams/commands/AddNodeCommand.js +28 -0
- package/src/charting/diagrams/commands/AddWaypointCommand.js +27 -0
- package/src/charting/diagrams/commands/CreateFolderCommand.js +27 -0
- package/src/charting/diagrams/commands/DeleteEdgeCommand.js +30 -0
- package/src/charting/diagrams/commands/DeleteFolderCommand.js +47 -0
- package/src/charting/diagrams/commands/DeleteNodeCommand.js +35 -0
- package/src/charting/diagrams/commands/DeleteWaypointCommand.js +24 -0
- package/src/charting/diagrams/commands/GraphCommand.js +65 -0
- package/src/charting/diagrams/commands/InvertEdgeCommand.js +24 -0
- package/src/charting/diagrams/commands/MoveNodeCommand.js +44 -0
- package/src/charting/diagrams/commands/MoveWaypointCommand.js +27 -0
- package/src/charting/diagrams/commands/RenameEdgeCommand.js +23 -0
- package/src/charting/diagrams/commands/RenameFolderCommand.js +31 -0
- package/src/charting/diagrams/commands/RenameNodeCommand.js +27 -0
- package/src/charting/diagrams/commands/ResizeNodeCommand.js +46 -0
- package/src/charting/diagrams/commands/UpdateEdgeSideCommand.js +40 -0
- package/src/charting/diagrams/commands/index.js +17 -0
- package/src/charting/diagrams/duplicates.js +49 -0
- package/src/charting/diagrams/nesting.js +30 -0
- package/src/charting/diagrams/roadmap.js +77 -0
- package/src/charting/edgeMarkers/ArrowMarker.js +15 -0
- package/src/charting/edgeMarkers/CircleMarker.js +13 -0
- package/src/charting/edgeMarkers/CrowsFootMarker.js +16 -0
- package/src/charting/edgeMarkers/DiamondMarker.js +15 -0
- package/src/charting/edgeMarkers/EdgeMarker.js +34 -0
- package/src/charting/edgeMarkers/HalfArrowMarker.js +8 -0
- package/src/charting/edgeMarkers/HollowDiamondMarker.js +18 -0
- package/src/charting/edgeMarkers/HollowTriangleMarker.js +18 -0
- package/src/charting/edgeMarkers/OpenArrowMarker.js +17 -0
- package/src/charting/edgeMarkers/index.js +27 -0
- package/src/charting/edgeStyle/EdgeStyleCascade.js +22 -0
- package/src/charting/edgeStyle/EdgeStyleDialog.js +51 -0
- package/src/charting/edgeStyle/EdgeStyleSchema.js +43 -0
- package/src/charting/edgeStyle/SetStyleCommand.js +12 -0
- package/src/charting/edgeStyle/index.js +4 -0
- package/src/charting/emphasis/EmphasisRule.js +42 -0
- package/src/charting/emphasis/HighlightRule.js +24 -0
- package/src/charting/gauges/ArcTrack.js +51 -0
- package/src/charting/gauges/GaugeAnimation.js +51 -0
- package/src/charting/gauges/GaugeBands.js +48 -0
- package/src/charting/gauges/GaugeScale.js +87 -0
- package/src/charting/gauges/GaugeTrack.js +44 -0
- package/src/charting/gauges/GaugeValue.js +61 -0
- package/src/charting/gauges/HorizontalTrack.js +14 -0
- package/src/charting/gauges/LinearTrack.js +29 -0
- package/src/charting/gauges/Sparkline.js +42 -0
- package/src/charting/gauges/VerticalTrack.js +17 -0
- package/src/charting/glyphs/ArrowGlyph.js +21 -0
- package/src/charting/glyphs/BatteryGlyph.js +18 -0
- package/src/charting/glyphs/ChevronGlyph.js +18 -0
- package/src/charting/glyphs/CircleGlyph.js +15 -0
- package/src/charting/glyphs/CloudGlyph.js +19 -0
- package/src/charting/glyphs/ComponentGlyph.js +18 -0
- package/src/charting/glyphs/ConstraintGlyph.js +24 -0
- package/src/charting/glyphs/ContractBoxGlyph.js +10 -0
- package/src/charting/glyphs/CubeGlyph.js +19 -0
- package/src/charting/glyphs/CylinderGlyph.js +19 -0
- package/src/charting/glyphs/DashedDoubleArrowGlyph.js +11 -0
- package/src/charting/glyphs/DeviceGlyph.js +17 -0
- package/src/charting/glyphs/DiamondGlyph.js +17 -0
- package/src/charting/glyphs/DocumentGlyph.js +17 -0
- package/src/charting/glyphs/DoubleArrowGlyph.js +23 -0
- package/src/charting/glyphs/DoubleCircleGlyph.js +24 -0
- package/src/charting/glyphs/EllipseGlyph.js +18 -0
- package/src/charting/glyphs/FactoryGlyph.js +20 -0
- package/src/charting/glyphs/FlagGlyph.js +16 -0
- package/src/charting/glyphs/GapCircleGlyph.js +17 -0
- package/src/charting/glyphs/GearGlyph.js +37 -0
- package/src/charting/glyphs/Glyph.js +98 -0
- package/src/charting/glyphs/GroupingBoxGlyph.js +13 -0
- package/src/charting/glyphs/HalfCircleGlyph.js +22 -0
- package/src/charting/glyphs/HexagonGlyph.js +28 -0
- package/src/charting/glyphs/IconGlyph.js +22 -0
- package/src/charting/glyphs/ImageGlyph.js +16 -0
- package/src/charting/glyphs/JunctionGlyph.js +17 -0
- package/src/charting/glyphs/LollipopGlyph.js +22 -0
- package/src/charting/glyphs/MagnifierGlyph.js +17 -0
- package/src/charting/glyphs/NoteGlyph.js +33 -0
- package/src/charting/glyphs/ObjectBoxGlyph.js +21 -0
- package/src/charting/glyphs/OrJunctionGlyph.js +17 -0
- package/src/charting/glyphs/ParallelogramGlyph.js +20 -0
- package/src/charting/glyphs/PersonGlyph.js +23 -0
- package/src/charting/glyphs/PillGlyph.js +23 -0
- package/src/charting/glyphs/PinGlyph.js +18 -0
- package/src/charting/glyphs/PrincipleGlyph.js +23 -0
- package/src/charting/glyphs/ProductBoxGlyph.js +16 -0
- package/src/charting/glyphs/RectGlyph.js +15 -0
- package/src/charting/glyphs/RoundedBoxGlyph.js +13 -0
- package/src/charting/glyphs/StackGlyph.js +14 -0
- package/src/charting/glyphs/StepsGlyph.js +20 -0
- package/src/charting/glyphs/StickFigureGlyph.js +32 -0
- package/src/charting/glyphs/SystemSoftwareBoxGlyph.js +16 -0
- package/src/charting/glyphs/TabbedBoxGlyph.js +37 -0
- package/src/charting/glyphs/TargetGlyph.js +23 -0
- package/src/charting/glyphs/WavyBoxGlyph.js +17 -0
- package/src/charting/glyphs/WheelGlyph.js +28 -0
- package/src/charting/glyphs/drawGlyph.js +28 -0
- package/src/charting/glyphs/glyphSvg.js +55 -0
- package/src/charting/glyphs/index.js +109 -0
- package/src/charting/modelTree/AnalysisPanel.js +159 -0
- package/src/charting/modelTree/DiagramTabs.js +217 -0
- package/src/charting/modelTree/ModelTree.js +164 -0
- package/src/charting/modelTree/ModelTreePanel.js +914 -0
- package/src/charting/modelTree/TreeBuilder.js +238 -0
- package/src/charting/modelTree/TreeModeRegistry.js +51 -0
- package/src/charting/modelTree/TreeViewMode.js +110 -0
- package/src/charting/modelTree/buildFilterTrees.js +138 -0
- package/src/charting/modelTree/modes/FlatTreeMode.js +46 -0
- package/src/charting/modelTree/modes/LayerGroupedTreeMode.js +62 -0
- package/src/charting/modelTree/modes/TypeGroupedTreeMode.js +60 -0
- package/src/charting/modelTree/treeLayers.js +11 -0
- package/src/charting/report/reportHtml.js +82 -0
- package/src/charting/report/reportViewer.js +118 -0
- package/src/charting/shapes/CircleShape.js +19 -0
- package/src/charting/shapes/PathShape.js +17 -0
- package/src/charting/shapes/RectShape.js +20 -0
- package/src/charting/shapes/Shape.js +20 -0
- package/src/charting/shapes/ShapeFactory.js +23 -0
- package/src/charting/storage/LocalJsonStore.js +43 -0
- package/src/charting/templates/ActorTemplate.js +36 -0
- package/src/charting/templates/BoxTemplate.js +27 -0
- package/src/charting/templates/CircleTemplate.js +18 -0
- package/src/charting/templates/ClassTemplate.js +20 -0
- package/src/charting/templates/CloudTemplate.js +43 -0
- package/src/charting/templates/ComponentTemplate.js +19 -0
- package/src/charting/templates/CylinderTemplate.js +30 -0
- package/src/charting/templates/DataStoreTemplate.js +16 -0
- package/src/charting/templates/DiamondTemplate.js +10 -0
- package/src/charting/templates/DocumentTemplate.js +32 -0
- package/src/charting/templates/EllipseTemplate.js +15 -0
- package/src/charting/templates/FinalStateTemplate.js +12 -0
- package/src/charting/templates/GlyphTemplate.js +47 -0
- package/src/charting/templates/HexagonTemplate.js +17 -0
- package/src/charting/templates/LifelineTemplate.js +20 -0
- package/src/charting/templates/ManualInputTemplate.js +12 -0
- package/src/charting/templates/NoteTemplate.js +23 -0
- package/src/charting/templates/OctagonTemplate.js +7 -0
- package/src/charting/templates/PackageTemplate.js +25 -0
- package/src/charting/templates/ParallelogramTemplate.js +11 -0
- package/src/charting/templates/PentagonTemplate.js +5 -0
- package/src/charting/templates/PolygonTemplate.js +18 -0
- package/src/charting/templates/PredefinedProcessTemplate.js +13 -0
- package/src/charting/templates/RectangleTemplate.js +28 -0
- package/src/charting/templates/RegularPolygonTemplate.js +21 -0
- package/src/charting/templates/RoundedRectangleTemplate.js +5 -0
- package/src/charting/templates/StadiumTemplate.js +8 -0
- package/src/charting/templates/StarTemplate.js +17 -0
- package/src/charting/templates/SwimlaneTemplate.js +18 -0
- package/src/charting/templates/Template.js +208 -0
- package/src/charting/templates/TrapezoidTemplate.js +11 -0
- package/src/charting/templates/TriangleTemplate.js +12 -0
- package/src/charting/templates/index.js +31 -0
- package/src/charting/templates/outline.js +59 -0
- package/src/charting/templates/svg.js +19 -0
- package/src/charting/textToShapes.js +61 -0
- package/src/charting/toolbar/ToolbarButton.js +38 -0
- package/src/charting/toolbar/ToolbarCheckbox.js +31 -0
- package/src/charting/toolbar/ToolbarItem.js +19 -0
- package/src/charting/toolbar/ToolbarMenu.js +36 -0
- package/src/charting/toolbar/ToolbarSelect.js +38 -0
- package/src/charting/toolbar/ToolbarSeparator.js +7 -0
- package/src/charting/toolbar/ToolbarText.js +22 -0
- package/src/charting/toolbar/index.js +8 -0
- package/src/charting/toolbar/pickFile.js +14 -0
- package/src/charting/viewDecorations.js +85 -0
- package/src/charting/zOrder.js +57 -0
- package/src/csvTable.js +61 -0
- package/src/datamodel.js +122 -0
- package/src/datawindow/BoundedWindow.js +36 -0
- package/src/datawindow/FlatDataWindow.js +34 -0
- package/src/datawindow/GraphDataWindow.js +40 -0
- package/src/datawindow/GroupedSampleDataWindow.js +16 -0
- package/src/datawindow/SeriesDataWindow.js +42 -0
- package/src/datawindow/index.js +31 -0
- package/src/diagramCatalog.js +30 -0
- package/src/ebnfDiagram.js +57 -0
- package/src/ebnfParser.js +129 -0
- package/src/exportImage.js +233 -0
- package/src/index.js +2636 -0
- package/src/itIcons.js +84 -0
- package/src/kernelExpr.js +243 -0
- package/src/propertiesDialog.js +463 -0
- package/src/railroadDiagram.js +571 -0
- package/src/treeModeCatalog.js +16 -0
- package/src/workspace/ContextBus.js +79 -0
- package/src/workspace/EditorShell.js +67 -0
- package/src/workspace/Part.js +163 -0
- package/src/workspace/PartFactory.js +49 -0
- package/src/workspace/PartRegistry.js +86 -0
- package/src/workspace/Workspace.js +321 -0
- package/src/workspace/archimateServices.js +33 -0
- package/src/workspace/dom.js +120 -0
- package/src/workspace/index.js +75 -0
- package/src/workspace/layout/GridNode.js +280 -0
- package/src/workspace/layout/LayoutNode.js +89 -0
- package/src/workspace/layout/PartNode.js +77 -0
- package/src/workspace/layout/SplitNode.js +114 -0
- package/src/workspace/layout/TabsNode.js +191 -0
- package/src/workspace/layout/index.js +24 -0
- package/src/workspace/parts/AdapterPart.js +33 -0
- package/src/workspace/parts/ArchimateCanvasPart.js +345 -0
- package/src/workspace/parts/ArchimateEditorPart.js +79 -0
- package/src/workspace/parts/ChartPart.js +115 -0
- package/src/workspace/parts/ContentPart.js +34 -0
- package/src/workspace/parts/DetailPart.js +46 -0
- package/src/workspace/parts/DiagramEditorPart.js +135 -0
- package/src/workspace/parts/EditorPart.js +388 -0
- package/src/workspace/parts/HtmlPart.js +25 -0
- package/src/workspace/parts/ListPart.js +57 -0
- package/src/workspace/parts/ModelFile.js +187 -0
- package/src/workspace/parts/ModelsPart.js +135 -0
- package/src/workspace/styles.js +258 -0
- package/src/workspace/themes.js +96 -0
- package/src/workspace/workArea.js +413 -0
- package/src/workspace/workAreaModel.js +197 -0
- package/src/workspace.js +16 -0
- package/src/zip/ZipArchive.js +160 -0
- package/src/zip/crc32.js +25 -0
- package/src/zip/inflate.js +159 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ArchimateNotation, archimate32Type } from './archimate.js';
|
|
2
|
+
import { ITIconNotation } from './itIcons.js';
|
|
3
|
+
import { RELATIONSHIP_TABLE_CONCEPTS } from './archimateRelationshipTable.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The element types Archi can hold, and the nearest one for a type it cannot.
|
|
7
|
+
*
|
|
8
|
+
* Archi has a class for each ArchiMate 3.2 element type and no others: a file
|
|
9
|
+
* naming any other class (an IT icon type such as `load-balancer`, or a custom
|
|
10
|
+
* type) does not open. So such an element is written as its nearest 3.2 type,
|
|
11
|
+
* chosen by its layer and aspect, with its own type kept beside it: the
|
|
12
|
+
* feature ARCHI_TYPE_FEATURE (which Archi keeps, and import reads back) and an
|
|
13
|
+
* Archi specialization (profile) named after it, so Archi users see it too.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** The feature that keeps an element's own type when Archi has no class for it. */
|
|
17
|
+
export const ARCHI_TYPE_FEATURE = 'renderengine.type';
|
|
18
|
+
|
|
19
|
+
/** Ids of the specializations written for such types start with this. */
|
|
20
|
+
export const ARCHI_TYPE_PROFILE_PREFIX = 'id-renderengine-type-';
|
|
21
|
+
|
|
22
|
+
/** Every element type Archi has a class for (ArchiMate 3.2, from its relationship table). */
|
|
23
|
+
export const ARCHI_ELEMENT_TYPES = new Set(RELATIONSHIP_TABLE_CONCEPTS.filter(t => t !== 'relationship'));
|
|
24
|
+
|
|
25
|
+
/** The nearest 3.2 type by layer and aspect, for a type Archi lacks. */
|
|
26
|
+
export const NEAREST_ARCHI_TYPE = Object.freeze({
|
|
27
|
+
business: { active: 'business-actor', behavior: 'business-process', passive: 'business-object' },
|
|
28
|
+
application: { active: 'application-component', behavior: 'application-process', passive: 'data-object' },
|
|
29
|
+
technology: { active: 'node', behavior: 'technology-process', passive: 'artifact' },
|
|
30
|
+
physical: { active: 'equipment', behavior: 'technology-process', passive: 'material' },
|
|
31
|
+
motivation: { active: 'stakeholder', behavior: 'requirement', passive: 'requirement' },
|
|
32
|
+
strategy: { active: 'resource', behavior: 'capability', passive: 'resource' },
|
|
33
|
+
implementation: { active: 'work-package', behavior: 'work-package', passive: 'deliverable' },
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
/** 'active' | 'behavior' | 'passive' from an aspect name ('active-structure', ...). */
|
|
37
|
+
function _aspect(name) {
|
|
38
|
+
const text = String(name ?? '').toLowerCase();
|
|
39
|
+
if (text.startsWith('passive')) return 'passive';
|
|
40
|
+
if (text.startsWith('behav')) return 'behavior';
|
|
41
|
+
return 'active';
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** A layer as a name, whether given as a name or an ArchimateLayer. */
|
|
45
|
+
const _layerName = (layer) => (typeof layer === 'string' ? layer : layer?.name);
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The type to write for an element in an Archi file.
|
|
49
|
+
* @param {{type: string, layer?: string, aspect?: string}} element
|
|
50
|
+
* @returns {{ type: string, original: string|null }} the type Archi has, and the element's own
|
|
51
|
+
* type when that had to change (null when Archi has it, or its 3.2 form)
|
|
52
|
+
*/
|
|
53
|
+
export function archiElementType(element) {
|
|
54
|
+
const type32 = archimate32Type(element);
|
|
55
|
+
if (ARCHI_ELEMENT_TYPES.has(type32)) return { type: type32, original: null };
|
|
56
|
+
const it = ITIconNotation.elementType(element.type);
|
|
57
|
+
const known = ArchimateNotation.elementType(element.type);
|
|
58
|
+
const layer = _layerName(element.layer) ?? _layerName(it?.layer) ?? _layerName(known?.layer) ?? 'other';
|
|
59
|
+
const aspect = _aspect(element.aspect ?? it?.aspect ?? known?.aspect);
|
|
60
|
+
const type = NEAREST_ARCHI_TYPE[layer]?.[aspect] ?? 'grouping';
|
|
61
|
+
return { type, original: element.type };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** The id of the specialization written for an element type Archi lacks. */
|
|
65
|
+
export function typeProfileId(type) {
|
|
66
|
+
return `${ARCHI_TYPE_PROFILE_PREFIX}${String(type).replace(/[^A-Za-z0-9_-]/g, '_')}`;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** A type's name as a person reads it: 'load-balancer' → 'Load Balancer'. */
|
|
70
|
+
export function typeDisplayName(type) {
|
|
71
|
+
return String(type).split(/[-_\s]+/).filter(Boolean).map(w => w[0].toUpperCase() + w.slice(1)).join(' ');
|
|
72
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { parseArchiModel, toArchiXML } from './archimateArchiFormat.js';
|
|
2
|
+
import { ZipArchive } from './zip/ZipArchive.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Archi's file as it is on disk. A model without images is plain XML; a model
|
|
6
|
+
* with images is a zip archive holding the XML as `model.xml` and each picture
|
|
7
|
+
* under `images/`, which the visuals' `imagePath` names. Here pictures travel
|
|
8
|
+
* as `data:` URLs, so reading turns each archived picture into one, and writing
|
|
9
|
+
* turns each `data:` URL back into an archived picture.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** The archive entry holding the model. */
|
|
13
|
+
export const ARCHI_MODEL_ENTRY = 'model.xml';
|
|
14
|
+
const IMAGE_FOLDER = 'images/';
|
|
15
|
+
|
|
16
|
+
const MIME_BY_EXTENSION = Object.freeze({
|
|
17
|
+
png: 'image/png', jpg: 'image/jpeg', jpeg: 'image/jpeg', gif: 'image/gif', bmp: 'image/bmp',
|
|
18
|
+
svg: 'image/svg+xml', webp: 'image/webp', ico: 'image/x-icon', tif: 'image/tiff', tiff: 'image/tiff',
|
|
19
|
+
});
|
|
20
|
+
const EXTENSION_BY_MIME = Object.freeze({
|
|
21
|
+
'image/png': 'png', 'image/jpeg': 'jpg', 'image/gif': 'gif', 'image/bmp': 'bmp',
|
|
22
|
+
'image/svg+xml': 'svg', 'image/webp': 'webp', 'image/x-icon': 'ico', 'image/tiff': 'tif',
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Read an Archi file: plain XML (a string, or its bytes) or an archive.
|
|
27
|
+
* @param {string|Uint8Array|ArrayBuffer} input
|
|
28
|
+
* @returns {Object} the parsed model, as parseArchiModel returns it, with every
|
|
29
|
+
* archived picture's `imagePath` replaced by a `data:` URL
|
|
30
|
+
*/
|
|
31
|
+
export function parseArchiFile(input) {
|
|
32
|
+
const bytes = input instanceof ArrayBuffer ? new Uint8Array(input) : input;
|
|
33
|
+
if (typeof bytes === 'string') return parseArchiModel(bytes);
|
|
34
|
+
if (!ZipArchive.isZip(bytes)) return parseArchiModel(new TextDecoder().decode(bytes));
|
|
35
|
+
|
|
36
|
+
const zip = ZipArchive.read(bytes);
|
|
37
|
+
const xml = zip.get(ARCHI_MODEL_ENTRY);
|
|
38
|
+
if (!xml) throw new Error(`Not an Archi archive: it has no ${ARCHI_MODEL_ENTRY}`);
|
|
39
|
+
const model = parseArchiModel(new TextDecoder().decode(xml));
|
|
40
|
+
const urls = new Map();
|
|
41
|
+
const resolve = (path) => {
|
|
42
|
+
if (!urls.has(path)) {
|
|
43
|
+
const data = zip.get(path);
|
|
44
|
+
urls.set(path, data ? archivedFileUrl(data, path) : null);
|
|
45
|
+
}
|
|
46
|
+
return urls.get(path);
|
|
47
|
+
};
|
|
48
|
+
_eachVisual(model.views, (visual) => {
|
|
49
|
+
if (!visual.imagePath) return;
|
|
50
|
+
const url = resolve(visual.imagePath);
|
|
51
|
+
if (url) {
|
|
52
|
+
visual.archiImagePath = visual.imagePath; // kept, so export writes the picture back under the same name
|
|
53
|
+
visual.imagePath = url;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
return model;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Write an Archi file. Plain XML when no visual carries a `data:` picture;
|
|
61
|
+
* otherwise an archive with the pictures under `images/`.
|
|
62
|
+
* @param {Object} model - as toArchiXML takes it
|
|
63
|
+
* @param {Array<Object>} views - as toArchiXML takes them (not changed)
|
|
64
|
+
* @returns {{ data: string|Uint8Array, archive: boolean, mimeType: string }}
|
|
65
|
+
*/
|
|
66
|
+
export function toArchiFile(model, views) {
|
|
67
|
+
const copies = _copyTrees(views);
|
|
68
|
+
const pictures = new Map(); // data: URL -> archive path
|
|
69
|
+
_eachVisual(copies, (visual) => {
|
|
70
|
+
const url = visual.imagePath;
|
|
71
|
+
if (!url?.startsWith('data:')) return;
|
|
72
|
+
if (!pictures.has(url)) {
|
|
73
|
+
// Its own archive path when it came from one (and no other picture took it), else a new one.
|
|
74
|
+
const taken = new Set(pictures.values());
|
|
75
|
+
const own = visual.archiImagePath && !taken.has(visual.archiImagePath) ? visual.archiImagePath : null;
|
|
76
|
+
const { mime } = _parseDataUrl(url);
|
|
77
|
+
let path = own;
|
|
78
|
+
for (let n = pictures.size + 1; !path || (path !== own && taken.has(path)); n++) path = `${IMAGE_FOLDER}image-${n}.${EXTENSION_BY_MIME[mime] ?? 'bin'}`;
|
|
79
|
+
pictures.set(url, path);
|
|
80
|
+
}
|
|
81
|
+
visual.imagePath = pictures.get(url);
|
|
82
|
+
});
|
|
83
|
+
const xml = toArchiXML(model, copies);
|
|
84
|
+
if (!pictures.size) return { data: xml, archive: false, mimeType: 'application/xml' };
|
|
85
|
+
|
|
86
|
+
const zip = new ZipArchive().add(ARCHI_MODEL_ENTRY, xml);
|
|
87
|
+
for (const [url, path] of pictures) zip.add(path, _parseDataUrl(url).bytes);
|
|
88
|
+
return { data: zip.toBytes(), archive: true, mimeType: 'application/zip' };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** Call fn on every visual of every view, nested ones included. @private */
|
|
92
|
+
function _eachVisual(views, fn) {
|
|
93
|
+
const walk = (visual) => {
|
|
94
|
+
fn(visual);
|
|
95
|
+
for (const child of visual.children || []) walk(child);
|
|
96
|
+
};
|
|
97
|
+
for (const view of views || []) for (const child of view.children || []) walk(child);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Views with their visual trees copied, so the caller's are left alone. @private */
|
|
101
|
+
function _copyTrees(views) {
|
|
102
|
+
const copy = (visual) => ({ ...visual, children: (visual.children || []).map(copy) });
|
|
103
|
+
return (views || []).map(view => ({ ...view, children: (view.children || []).map(copy) }));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const _extension = (path) => (path.match(/\.([^./]+)$/)?.[1] ?? '').toLowerCase();
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* An archived file's bytes as a `data:` URL, its media type taken from the
|
|
110
|
+
* path's extension (a picture in an Archi archive or template).
|
|
111
|
+
* @param {Uint8Array} bytes
|
|
112
|
+
* @param {string} path
|
|
113
|
+
* @returns {string}
|
|
114
|
+
*/
|
|
115
|
+
export function archivedFileUrl(bytes, path) {
|
|
116
|
+
return _dataUrl(bytes, MIME_BY_EXTENSION[_extension(path)] ?? 'application/octet-stream');
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** Bytes as a base64 `data:` URL. @private */
|
|
120
|
+
function _dataUrl(bytes, mime) {
|
|
121
|
+
let binary = '';
|
|
122
|
+
const CHUNK = 0x8000;
|
|
123
|
+
for (let i = 0; i < bytes.length; i += CHUNK) binary += String.fromCharCode(...bytes.subarray(i, i + CHUNK));
|
|
124
|
+
return `data:${mime};base64,${btoa(binary)}`;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** A `data:` URL's media type and bytes (base64 or percent-encoded). @private */
|
|
128
|
+
function _parseDataUrl(url) {
|
|
129
|
+
const comma = url.indexOf(',');
|
|
130
|
+
const header = url.slice(5, comma);
|
|
131
|
+
const body = url.slice(comma + 1);
|
|
132
|
+
const mime = (header.split(';')[0] || 'text/plain').toLowerCase();
|
|
133
|
+
if (header.split(';').includes('base64')) {
|
|
134
|
+
const binary = atob(body);
|
|
135
|
+
const bytes = new Uint8Array(binary.length);
|
|
136
|
+
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
137
|
+
return { mime, bytes };
|
|
138
|
+
}
|
|
139
|
+
return { mime, bytes: new TextEncoder().encode(decodeURIComponent(body)) };
|
|
140
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { parseCsvTable } from './csvTable.js';
|
|
2
|
+
/**
|
|
3
|
+
* archimateCSV — minimal CSV import/export for renderengine element/relationship
|
|
4
|
+
* models. No external dependencies: a small RFC-4180-ish parser just big enough
|
|
5
|
+
* for the two shapes we need.
|
|
6
|
+
*
|
|
7
|
+
* Two files are used:
|
|
8
|
+
* - elements.csv: id, name, type, layer, documentation, properties
|
|
9
|
+
* - relationships.csv: id, source, target, kind, label, documentation, properties
|
|
10
|
+
*
|
|
11
|
+
* The `properties` column is a JSON string of [{name, type, value}]. Empty cells
|
|
12
|
+
* round-trip cleanly.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
function escapeCsvCell(value) {
|
|
16
|
+
const str = value == null ? '' : String(value);
|
|
17
|
+
if (/[",\n\r]/.test(str)) {
|
|
18
|
+
return '"' + str.replace(/"/g, '""') + '"';
|
|
19
|
+
}
|
|
20
|
+
return str;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** The rows of a CSV text, as objects by the header's columns (csvTable.js: the one CSV reader). */
|
|
24
|
+
function parseCsv(csv) {
|
|
25
|
+
return parseCsvTable(csv, { delimiter: ',' }).rows;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function stringifyProperties(properties) {
|
|
29
|
+
if (!Array.isArray(properties) || properties.length === 0) return '';
|
|
30
|
+
return JSON.stringify(properties);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function parseProperties(raw) {
|
|
34
|
+
if (!raw) return undefined;
|
|
35
|
+
try {
|
|
36
|
+
const parsed = JSON.parse(raw);
|
|
37
|
+
return Array.isArray(parsed) && parsed.length > 0 ? parsed : undefined;
|
|
38
|
+
} catch {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Export an array of element objects to CSV. */
|
|
44
|
+
export function exportElementsCSV(elements = []) {
|
|
45
|
+
const header = ['id', 'name', 'type', 'layer', 'documentation', 'properties'];
|
|
46
|
+
const lines = [header.join(',')];
|
|
47
|
+
for (const el of elements) {
|
|
48
|
+
lines.push([
|
|
49
|
+
escapeCsvCell(el.id),
|
|
50
|
+
escapeCsvCell(el.name),
|
|
51
|
+
escapeCsvCell(el.type),
|
|
52
|
+
escapeCsvCell(el.layer),
|
|
53
|
+
escapeCsvCell(el.documentation),
|
|
54
|
+
escapeCsvCell(stringifyProperties(el.properties)),
|
|
55
|
+
].join(','));
|
|
56
|
+
}
|
|
57
|
+
return lines.join('\n');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Export an array of relationship objects to CSV. */
|
|
61
|
+
export function exportRelationshipsCSV(relationships = []) {
|
|
62
|
+
const header = ['id', 'source', 'target', 'kind', 'label', 'documentation', 'properties'];
|
|
63
|
+
const lines = [header.join(',')];
|
|
64
|
+
for (const rel of relationships) {
|
|
65
|
+
lines.push([
|
|
66
|
+
escapeCsvCell(rel.id),
|
|
67
|
+
escapeCsvCell(rel.source),
|
|
68
|
+
escapeCsvCell(rel.target),
|
|
69
|
+
escapeCsvCell(rel.kind),
|
|
70
|
+
escapeCsvCell(rel.label),
|
|
71
|
+
escapeCsvCell(rel.documentation),
|
|
72
|
+
escapeCsvCell(stringifyProperties(rel.properties)),
|
|
73
|
+
].join(','));
|
|
74
|
+
}
|
|
75
|
+
return lines.join('\n');
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** Parse an elements CSV string into element objects. */
|
|
79
|
+
export function importElementsCSV(csv) {
|
|
80
|
+
const rows = parseCsv(csv);
|
|
81
|
+
return rows.map(row => {
|
|
82
|
+
const el = {
|
|
83
|
+
id: row.id,
|
|
84
|
+
name: row.name,
|
|
85
|
+
type: row.type,
|
|
86
|
+
};
|
|
87
|
+
if (row.layer) el.layer = row.layer;
|
|
88
|
+
if (row.documentation) el.documentation = row.documentation;
|
|
89
|
+
const props = parseProperties(row.properties);
|
|
90
|
+
if (props) el.properties = props;
|
|
91
|
+
return el;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Parse a relationships CSV string into relationship objects. */
|
|
96
|
+
export function importRelationshipsCSV(csv) {
|
|
97
|
+
const rows = parseCsv(csv);
|
|
98
|
+
return rows.map(row => {
|
|
99
|
+
const rel = {
|
|
100
|
+
id: row.id,
|
|
101
|
+
source: row.source,
|
|
102
|
+
target: row.target,
|
|
103
|
+
kind: row.kind,
|
|
104
|
+
};
|
|
105
|
+
if (row.label) rel.label = row.label;
|
|
106
|
+
if (row.documentation) rel.documentation = row.documentation;
|
|
107
|
+
const props = parseProperties(row.properties);
|
|
108
|
+
if (props) rel.properties = props;
|
|
109
|
+
return rel;
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** Convenience: export both in one call. Returns { elementsCSV, relationshipsCSV }. */
|
|
114
|
+
export function exportModelCSV(model = {}) {
|
|
115
|
+
return {
|
|
116
|
+
elementsCSV: exportElementsCSV(model.elements || []),
|
|
117
|
+
relationshipsCSV: exportRelationshipsCSV(model.relationships || []),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** Convenience: import both in one call. Returns { elements, relationships }. */
|
|
122
|
+
export function importModelCSV(elementsCSV = '', relationshipsCSV = '') {
|
|
123
|
+
return {
|
|
124
|
+
elements: importElementsCSV(elementsCSV),
|
|
125
|
+
relationships: importRelationshipsCSV(relationshipsCSV),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { toArchiExport } from './archimateArchiFormat.js';
|
|
2
|
+
import { ArchimateDiagram } from './charting/diagrams/ArchimateDiagram.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* draw.io (diagrams.net) export: an ArchiMate model's views as one draw.io
|
|
6
|
+
* file, a page per view, drawn with draw.io's own ArchiMate 3 shapes (the
|
|
7
|
+
* type-to-shape table of the jArchi "Export view to draw.io" script). Each
|
|
8
|
+
* box keeps its place, size, colours and nesting (a box inside another is
|
|
9
|
+
* its child cell), each line its relationship's look and its bendpoints;
|
|
10
|
+
* notes, groups and canvas boxes come too. The element's or relationship's
|
|
11
|
+
* id, type and properties go on the cell's object, so draw.io keeps them.
|
|
12
|
+
* Export only: draw.io files do not come back in.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const box = (props, extra = '') => ({ html: 1, whiteSpace: 'wrap', outlineConnect: 0, ...props, _extra: extra });
|
|
16
|
+
const app = (appType, archiType) => box({ shape: 'mxgraph.archimate3.application', appType, archiType });
|
|
17
|
+
|
|
18
|
+
/** ArchiMate element types as draw.io styles. */
|
|
19
|
+
export const DRAWIO_ELEMENT_STYLES = Object.freeze({
|
|
20
|
+
// Strategy
|
|
21
|
+
capability: app('capability', 'rounded'), 'course-of-action': app('course', 'rounded'), resource: app('resource', 'square'),
|
|
22
|
+
'value-stream': app('valueStream', 'rounded'),
|
|
23
|
+
// Motivation
|
|
24
|
+
stakeholder: app('role', 'oct'), driver: app('driver', 'oct'), goal: app('goal', 'oct'), outcome: app('outcome', 'oct'),
|
|
25
|
+
principle: app('principle', 'oct'), requirement: app('requirement', 'oct'), assessment: app('assess', 'oct'),
|
|
26
|
+
constraint: app('constraint', 'oct'), meaning: box({ shape: 'cloud' }), value: box({ shape: 'ellipse' }),
|
|
27
|
+
// Business
|
|
28
|
+
'business-actor': app('actor', 'square'), 'business-role': app('role', 'square'), 'business-collaboration': app('collab', 'square'),
|
|
29
|
+
'business-interface': app('interface', 'square'), 'business-process': app('proc', 'rounded'), 'business-function': app('func', 'rounded'),
|
|
30
|
+
'business-interaction': app('interaction', 'rounded'), 'business-event': app('event', 'rounded'), 'business-service': app('serv', 'rounded'),
|
|
31
|
+
'business-object': box({ shape: 'mxgraph.archimate3.businessObject', overflow: 'fill' }),
|
|
32
|
+
contract: box({ shape: 'mxgraph.archimate3.contract' }), representation: box({ shape: 'mxgraph.archimate3.representation' }),
|
|
33
|
+
product: box({ shape: 'mxgraph.archimate3.product' }),
|
|
34
|
+
// Application
|
|
35
|
+
'application-component': app('comp', 'square'), 'application-collaboration': app('collab', 'square'),
|
|
36
|
+
'application-interface': app('interface', 'square'), 'application-function': app('func', 'rounded'),
|
|
37
|
+
'application-interaction': app('interaction', 'rounded'), 'application-process': app('proc', 'rounded'),
|
|
38
|
+
'application-event': app('event', 'rounded'), 'application-service': app('serv', 'rounded'),
|
|
39
|
+
'data-object': box({ shape: 'mxgraph.archimate3.businessObject', overflow: 'fill' }),
|
|
40
|
+
// Technology and physical
|
|
41
|
+
node: box({ shape: 'mxgraph.archimate3.node' }), device: box({ shape: 'mxgraph.archimate3.device' }),
|
|
42
|
+
'system-software': app('sysSw', 'square'), 'technology-collaboration': app('collab', 'square'),
|
|
43
|
+
'technology-interface': app('interface', 'square'), path: app('path', 'square'), 'communication-network': app('netw', 'square'),
|
|
44
|
+
'technology-function': app('func', 'rounded'), 'technology-process': app('proc', 'rounded'), 'technology-interaction': app('interaction', 'rounded'),
|
|
45
|
+
'technology-event': app('event', 'rounded'), 'technology-service': app('serv', 'rounded'), artifact: app('artifact', 'square'),
|
|
46
|
+
equipment: box({ shape: 'mxgraph.archimate3.tech', techType: 'equipment' }), facility: box({ shape: 'mxgraph.archimate3.tech', techType: 'facility' }),
|
|
47
|
+
'distribution-network': app('distribution', 'square'), material: app('material', 'square'),
|
|
48
|
+
// Implementation and migration
|
|
49
|
+
'work-package': app(undefined, 'rounded'), deliverable: box({ shape: 'mxgraph.archimate3.deliverable' }),
|
|
50
|
+
'implementation-event': app('event', 'rounded'), plateau: box({ shape: 'mxgraph.archimate3.tech', techType: 'plateau' }),
|
|
51
|
+
gap: box({ shape: 'mxgraph.archimate3.gap' }),
|
|
52
|
+
// Other
|
|
53
|
+
location: app('location', 'square'),
|
|
54
|
+
grouping: box({ shape: 'folder', spacingTop: 10, tabWidth: 100, tabHeight: 25, tabPosition: 'left', dashed: 1, outlineConnect: undefined }),
|
|
55
|
+
junction: box({ verticalLabelPosition: 'bottom', verticalAlign: 'top', outlineConnect: undefined }, 'ellipse;'),
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
/** The other boxes a view draws: notes, groups (folders), pictures, canvas boxes; and a type with no shape of its own. */
|
|
59
|
+
const OTHER_STYLES = {
|
|
60
|
+
'diagram-model-note': box({ shape: 'note', size: 12, align: 'left', verticalAlign: 'top', spacingLeft: 4 }),
|
|
61
|
+
'diagram-model-group': box({ shape: 'folder', spacingTop: 10, tabWidth: 100, tabHeight: 25, tabPosition: 'left', verticalAlign: 'top', outlineConnect: undefined }),
|
|
62
|
+
'diagram-model-image': box({ shape: 'image' }),
|
|
63
|
+
other: box({ rounded: 1 }),
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const line = (props) => ({ html: 1, endArrow: 'none', rounded: 0, ...props });
|
|
67
|
+
|
|
68
|
+
/** Relationship kinds as draw.io line styles (access by its access type). */
|
|
69
|
+
export const DRAWIO_RELATIONSHIP_STYLES = Object.freeze({
|
|
70
|
+
access: line({ dashed: 1, dashPattern: '1 4', endArrow: 'open', endFill: 0 }),
|
|
71
|
+
'access-read': line({ dashed: 1, dashPattern: '1 4', startArrow: 'open', startFill: 0 }),
|
|
72
|
+
'access-write': line({ dashed: 1, dashPattern: '1 4', endArrow: 'open', endFill: 0 }),
|
|
73
|
+
'access-readwrite': line({ dashed: 1, dashPattern: '1 4', startArrow: 'open', startFill: 0, endArrow: 'open', endFill: 0 }),
|
|
74
|
+
'access-access': line({ dashed: 1, dashPattern: '1 4' }),
|
|
75
|
+
aggregation: line({ startArrow: 'diamondThin', startFill: 0, startSize: 10 }),
|
|
76
|
+
assignment: line({ startArrow: 'oval', startFill: 1, endArrow: 'block', endFill: 1 }),
|
|
77
|
+
association: line({}),
|
|
78
|
+
composition: line({ startArrow: 'diamondThin', startFill: 1, startSize: 10 }),
|
|
79
|
+
flow: line({ dashed: 1, dashPattern: '6 4', endArrow: 'block', endFill: 1 }),
|
|
80
|
+
influence: line({ dashed: 1, dashPattern: '6 4', endArrow: 'open', endFill: 0 }),
|
|
81
|
+
realization: line({ dashed: 1, endArrow: 'block', endFill: 0 }),
|
|
82
|
+
serving: line({ endArrow: 'open', endFill: 1 }),
|
|
83
|
+
specialization: line({ endArrow: 'block', endFill: 0 }),
|
|
84
|
+
triggering: line({ endArrow: 'block', endFill: 1 }),
|
|
85
|
+
connection: line({}),
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
/** Archi's access types (as its files write them) by our names. */
|
|
89
|
+
const ACCESS_TYPES = { 0: 'write', 1: 'read', 2: 'access', 3: 'readwrite', write: 'write', read: 'read', access: 'access', readwrite: 'readwrite' };
|
|
90
|
+
/** Archi's text alignment and position numbers as draw.io's. */
|
|
91
|
+
const ALIGN = { 1: 'left', 2: 'center', 4: 'right' };
|
|
92
|
+
const VERTICAL = { 0: 'top', 1: 'middle', 2: 'bottom' };
|
|
93
|
+
|
|
94
|
+
const esc = (v) => String(v ?? '').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/\n/g, ' ');
|
|
95
|
+
const attrs = (o) => Object.entries(o).filter(([, v]) => v !== undefined && v !== null).map(([k, v]) => ` ${k}="${esc(v)}"`).join('');
|
|
96
|
+
|
|
97
|
+
/** A style object as draw.io's "key=value;" text, with an item's own colours and text placement. */
|
|
98
|
+
function styleText(base, own = {}) {
|
|
99
|
+
const { _extra = '', ...props } = base;
|
|
100
|
+
const merged = { ...props };
|
|
101
|
+
if (own.fillColor) merged.fillColor = own.fillColor;
|
|
102
|
+
if (own.lineColor) merged.strokeColor = own.lineColor;
|
|
103
|
+
if (own.fontColor) merged.fontColor = own.fontColor;
|
|
104
|
+
if (ALIGN[own.textAlignment]) merged.align = ALIGN[own.textAlignment];
|
|
105
|
+
if (VERTICAL[own.textPosition]) merged.verticalAlign = VERTICAL[own.textPosition];
|
|
106
|
+
return _extra + Object.entries(merged).filter(([, v]) => v !== undefined).map(([k, v]) => `${k}=${v};`).join('');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** An item's properties as attributes of its draw.io object (names made safe). */
|
|
110
|
+
function propertyAttrs(properties) {
|
|
111
|
+
const out = {};
|
|
112
|
+
for (const p of properties ?? []) {
|
|
113
|
+
const name = String(p.name ?? p.key ?? '').trim().replace(/[^A-Za-z0-9_.-]+/g, '_').replace(/^[^A-Za-z_]+/, '_');
|
|
114
|
+
if (name && !(name in out)) out[name] = p.value;
|
|
115
|
+
}
|
|
116
|
+
return out;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* The model's views as a draw.io file.
|
|
121
|
+
* @param {ArchimateModel} model
|
|
122
|
+
* @param {Object} [options]
|
|
123
|
+
* @param {Array<string>} [options.viewIds] - Only these views (default: every view but model templates)
|
|
124
|
+
* @returns {string} draw.io XML (an mxfile)
|
|
125
|
+
*/
|
|
126
|
+
export function toDrawioXML(model, { viewIds = null } = {}) {
|
|
127
|
+
const [data, views] = toArchiExport(model);
|
|
128
|
+
const elements = new Map((data.elements ?? []).map(e => [e.id, e]));
|
|
129
|
+
const relationships = new Map((data.relationships ?? []).map(r => [r.id, r]));
|
|
130
|
+
const pages = views
|
|
131
|
+
.filter(v => (viewIds ? viewIds.includes(v.id) : !v.template))
|
|
132
|
+
.map(view => page(view, elements, relationships));
|
|
133
|
+
return `<?xml version="1.0" encoding="UTF-8"?>\n<mxfile${attrs({ host: 'renderengine', agent: 'RenderEngine', type: 'device' })}>\n${pages.join('')}</mxfile>\n`;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** One view as a draw.io page. @private */
|
|
137
|
+
function page(view, elements, relationships) {
|
|
138
|
+
const cells = [];
|
|
139
|
+
const centres = new Map(); // visual id -> its centre on the page, for bendpoints
|
|
140
|
+
const edges = [];
|
|
141
|
+
const walk = (visual, parentId, origin) => {
|
|
142
|
+
const b = visual.bounds ?? { x: 0, y: 0, width: 120, height: 55 };
|
|
143
|
+
const abs = { x: origin.x + b.x, y: origin.y + b.y };
|
|
144
|
+
centres.set(visual.id, { x: abs.x + b.width / 2, y: abs.y + b.height / 2 });
|
|
145
|
+
const element = visual.archimateElement ? elements.get(visual.archimateElement) : null;
|
|
146
|
+
const own = { ...visual.style };
|
|
147
|
+
let base, value, object;
|
|
148
|
+
if (element) {
|
|
149
|
+
base = DRAWIO_ELEMENT_STYLES[element.type] ?? OTHER_STYLES.other;
|
|
150
|
+
if (!own.fillColor) own.fillColor = ArchimateDiagram.layerColor(ArchimateDiagram.elementLayer(element));
|
|
151
|
+
value = element.name ?? '';
|
|
152
|
+
object = { archimateId: element.id, archimateType: element.type, ...(element.documentation && { documentation: element.documentation }), ...propertyAttrs(element.properties) };
|
|
153
|
+
} else {
|
|
154
|
+
base = OTHER_STYLES[visual.type] ?? OTHER_STYLES.other;
|
|
155
|
+
value = visual.text ?? visual.name ?? '';
|
|
156
|
+
object = null;
|
|
157
|
+
}
|
|
158
|
+
const geometry = `<mxGeometry${attrs({ x: b.x, y: b.y, width: b.width, height: b.height, as: 'geometry' })}/>`;
|
|
159
|
+
const cell = `<mxCell${attrs({ style: styleText(base, own), vertex: 1, parent: parentId })}>${geometry}</mxCell>`;
|
|
160
|
+
cells.push(object
|
|
161
|
+
? `<object${attrs({ id: visual.id, label: value, ...object })}>${cell}</object>`
|
|
162
|
+
: `<mxCell${attrs({ id: visual.id, value, style: styleText(base, own), vertex: 1, parent: parentId })}>${geometry}</mxCell>`);
|
|
163
|
+
edges.push(...(visual.sourceConnections ?? []));
|
|
164
|
+
for (const child of visual.children ?? []) walk(child, visual.id, abs);
|
|
165
|
+
};
|
|
166
|
+
for (const visual of view.children ?? []) walk(visual, '1', { x: 0, y: 0 });
|
|
167
|
+
|
|
168
|
+
for (const sc of edges) {
|
|
169
|
+
const rel = sc.relationship ? relationships.get(sc.relationship) : null;
|
|
170
|
+
const kind = rel?.kind ?? rel?.type ?? 'connection';
|
|
171
|
+
const key = kind === 'access' ? `access-${ACCESS_TYPES[rel?.accessType ?? rel?.archi?.attributes?.accessType] ?? 'write'}` : kind;
|
|
172
|
+
const style = styleText(DRAWIO_RELATIONSHIP_STYLES[key] ?? DRAWIO_RELATIONSHIP_STYLES.connection, sc.style);
|
|
173
|
+
const from = centres.get(sc.source);
|
|
174
|
+
const points = (sc.bendpoints ?? []).filter(() => from).map(bp => `<mxPoint${attrs({ x: from.x + (bp.startX ?? 0), y: from.y + (bp.startY ?? 0) })}/>`);
|
|
175
|
+
const geometry = `<mxGeometry${attrs({ relative: 1, as: 'geometry' })}>${points.length ? `<Array as="points">${points.join('')}</Array>` : ''}</mxGeometry>`;
|
|
176
|
+
const cell = `<mxCell${attrs({ style, edge: 1, parent: '1', source: sc.source, target: sc.target })}>${geometry}</mxCell>`;
|
|
177
|
+
cells.push(rel
|
|
178
|
+
? `<object${attrs({ id: sc.id, label: rel.name ?? '', archimateId: rel.id, archimateType: kind, ...propertyAttrs(rel.properties) })}>${cell}</object>`
|
|
179
|
+
: `<mxCell${attrs({ id: sc.id, value: sc.name ?? '', style, edge: 1, parent: '1', source: sc.source, target: sc.target })}>${geometry}</mxCell>`);
|
|
180
|
+
}
|
|
181
|
+
return ` <diagram${attrs({ id: view.id, name: view.name || view.id })}>\n <mxGraphModel${attrs({ grid: 1, gridSize: 10, guides: 1, tooltips: 1, connect: 1, arrows: 1, fold: 1, page: 1, pageScale: 1, math: 0, shadow: 0 })}>\n <root>\n <mxCell id="0"/>\n <mxCell id="1" parent="0"/>\n${cells.map(c => ` ${c}\n`).join('')} </root>\n </mxGraphModel>\n </diagram>\n`;
|
|
182
|
+
}
|