matterviz 0.3.7 → 0.4.1
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/Icon.svelte +7 -4
- package/dist/MillerIndexInput.svelte +1 -1
- package/dist/api/optimade.js +32 -26
- package/dist/app.css +0 -3
- package/dist/brillouin/BrillouinZone.svelte +76 -148
- package/dist/brillouin/BrillouinZone.svelte.d.ts +6 -14
- package/dist/brillouin/BrillouinZoneExportPane.svelte +43 -96
- package/dist/brillouin/BrillouinZoneExportPane.svelte.d.ts +1 -1
- package/dist/brillouin/BrillouinZoneInfoPane.svelte +9 -32
- package/dist/brillouin/BrillouinZoneInfoPane.svelte.d.ts +2 -3
- package/dist/brillouin/BrillouinZoneScene.svelte +97 -205
- package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +4 -23
- package/dist/brillouin/BrillouinZoneTooltip.svelte +16 -25
- package/dist/brillouin/ReciprocalVectors.svelte +39 -0
- package/dist/brillouin/ReciprocalVectors.svelte.d.ts +9 -0
- package/dist/brillouin/compute.d.ts +2 -0
- package/dist/brillouin/compute.js +89 -90
- package/dist/brillouin/geometry.d.ts +8 -0
- package/dist/brillouin/geometry.js +57 -0
- package/dist/brillouin/index.d.ts +2 -0
- package/dist/brillouin/index.js +2 -0
- package/dist/brillouin/types.d.ts +2 -2
- package/dist/chempot-diagram/ChemPotDiagram.svelte +14 -13
- package/dist/chempot-diagram/ChemPotDiagram.svelte.d.ts +1 -1
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +109 -203
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +4 -1
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +180 -470
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +7 -1
- package/dist/chempot-diagram/async-compute.svelte.js +3 -1
- package/dist/chempot-diagram/chempot-worker.js +2 -1
- package/dist/chempot-diagram/color.d.ts +3 -6
- package/dist/chempot-diagram/color.js +5 -5
- package/dist/chempot-diagram/compute.d.ts +4 -4
- package/dist/chempot-diagram/compute.js +20 -20
- package/dist/chempot-diagram/controls-state.svelte.d.ts +10 -0
- package/dist/chempot-diagram/controls-state.svelte.js +42 -0
- package/dist/chempot-diagram/export.d.ts +47 -0
- package/dist/chempot-diagram/export.js +133 -0
- package/dist/chempot-diagram/index.d.ts +1 -0
- package/dist/chempot-diagram/index.js +1 -0
- package/dist/chempot-diagram/pointer.d.ts +0 -10
- package/dist/chempot-diagram/pointer.js +4 -4
- package/dist/chempot-diagram/types.d.ts +3 -3
- package/dist/colors/index.js +8 -7
- package/dist/composition/FormulaFilter.svelte +18 -11
- package/dist/composition/PieChart.svelte +11 -10
- package/dist/composition/chem-sys.d.ts +8 -0
- package/dist/composition/chem-sys.js +86 -0
- package/dist/composition/format.js +7 -4
- package/dist/composition/index.d.ts +1 -0
- package/dist/composition/index.js +1 -0
- package/dist/composition/parse.d.ts +0 -1
- package/dist/composition/parse.js +41 -31
- package/dist/controls.d.ts +1 -0
- package/dist/controls.js +0 -1
- package/dist/convex-hull/ConvexHull.svelte +8 -10
- package/dist/convex-hull/ConvexHull.svelte.d.ts +1 -4
- package/dist/convex-hull/ConvexHull2D.svelte +106 -185
- package/dist/convex-hull/ConvexHull2D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull3D.svelte +179 -683
- package/dist/convex-hull/ConvexHull3D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull4D.svelte +183 -687
- package/dist/convex-hull/ConvexHull4D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHullChrome.svelte +268 -0
- package/dist/convex-hull/ConvexHullChrome.svelte.d.ts +30 -0
- package/dist/convex-hull/ConvexHullControls.svelte +88 -7
- package/dist/convex-hull/ConvexHullControls.svelte.d.ts +7 -6
- package/dist/convex-hull/ConvexHullInfoPane.svelte +18 -5
- package/dist/convex-hull/ConvexHullInfoPane.svelte.d.ts +6 -5
- package/dist/convex-hull/ConvexHullStats.svelte +36 -175
- package/dist/convex-hull/ConvexHullStats.svelte.d.ts +3 -1
- package/dist/convex-hull/ConvexHullTooltip.svelte +11 -2
- package/dist/convex-hull/ConvexHullTooltip.svelte.d.ts +2 -1
- package/dist/convex-hull/GasPressureControls.svelte +4 -4
- package/dist/convex-hull/TemperatureSlider.svelte +2 -2
- package/dist/convex-hull/barycentric-coords.d.ts +2 -4
- package/dist/convex-hull/barycentric-coords.js +6 -33
- package/dist/convex-hull/canvas-interactions.svelte.d.ts +79 -0
- package/dist/convex-hull/canvas-interactions.svelte.js +278 -0
- package/dist/convex-hull/demo-temperature.d.ts +1 -1
- package/dist/convex-hull/demo-temperature.js +20 -22
- package/dist/convex-hull/gas-thermodynamics.d.ts +2 -2
- package/dist/convex-hull/gas-thermodynamics.js +22 -30
- package/dist/convex-hull/helpers.d.ts +42 -7
- package/dist/convex-hull/helpers.js +171 -78
- package/dist/convex-hull/hull-state.svelte.d.ts +44 -0
- package/dist/convex-hull/hull-state.svelte.js +124 -0
- package/dist/convex-hull/index.d.ts +10 -8
- package/dist/convex-hull/index.js +7 -2
- package/dist/convex-hull/thermodynamics.js +136 -960
- package/dist/convex-hull/types.d.ts +13 -5
- package/dist/convex-hull/types.js +12 -0
- package/dist/coordination/CoordinationBarPlot.svelte +27 -34
- package/dist/coordination/CoordinationBarPlot.svelte.d.ts +1 -1
- package/dist/element/BohrAtom.svelte +2 -1
- package/dist/element/index.d.ts +4 -0
- package/dist/element/index.js +18 -0
- package/dist/feedback/DragOverlay.svelte +3 -1
- package/dist/feedback/DragOverlay.svelte.d.ts +1 -0
- package/dist/feedback/StatusMessage.svelte +13 -3
- package/dist/fermi-surface/FermiSlice.svelte +13 -5
- package/dist/fermi-surface/FermiSurface.svelte +78 -151
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +5 -14
- package/dist/fermi-surface/FermiSurfaceControls.svelte +1 -1
- package/dist/fermi-surface/FermiSurfaceControls.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceScene.svelte +72 -221
- package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +3 -23
- package/dist/fermi-surface/FermiSurfaceTooltip.svelte +8 -34
- package/dist/fermi-surface/compute.js +67 -66
- package/dist/fermi-surface/export.js +6 -16
- package/dist/fermi-surface/index.d.ts +0 -1
- package/dist/fermi-surface/index.js +0 -1
- package/dist/fermi-surface/parse.d.ts +1 -1
- package/dist/fermi-surface/parse.js +71 -79
- package/dist/fermi-surface/types.d.ts +3 -2
- package/dist/heatmap-matrix/HeatmapMatrix.svelte +69 -52
- package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +4 -3
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +3 -2
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +5 -5
- package/dist/heatmap-matrix/index.d.ts +3 -2
- package/dist/heatmap-matrix/index.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/io/ExportPane.svelte +166 -0
- package/dist/io/ExportPane.svelte.d.ts +17 -0
- package/dist/io/decompress.js +5 -4
- package/dist/io/export.d.ts +9 -5
- package/dist/io/export.js +77 -51
- package/dist/io/fetch.d.ts +2 -1
- package/dist/io/fetch.js +5 -1
- package/dist/io/file-drop.d.ts +8 -1
- package/dist/io/file-drop.js +48 -36
- package/dist/io/index.d.ts +2 -0
- package/dist/io/index.js +10 -0
- package/dist/io/types.d.ts +13 -0
- package/dist/io/url-drop.js +64 -33
- package/dist/isosurface/parse.js +52 -51
- package/dist/isosurface/slice.js +5 -4
- package/dist/isosurface/types.js +1 -1
- package/dist/keyboard.d.ts +3 -0
- package/dist/keyboard.js +23 -0
- package/dist/labels.d.ts +1 -1
- package/dist/labels.js +9 -8
- package/dist/layout/FullscreenButton.svelte +33 -0
- package/dist/layout/FullscreenButton.svelte.d.ts +10 -0
- package/dist/layout/FullscreenToggle.svelte +8 -14
- package/dist/layout/PropertyFilter.svelte +3 -2
- package/dist/layout/SettingsSection.svelte +1 -1
- package/dist/layout/ViewerChrome.svelte +116 -0
- package/dist/layout/ViewerChrome.svelte.d.ts +17 -0
- package/dist/layout/fullscreen.d.ts +4 -0
- package/dist/layout/fullscreen.svelte.d.ts +8 -0
- package/dist/layout/fullscreen.svelte.js +37 -0
- package/dist/layout/index.d.ts +3 -0
- package/dist/layout/index.js +3 -0
- package/dist/layout/json-tree/JsonNode.svelte +1 -1
- package/dist/layout/json-tree/JsonTree.svelte +2 -2
- package/dist/layout/json-tree/utils.js +5 -4
- package/dist/marching-cubes.js +8 -13
- package/dist/math.d.ts +12 -4
- package/dist/math.js +42 -30
- package/dist/overlays/DraggablePane.svelte +4 -4
- package/dist/overlays/index.d.ts +4 -0
- package/dist/periodic-table/PeriodicTable.svelte +27 -15
- package/dist/periodic-table/PropertySelect.svelte +1 -0
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +9 -3
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +1 -1
- package/dist/phase-diagram/PhaseDiagramControls.svelte +3 -2
- package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +4 -3
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +4 -2
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte.d.ts +2 -3
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte +47 -132
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte.d.ts +3 -4
- package/dist/phase-diagram/PhaseDiagramTooltip.svelte +1 -1
- package/dist/phase-diagram/build-diagram.js +2 -2
- package/dist/phase-diagram/colors.js +1 -1
- package/dist/phase-diagram/parse.d.ts +2 -1
- package/dist/phase-diagram/parse.js +6 -5
- package/dist/phase-diagram/types.d.ts +1 -1
- package/dist/phase-diagram/utils.d.ts +3 -3
- package/dist/phase-diagram/utils.js +8 -12
- package/dist/plot/{BarPlot.svelte → bar/BarPlot.svelte} +246 -841
- package/dist/plot/{BarPlot.svelte.d.ts → bar/BarPlot.svelte.d.ts} +8 -16
- package/dist/plot/{BarPlotControls.svelte → bar/BarPlotControls.svelte} +6 -5
- package/dist/plot/{BarPlotControls.svelte.d.ts → bar/BarPlotControls.svelte.d.ts} +3 -3
- package/dist/plot/{SpacegroupBarPlot.svelte → bar/SpacegroupBarPlot.svelte} +8 -7
- package/dist/plot/{SpacegroupBarPlot.svelte.d.ts → bar/SpacegroupBarPlot.svelte.d.ts} +1 -1
- package/dist/plot/bar/data.d.ts +40 -0
- package/dist/plot/bar/data.js +154 -0
- package/dist/plot/bar/geometry.d.ts +39 -0
- package/dist/plot/bar/geometry.js +60 -0
- package/dist/plot/bar/index.d.ts +3 -0
- package/dist/plot/bar/index.js +3 -0
- package/dist/plot/box/BoxPlot.svelte +1292 -0
- package/dist/plot/box/BoxPlot.svelte.d.ts +95 -0
- package/dist/plot/box/BoxPlotControls.svelte +109 -0
- package/dist/plot/box/BoxPlotControls.svelte.d.ts +19 -0
- package/dist/plot/box/Violin.svelte +14 -0
- package/dist/plot/box/Violin.svelte.d.ts +70 -0
- package/dist/plot/box/box-plot.d.ts +56 -0
- package/dist/plot/box/box-plot.js +129 -0
- package/dist/plot/box/index.d.ts +5 -0
- package/dist/plot/box/index.js +5 -0
- package/dist/plot/box/kde.d.ts +17 -0
- package/dist/plot/box/kde.js +160 -0
- package/dist/plot/box/quantile.d.ts +3 -0
- package/dist/plot/box/quantile.js +53 -0
- package/dist/plot/{auto-place.d.ts → core/auto-place.d.ts} +1 -1
- package/dist/plot/{auto-place.js → core/auto-place.js} +6 -3
- package/dist/plot/core/axis-utils.d.ts +46 -0
- package/dist/plot/core/axis-utils.js +110 -0
- package/dist/plot/{AxisLabel.svelte → core/components/AxisLabel.svelte} +2 -2
- package/dist/plot/{AxisLabel.svelte.d.ts → core/components/AxisLabel.svelte.d.ts} +1 -1
- package/dist/plot/{ColorBar.svelte → core/components/ColorBar.svelte} +41 -38
- package/dist/plot/{ColorBar.svelte.d.ts → core/components/ColorBar.svelte.d.ts} +7 -6
- package/dist/plot/{ColorScaleSelect.svelte → core/components/ColorScaleSelect.svelte} +4 -3
- package/dist/plot/{ColorScaleSelect.svelte.d.ts → core/components/ColorScaleSelect.svelte.d.ts} +2 -2
- package/dist/plot/core/components/ControlPane.svelte +46 -0
- package/dist/plot/core/components/ControlPane.svelte.d.ts +13 -0
- package/dist/plot/{FillArea.svelte → core/components/FillArea.svelte} +17 -6
- package/dist/plot/{FillArea.svelte.d.ts → core/components/FillArea.svelte.d.ts} +1 -1
- package/dist/plot/{InteractiveAxisLabel.svelte → core/components/InteractiveAxisLabel.svelte} +3 -3
- package/dist/plot/{InteractiveAxisLabel.svelte.d.ts → core/components/InteractiveAxisLabel.svelte.d.ts} +2 -2
- package/dist/plot/{Line.svelte → core/components/Line.svelte} +33 -15
- package/dist/plot/{Line.svelte.d.ts → core/components/Line.svelte.d.ts} +3 -2
- package/dist/plot/{PlotAxis.svelte → core/components/PlotAxis.svelte} +9 -6
- package/dist/plot/{PlotAxis.svelte.d.ts → core/components/PlotAxis.svelte.d.ts} +5 -3
- package/dist/plot/{PlotControls.svelte → core/components/PlotControls.svelte} +17 -29
- package/dist/plot/core/components/PlotControls.svelte.d.ts +4 -0
- package/dist/plot/{PlotLegend.svelte → core/components/PlotLegend.svelte} +21 -10
- package/dist/plot/{PlotLegend.svelte.d.ts → core/components/PlotLegend.svelte.d.ts} +3 -2
- package/dist/plot/{PlotTooltip.svelte → core/components/PlotTooltip.svelte} +17 -1
- package/dist/plot/{PlotTooltip.svelte.d.ts → core/components/PlotTooltip.svelte.d.ts} +8 -0
- package/dist/plot/{PortalSelect.svelte → core/components/PortalSelect.svelte} +11 -7
- package/dist/plot/{ReferenceLine.svelte → core/components/ReferenceLine.svelte} +3 -3
- package/dist/plot/{ReferenceLine.svelte.d.ts → core/components/ReferenceLine.svelte.d.ts} +1 -1
- package/dist/plot/{ReferenceLine3D.svelte → core/components/ReferenceLine3D.svelte} +5 -5
- package/dist/plot/{ReferenceLine3D.svelte.d.ts → core/components/ReferenceLine3D.svelte.d.ts} +5 -5
- package/dist/plot/{ReferencePlane.svelte → core/components/ReferencePlane.svelte} +8 -8
- package/dist/plot/{ReferencePlane.svelte.d.ts → core/components/ReferencePlane.svelte.d.ts} +5 -5
- package/dist/plot/{ZeroLines.svelte → core/components/ZeroLines.svelte} +3 -3
- package/dist/plot/{ZeroLines.svelte.d.ts → core/components/ZeroLines.svelte.d.ts} +3 -3
- package/dist/plot/{ZoomRect.svelte → core/components/ZoomRect.svelte} +1 -1
- package/dist/plot/{ZoomRect.svelte.d.ts → core/components/ZoomRect.svelte.d.ts} +1 -1
- package/dist/plot/core/components/index.d.ts +17 -0
- package/dist/plot/core/components/index.js +17 -0
- package/dist/plot/{data-cleaning.d.ts → core/data-cleaning.d.ts} +71 -1
- package/dist/plot/{data-cleaning.js → core/data-cleaning.js} +21 -23
- package/dist/plot/{data-transform.d.ts → core/data-transform.d.ts} +2 -2
- package/dist/plot/{data-transform.js → core/data-transform.js} +3 -3
- package/dist/plot/core/fill-utils.d.ts +34 -0
- package/dist/plot/core/fill-utils.js +391 -0
- package/dist/plot/core/index.d.ts +10 -0
- package/dist/plot/core/index.js +11 -0
- package/dist/plot/core/interactions.d.ts +39 -0
- package/dist/plot/core/interactions.js +209 -0
- package/dist/plot/{layout.d.ts → core/layout.d.ts} +1 -0
- package/dist/plot/{layout.js → core/layout.js} +16 -8
- package/dist/plot/core/pan-zoom.svelte.d.ts +35 -0
- package/dist/plot/core/pan-zoom.svelte.js +221 -0
- package/dist/plot/core/placed-tween.svelte.d.ts +21 -0
- package/dist/plot/core/placed-tween.svelte.js +68 -0
- package/dist/plot/{reference-line.d.ts → core/reference-line.d.ts} +11 -11
- package/dist/plot/{reference-line.js → core/reference-line.js} +29 -42
- package/dist/plot/core/scales.d.ts +40 -0
- package/dist/plot/{scales.js → core/scales.js} +94 -93
- package/dist/plot/core/svg.d.ts +3 -0
- package/dist/plot/core/svg.js +41 -0
- package/dist/plot/{types.d.ts → core/types.d.ts} +36 -85
- package/dist/plot/{types.js → core/types.js} +1 -1
- package/dist/plot/{utils → core/utils}/label-placement.d.ts +3 -3
- package/dist/plot/{utils → core/utils}/label-placement.js +3 -3
- package/dist/plot/core/utils/series-visibility.d.ts +26 -0
- package/dist/plot/{utils → core/utils}/series-visibility.js +29 -2
- package/dist/plot/core/utils.d.ts +12 -0
- package/dist/plot/core/utils.js +27 -0
- package/dist/plot/{Histogram.svelte → histogram/Histogram.svelte} +174 -551
- package/dist/plot/{Histogram.svelte.d.ts → histogram/Histogram.svelte.d.ts} +2 -2
- package/dist/plot/{HistogramControls.svelte → histogram/HistogramControls.svelte} +6 -6
- package/dist/plot/{HistogramControls.svelte.d.ts → histogram/HistogramControls.svelte.d.ts} +4 -4
- package/dist/plot/histogram/index.d.ts +2 -0
- package/dist/plot/histogram/index.js +2 -0
- package/dist/plot/index.d.ts +8 -41
- package/dist/plot/index.js +10 -39
- package/dist/plot/sankey/Sankey.svelte +697 -0
- package/dist/plot/sankey/Sankey.svelte.d.ts +74 -0
- package/dist/plot/sankey/SankeyControls.svelte +98 -0
- package/dist/plot/sankey/SankeyControls.svelte.d.ts +19 -0
- package/dist/plot/sankey/index.d.ts +4 -0
- package/dist/plot/sankey/index.js +3 -0
- package/dist/plot/sankey/sankey-types.d.ts +42 -0
- package/dist/plot/sankey/sankey-types.js +4 -0
- package/dist/plot/sankey/sankey.d.ts +52 -0
- package/dist/plot/sankey/sankey.js +189 -0
- package/dist/plot/{BinnedScatterPlot.svelte → scatter/BinnedScatterPlot.svelte} +64 -64
- package/dist/plot/{BinnedScatterPlot.svelte.d.ts → scatter/BinnedScatterPlot.svelte.d.ts} +6 -6
- package/dist/plot/{ElementScatter.svelte → scatter/ElementScatter.svelte} +6 -6
- package/dist/plot/{ElementScatter.svelte.d.ts → scatter/ElementScatter.svelte.d.ts} +2 -2
- package/dist/plot/{ScatterPlot.svelte → scatter/ScatterPlot.svelte} +297 -1008
- package/dist/plot/{ScatterPlot.svelte.d.ts → scatter/ScatterPlot.svelte.d.ts} +10 -18
- package/dist/plot/{ScatterPlotControls.svelte → scatter/ScatterPlotControls.svelte} +6 -5
- package/dist/plot/{ScatterPlotControls.svelte.d.ts → scatter/ScatterPlotControls.svelte.d.ts} +2 -2
- package/dist/plot/{ScatterPoint.svelte → scatter/ScatterPoint.svelte} +7 -7
- package/dist/plot/{ScatterPoint.svelte.d.ts → scatter/ScatterPoint.svelte.d.ts} +3 -3
- package/dist/plot/{adaptive-density.d.ts → scatter/adaptive-density.d.ts} +14 -4
- package/dist/plot/{adaptive-density.js → scatter/adaptive-density.js} +46 -20
- package/dist/plot/{binned-scatter-types.d.ts → scatter/binned-scatter-types.d.ts} +5 -12
- package/dist/plot/scatter/index.d.ts +7 -0
- package/dist/plot/scatter/index.js +5 -0
- package/dist/plot/scatter/scatter-data.d.ts +19 -0
- package/dist/plot/scatter/scatter-data.js +212 -0
- package/dist/plot/{ScatterPlot3D.svelte → scatter-3d/ScatterPlot3D.svelte} +25 -34
- package/dist/plot/{ScatterPlot3D.svelte.d.ts → scatter-3d/ScatterPlot3D.svelte.d.ts} +9 -17
- package/dist/plot/{ScatterPlot3DControls.svelte → scatter-3d/ScatterPlot3DControls.svelte} +14 -14
- package/dist/plot/{ScatterPlot3DControls.svelte.d.ts → scatter-3d/ScatterPlot3DControls.svelte.d.ts} +6 -6
- package/dist/plot/{ScatterPlot3DScene.svelte → scatter-3d/ScatterPlot3DScene.svelte} +129 -128
- package/dist/plot/{ScatterPlot3DScene.svelte.d.ts → scatter-3d/ScatterPlot3DScene.svelte.d.ts} +6 -15
- package/dist/plot/{Surface3D.svelte → scatter-3d/Surface3D.svelte} +7 -6
- package/dist/plot/{Surface3D.svelte.d.ts → scatter-3d/Surface3D.svelte.d.ts} +5 -4
- package/dist/plot/scatter-3d/index.d.ts +4 -0
- package/dist/plot/scatter-3d/index.js +4 -0
- package/dist/plot/sunburst/Sunburst.svelte +1041 -0
- package/dist/plot/sunburst/Sunburst.svelte.d.ts +97 -0
- package/dist/plot/sunburst/SunburstControls.svelte +200 -0
- package/dist/plot/sunburst/SunburstControls.svelte.d.ts +26 -0
- package/dist/plot/sunburst/index.d.ts +4 -0
- package/dist/plot/sunburst/index.js +4 -0
- package/dist/plot/sunburst/render.d.ts +34 -0
- package/dist/plot/sunburst/render.js +122 -0
- package/dist/plot/sunburst/sunburst.d.ts +62 -0
- package/dist/plot/sunburst/sunburst.js +269 -0
- package/dist/rdf/RdfPlot.svelte +2 -1
- package/dist/rdf/RdfPlot.svelte.d.ts +1 -1
- package/dist/rdf/calc-rdf.js +11 -24
- package/dist/sanitize.js +14 -3
- package/dist/scene/SceneCamera.svelte +62 -0
- package/dist/scene/SceneCamera.svelte.d.ts +19 -0
- package/dist/scene/bind-renderer.svelte.d.ts +2 -0
- package/dist/scene/bind-renderer.svelte.js +14 -0
- package/dist/scene/index.d.ts +4 -0
- package/dist/scene/index.js +5 -0
- package/dist/scene/props.js +52 -0
- package/dist/scene/types.d.ts +26 -0
- package/dist/scene/types.js +1 -0
- package/dist/settings.d.ts +79 -3
- package/dist/settings.js +321 -1
- package/dist/spectral/Bands.svelte +47 -36
- package/dist/spectral/Bands.svelte.d.ts +6 -6
- package/dist/spectral/BandsAndDos.svelte +23 -25
- package/dist/spectral/BrillouinBandsDos.svelte +42 -30
- package/dist/spectral/Dos.svelte +15 -23
- package/dist/spectral/Dos.svelte.d.ts +4 -3
- package/dist/spectral/helpers.d.ts +8 -6
- package/dist/spectral/helpers.js +137 -65
- package/dist/state.svelte.d.ts +0 -7
- package/dist/state.svelte.js +0 -6
- package/dist/structure/Arrow.svelte +2 -4
- package/dist/structure/AtomLegend.svelte +8 -9
- package/dist/structure/AtomLegend.svelte.d.ts +1 -1
- package/dist/structure/CanvasTooltip.svelte +1 -0
- package/dist/structure/CellSelect.svelte +12 -5
- package/dist/structure/CellSelect.svelte.d.ts +2 -1
- package/dist/structure/Cylinder.svelte +12 -8
- package/dist/structure/Cylinder.svelte.d.ts +4 -1
- package/dist/structure/Lattice.svelte +2 -2
- package/dist/structure/Structure.svelte +365 -423
- package/dist/structure/Structure.svelte.d.ts +5 -15
- package/dist/structure/StructureControls.svelte +217 -2
- package/dist/structure/StructureControls.svelte.d.ts +5 -3
- package/dist/structure/StructureExportPane.svelte +54 -156
- package/dist/structure/StructureExportPane.svelte.d.ts +4 -5
- package/dist/structure/StructureInfoPane.svelte +10 -9
- package/dist/structure/StructureInfoPane.svelte.d.ts +5 -5
- package/dist/structure/StructureScene.svelte +376 -208
- package/dist/structure/StructureScene.svelte.d.ts +22 -20
- package/dist/structure/{label-placement.d.ts → atom-label-placement.d.ts} +3 -3
- package/dist/structure/{label-placement.js → atom-label-placement.js} +15 -5
- package/dist/structure/atom-properties.d.ts +1 -1
- package/dist/structure/atom-properties.js +17 -22
- package/dist/structure/bond-order-perception.js +3 -5
- package/dist/structure/bonding.d.ts +4 -0
- package/dist/structure/bonding.js +134 -63
- package/dist/structure/export.d.ts +24 -4
- package/dist/structure/export.js +89 -143
- package/dist/structure/index.d.ts +4 -4
- package/dist/structure/index.js +3 -3
- package/dist/structure/measure.d.ts +3 -2
- package/dist/structure/measure.js +6 -5
- package/dist/structure/parse.d.ts +3 -2
- package/dist/structure/parse.js +419 -438
- package/dist/structure/partial-occupancy.d.ts +0 -1
- package/dist/structure/partial-occupancy.js +1 -1
- package/dist/structure/pbc.d.ts +1 -1
- package/dist/structure/pbc.js +190 -13
- package/dist/structure/polyhedra.d.ts +41 -0
- package/dist/structure/polyhedra.js +602 -0
- package/dist/structure/site.d.ts +4 -0
- package/dist/structure/site.js +1 -0
- package/dist/structure/supercell.js +3 -2
- package/dist/structure/validation.js +5 -6
- package/dist/symmetry/SymmetryElementControls.svelte +69 -0
- package/dist/symmetry/SymmetryElementControls.svelte.d.ts +9 -0
- package/dist/symmetry/SymmetryElements.svelte +354 -0
- package/dist/symmetry/SymmetryElements.svelte.d.ts +24 -0
- package/dist/symmetry/SymmetryStats.svelte +113 -8
- package/dist/symmetry/WyckoffTable.svelte +68 -7
- package/dist/symmetry/WyckoffTable.svelte.d.ts +3 -0
- package/dist/symmetry/cell-transform.js +7 -14
- package/dist/symmetry/index.d.ts +14 -4
- package/dist/symmetry/index.js +291 -72
- package/dist/symmetry/spacegroups.d.ts +12 -1
- package/dist/symmetry/spacegroups.js +63 -14
- package/dist/symmetry/symmetry-elements.d.ts +33 -0
- package/dist/symmetry/symmetry-elements.js +521 -0
- package/dist/symmetry/wyckoff-db.d.ts +9 -0
- package/dist/symmetry/wyckoff-db.js +87 -0
- package/dist/table/HeatmapTable.svelte +66 -25
- package/dist/table/HeatmapTable.svelte.d.ts +1 -1
- package/dist/table/index.d.ts +1 -3
- package/dist/table/index.js +1 -1
- package/dist/theme/index.js +8 -8
- package/dist/tooltip/KCoords.svelte +45 -0
- package/dist/tooltip/KCoords.svelte.d.ts +8 -0
- package/dist/tooltip/index.d.ts +1 -0
- package/dist/tooltip/index.js +1 -0
- package/dist/trajectory/Trajectory.svelte +123 -100
- package/dist/trajectory/Trajectory.svelte.d.ts +11 -22
- package/dist/trajectory/TrajectoryExportPane.svelte +17 -25
- package/dist/trajectory/TrajectoryExportPane.svelte.d.ts +4 -5
- package/dist/trajectory/TrajectoryInfoPane.svelte +5 -3
- package/dist/trajectory/TrajectoryInfoPane.svelte.d.ts +3 -2
- package/dist/trajectory/constants.js +6 -2
- package/dist/trajectory/extract.js +17 -37
- package/dist/trajectory/format-detect.d.ts +1 -1
- package/dist/trajectory/format-detect.js +27 -19
- package/dist/trajectory/frame-reader.d.ts +0 -1
- package/dist/trajectory/frame-reader.js +63 -162
- package/dist/trajectory/helpers.d.ts +10 -2
- package/dist/trajectory/helpers.js +56 -36
- package/dist/trajectory/index.js +1 -1
- package/dist/trajectory/parse/ase.d.ts +9 -1
- package/dist/trajectory/parse/ase.js +47 -32
- package/dist/trajectory/parse/diagnostics.d.ts +3 -0
- package/dist/trajectory/parse/diagnostics.js +14 -0
- package/dist/trajectory/parse/hdf5.js +1 -1
- package/dist/trajectory/parse/index.d.ts +1 -1
- package/dist/trajectory/parse/index.js +65 -105
- package/dist/trajectory/parse/lammps.d.ts +0 -2
- package/dist/trajectory/parse/lammps.js +8 -6
- package/dist/trajectory/parse/pymatgen.d.ts +2 -0
- package/dist/trajectory/parse/pymatgen.js +74 -0
- package/dist/trajectory/parse/vasp.js +38 -18
- package/dist/trajectory/parse/xyz.d.ts +13 -1
- package/dist/trajectory/parse/xyz.js +102 -94
- package/dist/trajectory/plotting.d.ts +1 -2
- package/dist/trajectory/plotting.js +16 -113
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +7 -5
- package/dist/xrd/XrdPlot.svelte +16 -30
- package/dist/xrd/broadening.d.ts +2 -1
- package/dist/xrd/calc-xrd.js +18 -20
- package/dist/xrd/index.d.ts +2 -2
- package/dist/xrd/parse.js +2 -2
- package/package.json +43 -26
- package/dist/element/data.json +0 -11864
- package/dist/fermi-surface/marching-cubes.d.ts +0 -2
- package/dist/fermi-surface/marching-cubes.js +0 -2
- package/dist/plot/PlotControls.svelte.d.ts +0 -4
- package/dist/plot/axis-utils.d.ts +0 -19
- package/dist/plot/axis-utils.js +0 -78
- package/dist/plot/defaults.d.ts +0 -19
- package/dist/plot/defaults.js +0 -9
- package/dist/plot/fill-utils.d.ts +0 -46
- package/dist/plot/fill-utils.js +0 -322
- package/dist/plot/hover-lock.svelte.d.ts +0 -14
- package/dist/plot/hover-lock.svelte.js +0 -46
- package/dist/plot/interactions.d.ts +0 -12
- package/dist/plot/interactions.js +0 -101
- package/dist/plot/scales.d.ts +0 -48
- package/dist/plot/svg.d.ts +0 -1
- package/dist/plot/svg.js +0 -11
- package/dist/plot/utils/series-visibility.d.ts +0 -15
- package/dist/plot/utils.d.ts +0 -1
- package/dist/plot/utils.js +0 -14
- /package/dist/plot/{PortalSelect.svelte.d.ts → core/components/PortalSelect.svelte.d.ts} +0 -0
- /package/dist/plot/{binned-scatter-types.js → scatter/binned-scatter-types.js} +0 -0
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { PlotControlsProps } from './index';
|
|
2
|
-
declare const PlotControls: import("svelte").Component<PlotControlsProps, {}, "display" | "show_controls" | "x_axis" | "y_axis" | "controls_open" | "x2_axis" | "y2_axis">;
|
|
3
|
-
type PlotControls = ReturnType<typeof PlotControls>;
|
|
4
|
-
export default PlotControls;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { AxisConfig, AxisLoadError, BarSeries, DataLoaderFn, DataSeries } from './types';
|
|
2
|
-
type AxisType = `x` | `x2` | `y` | `y2`;
|
|
3
|
-
export declare function merge_series_state<T extends DataSeries | BarSeries>(old_series: T[], new_series: T[]): T[];
|
|
4
|
-
export interface AxisChangeState<T extends DataSeries | BarSeries> {
|
|
5
|
-
get_axis: (axis: AxisType) => AxisConfig;
|
|
6
|
-
set_axis: (axis: AxisType, config: AxisConfig) => void;
|
|
7
|
-
get_series: () => T[];
|
|
8
|
-
set_series: (series: T[]) => void;
|
|
9
|
-
get_loading: () => AxisType | null;
|
|
10
|
-
set_loading: (axis: AxisType | null) => void;
|
|
11
|
-
}
|
|
12
|
-
export declare function create_axis_change_handler<T extends DataSeries | BarSeries>(state: AxisChangeState<T>, data_loader: DataLoaderFn<Record<string, unknown>, T> | undefined, on_axis_change?: (axis: AxisType, key: string, new_series: T[]) => void, on_error?: (error: AxisLoadError) => void): (axis: AxisType, key: string) => Promise<void>;
|
|
13
|
-
export declare const AXIS_LABEL_CONTAINER: {
|
|
14
|
-
readonly width: 200;
|
|
15
|
-
readonly height: 24;
|
|
16
|
-
readonly x_offset: 100;
|
|
17
|
-
readonly y_offset: 12;
|
|
18
|
-
};
|
|
19
|
-
export {};
|
package/dist/plot/axis-utils.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
// Shared utilities for interactive axis functionality
|
|
2
|
-
// Merge new series with preserved UI state from old series.
|
|
3
|
-
// Matches by stable id first, then by index only for ordered id-less series.
|
|
4
|
-
export function merge_series_state(old_series, new_series) {
|
|
5
|
-
// Build id lookup map for O(1) matching (string or number ids)
|
|
6
|
-
const by_id = new Map();
|
|
7
|
-
for (const srs of old_series) {
|
|
8
|
-
if (srs.id !== undefined && srs.id !== ``)
|
|
9
|
-
by_id.set(srs.id, srs);
|
|
10
|
-
}
|
|
11
|
-
return new_series.map((new_srs, idx) => {
|
|
12
|
-
const old_srs = new_srs.id !== undefined && new_srs.id !== `` ? by_id.get(new_srs.id) : old_series[idx];
|
|
13
|
-
if (!old_srs) {
|
|
14
|
-
return new_srs;
|
|
15
|
-
}
|
|
16
|
-
// Preserve UI state: visibility and styling from old series if not in new
|
|
17
|
-
const result = { ...new_srs };
|
|
18
|
-
result.visible ??= old_srs.visible;
|
|
19
|
-
// Preserve style properties only when key exists in BOTH series (guards against
|
|
20
|
-
// cross-type injection when T is a union like DataSeries | BarSeries)
|
|
21
|
-
for (const key of [`point_style`, `line_style`, `color`]) {
|
|
22
|
-
if (key in old_srs && key in new_srs && result[key] === undefined) {
|
|
23
|
-
result[key] = old_srs[key];
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return result;
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
// Handle axis property change - loads new data via data_loader
|
|
30
|
-
// Returns a function bound to the component's state accessors
|
|
31
|
-
export function create_axis_change_handler(state, data_loader, on_axis_change, on_error) {
|
|
32
|
-
return async (axis, key) => {
|
|
33
|
-
if (!data_loader || state.get_loading())
|
|
34
|
-
return;
|
|
35
|
-
const axis_config = state.get_axis(axis);
|
|
36
|
-
const prev_key = axis_config.selected_key;
|
|
37
|
-
// Skip if key unchanged AND series already loaded (allows initial load when series empty)
|
|
38
|
-
if (prev_key === key && state.get_series().length > 0)
|
|
39
|
-
return;
|
|
40
|
-
// Update selected_key immediately for UI feedback
|
|
41
|
-
state.set_axis(axis, { ...axis_config, selected_key: key });
|
|
42
|
-
state.set_loading(axis);
|
|
43
|
-
try {
|
|
44
|
-
const result = await data_loader(axis, key, state.get_series());
|
|
45
|
-
// Merge new series with preserved state from old series
|
|
46
|
-
const merged = merge_series_state(state.get_series(), result.series);
|
|
47
|
-
state.set_series(merged);
|
|
48
|
-
// Update axis label/unit if provided
|
|
49
|
-
if (result.axis_label || result.axis_unit) {
|
|
50
|
-
const current = state.get_axis(axis);
|
|
51
|
-
state.set_axis(axis, {
|
|
52
|
-
...current,
|
|
53
|
-
label: result.axis_label ?? current.label,
|
|
54
|
-
unit: result.axis_unit ?? current.unit,
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
on_axis_change?.(axis, key, merged);
|
|
58
|
-
}
|
|
59
|
-
catch (err) {
|
|
60
|
-
console.error(`Failed to load data for ${axis}=${key}:`, err);
|
|
61
|
-
// Revert selection
|
|
62
|
-
state.set_axis(axis, { ...state.get_axis(axis), selected_key: prev_key });
|
|
63
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
64
|
-
on_error?.({ axis, key, message });
|
|
65
|
-
}
|
|
66
|
-
finally {
|
|
67
|
-
state.set_loading(null);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
// Constants for axis label foreignObject positioning (all values in px)
|
|
72
|
-
// Use minimal dimensions - overflow: visible handles any dropdown expansion
|
|
73
|
-
export const AXIS_LABEL_CONTAINER = {
|
|
74
|
-
width: 200, // container width for centering; dropdown can overflow
|
|
75
|
-
height: 24, // single line height; dropdown options overflow downward
|
|
76
|
-
x_offset: 100, // half of width for horizontal centering
|
|
77
|
-
y_offset: 12, // half of height for vertical centering
|
|
78
|
-
};
|
package/dist/plot/defaults.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export declare const AXIS_DEFAULTS: {
|
|
2
|
-
format: string;
|
|
3
|
-
scale_type: "linear";
|
|
4
|
-
ticks: number;
|
|
5
|
-
label_shift: {
|
|
6
|
-
x: number;
|
|
7
|
-
y: number;
|
|
8
|
-
};
|
|
9
|
-
tick: {
|
|
10
|
-
label: {
|
|
11
|
-
shift: {
|
|
12
|
-
x: number;
|
|
13
|
-
y: number;
|
|
14
|
-
};
|
|
15
|
-
inside: boolean;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
range: [number | null, number | null];
|
|
19
|
-
};
|
package/dist/plot/defaults.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// Shared axis defaults across plot components (single source of truth)
|
|
2
|
-
export const AXIS_DEFAULTS = {
|
|
3
|
-
format: ``,
|
|
4
|
-
scale_type: `linear`,
|
|
5
|
-
ticks: 5,
|
|
6
|
-
label_shift: { x: 0, y: 0 },
|
|
7
|
-
tick: { label: { shift: { x: 0, y: 0 }, inside: false } },
|
|
8
|
-
range: [null, null],
|
|
9
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { DataSeries, ErrorBand, FillBoundary, FillCurveType, FillGradient, FillRegion, ScaleType } from './types';
|
|
2
|
-
export declare const LOG_EPSILON = 1e-10;
|
|
3
|
-
export interface FillPathPoint {
|
|
4
|
-
x: number;
|
|
5
|
-
y1: number;
|
|
6
|
-
y2: number;
|
|
7
|
-
}
|
|
8
|
-
type FillPathArrays = Record<keyof FillPathPoint, number[]>;
|
|
9
|
-
export interface InterpolatedSeries {
|
|
10
|
-
x: number[];
|
|
11
|
-
y_a: number[];
|
|
12
|
-
y_b: number[];
|
|
13
|
-
}
|
|
14
|
-
export interface FilteredFillData extends FillPathArrays {
|
|
15
|
-
original_indices: number[];
|
|
16
|
-
}
|
|
17
|
-
export interface ConditionedFillData {
|
|
18
|
-
segments: FillPathPoint[][];
|
|
19
|
-
}
|
|
20
|
-
export interface ClampedFillData extends FillPathArrays {
|
|
21
|
-
clamped_indices: number[];
|
|
22
|
-
}
|
|
23
|
-
export declare function resolve_series_ref(ref: {
|
|
24
|
-
type: `series`;
|
|
25
|
-
series_idx?: number;
|
|
26
|
-
series_id?: string | number;
|
|
27
|
-
}, series: readonly DataSeries[]): DataSeries | null;
|
|
28
|
-
export declare function interpolate_series(series_a: {
|
|
29
|
-
x: readonly number[];
|
|
30
|
-
y: readonly number[];
|
|
31
|
-
}, series_b: {
|
|
32
|
-
x: readonly number[];
|
|
33
|
-
y: readonly number[];
|
|
34
|
-
}, method?: `linear` | `step`): InterpolatedSeries;
|
|
35
|
-
interface DomainContext {
|
|
36
|
-
y_domain: [number, number];
|
|
37
|
-
y2_domain?: [number, number];
|
|
38
|
-
}
|
|
39
|
-
export declare function resolve_boundary(boundary: FillBoundary, series: readonly DataSeries[], x_values: readonly number[], domains: DomainContext): number[] | null;
|
|
40
|
-
export declare function apply_range_constraints(x_values: readonly number[], y1_values: readonly number[], y2_values: readonly number[], region: Pick<FillRegion, `x_range` | `y_range`>): FilteredFillData;
|
|
41
|
-
export declare function apply_where_condition(x_values: readonly number[], y1_values: readonly number[], y2_values: readonly number[], region: Pick<FillRegion, `where`>): ConditionedFillData;
|
|
42
|
-
export declare function clamp_for_log_scale(x_values: readonly number[], y1_values: readonly number[], y2_values: readonly number[], y_scale_type: ScaleType, x_scale_type?: ScaleType): ClampedFillData;
|
|
43
|
-
export declare function generate_fill_path(data: readonly FillPathPoint[], curve_type?: FillCurveType): string;
|
|
44
|
-
export declare function convert_error_band_to_fill_region(error_band: ErrorBand, series: readonly DataSeries[], default_color?: string): FillRegion | null;
|
|
45
|
-
export declare const is_fill_gradient: (fill: string | FillGradient | undefined) => fill is FillGradient;
|
|
46
|
-
export {};
|
package/dist/plot/fill-utils.js
DELETED
|
@@ -1,322 +0,0 @@
|
|
|
1
|
-
// Fill-between utility functions for ScatterPlot fill regions
|
|
2
|
-
// Handles interpolation, boundary resolution, and path generation
|
|
3
|
-
import { area, curveBasis, curveCardinal, curveCatmullRom, curveLinear, curveMonotoneX, curveMonotoneY, curveNatural, curveStep, curveStepAfter, curveStepBefore, } from 'd3-shape';
|
|
4
|
-
// Epsilon value for log scale clamping (to avoid log(0) = -Infinity)
|
|
5
|
-
export const LOG_EPSILON = 1e-10;
|
|
6
|
-
// Resolves a series reference (by index or id) to the actual DataSeries
|
|
7
|
-
// Returns null if the reference cannot be resolved
|
|
8
|
-
export function resolve_series_ref(ref, series) {
|
|
9
|
-
if (`series_idx` in ref && typeof ref.series_idx === `number`) {
|
|
10
|
-
const idx = ref.series_idx;
|
|
11
|
-
if (idx >= 0 && idx < series.length) {
|
|
12
|
-
return series[idx];
|
|
13
|
-
}
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
if (`series_id` in ref && ref.series_id !== undefined) {
|
|
17
|
-
const found = series.find((data_series) => data_series.id === ref.series_id);
|
|
18
|
-
return found ?? null;
|
|
19
|
-
}
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
// Helper: linear interpolation at a specific x value
|
|
23
|
-
function interpolate_at(x_values, y_values, target_x) {
|
|
24
|
-
// Find bracketing indices
|
|
25
|
-
let [left_idx, right_idx] = [-1, -1];
|
|
26
|
-
for (let idx = 0; idx < x_values.length; idx++) {
|
|
27
|
-
if (x_values[idx] <= target_x)
|
|
28
|
-
left_idx = idx;
|
|
29
|
-
if (x_values[idx] >= target_x && right_idx === -1)
|
|
30
|
-
right_idx = idx;
|
|
31
|
-
}
|
|
32
|
-
// Handle edge cases: exact match, before all, after all
|
|
33
|
-
if (left_idx >= 0 && x_values[left_idx] === target_x)
|
|
34
|
-
return y_values[left_idx];
|
|
35
|
-
if (left_idx === -1)
|
|
36
|
-
return y_values[0];
|
|
37
|
-
if (right_idx === -1)
|
|
38
|
-
return y_values[y_values.length - 1];
|
|
39
|
-
// Linear interpolation
|
|
40
|
-
const x_left = x_values[left_idx];
|
|
41
|
-
const x_right = x_values[right_idx];
|
|
42
|
-
const y_left = y_values[left_idx];
|
|
43
|
-
const y_right = y_values[right_idx];
|
|
44
|
-
return x_right === x_left
|
|
45
|
-
? y_left
|
|
46
|
-
: y_left + ((target_x - x_left) / (x_right - x_left)) * (y_right - y_left);
|
|
47
|
-
}
|
|
48
|
-
// Helper: step interpolation at a specific x value
|
|
49
|
-
function step_interpolate_at(x_values, y_values, target_x) {
|
|
50
|
-
// Find the last x value <= target_x
|
|
51
|
-
let last_idx = -1;
|
|
52
|
-
for (let idx = 0; idx < x_values.length; idx++) {
|
|
53
|
-
if (x_values[idx] <= target_x)
|
|
54
|
-
last_idx = idx;
|
|
55
|
-
else
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
// Before all x values, use first y value
|
|
59
|
-
if (last_idx === -1)
|
|
60
|
-
return y_values[0];
|
|
61
|
-
return y_values[last_idx];
|
|
62
|
-
}
|
|
63
|
-
// Interpolates two series to have matching x-values
|
|
64
|
-
// Returns arrays with the union of all x-values, sorted
|
|
65
|
-
export function interpolate_series(series_a, series_b, method = `linear`) {
|
|
66
|
-
// Create union of x-values
|
|
67
|
-
const x_set = new Set();
|
|
68
|
-
for (const curr_x of series_a.x)
|
|
69
|
-
x_set.add(curr_x);
|
|
70
|
-
for (const curr_x of series_b.x)
|
|
71
|
-
x_set.add(curr_x);
|
|
72
|
-
// Sort x-values
|
|
73
|
-
const all_x = Array.from(x_set).sort((val_a, val_b) => val_a - val_b);
|
|
74
|
-
const interpolate_fn = method === `step` ? step_interpolate_at : interpolate_at;
|
|
75
|
-
// Interpolate y values for each x
|
|
76
|
-
const y_a = all_x.map((target_x) => interpolate_fn(series_a.x, series_a.y, target_x));
|
|
77
|
-
const y_b = all_x.map((target_x) => interpolate_fn(series_b.x, series_b.y, target_x));
|
|
78
|
-
return { x: all_x, y_a, y_b };
|
|
79
|
-
}
|
|
80
|
-
// Resolves a FillBoundary definition to an array of y-values at given x positions
|
|
81
|
-
// Returns null if the boundary cannot be resolved
|
|
82
|
-
export function resolve_boundary(boundary, series, x_values, domains) {
|
|
83
|
-
// Handle shorthand number (constant value)
|
|
84
|
-
if (typeof boundary === `number`) {
|
|
85
|
-
return x_values.map(() => boundary);
|
|
86
|
-
}
|
|
87
|
-
if (boundary.type === `series`) {
|
|
88
|
-
const resolved = resolve_series_ref(boundary, series);
|
|
89
|
-
if (!resolved)
|
|
90
|
-
return null;
|
|
91
|
-
// Interpolate to match x_values
|
|
92
|
-
const interpolated = interpolate_series({ x: x_values, y: x_values.map(() => 0) }, { x: resolved.x, y: resolved.y }, `linear`);
|
|
93
|
-
return interpolated.y_b;
|
|
94
|
-
}
|
|
95
|
-
if (boundary.type === `constant`)
|
|
96
|
-
return x_values.map(() => boundary.value);
|
|
97
|
-
if (boundary.type === `axis`) {
|
|
98
|
-
// For axis boundaries, return the edge value of the appropriate axis domain
|
|
99
|
-
const value = boundary.value ??
|
|
100
|
-
(boundary.axis === `y2` ? domains.y2_domain?.[0] : undefined) ??
|
|
101
|
-
domains.y_domain[0];
|
|
102
|
-
return x_values.map(() => value);
|
|
103
|
-
}
|
|
104
|
-
if (boundary.type === `function`)
|
|
105
|
-
return x_values.map((curr_x) => boundary.fn(curr_x));
|
|
106
|
-
if (boundary.type === `data`) {
|
|
107
|
-
if (boundary.values.length === 0)
|
|
108
|
-
return Array(x_values.length).fill(NaN);
|
|
109
|
-
// If lengths match, use directly; otherwise interpolate
|
|
110
|
-
if (boundary.values.length === x_values.length)
|
|
111
|
-
return [...boundary.values];
|
|
112
|
-
// Lengths don't match: truncate if values is longer, or extend last value if shorter
|
|
113
|
-
return x_values.map((_, idx) => boundary.values[idx] ?? boundary.values[boundary.values.length - 1]);
|
|
114
|
-
}
|
|
115
|
-
return null;
|
|
116
|
-
}
|
|
117
|
-
export function apply_range_constraints(x_values, y1_values, y2_values, region) {
|
|
118
|
-
const [x_min, x_max] = region.x_range ?? [null, null];
|
|
119
|
-
const [y_min, y_max] = region.y_range ?? [null, null];
|
|
120
|
-
// Helper to clamp value within optional bounds
|
|
121
|
-
const clamp = (val) => Math.min(y_max ?? Infinity, Math.max(y_min ?? -Infinity, val));
|
|
122
|
-
const result = {
|
|
123
|
-
x: [],
|
|
124
|
-
y1: [],
|
|
125
|
-
y2: [],
|
|
126
|
-
original_indices: [],
|
|
127
|
-
};
|
|
128
|
-
for (let idx = 0; idx < x_values.length; idx++) {
|
|
129
|
-
const [curr_x, curr_y1, curr_y2] = [x_values[idx], y1_values[idx], y2_values[idx]];
|
|
130
|
-
// Skip if outside x range
|
|
131
|
-
if ((x_min !== null && curr_x < x_min) || (x_max !== null && curr_x > x_max))
|
|
132
|
-
continue;
|
|
133
|
-
// Skip if fill region doesn't overlap y range
|
|
134
|
-
const [fill_min, fill_max] = [Math.min(curr_y1, curr_y2), Math.max(curr_y1, curr_y2)];
|
|
135
|
-
if ((y_min !== null && fill_max < y_min) || (y_max !== null && fill_min > y_max)) {
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
result.x.push(curr_x);
|
|
139
|
-
result.y1.push(clamp(curr_y1));
|
|
140
|
-
result.y2.push(clamp(curr_y2));
|
|
141
|
-
result.original_indices.push(idx);
|
|
142
|
-
}
|
|
143
|
-
return result;
|
|
144
|
-
}
|
|
145
|
-
// Helper: find x-coordinate where condition changes (linear interpolation)
|
|
146
|
-
function find_crossing(x1, y1_upper, y1_lower, x2, y2_upper, y2_lower, condition) {
|
|
147
|
-
const cond1 = condition(x1, y1_upper, y1_lower);
|
|
148
|
-
const cond2 = condition(x2, y2_upper, y2_lower);
|
|
149
|
-
if (cond1 === cond2)
|
|
150
|
-
return null;
|
|
151
|
-
// Binary search for crossing point
|
|
152
|
-
let left = x1;
|
|
153
|
-
let right = x2;
|
|
154
|
-
const tolerance = (x2 - x1) * 0.001;
|
|
155
|
-
for (let iter = 0; iter < 20; iter++) {
|
|
156
|
-
const mid = (left + right) / 2;
|
|
157
|
-
const weight = (mid - x1) / (x2 - x1);
|
|
158
|
-
const mid_upper = y1_upper + weight * (y2_upper - y1_upper);
|
|
159
|
-
const mid_lower = y1_lower + weight * (y2_lower - y1_lower);
|
|
160
|
-
const mid_cond = condition(mid, mid_upper, mid_lower);
|
|
161
|
-
if (mid_cond === cond1) {
|
|
162
|
-
left = mid;
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
right = mid;
|
|
166
|
-
}
|
|
167
|
-
if (right - left < tolerance)
|
|
168
|
-
break;
|
|
169
|
-
}
|
|
170
|
-
return (left + right) / 2;
|
|
171
|
-
}
|
|
172
|
-
export function apply_where_condition(x_values, y1_values, y2_values, region) {
|
|
173
|
-
if (!region.where) {
|
|
174
|
-
// No condition - return single segment with all points
|
|
175
|
-
const points = x_values.map((curr_x, idx) => ({
|
|
176
|
-
x: curr_x,
|
|
177
|
-
y1: y1_values[idx],
|
|
178
|
-
y2: y2_values[idx],
|
|
179
|
-
}));
|
|
180
|
-
return { segments: [points] };
|
|
181
|
-
}
|
|
182
|
-
const segments = [];
|
|
183
|
-
let current_segment = [];
|
|
184
|
-
for (let idx = 0; idx < x_values.length; idx++) {
|
|
185
|
-
const curr_x = x_values[idx];
|
|
186
|
-
const curr_y1 = y1_values[idx];
|
|
187
|
-
const curr_y2 = y2_values[idx];
|
|
188
|
-
const passes = region.where(curr_x, curr_y1, curr_y2);
|
|
189
|
-
if (idx > 0) {
|
|
190
|
-
const prev_x = x_values[idx - 1];
|
|
191
|
-
const prev_y1 = y1_values[idx - 1];
|
|
192
|
-
const prev_y2 = y2_values[idx - 1];
|
|
193
|
-
const prev_passes = region.where(prev_x, prev_y1, prev_y2);
|
|
194
|
-
// Check for condition crossing between prev and current
|
|
195
|
-
if (passes !== prev_passes) {
|
|
196
|
-
const crossing_x = find_crossing(prev_x, prev_y1, prev_y2, curr_x, curr_y1, curr_y2, region.where);
|
|
197
|
-
if (crossing_x !== null) {
|
|
198
|
-
// Interpolate y values at crossing point
|
|
199
|
-
const weight = (crossing_x - prev_x) / (curr_x - prev_x);
|
|
200
|
-
const crossing_y1 = prev_y1 + weight * (curr_y1 - prev_y1);
|
|
201
|
-
const crossing_y2 = prev_y2 + weight * (curr_y2 - prev_y2);
|
|
202
|
-
if (prev_passes) {
|
|
203
|
-
// End current segment at crossing
|
|
204
|
-
current_segment.push({ x: crossing_x, y1: crossing_y1, y2: crossing_y2 });
|
|
205
|
-
segments.push(current_segment);
|
|
206
|
-
current_segment = [];
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
// Start new segment at crossing
|
|
210
|
-
current_segment.push({ x: crossing_x, y1: crossing_y1, y2: crossing_y2 });
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
if (passes) {
|
|
216
|
-
current_segment.push({ x: curr_x, y1: curr_y1, y2: curr_y2 });
|
|
217
|
-
}
|
|
218
|
-
else if (current_segment.length > 0) {
|
|
219
|
-
segments.push(current_segment);
|
|
220
|
-
current_segment = [];
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
// Don't forget the last segment
|
|
224
|
-
if (current_segment.length > 0) {
|
|
225
|
-
segments.push(current_segment);
|
|
226
|
-
}
|
|
227
|
-
return { segments };
|
|
228
|
-
}
|
|
229
|
-
export function clamp_for_log_scale(x_values, y1_values, y2_values, y_scale_type, x_scale_type = `linear`) {
|
|
230
|
-
const result_x = [];
|
|
231
|
-
const result_y1 = [];
|
|
232
|
-
const result_y2 = [];
|
|
233
|
-
const clamped_indices = [];
|
|
234
|
-
for (let idx = 0; idx < x_values.length; idx++) {
|
|
235
|
-
let curr_x = x_values[idx];
|
|
236
|
-
let curr_y1 = y1_values[idx];
|
|
237
|
-
let curr_y2 = y2_values[idx];
|
|
238
|
-
let was_clamped = false;
|
|
239
|
-
// Clamp x if x-axis is log scale
|
|
240
|
-
if (x_scale_type === `log` && curr_x <= 0) {
|
|
241
|
-
curr_x = LOG_EPSILON;
|
|
242
|
-
was_clamped = true;
|
|
243
|
-
}
|
|
244
|
-
// Clamp y values if y-axis is log scale
|
|
245
|
-
if (y_scale_type === `log`) {
|
|
246
|
-
if (curr_y1 <= 0) {
|
|
247
|
-
curr_y1 = LOG_EPSILON;
|
|
248
|
-
was_clamped = true;
|
|
249
|
-
}
|
|
250
|
-
if (curr_y2 <= 0) {
|
|
251
|
-
curr_y2 = LOG_EPSILON;
|
|
252
|
-
was_clamped = true;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
result_x.push(curr_x);
|
|
256
|
-
result_y1.push(curr_y1);
|
|
257
|
-
result_y2.push(curr_y2);
|
|
258
|
-
if (was_clamped) {
|
|
259
|
-
clamped_indices.push(idx);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
return {
|
|
263
|
-
x: result_x,
|
|
264
|
-
y1: result_y1,
|
|
265
|
-
y2: result_y2,
|
|
266
|
-
clamped_indices,
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
// Map FillCurveType to d3 curve factory
|
|
270
|
-
const CURVE_MAP = {
|
|
271
|
-
linear: curveLinear,
|
|
272
|
-
monotoneX: curveMonotoneX,
|
|
273
|
-
monotoneY: curveMonotoneY,
|
|
274
|
-
step: curveStep,
|
|
275
|
-
stepBefore: curveStepBefore,
|
|
276
|
-
stepAfter: curveStepAfter,
|
|
277
|
-
basis: curveBasis,
|
|
278
|
-
cardinal: curveCardinal,
|
|
279
|
-
catmullRom: curveCatmullRom,
|
|
280
|
-
natural: curveNatural,
|
|
281
|
-
};
|
|
282
|
-
const get_curve = (curve_type) => CURVE_MAP[curve_type] ?? curveMonotoneX;
|
|
283
|
-
// Generate SVG path string for a fill region
|
|
284
|
-
// data should already be in pixel coordinates
|
|
285
|
-
export function generate_fill_path(data, curve_type = `monotoneX`) {
|
|
286
|
-
if (data.length === 0)
|
|
287
|
-
return ``;
|
|
288
|
-
const curve = get_curve(curve_type);
|
|
289
|
-
const area_generator = area()
|
|
290
|
-
.x((point) => point.x)
|
|
291
|
-
.y0((point) => point.y1)
|
|
292
|
-
.y1((point) => point.y2)
|
|
293
|
-
.curve(curve);
|
|
294
|
-
return area_generator(data) ?? ``;
|
|
295
|
-
}
|
|
296
|
-
// Helper to expand error definition to array
|
|
297
|
-
const expand_error = (err, length) => typeof err === `number` ? Array(length).fill(err) : err;
|
|
298
|
-
// Convert an ErrorBand convenience type to a full FillRegion
|
|
299
|
-
export function convert_error_band_to_fill_region(error_band, series, default_color) {
|
|
300
|
-
const resolved = resolve_series_ref(error_band.series, series);
|
|
301
|
-
if (!resolved)
|
|
302
|
-
return null;
|
|
303
|
-
const { y } = resolved;
|
|
304
|
-
const { error } = error_band;
|
|
305
|
-
// Determine upper/lower error arrays
|
|
306
|
-
const [upper_err, lower_err] = typeof error === `object` && `upper` in error
|
|
307
|
-
? [expand_error(error.upper, y.length), expand_error(error.lower, y.length)]
|
|
308
|
-
: [expand_error(error, y.length), expand_error(error, y.length)];
|
|
309
|
-
return {
|
|
310
|
-
id: error_band.id,
|
|
311
|
-
label: error_band.label,
|
|
312
|
-
upper: { type: `data`, values: y.map((val, idx) => val + upper_err[idx]) },
|
|
313
|
-
lower: { type: `data`, values: y.map((val, idx) => val - lower_err[idx]) },
|
|
314
|
-
fill: error_band.fill ?? default_color ?? `#4e79a7`,
|
|
315
|
-
fill_opacity: error_band.fill_opacity ?? 0.3,
|
|
316
|
-
edge_upper: error_band.edge_style,
|
|
317
|
-
edge_lower: error_band.edge_style,
|
|
318
|
-
show_in_legend: error_band.show_in_legend ?? true,
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
|
-
// Type guard to check if fill is a gradient
|
|
322
|
-
export const is_fill_gradient = (fill) => typeof fill === `object` && fill !== null && `type` in fill && `stops` in fill;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare const HOVER_DEBOUNCE_MS = 300;
|
|
2
|
-
interface ReactiveBoolean {
|
|
3
|
-
readonly current: boolean;
|
|
4
|
-
}
|
|
5
|
-
export declare function create_hover_lock(): {
|
|
6
|
-
is_locked: ReactiveBoolean;
|
|
7
|
-
set_locked: (locked: boolean) => void;
|
|
8
|
-
cleanup: () => void;
|
|
9
|
-
};
|
|
10
|
-
export declare function create_dimension_tracker(): {
|
|
11
|
-
has_changed: (width: number, height: number) => boolean;
|
|
12
|
-
update: (width: number, height: number) => void;
|
|
13
|
-
};
|
|
14
|
-
export {};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// Shared utility for hover lock behavior on plot elements (legend, colorbar)
|
|
2
|
-
// Prevents element repositioning while user is hovering, with debounced release
|
|
3
|
-
export const HOVER_DEBOUNCE_MS = 300;
|
|
4
|
-
// Creates hover lock state and handlers for a plot element
|
|
5
|
-
export function create_hover_lock() {
|
|
6
|
-
let is_locked = $state(false);
|
|
7
|
-
let timeout = null;
|
|
8
|
-
// Stable object reference with getter - Svelte tracks the getter read
|
|
9
|
-
const locked_ref = {
|
|
10
|
-
get current() {
|
|
11
|
-
return is_locked;
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
return {
|
|
15
|
-
is_locked: locked_ref,
|
|
16
|
-
set_locked(locked) {
|
|
17
|
-
if (locked) {
|
|
18
|
-
if (timeout)
|
|
19
|
-
clearTimeout(timeout);
|
|
20
|
-
is_locked = true;
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
timeout = setTimeout(() => (is_locked = false), HOVER_DEBOUNCE_MS);
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
// Clear pending timeout to prevent state updates after unmount
|
|
27
|
-
cleanup() {
|
|
28
|
-
if (timeout)
|
|
29
|
-
clearTimeout(timeout);
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
// Tracks previous dimensions for resize detection
|
|
34
|
-
export function create_dimension_tracker() {
|
|
35
|
-
let prev = $state(null);
|
|
36
|
-
return {
|
|
37
|
-
has_changed(width, height) {
|
|
38
|
-
if (!prev)
|
|
39
|
-
return true;
|
|
40
|
-
return prev.width !== width || prev.height !== height;
|
|
41
|
-
},
|
|
42
|
-
update(width, height) {
|
|
43
|
-
prev = { width, height };
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Point2D, Vec2 } from '../math';
|
|
2
|
-
import type { Y2SyncConfig, Y2SyncMode } from './types';
|
|
3
|
-
export declare function get_relative_coords(evt: MouseEvent): Point2D | null;
|
|
4
|
-
export declare function normalize_y2_sync(sync: Y2SyncConfig | Y2SyncMode | undefined): Y2SyncConfig;
|
|
5
|
-
export declare function sync_y2_range(y1_range: Vec2, y2_base_range: Vec2, sync: Y2SyncConfig): Vec2;
|
|
6
|
-
export declare const pan_range: (current: Vec2, delta: number) => Vec2;
|
|
7
|
-
export declare function pixels_to_data_delta(pixel_delta: number, data_range: Vec2, pixel_range: number): number;
|
|
8
|
-
export declare const PINCH_ZOOM_THRESHOLD = 0.1;
|
|
9
|
-
export declare function expand_range_if_needed(current: Vec2, new_range: Vec2): {
|
|
10
|
-
range: Vec2;
|
|
11
|
-
changed: boolean;
|
|
12
|
-
};
|