@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,158 @@
|
|
|
1
|
+
import { Glyph, glyphFor, drawGlyph } from '../glyphs/index.js';
|
|
2
|
+
import { GraphMetrics } from './GraphMetrics.js';
|
|
3
|
+
import { LabelHelper } from './LabelHelper.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* NodeGeometry — pure, stateless helpers for graph node sizing, corners,
|
|
7
|
+
* resize-handle math, and table-node geometry.
|
|
8
|
+
*
|
|
9
|
+
* These used to live on RenderEngine; they are collected here so diagram
|
|
10
|
+
* classes can compute node geometry without going through the engine façade.
|
|
11
|
+
*/
|
|
12
|
+
export class NodeGeometry {
|
|
13
|
+
static TABLE_NODE = { width: 170, headerH: 26, rowH: 18, pad: 6 };
|
|
14
|
+
|
|
15
|
+
/** Bounding box a node occupies, centred on its (x,y) — {w:2R,h:2R} for
|
|
16
|
+
* the plain default (sized by GraphMetrics.effectiveNodeRadius when a
|
|
17
|
+
* `sizeDomain` is supplied), the real card size for a `shape:'table'`
|
|
18
|
+
* node (see NodeGeometry.tableNodeSize), or, for any OTHER shape, an
|
|
19
|
+
* explicit `node.width`/`node.height` override for a wider-than-tall box. */
|
|
20
|
+
static nodeSize(node, R, sizeDomain, sizeOptions) {
|
|
21
|
+
if (node?.shape === 'table') return NodeGeometry.tableNodeSize(node);
|
|
22
|
+
const radius = GraphMetrics ? GraphMetrics.effectiveNodeRadius(node, R, sizeDomain, sizeOptions) : R;
|
|
23
|
+
if (Number.isFinite(node?.width) || Number.isFinite(node?.height)) {
|
|
24
|
+
return {
|
|
25
|
+
w: Number.isFinite(node.width) ? node.width : radius * 2,
|
|
26
|
+
h: Number.isFinite(node.height) ? node.height : radius * 2,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return { w: radius * 2, h: radius * 2 };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Size of a `shape:'table'` node — column-count-driven, never affected
|
|
33
|
+
* by node.size/sizeDomain. */
|
|
34
|
+
static tableNodeSize(node) {
|
|
35
|
+
const { width, headerH, rowH, pad } = NodeGeometry.TABLE_NODE;
|
|
36
|
+
const cols = node.columns?.length ?? 0;
|
|
37
|
+
return { w: node.width || width, h: headerH + cols * rowH + pad };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** World-space Y of a named column's row within a table node, for edge anchoring. */
|
|
41
|
+
static tableColumnY(node, posEntry, size, colName) {
|
|
42
|
+
const { headerH, rowH } = NodeGeometry.TABLE_NODE;
|
|
43
|
+
const idx = Math.max(0, (node.columns ?? []).findIndex(c => c.name === colName));
|
|
44
|
+
return posEntry.y - size.h / 2 + headerH + idx * rowH + rowH / 2;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Draws a table-card node's header + one row per column into wrapper `g`. */
|
|
48
|
+
static buildTableNodeContent(renderer, g, node) {
|
|
49
|
+
const { headerH, rowH } = NodeGeometry.TABLE_NODE;
|
|
50
|
+
const { w, h } = NodeGeometry.tableNodeSize(node);
|
|
51
|
+
const cols = node.columns ?? [];
|
|
52
|
+
const x0 = -w / 2, y0 = -h / 2;
|
|
53
|
+
const borderColor = node.selected ? '#4f8ef7' : '#cfd8dc';
|
|
54
|
+
const borderWidth = node.selected ? 2 : 1;
|
|
55
|
+
|
|
56
|
+
const TYPE_COLORS = { NUMBER: '#74b9ff', TEXT: '#a29bfe', TIMESTAMP: '#55efc4', BOOLEAN: '#ffeaa7', JSON: '#fd79a8', UNKNOWN: '#dfe6e9' };
|
|
57
|
+
g.appendChild(renderer.rect(x0, y0, w, h, '#ffffff', { color: borderColor, width: borderWidth }));
|
|
58
|
+
g.appendChild(renderer.rect(x0, y0, w, headerH, '#1976d2', null));
|
|
59
|
+
g.appendChild(renderer.text(LabelHelper.resolveNodeLabel(node), x0 + 8, y0 + headerH / 2, {
|
|
60
|
+
fill: '#fff', textAnchor: 'start', verticalAlign: 'middle', fontSize: '11px', fontWeight: 'bold', 'pointer-events': 'none',
|
|
61
|
+
}));
|
|
62
|
+
if (node.rowCount != null) {
|
|
63
|
+
g.appendChild(renderer.text(String(node.rowCount), x0 + w - 8, y0 + headerH / 2, {
|
|
64
|
+
fill: '#cfe3fb', textAnchor: 'end', verticalAlign: 'middle', fontSize: '9px', 'pointer-events': 'none',
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
cols.forEach((col, i) => {
|
|
69
|
+
const rowY = y0 + headerH + i * rowH;
|
|
70
|
+
g.appendChild(renderer.circle(x0 + 12, rowY + rowH / 2, 3.5, TYPE_COLORS[col.typeGroup] ?? TYPE_COLORS.UNKNOWN, null));
|
|
71
|
+
g.appendChild(renderer.text(col.name, x0 + 20, rowY + rowH / 2, {
|
|
72
|
+
fill: '#333', textAnchor: 'start', verticalAlign: 'middle', fontSize: '10px', 'pointer-events': 'none',
|
|
73
|
+
}));
|
|
74
|
+
let badgeX = x0 + w - 8;
|
|
75
|
+
if (col.isFK) {
|
|
76
|
+
g.appendChild(renderer.text('FK', badgeX, rowY + rowH / 2, {
|
|
77
|
+
fill: '#e67e22', textAnchor: 'end', verticalAlign: 'middle', fontSize: '8px', fontWeight: 'bold', 'pointer-events': 'none',
|
|
78
|
+
}));
|
|
79
|
+
badgeX -= 18;
|
|
80
|
+
}
|
|
81
|
+
if (col.isPK) {
|
|
82
|
+
g.appendChild(renderer.text('PK', badgeX, rowY + rowH / 2, {
|
|
83
|
+
fill: '#00b894', textAnchor: 'end', verticalAlign: 'middle', fontSize: '8px', fontWeight: 'bold', 'pointer-events': 'none',
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Pure. The point at a given corner of a `size` (`{w,h}`) box centred on
|
|
90
|
+
* `pos` — shared by the resize handle's screen positioning and a node's
|
|
91
|
+
* icon-badge placement. */
|
|
92
|
+
static cornerPoint(pos, size, corner) {
|
|
93
|
+
return {
|
|
94
|
+
x: pos.x + (corner.includes('right') ? size.w / 2 : -size.w / 2),
|
|
95
|
+
y: pos.y + (corner.includes('bottom') ? size.h / 2 : -size.h / 2),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** Pure. Generic 3-tier corner resolution — 'top-left'|'top-right'|
|
|
100
|
+
* 'bottom-left'|'bottom-right': a per-node `node[nodeKey]` override,
|
|
101
|
+
* then a per-shape entry in `byShape` (keyed by `node.shape`, default
|
|
102
|
+
* shape 'circle'), then `defaultCorner`. */
|
|
103
|
+
static resolveNodeCorner(node, nodeKey, byShape, defaultCorner) {
|
|
104
|
+
if (node?.[nodeKey]) return node[nodeKey];
|
|
105
|
+
const shapeCorner = byShape?.[node?.shape || 'circle'];
|
|
106
|
+
return shapeCorner || defaultCorner;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** Pure. Which corner a node's resize handle sits at/drags from. */
|
|
110
|
+
static nodeResizeCorner(node, resizeCornerByShape, defaultCorner = 'top-right') {
|
|
111
|
+
return NodeGeometry.resolveNodeCorner(node, 'resizeCorner', resizeCornerByShape, defaultCorner);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** Pure. Which corner a node's icon badge sits at when `iconPosition`
|
|
115
|
+
* is `'corner'`. */
|
|
116
|
+
static nodeIconCorner(node, iconCornerByShape, defaultCorner = 'top-right') {
|
|
117
|
+
return NodeGeometry.resolveNodeCorner(node, 'iconCorner', iconCornerByShape, defaultCorner);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Pure. What dragging a node's resize handle to `mousePos` should set on
|
|
121
|
+
* the node. */
|
|
122
|
+
static resizedNodeValue(node, corner, center, mousePos) {
|
|
123
|
+
const signX = corner.includes('right') ? 1 : -1;
|
|
124
|
+
const signY = corner.includes('bottom') ? 1 : -1;
|
|
125
|
+
if (node?.shape === 'table') {
|
|
126
|
+
const MIN_TABLE_WIDTH = 80;
|
|
127
|
+
return { width: Math.max(MIN_TABLE_WIDTH, Math.round(Math.abs(mousePos.x - center.x) * 2)) };
|
|
128
|
+
}
|
|
129
|
+
if (node?.shape === 'rect') {
|
|
130
|
+
const MIN_RECT_SIZE = 24;
|
|
131
|
+
const width = Math.max(MIN_RECT_SIZE, Math.round((mousePos.x - center.x) * signX * 2));
|
|
132
|
+
const height = Math.max(MIN_RECT_SIZE, Math.round((mousePos.y - center.y) * signY * 2));
|
|
133
|
+
return { width, height };
|
|
134
|
+
}
|
|
135
|
+
const MIN_RADIUS = 4;
|
|
136
|
+
const projected = ((mousePos.x - center.x) * signX + (mousePos.y - center.y) * signY) / 2;
|
|
137
|
+
return { radius: Math.max(MIN_RADIUS, Math.round(projected)) };
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** Pure. SVG path `d` for a `w`x`h` rectangle centred on the origin with
|
|
141
|
+
* all four corners cut at 45° (an octagon) — see nodeShapeEl's
|
|
142
|
+
* 'chamfered' cornerStyle. `chamfer` (the cut's size) defaults to a
|
|
143
|
+
* fraction of the box's smaller dimension so it scales sensibly with
|
|
144
|
+
* the box rather than needing its own per-node configuration. */
|
|
145
|
+
static chamferedRectPath(w, h, chamfer) {
|
|
146
|
+
return Glyph.chamferedRectPath(w, h, chamfer);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** Build the SVG element for a node's shape. Returns `{el, suppressInner}`
|
|
150
|
+
* where `suppressInner` tells the caller not to draw a centred icon or
|
|
151
|
+
* initials on top of busy distinct shapes. The shapes themselves are
|
|
152
|
+
* Glyphs (src/charting/glyphs), shared with the editor's templates. */
|
|
153
|
+
static nodeShapeEl(renderer, shape, R, color, size, cornerStyle, strokeColor = '#fff', strokeWidth = 2, iconUrl = null, icon = null) {
|
|
154
|
+
const glyph = glyphFor(shape);
|
|
155
|
+
const ctx = Glyph.context({ R, size, color, cornerStyle, strokeColor, strokeWidth, iconUrl, icon });
|
|
156
|
+
return { el: drawGlyph(renderer, glyph.parts(ctx)), suppressInner: glyph.constructor.ownsInterior };
|
|
157
|
+
}
|
|
158
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Command } from '../CommandHistory.js';
|
|
2
|
+
import { BackgroundCommand } from '../arrangement/index.js';
|
|
3
|
+
import { pinnedBehind } from '../zOrder.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* PlaceItemsCommand — put new boxes and lines on an ArchiMate view (a
|
|
7
|
+
* template placed on a canvas, a paste), as one undo step: relationships
|
|
8
|
+
* drawn between the boxes too, and the model elements and relationships they
|
|
9
|
+
* show when the model lacks them (a paste from another model). They stack in front of
|
|
10
|
+
* what is there; given `background`, they become one locked background group
|
|
11
|
+
* instead (BackgroundGroup: behind everything not pinned, in front of any
|
|
12
|
+
* older background).
|
|
13
|
+
*/
|
|
14
|
+
export class PlaceItemsCommand extends Command {
|
|
15
|
+
/**
|
|
16
|
+
* @param {ArchimateView} view
|
|
17
|
+
* @param {Object} items
|
|
18
|
+
* @param {Array<ElementInstance>} items.elementInstances
|
|
19
|
+
* @param {Array<ViewConnectionInstance>} [items.viewConnections]
|
|
20
|
+
* @param {Array<RelationshipInstance>} [items.relationshipInstances]
|
|
21
|
+
* @param {Array<Object>} [items.elements] - Model elements to add with them
|
|
22
|
+
* @param {Array<Object>} [items.relationships] - Model relationships to add with them
|
|
23
|
+
* @param {Object} [options]
|
|
24
|
+
* @param {{name?: string}|null} [options.background] - Make them a locked background group
|
|
25
|
+
* @param {string} [options.label]
|
|
26
|
+
*/
|
|
27
|
+
constructor(view, { elementInstances, viewConnections = [], relationshipInstances = [], elements = [], relationships = [] }, { background = null, label = 'Place template' } = {}) {
|
|
28
|
+
super(label);
|
|
29
|
+
this.view = view;
|
|
30
|
+
this.elementInstances = elementInstances;
|
|
31
|
+
this.viewConnections = viewConnections;
|
|
32
|
+
this.relationshipInstances = relationshipInstances;
|
|
33
|
+
this.elements = elements;
|
|
34
|
+
this.relationships = relationships;
|
|
35
|
+
this._widened = [];
|
|
36
|
+
this.background = background;
|
|
37
|
+
/** The background group's id, once placed. */
|
|
38
|
+
this.groupId = null;
|
|
39
|
+
this._before = null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
execute() {
|
|
43
|
+
const { view } = this;
|
|
44
|
+
this._before = { arrangement: view.arrangement.toJSON(), z: new Map(view.layerItems().map(i => [i.id, i.zIndex])) };
|
|
45
|
+
for (const element of this.elements) view.model.addElement(JSON.parse(JSON.stringify(element)));
|
|
46
|
+
for (const relationship of this.relationships) view.model.addRelationship(JSON.parse(JSON.stringify(relationship)));
|
|
47
|
+
// A view that lists the elements it draws lists these too (mutated: others hold the array).
|
|
48
|
+
this._widened = view.elementIds ? [...new Set(this.elementInstances.map(i => i.elementId))].filter(id => view.model.getElement(id) && !view.elementIds.includes(id)) : [];
|
|
49
|
+
if (view.elementIds) view.elementIds.push(...this._widened);
|
|
50
|
+
// In front of everything there now, in their own order.
|
|
51
|
+
let z = Math.max(-1, ...view.layerItems().map(i => i.zIndex || 0)) + 1;
|
|
52
|
+
for (const inst of [...this.elementInstances].sort((a, b) => (a.zIndex || 0) - (b.zIndex || 0))) {
|
|
53
|
+
inst.zIndex = z++;
|
|
54
|
+
view.addElementInstance(inst);
|
|
55
|
+
}
|
|
56
|
+
for (const line of this.viewConnections) view.viewConnections.set(line.id, line);
|
|
57
|
+
for (const line of this.relationshipInstances) view.addRelationshipInstance(line);
|
|
58
|
+
if (!this.background) return;
|
|
59
|
+
const cmd = new BackgroundCommand(view.arrangement, this.elementInstances.map(i => i.id), { ...this.background, ...(this.groupId && { id: this.groupId }) });
|
|
60
|
+
cmd.apply();
|
|
61
|
+
this.groupId = cmd.groupId;
|
|
62
|
+
const stack = pinnedBehind(view.layerItems(), (id) => view.arrangement.isPinnedToBack(id));
|
|
63
|
+
for (const item of view.layerItems()) item.zIndex = stack.get(item.id);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
undo() {
|
|
67
|
+
const { view } = this;
|
|
68
|
+
for (const inst of this.elementInstances) view.removeElementInstance(inst.id);
|
|
69
|
+
for (const line of this.viewConnections) view.viewConnections.delete(line.id);
|
|
70
|
+
for (const line of this.relationshipInstances) view.removeRelationshipInstance(line.id);
|
|
71
|
+
for (const id of this._widened) { const at = view.elementIds.indexOf(id); if (at >= 0) view.elementIds.splice(at, 1); }
|
|
72
|
+
for (const relationship of this.relationships) view.model.removeRelationship(relationship.id);
|
|
73
|
+
for (const element of this.elements) view.model.removeElement(element.id);
|
|
74
|
+
view.arrangement.restore(this._before.arrangement);
|
|
75
|
+
for (const item of view.layerItems()) if (this._before.z.has(item.id)) item.zIndex = this._before.z.get(item.id);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RadialLayout — compute node positions for a radial tree view.
|
|
3
|
+
*
|
|
4
|
+
* Centers a primary element at origin, arranges related elements in a circle.
|
|
5
|
+
* Pure function, no side effects.
|
|
6
|
+
*/
|
|
7
|
+
export class RadialLayout {
|
|
8
|
+
/**
|
|
9
|
+
* Compute radial layout for an element and its connected neighbors.
|
|
10
|
+
*
|
|
11
|
+
* @param {string} centerElementId - the element to center
|
|
12
|
+
* @param {ArchimateModel} model - the model to query for relationships
|
|
13
|
+
* @param {object} options - { radius: 150, fontSize: 12 }
|
|
14
|
+
* @returns {object} { nodes, edges } ready for graphDiagram
|
|
15
|
+
*/
|
|
16
|
+
static compute(centerElementId, model, options = {}) {
|
|
17
|
+
const { radius = 120, centerX = 150, centerY = 150 } = options;
|
|
18
|
+
|
|
19
|
+
const centerElement = model.getElement(centerElementId);
|
|
20
|
+
if (!centerElement) {
|
|
21
|
+
return { nodes: [], edges: [] };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Find all elements connected via relationships
|
|
25
|
+
const connectedIds = new Set([centerElementId]);
|
|
26
|
+
const edges = [];
|
|
27
|
+
const relationships = model.relationships();
|
|
28
|
+
|
|
29
|
+
for (const rel of relationships) {
|
|
30
|
+
if (rel.source === centerElementId) {
|
|
31
|
+
connectedIds.add(rel.target);
|
|
32
|
+
edges.push({
|
|
33
|
+
source: centerElementId,
|
|
34
|
+
target: rel.target,
|
|
35
|
+
kind: rel.kind,
|
|
36
|
+
id: rel.id,
|
|
37
|
+
label: rel.label,
|
|
38
|
+
arrowhead: rel.arrowhead,
|
|
39
|
+
arrowheadStart: rel.arrowheadStart,
|
|
40
|
+
});
|
|
41
|
+
} else if (rel.target === centerElementId) {
|
|
42
|
+
connectedIds.add(rel.source);
|
|
43
|
+
edges.push({
|
|
44
|
+
source: rel.source,
|
|
45
|
+
target: centerElementId,
|
|
46
|
+
kind: rel.kind,
|
|
47
|
+
id: rel.id,
|
|
48
|
+
label: rel.label,
|
|
49
|
+
arrowhead: rel.arrowhead,
|
|
50
|
+
arrowheadStart: rel.arrowheadStart,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Position nodes: center element in middle, neighbors in circle
|
|
56
|
+
const nodes = [];
|
|
57
|
+
const connectedArray = Array.from(connectedIds);
|
|
58
|
+
const centerIndex = connectedArray.indexOf(centerElementId);
|
|
59
|
+
|
|
60
|
+
for (let i = 0; i < connectedArray.length; i++) {
|
|
61
|
+
const id = connectedArray[i];
|
|
62
|
+
const elem = model.getElement(id);
|
|
63
|
+
|
|
64
|
+
if (id === centerElementId) {
|
|
65
|
+
// Center element in viewport center
|
|
66
|
+
nodes.push({
|
|
67
|
+
id,
|
|
68
|
+
label: elem.name || id,
|
|
69
|
+
x: centerX,
|
|
70
|
+
y: centerY,
|
|
71
|
+
shape: 'rect',
|
|
72
|
+
type: elem.type,
|
|
73
|
+
layer: elem.layer,
|
|
74
|
+
specialization: elem.specialization,
|
|
75
|
+
properties: elem.properties,
|
|
76
|
+
});
|
|
77
|
+
} else {
|
|
78
|
+
// Arrange neighbors in circle around center
|
|
79
|
+
const neighborIndex = i < centerIndex ? i : i - 1;
|
|
80
|
+
const neighborCount = connectedArray.length - 1;
|
|
81
|
+
const angle = (neighborIndex / neighborCount) * 2 * Math.PI;
|
|
82
|
+
const x = centerX + Math.cos(angle) * radius;
|
|
83
|
+
const y = centerY + Math.sin(angle) * radius;
|
|
84
|
+
|
|
85
|
+
nodes.push({
|
|
86
|
+
id,
|
|
87
|
+
label: elem.name || id,
|
|
88
|
+
x,
|
|
89
|
+
y,
|
|
90
|
+
shape: 'rect',
|
|
91
|
+
type: elem.type,
|
|
92
|
+
layer: elem.layer,
|
|
93
|
+
specialization: elem.specialization,
|
|
94
|
+
properties: elem.properties,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return { nodes, edges };
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RelationshipInstance — A projection of a model relationship into a specific view.
|
|
3
|
+
* Represents a single occurrence of a relationship with its own routing and
|
|
4
|
+
* visibility state. A view may have multiple instances of the same relationship,
|
|
5
|
+
* and each keeps its own route.
|
|
6
|
+
*/
|
|
7
|
+
export class RelationshipInstance {
|
|
8
|
+
/**
|
|
9
|
+
* Create a new relationship instance.
|
|
10
|
+
* @param {string} relationshipId - Reference to the model relationship (immutable)
|
|
11
|
+
* @param {Array<{x: number, y: number}>|null} [waypoints] - Bend points for this instance.
|
|
12
|
+
* `null` inherits the model relationship's; `[]` is a deliberately straight line.
|
|
13
|
+
* @param {string} [sourceInstanceId] - ID of the specific source element instance this connects
|
|
14
|
+
* @param {string} [targetInstanceId] - ID of the specific target element instance this connects
|
|
15
|
+
*/
|
|
16
|
+
constructor(relationshipId, waypoints = null, sourceInstanceId = null, targetInstanceId = null) {
|
|
17
|
+
if (!relationshipId) {
|
|
18
|
+
throw new Error('RelationshipInstance requires relationshipId');
|
|
19
|
+
}
|
|
20
|
+
this.relationshipId = relationshipId;
|
|
21
|
+
this.waypoints = waypoints ? waypoints.map(wp => ({ x: wp.x, y: wp.y })) : null;
|
|
22
|
+
/** Pinned attachment side at each end ('top'|'right'|'bottom'|'left'); null = automatic. */
|
|
23
|
+
this.sourceSide = null;
|
|
24
|
+
this.targetSide = null;
|
|
25
|
+
/** Line style set on this view (routing, attach, strokeColor, strokeWidth); empty = inherited. */
|
|
26
|
+
this.appearance = {};
|
|
27
|
+
/** What an Archi file said about this line that the model does not use; null when not imported. */
|
|
28
|
+
this.archi = null;
|
|
29
|
+
this.visible = true;
|
|
30
|
+
this.sourceInstanceId = sourceInstanceId;
|
|
31
|
+
this.targetInstanceId = targetInstanceId;
|
|
32
|
+
|
|
33
|
+
// Generate stable instance ID
|
|
34
|
+
this.id = RelationshipInstance.generateId(relationshipId, sourceInstanceId, targetInstanceId);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Generate a stable, deterministic instance ID.
|
|
39
|
+
* Includes source and target instance IDs to uniquely identify each relationship instance pairing.
|
|
40
|
+
* @param {string} relationshipId
|
|
41
|
+
* @param {string} [sourceInstanceId]
|
|
42
|
+
* @param {string} [targetInstanceId]
|
|
43
|
+
* @returns {string}
|
|
44
|
+
*/
|
|
45
|
+
static generateId(relationshipId, sourceInstanceId = null, targetInstanceId = null) {
|
|
46
|
+
if (sourceInstanceId && targetInstanceId) {
|
|
47
|
+
return `${relationshipId}_${sourceInstanceId}_${targetInstanceId}`;
|
|
48
|
+
}
|
|
49
|
+
return `rel_${relationshipId}`;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Resolve this instance to the actual model relationship.
|
|
54
|
+
* @param {ArchimateModel} model
|
|
55
|
+
* @returns {ArchimateRelationship}
|
|
56
|
+
*/
|
|
57
|
+
getModelRelationship(model) {
|
|
58
|
+
return model.getRelationship(this.relationshipId);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Serialize to plain object (for JSON, storage, export).
|
|
63
|
+
* @returns {Object}
|
|
64
|
+
*/
|
|
65
|
+
toJSON() {
|
|
66
|
+
return {
|
|
67
|
+
relationshipId: this.relationshipId,
|
|
68
|
+
waypoints: this.waypoints ?? undefined,
|
|
69
|
+
sourceSide: this.sourceSide ?? undefined,
|
|
70
|
+
targetSide: this.targetSide ?? undefined,
|
|
71
|
+
appearance: Object.keys(this.appearance).length ? { ...this.appearance } : undefined,
|
|
72
|
+
visible: this.visible,
|
|
73
|
+
sourceInstanceId: this.sourceInstanceId,
|
|
74
|
+
targetInstanceId: this.targetInstanceId,
|
|
75
|
+
archi: this.archi ? JSON.parse(JSON.stringify(this.archi)) : undefined,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Create an instance from plain object.
|
|
81
|
+
* @param {Object} data
|
|
82
|
+
* @returns {RelationshipInstance}
|
|
83
|
+
*/
|
|
84
|
+
static fromJSON(data) {
|
|
85
|
+
const inst = new RelationshipInstance(data.relationshipId, data.waypoints, data.sourceInstanceId, data.targetInstanceId);
|
|
86
|
+
inst.sourceSide = data.sourceSide ?? null;
|
|
87
|
+
inst.targetSide = data.targetSide ?? null;
|
|
88
|
+
inst.appearance = { ...(data.appearance ?? {}) };
|
|
89
|
+
inst.visible = data.visible !== false;
|
|
90
|
+
inst.archi = data.archi ? JSON.parse(JSON.stringify(data.archi)) : null;
|
|
91
|
+
return inst;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Command } from '../CommandHistory.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* RemoveGroupFromViewCommand — take a group off a view: its layout entry
|
|
5
|
+
* goes, and what was drawn in it stays where it is (on the view, or in the
|
|
6
|
+
* group around it). The model folder stays. Undo puts the same entry back.
|
|
7
|
+
*/
|
|
8
|
+
export class RemoveGroupFromViewCommand extends Command {
|
|
9
|
+
/**
|
|
10
|
+
* @param {ArchimateView} view
|
|
11
|
+
* @param {string} folderId - The folder the group draws
|
|
12
|
+
*/
|
|
13
|
+
constructor(view, folderId) {
|
|
14
|
+
super('Remove group from view');
|
|
15
|
+
this.view = view;
|
|
16
|
+
this.folderId = folderId;
|
|
17
|
+
this._entry = null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
execute() {
|
|
21
|
+
this._entry = this.view.folderLayout[this.folderId] ?? null;
|
|
22
|
+
delete this.view.folderLayout[this.folderId];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
undo() {
|
|
26
|
+
if (this._entry) this.view.folderLayout[this.folderId] = this._entry;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Command } from '../CommandHistory.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* RemoveLineCommand — take a plain line (ViewConnectionInstance: no
|
|
5
|
+
* relationship behind it) off a view, as one undo step.
|
|
6
|
+
*/
|
|
7
|
+
export class RemoveLineCommand extends Command {
|
|
8
|
+
/**
|
|
9
|
+
* @param {ArchimateView} view
|
|
10
|
+
* @param {string} lineId
|
|
11
|
+
*/
|
|
12
|
+
constructor(view, lineId) {
|
|
13
|
+
super('Delete line');
|
|
14
|
+
this.view = view;
|
|
15
|
+
this.lineId = lineId;
|
|
16
|
+
this.line = null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
execute() {
|
|
20
|
+
this.line = this.view.viewConnections.get(this.lineId) ?? null;
|
|
21
|
+
this.view.viewConnections.delete(this.lineId);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
undo() {
|
|
25
|
+
if (this.line) this.view.viewConnections.set(this.lineId, this.line);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Command } from '../CommandHistory.js';
|
|
2
|
+
import { AddToViewCommand } from './ArchimateCommands.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* ShowElementCommand — put an existing model element on a view (dropped from
|
|
6
|
+
* the model tree), with its relationships to the elements already there, as
|
|
7
|
+
* one undo step: what Archi does by default when an element is added to a
|
|
8
|
+
* view. Only lines to or from the new box are added; a line the view leaves
|
|
9
|
+
* out between boxes already there stays out. Redo adds the same lines again,
|
|
10
|
+
* so later steps that refer to them still find them.
|
|
11
|
+
*/
|
|
12
|
+
export class ShowElementCommand extends Command {
|
|
13
|
+
/**
|
|
14
|
+
* @param {ArchimateView} view
|
|
15
|
+
* @param {ElementInstance} instance - The new box, for an element the model has
|
|
16
|
+
* @param {Object} [options]
|
|
17
|
+
* @param {boolean} [options.withRelationships=true]
|
|
18
|
+
*/
|
|
19
|
+
constructor(view, instance, { withRelationships = true, label = 'Show in View' } = {}) {
|
|
20
|
+
super(label);
|
|
21
|
+
this.view = view;
|
|
22
|
+
this.instance = instance;
|
|
23
|
+
this.withRelationships = withRelationships;
|
|
24
|
+
this._add = new AddToViewCommand(view, instance);
|
|
25
|
+
/** The relationship lines added with it, found on first execute. */
|
|
26
|
+
this.lines = null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
execute() {
|
|
30
|
+
const { view, instance } = this;
|
|
31
|
+
this._add.execute();
|
|
32
|
+
this.lines ??= this.withRelationships
|
|
33
|
+
? view.missingRelationshipInstances(instance.elementId)
|
|
34
|
+
.filter(line => line.sourceInstanceId === instance.id || line.targetInstanceId === instance.id)
|
|
35
|
+
: [];
|
|
36
|
+
for (const line of this.lines) view.addRelationshipInstance(line);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
undo() {
|
|
40
|
+
for (const line of this.lines ?? []) this.view.removeRelationshipInstance(line.id);
|
|
41
|
+
this._add.undo();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SvgCoordinate — screen-to-SVG coordinate conversion helpers.
|
|
3
|
+
*
|
|
4
|
+
* These used to live on RenderEngine; they are collected here so diagram
|
|
5
|
+
* classes can translate DOM mouse events into SVG user-space without going
|
|
6
|
+
* through the engine façade.
|
|
7
|
+
*/
|
|
8
|
+
export class SvgCoordinate {
|
|
9
|
+
/** Screen (clientX/clientY) → SVG user-space coordinates, honoring the
|
|
10
|
+
* current pan/zoom viewBox. Shared by drag, add-node, and edge-creation
|
|
11
|
+
* — all of which need a graph-space point, not a raw screen pixel. */
|
|
12
|
+
static clientToSvgPoint(svg, clientX, clientY) {
|
|
13
|
+
const CTM = svg?.getScreenCTM();
|
|
14
|
+
if (!CTM) return { x: 0, y: 0 };
|
|
15
|
+
return { x: (clientX - CTM.e) / CTM.a, y: (clientY - CTM.f) / CTM.d };
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { ViewFit } from '../ViewFit.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* SvgZoom — pan/zoom controller for an SVG container.
|
|
5
|
+
*
|
|
6
|
+
* The wheel/mouse logic used to live inside RenderEngine._addZoomListeners;
|
|
7
|
+
* it is collected here so diagram classes can attach their own pan/zoom
|
|
8
|
+
* without going through the engine façade.
|
|
9
|
+
*/
|
|
10
|
+
export class SvgZoom {
|
|
11
|
+
constructor(container, svg, { clientToSvgPoint, hitTest, is3D } = {}) {
|
|
12
|
+
this.container = container;
|
|
13
|
+
this.svg = svg;
|
|
14
|
+
this.clientToSvgPoint = clientToSvgPoint;
|
|
15
|
+
this.hitTest = hitTest;
|
|
16
|
+
this.is3D = is3D;
|
|
17
|
+
this._initialViewBox = null;
|
|
18
|
+
this._isPanning = false;
|
|
19
|
+
this._panMoved = false;
|
|
20
|
+
this._lastMousePos = { x: 0, y: 0 };
|
|
21
|
+
|
|
22
|
+
this._onWheel = this._onWheel.bind(this);
|
|
23
|
+
this._onMouseDown = this._onMouseDown.bind(this);
|
|
24
|
+
this._onMouseMove = this._onMouseMove.bind(this);
|
|
25
|
+
this._onMouseUp = this._onMouseUp.bind(this);
|
|
26
|
+
|
|
27
|
+
container.addEventListener('wheel', this._onWheel, { passive: false });
|
|
28
|
+
container.addEventListener('mousedown', this._onMouseDown);
|
|
29
|
+
container.addEventListener('mousemove', this._onMouseMove);
|
|
30
|
+
container.addEventListener('mouseup', this._onMouseUp);
|
|
31
|
+
container.addEventListener('mouseleave', this._onMouseUp);
|
|
32
|
+
// A right-drag that panned is not a right-click: no menu.
|
|
33
|
+
this._onContextMenu = (e) => {
|
|
34
|
+
if (!this._panMoved) return;
|
|
35
|
+
this._panMoved = false;
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
e.stopPropagation();
|
|
38
|
+
};
|
|
39
|
+
container.addEventListener('contextmenu', this._onContextMenu, true);
|
|
40
|
+
|
|
41
|
+
this._captureInitialViewBox();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
_captureInitialViewBox() {
|
|
45
|
+
const viewBox = this.svg?.viewBox?.baseVal;
|
|
46
|
+
if (!viewBox) return;
|
|
47
|
+
this._initialViewBox = { x: viewBox.x, y: viewBox.y, width: viewBox.width, height: viewBox.height };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
get initialViewBox() {
|
|
51
|
+
return this._initialViewBox;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Zoom and pan so `bounds` (SVG coordinates) fills the view (ViewFit.viewBox). */
|
|
55
|
+
fit(bounds, { margin = 20 } = {}) {
|
|
56
|
+
if (!this.svg || !bounds) return;
|
|
57
|
+
const rect = this.svg.getBoundingClientRect?.() ?? { width: 0, height: 0 };
|
|
58
|
+
const box = ViewFit.viewBox(bounds, rect, margin);
|
|
59
|
+
const viewBox = this.svg.viewBox.baseVal;
|
|
60
|
+
viewBox.x = box.x;
|
|
61
|
+
viewBox.y = box.y;
|
|
62
|
+
viewBox.width = box.width;
|
|
63
|
+
viewBox.height = box.height;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
reset() {
|
|
67
|
+
if (!this._initialViewBox || !this.svg) return;
|
|
68
|
+
const viewBox = this.svg.viewBox.baseVal;
|
|
69
|
+
viewBox.x = this._initialViewBox.x;
|
|
70
|
+
viewBox.y = this._initialViewBox.y;
|
|
71
|
+
viewBox.width = this._initialViewBox.width;
|
|
72
|
+
viewBox.height = this._initialViewBox.height;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
_onWheel(event) {
|
|
76
|
+
if (this.is3D?.()) return;
|
|
77
|
+
event.preventDefault();
|
|
78
|
+
|
|
79
|
+
const scaleFactor = event.deltaY > 0 ? 1.1 : 1 / 1.1;
|
|
80
|
+
const pointer = this.clientToSvgPoint(event.clientX, event.clientY);
|
|
81
|
+
const viewBox = this.svg.viewBox.baseVal;
|
|
82
|
+
|
|
83
|
+
viewBox.x = pointer.x - (pointer.x - viewBox.x) * scaleFactor;
|
|
84
|
+
viewBox.y = pointer.y - (pointer.y - viewBox.y) * scaleFactor;
|
|
85
|
+
viewBox.width *= scaleFactor;
|
|
86
|
+
viewBox.height *= scaleFactor;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Pan with the right button (a right-click that does not move still opens
|
|
91
|
+
* the menu), the middle one, or Alt+left. A plain left drag on empty space
|
|
92
|
+
* is the editor's: a selection box.
|
|
93
|
+
*/
|
|
94
|
+
_onMouseDown(event) {
|
|
95
|
+
if (this.is3D?.()) return;
|
|
96
|
+
if (event.button === 2 || event.button === 1 || (event.button === 0 && event.altKey)) {
|
|
97
|
+
this._isPanning = true;
|
|
98
|
+
this._panMoved = false;
|
|
99
|
+
this._downPos = { x: event.clientX, y: event.clientY };
|
|
100
|
+
this._lastMousePos = { x: event.clientX, y: event.clientY };
|
|
101
|
+
if (event.button !== 2) event.preventDefault();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
_onMouseMove(event) {
|
|
106
|
+
if (!this._isPanning) return;
|
|
107
|
+
if (!this._panMoved) {
|
|
108
|
+
if (Math.hypot(event.clientX - this._downPos.x, event.clientY - this._downPos.y) < 4) return;
|
|
109
|
+
this._panMoved = true;
|
|
110
|
+
this.svg.style.cursor = 'grabbing';
|
|
111
|
+
}
|
|
112
|
+
const dx = event.clientX - this._lastMousePos.x;
|
|
113
|
+
const dy = event.clientY - this._lastMousePos.y;
|
|
114
|
+
this._lastMousePos = { x: event.clientX, y: event.clientY };
|
|
115
|
+
|
|
116
|
+
const CTM = this.svg.getScreenCTM();
|
|
117
|
+
const viewBox = this.svg.viewBox.baseVal;
|
|
118
|
+
viewBox.x -= dx / CTM.a;
|
|
119
|
+
viewBox.y -= dy / CTM.d;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
_onMouseUp() {
|
|
123
|
+
if (!this._isPanning) return;
|
|
124
|
+
this._isPanning = false;
|
|
125
|
+
this.svg.style.cursor = 'default';
|
|
126
|
+
}
|
|
127
|
+
}
|