matterviz 0.4.1 → 0.4.2
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/dist/EmptyState.svelte +10 -4
- package/dist/FilePicker.svelte +12 -14
- package/dist/Icon.svelte +7 -4
- package/dist/MillerIndexInput.svelte +2 -2
- package/dist/app.css +53 -0
- package/dist/brillouin/BrillouinZone.svelte +75 -85
- package/dist/brillouin/BrillouinZone.svelte.d.ts +5 -7
- package/dist/brillouin/BrillouinZoneControls.svelte +3 -6
- package/dist/brillouin/BrillouinZoneExportPane.svelte +18 -14
- package/dist/brillouin/BrillouinZoneInfoPane.svelte +6 -10
- package/dist/brillouin/BrillouinZoneScene.svelte +26 -39
- package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +1 -1
- package/dist/chempot-diagram/ChemPotDiagram.svelte +33 -38
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +62 -74
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +1 -1
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +511 -547
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +1 -1
- package/dist/chempot-diagram/async-compute.svelte.js +1 -1
- package/dist/chempot-diagram/controls-state.svelte.js +1 -1
- package/dist/colors/index.d.ts +0 -4
- package/dist/colors/index.js +19 -20
- package/dist/composition/BarChart.svelte +37 -31
- package/dist/composition/BubbleChart.svelte +17 -17
- package/dist/composition/Composition.svelte +7 -11
- package/dist/composition/Formula.svelte +18 -25
- package/dist/composition/FormulaFilter.svelte +92 -95
- package/dist/composition/PieChart.svelte +55 -41
- package/dist/composition/format.js +1 -1
- package/dist/composition/index.d.ts +2 -0
- package/dist/composition/index.js +14 -0
- package/dist/composition/parse.d.ts +2 -2
- package/dist/composition/parse.js +11 -10
- package/dist/constants.js +11 -9
- package/dist/convex-hull/ConvexHull.svelte +12 -15
- package/dist/convex-hull/ConvexHull.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull2D.svelte +93 -92
- package/dist/convex-hull/ConvexHull2D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull3D.svelte +109 -140
- package/dist/convex-hull/ConvexHull3D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull4D.svelte +75 -94
- package/dist/convex-hull/ConvexHull4D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHullChrome.svelte +36 -40
- package/dist/convex-hull/ConvexHullControls.svelte +46 -48
- package/dist/convex-hull/ConvexHullStats.svelte +193 -195
- package/dist/convex-hull/ConvexHullTooltip.svelte +5 -12
- package/dist/convex-hull/GasPressureControls.svelte +5 -12
- package/dist/convex-hull/StructurePopup.svelte +17 -21
- package/dist/convex-hull/StructurePopup.svelte.d.ts +2 -0
- package/dist/convex-hull/TemperatureSlider.svelte +4 -10
- package/dist/convex-hull/canvas-interactions.svelte.js +2 -1
- package/dist/convex-hull/helpers.d.ts +8 -10
- package/dist/convex-hull/helpers.js +36 -36
- package/dist/convex-hull/hull-state.svelte.d.ts +1 -1
- package/dist/convex-hull/thermodynamics.js +18 -17
- package/dist/coordination/CoordinationBarPlot.svelte +38 -33
- package/dist/coordination/CoordinationBarPlot.svelte.d.ts +1 -1
- package/dist/coordination/calc-coordination.d.ts +1 -1
- package/dist/coordination/calc-coordination.js +28 -25
- package/dist/element/BohrAtom.svelte +5 -8
- package/dist/element/ElementHeading.svelte +4 -1
- package/dist/element/ElementPhoto.svelte +11 -9
- package/dist/element/ElementStats.svelte +12 -10
- package/dist/element/ElementTile.svelte +24 -29
- package/dist/element/Nucleus.svelte +4 -2
- package/dist/element/data.d.ts +1 -2
- package/dist/element/helpers.d.ts +4 -0
- package/dist/element/helpers.js +18 -0
- package/dist/element/index.d.ts +1 -4
- package/dist/element/index.js +3 -18
- package/dist/feedback/DragOverlay.svelte +5 -5
- package/dist/feedback/DragOverlay.svelte.d.ts +2 -2
- package/dist/feedback/StatusMessage.svelte +7 -4
- package/dist/fermi-surface/FermiSlice.svelte +21 -18
- package/dist/fermi-surface/FermiSurface.svelte +14 -22
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +5 -7
- package/dist/fermi-surface/FermiSurfaceControls.svelte +6 -20
- package/dist/fermi-surface/FermiSurfaceControls.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceScene.svelte +37 -64
- package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceTooltip.svelte +9 -6
- package/dist/fermi-surface/compute.js +3 -3
- package/dist/fermi-surface/parse.js +22 -24
- package/dist/heatmap-matrix/HeatmapMatrix.svelte +109 -148
- package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +2 -2
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +9 -7
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +1 -1
- package/dist/heatmap-matrix/index.d.ts +5 -0
- package/dist/icons.d.ts +4 -0
- package/dist/icons.js +4 -0
- package/dist/io/ExportPane.svelte +10 -6
- package/dist/io/decompress.d.ts +2 -1
- package/dist/io/decompress.js +22 -35
- package/dist/io/export.d.ts +4 -0
- package/dist/io/export.js +5 -1
- package/dist/io/fetch.d.ts +0 -3
- package/dist/io/fetch.js +0 -11
- package/dist/io/index.d.ts +0 -1
- package/dist/io/index.js +2 -9
- package/dist/io/is-binary.d.ts +9 -0
- package/dist/io/is-binary.js +45 -1
- package/dist/io/url-drop.js +13 -25
- package/dist/isosurface/Isosurface.svelte +17 -23
- package/dist/isosurface/IsosurfaceControls.svelte +37 -42
- package/dist/isosurface/parse-vaspwave.d.ts +3 -0
- package/dist/isosurface/parse-vaspwave.js +138 -0
- package/dist/isosurface/parse.js +6 -6
- package/dist/labels.d.ts +6 -2
- package/dist/labels.js +43 -13
- package/dist/layout/FullscreenButton.svelte +2 -1
- package/dist/layout/FullscreenToggle.svelte +10 -4
- package/dist/layout/InfoCard.svelte +7 -18
- package/dist/layout/InfoTag.svelte +1 -3
- package/dist/layout/NumberRangeInput.svelte +46 -0
- package/dist/layout/NumberRangeInput.svelte.d.ts +12 -0
- package/dist/layout/PropertyFilter.svelte +2 -6
- package/dist/layout/SettingsSection.svelte +21 -17
- package/dist/layout/SubpageGrid.svelte +3 -1
- package/dist/layout/ViewerChrome.svelte +9 -10
- package/dist/layout/ViewerChrome.svelte.d.ts +2 -1
- package/dist/layout/fullscreen.js +3 -5
- package/dist/layout/fullscreen.svelte.js +1 -2
- package/dist/layout/index.d.ts +1 -0
- package/dist/layout/index.js +1 -0
- package/dist/layout/json-tree/JsonNode.svelte +8 -11
- package/dist/layout/json-tree/JsonTree.svelte +53 -77
- package/dist/layout/json-tree/JsonValue.svelte +7 -15
- package/dist/layout/json-tree/utils.js +14 -23
- package/dist/math.d.ts +2 -0
- package/dist/math.js +19 -0
- package/dist/overlays/ContextMenu.svelte +4 -2
- package/dist/overlays/CopyButton.svelte +11 -5
- package/dist/overlays/DragControlTab.svelte +6 -1
- package/dist/overlays/DraggablePane.svelte +81 -26
- package/dist/overlays/DraggablePane.svelte.d.ts +1 -0
- package/dist/overlays/GlassChip.svelte +30 -0
- package/dist/overlays/GlassChip.svelte.d.ts +8 -0
- package/dist/overlays/InfoPaneCards.svelte +11 -23
- package/dist/overlays/index.d.ts +7 -0
- package/dist/overlays/index.js +26 -0
- package/dist/overlays/portal.d.ts +2 -0
- package/dist/overlays/portal.js +14 -0
- package/dist/periodic-table/PeriodicTable.svelte +113 -145
- package/dist/periodic-table/PeriodicTable.svelte.d.ts +5 -3
- package/dist/periodic-table/PeriodicTableControls.svelte +11 -63
- package/dist/periodic-table/TableInset.svelte +9 -4
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +50 -71
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +6 -8
- package/dist/phase-diagram/PhaseDiagramControls.svelte +70 -94
- package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +1 -1
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +2 -1
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte +12 -12
- package/dist/phase-diagram/PhaseDiagramTooltip.svelte +54 -58
- package/dist/phase-diagram/TdbInfoPanel.svelte +21 -15
- package/dist/phase-diagram/build-diagram.js +3 -3
- package/dist/phase-diagram/diagram-input.d.ts +1 -2
- package/dist/phase-diagram/parse.js +15 -15
- package/dist/phase-diagram/svg-to-diagram.js +21 -15
- package/dist/phase-diagram/utils.js +2 -3
- package/dist/plot/bar/BarPlot.svelte +430 -391
- package/dist/plot/bar/BarPlot.svelte.d.ts +2 -0
- package/dist/plot/bar/BarPlotControls.svelte +1 -3
- package/dist/plot/bar/BarPlotControls.svelte.d.ts +4 -6
- package/dist/plot/bar/SpacegroupBarPlot.svelte +29 -36
- package/dist/plot/bar/data.d.ts +5 -4
- package/dist/plot/bar/data.js +2 -1
- package/dist/plot/box/BoxPlot.svelte +301 -209
- package/dist/plot/box/BoxPlot.svelte.d.ts +2 -0
- package/dist/plot/box/Violin.svelte.d.ts +1 -0
- package/dist/plot/box/box-plot.js +1 -1
- package/dist/plot/core/auto-place.js +1 -1
- package/dist/plot/core/axis-utils.d.ts +12 -7
- package/dist/plot/core/axis-utils.js +48 -48
- package/dist/plot/core/components/AxisLabel.svelte +82 -20
- package/dist/plot/core/components/AxisLabel.svelte.d.ts +1 -0
- package/dist/plot/core/components/ColorBar.svelte +101 -106
- package/dist/plot/core/components/ColorScaleSelect.svelte +1 -1
- package/dist/plot/core/components/FillArea.svelte +10 -17
- package/dist/plot/core/components/HierarchyControls.svelte +249 -0
- package/dist/plot/{sunburst/SunburstControls.svelte.d.ts → core/components/HierarchyControls.svelte.d.ts} +12 -8
- package/dist/plot/core/components/InteractiveAxisLabel.svelte +1 -1
- package/dist/plot/core/components/InteractiveAxisLabel.svelte.d.ts +1 -1
- package/dist/plot/core/components/Line.svelte +18 -9
- package/dist/plot/core/components/Line.svelte.d.ts +2 -0
- package/dist/plot/core/components/PlotAxis.svelte +40 -17
- package/dist/plot/core/components/PlotControls.svelte +65 -41
- package/dist/plot/core/components/PlotLegend.svelte +31 -35
- package/dist/plot/core/components/PlotMarginals.svelte +616 -0
- package/dist/plot/core/components/PlotMarginals.svelte.d.ts +15 -0
- package/dist/plot/core/components/PlotTooltip.svelte +1 -1
- package/dist/plot/core/components/PortalSelect.svelte +4 -8
- package/dist/plot/core/components/ReferenceLine.svelte +27 -24
- package/dist/plot/core/components/ReferenceLine3D.svelte +54 -57
- package/dist/plot/core/components/ReferencePlane.svelte +7 -8
- package/dist/plot/core/components/ZeroLines.svelte +4 -8
- package/dist/plot/core/components/ZoomRect.svelte +1 -2
- package/dist/plot/core/components/index.d.ts +1 -0
- package/dist/plot/core/components/index.js +1 -0
- package/dist/plot/core/data-cleaning-signal.d.ts +46 -0
- package/dist/plot/core/data-cleaning-signal.js +467 -0
- package/dist/plot/core/data-cleaning.d.ts +2 -42
- package/dist/plot/core/data-cleaning.js +27 -474
- package/dist/plot/core/data-transform.js +9 -5
- package/dist/plot/core/fill-utils.d.ts +3 -1
- package/dist/plot/core/fill-utils.js +28 -6
- package/dist/plot/core/index.d.ts +1 -0
- package/dist/plot/core/index.js +1 -0
- package/dist/plot/core/interactions.js +0 -2
- package/dist/plot/core/layout.d.ts +3 -1
- package/dist/plot/core/layout.js +22 -13
- package/dist/plot/core/marginals.d.ts +170 -0
- package/dist/plot/core/marginals.js +436 -0
- package/dist/plot/core/reference-line.js +1 -1
- package/dist/plot/core/scales.d.ts +23 -0
- package/dist/plot/core/scales.js +39 -13
- package/dist/plot/core/types/fills.d.ts +101 -0
- package/dist/plot/core/types/fills.js +15 -0
- package/dist/plot/core/types/plot-3d.d.ts +87 -0
- package/dist/plot/core/types/plot-3d.js +4 -0
- package/dist/plot/core/types/reference-lines.d.ts +140 -0
- package/dist/plot/core/types/reference-lines.js +9 -0
- package/dist/plot/core/types.d.ts +29 -324
- package/dist/plot/core/types.js +23 -20
- package/dist/plot/core/utils/hierarchy-chart.d.ts +51 -0
- package/dist/plot/core/utils/hierarchy-chart.js +179 -0
- package/dist/plot/core/utils/hierarchy-labels.d.ts +20 -0
- package/dist/plot/core/utils/hierarchy-labels.js +99 -0
- package/dist/plot/core/utils/label-placement.js +2 -2
- package/dist/plot/histogram/Histogram.svelte +304 -325
- package/dist/plot/histogram/Histogram.svelte.d.ts +7 -7
- package/dist/plot/histogram/HistogramControls.svelte +30 -28
- package/dist/plot/histogram/histogram.d.ts +31 -0
- package/dist/plot/histogram/histogram.js +70 -0
- package/dist/plot/histogram/index.d.ts +1 -0
- package/dist/plot/histogram/index.js +1 -0
- package/dist/plot/index.d.ts +1 -0
- package/dist/plot/index.js +1 -0
- package/dist/plot/sankey/Sankey.svelte +78 -69
- package/dist/plot/sankey/Sankey.svelte.d.ts +2 -2
- package/dist/plot/sankey/SankeyControls.svelte +22 -16
- package/dist/plot/scatter/BinnedScatterPlot.svelte +263 -109
- package/dist/plot/scatter/BinnedScatterPlot.svelte.d.ts +7 -0
- package/dist/plot/scatter/ElementScatter.svelte +4 -1
- package/dist/plot/scatter/ScatterPlot.svelte +477 -385
- package/dist/plot/scatter/ScatterPlot.svelte.d.ts +2 -0
- package/dist/plot/scatter/ScatterPlotControls.svelte +18 -19
- package/dist/plot/scatter/ScatterPlotControls.svelte.d.ts +1 -1
- package/dist/plot/scatter/ScatterPoint.svelte +16 -9
- package/dist/plot/scatter/binned-scatter-types.d.ts +3 -2
- package/dist/plot/scatter/binned-scatter-types.js +6 -1
- package/dist/plot/scatter/scatter-data.d.ts +1 -1
- package/dist/plot/scatter/scatter-data.js +8 -7
- package/dist/plot/scatter-3d/ScatterPlot3D.svelte +25 -34
- package/dist/plot/scatter-3d/ScatterPlot3D.svelte.d.ts +2 -2
- package/dist/plot/scatter-3d/ScatterPlot3DControls.svelte +8 -5
- package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte +113 -116
- package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte.d.ts +2 -2
- package/dist/plot/scatter-3d/Surface3D.svelte +4 -13
- package/dist/plot/sunburst/Sunburst.svelte +251 -329
- package/dist/plot/sunburst/Sunburst.svelte.d.ts +2 -2
- package/dist/plot/sunburst/index.d.ts +1 -1
- package/dist/plot/sunburst/index.js +2 -1
- package/dist/plot/sunburst/render.d.ts +2 -2
- package/dist/plot/sunburst/render.js +47 -22
- package/dist/plot/sunburst/sunburst.d.ts +5 -1
- package/dist/plot/sunburst/sunburst.js +10 -3
- package/dist/plot/treemap/Treemap.svelte +907 -0
- package/dist/plot/treemap/Treemap.svelte.d.ts +84 -0
- package/dist/plot/treemap/index.d.ts +3 -0
- package/dist/plot/treemap/index.js +4 -0
- package/dist/plot/treemap/treemap.d.ts +26 -0
- package/dist/plot/treemap/treemap.js +99 -0
- package/dist/rdf/RdfPlot.svelte +22 -26
- package/dist/rdf/RdfPlot.svelte.d.ts +1 -1
- package/dist/rdf/calc-rdf.js +4 -8
- package/dist/sanitize.js +1 -1
- package/dist/scene/bind-renderer.svelte.js +14 -6
- package/dist/settings.d.ts +19 -9
- package/dist/settings.js +77 -50
- package/dist/spectral/Bands.svelte +223 -230
- package/dist/spectral/BandsAndDos.svelte +11 -9
- package/dist/spectral/BrillouinBandsDos.svelte +19 -27
- package/dist/spectral/Dos.svelte +70 -73
- package/dist/spectral/helpers.d.ts +3 -3
- package/dist/spectral/helpers.js +25 -35
- package/dist/state.svelte.js +5 -18
- package/dist/structure/Arrow.svelte +5 -18
- package/dist/structure/ArrowInstances.svelte +160 -0
- package/dist/structure/ArrowInstances.svelte.d.ts +16 -0
- package/dist/structure/AtomLegend.svelte +115 -75
- package/dist/structure/AtomLegend.svelte.d.ts +1 -1
- package/dist/structure/Bond.svelte +31 -23
- package/dist/structure/CanvasTooltip.svelte +15 -3
- package/dist/structure/CellSelect.svelte +11 -26
- package/dist/structure/Cylinder.svelte +24 -40
- package/dist/structure/InstancedAtoms.svelte +114 -0
- package/dist/structure/InstancedAtoms.svelte.d.ts +15 -0
- package/dist/structure/Lattice.svelte +85 -149
- package/dist/structure/SiteLabels.svelte +122 -0
- package/dist/structure/SiteLabels.svelte.d.ts +18 -0
- package/dist/structure/Structure.svelte +473 -419
- package/dist/structure/Structure.svelte.d.ts +4 -2
- package/dist/structure/StructureCarousel.svelte +630 -0
- package/dist/structure/StructureCarousel.svelte.d.ts +19 -0
- package/dist/structure/StructureControls.svelte +157 -399
- package/dist/structure/StructureControls.svelte.d.ts +1 -1
- package/dist/structure/StructureExportPane.svelte +17 -21
- package/dist/structure/StructureInfoPane.svelte +72 -66
- package/dist/structure/StructureInfoPane.svelte.d.ts +1 -1
- package/dist/structure/StructureScene.svelte +467 -476
- package/dist/structure/StructureScene.svelte.d.ts +3 -1
- package/dist/structure/StructureViewport.svelte +386 -0
- package/dist/structure/StructureViewport.svelte.d.ts +63 -0
- package/dist/structure/atom-label-placement.d.ts +16 -12
- package/dist/structure/atom-label-placement.js +70 -37
- package/dist/structure/atom-properties.d.ts +2 -0
- package/dist/structure/atom-properties.js +104 -38
- package/dist/structure/bonding.d.ts +10 -3
- package/dist/structure/bonding.js +84 -28
- package/dist/structure/edit-history.d.ts +6 -0
- package/dist/structure/edit-history.js +27 -0
- package/dist/structure/export.d.ts +1 -0
- package/dist/structure/export.js +39 -31
- package/dist/structure/format-detect.d.ts +1 -0
- package/dist/structure/format-detect.js +22 -0
- package/dist/structure/geometry.d.ts +9 -0
- package/dist/structure/geometry.js +27 -0
- package/dist/structure/index.d.ts +16 -1
- package/dist/structure/index.js +13 -2
- package/dist/structure/measure.d.ts +1 -1
- package/dist/structure/measure.js +6 -12
- package/dist/structure/parse.d.ts +2 -1
- package/dist/structure/parse.js +243 -222
- package/dist/structure/partial-occupancy.js +4 -2
- package/dist/structure/pbc.js +78 -98
- package/dist/structure/polyhedra.d.ts +0 -1
- package/dist/structure/polyhedra.js +3 -18
- package/dist/structure/supercell.d.ts +1 -2
- package/dist/structure/supercell.js +7 -13
- package/dist/symmetry/SymmetryElements.svelte +11 -15
- package/dist/symmetry/SymmetryStats.svelte +56 -68
- package/dist/symmetry/WyckoffTable.svelte +5 -24
- package/dist/symmetry/cell-transform.js +1 -0
- package/dist/symmetry/index.d.ts +1 -0
- package/dist/symmetry/index.js +8 -2
- package/dist/symmetry/spacegroups.js +3 -2
- package/dist/table/HeatmapTable.svelte +1102 -365
- package/dist/table/HeatmapTable.svelte.d.ts +12 -2
- package/dist/table/ToggleMenu.svelte +5 -12
- package/dist/table/index.d.ts +21 -6
- package/dist/table/index.js +34 -21
- package/dist/theme/ThemeControl.svelte +16 -8
- package/dist/theme/index.d.ts +1 -5
- package/dist/theme/index.js +4 -10
- package/dist/theme/themes.mjs +14 -7
- package/dist/tooltip/KCoords.svelte +4 -1
- package/dist/tooltip/TooltipContent.svelte +2 -5
- package/dist/trajectory/Trajectory.svelte +515 -308
- package/dist/trajectory/Trajectory.svelte.d.ts +1 -1
- package/dist/trajectory/TrajectoryError.svelte +11 -8
- package/dist/trajectory/TrajectoryExportPane.svelte +14 -31
- package/dist/trajectory/TrajectoryInfoPane.svelte +85 -97
- package/dist/trajectory/extract.js +56 -34
- package/dist/trajectory/format-detect.js +11 -9
- package/dist/trajectory/frame-reader.d.ts +2 -0
- package/dist/trajectory/frame-reader.js +33 -29
- package/dist/trajectory/helpers.d.ts +2 -0
- package/dist/trajectory/helpers.js +18 -7
- package/dist/trajectory/index.d.ts +1 -0
- package/dist/trajectory/index.js +3 -0
- package/dist/trajectory/parse/h5-utils.d.ts +13 -0
- package/dist/trajectory/parse/h5-utils.js +109 -0
- package/dist/trajectory/parse/hdf5.d.ts +1 -1
- package/dist/trajectory/parse/hdf5.js +116 -106
- package/dist/trajectory/parse/index.d.ts +2 -3
- package/dist/trajectory/parse/index.js +17 -20
- package/dist/trajectory/parse/lammps.js +8 -12
- package/dist/trajectory/parse/vasp.js +10 -7
- package/dist/trajectory/parse/vaspout-electronic.d.ts +13 -0
- package/dist/trajectory/parse/vaspout-electronic.js +207 -0
- package/dist/trajectory/parse/vaspout-h5.d.ts +5 -0
- package/dist/trajectory/parse/vaspout-h5.js +284 -0
- package/dist/trajectory/parse/xyz.js +11 -7
- package/dist/trajectory/plotting.d.ts +8 -9
- package/dist/trajectory/plotting.js +99 -27
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +7 -0
- package/dist/xrd/XrdPlot.svelte +47 -61
- package/dist/xrd/broadening.js +2 -1
- package/dist/xrd/calc-xrd.js +2 -4
- package/dist/xrd/parse.d.ts +0 -1
- package/dist/xrd/parse.js +56 -73
- package/package.json +61 -33
- package/dist/api/mp.d.ts +0 -6
- package/dist/api/mp.js +0 -22
- package/dist/plot/sunburst/SunburstControls.svelte +0 -200
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { PaneProps, PaneToggleProps } from '../../overlays';
|
|
2
2
|
import type { D3ColorSchemeName, D3InterpolateName } from '../../colors';
|
|
3
3
|
import type { D3SymbolName } from '../../labels';
|
|
4
|
-
import type { Point2D,
|
|
4
|
+
import type { Point2D, Vec2 } from '../../math';
|
|
5
5
|
import type { ComponentProps, Snippet } from 'svelte';
|
|
6
6
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
7
7
|
import type { TweenOptions } from 'svelte/motion';
|
|
8
8
|
import type { Sides } from './layout';
|
|
9
9
|
import type PlotLegend from './components/PlotLegend.svelte';
|
|
10
10
|
import type { TicksOption } from './scales';
|
|
11
|
+
import type { FillGradient } from './types/fills';
|
|
11
12
|
export type { TweenOptions } from 'svelte/motion';
|
|
12
13
|
export type { BandwidthOption, BoxHandlerProps, BoxPlotSeries, ViolinKind, ViolinSide, WhiskerMode, } from '../box/box-plot';
|
|
13
14
|
export type { CleaningConfig, CleaningQuality, CleaningResult, InstabilityResult, InvalidValueMode, LocalOutlierConfig, LocalOutlierResult, OscillationWeights, PhysicalBounds, SmoothingConfig, TruncationMode, } from './data-cleaning';
|
|
@@ -79,6 +80,7 @@ export interface BarStyle {
|
|
|
79
80
|
ry?: number;
|
|
80
81
|
[key: string]: unknown;
|
|
81
82
|
}
|
|
83
|
+
export type LineCurve = `linear` | `monotone` | `natural` | `step` | `basis` | `catmull-rom`;
|
|
82
84
|
export interface LineStyle {
|
|
83
85
|
color?: string;
|
|
84
86
|
width?: number;
|
|
@@ -113,10 +115,12 @@ export interface DataSeries<Metadata = Record<string, unknown>> {
|
|
|
113
115
|
label?: string;
|
|
114
116
|
legend_group?: string;
|
|
115
117
|
unit?: string;
|
|
118
|
+
axis_group?: string;
|
|
116
119
|
line_style?: {
|
|
117
120
|
stroke?: string;
|
|
118
121
|
stroke_width?: number;
|
|
119
122
|
line_dash?: string;
|
|
123
|
+
curve?: LineCurve;
|
|
120
124
|
};
|
|
121
125
|
filtered_data?: InternalPoint<Metadata>[];
|
|
122
126
|
_id?: string | number;
|
|
@@ -200,6 +204,27 @@ export type SizeScaleConfig = {
|
|
|
200
204
|
radius_range?: Vec2;
|
|
201
205
|
value_range?: Vec2;
|
|
202
206
|
};
|
|
207
|
+
export declare const COLOR_BAR_DEFAULTS: {
|
|
208
|
+
readonly width: 220;
|
|
209
|
+
readonly horizontal_bar_height: 16;
|
|
210
|
+
readonly binned_bar_height: 10;
|
|
211
|
+
readonly horizontal_footprint: {
|
|
212
|
+
readonly width: 220;
|
|
213
|
+
readonly height: 56;
|
|
214
|
+
};
|
|
215
|
+
readonly vertical_footprint: {
|
|
216
|
+
readonly width: 56;
|
|
217
|
+
readonly height: 100;
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
export declare const SCALE_DEFAULTS: {
|
|
221
|
+
scheme: D3InterpolateName;
|
|
222
|
+
color: ColorScaleConfig;
|
|
223
|
+
radius: Vec2;
|
|
224
|
+
binned_radius: Vec2;
|
|
225
|
+
size: SizeScaleConfig;
|
|
226
|
+
size_3d: SizeScaleConfig;
|
|
227
|
+
};
|
|
203
228
|
export declare const is_scale_type_name: (val: string) => val is ScaleTypeName;
|
|
204
229
|
export declare function get_scale_type_name(scale_type: ScaleType | undefined): ScaleTypeName;
|
|
205
230
|
export declare function get_arcsinh_threshold(scale_type: ScaleType | undefined): number;
|
|
@@ -457,326 +482,6 @@ export declare const DEFAULT_GRID_STYLE: {
|
|
|
457
482
|
export declare const DEFAULT_MARKERS: "line+points";
|
|
458
483
|
export declare const DEFAULT_SERIES_COLORS: readonly ["#4e79a7", "#f28e2c", "#e15759", "#76b7b2", "#59a14f", "#edc949", "#af7aa1", "#ff9da7", "#9c755f", "#bab0ab"];
|
|
459
484
|
export declare const DEFAULT_SERIES_SYMBOLS: readonly ["Circle", "Square", "Triangle", "Cross", "Diamond", "Star", "Wye"];
|
|
460
|
-
export
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
export interface DataSeries3D<Metadata = Record<string, unknown>> extends Omit<DataSeries<Metadata>, `y_axis` | `filtered_data`> {
|
|
464
|
-
z: readonly number[];
|
|
465
|
-
filtered_data?: InternalPoint3D<Metadata>[];
|
|
466
|
-
}
|
|
467
|
-
export interface InternalPoint3D<Metadata = Record<string, unknown>> extends ScatterPoint3D<Metadata> {
|
|
468
|
-
series_idx: number;
|
|
469
|
-
point_idx: number;
|
|
470
|
-
color_value?: number | null;
|
|
471
|
-
size_value?: number | null;
|
|
472
|
-
point_style?: PointStyle;
|
|
473
|
-
}
|
|
474
|
-
export type SurfaceType = `grid` | `parametric` | `triangulated`;
|
|
475
|
-
export interface Surface3DConfig {
|
|
476
|
-
id?: string | number;
|
|
477
|
-
type: SurfaceType;
|
|
478
|
-
x_range?: Vec2;
|
|
479
|
-
y_range?: Vec2;
|
|
480
|
-
resolution?: number | Vec2;
|
|
481
|
-
z_fn?: (x: number, y: number) => number;
|
|
482
|
-
u_range?: Vec2;
|
|
483
|
-
v_range?: Vec2;
|
|
484
|
-
parametric_fn?: (u: number, v: number) => Point3D;
|
|
485
|
-
points?: Point3D[];
|
|
486
|
-
triangles?: Vec3[];
|
|
487
|
-
color?: string;
|
|
488
|
-
color_fn?: (x: number, y: number, z: number) => string;
|
|
489
|
-
opacity?: number;
|
|
490
|
-
wireframe?: boolean;
|
|
491
|
-
wireframe_color?: string;
|
|
492
|
-
wireframe_width?: number;
|
|
493
|
-
visible?: boolean;
|
|
494
|
-
double_sided?: boolean;
|
|
495
|
-
}
|
|
496
|
-
export interface AxisConfig3D extends AxisConfig {
|
|
497
|
-
show_plane?: boolean;
|
|
498
|
-
plane_opacity?: number;
|
|
499
|
-
}
|
|
500
|
-
export interface DisplayConfig3D extends DisplayConfig {
|
|
501
|
-
z_grid?: boolean;
|
|
502
|
-
z_zero_line?: boolean;
|
|
503
|
-
show_axes?: boolean;
|
|
504
|
-
show_axis_labels?: boolean;
|
|
505
|
-
show_bounding_box?: boolean;
|
|
506
|
-
show_grid?: boolean;
|
|
507
|
-
projections?: {
|
|
508
|
-
xy?: boolean;
|
|
509
|
-
xz?: boolean;
|
|
510
|
-
yz?: boolean;
|
|
511
|
-
};
|
|
512
|
-
projection_opacity?: number;
|
|
513
|
-
projection_scale?: number;
|
|
514
|
-
}
|
|
515
|
-
export interface Scatter3DHandlerProps<Metadata = Record<string, unknown>> extends Omit<HandlerProps<Metadata>, `x_axis` | `x2_axis` | `y_axis` | `y2_axis`> {
|
|
516
|
-
z: number;
|
|
517
|
-
x_axis: AxisConfig3D;
|
|
518
|
-
y_axis: AxisConfig3D;
|
|
519
|
-
z_axis: AxisConfig3D;
|
|
520
|
-
x_formatted: string;
|
|
521
|
-
y_formatted: string;
|
|
522
|
-
z_formatted: string;
|
|
523
|
-
color_value?: number | null;
|
|
524
|
-
}
|
|
525
|
-
export type Scatter3DHandlerEvent<Metadata = Record<string, unknown>> = Scatter3DHandlerProps<Metadata> & {
|
|
526
|
-
event?: MouseEvent;
|
|
527
|
-
point: InternalPoint3D<Metadata>;
|
|
528
|
-
};
|
|
529
|
-
export type CameraProjection3D = `perspective` | `orthographic`;
|
|
530
|
-
export interface PlotConfig3D {
|
|
531
|
-
x_axis?: AxisConfig3D;
|
|
532
|
-
y_axis?: AxisConfig3D;
|
|
533
|
-
z_axis?: AxisConfig3D;
|
|
534
|
-
display?: DisplayConfig3D;
|
|
535
|
-
}
|
|
536
|
-
export interface StyleOverrides3D extends StyleOverrides {
|
|
537
|
-
point?: StyleOverrides[`point`] & {
|
|
538
|
-
sphere_segments?: number;
|
|
539
|
-
};
|
|
540
|
-
}
|
|
541
|
-
export interface ControlsConfig3D extends ControlsConfig {
|
|
542
|
-
show_camera_controls?: boolean;
|
|
543
|
-
show_surface_controls?: boolean;
|
|
544
|
-
}
|
|
545
|
-
export type FillBoundary = {
|
|
546
|
-
type: `series`;
|
|
547
|
-
series_idx: number;
|
|
548
|
-
} | {
|
|
549
|
-
type: `series`;
|
|
550
|
-
series_id: string | number;
|
|
551
|
-
} | {
|
|
552
|
-
type: `constant`;
|
|
553
|
-
value: number;
|
|
554
|
-
} | {
|
|
555
|
-
type: `axis`;
|
|
556
|
-
axis: `x` | `x2` | `y` | `y2`;
|
|
557
|
-
value?: number;
|
|
558
|
-
} | {
|
|
559
|
-
type: `function`;
|
|
560
|
-
fn: (coord: number) => number;
|
|
561
|
-
} | {
|
|
562
|
-
type: `data`;
|
|
563
|
-
values: readonly number[];
|
|
564
|
-
x?: readonly number[];
|
|
565
|
-
} | number;
|
|
566
|
-
export interface FillGradient {
|
|
567
|
-
type: `linear` | `radial`;
|
|
568
|
-
angle?: number;
|
|
569
|
-
center?: {
|
|
570
|
-
x: number;
|
|
571
|
-
y: number;
|
|
572
|
-
};
|
|
573
|
-
stops: readonly [number, string][];
|
|
574
|
-
}
|
|
575
|
-
export interface FillEdgeStyle {
|
|
576
|
-
color?: string;
|
|
577
|
-
width?: number;
|
|
578
|
-
dash?: string;
|
|
579
|
-
opacity?: number;
|
|
580
|
-
}
|
|
581
|
-
export interface FillHoverStyle {
|
|
582
|
-
fill?: string;
|
|
583
|
-
fill_opacity?: number;
|
|
584
|
-
edge?: FillEdgeStyle;
|
|
585
|
-
cursor?: string;
|
|
586
|
-
scale?: number;
|
|
587
|
-
stroke?: string;
|
|
588
|
-
stroke_width?: number;
|
|
589
|
-
}
|
|
590
|
-
export interface FillHandlerEvent {
|
|
591
|
-
event: MouseEvent | KeyboardEvent;
|
|
592
|
-
region_idx: number;
|
|
593
|
-
region_id?: string | number;
|
|
594
|
-
x: number;
|
|
595
|
-
y: number;
|
|
596
|
-
px: number;
|
|
597
|
-
py: number;
|
|
598
|
-
label?: string;
|
|
599
|
-
metadata?: Record<string, unknown>;
|
|
600
|
-
}
|
|
601
|
-
export type LayerZIndex = `below-grid` | `below-lines` | `below-points` | `above-all`;
|
|
602
|
-
export declare const FILL_CURVE_TYPES: readonly ["linear", "monotoneX", "monotoneY", "step", "stepBefore", "stepAfter", "basis", "cardinal", "catmullRom", "natural"];
|
|
603
|
-
export type FillCurveType = (typeof FILL_CURVE_TYPES)[number];
|
|
604
|
-
export interface FillRegion {
|
|
605
|
-
id?: string | number;
|
|
606
|
-
label?: string;
|
|
607
|
-
upper: FillBoundary;
|
|
608
|
-
lower: FillBoundary;
|
|
609
|
-
x_range?: [number | null, number | null];
|
|
610
|
-
y_range?: [number | null, number | null];
|
|
611
|
-
where?: (x: number, y_upper: number, y_lower: number) => boolean;
|
|
612
|
-
fill?: string | FillGradient;
|
|
613
|
-
fill_opacity?: number;
|
|
614
|
-
edge_upper?: FillEdgeStyle;
|
|
615
|
-
edge_lower?: FillEdgeStyle;
|
|
616
|
-
curve?: FillCurveType;
|
|
617
|
-
step_position?: number;
|
|
618
|
-
z_index?: LayerZIndex;
|
|
619
|
-
visible?: boolean;
|
|
620
|
-
hover_style?: FillHoverStyle;
|
|
621
|
-
on_click?: (event: FillHandlerEvent) => void;
|
|
622
|
-
on_hover?: (event: FillHandlerEvent | null) => void;
|
|
623
|
-
show_in_legend?: boolean;
|
|
624
|
-
legend_group?: string;
|
|
625
|
-
metadata?: Record<string, unknown>;
|
|
626
|
-
}
|
|
627
|
-
export interface ErrorBand {
|
|
628
|
-
series: {
|
|
629
|
-
type: `series`;
|
|
630
|
-
series_idx: number;
|
|
631
|
-
} | {
|
|
632
|
-
type: `series`;
|
|
633
|
-
series_id: string | number;
|
|
634
|
-
};
|
|
635
|
-
error: number | readonly number[] | {
|
|
636
|
-
upper: number | readonly number[];
|
|
637
|
-
lower: number | readonly number[];
|
|
638
|
-
};
|
|
639
|
-
fill?: string;
|
|
640
|
-
fill_opacity?: number;
|
|
641
|
-
edge_style?: FillEdgeStyle;
|
|
642
|
-
id?: string | number;
|
|
643
|
-
label?: string;
|
|
644
|
-
show_in_legend?: boolean;
|
|
645
|
-
}
|
|
646
|
-
export interface RefLineStyle {
|
|
647
|
-
color?: string;
|
|
648
|
-
width?: number;
|
|
649
|
-
dash?: string;
|
|
650
|
-
opacity?: number;
|
|
651
|
-
}
|
|
652
|
-
export interface RefLineAnnotation {
|
|
653
|
-
text: string;
|
|
654
|
-
position?: `start` | `center` | `end`;
|
|
655
|
-
side?: `above` | `below` | `left` | `right`;
|
|
656
|
-
offset?: {
|
|
657
|
-
x?: number;
|
|
658
|
-
y?: number;
|
|
659
|
-
};
|
|
660
|
-
gap?: number;
|
|
661
|
-
edge_padding?: number;
|
|
662
|
-
font_size?: string;
|
|
663
|
-
font_family?: string;
|
|
664
|
-
color?: string;
|
|
665
|
-
background?: string;
|
|
666
|
-
padding?: number;
|
|
667
|
-
rotate?: boolean;
|
|
668
|
-
}
|
|
669
|
-
export interface RefLineEvent {
|
|
670
|
-
event: MouseEvent | KeyboardEvent | FocusEvent;
|
|
671
|
-
line_idx: number;
|
|
672
|
-
line_id?: string | number;
|
|
673
|
-
type: RefLine[`type`];
|
|
674
|
-
label?: string;
|
|
675
|
-
metadata?: Record<string, unknown>;
|
|
676
|
-
}
|
|
677
|
-
export interface RefLineBase {
|
|
678
|
-
id?: string | number;
|
|
679
|
-
x_span?: [number | null, number | null];
|
|
680
|
-
y_span?: [number | null, number | null];
|
|
681
|
-
coord_mode?: `data` | `relative`;
|
|
682
|
-
x_axis?: `x1` | `x2`;
|
|
683
|
-
y_axis?: `y1` | `y2`;
|
|
684
|
-
style?: RefLineStyle;
|
|
685
|
-
annotation?: RefLineAnnotation;
|
|
686
|
-
z_index?: LayerZIndex;
|
|
687
|
-
visible?: boolean;
|
|
688
|
-
hover_style?: RefLineStyle;
|
|
689
|
-
on_click?: (event: RefLineEvent) => void;
|
|
690
|
-
on_hover?: (event: RefLineEvent | null) => void;
|
|
691
|
-
show_in_legend?: boolean;
|
|
692
|
-
label?: string;
|
|
693
|
-
legend_group?: string;
|
|
694
|
-
metadata?: Record<string, unknown>;
|
|
695
|
-
}
|
|
696
|
-
export type RefLineValue = number | Date | string;
|
|
697
|
-
export type RefLine = RefLineBase & ({
|
|
698
|
-
type: `horizontal`;
|
|
699
|
-
y: RefLineValue;
|
|
700
|
-
} | {
|
|
701
|
-
type: `vertical`;
|
|
702
|
-
x: RefLineValue;
|
|
703
|
-
} | {
|
|
704
|
-
type: `diagonal`;
|
|
705
|
-
slope: number;
|
|
706
|
-
intercept: number;
|
|
707
|
-
} | {
|
|
708
|
-
type: `segment`;
|
|
709
|
-
p1: [RefLineValue, RefLineValue];
|
|
710
|
-
p2: [RefLineValue, RefLineValue];
|
|
711
|
-
} | {
|
|
712
|
-
type: `line`;
|
|
713
|
-
p1: [RefLineValue, RefLineValue];
|
|
714
|
-
p2: [RefLineValue, RefLineValue];
|
|
715
|
-
});
|
|
716
|
-
export declare const REF_LINE_STYLE_DEFAULTS: Required<RefLineStyle>;
|
|
717
|
-
type Ref3DBase = Omit<RefLineBase, `coord_mode` | `x_axis` | `y_axis` | `style` | `hover_style` | `annotation` | `on_click` | `on_hover`> & {
|
|
718
|
-
z_span?: [number | null, number | null];
|
|
719
|
-
};
|
|
720
|
-
export interface RefLine3DBase extends Ref3DBase {
|
|
721
|
-
style?: RefLineStyle;
|
|
722
|
-
hover_style?: RefLineStyle;
|
|
723
|
-
annotation?: RefLineAnnotation;
|
|
724
|
-
on_click?: (event: {
|
|
725
|
-
line_idx: number;
|
|
726
|
-
line_id?: string | number;
|
|
727
|
-
}) => void;
|
|
728
|
-
on_hover?: (event: {
|
|
729
|
-
line_idx: number;
|
|
730
|
-
line_id?: string | number;
|
|
731
|
-
} | null) => void;
|
|
732
|
-
}
|
|
733
|
-
export type RefLine3D = RefLine3DBase & ({
|
|
734
|
-
type: `x-axis`;
|
|
735
|
-
y: number;
|
|
736
|
-
z: number;
|
|
737
|
-
} | {
|
|
738
|
-
type: `y-axis`;
|
|
739
|
-
x: number;
|
|
740
|
-
z: number;
|
|
741
|
-
} | {
|
|
742
|
-
type: `z-axis`;
|
|
743
|
-
x: number;
|
|
744
|
-
y: number;
|
|
745
|
-
} | {
|
|
746
|
-
type: `segment`;
|
|
747
|
-
p1: Vec3;
|
|
748
|
-
p2: Vec3;
|
|
749
|
-
} | {
|
|
750
|
-
type: `line`;
|
|
751
|
-
p1: Vec3;
|
|
752
|
-
p2: Vec3;
|
|
753
|
-
});
|
|
754
|
-
export interface RefPlaneStyle {
|
|
755
|
-
color?: string;
|
|
756
|
-
opacity?: number;
|
|
757
|
-
wireframe?: boolean;
|
|
758
|
-
wireframe_color?: string;
|
|
759
|
-
double_sided?: boolean;
|
|
760
|
-
}
|
|
761
|
-
export interface RefPlaneBase extends Ref3DBase {
|
|
762
|
-
style?: RefPlaneStyle;
|
|
763
|
-
}
|
|
764
|
-
export type RefPlane = RefPlaneBase & ({
|
|
765
|
-
type: `xy`;
|
|
766
|
-
z: number;
|
|
767
|
-
} | {
|
|
768
|
-
type: `xz`;
|
|
769
|
-
y: number;
|
|
770
|
-
} | {
|
|
771
|
-
type: `yz`;
|
|
772
|
-
x: number;
|
|
773
|
-
} | {
|
|
774
|
-
type: `normal`;
|
|
775
|
-
normal: Vec3;
|
|
776
|
-
point: Vec3;
|
|
777
|
-
} | {
|
|
778
|
-
type: `points`;
|
|
779
|
-
p1: Vec3;
|
|
780
|
-
p2: Vec3;
|
|
781
|
-
p3: Vec3;
|
|
782
|
-
});
|
|
485
|
+
export type * from './types/plot-3d';
|
|
486
|
+
export * from './types/fills';
|
|
487
|
+
export * from './types/reference-lines';
|
package/dist/plot/core/types.js
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
// Shared defaults for color/size scales and colorbar layout (scatter, bar, binned-scatter, …)
|
|
2
|
+
const COLOR_BAR_WIDTH = 220;
|
|
3
|
+
export const COLOR_BAR_DEFAULTS = {
|
|
4
|
+
width: COLOR_BAR_WIDTH,
|
|
5
|
+
horizontal_bar_height: 16,
|
|
6
|
+
binned_bar_height: 10,
|
|
7
|
+
horizontal_footprint: { width: COLOR_BAR_WIDTH, height: 56 },
|
|
8
|
+
vertical_footprint: { width: 56, height: 100 },
|
|
9
|
+
};
|
|
10
|
+
// Shared color/size scale defaults for scatter, scatter-3d, binned-scatter, bar, …
|
|
11
|
+
const VIRIDIS = `interpolateViridis`;
|
|
12
|
+
const SCATTER_RADIUS = [2, 10];
|
|
13
|
+
const BINNED_RADIUS = [4, 12];
|
|
14
|
+
export const SCALE_DEFAULTS = {
|
|
15
|
+
scheme: VIRIDIS,
|
|
16
|
+
color: { type: `linear`, scheme: VIRIDIS, value_range: undefined },
|
|
17
|
+
radius: SCATTER_RADIUS,
|
|
18
|
+
binned_radius: BINNED_RADIUS,
|
|
19
|
+
size: { type: `linear`, radius_range: SCATTER_RADIUS, value_range: undefined },
|
|
20
|
+
size_3d: { type: `linear`, radius_range: [0.05, 0.2], value_range: undefined },
|
|
21
|
+
};
|
|
1
22
|
// Type guard for select value narrowing (avoids unsafe casts)
|
|
2
23
|
const SCALE_TYPE_NAMES = new Set([`linear`, `log`, `arcsinh`, `time`]);
|
|
3
24
|
export const is_scale_type_name = (val) => SCALE_TYPE_NAMES.has(val);
|
|
@@ -77,23 +98,5 @@ export const DEFAULT_SERIES_SYMBOLS = [
|
|
|
77
98
|
`Star`,
|
|
78
99
|
`Wye`,
|
|
79
100
|
];
|
|
80
|
-
|
|
81
|
-
export
|
|
82
|
-
`linear`,
|
|
83
|
-
`monotoneX`,
|
|
84
|
-
`monotoneY`,
|
|
85
|
-
`step`,
|
|
86
|
-
`stepBefore`,
|
|
87
|
-
`stepAfter`,
|
|
88
|
-
`basis`,
|
|
89
|
-
`cardinal`,
|
|
90
|
-
`catmullRom`,
|
|
91
|
-
`natural`,
|
|
92
|
-
];
|
|
93
|
-
// Default style values for reference lines
|
|
94
|
-
export const REF_LINE_STYLE_DEFAULTS = {
|
|
95
|
-
color: `currentColor`,
|
|
96
|
-
width: 1,
|
|
97
|
-
dash: ``,
|
|
98
|
-
opacity: 1,
|
|
99
|
-
};
|
|
101
|
+
export * from './types/fills';
|
|
102
|
+
export * from './types/reference-lines';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { D3InterpolateName } from '../../../colors';
|
|
2
|
+
import type { Vec2 } from '../../../math';
|
|
3
|
+
import type { LegendItem } from '../types';
|
|
4
|
+
import type { PositionedArc, SunburstLabelText, SunburstLayoutOptions, SunburstLayoutResult, SunburstNode, SunburstNodeHandlerProps } from '../../sunburst/sunburst';
|
|
5
|
+
export declare function safe_hierarchy_layout<Metadata>(data: SunburstNode<Metadata> | SunburstNode<Metadata>[], opts: SunburstLayoutOptions): SunburstLayoutResult<Metadata>;
|
|
6
|
+
export declare function compute_metric_colors<Metadata>(arcs: readonly PositionedArc<Metadata>[], color_values: ((arc: PositionedArc<Metadata>) => number | null) | undefined, color_scale: D3InterpolateName, color_range?: Vec2): {
|
|
7
|
+
range: Vec2;
|
|
8
|
+
colors: string[];
|
|
9
|
+
} | null;
|
|
10
|
+
export declare function compute_node_dim<Metadata>(arcs: readonly PositionedArc<Metadata>[], muted_ids: ReadonlySet<string | number>, hovered_idx: number | null): {
|
|
11
|
+
opacity: number;
|
|
12
|
+
label_opacity: number | undefined;
|
|
13
|
+
}[];
|
|
14
|
+
export declare function prune_muted_ids<Metadata>(arcs: readonly PositionedArc<Metadata>[], muted_ids: Set<string | number>): void;
|
|
15
|
+
export declare function toggle_muted(muted_ids: Set<string | number>, id: string | number | undefined): void;
|
|
16
|
+
export declare function hierarchy_legend_items<Metadata>(depth1_arcs: readonly PositionedArc<Metadata>[], muted_ids: ReadonlySet<string | number>, color_for: (arc: PositionedArc<Metadata>) => string): LegendItem[];
|
|
17
|
+
export declare function node_handler_props<Metadata>(arcs: readonly PositionedArc<Metadata>[], arc: PositionedArc<Metadata>, color: string): SunburstNodeHandlerProps<Metadata>;
|
|
18
|
+
export declare function selection_within(wrapper: HTMLElement | undefined): boolean;
|
|
19
|
+
export declare function ancestor_chain<Metadata>(arcs: readonly PositionedArc<Metadata>[], zoom_root: PositionedArc<Metadata> | null): PositionedArc<Metadata>[];
|
|
20
|
+
export interface HierarchyNodeInfo {
|
|
21
|
+
variants: {
|
|
22
|
+
text: string;
|
|
23
|
+
width: number;
|
|
24
|
+
}[];
|
|
25
|
+
aria: string;
|
|
26
|
+
fill: string;
|
|
27
|
+
label_fill: string;
|
|
28
|
+
clickable?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare function compute_node_infos<Metadata>(arcs: readonly PositionedArc<Metadata>[], opts: {
|
|
31
|
+
label_text: SunburstLabelText;
|
|
32
|
+
value_format: string;
|
|
33
|
+
label_font: string;
|
|
34
|
+
color_for: (arc: PositionedArc<Metadata>) => string;
|
|
35
|
+
text_width: (text: string, font: string) => number;
|
|
36
|
+
contrast: (fill: string) => string;
|
|
37
|
+
clickable?: (arc: PositionedArc<Metadata>) => boolean;
|
|
38
|
+
}): HierarchyNodeInfo[];
|
|
39
|
+
export declare function svg_label_font(svg_element: SVGSVGElement | null): string;
|
|
40
|
+
export declare const pointer_pos: (event: MouseEvent | FocusEvent | undefined, svg_element: SVGSVGElement | null) => {
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
} | null;
|
|
44
|
+
export declare const is_activation_key: (evt: KeyboardEvent) => boolean;
|
|
45
|
+
export declare function handle_hierarchy_escape(evt: KeyboardEvent, ctx: {
|
|
46
|
+
wrapper: HTMLElement | undefined;
|
|
47
|
+
fullscreen: boolean;
|
|
48
|
+
zoomed: boolean;
|
|
49
|
+
zoom_out: () => void;
|
|
50
|
+
exit_fullscreen: () => void;
|
|
51
|
+
}): void;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
// State/interaction helpers shared by the hierarchical part-of-whole charts
|
|
2
|
+
// (Sunburst, Treemap): metric coloring, hover/mute dimming, handler payloads,
|
|
3
|
+
// breadcrumbs and keyboard plumbing. All pure functions over the flat pre-order
|
|
4
|
+
// arc arrays that compute_sunburst_layout produces — each component keeps only
|
|
5
|
+
// its geometry-specific logic (polar projection vs squarified tiling).
|
|
6
|
+
import { get_relative_coords } from '../interactions';
|
|
7
|
+
import { create_color_scale } from '../scales';
|
|
8
|
+
import { node_display_name, node_label_variants } from './hierarchy-labels';
|
|
9
|
+
import { compute_sunburst_layout } from '../../sunburst/sunburst';
|
|
10
|
+
// Degrade to an empty layout (instead of crashing the host page) on invalid data
|
|
11
|
+
export function safe_hierarchy_layout(data, opts) {
|
|
12
|
+
try {
|
|
13
|
+
return compute_sunburst_layout(data, opts);
|
|
14
|
+
}
|
|
15
|
+
catch (err) {
|
|
16
|
+
console.error(err);
|
|
17
|
+
return { arcs: [], root: null, max_depth: 0 };
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
// Continuous metric coloring: when color_values is given, nodes are colored by
|
|
21
|
+
// their metric on a d3 colormap (nodes returning null keep their categorical
|
|
22
|
+
// color). The user accessor runs exactly once per node.
|
|
23
|
+
export function compute_metric_colors(arcs, color_values, color_scale, color_range) {
|
|
24
|
+
if (!color_values)
|
|
25
|
+
return null;
|
|
26
|
+
const vals = arcs.map((arc) => {
|
|
27
|
+
const val = arc.depth === 0 ? null : color_values(arc);
|
|
28
|
+
return val != null && Number.isFinite(val) ? val : null;
|
|
29
|
+
});
|
|
30
|
+
// iterative min/max: spreading into Math.min/max overflows the call stack
|
|
31
|
+
// for very large arc arrays
|
|
32
|
+
let min_val = Infinity;
|
|
33
|
+
let max_val = -Infinity;
|
|
34
|
+
for (const val of vals) {
|
|
35
|
+
if (val == null)
|
|
36
|
+
continue;
|
|
37
|
+
if (val < min_val)
|
|
38
|
+
min_val = val;
|
|
39
|
+
if (val > max_val)
|
|
40
|
+
max_val = val;
|
|
41
|
+
}
|
|
42
|
+
if (min_val > max_val)
|
|
43
|
+
return null; // no finite values
|
|
44
|
+
const range = color_range ?? [min_val, max_val];
|
|
45
|
+
const scale = create_color_scale({ scheme: color_scale, value_range: range }, range);
|
|
46
|
+
return {
|
|
47
|
+
range,
|
|
48
|
+
colors: vals.map((val, idx) => (val == null ? arcs[idx].color : scale(val))),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
const MUTED_OPACITY = 0.12;
|
|
52
|
+
// Legend muting + hover dimming per node, indexed by node_idx. The hovered node
|
|
53
|
+
// + its ancestors/descendants stay fully opaque, other nodes dim to 0.3; muted
|
|
54
|
+
// categories dim hardest. Pre-order indexing makes the ancestor/descendant
|
|
55
|
+
// tests O(1): a subtree is the contiguous index range [node_idx, subtree_end].
|
|
56
|
+
// Zoom-independent: recomputed only when hover/mute state changes, so during
|
|
57
|
+
// zoom tweens (where geometry re-evaluates per frame) this is an array lookup.
|
|
58
|
+
export function compute_node_dim(arcs, muted_ids, hovered_idx) {
|
|
59
|
+
const hov = hovered_idx != null ? arcs[hovered_idx] : null;
|
|
60
|
+
const active = (arc) => !hov ||
|
|
61
|
+
(arc.node_idx >= hov.node_idx && arc.node_idx <= hov.subtree_end) ||
|
|
62
|
+
(hov.node_idx >= arc.node_idx && hov.node_idx <= arc.subtree_end);
|
|
63
|
+
return arcs.map((arc) => {
|
|
64
|
+
const muted = arc.path.length > 0 && muted_ids.has(arc.path[0]);
|
|
65
|
+
return {
|
|
66
|
+
opacity: muted ? MUTED_OPACITY : active(arc) ? 1 : 0.3,
|
|
67
|
+
// labels dim only when muted, not when hover-inactive (undefined omits the attr)
|
|
68
|
+
label_opacity: muted ? MUTED_OPACITY : undefined,
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
// Drop muted ids that no longer exist in the current layout (e.g. after a data swap)
|
|
73
|
+
export function prune_muted_ids(arcs, muted_ids) {
|
|
74
|
+
const valid = new Set(arcs.filter((arc) => arc.depth === 1).map((arc) => arc.id));
|
|
75
|
+
for (const id of muted_ids)
|
|
76
|
+
if (!valid.has(id))
|
|
77
|
+
muted_ids.delete(id);
|
|
78
|
+
}
|
|
79
|
+
// Toggle one depth-1 category's muted state (legend click)
|
|
80
|
+
export function toggle_muted(muted_ids, id) {
|
|
81
|
+
if (id !== undefined && !muted_ids.delete(id))
|
|
82
|
+
muted_ids.add(id);
|
|
83
|
+
}
|
|
84
|
+
// Legend: one item per depth-1 category; toggling mutes (dims) rather than removes
|
|
85
|
+
export function hierarchy_legend_items(depth1_arcs, muted_ids, color_for) {
|
|
86
|
+
return depth1_arcs.map((arc, idx) => ({
|
|
87
|
+
series_idx: idx,
|
|
88
|
+
label: node_display_name(arc),
|
|
89
|
+
visible: !muted_ids.has(arc.id),
|
|
90
|
+
display_style: { symbol_type: `Square`, symbol_color: color_for(arc) },
|
|
91
|
+
}));
|
|
92
|
+
}
|
|
93
|
+
// Handler props are the node minus its layout geometry (screen coords are an
|
|
94
|
+
// implementation detail), plus the resolved parent id
|
|
95
|
+
export function node_handler_props(arcs, arc, color) {
|
|
96
|
+
const { x0: _x0, x1: _x1, y0: _y0, y1: _y1, subtree_end: _end, parent_idx, ...node } = arc;
|
|
97
|
+
return {
|
|
98
|
+
...node,
|
|
99
|
+
type: `node`,
|
|
100
|
+
color,
|
|
101
|
+
parent_id: parent_idx != null ? arcs[parent_idx].id : null,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
// True while the user has an uncollapsed text selection inside the chart. Labels
|
|
105
|
+
// are selectable text, and the mouseup that ends a selection drag also fires a
|
|
106
|
+
// click — selecting a label must not zoom or fire on_node_click.
|
|
107
|
+
export function selection_within(wrapper) {
|
|
108
|
+
const selection = globalThis.getSelection?.();
|
|
109
|
+
return Boolean(selection &&
|
|
110
|
+
!selection.isCollapsed &&
|
|
111
|
+
selection.anchorNode &&
|
|
112
|
+
wrapper?.contains(selection.anchorNode));
|
|
113
|
+
}
|
|
114
|
+
// Ancestor chain from the root to the current zoom root (clickable breadcrumb trail)
|
|
115
|
+
export function ancestor_chain(arcs, zoom_root) {
|
|
116
|
+
if (!zoom_root || zoom_root.depth === 0)
|
|
117
|
+
return [];
|
|
118
|
+
const chain = [];
|
|
119
|
+
let cur = zoom_root;
|
|
120
|
+
while (cur) {
|
|
121
|
+
chain.unshift(cur);
|
|
122
|
+
cur = cur.parent_idx != null ? arcs[cur.parent_idx] : null;
|
|
123
|
+
}
|
|
124
|
+
return chain;
|
|
125
|
+
}
|
|
126
|
+
// Per-node label text, measured widths, fill/label colors, aria string (and
|
|
127
|
+
// optional clickability) — all zoom-independent, so computed once per
|
|
128
|
+
// layout/option change instead of per animation frame (format_value, canvas
|
|
129
|
+
// measureText, contrast picking and color resolution would otherwise run per
|
|
130
|
+
// visible node per frame during zoom tweens)
|
|
131
|
+
export function compute_node_infos(arcs, opts) {
|
|
132
|
+
const { label_text, value_format, label_font } = opts;
|
|
133
|
+
return arcs.map((arc) => {
|
|
134
|
+
const { text, extended, short } = node_label_variants(arc, label_text, value_format);
|
|
135
|
+
const fill = opts.color_for(arc);
|
|
136
|
+
const variants = (text ? [extended, text, short] : []).flatMap((variant) => variant === undefined
|
|
137
|
+
? []
|
|
138
|
+
: [{ text: variant, width: opts.text_width(variant, label_font) }]);
|
|
139
|
+
return {
|
|
140
|
+
variants,
|
|
141
|
+
aria: `${node_display_name(arc)}: ${arc.value}`,
|
|
142
|
+
fill,
|
|
143
|
+
label_fill: opts.contrast(fill),
|
|
144
|
+
...(opts.clickable ? { clickable: opts.clickable(arc) } : {}),
|
|
145
|
+
};
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
// The font node labels actually render in (respects the chart's font-size CSS
|
|
149
|
+
// var instead of assuming 11px), for canvas-measured label fitting
|
|
150
|
+
export function svg_label_font(svg_element) {
|
|
151
|
+
if (!svg_element)
|
|
152
|
+
return `11px sans-serif`;
|
|
153
|
+
const { fontSize, fontFamily } = getComputedStyle(svg_element);
|
|
154
|
+
return `${fontSize} ${fontFamily}`;
|
|
155
|
+
}
|
|
156
|
+
// Anchor tooltips at the cursor (mouse hover) so they follow the pointer across
|
|
157
|
+
// wide nodes; callers fall back to the node center on keyboard focus (no cursor).
|
|
158
|
+
export const pointer_pos = (event, svg_element) => event instanceof MouseEvent ? get_relative_coords(event, svg_element) : null;
|
|
159
|
+
export const is_activation_key = (evt) => [`Enter`, ` `].includes(evt.key);
|
|
160
|
+
// Escape zooms out one level, then exits fullscreen once at the root — but only
|
|
161
|
+
// when the user is interacting with this chart (pointer over it, focus inside
|
|
162
|
+
// it, or fullscreen)
|
|
163
|
+
export function handle_hierarchy_escape(evt, ctx) {
|
|
164
|
+
if (evt.key !== `Escape`)
|
|
165
|
+
return;
|
|
166
|
+
const within = ctx.fullscreen ||
|
|
167
|
+
(ctx.wrapper != null &&
|
|
168
|
+
(ctx.wrapper.matches(`:hover`) || ctx.wrapper.contains(document.activeElement)));
|
|
169
|
+
if (!within)
|
|
170
|
+
return;
|
|
171
|
+
if (ctx.zoomed) {
|
|
172
|
+
evt.preventDefault();
|
|
173
|
+
ctx.zoom_out();
|
|
174
|
+
}
|
|
175
|
+
else if (ctx.fullscreen) {
|
|
176
|
+
evt.preventDefault();
|
|
177
|
+
ctx.exit_fullscreen();
|
|
178
|
+
}
|
|
179
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SunburstLabelText } from '../../sunburst/sunburst';
|
|
2
|
+
interface LabeledNode {
|
|
3
|
+
id: string | number;
|
|
4
|
+
label?: string;
|
|
5
|
+
label_short?: string;
|
|
6
|
+
value: number;
|
|
7
|
+
fraction: number;
|
|
8
|
+
parent_fraction?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare const node_display_name: (node: LabeledNode) => string;
|
|
11
|
+
export declare function node_label_str(node: LabeledNode, label_text: SunburstLabelText, value_format: string): string;
|
|
12
|
+
export declare function node_label_variants(node: LabeledNode, label_text: SunburstLabelText, value_format: string): {
|
|
13
|
+
text: string;
|
|
14
|
+
extended?: string;
|
|
15
|
+
short?: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function make_cached_contrast(): (fill: string) => string;
|
|
18
|
+
export declare function make_cached_text_width(): (text: string, font: string) => number;
|
|
19
|
+
export declare function export_hierarchy_chart(svg_element: SVGSVGElement | null, base_filename: string, format: `svg` | `png`): void;
|
|
20
|
+
export {};
|