@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,151 @@
|
|
|
1
|
+
import { FormDialog } from '../FormDialog.js';
|
|
2
|
+
import { pickFile } from '../toolbar/pickFile.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* CanvasTemplateMenu — the menu items for canvases and their templates: a new
|
|
6
|
+
* canvas (empty, or from a model template or a library entry), saving a canvas
|
|
7
|
+
* as a template (in the model, or in the library for every model), importing
|
|
8
|
+
* Archi's templates into the library, and looking after both kinds of
|
|
9
|
+
* template. One source for the model tree and the File menu, as ViewMenu is
|
|
10
|
+
* for views. Items are PopupMenu items: `{label, action}`, `{label, items}`
|
|
11
|
+
* (a submenu) or `{separator: true}`.
|
|
12
|
+
*/
|
|
13
|
+
export class CanvasTemplateMenu {
|
|
14
|
+
/**
|
|
15
|
+
* @param {ArchimateModel} model
|
|
16
|
+
* @param {Object} [options]
|
|
17
|
+
* @param {CanvasTemplateLibrary} [options.library] - Templates across models; none, no library items
|
|
18
|
+
* @param {Document|Function} [options.document] - The page, or a function returning it
|
|
19
|
+
* @param {(accept: string) => Promise<File|null>} [options.chooseFile] - Asks for a file (pickFile by default)
|
|
20
|
+
* @param {(title: string, value: string, onName: (name: string) => void) => void} [options.askName] - Asks for a name
|
|
21
|
+
* (a FormDialog by default) and calls onName with it, unless cancelled
|
|
22
|
+
* @param {(message: string) => void} [options.report] - Says what went wrong (an import that failed)
|
|
23
|
+
*/
|
|
24
|
+
constructor(model, { library = null, document: doc = null, chooseFile = null, askName = null, report = null } = {}) {
|
|
25
|
+
this.model = model;
|
|
26
|
+
this.library = library;
|
|
27
|
+
this._document = doc;
|
|
28
|
+
this.chooseFile = chooseFile ?? ((accept) => pickFile(accept, this.document));
|
|
29
|
+
this.report = report ?? ((message) => (this.document.defaultView ?? globalThis).alert?.(message));
|
|
30
|
+
this.askName = askName ?? ((title, value, onName) => this._askName(title, value, onName));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
get document() {
|
|
34
|
+
const doc = typeof this._document === 'function' ? this._document() : this._document;
|
|
35
|
+
return doc ?? globalThis.document;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** "New canvas…" and, when there are templates, "New canvas from template" (a submenu). */
|
|
39
|
+
newCanvasItems() {
|
|
40
|
+
const fromTemplate = this._templateChoices();
|
|
41
|
+
return [
|
|
42
|
+
{ label: 'New canvas…', action: () => this.askName('New canvas', `Canvas ${this.model.canvases().length + 1}`, (title) => this.model.createCanvas(title)) },
|
|
43
|
+
...(fromTemplate.length ? [{ label: 'New canvas from template', items: fromTemplate }] : []),
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* For a canvas, or some of its boxes (`itemIds`: a selection, a group): save
|
|
49
|
+
* them as a model template, or into the library.
|
|
50
|
+
*/
|
|
51
|
+
saveAsTemplateItems(viewId, { itemIds = null } = {}) {
|
|
52
|
+
const view = this.model.getView(viewId);
|
|
53
|
+
if (view?.constructor.kind !== 'canvas' || view.template) return [];
|
|
54
|
+
const name = itemIds ? `${view.name} (part)` : view.name;
|
|
55
|
+
return [
|
|
56
|
+
{ label: 'Save as model template…', action: () => this.askName('Save as model template', name, (title) => this.model.saveAsTemplate(viewId, title, { itemIds })) },
|
|
57
|
+
...(this.library ? [{ label: 'Save to template library…', action: () => this.askName('Save to template library', name, (entryName) => this.library.add({ view: view.toJSON({ itemIds }), name: entryName, description: view.documentation ?? '' })) }] : []),
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Every template (the model's, then the library's) as an item that places
|
|
63
|
+
* it on a canvas at `at` (CanvasView#placeTemplate: its own locked
|
|
64
|
+
* background group). None for a view that is not a canvas.
|
|
65
|
+
* @param {string} viewId
|
|
66
|
+
* @param {{x: number, y: number}} [at] - Where its top left goes
|
|
67
|
+
*/
|
|
68
|
+
placeTemplateItems(viewId, at = null) {
|
|
69
|
+
const view = this.model.getView(viewId);
|
|
70
|
+
if (view?.constructor.kind !== 'canvas') return [];
|
|
71
|
+
return this._templateChoices((source, name) => view.placeTemplate(source, { at, name: `${name} (template)` }), { except: view });
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** For a model template: make a canvas from it, copy it to the library. */
|
|
75
|
+
modelTemplateItems(viewId) {
|
|
76
|
+
const view = this.model.getView(viewId);
|
|
77
|
+
if (!view?.template) return [];
|
|
78
|
+
return [
|
|
79
|
+
{ label: 'New canvas from this', action: () => this._newFrom(view) },
|
|
80
|
+
...(this.library ? [{ label: 'Copy to template library', action: () => this.library.add({ view: view.toJSON(), description: view.documentation ?? '' }) }] : []),
|
|
81
|
+
];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** For a library entry: make a canvas from it, copy it into the model, and (unless built in) rename, remove. */
|
|
85
|
+
libraryEntryItems(entryId) {
|
|
86
|
+
const entry = this.library?.get(entryId);
|
|
87
|
+
if (!entry) return [];
|
|
88
|
+
const shared = [
|
|
89
|
+
{ label: 'New canvas from this', action: () => this._newFrom(entry.view, entry.name) },
|
|
90
|
+
{ label: 'Copy to model templates', action: () => this.model.addTemplate(entry.view, entry.name) },
|
|
91
|
+
];
|
|
92
|
+
if (entry.builtIn) return shared;
|
|
93
|
+
return [
|
|
94
|
+
...shared,
|
|
95
|
+
{ label: 'Rename…', action: () => this.askName('Rename template', entry.name, (name) => this.library.update(entryId, { name })) },
|
|
96
|
+
{ separator: true },
|
|
97
|
+
{ label: 'Remove from library', danger: true, action: () => this._confirm(`Remove "${entry.name}" from the template library?`, () => this.library.remove(entryId)) },
|
|
98
|
+
];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** "Import Archi template…": an .archicanvas or .architemplate file into the library. */
|
|
102
|
+
importItem() {
|
|
103
|
+
if (!this.library) return null;
|
|
104
|
+
return { label: 'Import Archi template…', action: () => this.importArchiTemplate() };
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Ask for an Archi template file and add its canvases to the library. @returns {Promise<Array<Object>>} the entries added */
|
|
108
|
+
async importArchiTemplate() {
|
|
109
|
+
const file = await this.chooseFile('.archicanvas,.architemplate');
|
|
110
|
+
if (!file) return [];
|
|
111
|
+
try {
|
|
112
|
+
return this.library.importArchiTemplate(new Uint8Array(await file.arrayBuffer()));
|
|
113
|
+
} catch (error) {
|
|
114
|
+
this.report(`Could not import ${file.name ?? 'the template'}: ${error.message}`);
|
|
115
|
+
return [];
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* An item per template (the model's, then the library's) doing `act(source, name)`:
|
|
121
|
+
* by default, a new canvas from it.
|
|
122
|
+
* @private
|
|
123
|
+
*/
|
|
124
|
+
_templateChoices(act = (source, name) => this._newFrom(source, name), { except = null } = {}) {
|
|
125
|
+
const model = this.model.templates().filter(view => view !== except).map(view => ({ label: view.name, action: () => act(view, view.name) }));
|
|
126
|
+
const library = (this.library?.list() ?? []).map(entry => ({ label: entry.name, action: () => act(entry.view, entry.name) }));
|
|
127
|
+
return [...model, ...(model.length && library.length ? [{ separator: true }] : []), ...library];
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** @private */
|
|
131
|
+
_newFrom(template, name = template.name) {
|
|
132
|
+
return this.model.newCanvasFromTemplate(template, name);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** @private */
|
|
136
|
+
_askName(title, value, onTitle) {
|
|
137
|
+
new FormDialog({
|
|
138
|
+
title,
|
|
139
|
+
submitLabel: 'OK',
|
|
140
|
+
document: this.document,
|
|
141
|
+
fields: [{ key: 'title', label: 'Name', type: 'text', value }],
|
|
142
|
+
onApply: ({ title: t }) => { if (t?.trim()) onTitle(t.trim()); },
|
|
143
|
+
}).open();
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** @private */
|
|
147
|
+
_confirm(message, then) {
|
|
148
|
+
const win = this.document.defaultView ?? globalThis;
|
|
149
|
+
if (win.confirm(message)) then();
|
|
150
|
+
}
|
|
151
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Command } from '../CommandHistory.js';
|
|
2
|
+
import { ArchiHint } from './ArchiHint.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* EditHintCommand — set or clear the hint on anything that keeps an Archi
|
|
6
|
+
* record (`archi`): a canvas, or a box on one. One undo step.
|
|
7
|
+
*/
|
|
8
|
+
export class EditHintCommand extends Command {
|
|
9
|
+
/**
|
|
10
|
+
* @param {{archi: Object|null}} holder - A view or an instance
|
|
11
|
+
* @param {{title?: string, text?: string}} hint - Empty title and text clear it
|
|
12
|
+
*/
|
|
13
|
+
constructor(holder, hint) {
|
|
14
|
+
super('Edit hint');
|
|
15
|
+
this.holder = holder;
|
|
16
|
+
this.hint = hint;
|
|
17
|
+
this._before = undefined;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
execute() {
|
|
21
|
+
this._before = this.holder.archi ?? null;
|
|
22
|
+
this.holder.archi = ArchiHint.write(this.holder.archi, this.hint);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
undo() {
|
|
26
|
+
this.holder.archi = this._before;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CanvasBoxKind } from './CanvasBoxKind.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Archi's canvas palette: Block, Sticky and Image (its Connection is a plain
|
|
5
|
+
* line, CanvasView#connect). The looks match what Archi draws for a new one:
|
|
6
|
+
* a block is a bordered white box with its text at the top, a sticky a
|
|
7
|
+
* borderless yellow note with its text in the middle.
|
|
8
|
+
*/
|
|
9
|
+
export const CANVAS_BOX_KINDS = Object.freeze([
|
|
10
|
+
new CanvasBoxKind({
|
|
11
|
+
key: 'block', label: 'Block', icon: '▭', archiVisualType: 'canvas-model-block', width: 200, height: 150,
|
|
12
|
+
appearance: { fillColor: '#ffffff', strokeColor: '#000000', textAlign: 'center', textPosition: 'top' },
|
|
13
|
+
}),
|
|
14
|
+
new CanvasBoxKind({
|
|
15
|
+
key: 'sticky', label: 'Sticky', icon: '🗒', archiVisualType: 'canvas-model-sticky', width: 120, height: 80,
|
|
16
|
+
appearance: { fillColor: '#fff59d', strokeColor: 'none', textAlign: 'center', textPosition: 'middle' },
|
|
17
|
+
}),
|
|
18
|
+
new CanvasBoxKind({
|
|
19
|
+
key: 'image', label: 'Image', icon: '🖼', archiVisualType: 'canvas-model-image', width: 160, height: 120, shape: 'image',
|
|
20
|
+
appearance: { strokeColor: 'none' },
|
|
21
|
+
}),
|
|
22
|
+
]);
|
|
23
|
+
|
|
24
|
+
/** A canvas box kind by key, or undefined. */
|
|
25
|
+
export function canvasBoxKind(key) {
|
|
26
|
+
return CANVAS_BOX_KINDS.find(k => k.key === key);
|
|
27
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { pickFile } from '../toolbar/pickFile.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The boxes a view adds besides elements, as menu items: on a canvas Add
|
|
5
|
+
* Block, Add Sticky, Add Image…; on an ArchiMate view Add Note, Add Image…
|
|
6
|
+
* (the view's BOX_KINDS). Each adds the box centred at `at` (addBox, one undo
|
|
7
|
+
* step). One definition for every editor that shows a view.
|
|
8
|
+
* @param {ArchimateView} view
|
|
9
|
+
* @param {{x: number, y: number}} at
|
|
10
|
+
* @param {Object} [options]
|
|
11
|
+
* @param {(box) => void} [options.onAdded] - After a box is added (redraw, select it)
|
|
12
|
+
* @param {() => Promise<string|null>} [options.chooseImage] - Asks for a picture, as a data: URL
|
|
13
|
+
* (default: a file chooser)
|
|
14
|
+
* @param {Document} [options.document]
|
|
15
|
+
* @returns {Array<{label, action}>}
|
|
16
|
+
*/
|
|
17
|
+
export function canvasBoxMenuItems(view, at, { onAdded = () => {}, chooseImage = null, document: doc = globalThis.document } = {}) {
|
|
18
|
+
if (typeof view?.addBox !== 'function') return [];
|
|
19
|
+
const choose = chooseImage ?? (() => chooseImageFile(doc));
|
|
20
|
+
return (view.constructor.BOX_KINDS ?? []).map(kind => ({
|
|
21
|
+
label: `${kind.icon} Add ${kind.label}${kind.shape === 'image' ? '…' : ''}`,
|
|
22
|
+
action: async () => {
|
|
23
|
+
const iconUrl = kind.shape === 'image' ? await choose() : undefined;
|
|
24
|
+
if (kind.shape === 'image' && !iconUrl) return;
|
|
25
|
+
onAdded(view.addBox(kind.key, at, iconUrl ? { iconUrl } : {}));
|
|
26
|
+
},
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Ask for a picture file and read it as a data: URL (null if none is chosen). */
|
|
31
|
+
export async function chooseImageFile(doc = globalThis.document) {
|
|
32
|
+
const file = await pickFile('image/*', doc);
|
|
33
|
+
if (!file) return null;
|
|
34
|
+
return new Promise((resolve) => {
|
|
35
|
+
const reader = new (doc.defaultView ?? globalThis).FileReader();
|
|
36
|
+
reader.onload = (e) => resolve(e.target.result);
|
|
37
|
+
reader.onerror = () => resolve(null);
|
|
38
|
+
reader.readAsDataURL(file);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The canvas templates a CanvasTemplateLibrary offers out of the box: common
|
|
3
|
+
* planning and analysis canvases, written here (Archi's own templates are
|
|
4
|
+
* licensed CC BY-SA, so they are imported from an Archi install, not bundled).
|
|
5
|
+
*
|
|
6
|
+
* Each is a library entry: `{ id, name, description, thumbnail, builtIn, view }`,
|
|
7
|
+
* the view in CanvasView JSON form, made by `canvasTemplate()` from a list of
|
|
8
|
+
* blocks. Every block carries a hint (Archi's hintTitle / hintContent), as
|
|
9
|
+
* Archi's canvases do, so the template explains itself in Archi too.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** Pale fills that keep black text readable. */
|
|
13
|
+
const FILL = Object.freeze({
|
|
14
|
+
green: '#d9f2d0', red: '#fadbd8', blue: '#d6e9f8', yellow: '#fff5c2', orange: '#fde5cc',
|
|
15
|
+
purple: '#e8dcf2', grey: '#eeeeee', teal: '#d4f0ec', white: '#ffffff',
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A canvas template entry from its blocks.
|
|
20
|
+
* @param {Object} spec
|
|
21
|
+
* @param {string} spec.id - The entry's id (kept stable: `builtin-...`)
|
|
22
|
+
* @param {string} spec.name
|
|
23
|
+
* @param {string} spec.description
|
|
24
|
+
* @param {Array<{title: string, x: number, y: number, width: number, height: number, fill?: string,
|
|
25
|
+
* hint?: string, kind?: 'block'|'sticky', fontSize?: string}>} spec.blocks - Top-left corners
|
|
26
|
+
* @returns {Object} a library entry
|
|
27
|
+
*/
|
|
28
|
+
export function canvasTemplate({ id, name, description, blocks }) {
|
|
29
|
+
const elementInstances = blocks.map((block, i) => {
|
|
30
|
+
const kind = block.kind ?? 'block';
|
|
31
|
+
const boxId = `${id}-${i + 1}`;
|
|
32
|
+
const isBlock = kind === 'block';
|
|
33
|
+
return {
|
|
34
|
+
id: `${boxId}-instance`,
|
|
35
|
+
elementId: boxId,
|
|
36
|
+
x: block.x + block.width / 2,
|
|
37
|
+
y: block.y + block.height / 2,
|
|
38
|
+
labelOverride: null,
|
|
39
|
+
visible: true,
|
|
40
|
+
zIndex: i,
|
|
41
|
+
size: { width: block.width, height: block.height },
|
|
42
|
+
appearance: {
|
|
43
|
+
fillColor: block.fill ?? (isBlock ? FILL.white : FILL.yellow),
|
|
44
|
+
strokeColor: isBlock ? '#555555' : 'none',
|
|
45
|
+
textAlign: 'center',
|
|
46
|
+
textPosition: isBlock ? 'top' : 'middle',
|
|
47
|
+
fontSize: block.fontSize ?? (isBlock ? '12pt' : '10pt'),
|
|
48
|
+
...(isBlock && { fontWeight: 'bold' }),
|
|
49
|
+
},
|
|
50
|
+
...(block.hint && {
|
|
51
|
+
archi: {
|
|
52
|
+
attributes: { hintTitle: block.title },
|
|
53
|
+
elements: [{ tag: 'hintContent', text: block.hint, attributes: {} }],
|
|
54
|
+
},
|
|
55
|
+
}),
|
|
56
|
+
content: {
|
|
57
|
+
id: boxId, name: block.title, label: block.title, shape: 'rect',
|
|
58
|
+
archiVisualType: isBlock ? 'canvas-model-block' : 'canvas-model-sticky',
|
|
59
|
+
width: block.width, height: block.height,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
return Object.freeze({
|
|
64
|
+
id, name, description, thumbnail: null, builtIn: true,
|
|
65
|
+
view: {
|
|
66
|
+
name, documentation: description, properties: [],
|
|
67
|
+
archi: { attributes: { hintTitle: name }, elements: [{ tag: 'hintContent', text: description, attributes: {} }] },
|
|
68
|
+
elementInstances, viewConnections: [], arrangement: { groups: [], locked: [] },
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Blocks in a grid of `columns`, each `width` x `height`, starting at (x, y). */
|
|
74
|
+
function grid(cells, { columns, width, height, x = 20, y = 80, gap = 10 }) {
|
|
75
|
+
return cells.map((cell, i) => ({
|
|
76
|
+
...cell,
|
|
77
|
+
x: x + (i % columns) * (width + gap),
|
|
78
|
+
y: y + Math.floor(i / columns) * (height + gap),
|
|
79
|
+
width, height,
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** A title sticky across the top. */
|
|
84
|
+
const title = (text, width) => ({ title: text, x: 20, y: 20, width, height: 50, kind: 'sticky', fill: FILL.white, fontSize: '16pt' });
|
|
85
|
+
|
|
86
|
+
export const DEFAULT_CANVAS_TEMPLATES = Object.freeze([
|
|
87
|
+
canvasTemplate({
|
|
88
|
+
id: 'builtin-swot',
|
|
89
|
+
name: 'SWOT analysis',
|
|
90
|
+
description: 'Strengths and weaknesses inside the organisation; opportunities and threats outside it.',
|
|
91
|
+
blocks: [
|
|
92
|
+
title('SWOT analysis', 830),
|
|
93
|
+
...grid([
|
|
94
|
+
{ title: 'Strengths', fill: FILL.green, hint: 'What does the organisation do well? What advantages does it have over others?' },
|
|
95
|
+
{ title: 'Weaknesses', fill: FILL.red, hint: 'What could be improved? Where does it lack resources or capability?' },
|
|
96
|
+
{ title: 'Opportunities', fill: FILL.blue, hint: 'Which outside trends, changes or openings could it use?' },
|
|
97
|
+
{ title: 'Threats', fill: FILL.yellow, hint: 'Which outside changes, competitors or risks could harm it?' },
|
|
98
|
+
], { columns: 2, width: 410, height: 260 }),
|
|
99
|
+
],
|
|
100
|
+
}),
|
|
101
|
+
canvasTemplate({
|
|
102
|
+
id: 'builtin-pestle',
|
|
103
|
+
name: 'PESTLE analysis',
|
|
104
|
+
description: 'The outside factors that shape a strategy: political, economic, social, technological, legal and environmental.',
|
|
105
|
+
blocks: [
|
|
106
|
+
title('PESTLE analysis', 830),
|
|
107
|
+
...grid([
|
|
108
|
+
{ title: 'Political', fill: FILL.red, hint: 'Government policy, stability, trade and tax policy.' },
|
|
109
|
+
{ title: 'Economic', fill: FILL.orange, hint: 'Growth, interest and exchange rates, inflation, spending.' },
|
|
110
|
+
{ title: 'Social', fill: FILL.yellow, hint: 'Demographics, culture, attitudes, education, lifestyle.' },
|
|
111
|
+
{ title: 'Technological', fill: FILL.blue, hint: 'New technology, automation, research, rate of change.' },
|
|
112
|
+
{ title: 'Legal', fill: FILL.purple, hint: 'Laws and regulation: employment, consumer, data, health and safety.' },
|
|
113
|
+
{ title: 'Environmental', fill: FILL.green, hint: 'Climate, sustainability, environmental regulation, resources.' },
|
|
114
|
+
], { columns: 3, width: 270, height: 240 }),
|
|
115
|
+
],
|
|
116
|
+
}),
|
|
117
|
+
canvasTemplate({
|
|
118
|
+
id: 'builtin-stakeholders',
|
|
119
|
+
name: 'Stakeholder map',
|
|
120
|
+
description: 'Stakeholders placed by their power over the work and their interest in it, with how to engage each group.',
|
|
121
|
+
blocks: [
|
|
122
|
+
title('Stakeholder map: power and interest', 830),
|
|
123
|
+
...grid([
|
|
124
|
+
{ title: 'Keep satisfied (high power, low interest)', fill: FILL.yellow, hint: 'Meet their needs; keep them content without overloading them.' },
|
|
125
|
+
{ title: 'Manage closely (high power, high interest)', fill: FILL.red, hint: 'Engage fully and make the greatest effort to satisfy them.' },
|
|
126
|
+
{ title: 'Monitor (low power, low interest)', fill: FILL.grey, hint: 'Watch them, with minimum effort.' },
|
|
127
|
+
{ title: 'Keep informed (low power, high interest)', fill: FILL.green, hint: 'Keep them adequately informed and talk to them to ensure no major issues arise.' },
|
|
128
|
+
], { columns: 2, width: 410, height: 240 }),
|
|
129
|
+
],
|
|
130
|
+
}),
|
|
131
|
+
canvasTemplate({
|
|
132
|
+
id: 'builtin-priority',
|
|
133
|
+
name: 'Priority matrix',
|
|
134
|
+
description: 'Tasks sorted by urgency and importance: do, schedule, delegate or drop.',
|
|
135
|
+
blocks: [
|
|
136
|
+
title('Priority matrix: urgent and important', 830),
|
|
137
|
+
...grid([
|
|
138
|
+
{ title: 'Do now (urgent, important)', fill: FILL.red, hint: 'Crises and deadlines: do these first.' },
|
|
139
|
+
{ title: 'Schedule (not urgent, important)', fill: FILL.blue, hint: 'Planning, improvement, relationships: give them time.' },
|
|
140
|
+
{ title: 'Delegate (urgent, not important)', fill: FILL.yellow, hint: 'Interruptions and some requests: hand them on.' },
|
|
141
|
+
{ title: 'Drop (not urgent, not important)', fill: FILL.grey, hint: 'Busywork and distractions: stop doing them.' },
|
|
142
|
+
], { columns: 2, width: 410, height: 240 }),
|
|
143
|
+
],
|
|
144
|
+
}),
|
|
145
|
+
canvasTemplate({
|
|
146
|
+
id: 'builtin-retrospective',
|
|
147
|
+
name: 'Retrospective',
|
|
148
|
+
description: 'A team looks back on a piece of work: what went well, what to improve, and what it will do next.',
|
|
149
|
+
blocks: [
|
|
150
|
+
title('Retrospective', 830),
|
|
151
|
+
...grid([
|
|
152
|
+
{ title: 'Went well', fill: FILL.green, hint: 'What worked, and should be kept?' },
|
|
153
|
+
{ title: 'To improve', fill: FILL.orange, hint: 'What got in the way, or could be done better?' },
|
|
154
|
+
{ title: 'Actions', fill: FILL.blue, hint: 'What will the team do differently, who owns it, and by when?' },
|
|
155
|
+
], { columns: 3, width: 270, height: 420 }),
|
|
156
|
+
],
|
|
157
|
+
}),
|
|
158
|
+
canvasTemplate({
|
|
159
|
+
id: 'builtin-kanban',
|
|
160
|
+
name: 'Kanban board',
|
|
161
|
+
description: 'Work items moving across the board from backlog to done.',
|
|
162
|
+
blocks: [
|
|
163
|
+
title('Kanban board', 830),
|
|
164
|
+
...grid([
|
|
165
|
+
{ title: 'Backlog', fill: FILL.grey, hint: 'Work not yet started, in priority order.' },
|
|
166
|
+
{ title: 'To do', fill: FILL.yellow, hint: 'Work ready to start next.' },
|
|
167
|
+
{ title: 'In progress', fill: FILL.blue, hint: 'Work being done now. Keep this column short.' },
|
|
168
|
+
{ title: 'Done', fill: FILL.green, hint: 'Finished work.' },
|
|
169
|
+
], { columns: 4, width: 200, height: 460 }),
|
|
170
|
+
],
|
|
171
|
+
}),
|
|
172
|
+
canvasTemplate({
|
|
173
|
+
id: 'builtin-decision',
|
|
174
|
+
name: 'Architecture decision',
|
|
175
|
+
description: 'One architecture decision recorded: its context, the options considered, what was decided and what follows from it.',
|
|
176
|
+
blocks: [
|
|
177
|
+
title('Architecture decision', 830),
|
|
178
|
+
...grid([
|
|
179
|
+
{ title: 'Context', fill: FILL.grey, hint: 'The situation and forces that make a decision necessary.' },
|
|
180
|
+
{ title: 'Options', fill: FILL.blue, hint: 'The options considered, with their pros and cons.' },
|
|
181
|
+
{ title: 'Decision', fill: FILL.green, hint: 'What was decided, and why.' },
|
|
182
|
+
{ title: 'Consequences', fill: FILL.orange, hint: 'What becomes easier or harder because of it; follow-up work.' },
|
|
183
|
+
], { columns: 2, width: 410, height: 240 }),
|
|
184
|
+
],
|
|
185
|
+
}),
|
|
186
|
+
]);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CanvasBoxKind } from './CanvasBoxKind.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The boxes Archi adds to an ArchiMate view besides elements: a Note and an
|
|
5
|
+
* Image (its Group is a folder drawn on the view). They carry no Archi class
|
|
6
|
+
* of their own: a note and a picture are written as Archi's Note and Image
|
|
7
|
+
* from their shape, as imported ones are.
|
|
8
|
+
*/
|
|
9
|
+
export const DIAGRAM_BOX_KINDS = Object.freeze([
|
|
10
|
+
new CanvasBoxKind({ key: 'note', label: 'Note', icon: '📝', width: 185, height: 80, shape: 'note' }),
|
|
11
|
+
new CanvasBoxKind({ key: 'image', label: 'Image', icon: '🖼', width: 160, height: 120, shape: 'image', appearance: { strokeColor: 'none' } }),
|
|
12
|
+
]);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ArchiHint } from './ArchiHint.js';
|
|
2
|
+
import { EditHintCommand } from './EditHintCommand.js';
|
|
3
|
+
import { FormDialog } from '../FormDialog.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* "Edit Hint…" for a box on a canvas, or "Edit Canvas Hint…" for the canvas
|
|
7
|
+
* itself (no `itemId`): one definition for every editor that shows a canvas.
|
|
8
|
+
* The hint is asked for as a title and plain text, and set as one undo step on
|
|
9
|
+
* the canvas (EditHintCommand). None for a view that is not a canvas.
|
|
10
|
+
* @param {ArchimateView} view
|
|
11
|
+
* @param {string|null} itemId - The box, or null for the canvas
|
|
12
|
+
* @param {Object} [options]
|
|
13
|
+
* @param {(hint) => void} [options.onChange] - After it is set (redraw, show it)
|
|
14
|
+
* @param {(current, done) => void} [options.askHint] - Asks for {title, text} and calls done with it
|
|
15
|
+
* (default: a FormDialog)
|
|
16
|
+
* @param {Document} [options.document]
|
|
17
|
+
* @returns {Array<{label, action}>}
|
|
18
|
+
*/
|
|
19
|
+
export function hintMenuItems(view, itemId = null, { onChange = () => {}, askHint = null, document: doc = globalThis.document } = {}) {
|
|
20
|
+
if (view?.constructor.kind !== 'canvas') return [];
|
|
21
|
+
const holder = itemId ? view.getElementInstance(itemId) : view;
|
|
22
|
+
if (!holder) return [];
|
|
23
|
+
const ask = askHint ?? ((current, done) => askHintDialog(current, done, { document: doc, what: itemId ? 'Hint' : 'Canvas hint' }));
|
|
24
|
+
return [{
|
|
25
|
+
label: itemId ? '💡 Edit Hint…' : '💡 Edit Canvas Hint…',
|
|
26
|
+
action: () => {
|
|
27
|
+
const current = ArchiHint.of(holder.archi) ?? { title: '', text: '' };
|
|
28
|
+
ask({ title: current.title, text: current.text }, (hint) => {
|
|
29
|
+
view.history.execute(new EditHintCommand(holder, hint));
|
|
30
|
+
onChange(ArchiHint.of(holder.archi));
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
}];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Ask for a hint's title and text in a FormDialog. */
|
|
37
|
+
export function askHintDialog(current, done, { document: doc = globalThis.document, what = 'Hint' } = {}) {
|
|
38
|
+
new FormDialog({
|
|
39
|
+
title: `Edit ${what.toLowerCase()}`,
|
|
40
|
+
description: 'Shown in the Hints panel (and Archi\'s Hints view). Leave both empty to remove it.',
|
|
41
|
+
fields: [
|
|
42
|
+
{ key: 'title', label: 'Title', type: 'text', value: current.title },
|
|
43
|
+
{ key: 'text', label: 'Hint', type: 'textarea', rows: 6, value: current.text },
|
|
44
|
+
],
|
|
45
|
+
submitLabel: 'Save',
|
|
46
|
+
document: doc,
|
|
47
|
+
onApply: ({ title, text }) => done({ title: title ?? '', text: text ?? '' }),
|
|
48
|
+
}).open();
|
|
49
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { GaugeChart } from './GaugeChart.js';
|
|
2
|
+
import { ArcTrack } from '../gauges/ArcTrack.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* ArcGauge — an arc filled to the value, its number in the middle: a half
|
|
6
|
+
* circle by default, or any start angle and sweep.
|
|
7
|
+
*
|
|
8
|
+
* Options: cx, cy, r (100, 100, 70), thickness (16), startAngle and sweep in
|
|
9
|
+
* degrees (180 and 180: a half circle over the top), cap ('round' ends), and
|
|
10
|
+
* every GaugeChart option (min, max, bands, target, ticks, ...). Without
|
|
11
|
+
* ticks the scale's two ends are labelled.
|
|
12
|
+
*/
|
|
13
|
+
export class ArcGauge extends GaugeChart {
|
|
14
|
+
static chartType = 'arcGauge';
|
|
15
|
+
|
|
16
|
+
static LAYOUT = { cx: 100, cy: 100, r: 70, thickness: 16, startAngle: 180, sweep: 180 };
|
|
17
|
+
|
|
18
|
+
track() { return new ArcTrack(this.layout); }
|
|
19
|
+
|
|
20
|
+
_render() {
|
|
21
|
+
const { title, cap } = this.options;
|
|
22
|
+
const track = this.track();
|
|
23
|
+
const capOption = cap ? { cap } : {};
|
|
24
|
+
this.drawBackground(track, capOption);
|
|
25
|
+
this.drawValue(track, capOption);
|
|
26
|
+
this.drawTarget(track);
|
|
27
|
+
if (this.options.ticks) this.drawTicks(track);
|
|
28
|
+
else this.drawEnds(track);
|
|
29
|
+
this.drawLabels(track);
|
|
30
|
+
this._renderTitle(title, track.cx, this.titleY(track), { textAnchor: 'middle', fontSize: '12px', fill: '#747d8c' });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** The value's number in the middle, a little above the centre for an open arc. */
|
|
34
|
+
drawLabels(track) {
|
|
35
|
+
const { cx, cy, r } = track;
|
|
36
|
+
this._renderValueLabel(cx, cy - r * 0.15, { fontSize: `${Math.max(12, Math.round(r * 0.32))}px`, fill: '#2f3542', fontWeight: 'bold' });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Below the arc's lowest point. */
|
|
40
|
+
titleY(track) {
|
|
41
|
+
const lowest = Math.max(track.point(0).y, track.point(1).y, track.cy);
|
|
42
|
+
return lowest + track.thickness / 2 + 18;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** The scale's min and max under the arc's two ends. */
|
|
46
|
+
drawEnds(track) {
|
|
47
|
+
const below = track.thickness / 2 + 2;
|
|
48
|
+
for (const f of [0, 1]) {
|
|
49
|
+
const at = track.point(f);
|
|
50
|
+
this.renderer.text(this.scale.tickLabel(this.scale.valueAt(f), 1), at.x, at.y + below + 8, {
|
|
51
|
+
textAnchor: 'middle', verticalAlign: 'middle', fontSize: '10px', fill: '#747d8c',
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Chart } from '../Chart.js';
|
|
2
|
+
import { ChartBox, ChartLabels } from '../ChartBox.js';
|
|
3
|
+
import { Legend } from '../Legend.js';
|
|
4
|
+
import { ColorPalette } from '../ColorPalette.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* AreaChart — stacked or overlaid area chart.
|
|
8
|
+
*/
|
|
9
|
+
export class AreaChart extends Chart {
|
|
10
|
+
static chartType = 'area';
|
|
11
|
+
|
|
12
|
+
_render() {
|
|
13
|
+
const data = this.data;
|
|
14
|
+
const options = this.options;
|
|
15
|
+
const box = ChartBox.fromRenderer(this.renderer);
|
|
16
|
+
const {
|
|
17
|
+
x = box.x, y = box.y, width = box.width, height = box.height,
|
|
18
|
+
colors, title, xAxisLabel, yAxisLabel, stacked = false, legend: showLegend = false,
|
|
19
|
+
} = options;
|
|
20
|
+
const plotBox = { x, y, width, height };
|
|
21
|
+
const isMultiline = Array.isArray(data[0]?.values);
|
|
22
|
+
const series = isMultiline ? data : [{ name: 'default', values: data }];
|
|
23
|
+
const pointCount = series[0].values.length;
|
|
24
|
+
const pointMargin = pointCount > 1 ? width / (pointCount - 1) : width;
|
|
25
|
+
const palette = new ColorPalette(colors);
|
|
26
|
+
const textAnchor = this.renderer.centerTextAnchor;
|
|
27
|
+
|
|
28
|
+
// Precompute each series' [base, top] band per point — base is 0
|
|
29
|
+
// unless stacked, in which case it's the running cumulative of prior
|
|
30
|
+
// series (computed once here, not re-derived during render).
|
|
31
|
+
let running = new Array(pointCount).fill(0);
|
|
32
|
+
const bands = series.map(s => {
|
|
33
|
+
const band = s.values.map((d, i) => {
|
|
34
|
+
const base = stacked ? running[i] : 0;
|
|
35
|
+
return { base, top: base + d.value };
|
|
36
|
+
});
|
|
37
|
+
if (stacked) running = band.map(b => b.top);
|
|
38
|
+
return band;
|
|
39
|
+
});
|
|
40
|
+
const maxValue = Math.max(...bands.flat().map(b => b.top)) || 1;
|
|
41
|
+
|
|
42
|
+
new ChartLabels({ title, xAxisLabel, yAxisLabel }).draw(this.renderer, plotBox);
|
|
43
|
+
this.renderer.path(`M${x},${y} L${x},${y + height} L${x + width},${y + height}`, 'none', { color: 'black', width: 1 });
|
|
44
|
+
|
|
45
|
+
series.forEach((s, seriesIndex) => {
|
|
46
|
+
const band = bands[seriesIndex];
|
|
47
|
+
const color = palette.colorAt(seriesIndex);
|
|
48
|
+
const topPts = band.map((b, i) => ({ px: x + i * pointMargin, py: y + height - (b.top / maxValue) * height }));
|
|
49
|
+
const basePts = band.map((b, i) => ({ px: x + i * pointMargin, py: y + height - (b.base / maxValue) * height }));
|
|
50
|
+
const areaPath = 'M' + topPts.map(p => `${p.px},${p.py}`).join(' L')
|
|
51
|
+
+ ' L' + [...basePts].reverse().map(p => `${p.px},${p.py}`).join(' L') + ' Z';
|
|
52
|
+
const { r, g, b: bl } = palette.hexToRgb(color);
|
|
53
|
+
this.renderer.path(areaPath, `rgba(${r},${g},${bl},0.35)`, null, { tooltip: s.name });
|
|
54
|
+
this.renderer.path('M' + topPts.map(p => `${p.px},${p.py}`).join(' L'), 'none', { color, width: 2 });
|
|
55
|
+
|
|
56
|
+
if (seriesIndex === 0) {
|
|
57
|
+
s.values.forEach((d, i) => {
|
|
58
|
+
this.renderer.text(d.label, x + i * pointMargin, y + height + 20, { textAnchor, fontSize: '10px' });
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
if (isMultiline && showLegend) {
|
|
64
|
+
const legendItems = series.map((s, i) => ({ name: s.name, color: palette.colorAt(i) }));
|
|
65
|
+
new Legend({
|
|
66
|
+
items: legendItems, x: x + width + 20, y,
|
|
67
|
+
itemHeight: 20, markerSize: 12,
|
|
68
|
+
}).draw(this.renderer);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|