@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,29 @@
|
|
|
1
|
+
import { Edge } from '../Edge.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* DerivedEdge — a derived relationship drawn on a view (DerivedRelationships):
|
|
5
|
+
* one the model implies through a chain of structural relationships but does
|
|
6
|
+
* not hold. It is shown dotted, labelled with its chain (e.g.
|
|
7
|
+
* "composition→assignment"), and cannot be selected or edited: it is not in
|
|
8
|
+
* the model or the view, only drawn from them.
|
|
9
|
+
*/
|
|
10
|
+
export class DerivedEdge extends Edge {
|
|
11
|
+
/**
|
|
12
|
+
* @param {Object} derived - As DerivedRelationships.compute gives it: {id, pathSummary, distance, ...}
|
|
13
|
+
* @param {string} sourceId - The source element's box on the view
|
|
14
|
+
* @param {string} targetId - The target element's box on the view
|
|
15
|
+
*/
|
|
16
|
+
constructor(derived, sourceId, targetId) {
|
|
17
|
+
super(derived.id, sourceId, targetId, { label: derived.pathSummary, lineStyle: 'dotted', endMarker: 'arrow' });
|
|
18
|
+
this.derived = derived;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Drawn only: not selectable, movable or deletable. */
|
|
22
|
+
get editable() {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
get tooltip() {
|
|
27
|
+
return `Derived: ${this.derived.pathSummary}`;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ModelFileFormat } from '../ModelFileFormat.js';
|
|
2
|
+
import { toDrawioXML } from '../../archimateDrawio.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* draw.io (diagrams.net): every view a page, in draw.io's ArchiMate shapes
|
|
6
|
+
* (archimateDrawio.js). Export only: a draw.io file is a drawing, not a model.
|
|
7
|
+
*/
|
|
8
|
+
export class DrawioFileFormat extends ModelFileFormat {
|
|
9
|
+
get label() { return 'draw.io (.drawio)'; }
|
|
10
|
+
get accept() { return '.drawio'; }
|
|
11
|
+
get fileName() { return 'model.drawio'; }
|
|
12
|
+
get featureName() { return 'Drawio'; }
|
|
13
|
+
|
|
14
|
+
/** A drawing does not come back as a model. */
|
|
15
|
+
get imports() { return false; }
|
|
16
|
+
|
|
17
|
+
recognizes() {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export(model) {
|
|
22
|
+
return { data: toDrawioXML(model), mimeType: 'application/xml' };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { EmphasisRule } from '../emphasis/EmphasisRule.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ElementFilterRule — a filter's result on an ArchiMate view: shapes of the
|
|
5
|
+
* model elements it kept are drawn as usual, every other element dimmed.
|
|
6
|
+
* Notes, groups and canvas boxes are not model elements, and a filter never
|
|
7
|
+
* dims them. Lines are left as they are.
|
|
8
|
+
*/
|
|
9
|
+
export class ElementFilterRule extends EmphasisRule {
|
|
10
|
+
/** @param {Iterable<string>} elementIds - The model elements the filter kept */
|
|
11
|
+
constructor(elementIds) {
|
|
12
|
+
super();
|
|
13
|
+
this.elementIds = new Set(elementIds);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
template(template, editor) {
|
|
17
|
+
const elementId = template.instance?.elementId;
|
|
18
|
+
if (!elementId || !editor.model?.getElement?.(elementId)) return null;
|
|
19
|
+
return this.elementIds.has(elementId) ? null : 'dimmed';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ModelFileFormat } from '../ModelFileFormat.js';
|
|
2
|
+
import { toArchimateModel, toArchiExport } from '../../archimateArchiFormat.js';
|
|
3
|
+
import { parseExchangeModel, toExchangeXML } from '../../archimateExchangeFormat.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The Open Group Exchange Format (.xml), the standard route to other
|
|
7
|
+
* ArchiMate tools. Only ArchiMate diagrams are written: the format has no
|
|
8
|
+
* canvases or sketches.
|
|
9
|
+
*/
|
|
10
|
+
export class ExchangeFileFormat extends ModelFileFormat {
|
|
11
|
+
get label() { return 'Exchange Format (.xml)'; }
|
|
12
|
+
get accept() { return '.xml'; }
|
|
13
|
+
get fileName() { return 'model.xml'; }
|
|
14
|
+
get featureName() { return 'Exchange'; }
|
|
15
|
+
|
|
16
|
+
/** An Exchange file names the Open Group's namespace. */
|
|
17
|
+
recognizes(xml) {
|
|
18
|
+
return /opengroup\.org\/xsd\/archimate/.test(String(xml).slice(0, 4000));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export(model) {
|
|
22
|
+
return { data: toExchangeXML(...toArchiExport(model)), mimeType: 'application/xml' };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
import(xml) {
|
|
26
|
+
return toArchimateModel(parseExchangeModel(xml));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { GlyphTemplate } from '../templates/GlyphTemplate.js';
|
|
2
|
+
import { Glyph } from '../glyphs/Glyph.js';
|
|
3
|
+
import { TabbedBoxGlyph, TAB_HEIGHT } from '../glyphs/TabbedBoxGlyph.js';
|
|
4
|
+
import { TextStyle, TEXT_STYLE_KEYS } from '../TextStyle.js';
|
|
5
|
+
|
|
6
|
+
/** Archi's grey for a group with no fill of its own. */
|
|
7
|
+
export const GROUP_FILL = '#d2d7d7';
|
|
8
|
+
|
|
9
|
+
/** Paint a group keeps on its layout entry (as an instance keeps its appearance). */
|
|
10
|
+
const APPEARANCE = ['fillColor', 'strokeColor', 'strokeWidth', 'textColor', ...TEXT_STYLE_KEYS];
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* ViewGroupTemplate — a group drawn on an ArchiMate view (an Archi group), as
|
|
14
|
+
* an editor template: Archi's box with a name tab. Like
|
|
15
|
+
* ArchimateElementTemplate it keeps nothing of its own: its bounds, stacking
|
|
16
|
+
* and paint live in the view's `folderLayout` entry for it (top-left x/y,
|
|
17
|
+
* width, height, zIndex, appearance), and its name on the model folder it
|
|
18
|
+
* draws. So the editor's move, resize, restack and repaint commands edit the
|
|
19
|
+
* view, and undo there. What it contains moves with it
|
|
20
|
+
* (ArchimateCanvasEditor#containedIn).
|
|
21
|
+
*/
|
|
22
|
+
export class ViewGroupTemplate extends GlyphTemplate {
|
|
23
|
+
static rotatable = false;
|
|
24
|
+
|
|
25
|
+
/** The format painter copies its appearance. */
|
|
26
|
+
static formatKeys = Object.freeze([...APPEARANCE]);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @param {string} folderId - The model folder the group draws
|
|
30
|
+
* @param {ArchimateView} view - Holds its layout entry
|
|
31
|
+
*/
|
|
32
|
+
constructor(folderId, view) {
|
|
33
|
+
super(folderId, undefined, {});
|
|
34
|
+
this.view = view;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** State lives on the view's layout entry and the model folder. @protected */
|
|
38
|
+
_initState() {}
|
|
39
|
+
|
|
40
|
+
/** The view's layout entry for this group. */
|
|
41
|
+
get layout() {
|
|
42
|
+
return this.view.folderLayout[this.id];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** The model folder this group draws. */
|
|
46
|
+
get folder() {
|
|
47
|
+
return this.view.model.getFolder(this.id);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
get name() { return this.folder?.name ?? 'Group'; }
|
|
51
|
+
set name(value) { if (this.folder) this.folder.name = value || 'Group'; }
|
|
52
|
+
|
|
53
|
+
// The layout keeps the top-left corner; a template is placed by its centre.
|
|
54
|
+
get x() { return this.layout.x + this.width / 2; }
|
|
55
|
+
set x(value) { this.layout.x = value - this.width / 2; }
|
|
56
|
+
get y() { return this.layout.y + this.height / 2; }
|
|
57
|
+
set y(value) { this.layout.y = value - this.height / 2; }
|
|
58
|
+
get width() { return this.layout.width ?? 400; }
|
|
59
|
+
set width(value) { const x = this.x; this.layout.width = value; this.x = x; }
|
|
60
|
+
get height() { return this.layout.height ?? 140; }
|
|
61
|
+
set height(value) { const y = this.y; this.layout.height = value; this.y = y; }
|
|
62
|
+
get zIndex() { return this.layout.zIndex ?? 0; }
|
|
63
|
+
set zIndex(value) { this.layout.zIndex = value ?? 0; }
|
|
64
|
+
get visible() { return true; }
|
|
65
|
+
set visible(_) {}
|
|
66
|
+
|
|
67
|
+
get fillColor() { return this._appearance.fillColor ?? GROUP_FILL; }
|
|
68
|
+
set fillColor(value) { this._setAppearance('fillColor', value); }
|
|
69
|
+
get fillOpacity() { return 1; }
|
|
70
|
+
set fillOpacity(_) {}
|
|
71
|
+
get strokeColor() { return this._appearance.strokeColor ?? '#5c5c5c'; }
|
|
72
|
+
set strokeColor(value) { this._setAppearance('strokeColor', value); }
|
|
73
|
+
get strokeWidth() { return this._appearance.strokeWidth ?? 1; }
|
|
74
|
+
set strokeWidth(value) { this._setAppearance('strokeWidth', value); }
|
|
75
|
+
get textColor() { return this._appearance.textColor ?? '#222'; }
|
|
76
|
+
set textColor(value) { this._setAppearance('textColor', value); }
|
|
77
|
+
get fontFamily() { return this._appearance.fontFamily; }
|
|
78
|
+
set fontFamily(value) { this._setAppearance('fontFamily', value); }
|
|
79
|
+
get fontSize() { return this._appearance.fontSize; }
|
|
80
|
+
set fontSize(value) { this._setAppearance('fontSize', value); }
|
|
81
|
+
get fontWeight() { return this._appearance.fontWeight; }
|
|
82
|
+
set fontWeight(value) { this._setAppearance('fontWeight', value); }
|
|
83
|
+
get fontStyle() { return this._appearance.fontStyle; }
|
|
84
|
+
set fontStyle(value) { this._setAppearance('fontStyle', value); }
|
|
85
|
+
get textDecoration() { return this._appearance.textDecoration; }
|
|
86
|
+
set textDecoration(value) { this._setAppearance('textDecoration', value); }
|
|
87
|
+
get textAlign() { return this._appearance.textAlign; }
|
|
88
|
+
set textAlign(value) { this._setAppearance('textAlign', value); }
|
|
89
|
+
get textPosition() { return this._appearance.textPosition; }
|
|
90
|
+
set textPosition(value) { this._setAppearance('textPosition', value); }
|
|
91
|
+
|
|
92
|
+
/** What the group sets itself (undefined: the default), for commands that undo to "unset". */
|
|
93
|
+
ownProperty(key) {
|
|
94
|
+
if (APPEARANCE.includes(key)) return this._appearance[key];
|
|
95
|
+
return this[key];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** @private */
|
|
99
|
+
get _appearance() {
|
|
100
|
+
return this.layout.appearance ?? {};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** @private */
|
|
104
|
+
_setAppearance(key, value) {
|
|
105
|
+
const appearance = { ...this._appearance };
|
|
106
|
+
if (value === undefined) delete appearance[key];
|
|
107
|
+
else appearance[key] = value;
|
|
108
|
+
this.layout.appearance = appearance;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
glyph() {
|
|
112
|
+
return new TabbedBoxGlyph();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
glyphContext() {
|
|
116
|
+
return Glyph.context({
|
|
117
|
+
R: Math.max(this.width, this.height) / 2,
|
|
118
|
+
size: { w: this.width, h: this.height },
|
|
119
|
+
color: this.fillColor === 'none' ? 'none' : this.fillColor,
|
|
120
|
+
strokeColor: this.strokeColor === 'none' ? 'none' : this.strokeColor,
|
|
121
|
+
strokeWidth: this.strokeWidth,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** The name in the tab, as Archi writes it. */
|
|
126
|
+
_renderLabel(g, doc) {
|
|
127
|
+
const font = TextStyle.svgAttributes(this.textStyle, { defaultPixels: 11 });
|
|
128
|
+
const t = doc.createElementNS('http://www.w3.org/2000/svg', 'text');
|
|
129
|
+
const attrs = {
|
|
130
|
+
x: this.x - this.width / 2 + 6, y: this.y - this.height / 2 + TAB_HEIGHT - 5,
|
|
131
|
+
'pointer-events': 'none', 'font-family': 'sans-serif', ...font, fill: this.textColor,
|
|
132
|
+
};
|
|
133
|
+
for (const [k, v] of Object.entries(attrs)) t.setAttribute(k, String(v));
|
|
134
|
+
t.textContent = this.name;
|
|
135
|
+
g.appendChild(t);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Edge } from '../Edge.js';
|
|
2
|
+
import { EDGE_STYLE_PROPERTIES } from '../edgeStyle/EdgeStyleSchema.js';
|
|
3
|
+
|
|
4
|
+
/** Style keys the line's Archi type bits decide (dashes, arrows). */
|
|
5
|
+
const TYPE_KEYS = ['lineStyle', 'startMarker', 'endMarker'];
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ViewLineEdge — a plain line on an ArchiMate view (ViewConnectionInstance: a
|
|
9
|
+
* canvas connection, or a line from a note), as an editor line. Like
|
|
10
|
+
* ArchimateEdge it keeps nothing of its own: its ends, label, route and colour
|
|
11
|
+
* are the line's, so the editor's commands edit the view and undo there. Its
|
|
12
|
+
* dashes and arrows come from the line's type bits (Archi's) and are not set
|
|
13
|
+
* here.
|
|
14
|
+
*/
|
|
15
|
+
export class ViewLineEdge extends Edge {
|
|
16
|
+
/** @param {ViewConnectionInstance} line */
|
|
17
|
+
constructor(line) {
|
|
18
|
+
super(line.id, undefined, undefined, {});
|
|
19
|
+
this.line = line;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Everything lives on the line. @protected */
|
|
23
|
+
_initState() {}
|
|
24
|
+
|
|
25
|
+
get sourceId() { return this.line.sourceInstanceId; }
|
|
26
|
+
set sourceId(id) { this.line.sourceInstanceId = id; }
|
|
27
|
+
get targetId() { return this.line.targetInstanceId; }
|
|
28
|
+
set targetId(id) { this.line.targetInstanceId = id; }
|
|
29
|
+
|
|
30
|
+
get label() { return this.line.label ?? ''; }
|
|
31
|
+
set label(value) { this.line.label = value || ''; }
|
|
32
|
+
|
|
33
|
+
get waypoints() { return this.line.waypoints; }
|
|
34
|
+
set waypoints(points) { this.line.waypoints = (points ?? []).map(({ x, y }) => ({ x, y })); }
|
|
35
|
+
|
|
36
|
+
addWaypoint(x, y, index = this.line.waypoints.length) { this.line.waypoints.splice(index, 0, { x, y }); }
|
|
37
|
+
removeWaypoint(index) { if (index >= 0 && index < this.line.waypoints.length) this.line.waypoints.splice(index, 1); }
|
|
38
|
+
moveWaypoint(index, x, y) { if (index >= 0 && index < this.line.waypoints.length) this.line.waypoints[index] = { x, y }; }
|
|
39
|
+
clearWaypoints() { this.line.waypoints = []; }
|
|
40
|
+
|
|
41
|
+
get sourceSide() { return this.line.sourceSide ?? 'auto'; }
|
|
42
|
+
set sourceSide(side) { this.line.sourceSide = side && side !== 'auto' ? side : undefined; }
|
|
43
|
+
get targetSide() { return this.line.targetSide ?? 'auto'; }
|
|
44
|
+
set targetSide(side) { this.line.targetSide = side && side !== 'auto' ? side : undefined; }
|
|
45
|
+
|
|
46
|
+
get visible() { return this.line.visible; }
|
|
47
|
+
set visible(value) { this.line.visible = value !== false; }
|
|
48
|
+
|
|
49
|
+
/** Dashes and arrows from the line's type bits, as edge style values. */
|
|
50
|
+
get typeStyle() {
|
|
51
|
+
return { lineStyle: this.line.lineStyle, startMarker: this.line.arrowhead('source'), endMarker: this.line.arrowhead('target') };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Every style property but the dashes and arrows, which the line's type bits decide. */
|
|
55
|
+
get styleProperties() {
|
|
56
|
+
return EDGE_STYLE_PROPERTIES.filter(p => !TYPE_KEYS.includes(p.key));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** A plain Edge with this line's route and style. */
|
|
60
|
+
clone() {
|
|
61
|
+
return new Edge(this.id, this.sourceId, this.targetId, {
|
|
62
|
+
label: this.label, waypoints: this.waypoints, sourceSide: this.sourceSide, targetSide: this.targetSide,
|
|
63
|
+
visible: this.visible, ...this.styleOverrides(),
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Style: dashes and arrows from the type bits (read-only), the rest per line on its appearance.
|
|
69
|
+
for (const { key } of EDGE_STYLE_PROPERTIES) {
|
|
70
|
+
Object.defineProperty(ViewLineEdge.prototype, key, TYPE_KEYS.includes(key)
|
|
71
|
+
? {
|
|
72
|
+
get() { return this.typeStyle[key]; },
|
|
73
|
+
set() { throw new TypeError(`A plain line's ${key} comes from its type`); },
|
|
74
|
+
configurable: true,
|
|
75
|
+
}
|
|
76
|
+
: {
|
|
77
|
+
get() { return this.line.appearance[key]; },
|
|
78
|
+
set(value) {
|
|
79
|
+
if (value === undefined) delete this.line.appearance[key];
|
|
80
|
+
else this.line.appearance = { ...this.line.appearance, [key]: value };
|
|
81
|
+
},
|
|
82
|
+
configurable: true,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { EmphasisRule } from '../emphasis/EmphasisRule.js';
|
|
2
|
+
import { ArchimateViewpoints } from '../../archimate.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* ViewpointRule — an ArchiMate viewpoint on a view: elements of a type the
|
|
6
|
+
* viewpoint does not allow are faded (mode 'fade') or hidden ('hide'), as
|
|
7
|
+
* Archi ghosts them. A line between two allowed elements is drawn as usual,
|
|
8
|
+
* one with a single allowed end faded, and one between two that are not
|
|
9
|
+
* allowed is hidden. Notes, groups and canvas boxes are not elements, and a
|
|
10
|
+
* viewpoint leaves them alone.
|
|
11
|
+
*/
|
|
12
|
+
export class ViewpointRule extends EmphasisRule {
|
|
13
|
+
/**
|
|
14
|
+
* @param {Object} options
|
|
15
|
+
* @param {string} options.viewpoint - A viewpoint name ('All' or none: everything is allowed)
|
|
16
|
+
* @param {'fade'|'hide'} [options.mode]
|
|
17
|
+
* @param {string} [options.version] - ArchiMate version ('4', '3.2')
|
|
18
|
+
* @param {Array<Object>} [options.customViewpoints]
|
|
19
|
+
*/
|
|
20
|
+
constructor({ viewpoint, mode = 'fade', version = '4', customViewpoints = [] }) {
|
|
21
|
+
super();
|
|
22
|
+
this.viewpoint = viewpoint && viewpoint !== 'All' ? viewpoint : null;
|
|
23
|
+
this.mode = mode;
|
|
24
|
+
this.version = version;
|
|
25
|
+
this.customViewpoints = customViewpoints;
|
|
26
|
+
this._allowed = this.viewpoint ? new Set(ArchimateViewpoints.allowedElementTypes(this.viewpoint, version, customViewpoints)) : null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Whether a shape is outside the viewpoint: a model element of a type it does not allow. */
|
|
30
|
+
excludes(template, editor) {
|
|
31
|
+
if (!this._allowed || !template) return false;
|
|
32
|
+
const element = editor.model?.getElement?.(template.instance?.elementId);
|
|
33
|
+
return !!element && !this._allowed.has(element.type);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
template(template, editor) {
|
|
37
|
+
if (!this.excludes(template, editor)) return null;
|
|
38
|
+
return this.mode === 'hide' ? 'hidden' : 'faded';
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
edge(edge, editor) {
|
|
42
|
+
const out = [edge.sourceId, edge.targetId].filter(id => this.excludes(editor.templates.get(id), editor)).length;
|
|
43
|
+
return [null, 'faded', 'hidden'][out];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ArchimateCsvFileFormat } from './ArchimateCsvFileFormat.js';
|
|
2
|
+
import { ArchiFileFormat } from './ArchiFileFormat.js';
|
|
3
|
+
import { ExchangeFileFormat } from './ExchangeFileFormat.js';
|
|
4
|
+
import { DrawioFileFormat } from './DrawioFileFormat.js';
|
|
5
|
+
|
|
6
|
+
/** The file formats an ArchiMate model is exported to and imported from, in File menu order. */
|
|
7
|
+
export const ARCHIMATE_FILE_FORMATS = Object.freeze([
|
|
8
|
+
new ArchimateCsvFileFormat(),
|
|
9
|
+
new ArchiFileFormat(),
|
|
10
|
+
new ExchangeFileFormat(),
|
|
11
|
+
new DrawioFileFormat(),
|
|
12
|
+
]);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Title for a type name: 'business-actor' → 'Business Actor'. */
|
|
2
|
+
export const typeTitle = (name) => name.replace(/(^|-)(\w)/g, (_, dash, c) => (dash ? ' ' : '') + c.toUpperCase());
|
|
3
|
+
|
|
4
|
+
/** dataTransfer type an ArchiMate palette tile carries: the element type's name. */
|
|
5
|
+
export const ARCHIMATE_TYPE_MIME = 'application/x-archimate-type';
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { ArchimateNotation } from '../../archimate.js';
|
|
2
|
+
import { ArchimateValidator } from '../diagrams/ArchimateValidator.js';
|
|
3
|
+
import { typeTitle } from './archimateNames.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A spreadsheet's rows as model elements (the load_csv / importCSV jArchi
|
|
7
|
+
* scripts): which column holds the name, the type (or one type for every
|
|
8
|
+
* row), an id, the documentation, which columns are properties, and one
|
|
9
|
+
* whose cells name elements a row's element is related to. Pure: it plans;
|
|
10
|
+
* ImportCsvCommand carries the plan out.
|
|
11
|
+
*
|
|
12
|
+
* A row whose id (or, without an id column, whose name and type) is an
|
|
13
|
+
* element the model has updates it rather than making a second; rows that
|
|
14
|
+
* name the same element are one element.
|
|
15
|
+
*
|
|
16
|
+
* Mapping: `{ name, type?, fixedType?, id?, documentation?, properties?: [column],
|
|
17
|
+
* related?, relatedKind?, relatedDirection?: 'out'|'in' }`, columns by name.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/** A type written in a cell ("business-actor", "Business Actor", "business actor") as its name, or null. */
|
|
21
|
+
export function resolveElementType(text, version = '4') {
|
|
22
|
+
// Archi's CSV writes CamelCase (BusinessActor): a capital after a letter starts a word.
|
|
23
|
+
const wanted = String(text ?? '').trim().replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase().replace(/[\s_]+/g, '-');
|
|
24
|
+
if (!wanted) return null;
|
|
25
|
+
// A title is its name with spaces (Business Actor: business-actor), so one comparison covers both.
|
|
26
|
+
return ArchimateNotation.elementTypeNames(version).find(t => t === wanted) ?? null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The plan for importing a table's rows into a model.
|
|
31
|
+
* @param {{columns, rows}} table - parseCsvTable's
|
|
32
|
+
* @param {Object} mapping
|
|
33
|
+
* @param {ArchimateModel} model
|
|
34
|
+
* @param {{version?: string}} [options]
|
|
35
|
+
* @returns {{creates: Array<Object>, updates: Array<{element, changes}>, relationships: Array<Object>, problems: Array<{row: number, message: string}>}}
|
|
36
|
+
* `row` counts from 2, as a spreadsheet numbers the rows under its header
|
|
37
|
+
*/
|
|
38
|
+
export function planCsvImport({ rows }, mapping, model, { version = '4' } = {}) {
|
|
39
|
+
const problems = [];
|
|
40
|
+
const creates = [];
|
|
41
|
+
const updates = new Map(); // element id -> { element, changes }
|
|
42
|
+
const byKey = new Map(); // an id, or a type+name, -> the element (existing or planned)
|
|
43
|
+
const key = (type, name) => `${type} ${String(name).trim().toLowerCase().replace(/\s+/g, ' ')}`;
|
|
44
|
+
for (const e of model.elements()) { byKey.set(`id ${e.id}`, e); byKey.set(key(e.type, e.name ?? ''), e); }
|
|
45
|
+
const existingIds = new Set(model.elements().map(e => e.id));
|
|
46
|
+
const newId = (type, name) => {
|
|
47
|
+
const base = `${type}-${String(name).trim().toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '') || 'element'}`;
|
|
48
|
+
let id = base, n = 2;
|
|
49
|
+
while (existingIds.has(id)) id = `${base}-${n++}`;
|
|
50
|
+
existingIds.add(id);
|
|
51
|
+
return id;
|
|
52
|
+
};
|
|
53
|
+
const rowElement = []; // per row, the element it names (or null)
|
|
54
|
+
|
|
55
|
+
rows.forEach((row, i) => {
|
|
56
|
+
const at = i + 2;
|
|
57
|
+
const name = String(row[mapping.name] ?? '').trim();
|
|
58
|
+
if (!name) { problems.push({ row: at, message: 'no name' }); rowElement.push(null); return; }
|
|
59
|
+
const typeText = mapping.type ? row[mapping.type] : mapping.fixedType;
|
|
60
|
+
const type = resolveElementType(typeText, version);
|
|
61
|
+
if (!type) { problems.push({ row: at, message: `"${typeText ?? ''}" is not an element type` }); rowElement.push(null); return; }
|
|
62
|
+
const id = mapping.id ? String(row[mapping.id] ?? '').trim() : '';
|
|
63
|
+
const found = (id && byKey.get(`id ${id}`)) || byKey.get(key(type, name));
|
|
64
|
+
const documentation = mapping.documentation ? String(row[mapping.documentation] ?? '').trim() : '';
|
|
65
|
+
const properties = (mapping.properties ?? [])
|
|
66
|
+
.map(column => ({ name: column, type: 'string', value: String(row[column] ?? '').trim() }))
|
|
67
|
+
.filter(p => p.value !== '');
|
|
68
|
+
if (found && !creates.includes(found)) {
|
|
69
|
+
// An element the model has: what the row says that it does not.
|
|
70
|
+
const entry = updates.get(found.id) ?? { element: found, changes: {} };
|
|
71
|
+
if (documentation && documentation !== (found.documentation ?? '')) entry.changes.documentation = documentation;
|
|
72
|
+
if (properties.length) {
|
|
73
|
+
const merged = [...(entry.changes.properties ?? found.properties ?? []).map(p => ({ ...p }))];
|
|
74
|
+
for (const p of properties) {
|
|
75
|
+
const same = merged.find(q => (q.name ?? q.key) === p.name);
|
|
76
|
+
if (same) same.value = p.value; else merged.push(p);
|
|
77
|
+
}
|
|
78
|
+
if (JSON.stringify(merged) !== JSON.stringify(found.properties ?? [])) entry.changes.properties = merged;
|
|
79
|
+
}
|
|
80
|
+
if (Object.keys(entry.changes).length) updates.set(found.id, entry);
|
|
81
|
+
rowElement.push(found);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (found) { // a later row naming an element planned already: what it adds
|
|
85
|
+
if (documentation && !found.documentation) found.documentation = documentation;
|
|
86
|
+
for (const p of properties) if (!found.properties.some(q => q.name === p.name)) found.properties.push(p);
|
|
87
|
+
rowElement.push(found);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const element = { id: id && !existingIds.has(id) ? (existingIds.add(id), id) : newId(type, name), name, type, ...(documentation && { documentation }), properties };
|
|
91
|
+
creates.push(element);
|
|
92
|
+
byKey.set(`id ${element.id}`, element);
|
|
93
|
+
byKey.set(key(type, name), element);
|
|
94
|
+
rowElement.push(element);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// Relationships: each name or id in a row's related cell (several split by ";").
|
|
98
|
+
const relationships = [];
|
|
99
|
+
if (mapping.related && mapping.relatedKind) {
|
|
100
|
+
const named = (text) => byKey.get(`id ${text}`) ?? [...byKey.values()].find(e => (e.name ?? '').trim().toLowerCase() === text.toLowerCase());
|
|
101
|
+
const have = new Set(model.relationships().map(r => `${r.kind} ${r.source} ${r.target}`));
|
|
102
|
+
rows.forEach((row, i) => {
|
|
103
|
+
const element = rowElement[i];
|
|
104
|
+
if (!element) return;
|
|
105
|
+
for (const text of String(row[mapping.related] ?? '').split(';').map(t => t.trim()).filter(Boolean)) {
|
|
106
|
+
const other = named(text);
|
|
107
|
+
if (!other) { problems.push({ row: i + 2, message: `no element "${text}" to relate to` }); continue; }
|
|
108
|
+
const [source, target] = mapping.relatedDirection === 'in' ? [other, element] : [element, other];
|
|
109
|
+
const allowed = ArchimateValidator.allowedKinds(source, target, version);
|
|
110
|
+
if (mapping.relatedKind !== 'association' && !allowed.includes(mapping.relatedKind)) {
|
|
111
|
+
problems.push({ row: i + 2, message: `${typeTitle(source.type)} to ${typeTitle(target.type)}: not ${mapping.relatedKind}` });
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
const k = `${mapping.relatedKind} ${source.id} ${target.id}`;
|
|
115
|
+
if (have.has(k)) continue;
|
|
116
|
+
have.add(k);
|
|
117
|
+
relationships.push({ id: `${source.id}-${mapping.relatedKind}-${target.id}`, source: source.id, target: target.id, kind: mapping.relatedKind });
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return { creates, updates: [...updates.values()], relationships, problems };
|
|
122
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What can be done with a model element from the model tree, as menu items:
|
|
3
|
+
* its properties; the views it is on (choosing one shows it there, selected);
|
|
4
|
+
* adding it to the current view when it is not there; a view of it and what
|
|
5
|
+
* it relates to. One definition for both editors; each says how it opens a
|
|
6
|
+
* view, edits, and adds.
|
|
7
|
+
* @param {Object} element - A model element
|
|
8
|
+
* @param {Object} host
|
|
9
|
+
* @param {ArchimateModel} host.model
|
|
10
|
+
* @param {ArchimateView} [host.view] - The view open now
|
|
11
|
+
* @param {(element) => void} host.editProperties
|
|
12
|
+
* @param {(view, instanceId) => void} host.showIn - Open `view` with that box selected
|
|
13
|
+
* @param {(element) => void} [host.addToView] - Show it on `view` (offered when it is not there)
|
|
14
|
+
* @returns {Array<Object>} menu items
|
|
15
|
+
*/
|
|
16
|
+
export function elementMenuItems(element, { model, view = null, editProperties, showIn, addToView = null }) {
|
|
17
|
+
const placed = model.views()
|
|
18
|
+
.map(v => ({ view: v, instance: v.elementInstancesFor?.(element.id)?.[0] }))
|
|
19
|
+
.filter(({ instance }) => instance);
|
|
20
|
+
const onThisView = placed.find(p => p.view === view);
|
|
21
|
+
return [
|
|
22
|
+
{ label: 'Properties…', action: () => editProperties(element) },
|
|
23
|
+
placed.length
|
|
24
|
+
? {
|
|
25
|
+
label: `Show in View (${placed.length})`,
|
|
26
|
+
items: placed.map(({ view: v, instance }) => ({ label: v.name || v.id, checked: v === view, action: () => showIn(v, instance.id) })),
|
|
27
|
+
}
|
|
28
|
+
: { label: 'Show in View (on none)', disabled: true, action: () => {} },
|
|
29
|
+
...(addToView && view && !onThisView ? [{ label: `Add to "${view.name || 'this view'}"`, action: () => addToView(element) }] : []),
|
|
30
|
+
{ label: 'Generate View For This', action: () => model.generateView([element.id]) },
|
|
31
|
+
];
|
|
32
|
+
}
|