@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,4 @@
|
|
|
1
|
+
export { EDGE_STYLE_PROPERTIES, LINE_ONLY_PROPERTIES, LINE_STYLE_DASH } from './EdgeStyleSchema.js';
|
|
2
|
+
export { EdgeStyleCascade } from './EdgeStyleCascade.js';
|
|
3
|
+
export { SetStyleCommand } from './SetStyleCommand.js';
|
|
4
|
+
export { EdgeStyleDialog } from './EdgeStyleDialog.js';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How strongly a shape or line is drawn, weakest last: drawn see-through
|
|
3
|
+
* (dimmed: not matching a highlight; faded: outside the viewpoint), or not
|
|
4
|
+
* drawn at all (hidden). Each level's opacity; hidden has none.
|
|
5
|
+
*/
|
|
6
|
+
export const EMPHASIS_OPACITY = Object.freeze({ dimmed: 0.3, faded: 0.2 });
|
|
7
|
+
|
|
8
|
+
/** The levels from weakest effect to strongest; the strongest any rule gives wins. */
|
|
9
|
+
export const EMPHASIS_LEVELS = Object.freeze([null, 'dimmed', 'faded', 'hidden']);
|
|
10
|
+
|
|
11
|
+
/** The stronger of two levels. */
|
|
12
|
+
export const strongerEmphasis = (a, b) => (EMPHASIS_LEVELS.indexOf(b) > EMPHASIS_LEVELS.indexOf(a) ? b : a);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* EmphasisRule — one reason the editor draws some shapes or lines more faintly
|
|
16
|
+
* or not at all (a highlight, a viewpoint, ...). The editor asks each of its
|
|
17
|
+
* rules (`DiagramEditor#emphasisRules()`) and draws an item at the strongest
|
|
18
|
+
* level any gives; a line whose shape is hidden is hidden too. A rule only
|
|
19
|
+
* changes how an item is drawn: the item stays in the view, and its rule can
|
|
20
|
+
* be cleared.
|
|
21
|
+
*/
|
|
22
|
+
export class EmphasisRule {
|
|
23
|
+
/**
|
|
24
|
+
* How a shape is drawn under this rule.
|
|
25
|
+
* @param {Template} template
|
|
26
|
+
* @param {DiagramEditor} editor
|
|
27
|
+
* @returns {null|'dimmed'|'faded'|'hidden'} null: as usual
|
|
28
|
+
*/
|
|
29
|
+
template(template, editor) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* How a line is drawn under this rule (its hidden ends are the editor's business).
|
|
35
|
+
* @param {Edge} edge
|
|
36
|
+
* @param {DiagramEditor} editor
|
|
37
|
+
* @returns {null|'dimmed'|'faded'|'hidden'}
|
|
38
|
+
*/
|
|
39
|
+
edge(edge, editor) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { EmphasisRule } from './EmphasisRule.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* HighlightRule — shapes whose name contains some text (any case) are drawn
|
|
5
|
+
* as usual and every other shape dimmed, so the matches stand out. Lines are
|
|
6
|
+
* left as they are. `matches(template)` is what a subclass changes to match
|
|
7
|
+
* on something else.
|
|
8
|
+
*/
|
|
9
|
+
export class HighlightRule extends EmphasisRule {
|
|
10
|
+
/** @param {string} text */
|
|
11
|
+
constructor(text) {
|
|
12
|
+
super();
|
|
13
|
+
this.text = String(text ?? '').trim();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Whether a shape matches: its name contains the text, ignoring case. */
|
|
17
|
+
matches(template) {
|
|
18
|
+
return String(template.name ?? '').toLowerCase().includes(this.text.toLowerCase());
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
template(template) {
|
|
22
|
+
return !this.text || this.matches(template) ? null : 'dimmed';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Gauge } from '../Gauge.js';
|
|
2
|
+
import { GaugeTrack } from './GaugeTrack.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* ArcTrack — a gauge track along a circle's arc: the dial's 270°, a half
|
|
6
|
+
* circle, a full ring. Angles are degrees clockwise from 3 o'clock (the
|
|
7
|
+
* screen's own direction), so 135° with a 270° sweep is the dial's
|
|
8
|
+
* bottom-left to bottom-right, and 180° with 180° is a half circle over the top.
|
|
9
|
+
*/
|
|
10
|
+
export class ArcTrack extends GaugeTrack {
|
|
11
|
+
/**
|
|
12
|
+
* @param {Object} options
|
|
13
|
+
* @param {number} options.cx
|
|
14
|
+
* @param {number} options.cy
|
|
15
|
+
* @param {number} options.r - The radius of the track's centre line
|
|
16
|
+
* @param {number} options.thickness
|
|
17
|
+
* @param {number} [options.startAngle=135]
|
|
18
|
+
* @param {number} [options.sweep=270]
|
|
19
|
+
*/
|
|
20
|
+
constructor({ cx, cy, r, thickness, startAngle = 135, sweep = 270 }) {
|
|
21
|
+
super(thickness);
|
|
22
|
+
Object.assign(this, { cx, cy, r, startAngle, sweep });
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** The arc's length along its centre line, in pixels. */
|
|
26
|
+
get length() { return this.r * Math.abs(this.sweep) * Math.PI / 180; }
|
|
27
|
+
|
|
28
|
+
/** The angle in degrees at a fraction along. */
|
|
29
|
+
angleAt(fraction) { return this.startAngle + fraction * this.sweep; }
|
|
30
|
+
|
|
31
|
+
point(fraction, offset = 0) {
|
|
32
|
+
const a = this.angleAt(fraction) * Math.PI / 180;
|
|
33
|
+
const r = this.r + offset;
|
|
34
|
+
return { x: this.cx + r * Math.cos(a), y: this.cy + r * Math.sin(a) };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
draw(renderer, from, to, color, { thickness = this.thickness, cap } = {}) {
|
|
38
|
+
const rad = Math.PI / 180;
|
|
39
|
+
const a0 = this.angleAt(Math.min(from, to)) * rad;
|
|
40
|
+
const a1 = this.angleAt(Math.max(from, to)) * rad;
|
|
41
|
+
renderer.path(Gauge.arcPath(this.cx, this.cy, this.r, a0, a1), 'none', { color, width: thickness, ...(cap ? { cap } : {}) });
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
get center() { return { x: this.cx, y: this.cy }; }
|
|
45
|
+
|
|
46
|
+
/** A label outside the arc leans away from the centre: 'start' on the right, 'end' on the left. */
|
|
47
|
+
anchorAt(fraction) {
|
|
48
|
+
const dx = Math.cos(this.angleAt(fraction) * Math.PI / 180);
|
|
49
|
+
return dx > 0.3 ? 'start' : dx < -0.3 ? 'end' : 'middle';
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { GaugeValue } from './GaugeValue.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* GaugeAnimation — eases a gauge from the value it shows to a new one, so a
|
|
5
|
+
* needle or fill moves instead of jumping.
|
|
6
|
+
*
|
|
7
|
+
* Each frame draws the gauge from `GaugeValue.between(from, to, t)`: the
|
|
8
|
+
* value, the target and each of several values move together; the history
|
|
9
|
+
* and the previous value are the new ones throughout. The clock is
|
|
10
|
+
* injectable (`schedule`, `now`) so it runs without a browser in tests.
|
|
11
|
+
*/
|
|
12
|
+
export class GaugeAnimation {
|
|
13
|
+
/** Ease out (cubic): quick at first, settling on the value. */
|
|
14
|
+
static ease(t) { return 1 - (1 - t) ** 3; }
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @param {Object} options
|
|
18
|
+
* @param {GaugeValue} options.from
|
|
19
|
+
* @param {GaugeValue} options.to
|
|
20
|
+
* @param {number} [options.duration=400] - Milliseconds
|
|
21
|
+
* @param {(data: Object) => void} options.draw - Draws one frame from its gauge data
|
|
22
|
+
* @param {(callback: Function) => *} [options.schedule] - requestAnimationFrame, else a 16ms timer
|
|
23
|
+
* @param {() => number} [options.now]
|
|
24
|
+
*/
|
|
25
|
+
constructor({ from, to, duration = 400, draw, schedule = GaugeAnimation.defaultSchedule(), now = () => Date.now() }) {
|
|
26
|
+
Object.assign(this, { from, to, duration, draw, schedule, now });
|
|
27
|
+
this.stopped = false;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static defaultSchedule() {
|
|
31
|
+
return typeof globalThis.requestAnimationFrame === 'function'
|
|
32
|
+
? (callback) => globalThis.requestAnimationFrame(callback)
|
|
33
|
+
: (callback) => setTimeout(callback, 16);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Draw the first frame now and the rest on the clock, ending exactly on `to`. */
|
|
37
|
+
start() {
|
|
38
|
+
const started = this.now();
|
|
39
|
+
const frame = () => {
|
|
40
|
+
if (this.stopped) return;
|
|
41
|
+
const t = this.duration > 0 ? Math.min(1, (this.now() - started) / this.duration) : 1;
|
|
42
|
+
this.draw(GaugeValue.between(this.from, this.to, GaugeAnimation.ease(t)));
|
|
43
|
+
if (t < 1) this.schedule(frame);
|
|
44
|
+
};
|
|
45
|
+
frame();
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** No more frames (a newer value has started its own). */
|
|
50
|
+
stop() { this.stopped = true; }
|
|
51
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ColorPalette } from '../ColorPalette.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* GaugeBands — ranges along a gauge's scale ("poor", "ok", "good"), each with
|
|
5
|
+
* its colour and label.
|
|
6
|
+
*
|
|
7
|
+
* Given as `[{ to, color?, label? }]` in order: each band runs from where the
|
|
8
|
+
* one before it ended (the scale's min for the first) to its `to` (`max` is
|
|
9
|
+
* read the same, as the bullet graph has always taken it). Every gauge draws
|
|
10
|
+
* its bands from here, and a value takes the colour of the band it falls in.
|
|
11
|
+
*/
|
|
12
|
+
export class GaugeBands {
|
|
13
|
+
/** Band colours used when a band has none of its own: bad, warning, good. */
|
|
14
|
+
static COLORS = ['#ff6b6b', '#ffd93d', '#6bcb77'];
|
|
15
|
+
|
|
16
|
+
/** How far a band's colour is mixed toward white when drawn behind a value. */
|
|
17
|
+
static TINT = 0.65;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {Array<{to?:number, max?:number, color?:string, label?:string}>} bands
|
|
21
|
+
* @param {import('./GaugeScale.js').GaugeScale} scale
|
|
22
|
+
* @param {Object} [options]
|
|
23
|
+
* @param {string[]} [options.colors] - Colours for bands without their own
|
|
24
|
+
*/
|
|
25
|
+
constructor(bands = [], scale, { colors = GaugeBands.COLORS } = {}) {
|
|
26
|
+
this.scale = scale;
|
|
27
|
+
let from = scale.min;
|
|
28
|
+
this.list = (bands ?? []).map((band, index) => {
|
|
29
|
+
const to = scale.clamp(band.to ?? band.max ?? scale.max);
|
|
30
|
+
const entry = { from, to, color: band.color ?? colors[index % colors.length], label: band.label ?? null, index };
|
|
31
|
+
from = to;
|
|
32
|
+
return entry;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
get length() { return this.list.length; }
|
|
37
|
+
|
|
38
|
+
/** The band a value falls in (the last one at a shared edge), or null. */
|
|
39
|
+
at(value) {
|
|
40
|
+
const v = this.scale.clamp(value);
|
|
41
|
+
return this.list.find(b => v >= b.from && v < b.to) ?? this.list.findLast(b => v >= b.from && v <= b.to) ?? null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** A band's colour as drawn behind the value: lighter, so the value shows on it. */
|
|
45
|
+
static tint(color) {
|
|
46
|
+
return /^#[0-9a-f]{6}$/i.test(color) ? ColorPalette.interpolate(color, '#ffffff', GaugeBands.TINT) : color;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GaugeScale — the range a gauge measures and how its numbers read.
|
|
3
|
+
*
|
|
4
|
+
* One scale per gauge: it turns a value into a 0-1 fraction of the way along
|
|
5
|
+
* the track, gives the tick values, and formats the value and tick labels.
|
|
6
|
+
* Every gauge draws from it, so `min`, `max` and `format` mean the same on
|
|
7
|
+
* all of them.
|
|
8
|
+
*/
|
|
9
|
+
export class GaugeScale {
|
|
10
|
+
/**
|
|
11
|
+
* @param {Object} [options]
|
|
12
|
+
* @param {number} [options.min=0]
|
|
13
|
+
* @param {number} [options.max=100]
|
|
14
|
+
* @param {Function|Object} [options.format] - `(value) => string`, or
|
|
15
|
+
* `{ decimals, prefix, suffix, grouping, compact }`. Without one, a
|
|
16
|
+
* 0-100 scale reads as a percentage ("75.0%"), any other as its number.
|
|
17
|
+
* @param {string} [options.units] - The suffix when no format is given ("ms", "°C")
|
|
18
|
+
*/
|
|
19
|
+
constructor({ min = 0, max = 100, format = null, units = null } = {}) {
|
|
20
|
+
this.min = Number(min);
|
|
21
|
+
this.max = Number(max);
|
|
22
|
+
this.format = format ?? { decimals: 1, suffix: units != null ? ` ${units}` : (this.isPercent ? '%' : '') };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** True for the plain 0-100 scale a percentage gauge has. */
|
|
26
|
+
get isPercent() { return this.min === 0 && this.max === 100; }
|
|
27
|
+
|
|
28
|
+
get span() { return (this.max - this.min) || 1; }
|
|
29
|
+
|
|
30
|
+
/** The value held to the scale's range. */
|
|
31
|
+
clamp(value) {
|
|
32
|
+
const v = Number(value);
|
|
33
|
+
if (!Number.isFinite(v)) return this.min;
|
|
34
|
+
return Math.min(Math.max(v, Math.min(this.min, this.max)), Math.max(this.min, this.max));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** How far along the scale a value is, 0-1 (held to the range). */
|
|
38
|
+
fraction(value) { return (this.clamp(value) - this.min) / this.span; }
|
|
39
|
+
|
|
40
|
+
/** The value at a fraction of the way along. */
|
|
41
|
+
valueAt(fraction) { return this.min + fraction * this.span; }
|
|
42
|
+
|
|
43
|
+
/** `count` equal steps: count + 1 values from min to max. */
|
|
44
|
+
ticks(count = 5) {
|
|
45
|
+
const n = Math.max(1, Math.round(count));
|
|
46
|
+
return Array.from({ length: n + 1 }, (_, i) => this.valueAt(i / n));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** A value as the gauge shows it. */
|
|
50
|
+
label(value) { return GaugeScale.formatNumber(value, this.format); }
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A tick's label: the value's prefix and suffix, with only the decimals a
|
|
54
|
+
* step of `span / count` needs ("0", "25", ... not "0.0%", "25.0%").
|
|
55
|
+
*/
|
|
56
|
+
tickLabel(value, count = 5) {
|
|
57
|
+
if (typeof this.format === 'function') return this.format(value);
|
|
58
|
+
const step = this.span / Math.max(1, Math.round(count));
|
|
59
|
+
// The fewest decimals that show the step exactly (0.25 needs 2), at most 6.
|
|
60
|
+
let decimals = 0;
|
|
61
|
+
while (decimals < 6 && Math.abs(step * 10 ** decimals - Math.round(step * 10 ** decimals)) > 1e-9) decimals++;
|
|
62
|
+
return GaugeScale.formatNumber(value, { ...this.format, decimals });
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Format a number: a function format is called; an object one gives
|
|
67
|
+
* decimals (null: as it is), prefix, suffix, grouping (1,234) and compact (1.2K).
|
|
68
|
+
*/
|
|
69
|
+
static formatNumber(value, format = {}) {
|
|
70
|
+
if (typeof format === 'function') return format(value);
|
|
71
|
+
const { decimals = null, prefix = '', suffix = '', grouping = false, compact = false } = format ?? {};
|
|
72
|
+
const v = Number(value);
|
|
73
|
+
if (!Number.isFinite(v)) return `${prefix}${value}${suffix}`;
|
|
74
|
+
let text;
|
|
75
|
+
if (compact || grouping) {
|
|
76
|
+
const digits = decimals ?? (compact ? 1 : undefined);
|
|
77
|
+
text = new Intl.NumberFormat('en', {
|
|
78
|
+
notation: compact ? 'compact' : 'standard',
|
|
79
|
+
useGrouping: true,
|
|
80
|
+
...(digits != null ? { minimumFractionDigits: compact ? 0 : digits, maximumFractionDigits: digits } : {}),
|
|
81
|
+
}).format(v);
|
|
82
|
+
} else {
|
|
83
|
+
text = decimals == null ? String(v) : v.toFixed(decimals);
|
|
84
|
+
}
|
|
85
|
+
return `${prefix}${text}${suffix}`;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GaugeTrack — the path a gauge's value moves along, as fractions 0-1.
|
|
3
|
+
*
|
|
4
|
+
* A subclass is one geometry (a straight bar, an arc). The gauge asks it for
|
|
5
|
+
* points and draws segments on it, so bands, the value, ticks and a target
|
|
6
|
+
* marker are drawn the same way on every gauge whatever its shape.
|
|
7
|
+
*
|
|
8
|
+
* A track has a `length` (pixels along it) as well as its `thickness`.
|
|
9
|
+
* Offsets are across the track from its centre line: positive is outward
|
|
10
|
+
* (below a horizontal bar, right of a vertical one, away from an arc's centre).
|
|
11
|
+
*/
|
|
12
|
+
export class GaugeTrack {
|
|
13
|
+
/** @param {number} thickness - The track's width across */
|
|
14
|
+
constructor(thickness) {
|
|
15
|
+
if (new.target === GaugeTrack) throw new TypeError('GaugeTrack is abstract — subclass it');
|
|
16
|
+
this.thickness = thickness;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** The point at a fraction along, `offset` across. @returns {{x:number, y:number}} */
|
|
20
|
+
point(fraction, offset = 0) { throw new Error(`${this.constructor.name} must implement point()`); }
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Draw the track from one fraction to another, in a colour.
|
|
24
|
+
* @param {Object} renderer
|
|
25
|
+
* @param {number} from - 0-1
|
|
26
|
+
* @param {number} to - 0-1
|
|
27
|
+
* @param {string} color
|
|
28
|
+
* @param {Object} [options] - `thickness` (this track's by default), `cap` ('round' ends)
|
|
29
|
+
*/
|
|
30
|
+
draw(renderer, from, to, color, options = {}) { throw new Error(`${this.constructor.name} must implement draw()`); }
|
|
31
|
+
|
|
32
|
+
/** Where a label sits in the middle of the gauge. @returns {{x:number, y:number}} */
|
|
33
|
+
get center() { throw new Error(`${this.constructor.name} must implement center`); }
|
|
34
|
+
|
|
35
|
+
/** A straight line across the track at a fraction, between two offsets (a tick, a target). */
|
|
36
|
+
line(renderer, fraction, fromOffset, toOffset, stroke) {
|
|
37
|
+
const a = this.point(fraction, fromOffset);
|
|
38
|
+
const b = this.point(fraction, toOffset);
|
|
39
|
+
renderer.path(`M${a.x},${a.y} L${b.x},${b.y}`, 'none', stroke);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** How a label at a point outside the track is anchored ('start', 'middle' or 'end'). */
|
|
43
|
+
anchorAt(fraction) { return 'middle'; }
|
|
44
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GaugeValue — what a gauge's data says: the value, and what it is compared
|
|
3
|
+
* with.
|
|
4
|
+
*
|
|
5
|
+
* Data is a plain number, or `{ value, target?, previous?, history?, values? }`;
|
|
6
|
+
* options of the same names win over the data's. `values` is for gauges that
|
|
7
|
+
* show several (one ring each): numbers, or `{ value, label?, color?, min?, max? }`;
|
|
8
|
+
* an array as the data is read as `values`.
|
|
9
|
+
*/
|
|
10
|
+
export class GaugeValue {
|
|
11
|
+
constructor({ value = 0, target = null, previous = null, history = [], values = [] } = {}) {
|
|
12
|
+
this.value = Number(value) || 0;
|
|
13
|
+
this.target = target == null ? null : Number(target);
|
|
14
|
+
this.history = (history ?? []).map(Number).filter(Number.isFinite);
|
|
15
|
+
// The value before this one: given, or the one before the last in the history.
|
|
16
|
+
this.previous = previous != null ? Number(previous) : (this.history.length > 1 ? this.history.at(-2) : null);
|
|
17
|
+
this.values = (values ?? []).map(v => (typeof v === 'object' && v !== null ? { ...v, value: Number(v.value) || 0 } : { value: Number(v) || 0 }));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** The change from the previous value, or null without one. */
|
|
21
|
+
get change() { return this.previous == null ? null : this.value - this.previous; }
|
|
22
|
+
|
|
23
|
+
/** The change as a fraction of the previous value (0.1 is up 10%), or null. */
|
|
24
|
+
get changeRatio() { return this.previous ? this.change / Math.abs(this.previous) : null; }
|
|
25
|
+
|
|
26
|
+
/** As gauge data again (`{ value, target, previous, history, values }`). */
|
|
27
|
+
toData() {
|
|
28
|
+
const { value, target, previous, history, values } = this;
|
|
29
|
+
return { value, target, previous, history: [...history], values: values.map(v => ({ ...v })) };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The data part of the way (t, 0-1) from one value to another: the value,
|
|
34
|
+
* the target and each of several values in between (one that is new
|
|
35
|
+
* starts from the first value); the rest as `to` has them.
|
|
36
|
+
*/
|
|
37
|
+
static between(from, to, t) {
|
|
38
|
+
const mix = (a, b) => (a == null || b == null ? b : a + (b - a) * t);
|
|
39
|
+
const data = to.toData();
|
|
40
|
+
data.value = mix(from.value, to.value);
|
|
41
|
+
data.target = mix(from.target, to.target);
|
|
42
|
+
data.values = to.values.map((v, i) => ({ ...v, value: mix(from.values[i]?.value ?? from.value, v.value) }));
|
|
43
|
+
return data;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static from(data, options = {}) {
|
|
47
|
+
const given = Array.isArray(data) ? { values: data } : (typeof data === 'object' && data !== null ? data : { value: data });
|
|
48
|
+
const pick = (key) => options[key] ?? given[key];
|
|
49
|
+
const values = pick('values') ?? [];
|
|
50
|
+
const history = pick('history') ?? [];
|
|
51
|
+
// Without a value: the first of several, else the last of the history.
|
|
52
|
+
const first = values.length ? (typeof values[0] === 'object' ? values[0].value : values[0]) : history.at(-1);
|
|
53
|
+
return new GaugeValue({
|
|
54
|
+
value: given.value ?? first ?? 0,
|
|
55
|
+
target: pick('target'),
|
|
56
|
+
previous: pick('previous'),
|
|
57
|
+
history,
|
|
58
|
+
values,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LinearTrack } from './LinearTrack.js';
|
|
2
|
+
|
|
3
|
+
/** A track left to right. */
|
|
4
|
+
export class HorizontalTrack extends LinearTrack {
|
|
5
|
+
point(fraction, offset = 0) {
|
|
6
|
+
return { x: this.x + fraction * this.length, y: this.y + this.thickness / 2 + offset };
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
rectangle(from, to, thickness) {
|
|
10
|
+
return { x: this.x + from * this.length, y: this.y + (this.thickness - thickness) / 2, width: (to - from) * this.length, height: thickness };
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
get center() { return this.point(0.5); }
|
|
14
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { GaugeTrack } from './GaugeTrack.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* LinearTrack — a straight gauge track: a box `length` long and `thickness`
|
|
5
|
+
* across, its segments drawn as rectangles. A subclass gives the direction.
|
|
6
|
+
*/
|
|
7
|
+
export class LinearTrack extends GaugeTrack {
|
|
8
|
+
/**
|
|
9
|
+
* @param {Object} options
|
|
10
|
+
* @param {number} options.x - The box's left
|
|
11
|
+
* @param {number} options.y - The box's top
|
|
12
|
+
* @param {number} options.length
|
|
13
|
+
* @param {number} options.thickness
|
|
14
|
+
* @param {number} [options.radius=0] - Corner radius of the drawn segments
|
|
15
|
+
*/
|
|
16
|
+
constructor({ x, y, length, thickness, radius = 0 }) {
|
|
17
|
+
super(thickness);
|
|
18
|
+
if (new.target === LinearTrack) throw new TypeError('LinearTrack is abstract — use HorizontalTrack or VerticalTrack');
|
|
19
|
+
Object.assign(this, { x, y, length, radius });
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** The rectangle covering from one fraction to another, `thickness` across and centred. */
|
|
23
|
+
rectangle(from, to, thickness) { throw new Error(`${this.constructor.name} must implement rectangle()`); }
|
|
24
|
+
|
|
25
|
+
draw(renderer, from, to, color, { thickness = this.thickness } = {}) {
|
|
26
|
+
const r = this.rectangle(Math.min(from, to), Math.max(from, to), thickness);
|
|
27
|
+
renderer.rect(r.x, r.y, r.width, r.height, color, null, this.radius ? { rx: this.radius, ry: this.radius } : {});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sparkline — a small line of a series' recent values, fitted to a box:
|
|
3
|
+
* the first value at the left, the last at the right, the lowest at the
|
|
4
|
+
* bottom and the highest at the top.
|
|
5
|
+
*/
|
|
6
|
+
export class Sparkline {
|
|
7
|
+
/**
|
|
8
|
+
* @param {number[]} values - At least two to draw a line
|
|
9
|
+
* @param {{x:number, y:number, width:number, height:number}} box
|
|
10
|
+
*/
|
|
11
|
+
constructor(values, box) {
|
|
12
|
+
this.values = values.map(Number).filter(Number.isFinite);
|
|
13
|
+
this.box = box;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Each value's point in the box (none for fewer than two values). */
|
|
17
|
+
get points() {
|
|
18
|
+
const { values, box } = this;
|
|
19
|
+
if (values.length < 2) return [];
|
|
20
|
+
const lo = Math.min(...values);
|
|
21
|
+
const hi = Math.max(...values);
|
|
22
|
+
const span = (hi - lo) || 1;
|
|
23
|
+
// A flat series sits across the middle.
|
|
24
|
+
const flat = hi === lo;
|
|
25
|
+
return values.map((v, i) => ({
|
|
26
|
+
x: box.x + (i / (values.length - 1)) * box.width,
|
|
27
|
+
y: flat ? box.y + box.height / 2 : box.y + box.height - ((v - lo) / span) * box.height,
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** The line as a path `d` (empty for fewer than two values). */
|
|
32
|
+
get d() { return this.points.map((p, i) => `${i ? 'L' : 'M'}${p.x},${p.y}`).join(' '); }
|
|
33
|
+
|
|
34
|
+
/** Draw the line and a dot on its last value. */
|
|
35
|
+
draw(renderer, { color = '#5352ed', width = 1.5 } = {}) {
|
|
36
|
+
const points = this.points;
|
|
37
|
+
if (!points.length) return;
|
|
38
|
+
renderer.path(this.d, 'none', { color, width });
|
|
39
|
+
const last = points.at(-1);
|
|
40
|
+
renderer.circle(last.x, last.y, 2.5, color);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LinearTrack } from './LinearTrack.js';
|
|
2
|
+
|
|
3
|
+
/** A track bottom to top. */
|
|
4
|
+
export class VerticalTrack extends LinearTrack {
|
|
5
|
+
point(fraction, offset = 0) {
|
|
6
|
+
return { x: this.x + this.thickness / 2 + offset, y: this.y + this.length - fraction * this.length };
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
rectangle(from, to, thickness) {
|
|
10
|
+
return { x: this.x + (this.thickness - thickness) / 2, y: this.y + this.length - to * this.length, width: thickness, height: (to - from) * this.length };
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
get center() { return this.point(0.5); }
|
|
14
|
+
|
|
15
|
+
/** Labels beside a vertical track start at their point. */
|
|
16
|
+
anchorAt() { return 'start'; }
|
|
17
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Glyph } from './Glyph.js';
|
|
2
|
+
|
|
3
|
+
/** Process: a flat-backed arrow pointing right. */
|
|
4
|
+
export class ArrowGlyph extends Glyph {
|
|
5
|
+
static key = 'arrow';
|
|
6
|
+
static ownsInterior = true;
|
|
7
|
+
|
|
8
|
+
parts(ctx) {
|
|
9
|
+
const { w, h } = ctx;
|
|
10
|
+
const G = Glyph, st = (k) => this.stroke(ctx, k);
|
|
11
|
+
const sh = h * 0.27, hx = w * 0.08; // shaft half-height, where the head starts
|
|
12
|
+
const d = `M ${-w / 2},${-sh} L ${hx},${-sh} L ${hx},${-h / 2} L ${w / 2},0`
|
|
13
|
+
+ ` L ${hx},${h / 2} L ${hx},${sh} L ${-w / 2},${sh} Z`;
|
|
14
|
+
return G.path(d, ctx.color, st());
|
|
15
|
+
}
|
|
16
|
+
outline(ctx) {
|
|
17
|
+
const { w, h } = ctx;
|
|
18
|
+
const sh = h * 0.27, hx = w * 0.08;
|
|
19
|
+
return [[-w / 2, -sh], [hx, -sh], [hx, -h / 2], [w / 2, 0], [hx, h / 2], [hx, sh], [-w / 2, sh]];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Glyph } from './Glyph.js';
|
|
2
|
+
|
|
3
|
+
/** Resource: a rounded box with a terminal nub and charge bars. */
|
|
4
|
+
export class BatteryGlyph extends Glyph {
|
|
5
|
+
static key = 'battery';
|
|
6
|
+
static ownsInterior = true;
|
|
7
|
+
|
|
8
|
+
parts(ctx) {
|
|
9
|
+
const { w, h } = ctx;
|
|
10
|
+
const G = Glyph, st = (k) => this.stroke(ctx, k);
|
|
11
|
+
const nub = h * 0.25, barX = -w * 0.28;
|
|
12
|
+
return G.group([
|
|
13
|
+
G.rect(-w / 2, -h / 2, w * 0.88, h, ctx.color, st(), { rx: h * 0.15 }),
|
|
14
|
+
G.rect(w * 0.38, -nub / 2, w * 0.12, nub, ctx.color, st()),
|
|
15
|
+
G.path(`M${barX},${-h * 0.3} L${barX},${h * 0.3} M${barX + w * 0.14},${-h * 0.3} L${barX + w * 0.14},${h * 0.3} M${barX + w * 0.28},${-h * 0.3} L${barX + w * 0.28},${h * 0.3}`, 'none', st()),
|
|
16
|
+
]);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Glyph } from './Glyph.js';
|
|
2
|
+
|
|
3
|
+
/** Function: a chevron pointing up, notched at the bottom. */
|
|
4
|
+
export class ChevronGlyph extends Glyph {
|
|
5
|
+
static key = 'chevron';
|
|
6
|
+
static ownsInterior = true;
|
|
7
|
+
|
|
8
|
+
parts(ctx) {
|
|
9
|
+
const { w, h } = ctx;
|
|
10
|
+
const G = Glyph, st = (k) => this.stroke(ctx, k);
|
|
11
|
+
const d = `M ${-w / 2},${h / 2} L ${-w / 2},${-h * 0.22} L 0,${-h / 2} L ${w / 2},${-h * 0.22} L ${w / 2},${h / 2} L 0,${h * 0.22} Z`;
|
|
12
|
+
return G.path(d, ctx.color, st());
|
|
13
|
+
}
|
|
14
|
+
outline(ctx) {
|
|
15
|
+
const { w, h } = ctx;
|
|
16
|
+
return [[-w / 2, h / 2], [-w / 2, -h * 0.22], [0, -h / 2], [w / 2, -h * 0.22], [w / 2, h / 2], [0, h * 0.22]];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { sampleArc } from '../templates/outline.js';
|
|
2
|
+
import { Glyph } from './Glyph.js';
|
|
3
|
+
|
|
4
|
+
/** A circle fitted to the smaller side: the plain graph node, and the fallback for unknown keys. */
|
|
5
|
+
export class CircleGlyph extends Glyph {
|
|
6
|
+
static key = 'circle';
|
|
7
|
+
|
|
8
|
+
parts(ctx) {
|
|
9
|
+
const G = Glyph, st = (k) => this.stroke(ctx, k);
|
|
10
|
+
return G.circle(0, 0, ctx.circleR, ctx.color, st());
|
|
11
|
+
}
|
|
12
|
+
outline(ctx) {
|
|
13
|
+
return sampleArc(0, 0, ctx.circleR, ctx.circleR, 0, Math.PI * 2, 48).slice(0, -1);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Glyph } from './Glyph.js';
|
|
2
|
+
|
|
3
|
+
/** Meaning: a rounded base and three bumps, fill only so the overlaps read as one silhouette. */
|
|
4
|
+
export class CloudGlyph extends Glyph {
|
|
5
|
+
static key = 'cloud';
|
|
6
|
+
static ownsInterior = true;
|
|
7
|
+
|
|
8
|
+
parts(ctx) {
|
|
9
|
+
const { w, h } = ctx;
|
|
10
|
+
const G = Glyph, st = (k) => this.stroke(ctx, k);
|
|
11
|
+
const baseH = h * 0.5, baseY = h / 2 - baseH;
|
|
12
|
+
return G.group([
|
|
13
|
+
G.rect(-w * 0.42, baseY, w * 0.84, baseH, ctx.color, null, { rx: baseH / 2 }),
|
|
14
|
+
G.circle(-w * 0.24, baseY + baseH * 0.1, h * 0.3, ctx.color, null),
|
|
15
|
+
G.circle(0, baseY - h * 0.08, h * 0.36, ctx.color, null),
|
|
16
|
+
G.circle(w * 0.24, baseY + baseH * 0.1, h * 0.28, ctx.color, null),
|
|
17
|
+
]);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Glyph } from './Glyph.js';
|
|
2
|
+
|
|
3
|
+
/** Component: a box with two connector tabs on its left edge. */
|
|
4
|
+
export class ComponentGlyph extends Glyph {
|
|
5
|
+
static key = 'component';
|
|
6
|
+
static ownsInterior = true;
|
|
7
|
+
|
|
8
|
+
parts(ctx) {
|
|
9
|
+
const { w, h } = ctx;
|
|
10
|
+
const G = Glyph, st = (k) => this.stroke(ctx, k);
|
|
11
|
+
const tabW = w * 0.12, tabH = h * 0.16;
|
|
12
|
+
return G.group([
|
|
13
|
+
G.rect(-w / 2 + tabW * 0.6, -h / 2, w - tabW * 0.6, h, ctx.color, st()),
|
|
14
|
+
G.rect(-w / 2, -h * 0.28, tabW, tabH, ctx.color, st()),
|
|
15
|
+
G.rect(-w / 2, h * 0.08, tabW, tabH, ctx.color, st()),
|
|
16
|
+
]);
|
|
17
|
+
}
|
|
18
|
+
}
|