@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,238 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic tree component builder for hierarchical node rendering.
|
|
3
|
+
* Handles expand/collapse, selection, context menus, and recursive rendering.
|
|
4
|
+
* Domain code provides node data and callbacks; TreeBuilder handles UI.
|
|
5
|
+
*/
|
|
6
|
+
export class TreeBuilder {
|
|
7
|
+
/**
|
|
8
|
+
* Create a tree builder instance.
|
|
9
|
+
* @param {Document} doc - Document object for creating elements
|
|
10
|
+
* @param {Object} options - Configuration options
|
|
11
|
+
* @param {HTMLElement} options.container - Element the tree renders into (an element, not an id,
|
|
12
|
+
* so several trees can share a page)
|
|
13
|
+
* @param {Array} options.rootNodes - Root-level nodes to render
|
|
14
|
+
* @param {Function} options.onNodeClick - Callback when node is clicked: (nodeId) => void
|
|
15
|
+
* @param {Function} options.onNodeContext - Callback for context menu: (event, node) => void
|
|
16
|
+
* @param {Function} options.getNodeChildren - Get children of a node: (node) => Array or null
|
|
17
|
+
* @param {(node) => (Node|null)} [options.iconFor] - A picture for a node (an element's type glyph);
|
|
18
|
+
* null: its `icon` text
|
|
19
|
+
* @param {Map<string, boolean>} [options.openState] - Which folders are open, by node id: kept
|
|
20
|
+
* by the caller so a rebuilt tree opens them as they were. A folder not in it is open unless
|
|
21
|
+
* its node says `collapsed: true`; opening or closing one records it here.
|
|
22
|
+
*/
|
|
23
|
+
constructor(doc, { container, rootNodes = [], onNodeClick = null, onNodeContext = null, getNodeChildren = null, openState = new Map(), iconFor = null } = {}) {
|
|
24
|
+
this.doc = doc;
|
|
25
|
+
this.container = container;
|
|
26
|
+
this.rootNodes = rootNodes;
|
|
27
|
+
this.onNodeClick = onNodeClick;
|
|
28
|
+
this.onNodeContext = onNodeContext;
|
|
29
|
+
this.getNodeChildren = getNodeChildren;
|
|
30
|
+
this.openState = openState;
|
|
31
|
+
this.iconFor = iconFor;
|
|
32
|
+
this.selectedNode = null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Render the tree into the container.
|
|
37
|
+
* @param {Array} nodes - Nodes to render (defaults to rootNodes)
|
|
38
|
+
*/
|
|
39
|
+
render(nodes = this.rootNodes) {
|
|
40
|
+
const container = this.container;
|
|
41
|
+
if (!container) return;
|
|
42
|
+
|
|
43
|
+
container.innerHTML = '';
|
|
44
|
+
for (const node of nodes) {
|
|
45
|
+
container.appendChild(this._renderNode(node));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Render a single node with optional expand/collapse.
|
|
51
|
+
* @private
|
|
52
|
+
*/
|
|
53
|
+
_renderNode(node) {
|
|
54
|
+
const children = this.getNodeChildren?.(node) || [];
|
|
55
|
+
const hasChildren = children.length > 0;
|
|
56
|
+
|
|
57
|
+
if (hasChildren) {
|
|
58
|
+
return this._renderExpandable(node, children);
|
|
59
|
+
} else {
|
|
60
|
+
return this._renderLeaf(node);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Render a node with children as expandable <details> element.
|
|
66
|
+
* @private
|
|
67
|
+
*/
|
|
68
|
+
_renderExpandable(node, children) {
|
|
69
|
+
const details = this.doc.createElement('details');
|
|
70
|
+
details.open = this.openState.get(node.id) ?? !node.collapsed;
|
|
71
|
+
details.setAttribute('data-node-id', node.id);
|
|
72
|
+
details.addEventListener('toggle', () => this.openState.set(node.id, details.open));
|
|
73
|
+
|
|
74
|
+
const summary = this.doc.createElement('summary');
|
|
75
|
+
summary.style.cssText = `
|
|
76
|
+
cursor: pointer;
|
|
77
|
+
padding: 4px 6px;
|
|
78
|
+
margin: 2px 0;
|
|
79
|
+
border-radius: 3px;
|
|
80
|
+
user-select: none;
|
|
81
|
+
border-left: 3px solid transparent;
|
|
82
|
+
transition: background-color 0.1s;
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
gap: 6px;
|
|
86
|
+
`;
|
|
87
|
+
summary.setAttribute('data-node-id', node.id);
|
|
88
|
+
|
|
89
|
+
this._applyNodeStyling(summary, node);
|
|
90
|
+
summary.addEventListener('click', (e) => this._handleNodeClick(e, summary, node));
|
|
91
|
+
summary.addEventListener('contextmenu', (e) => this._handleNodeContext(e, node));
|
|
92
|
+
summary.addEventListener('mouseenter', () => this._onNodeHover(summary, true));
|
|
93
|
+
summary.addEventListener('mouseleave', () => this._onNodeHover(summary, false));
|
|
94
|
+
|
|
95
|
+
details.appendChild(summary);
|
|
96
|
+
|
|
97
|
+
const childContainer = this.doc.createElement('div');
|
|
98
|
+
childContainer.style.cssText = 'padding-left: 16px;';
|
|
99
|
+
for (const child of children) {
|
|
100
|
+
childContainer.appendChild(this._renderNode(child));
|
|
101
|
+
}
|
|
102
|
+
details.appendChild(childContainer);
|
|
103
|
+
|
|
104
|
+
return details;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Render a leaf node without children.
|
|
109
|
+
* @private
|
|
110
|
+
*/
|
|
111
|
+
_renderLeaf(node) {
|
|
112
|
+
const leaf = this.doc.createElement('div');
|
|
113
|
+
leaf.setAttribute('data-node-id', node.id);
|
|
114
|
+
// Element leaves are filter targets and drag sources; mark them here so a rebuilt tree keeps that.
|
|
115
|
+
if (node.type === 'element' && node._element) {
|
|
116
|
+
leaf.setAttribute('data-element-id', node._element.id);
|
|
117
|
+
leaf.draggable = true;
|
|
118
|
+
}
|
|
119
|
+
leaf.style.cssText = `
|
|
120
|
+
padding: 4px 6px;
|
|
121
|
+
margin: 2px 0;
|
|
122
|
+
border-radius: 3px;
|
|
123
|
+
cursor: pointer;
|
|
124
|
+
user-select: none;
|
|
125
|
+
border-left: 3px solid transparent;
|
|
126
|
+
transition: background-color 0.1s;
|
|
127
|
+
display: flex;
|
|
128
|
+
align-items: center;
|
|
129
|
+
gap: 6px;
|
|
130
|
+
`;
|
|
131
|
+
|
|
132
|
+
this._applyNodeStyling(leaf, node);
|
|
133
|
+
leaf.addEventListener('click', (e) => this._handleNodeClick(e, leaf, node));
|
|
134
|
+
leaf.addEventListener('contextmenu', (e) => this._handleNodeContext(e, node));
|
|
135
|
+
leaf.addEventListener('mouseenter', () => this._onNodeHover(leaf, true));
|
|
136
|
+
leaf.addEventListener('mouseleave', () => this._onNodeHover(leaf, false));
|
|
137
|
+
|
|
138
|
+
return leaf;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Apply icon and label to a node element.
|
|
143
|
+
* @private
|
|
144
|
+
*/
|
|
145
|
+
_applyNodeStyling(element, node) {
|
|
146
|
+
// Icon: a picture when iconFor gives one, else the node's icon text.
|
|
147
|
+
const picture = this.iconFor?.(node) ?? null;
|
|
148
|
+
if (picture) {
|
|
149
|
+
const icon = this.doc.createElement('span');
|
|
150
|
+
icon.style.cssText = 'flex-shrink: 0; display: inline-flex; align-items: center;';
|
|
151
|
+
icon.appendChild(picture);
|
|
152
|
+
element.appendChild(icon);
|
|
153
|
+
} else if (node.icon) {
|
|
154
|
+
const icon = this.doc.createElement('span');
|
|
155
|
+
icon.textContent = node.icon;
|
|
156
|
+
icon.style.cssText = 'flex-shrink: 0; font-size: 14px;';
|
|
157
|
+
element.appendChild(icon);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Label
|
|
161
|
+
const label = this.doc.createElement('span');
|
|
162
|
+
label.textContent = node.label || 'Untitled';
|
|
163
|
+
element.appendChild(label);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Handle node click (selection).
|
|
168
|
+
* @private
|
|
169
|
+
*/
|
|
170
|
+
_handleNodeClick(event, element, node) {
|
|
171
|
+
event.stopPropagation();
|
|
172
|
+
|
|
173
|
+
// Deselect previous
|
|
174
|
+
if (this.selectedNode) {
|
|
175
|
+
this.selectedNode.style.background = '';
|
|
176
|
+
this.selectedNode.style.borderLeftColor = 'transparent';
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Select new
|
|
180
|
+
element.style.background = 'var(--accent, #91cc75)';
|
|
181
|
+
element.style.borderLeftColor = 'var(--accent-dark, #5ba344)';
|
|
182
|
+
element.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
|
183
|
+
this.selectedNode = element;
|
|
184
|
+
|
|
185
|
+
// Invoke callback
|
|
186
|
+
this.onNodeClick?.(node.id, node);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Handle node context menu.
|
|
191
|
+
* @private
|
|
192
|
+
*/
|
|
193
|
+
_handleNodeContext(event, node) {
|
|
194
|
+
event.preventDefault();
|
|
195
|
+
event.stopPropagation();
|
|
196
|
+
this.onNodeContext?.(event, node);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Handle node hover styling.
|
|
201
|
+
* @private
|
|
202
|
+
*/
|
|
203
|
+
_onNodeHover(element, isEntering) {
|
|
204
|
+
if (isEntering && element.style.background === '') {
|
|
205
|
+
element.style.background = '#f0f0f0';
|
|
206
|
+
} else if (!isEntering && element.style.background === 'rgb(240, 240, 240)') {
|
|
207
|
+
element.style.background = '';
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Select a node by ID programmatically.
|
|
213
|
+
*/
|
|
214
|
+
selectNode(nodeId) {
|
|
215
|
+
const element = this.doc.querySelector(`[data-node-id="${nodeId}"]`);
|
|
216
|
+
if (element) {
|
|
217
|
+
if (this.selectedNode) {
|
|
218
|
+
this.selectedNode.style.background = '';
|
|
219
|
+
this.selectedNode.style.borderLeftColor = 'transparent';
|
|
220
|
+
}
|
|
221
|
+
element.style.background = 'var(--accent, #91cc75)';
|
|
222
|
+
element.style.borderLeftColor = 'var(--accent-dark, #5ba344)';
|
|
223
|
+
element.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
|
224
|
+
this.selectedNode = element;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Clear selection.
|
|
230
|
+
*/
|
|
231
|
+
clearSelection() {
|
|
232
|
+
if (this.selectedNode) {
|
|
233
|
+
this.selectedNode.style.background = '';
|
|
234
|
+
this.selectedNode.style.borderLeftColor = 'transparent';
|
|
235
|
+
this.selectedNode = null;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { TreeViewMode } from './TreeViewMode.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Registry for tree view modes, mirrors DiagramRegistry/ChartRegistry pattern.
|
|
5
|
+
*/
|
|
6
|
+
export class TreeModeRegistry {
|
|
7
|
+
constructor(entries = []) {
|
|
8
|
+
this._entries = [];
|
|
9
|
+
this._index = new Map();
|
|
10
|
+
for (const entry of entries) this.register(entry);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
get size() { return this._entries.length; }
|
|
14
|
+
|
|
15
|
+
register(entry) {
|
|
16
|
+
if (!entry || typeof entry.key !== 'string') {
|
|
17
|
+
throw new TypeError('TreeModeRegistry entry must have a string key');
|
|
18
|
+
}
|
|
19
|
+
if (!entry.TreeModeClass || !(entry.TreeModeClass.prototype instanceof TreeViewMode)) {
|
|
20
|
+
throw new TypeError(
|
|
21
|
+
`${entry.TreeModeClass?.name ?? entry.TreeModeClass} must extend TreeViewMode`
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
if (entry.TreeModeClass.key !== entry.key) {
|
|
25
|
+
throw new TypeError(
|
|
26
|
+
`TreeModeClass.key (${entry.TreeModeClass.key}) must match entry.key (${entry.key})`
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (this._index.has(entry.key)) {
|
|
31
|
+
const i = this._entries.findIndex(e => e.key === entry.key);
|
|
32
|
+
this._entries[i] = entry;
|
|
33
|
+
} else {
|
|
34
|
+
this._entries.push(entry);
|
|
35
|
+
}
|
|
36
|
+
this._index.set(entry.key, entry);
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
unregister(key) {
|
|
41
|
+
const i = this._entries.findIndex(e => e.key === key);
|
|
42
|
+
if (i !== -1) this._entries.splice(i, 1);
|
|
43
|
+
return this._index.delete(key);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
get(key) { return this._index.get(key); }
|
|
47
|
+
list() { return this._entries.slice(); }
|
|
48
|
+
keys() { return this._entries.map(e => e.key); }
|
|
49
|
+
classes() { return this._entries.map(e => e.TreeModeClass); }
|
|
50
|
+
has(key) { return this._index.has(key); }
|
|
51
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abstract base class for tree grouping/presentation modes.
|
|
3
|
+
* Subclasses implement buildGroups() to organize model elements into groups.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export class TreeViewMode {
|
|
7
|
+
static key = null; // registry key; subclasses override
|
|
8
|
+
static label = ''; // human-readable label; subclasses override
|
|
9
|
+
|
|
10
|
+
constructor() {
|
|
11
|
+
if (new.target === TreeViewMode) {
|
|
12
|
+
throw new TypeError('TreeViewMode is abstract — subclass it');
|
|
13
|
+
}
|
|
14
|
+
if (!this.constructor.key) {
|
|
15
|
+
throw new TypeError(`${this.constructor.name} must define static key`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Build groups from model elements.
|
|
21
|
+
* @param {ArchimateModel} model
|
|
22
|
+
* @param {Object} opts
|
|
23
|
+
* @param {string} opts.filterText - text to filter by (case-insensitive name/type/layer)
|
|
24
|
+
* @param {Set<string>} opts.typeIds - filter by element type (e.g. Set(['type:business-actor']))
|
|
25
|
+
* @param {Set<string>} opts.specializationIds - filter by specialization (e.g. Set(['spec:Microservice']))
|
|
26
|
+
* @param {Set<string>} opts.propertyIds - filter by property values (e.g. Set(['propval:Owner=Alice']))
|
|
27
|
+
* @returns {Array<{label, items: Array<{id, kind, label, type}>}>}
|
|
28
|
+
*/
|
|
29
|
+
buildGroups(model, { filterText = '', typeIds = null, specializationIds = null, propertyIds = null } = {}) {
|
|
30
|
+
throw new Error(`${this.constructor.name} must implement buildGroups()`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Check if an item matches all active filters (text + type + specialization + properties).
|
|
35
|
+
* Subclasses can override for custom filtering logic.
|
|
36
|
+
* @protected
|
|
37
|
+
*/
|
|
38
|
+
_matchesFilter(item, { text = '', typeIds = null, specializationIds = null, propertyIds = null } = {}) {
|
|
39
|
+
// Text filter (label or type)
|
|
40
|
+
if (text) {
|
|
41
|
+
const textLower = text.toLowerCase();
|
|
42
|
+
const label = (item.label ?? '').toLowerCase();
|
|
43
|
+
const type = (item.type ?? '').toLowerCase();
|
|
44
|
+
if (!label.includes(textLower) && !type.includes(textLower)) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Type filter (elements only; 'type:business-actor' format)
|
|
50
|
+
if (typeIds && typeIds.size > 0 && item.kind === 'element') {
|
|
51
|
+
const typeId = `type:${item.type}`;
|
|
52
|
+
if (!typeIds.has(typeId)) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Specialization filter (elements only; 'spec:Microservice' format)
|
|
58
|
+
if (specializationIds && specializationIds.size > 0 && item.kind === 'element') {
|
|
59
|
+
if (!item.specialization) {
|
|
60
|
+
// Elements without specialization don't match specialization filters
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
const specId = `spec:${item.specialization}`;
|
|
64
|
+
if (!specializationIds.has(specId)) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Property filter ('propval:PropertyName=Value' format; both elements and relationships)
|
|
70
|
+
if (propertyIds && propertyIds.size > 0) {
|
|
71
|
+
if (!Array.isArray(item.properties)) {
|
|
72
|
+
// No properties defined — doesn't match property filter
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
// Check if any property matches the filter
|
|
76
|
+
const matches = item.properties.some(prop => {
|
|
77
|
+
const propId = `propval:${prop.name}=${prop.value}`;
|
|
78
|
+
return propertyIds.has(propId);
|
|
79
|
+
});
|
|
80
|
+
if (!matches) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** Group items into {label, items} structure. @protected */
|
|
89
|
+
_group(items, keyFn, labelFn) {
|
|
90
|
+
const groups = new Map();
|
|
91
|
+
for (const item of items) {
|
|
92
|
+
const key = keyFn(item);
|
|
93
|
+
if (!groups.has(key)) {
|
|
94
|
+
groups.set(key, { label: labelFn(key), items: [] });
|
|
95
|
+
}
|
|
96
|
+
groups.get(key).items.push(item);
|
|
97
|
+
}
|
|
98
|
+
return Array.from(groups.values());
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** Get elements from model (handles both ArchimateModel.elements() and ArchimateView.elements). @protected */
|
|
102
|
+
_getElements(model) {
|
|
103
|
+
return typeof model.elements === 'function' ? model.elements() : model.elements;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** Get relationships from model (handles both ArchimateModel.relationships() and ArchimateView.relationships). @protected */
|
|
107
|
+
_getRelationships(model) {
|
|
108
|
+
return typeof model.relationships === 'function' ? model.relationships() : model.relationships;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* buildFilterTrees — pure functions to construct checkbox-tree node structures from a model.
|
|
3
|
+
*
|
|
4
|
+
* No DOM, no side effects. Returns plain { id, label, children? } tree nodes ready to pass
|
|
5
|
+
* to CheckboxTreeSelector.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { ArchimateDiagram } from '../diagrams/ArchimateDiagram.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Build a hierarchical tree: Layer → Type → Specialization
|
|
12
|
+
* Only includes specializations that actually exist in the model for that type.
|
|
13
|
+
*
|
|
14
|
+
* @param {ArchimateModel} model
|
|
15
|
+
* @param {string} archimateVersion - '3.2' or '4' (default '4')
|
|
16
|
+
* @returns {Array<{id, label, children}>}
|
|
17
|
+
*/
|
|
18
|
+
export function buildTypeCategoryTree(model, { archimateVersion = '4' } = {}) {
|
|
19
|
+
const elements = model.elements();
|
|
20
|
+
|
|
21
|
+
// Collect layers present in model
|
|
22
|
+
const layerMap = new Map(); // layer name -> { layer, types: Map<typeName, {type, specs: Set}> }
|
|
23
|
+
|
|
24
|
+
for (const element of elements) {
|
|
25
|
+
// The layer the diagram draws it in (an IT type's too; v4 Common Domain types have none)
|
|
26
|
+
const layerName = ArchimateDiagram.elementLayer(element, archimateVersion);
|
|
27
|
+
|
|
28
|
+
if (!layerMap.has(layerName)) {
|
|
29
|
+
layerMap.set(layerName, { layer: layerName, types: new Map() });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const entry = layerMap.get(layerName);
|
|
33
|
+
if (!entry.types.has(element.type)) {
|
|
34
|
+
entry.types.set(element.type, { type: element.type, specs: new Set() });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Collect specializations for this type in this layer
|
|
38
|
+
if (element.specialization) {
|
|
39
|
+
entry.types.get(element.type).specs.add(element.specialization);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Build tree: layers sorted by name, types by name, specs by name
|
|
44
|
+
const tree = [];
|
|
45
|
+
for (const [layerName, layerEntry] of new Map([...layerMap].sort())) {
|
|
46
|
+
const typeChildren = [];
|
|
47
|
+
|
|
48
|
+
for (const [typeName, typeEntry] of new Map([...layerEntry.types].sort())) {
|
|
49
|
+
const specChildren = [];
|
|
50
|
+
|
|
51
|
+
for (const spec of new Set([...typeEntry.specs].sort())) {
|
|
52
|
+
specChildren.push({
|
|
53
|
+
id: `spec:${spec}`,
|
|
54
|
+
label: spec,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
typeChildren.push({
|
|
59
|
+
id: `type:${typeName}`,
|
|
60
|
+
label: typeName,
|
|
61
|
+
children: specChildren.length > 0 ? specChildren : undefined,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
tree.push({
|
|
66
|
+
id: `layer:${layerName}`,
|
|
67
|
+
label: layerName,
|
|
68
|
+
children: typeChildren.length > 0 ? typeChildren : undefined,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return tree;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Build a tree: Property Name → Property Value
|
|
77
|
+
* Scans all custom properties on elements and relationships in the model.
|
|
78
|
+
* Only includes property values that actually exist.
|
|
79
|
+
*
|
|
80
|
+
* @param {ArchimateModel} model
|
|
81
|
+
* @returns {Array<{id, label, children}>}
|
|
82
|
+
*/
|
|
83
|
+
export function buildPropertyTree(model) {
|
|
84
|
+
const elements = model.elements();
|
|
85
|
+
const relationships = model.relationships();
|
|
86
|
+
|
|
87
|
+
// Collect property names and their values
|
|
88
|
+
const propMap = new Map(); // propName -> Set<value>
|
|
89
|
+
|
|
90
|
+
for (const element of elements) {
|
|
91
|
+
if (Array.isArray(element.properties)) {
|
|
92
|
+
for (const prop of element.properties) {
|
|
93
|
+
const propName = String(prop.name);
|
|
94
|
+
const propValue = String(prop.value);
|
|
95
|
+
|
|
96
|
+
if (!propMap.has(propName)) {
|
|
97
|
+
propMap.set(propName, new Set());
|
|
98
|
+
}
|
|
99
|
+
propMap.get(propName).add(propValue);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
for (const rel of relationships) {
|
|
105
|
+
if (Array.isArray(rel.properties)) {
|
|
106
|
+
for (const prop of rel.properties) {
|
|
107
|
+
const propName = String(prop.name);
|
|
108
|
+
const propValue = String(prop.value);
|
|
109
|
+
|
|
110
|
+
if (!propMap.has(propName)) {
|
|
111
|
+
propMap.set(propName, new Set());
|
|
112
|
+
}
|
|
113
|
+
propMap.get(propName).add(propValue);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Build tree: property names sorted, values sorted per name
|
|
119
|
+
const tree = [];
|
|
120
|
+
for (const [propName, values] of new Map([...propMap].sort())) {
|
|
121
|
+
const valueChildren = [];
|
|
122
|
+
|
|
123
|
+
for (const value of new Set([...values].sort())) {
|
|
124
|
+
valueChildren.push({
|
|
125
|
+
id: `propval:${propName}=${value}`,
|
|
126
|
+
label: value,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
tree.push({
|
|
131
|
+
id: `prop:${propName}`,
|
|
132
|
+
label: propName,
|
|
133
|
+
children: valueChildren.length > 0 ? valueChildren : undefined,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return tree;
|
|
138
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { TreeViewMode } from '../TreeViewMode.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Tree mode: flat alphabetical list of all elements and relationships.
|
|
5
|
+
*/
|
|
6
|
+
export class FlatTreeMode extends TreeViewMode {
|
|
7
|
+
static key = 'flat';
|
|
8
|
+
static label = 'Flat';
|
|
9
|
+
|
|
10
|
+
buildGroups(model, { filterText = '', typeIds = null, specializationIds = null, propertyIds = null } = {}) {
|
|
11
|
+
// Build element items (include specialization and properties for filtering)
|
|
12
|
+
const elementItems = this._getElements(model).map(el => ({
|
|
13
|
+
id: el.id,
|
|
14
|
+
kind: 'element',
|
|
15
|
+
label: el.name || '(unnamed)',
|
|
16
|
+
type: el.type,
|
|
17
|
+
icon: el.icon,
|
|
18
|
+
specialization: el.specialization,
|
|
19
|
+
properties: el.properties,
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
// Build relationship items
|
|
23
|
+
const relationshipItems = this._getRelationships(model).map(rel => ({
|
|
24
|
+
id: rel.id,
|
|
25
|
+
kind: 'relationship',
|
|
26
|
+
label: rel.label || `${rel.source} → ${rel.target}`,
|
|
27
|
+
type: rel.kind,
|
|
28
|
+
properties: rel.properties,
|
|
29
|
+
}));
|
|
30
|
+
|
|
31
|
+
// Combine and filter with all criteria
|
|
32
|
+
const allItems = [...elementItems, ...relationshipItems];
|
|
33
|
+
const filtered = allItems.filter(item => this._matchesFilter(item, { text: filterText, typeIds, specializationIds, propertyIds }));
|
|
34
|
+
|
|
35
|
+
// Sort alphabetically
|
|
36
|
+
filtered.sort((a, b) => a.label.localeCompare(b.label));
|
|
37
|
+
|
|
38
|
+
// Single group containing all
|
|
39
|
+
if (filtered.length === 0) return [];
|
|
40
|
+
|
|
41
|
+
return [{
|
|
42
|
+
label: '',
|
|
43
|
+
items: filtered,
|
|
44
|
+
}];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { TreeViewMode } from '../TreeViewMode.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Tree mode: groups elements by ArchiMate layer, then relationships.
|
|
5
|
+
* Replicates the demo's current behavior.
|
|
6
|
+
*/
|
|
7
|
+
export class LayerGroupedTreeMode extends TreeViewMode {
|
|
8
|
+
static key = 'byLayer';
|
|
9
|
+
static label = 'By Layer';
|
|
10
|
+
|
|
11
|
+
buildGroups(model, { filterText = '', typeIds = null, specializationIds = null, propertyIds = null } = {}) {
|
|
12
|
+
// Build element items (include specialization and properties for filtering)
|
|
13
|
+
const elementItems = this._getElements(model).map(el => ({
|
|
14
|
+
id: el.id,
|
|
15
|
+
kind: 'element',
|
|
16
|
+
label: el.name || '(unnamed)',
|
|
17
|
+
type: el.type,
|
|
18
|
+
layer: el.layer,
|
|
19
|
+
icon: el.icon,
|
|
20
|
+
specialization: el.specialization,
|
|
21
|
+
properties: el.properties,
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
// Filter elements with all criteria
|
|
25
|
+
const filtered = elementItems.filter(item => this._matchesFilter(item, { text: filterText, typeIds, specializationIds, propertyIds }));
|
|
26
|
+
|
|
27
|
+
// Group by layer
|
|
28
|
+
const layerGroups = this._group(
|
|
29
|
+
filtered,
|
|
30
|
+
item => item.layer || 'Other',
|
|
31
|
+
layer => layer
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
// Sort layers in a sensible order (layers are lowercase-kebab)
|
|
35
|
+
const layerOrder = ['strategy', 'business', 'application', 'technology', 'physical', 'implementation', 'motivation', 'Other'];
|
|
36
|
+
layerGroups.sort((a, b) => {
|
|
37
|
+
const aIdx = layerOrder.indexOf(a.label);
|
|
38
|
+
const bIdx = layerOrder.indexOf(b.label);
|
|
39
|
+
return (aIdx === -1 ? 999 : aIdx) - (bIdx === -1 ? 999 : bIdx);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// Add relationships group
|
|
43
|
+
const relationshipItems = this._getRelationships(model).map(rel => ({
|
|
44
|
+
id: rel.id,
|
|
45
|
+
kind: 'relationship',
|
|
46
|
+
label: rel.label || `${rel.source} → ${rel.target}`,
|
|
47
|
+
type: rel.kind,
|
|
48
|
+
properties: rel.properties,
|
|
49
|
+
}));
|
|
50
|
+
|
|
51
|
+
const filtered_rels = relationshipItems.filter(item => this._matchesFilter(item, { text: filterText, typeIds, specializationIds, propertyIds }));
|
|
52
|
+
|
|
53
|
+
if (filtered_rels.length > 0) {
|
|
54
|
+
layerGroups.push({
|
|
55
|
+
label: 'Relationships',
|
|
56
|
+
items: filtered_rels,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return layerGroups;
|
|
61
|
+
}
|
|
62
|
+
}
|