@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,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tooltip — small DOM helper for graph-diagram hover tooltips.
|
|
3
|
+
*
|
|
4
|
+
* The tooltip logic used to live inside RenderEngine._addTooltipListeners;
|
|
5
|
+
* it is collected here so diagram classes can manage their own tooltips
|
|
6
|
+
* without going through the engine façade.
|
|
7
|
+
*/
|
|
8
|
+
export class Tooltip {
|
|
9
|
+
constructor(container) {
|
|
10
|
+
this.container = container;
|
|
11
|
+
this.el = null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
_ensure() {
|
|
15
|
+
if (this.el) return;
|
|
16
|
+
this.el = document.createElement('div');
|
|
17
|
+
this.el.style.cssText = `
|
|
18
|
+
position: fixed;
|
|
19
|
+
display: none;
|
|
20
|
+
background-color: rgba(0, 0, 0, 0.8);
|
|
21
|
+
color: white;
|
|
22
|
+
padding: 8px 12px;
|
|
23
|
+
border-radius: 5px;
|
|
24
|
+
font-family: sans-serif;
|
|
25
|
+
font-size: 12px;
|
|
26
|
+
line-height: 1.45;
|
|
27
|
+
pointer-events: none;
|
|
28
|
+
z-index: 10000;
|
|
29
|
+
white-space: pre-line;
|
|
30
|
+
max-width: 520px;
|
|
31
|
+
min-width: 80px;
|
|
32
|
+
word-wrap: break-word;
|
|
33
|
+
overflow-wrap: break-word;
|
|
34
|
+
box-shadow: 0 4px 16px rgba(0,0,0,0.25);
|
|
35
|
+
`;
|
|
36
|
+
document.body.appendChild(this.el);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
show(text, clientX, clientY) {
|
|
40
|
+
this._ensure();
|
|
41
|
+
this.el.style.display = 'block';
|
|
42
|
+
this.el.textContent = text;
|
|
43
|
+
// Position relative to the viewport so parent containers can never clip
|
|
44
|
+
// the tooltip, and nudge away from the cursor / screen edges.
|
|
45
|
+
const pad = 12;
|
|
46
|
+
let left = clientX + pad;
|
|
47
|
+
let top = clientY + pad;
|
|
48
|
+
const rect = this.el.getBoundingClientRect();
|
|
49
|
+
if (left + rect.width > window.innerWidth - pad) {
|
|
50
|
+
left = Math.max(pad, clientX - rect.width - pad);
|
|
51
|
+
}
|
|
52
|
+
if (top + rect.height > window.innerHeight - pad) {
|
|
53
|
+
top = Math.max(pad, clientY - rect.height - pad);
|
|
54
|
+
}
|
|
55
|
+
this.el.style.left = `${left}px`;
|
|
56
|
+
this.el.style.top = `${top}px`;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
hide() {
|
|
60
|
+
if (this.el) this.el.style.display = 'none';
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ViewConnectionInstance — a line drawn on one view between two of its boxes
|
|
3
|
+
* with no model relationship behind it: Archi's plain connection (a note to an
|
|
4
|
+
* element, say) or a canvas connection. Like a note, it belongs to its view.
|
|
5
|
+
*
|
|
6
|
+
* Its look is Archi's connection `type`, a bit mask: the line (solid, dashed,
|
|
7
|
+
* dotted) and an arrow at either end (filled, hollow or open).
|
|
8
|
+
*/
|
|
9
|
+
export class ViewConnectionInstance {
|
|
10
|
+
/** Archi's connection type bits (IDiagramModelConnection). */
|
|
11
|
+
static TYPE = Object.freeze({
|
|
12
|
+
ARROW_FILL_TARGET: 1, LINE_DASHED: 2, LINE_DOTTED: 4, ARROW_FILL_SOURCE: 8,
|
|
13
|
+
ARROW_HOLLOW_TARGET: 16, ARROW_HOLLOW_SOURCE: 32, ARROW_LINE_TARGET: 64, ARROW_LINE_SOURCE: 128,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @param {Object} spec
|
|
18
|
+
* @param {string} spec.id
|
|
19
|
+
* @param {string} spec.sourceInstanceId - the box it starts at (an instance on the view)
|
|
20
|
+
* @param {string} spec.targetInstanceId - the box it ends at
|
|
21
|
+
* @param {Array<{x:number,y:number}>} [spec.waypoints] - bend points on the view
|
|
22
|
+
* @param {number} [spec.type] - Archi's type bits (line style and arrows)
|
|
23
|
+
* @param {string} [spec.label]
|
|
24
|
+
* @param {Object} [spec.appearance] - strokeColor, strokeWidth, textColor, ...
|
|
25
|
+
* @param {string} [spec.archiType] - Archi's class, kept for export ('diagram-model-connection', 'canvas-model-connection')
|
|
26
|
+
*/
|
|
27
|
+
constructor({ id, sourceInstanceId, targetInstanceId, waypoints = [], type = 0, label = '', appearance = {}, archiType = 'diagram-model-connection' }) {
|
|
28
|
+
if (!id || !sourceInstanceId || !targetInstanceId) throw new TypeError('ViewConnectionInstance needs an id and both ends');
|
|
29
|
+
this.id = id;
|
|
30
|
+
this.sourceInstanceId = sourceInstanceId;
|
|
31
|
+
this.targetInstanceId = targetInstanceId;
|
|
32
|
+
this.waypoints = waypoints.map(wp => ({ x: wp.x, y: wp.y }));
|
|
33
|
+
this.type = type;
|
|
34
|
+
this.label = label;
|
|
35
|
+
this.appearance = { ...appearance };
|
|
36
|
+
this.archiType = archiType;
|
|
37
|
+
/** What an Archi file said about this line that the model does not use; null when not imported. */
|
|
38
|
+
this.archi = null;
|
|
39
|
+
this.visible = true;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** The line style its type bits give. */
|
|
43
|
+
get lineStyle() {
|
|
44
|
+
const { LINE_DASHED, LINE_DOTTED } = ViewConnectionInstance.TYPE;
|
|
45
|
+
if (this.type & LINE_DOTTED) return 'dotted';
|
|
46
|
+
if (this.type & LINE_DASHED) return 'dashed';
|
|
47
|
+
return 'solid';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** The renderer's marker for one end ('target' or 'source'), or 'none'. */
|
|
51
|
+
arrowhead(end) {
|
|
52
|
+
const T = ViewConnectionInstance.TYPE;
|
|
53
|
+
const [fill, hollow, line] = end === 'target'
|
|
54
|
+
? [T.ARROW_FILL_TARGET, T.ARROW_HOLLOW_TARGET, T.ARROW_LINE_TARGET]
|
|
55
|
+
: [T.ARROW_FILL_SOURCE, T.ARROW_HOLLOW_SOURCE, T.ARROW_LINE_SOURCE];
|
|
56
|
+
if (this.type & fill) return 'arrow';
|
|
57
|
+
if (this.type & hollow) return 'triangle-hollow';
|
|
58
|
+
if (this.type & line) return 'open-arrow';
|
|
59
|
+
return 'none';
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Whether an end is on the view: one of its boxes, or one of its groups. */
|
|
63
|
+
static endOn(view, id) {
|
|
64
|
+
return !!view.getElementInstance(id) || !!view.folderLayout?.[id];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** The edge handed to the renderer, if both its ends are on the view. */
|
|
68
|
+
project(view) {
|
|
69
|
+
if (!this.visible || !ViewConnectionInstance.endOn(view, this.sourceInstanceId) || !ViewConnectionInstance.endOn(view, this.targetInstanceId)) return undefined;
|
|
70
|
+
return {
|
|
71
|
+
id: this.id,
|
|
72
|
+
source: this.sourceInstanceId,
|
|
73
|
+
target: this.targetInstanceId,
|
|
74
|
+
kind: 'connection',
|
|
75
|
+
viewConnection: true,
|
|
76
|
+
label: this.label || undefined,
|
|
77
|
+
waypoints: this.waypoints.map(wp => ({ ...wp })),
|
|
78
|
+
lineStyle: this.lineStyle,
|
|
79
|
+
arrowhead: this.arrowhead('target'),
|
|
80
|
+
arrowheadStart: this.arrowhead('source'),
|
|
81
|
+
color: this.appearance.strokeColor || '#000000',
|
|
82
|
+
...(this.appearance.strokeWidth !== undefined && { width: this.appearance.strokeWidth }),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
toJSON() {
|
|
87
|
+
return {
|
|
88
|
+
id: this.id, sourceInstanceId: this.sourceInstanceId, targetInstanceId: this.targetInstanceId,
|
|
89
|
+
waypoints: this.waypoints.map(wp => ({ ...wp })), type: this.type, label: this.label,
|
|
90
|
+
appearance: Object.keys(this.appearance).length ? { ...this.appearance } : undefined,
|
|
91
|
+
archiType: this.archiType, visible: this.visible,
|
|
92
|
+
archi: this.archi ? JSON.parse(JSON.stringify(this.archi)) : undefined,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
static fromJSON(data) {
|
|
97
|
+
const inst = new ViewConnectionInstance(data);
|
|
98
|
+
inst.visible = data.visible !== false;
|
|
99
|
+
inst.archi = data.archi ? JSON.parse(JSON.stringify(data.archi)) : null;
|
|
100
|
+
return inst;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ElementInstance, structuredCopy } from './ElementInstance.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ViewObjectInstance — something drawn on one view that is not a model
|
|
5
|
+
* element: a note or an image (Archi's DiagramModelNote / DiagramModelImage).
|
|
6
|
+
* It carries its own content instead of pointing into the model, so it never
|
|
7
|
+
* shows in the model tree and goes when the view does.
|
|
8
|
+
*/
|
|
9
|
+
export class ViewObjectInstance extends ElementInstance {
|
|
10
|
+
/**
|
|
11
|
+
* @param {Object} content - What it draws: `id`, `name`, `shape` ('note'|'image'), and
|
|
12
|
+
* shape fields such as `label`, `iconUrl`, `href`, `width`, `height`
|
|
13
|
+
* @param {number} x
|
|
14
|
+
* @param {number} y
|
|
15
|
+
*/
|
|
16
|
+
constructor(content, x, y) {
|
|
17
|
+
if (!content?.id) throw new TypeError('ViewObjectInstance content needs an id');
|
|
18
|
+
super(content.id, x, y);
|
|
19
|
+
const { x: _x, y: _y, ...own } = content;
|
|
20
|
+
this.content = own;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Its own content: there is no model element behind it. */
|
|
24
|
+
resolve() {
|
|
25
|
+
return this.content;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** A view object belongs to its view: the element filter does not apply. */
|
|
29
|
+
shownIn() {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
project(model) {
|
|
34
|
+
return { ...super.project(model), viewObject: true };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
toJSON() {
|
|
38
|
+
return { ...super.toJSON(), content: { ...this.content } };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static fromJSON(data) {
|
|
42
|
+
const inst = new ViewObjectInstance(data.content, data.x, data.y);
|
|
43
|
+
inst.labelOverride = data.labelOverride ?? null;
|
|
44
|
+
inst.visible = data.visible !== false;
|
|
45
|
+
inst.zIndex = data.zIndex || 0;
|
|
46
|
+
inst.size = { ...(data.size ?? {}) };
|
|
47
|
+
inst.appearance = { ...(data.appearance ?? {}) };
|
|
48
|
+
inst.archi = data.archi ? structuredCopy(data.archi) : null;
|
|
49
|
+
return inst;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** An element or view-object instance from its JSON form. */
|
|
54
|
+
export function instanceFromJSON(data) {
|
|
55
|
+
return data?.content ? ViewObjectInstance.fromJSON(data) : ElementInstance.fromJSON(data);
|
|
56
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { EdgeCommand } from './GraphCommand.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* AddEdgeCommand — adds an edge to the current diagram. Execute and redo
|
|
5
|
+
* report it through `onAdd` (the diagram's `onEdgeAdd`), undo through
|
|
6
|
+
* `onEdgeRemove(edge)`, so a host can keep its own record in step. A host may
|
|
7
|
+
* give the edge an `id` in `onAdd`; the command then finds it by that id after
|
|
8
|
+
* a re-render.
|
|
9
|
+
*/
|
|
10
|
+
export class AddEdgeCommand extends EdgeCommand {
|
|
11
|
+
constructor(edge, { diagram, label = 'Add edge', onAdd } = {}) {
|
|
12
|
+
super(label, edge, diagram);
|
|
13
|
+
this._onAdd = onAdd;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
execute() {
|
|
17
|
+
const edges = this.diagram?._chartState?.edges;
|
|
18
|
+
if (!edges) return;
|
|
19
|
+
const edge = this.edge;
|
|
20
|
+
if (!edges.includes(edge)) edges.push(edge);
|
|
21
|
+
this._redraw();
|
|
22
|
+
this._onAdd?.(edge);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
undo() {
|
|
26
|
+
const edges = this.diagram?._chartState?.edges;
|
|
27
|
+
if (!edges) return;
|
|
28
|
+
const edge = this.edge;
|
|
29
|
+
const i = edges.indexOf(edge);
|
|
30
|
+
if (i >= 0) edges.splice(i, 1);
|
|
31
|
+
this._redraw();
|
|
32
|
+
this.options.onEdgeRemove?.(edge);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Command } from '../../CommandHistory.js';
|
|
2
|
+
|
|
3
|
+
export class AddNodeCommand extends Command {
|
|
4
|
+
constructor(node, { diagram, label = 'Add node', onAdd } = {}) {
|
|
5
|
+
super(label);
|
|
6
|
+
this._nodeRef = node;
|
|
7
|
+
this._diagram = diagram;
|
|
8
|
+
this._onAdd = onAdd;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
execute() {
|
|
12
|
+
const nodes = this._diagram?._chartState?.nodes;
|
|
13
|
+
if (!nodes) return;
|
|
14
|
+
if (!nodes.includes(this._nodeRef)) {
|
|
15
|
+
nodes.push(this._nodeRef);
|
|
16
|
+
}
|
|
17
|
+
this._diagram?._rerenderGraph?.();
|
|
18
|
+
this._onAdd?.(this._nodeRef);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
undo() {
|
|
22
|
+
const nodes = this._diagram?._chartState?.nodes;
|
|
23
|
+
if (!nodes) return;
|
|
24
|
+
const i = nodes.indexOf(this._nodeRef);
|
|
25
|
+
if (i >= 0) nodes.splice(i, 1);
|
|
26
|
+
this._diagram?._rerenderGraph?.();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { WaypointCommand } from './GraphCommand.js';
|
|
2
|
+
|
|
3
|
+
export class AddWaypointCommand extends WaypointCommand {
|
|
4
|
+
constructor(edge, point, { diagram, label = 'Add waypoint', index = -1 } = {}) {
|
|
5
|
+
super(label, edge, diagram);
|
|
6
|
+
this.point = { ...point };
|
|
7
|
+
this._index = index;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
execute() {
|
|
11
|
+
const edge = this.edge;
|
|
12
|
+
if (!edge) return;
|
|
13
|
+
if (!edge.waypoints) edge.waypoints = [];
|
|
14
|
+
const idx = this._index >= 0 ? this._index : edge.waypoints.length;
|
|
15
|
+
edge.waypoints.splice(idx, 0, { ...this.point });
|
|
16
|
+
this._actualIndex = idx;
|
|
17
|
+
this._changed(edge);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
undo() {
|
|
21
|
+
const edge = this.edge;
|
|
22
|
+
if (!edge?.waypoints) return;
|
|
23
|
+
const idx = this._actualIndex ?? this._index;
|
|
24
|
+
if (idx >= 0) edge.waypoints.splice(idx, 1);
|
|
25
|
+
this._changed(edge);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Command to create a new folder */
|
|
2
|
+
export class CreateFolderCommand {
|
|
3
|
+
constructor(folder, { diagram = null, onAdd = null } = {}) {
|
|
4
|
+
this.folder = folder;
|
|
5
|
+
this.diagram = diagram;
|
|
6
|
+
this.onAdd = onAdd;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
execute() {
|
|
10
|
+
if (this.diagram?.engine?.getArchimateModel) {
|
|
11
|
+
const model = this.diagram.engine.getArchimateModel?.();
|
|
12
|
+
if (model && model._folders) {
|
|
13
|
+
model._folders.set(this.folder.id, { ...this.folder });
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
this.onAdd?.(this.folder);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
undo() {
|
|
20
|
+
if (this.diagram?.engine?.getArchimateModel) {
|
|
21
|
+
const model = this.diagram.engine.getArchimateModel?.();
|
|
22
|
+
if (model && model._folders) {
|
|
23
|
+
model._folders.delete(this.folder.id);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Command } from '../../CommandHistory.js';
|
|
2
|
+
|
|
3
|
+
export class DeleteEdgeCommand extends Command {
|
|
4
|
+
constructor(edge, { diagram, label = 'Delete edge', suppressRender = false, onDelete } = {}) {
|
|
5
|
+
super(label);
|
|
6
|
+
/** @type {object} The actual edge object reference in the diagram. */
|
|
7
|
+
this._edgeRef = edge;
|
|
8
|
+
this._diagram = diagram;
|
|
9
|
+
this._suppressRender = suppressRender;
|
|
10
|
+
this._onDelete = onDelete;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
execute() {
|
|
14
|
+
const edges = this._diagram?._chartState?.edges;
|
|
15
|
+
if (!edges) return;
|
|
16
|
+
const i = edges.indexOf(this._edgeRef);
|
|
17
|
+
if (i >= 0) {
|
|
18
|
+
this._removed = edges.splice(i, 1)[0];
|
|
19
|
+
}
|
|
20
|
+
if (!this._suppressRender) this._diagram?._rerenderGraph?.();
|
|
21
|
+
this._onDelete?.(this._removed ?? this._edgeRef);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
undo() {
|
|
25
|
+
const edges = this._diagram?._chartState?.edges;
|
|
26
|
+
if (!edges || !this._removed) return;
|
|
27
|
+
edges.push(this._removed);
|
|
28
|
+
if (!this._suppressRender) this._diagram?._rerenderGraph?.();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** Command to delete a folder (moves children to parent) */
|
|
2
|
+
export class DeleteFolderCommand {
|
|
3
|
+
constructor(folderId, { diagram = null, onDelete = null } = {}) {
|
|
4
|
+
this.folderId = folderId;
|
|
5
|
+
this.folder = null; // Saved during execute
|
|
6
|
+
this.diagram = diagram;
|
|
7
|
+
this.onDelete = onDelete;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
execute() {
|
|
11
|
+
if (this.diagram?.engine?.getArchimateModel) {
|
|
12
|
+
const model = this.diagram.engine.getArchimateModel?.();
|
|
13
|
+
if (model && model._folders) {
|
|
14
|
+
this.folder = model._folders.get(this.folderId);
|
|
15
|
+
if (this.folder) {
|
|
16
|
+
// Move children to parent folder
|
|
17
|
+
const parentId = this.folder.parentId;
|
|
18
|
+
const allFolders = model.allFolders?.() || [];
|
|
19
|
+
for (const folder of allFolders) {
|
|
20
|
+
if (folder.parentId === this.folderId) {
|
|
21
|
+
folder.parentId = parentId || undefined;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
model._folders.delete(this.folderId);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
this.onDelete?.(this.folderId);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
undo() {
|
|
32
|
+
if (this.folder && this.diagram?.engine?.getArchimateModel) {
|
|
33
|
+
const model = this.diagram.engine.getArchimateModel?.();
|
|
34
|
+
if (model && model._folders) {
|
|
35
|
+
model._folders.set(this.folderId, { ...this.folder });
|
|
36
|
+
// Restore children's parent references
|
|
37
|
+
const allFolders = model.allFolders?.() || [];
|
|
38
|
+
for (const folder of allFolders) {
|
|
39
|
+
if (folder.parentId === (this.folder.parentId || undefined) && folder.id !== this.folderId) {
|
|
40
|
+
// Find folders that were moved to parent - can't reliably restore without tracking
|
|
41
|
+
// This is a limitation of not tracking the exact moves
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Command, CompositeCommand } from '../../CommandHistory.js';
|
|
2
|
+
import { DeleteEdgeCommand } from './DeleteEdgeCommand.js';
|
|
3
|
+
|
|
4
|
+
export class DeleteNodeCommand extends CompositeCommand {
|
|
5
|
+
constructor(node, edges, { diagram, label = 'Delete node' } = {}) {
|
|
6
|
+
super(label);
|
|
7
|
+
this.node = { ...node };
|
|
8
|
+
this._diagram = diagram;
|
|
9
|
+
this._addNodeSubcommand();
|
|
10
|
+
for (const edge of edges) {
|
|
11
|
+
this.add(new DeleteEdgeCommand(edge, { diagram, suppressRender: true }));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
_addNodeSubcommand() {
|
|
16
|
+
const node = this.node;
|
|
17
|
+
const diagram = this._diagram;
|
|
18
|
+
this.add(new (class extends Command {
|
|
19
|
+
constructor() { super('delete node'); }
|
|
20
|
+
execute() {
|
|
21
|
+
const nodes = diagram?._chartState?.nodes;
|
|
22
|
+
if (!nodes) return;
|
|
23
|
+
const i = nodes.findIndex(n => n.id === node.id);
|
|
24
|
+
if (i >= 0) nodes.splice(i, 1);
|
|
25
|
+
diagram?._rerenderGraph?.();
|
|
26
|
+
}
|
|
27
|
+
undo() {
|
|
28
|
+
const nodes = diagram?._chartState?.nodes;
|
|
29
|
+
if (!nodes || nodes.some(n => n.id === node.id)) return;
|
|
30
|
+
nodes.push({ ...node });
|
|
31
|
+
diagram?._rerenderGraph?.();
|
|
32
|
+
}
|
|
33
|
+
})());
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { WaypointCommand } from './GraphCommand.js';
|
|
2
|
+
|
|
3
|
+
export class DeleteWaypointCommand extends WaypointCommand {
|
|
4
|
+
constructor(edge, index, { diagram, label = 'Delete waypoint' } = {}) {
|
|
5
|
+
super(label, edge, diagram);
|
|
6
|
+
this.index = index;
|
|
7
|
+
this._removed = null;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
execute() {
|
|
11
|
+
const edge = this.edge;
|
|
12
|
+
if (!edge?.waypoints) return;
|
|
13
|
+
this._removed = edge.waypoints.splice(this.index, 1)[0];
|
|
14
|
+
this._changed(edge);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
undo() {
|
|
18
|
+
const edge = this.edge;
|
|
19
|
+
if (!edge || this._removed == null) return;
|
|
20
|
+
if (!edge.waypoints) edge.waypoints = [];
|
|
21
|
+
edge.waypoints.splice(this.index, 0, this._removed);
|
|
22
|
+
this._changed(edge);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Command } from '../../CommandHistory.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* GraphCommand — base for edits to a graph diagram's nodes and edges.
|
|
5
|
+
*
|
|
6
|
+
* A host that re-renders (ArchiMate rebuilds the diagram from its view) hands
|
|
7
|
+
* the engine one history that outlives each GraphDiagram, so a command may be
|
|
8
|
+
* undone after the diagram it was recorded on is gone. Commands therefore act
|
|
9
|
+
* on the diagram on screen now, finding nodes and edges by id.
|
|
10
|
+
*/
|
|
11
|
+
export class GraphCommand extends Command {
|
|
12
|
+
constructor(label, diagram) {
|
|
13
|
+
super(label);
|
|
14
|
+
this._diagram = diagram;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** The diagram on screen now (the one recorded on, if never re-rendered). */
|
|
18
|
+
get diagram() {
|
|
19
|
+
return this._diagram?.engine?._graphDiagram ?? this._diagram;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** The current diagram's options, where the host's change hooks live. */
|
|
23
|
+
get options() {
|
|
24
|
+
return this.diagram?._chartState?.options ?? {};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
_node(id) {
|
|
28
|
+
return this.diagram?._chartState?.nodes?.find(n => n.id === id);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** The current diagram's copy of `ref` (matched by id); `ref` itself when it has no id. */
|
|
32
|
+
_edge(ref) {
|
|
33
|
+
if (ref?.id == null) return ref;
|
|
34
|
+
return this.diagram?._chartState?.edges?.find(e => e.id === ref.id) ?? ref;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
_redraw() {
|
|
38
|
+
this.diagram?._rerenderGraph?.();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** EdgeCommand — base for edits to one edge, found on the current diagram. */
|
|
43
|
+
export class EdgeCommand extends GraphCommand {
|
|
44
|
+
constructor(label, edge, diagram) {
|
|
45
|
+
super(label, diagram);
|
|
46
|
+
this._edgeRef = edge;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
get edge() {
|
|
50
|
+
return this._edge(this._edgeRef);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* WaypointCommand — base for edits to one edge's bend points. Every apply,
|
|
56
|
+
* including undo and redo, reports the edge's new route through
|
|
57
|
+
* `onEdgeWaypointsChange(edge, waypoints)`, so a host's copy never drifts.
|
|
58
|
+
*/
|
|
59
|
+
export class WaypointCommand extends EdgeCommand {
|
|
60
|
+
|
|
61
|
+
_changed(edge) {
|
|
62
|
+
this._redraw();
|
|
63
|
+
this.options.onEdgeWaypointsChange?.(edge, edge.waypoints ?? []);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Command } from '../../CommandHistory.js';
|
|
2
|
+
|
|
3
|
+
export class InvertEdgeCommand extends Command {
|
|
4
|
+
constructor(edge, { diagram, label = 'Invert edge', onInvert } = {}) {
|
|
5
|
+
super(label);
|
|
6
|
+
this._edgeRef = edge;
|
|
7
|
+
this._diagram = diagram;
|
|
8
|
+
this._onInvert = onInvert;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
execute() { this._swap(); }
|
|
12
|
+
undo() { this._swap(); }
|
|
13
|
+
|
|
14
|
+
_swap() {
|
|
15
|
+
const edge = this._edgeRef;
|
|
16
|
+
if (!edge) return;
|
|
17
|
+
const oldSource = edge.source;
|
|
18
|
+
const oldTarget = edge.target;
|
|
19
|
+
edge.source = oldTarget;
|
|
20
|
+
edge.target = oldSource;
|
|
21
|
+
this._diagram?._rerenderGraph?.();
|
|
22
|
+
this._onInvert?.(edge, oldSource, oldTarget);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { GraphCommand } from './GraphCommand.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* MoveNodeCommand — repositions one node and coalesces with the previous
|
|
5
|
+
* drag of the same node so a long drag doesn't create dozens of history entries.
|
|
6
|
+
* Every apply, including undo and redo, reports the position through
|
|
7
|
+
* `onNodeMove(nodeId, {x, y})`.
|
|
8
|
+
*/
|
|
9
|
+
export class MoveNodeCommand extends GraphCommand {
|
|
10
|
+
constructor(nodeId, from, to, { diagram, label = 'Move node' } = {}) {
|
|
11
|
+
super(label, diagram);
|
|
12
|
+
this.nodeId = nodeId;
|
|
13
|
+
this.from = { ...from };
|
|
14
|
+
this.to = { ...to };
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
execute() {
|
|
18
|
+
this._apply(this.to);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
undo() {
|
|
22
|
+
this._apply(this.from);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
_apply(pos) {
|
|
26
|
+
const node = this._node(this.nodeId);
|
|
27
|
+
if (!node) return;
|
|
28
|
+
node.x = pos.x;
|
|
29
|
+
node.y = pos.y;
|
|
30
|
+
// Also update the live simulation/drag position map so _rerenderGraph
|
|
31
|
+
// doesn't copy stale dragged positions back onto the node.
|
|
32
|
+
const p = this.diagram?._graph?.pos?.get(this.nodeId);
|
|
33
|
+
if (p) { p.x = pos.x; p.y = pos.y; }
|
|
34
|
+
this._redraw();
|
|
35
|
+
this.options.onNodeMove?.(this.nodeId, { x: pos.x, y: pos.y });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
merge(other) {
|
|
39
|
+
if (other instanceof MoveNodeCommand && other.nodeId === this.nodeId) {
|
|
40
|
+
return new MoveNodeCommand(this.nodeId, this.from, other.to, { diagram: this._diagram, label: this.label });
|
|
41
|
+
}
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { WaypointCommand } from './GraphCommand.js';
|
|
2
|
+
|
|
3
|
+
export class MoveWaypointCommand extends WaypointCommand {
|
|
4
|
+
constructor(edge, index, from, to, { diagram, label = 'Move waypoint' } = {}) {
|
|
5
|
+
super(label, edge, diagram);
|
|
6
|
+
this.index = index;
|
|
7
|
+
this.from = { ...from };
|
|
8
|
+
this.to = { ...to };
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
execute() { this._apply(this.to); }
|
|
12
|
+
undo() { this._apply(this.from); }
|
|
13
|
+
|
|
14
|
+
_apply(pos) {
|
|
15
|
+
const edge = this.edge;
|
|
16
|
+
if (!edge?.waypoints || !edge.waypoints[this.index]) return;
|
|
17
|
+
edge.waypoints[this.index] = { ...pos };
|
|
18
|
+
this._changed(edge);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
merge(other) {
|
|
22
|
+
if (other instanceof MoveWaypointCommand && other._edgeRef === this._edgeRef && other.index === this.index) {
|
|
23
|
+
return new MoveWaypointCommand(this._edgeRef, this.index, this.from, other.to, { diagram: this._diagram, label: this.label });
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Command } from '../../CommandHistory.js';
|
|
2
|
+
|
|
3
|
+
export class RenameEdgeCommand extends Command {
|
|
4
|
+
constructor(edge, from, to, { diagram, label = 'Rename edge', onRename } = {}) {
|
|
5
|
+
super(label);
|
|
6
|
+
this._edgeRef = edge;
|
|
7
|
+
this.from = from;
|
|
8
|
+
this.to = to;
|
|
9
|
+
this._diagram = diagram;
|
|
10
|
+
this._onRename = onRename;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
execute() { this._apply(this.to); }
|
|
14
|
+
undo() { this._apply(this.from); }
|
|
15
|
+
|
|
16
|
+
_apply(name) {
|
|
17
|
+
const edge = this._edgeRef;
|
|
18
|
+
if (!edge) return;
|
|
19
|
+
edge.label = name;
|
|
20
|
+
this._diagram?._rerenderGraph?.();
|
|
21
|
+
this._onRename?.(edge, name);
|
|
22
|
+
}
|
|
23
|
+
}
|