matterviz 0.3.7 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +8 -3
- package/dist/brillouin/BrillouinZone.svelte.d.ts +2 -1
- package/dist/brillouin/BrillouinZoneScene.svelte +52 -6
- package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +1 -0
- package/dist/brillouin/BrillouinZoneTooltip.svelte +16 -25
- package/dist/brillouin/compute.js +10 -14
- package/dist/chempot-diagram/ChemPotDiagram.svelte +14 -13
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +12 -15
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +8 -10
- package/dist/chempot-diagram/async-compute.svelte.js +3 -1
- package/dist/chempot-diagram/chempot-worker.js +2 -1
- package/dist/chempot-diagram/compute.d.ts +1 -1
- package/dist/chempot-diagram/compute.js +17 -19
- package/dist/colors/index.js +6 -5
- package/dist/composition/FormulaFilter.svelte +12 -6
- package/dist/composition/PieChart.svelte +6 -5
- package/dist/composition/chem-sys.d.ts +8 -0
- package/dist/composition/chem-sys.js +85 -0
- package/dist/composition/format.js +4 -2
- package/dist/composition/index.d.ts +1 -0
- package/dist/composition/index.js +1 -0
- package/dist/composition/parse.js +25 -13
- package/dist/convex-hull/ConvexHull2D.svelte +12 -10
- package/dist/convex-hull/ConvexHull3D.svelte +5 -5
- package/dist/convex-hull/ConvexHull4D.svelte +5 -9
- package/dist/convex-hull/ConvexHullStats.svelte +12 -12
- package/dist/convex-hull/GasPressureControls.svelte +4 -4
- package/dist/convex-hull/TemperatureSlider.svelte +2 -2
- 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 +3 -0
- package/dist/convex-hull/helpers.js +17 -9
- package/dist/convex-hull/index.d.ts +1 -1
- package/dist/convex-hull/thermodynamics.js +83 -78
- package/dist/convex-hull/types.d.ts +1 -1
- package/dist/coordination/CoordinationBarPlot.svelte +23 -23
- package/dist/coordination/CoordinationBarPlot.svelte.d.ts +1 -1
- package/dist/element/ElementTile.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSlice.svelte +13 -5
- package/dist/fermi-surface/FermiSurface.svelte +11 -5
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceControls.svelte +1 -1
- package/dist/fermi-surface/FermiSurfaceScene.svelte +3 -0
- package/dist/fermi-surface/FermiSurfaceTooltip.svelte +8 -34
- package/dist/fermi-surface/compute.js +59 -59
- package/dist/fermi-surface/export.js +3 -2
- package/dist/fermi-surface/parse.js +7 -4
- package/dist/fermi-surface/types.d.ts +1 -0
- package/dist/heatmap-matrix/HeatmapMatrix.svelte +23 -21
- package/dist/heatmap-matrix/index.js +1 -1
- package/dist/io/decompress.js +4 -2
- package/dist/io/export.d.ts +4 -4
- package/dist/io/export.js +47 -25
- package/dist/io/fetch.js +5 -1
- package/dist/io/file-drop.d.ts +1 -1
- package/dist/io/file-drop.js +35 -36
- package/dist/io/url-drop.js +64 -33
- package/dist/isosurface/parse.js +6 -7
- 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 +8 -7
- package/dist/layout/PropertyFilter.svelte +3 -2
- package/dist/layout/SettingsSection.svelte +1 -1
- 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 +5 -1
- package/dist/math.js +24 -9
- package/dist/overlays/DraggablePane.svelte +4 -4
- package/dist/periodic-table/PeriodicTable.svelte +20 -9
- 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.d.ts +1 -1
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +2 -1
- package/dist/phase-diagram/PhaseDiagramTooltip.svelte +1 -1
- package/dist/phase-diagram/build-diagram.js +2 -2
- 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} +229 -587
- package/dist/plot/{BarPlot.svelte.d.ts → bar/BarPlot.svelte.d.ts} +5 -5
- 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} +6 -6
- 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 +1462 -0
- package/dist/plot/box/BoxPlot.svelte.d.ts +94 -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 +55 -0
- package/dist/plot/box/box-plot.js +126 -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 +16 -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.js → core/auto-place.js} +2 -2
- 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} +36 -33
- package/dist/plot/{ColorBar.svelte.d.ts → core/components/ColorBar.svelte.d.ts} +2 -2
- 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} +30 -13
- package/dist/plot/{PlotAxis.svelte → core/components/PlotAxis.svelte} +7 -5
- package/dist/plot/{PlotAxis.svelte.d.ts → core/components/PlotAxis.svelte.d.ts} +3 -2
- 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} +4 -4
- package/dist/plot/{ReferenceLine3D.svelte.d.ts → core/components/ReferenceLine3D.svelte.d.ts} +2 -2
- package/dist/plot/{ReferencePlane.svelte → core/components/ReferencePlane.svelte} +7 -7
- package/dist/plot/{ReferencePlane.svelte.d.ts → core/components/ReferencePlane.svelte.d.ts} +2 -2
- 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} +3 -5
- 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 +33 -0
- package/dist/plot/core/fill-utils.js +388 -0
- package/dist/plot/{hover-lock.svelte.js → core/hover-lock.svelte.js} +5 -6
- package/dist/plot/core/index.d.ts +10 -0
- package/dist/plot/core/index.js +11 -0
- package/dist/plot/core/interactions.d.ts +35 -0
- package/dist/plot/core/interactions.js +195 -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/{reference-line.d.ts → core/reference-line.d.ts} +1 -1
- package/dist/plot/{reference-line.js → core/reference-line.js} +23 -36
- package/dist/plot/{scales.d.ts → core/scales.d.ts} +2 -2
- package/dist/plot/{scales.js → core/scales.js} +84 -85
- package/dist/plot/core/svg.d.ts +2 -0
- package/dist/plot/core/svg.js +41 -0
- package/dist/plot/{types.d.ts → core/types.d.ts} +19 -79
- package/dist/plot/{types.js → core/types.js} +1 -1
- package/dist/plot/{utils → core/utils}/label-placement.d.ts +2 -2
- 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 +11 -0
- package/dist/plot/core/utils.js +27 -0
- package/dist/plot/{Histogram.svelte → histogram/Histogram.svelte} +154 -294
- 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 +700 -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 +187 -0
- package/dist/plot/{BinnedScatterPlot.svelte → scatter/BinnedScatterPlot.svelte} +61 -59
- package/dist/plot/{BinnedScatterPlot.svelte.d.ts → scatter/BinnedScatterPlot.svelte.d.ts} +4 -4
- 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} +221 -642
- package/dist/plot/{ScatterPlot.svelte.d.ts → scatter/ScatterPlot.svelte.d.ts} +7 -7
- package/dist/plot/{ScatterPlotControls.svelte → scatter/ScatterPlotControls.svelte} +6 -5
- package/dist/plot/{ScatterPlotControls.svelte.d.ts → scatter/ScatterPlotControls.svelte.d.ts} +1 -1
- 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} +3 -3
- 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} +12 -10
- package/dist/plot/{ScatterPlot3D.svelte.d.ts → scatter-3d/ScatterPlot3D.svelte.d.ts} +7 -7
- package/dist/plot/{ScatterPlot3DControls.svelte → scatter-3d/ScatterPlot3DControls.svelte} +5 -4
- package/dist/plot/{ScatterPlot3DControls.svelte.d.ts → scatter-3d/ScatterPlot3DControls.svelte.d.ts} +2 -2
- package/dist/plot/{ScatterPlot3DScene.svelte → scatter-3d/ScatterPlot3DScene.svelte} +11 -11
- package/dist/plot/{ScatterPlot3DScene.svelte.d.ts → scatter-3d/ScatterPlot3DScene.svelte.d.ts} +3 -3
- package/dist/plot/{Surface3D.svelte → scatter-3d/Surface3D.svelte} +1 -1
- package/dist/plot/{Surface3D.svelte.d.ts → scatter-3d/Surface3D.svelte.d.ts} +1 -1
- 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 +1045 -0
- package/dist/plot/sunburst/Sunburst.svelte.d.ts +96 -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 +266 -0
- package/dist/rdf/RdfPlot.svelte +2 -1
- package/dist/rdf/calc-rdf.js +11 -24
- package/dist/sanitize.js +1 -1
- package/dist/settings.d.ts +65 -1
- package/dist/settings.js +262 -0
- package/dist/spectral/Bands.svelte +39 -29
- package/dist/spectral/Bands.svelte.d.ts +3 -4
- package/dist/spectral/BandsAndDos.svelte +1 -1
- package/dist/spectral/BrillouinBandsDos.svelte +39 -27
- package/dist/spectral/Dos.svelte +10 -19
- package/dist/spectral/Dos.svelte.d.ts +2 -2
- package/dist/spectral/helpers.d.ts +3 -1
- package/dist/spectral/helpers.js +95 -29
- package/dist/structure/AtomLegend.svelte +8 -9
- package/dist/structure/CellSelect.svelte +1 -2
- package/dist/structure/Cylinder.svelte +12 -8
- package/dist/structure/Cylinder.svelte.d.ts +4 -1
- package/dist/structure/Structure.svelte +78 -72
- package/dist/structure/Structure.svelte.d.ts +1 -1
- package/dist/structure/StructureInfoPane.svelte +5 -6
- package/dist/structure/StructureScene.svelte +11 -10
- package/dist/structure/atom-properties.js +6 -6
- package/dist/structure/bond-order-perception.js +1 -1
- package/dist/structure/bonding.d.ts +1 -0
- package/dist/structure/bonding.js +43 -15
- package/dist/structure/export.js +27 -23
- package/dist/structure/index.d.ts +2 -4
- package/dist/structure/index.js +1 -3
- package/dist/structure/label-placement.js +4 -4
- package/dist/structure/measure.d.ts +3 -2
- package/dist/structure/measure.js +6 -5
- package/dist/structure/parse.js +121 -103
- package/dist/structure/pbc.js +4 -0
- package/dist/symmetry/SymmetryStats.svelte +2 -2
- package/dist/symmetry/index.d.ts +1 -1
- package/dist/symmetry/index.js +22 -24
- package/dist/symmetry/spacegroups.d.ts +7 -0
- package/dist/symmetry/spacegroups.js +48 -13
- package/dist/table/HeatmapTable.svelte +63 -11
- 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 +66 -40
- package/dist/trajectory/Trajectory.svelte.d.ts +2 -1
- package/dist/trajectory/TrajectoryExportPane.svelte +2 -1
- package/dist/trajectory/TrajectoryInfoPane.svelte +2 -1
- package/dist/trajectory/format-detect.d.ts +1 -0
- package/dist/trajectory/format-detect.js +25 -11
- package/dist/trajectory/frame-reader.js +17 -50
- package/dist/trajectory/helpers.js +1 -1
- package/dist/trajectory/index.js +1 -1
- package/dist/trajectory/parse/hdf5.js +1 -1
- package/dist/trajectory/parse/index.js +14 -6
- package/dist/trajectory/parse/vasp.js +36 -17
- package/dist/trajectory/parse/xyz.d.ts +24 -0
- package/dist/trajectory/parse/xyz.js +102 -89
- package/dist/trajectory/plotting.d.ts +1 -1
- package/dist/trajectory/plotting.js +15 -15
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +6 -4
- package/dist/xrd/XrdPlot.svelte +2 -1
- package/dist/xrd/calc-xrd.js +15 -12
- package/dist/xrd/parse.js +2 -2
- package/package.json +22 -18
- 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/interactions.d.ts +0 -12
- package/dist/plot/interactions.js +0 -101
- 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/{auto-place.d.ts → core/auto-place.d.ts} +0 -0
- /package/dist/plot/{Line.svelte.d.ts → core/components/Line.svelte.d.ts} +0 -0
- /package/dist/plot/{PortalSelect.svelte.d.ts → core/components/PortalSelect.svelte.d.ts} +0 -0
- /package/dist/plot/{hover-lock.svelte.d.ts → core/hover-lock.svelte.d.ts} +0 -0
- /package/dist/plot/{utils → core/utils}/label-placement.js +0 -0
- /package/dist/plot/{binned-scatter-types.js → scatter/binned-scatter-types.js} +0 -0
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { Matrix3x3, Vec2, Vec3 } from '../math';
|
|
2
|
-
import type { AxisConfig } from '../plot/types';
|
|
2
|
+
import type { AxisConfig } from '../plot/core/types';
|
|
3
3
|
import type * as types from './types';
|
|
4
4
|
import type { RibbonConfig } from './types';
|
|
5
5
|
export declare const is_valid_range: (range: unknown) => range is Vec2;
|
|
6
6
|
export declare const ranges_equal: (a: Vec2 | undefined | null, b: Vec2 | undefined | null, tol?: number) => boolean;
|
|
7
7
|
export declare const axis_with_range: (axis: AxisConfig | undefined, range: Vec2 | undefined, label?: string) => AxisConfig;
|
|
8
|
+
export declare function sync_axis_range(axis: AxisConfig, range: unknown): AxisConfig;
|
|
8
9
|
export declare function detect_zoom_change(bands_range: unknown, dos_range: unknown, shared_range: Vec2, current_synced: Vec2 | null, dos_enabled?: boolean): Vec2 | null | undefined;
|
|
9
10
|
export declare const IMAGINARY_MODE_NOISE_THRESHOLD = 0.005;
|
|
10
11
|
export declare function pretty_sym_point(symbol: string): string;
|
|
@@ -29,6 +30,7 @@ export declare function extract_k_path_points(band_struct: types.BaseBandStructu
|
|
|
29
30
|
wrap_to_bz?: boolean;
|
|
30
31
|
}): Vec3[];
|
|
31
32
|
export declare function find_qpoint_at_distance(band_struct: types.BaseBandStructure, target: number): number | null;
|
|
33
|
+
export declare function qpoint_x_position(band_struct: types.BaseBandStructure, qpoint_index: number, x_positions: Record<string, [number, number]>): number | null;
|
|
32
34
|
export declare function find_qpoint_at_rescaled_x(band_struct: types.BaseBandStructure, rescaled_x: number, x_positions: Record<string, [number, number]>): number | null;
|
|
33
35
|
type SpinDensities = Record<string, number[]>;
|
|
34
36
|
export interface PymatgenDos {
|
package/dist/spectral/helpers.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Helper utilities for band structure and DOS data processing
|
|
2
2
|
import { SUBSCRIPT_MAP } from '../labels';
|
|
3
|
-
import {
|
|
3
|
+
import { euclidean_dist } from '../math';
|
|
4
4
|
const is_subscript_key = (key) => key in SUBSCRIPT_MAP;
|
|
5
5
|
// Check if range is a valid [min, max] tuple (strict 2-element array of finite numbers)
|
|
6
6
|
export const is_valid_range = (range) => Array.isArray(range) &&
|
|
@@ -22,6 +22,22 @@ export const axis_with_range = (axis, range, label) => ({
|
|
|
22
22
|
...(label !== undefined && { label }),
|
|
23
23
|
...(is_valid_range(range) && { range }),
|
|
24
24
|
});
|
|
25
|
+
// Sync a ScatterPlot's internal y-axis range back onto a parent bindable axis.
|
|
26
|
+
// Returns a new axis when the range changed (or became invalid and must be
|
|
27
|
+
// cleared), otherwise the same reference so callers can skip reassignment and
|
|
28
|
+
// avoid reactive churn (assign only when `result !== axis`).
|
|
29
|
+
export function sync_axis_range(axis, range) {
|
|
30
|
+
if (is_valid_range(range)) {
|
|
31
|
+
if (axis.range?.[0] === range[0] && axis.range?.[1] === range[1])
|
|
32
|
+
return axis;
|
|
33
|
+
return { ...axis, range };
|
|
34
|
+
}
|
|
35
|
+
if (`range` in axis) {
|
|
36
|
+
const { range: _omit, ...rest } = axis;
|
|
37
|
+
return rest;
|
|
38
|
+
}
|
|
39
|
+
return axis;
|
|
40
|
+
}
|
|
25
41
|
// Detect which plot triggered a zoom change and return the new synced range.
|
|
26
42
|
// Returns null to reset to shared range, undefined for no change, or Vec2 for new zoom.
|
|
27
43
|
export function detect_zoom_change(bands_range, dos_range, shared_range, current_synced, dos_enabled = true) {
|
|
@@ -70,12 +86,12 @@ export function pretty_sym_point(symbol) {
|
|
|
70
86
|
// Handle subscripts: convert S0 to S₀, K1 to K₁, Γ1 to Γ₁, etc.
|
|
71
87
|
// Use \p{L} to match any Unicode letter (not just ASCII A-Z)
|
|
72
88
|
return symbol
|
|
73
|
-
.
|
|
74
|
-
.
|
|
75
|
-
.
|
|
76
|
-
.
|
|
77
|
-
.
|
|
78
|
-
.
|
|
89
|
+
.replaceAll('_', ``)
|
|
90
|
+
.replaceAll(/\\?GAMMA/gi, `Γ`)
|
|
91
|
+
.replaceAll(/\\?DELTA/gi, `Δ`)
|
|
92
|
+
.replaceAll(/\\?SIGMA/gi, `Σ`)
|
|
93
|
+
.replaceAll(/\\?LAMBDA/gi, `Λ`)
|
|
94
|
+
.replaceAll(/(\p{L})(\d+)/gu, (_, letter, num) => letter +
|
|
79
95
|
num
|
|
80
96
|
.split(``)
|
|
81
97
|
.map((digit) => (is_subscript_key(digit) ? SUBSCRIPT_MAP[digit] : digit))
|
|
@@ -133,7 +149,7 @@ export function get_ribbon_config(ribbon_config, label) {
|
|
|
133
149
|
export function get_band_xaxis_ticks(band_struct, branches = []) {
|
|
134
150
|
const ticks_x_pos = [];
|
|
135
151
|
const tick_labels = [];
|
|
136
|
-
let prev_label = band_struct.qpoints[0]?.label
|
|
152
|
+
let prev_label = band_struct.qpoints[0]?.label ?? null;
|
|
137
153
|
let prev_branch = band_struct.branches[0]?.name || null;
|
|
138
154
|
// Convert branches to Set for consistent handling
|
|
139
155
|
const branches_set = Array.isArray(branches) ? new Set(branches) : branches;
|
|
@@ -148,7 +164,7 @@ export function get_band_xaxis_ticks(band_struct, branches = []) {
|
|
|
148
164
|
const this_branch = branch_names[0] || null;
|
|
149
165
|
if (point.label !== prev_label && prev_branch !== this_branch) {
|
|
150
166
|
// Branch transition - combine labels
|
|
151
|
-
tick_labels[tick_labels.length - 1] = `${prev_label
|
|
167
|
+
tick_labels[tick_labels.length - 1] = `${prev_label ?? ``}|${point.label}`;
|
|
152
168
|
ticks_x_pos[ticks_x_pos.length - 1] = band_struct.distance[idx];
|
|
153
169
|
}
|
|
154
170
|
else if (branches_set.size === 0 || (this_branch && branches_set.has(this_branch))) {
|
|
@@ -222,6 +238,7 @@ function fnv1a_hash(arr) {
|
|
|
222
238
|
hash ^= int_view[1];
|
|
223
239
|
hash = Math.imul(hash, 16777619);
|
|
224
240
|
}
|
|
241
|
+
// oxlint-disable-next-line eslint-plugin-unicorn/prefer-math-trunc -- `>>> 0` is unsigned 32-bit coercion, not truncation
|
|
225
242
|
return hash >>> 0; // Ensure unsigned
|
|
226
243
|
}
|
|
227
244
|
// Generate cache key using FNV-1a hash over full arrays (O(n), low collision risk)
|
|
@@ -291,7 +308,7 @@ export function clear_smearing_cache() {
|
|
|
291
308
|
}
|
|
292
309
|
// Type guards for pymatgen qpoint formats
|
|
293
310
|
const is_vec3 = (val) => Array.isArray(val) && val.length >= 3 && val.slice(0, 3).every(Number.isFinite);
|
|
294
|
-
const is_kpoint = (val) =>
|
|
311
|
+
const is_kpoint = (val) => val !== null && typeof val === `object` && `frac_coords` in val && is_vec3(val.frac_coords);
|
|
295
312
|
const is_pymatgen_format = (obj) => {
|
|
296
313
|
// Check for explicit pymatgen markers
|
|
297
314
|
if (typeof obj[`@class`] === `string` || typeof obj[`@module`] === `string`) {
|
|
@@ -313,8 +330,8 @@ const parse_qpoint = (qpt, labels_dict) => {
|
|
|
313
330
|
: null;
|
|
314
331
|
if (!frac_coords)
|
|
315
332
|
return null;
|
|
316
|
-
const label = (is_kpoint(qpt) && typeof qpt.label === `string` && qpt.label) ||
|
|
317
|
-
Object.entries(labels_dict ?? {}).find(([, c]) => euclidean_dist(frac_coords, c) < 1e-4)?.[0]
|
|
333
|
+
const label = ((is_kpoint(qpt) && typeof qpt.label === `string` && qpt.label) ||
|
|
334
|
+
Object.entries(labels_dict ?? {}).find(([, c]) => euclidean_dist(frac_coords, c) < 1e-4)?.[0]) ??
|
|
318
335
|
null;
|
|
319
336
|
return { label, frac_coords };
|
|
320
337
|
};
|
|
@@ -386,13 +403,13 @@ function convert_pymatgen_band_structure(pmg) {
|
|
|
386
403
|
const unit = pmg.unit?.toLowerCase() ?? (has_frequencies_cm ? `cm-1` : `thz`);
|
|
387
404
|
if (!Array.isArray(raw_qpts) ||
|
|
388
405
|
!Array.isArray(raw_bands) ||
|
|
389
|
-
|
|
390
|
-
|
|
406
|
+
raw_qpts.length === 0 ||
|
|
407
|
+
raw_bands.length === 0)
|
|
391
408
|
return null;
|
|
392
409
|
const qpoints = raw_qpts
|
|
393
410
|
.map((qpoint) => parse_qpoint(qpoint, labels_dict))
|
|
394
411
|
.filter((qpoint) => qpoint !== null);
|
|
395
|
-
if (
|
|
412
|
+
if (qpoints.length === 0)
|
|
396
413
|
return null;
|
|
397
414
|
// Step distances and discontinuity detection (5x median threshold)
|
|
398
415
|
const steps = qpoints
|
|
@@ -439,7 +456,7 @@ function convert_pymatgen_band_structure(pmg) {
|
|
|
439
456
|
})
|
|
440
457
|
.filter((branch) => branch.start_index <= branch.end_index);
|
|
441
458
|
}
|
|
442
|
-
if (
|
|
459
|
+
if (branches.length === 0) {
|
|
443
460
|
branches.push({ start_index: 0, end_index: qpoints.length - 1, name: `path` });
|
|
444
461
|
}
|
|
445
462
|
// Convert bands to THz based on input unit
|
|
@@ -574,19 +591,44 @@ export function extract_k_path_points(band_struct, recip_lattice_matrix, options
|
|
|
574
591
|
throw new Error(`reciprocal_lattice_matrix must be a 3×3 matrix`);
|
|
575
592
|
const [[m00, m01, m02], [m10, m11, m12], [m20, m21, m22]] = recip_lattice_matrix;
|
|
576
593
|
return band_struct.qpoints.map((qpoint) => {
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
x
|
|
581
|
-
y
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
return
|
|
594
|
+
const [x, y, z] = qpoint.frac_coords;
|
|
595
|
+
const cart = [
|
|
596
|
+
x * m00 + y * m10 + z * m20,
|
|
597
|
+
x * m01 + y * m11 + z * m21,
|
|
598
|
+
x * m02 + y * m12 + z * m22,
|
|
599
|
+
];
|
|
600
|
+
// Fold into the first (Wigner-Seitz) BZ so points stay inside the rendered zone.
|
|
601
|
+
// Folding in Cartesian space (vs per-axis on fractional coords, which only yields
|
|
602
|
+
// the parallelepiped cell) handles non-orthogonal lattices and preserves path
|
|
603
|
+
// continuity: points already inside the zone are left untouched.
|
|
604
|
+
return wrap_to_bz ? fold_to_first_bz(cart, recip_lattice_matrix) : cart;
|
|
588
605
|
});
|
|
589
606
|
}
|
|
607
|
+
// Fold a Cartesian reciprocal-space point into the first (Wigner-Seitz) Brillouin zone
|
|
608
|
+
// by choosing the periodic image with the smallest norm (minimum-image convention).
|
|
609
|
+
// The ±1 search (27 images) suffices for typical reciprocal lattices; extremely skewed
|
|
610
|
+
// cells could in principle need a wider search.
|
|
611
|
+
function fold_to_first_bz(cart, recip) {
|
|
612
|
+
let best = cart;
|
|
613
|
+
let best_norm = cart[0] ** 2 + cart[1] ** 2 + cart[2] ** 2;
|
|
614
|
+
for (let n1 = -1; n1 <= 1; n1++) {
|
|
615
|
+
for (let n2 = -1; n2 <= 1; n2++) {
|
|
616
|
+
for (let n3 = -1; n3 <= 1; n3++) {
|
|
617
|
+
if (n1 === 0 && n2 === 0 && n3 === 0)
|
|
618
|
+
continue;
|
|
619
|
+
const cand = [
|
|
620
|
+
cart[0] + n1 * recip[0][0] + n2 * recip[1][0] + n3 * recip[2][0],
|
|
621
|
+
cart[1] + n1 * recip[0][1] + n2 * recip[1][1] + n3 * recip[2][1],
|
|
622
|
+
cart[2] + n1 * recip[0][2] + n2 * recip[1][2] + n3 * recip[2][2],
|
|
623
|
+
];
|
|
624
|
+
const norm = cand[0] ** 2 + cand[1] ** 2 + cand[2] ** 2;
|
|
625
|
+
if (norm < best_norm - 1e-9)
|
|
626
|
+
[best, best_norm] = [cand, norm];
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
return best;
|
|
631
|
+
}
|
|
590
632
|
// Find the q-point index closest to a given distance along the band structure path
|
|
591
633
|
export function find_qpoint_at_distance(band_struct, target) {
|
|
592
634
|
const { distance } = band_struct;
|
|
@@ -594,6 +636,30 @@ export function find_qpoint_at_distance(band_struct, target) {
|
|
|
594
636
|
return null;
|
|
595
637
|
return distance.reduce((closest, dist, idx) => Math.abs(dist - target) < Math.abs(distance[closest] - target) ? idx : closest, 0);
|
|
596
638
|
}
|
|
639
|
+
// Rescaled x-position of a q-point index along the band plot path. Inverse of
|
|
640
|
+
// find_qpoint_at_rescaled_x, used to highlight a q-point hovered in the Brillouin zone.
|
|
641
|
+
// Returns null if the index doesn't fall on a plotted (non-discontinuity) branch.
|
|
642
|
+
export function qpoint_x_position(band_struct, qpoint_index, x_positions) {
|
|
643
|
+
if (!band_struct?.branches?.length || !x_positions)
|
|
644
|
+
return null;
|
|
645
|
+
for (const branch of band_struct.branches) {
|
|
646
|
+
if (qpoint_index < branch.start_index || qpoint_index > branch.end_index)
|
|
647
|
+
continue;
|
|
648
|
+
const start_label = band_struct.qpoints[branch.start_index]?.label ?? undefined;
|
|
649
|
+
const end_label = band_struct.qpoints[branch.end_index]?.label ?? undefined;
|
|
650
|
+
const range = x_positions[get_segment_key(start_label, end_label)];
|
|
651
|
+
if (!range)
|
|
652
|
+
continue;
|
|
653
|
+
const [x_start, x_end] = range;
|
|
654
|
+
const d_start = band_struct.distance[branch.start_index];
|
|
655
|
+
const d_end = band_struct.distance[branch.end_index];
|
|
656
|
+
if (d_end === d_start)
|
|
657
|
+
return x_start; // discontinuity / zero-length segment
|
|
658
|
+
const ratio = (band_struct.distance[qpoint_index] - d_start) / (d_end - d_start);
|
|
659
|
+
return x_start + ratio * (x_end - x_start);
|
|
660
|
+
}
|
|
661
|
+
return null;
|
|
662
|
+
}
|
|
597
663
|
// Find q-point index from rescaled x-coordinate (used in band structure plots)
|
|
598
664
|
// This handles the case where the plot uses custom x-axis scaling per segment
|
|
599
665
|
export function find_qpoint_at_rescaled_x(band_struct, rescaled_x, x_positions) {
|
|
@@ -934,12 +1000,12 @@ export function format_dos_tooltip(x_formatted, y_formatted, label, is_horizonta
|
|
|
934
1000
|
};
|
|
935
1001
|
const lines = is_horizontal
|
|
936
1002
|
? [
|
|
937
|
-
format_tooltip_line(y_parsed.name || freq_defaults.name, y_formatted, y_parsed.unit
|
|
1003
|
+
format_tooltip_line(y_parsed.name || freq_defaults.name, y_formatted, y_parsed.unit ?? freq_defaults.unit),
|
|
938
1004
|
format_tooltip_line(x_parsed.name || `Density`, x_formatted),
|
|
939
1005
|
]
|
|
940
1006
|
: [
|
|
941
1007
|
format_tooltip_line(y_parsed.name || `Density`, y_formatted),
|
|
942
|
-
format_tooltip_line(x_parsed.name || freq_defaults.name, x_formatted, x_parsed.unit
|
|
1008
|
+
format_tooltip_line(x_parsed.name || freq_defaults.name, x_formatted, x_parsed.unit ?? freq_defaults.unit),
|
|
943
1009
|
];
|
|
944
1010
|
return { title: num_series > 1 && label ? label : undefined, lines };
|
|
945
1011
|
}
|
|
@@ -128,8 +128,8 @@
|
|
|
128
128
|
// Use unique_values instead of values to avoid undefined colors from duplicates
|
|
129
129
|
property_colors?.unique_values?.flatMap((val) => {
|
|
130
130
|
const idx = property_colors.values.indexOf(val)
|
|
131
|
-
return idx
|
|
132
|
-
})
|
|
131
|
+
return idx !== -1 ? [[val, property_colors.colors[idx]]] : []
|
|
132
|
+
}),
|
|
133
133
|
),
|
|
134
134
|
)
|
|
135
135
|
|
|
@@ -324,6 +324,7 @@
|
|
|
324
324
|
|
|
325
325
|
{#if show_element_legend}
|
|
326
326
|
<div {...rest} class="atom-legend element-legend {rest.class ?? ``}">
|
|
327
|
+
{@render mode_selector_snippet()}
|
|
327
328
|
{#each sorted_element_entries as [elem, amt], idx (elem)}
|
|
328
329
|
{@const is_hidden = hidden_elements.has(elem as ElementSymbol)}
|
|
329
330
|
{@const displayed_elem = element_mapping?.[elem as ElementSymbol] || elem}
|
|
@@ -465,7 +466,6 @@
|
|
|
465
466
|
</div>
|
|
466
467
|
{/each}
|
|
467
468
|
{@render site_radius_control_snippet()}
|
|
468
|
-
{@render mode_selector_snippet()}
|
|
469
469
|
{@render children?.({ mode_menu_open, structure })}
|
|
470
470
|
</div>
|
|
471
471
|
{:else if show_property_legend}
|
|
@@ -474,6 +474,7 @@
|
|
|
474
474
|
class:categorical-legend={atom_color_config.scale_type === `categorical`}
|
|
475
475
|
{...rest}
|
|
476
476
|
>
|
|
477
|
+
{@render mode_selector_snippet()}
|
|
477
478
|
{#if legend_title}
|
|
478
479
|
<div class="legend-header">
|
|
479
480
|
<h4>{legend_title}</h4>
|
|
@@ -533,7 +534,6 @@
|
|
|
533
534
|
{/each}
|
|
534
535
|
{/if}
|
|
535
536
|
{@render site_radius_control_snippet()}
|
|
536
|
-
{@render mode_selector_snippet()}
|
|
537
537
|
{@render children?.({ mode_menu_open, structure })}
|
|
538
538
|
</div>
|
|
539
539
|
{/if}
|
|
@@ -723,7 +723,8 @@
|
|
|
723
723
|
position: relative;
|
|
724
724
|
display: flex;
|
|
725
725
|
align-items: center;
|
|
726
|
-
|
|
726
|
+
/* extra gap toward the color labels so the chevron groups with the cell-select control */
|
|
727
|
+
margin-right: calc(0.25 * var(--struct-legend-gap, clamp(3pt, 2cqmin, 7pt)));
|
|
727
728
|
}
|
|
728
729
|
.mode-toggle {
|
|
729
730
|
background: transparent;
|
|
@@ -735,17 +736,15 @@
|
|
|
735
736
|
font-size: 0.9em;
|
|
736
737
|
opacity: 0;
|
|
737
738
|
pointer-events: none;
|
|
739
|
+
transform: translateY(1px);
|
|
738
740
|
transition: opacity 0.2s ease;
|
|
739
741
|
}
|
|
740
742
|
.mode-toggle :global(svg) {
|
|
741
743
|
font-size: 1.15em;
|
|
742
744
|
}
|
|
743
745
|
.mode-toggle.visible {
|
|
744
|
-
opacity: 0.7;
|
|
745
|
-
pointer-events: auto;
|
|
746
|
-
}
|
|
747
|
-
.mode-toggle.visible:hover {
|
|
748
746
|
opacity: 1;
|
|
747
|
+
pointer-events: auto;
|
|
749
748
|
}
|
|
750
749
|
.mode-dropdown {
|
|
751
750
|
position: absolute;
|
|
@@ -296,8 +296,7 @@
|
|
|
296
296
|
gap: 3px;
|
|
297
297
|
}
|
|
298
298
|
.preset-btn {
|
|
299
|
-
padding:
|
|
300
|
-
line-height: 1;
|
|
299
|
+
padding: 1px;
|
|
301
300
|
background: var(--btn-bg, light-dark(rgba(0, 0, 0, 0.08), rgba(255, 255, 255, 0.1)));
|
|
302
301
|
border: 1px solid var(--border-color);
|
|
303
302
|
border-radius: var(--border-radius, 3pt);
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Vec3 } from '../math'
|
|
3
3
|
import { T } from '@threlte/core'
|
|
4
|
+
import type { ComponentProps } from 'svelte'
|
|
4
5
|
import { Euler, Quaternion, Vector3 } from 'three'
|
|
5
6
|
|
|
6
|
-
let { from, to, color = `#808080`, thickness = 0.1 }:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
let { from, to, color = `#808080`, thickness = 0.1, opacity = 1, ...rest }:
|
|
8
|
+
& ComponentProps<typeof T.Mesh>
|
|
9
|
+
& {
|
|
10
|
+
from: Vec3
|
|
11
|
+
to: Vec3
|
|
12
|
+
color?: string
|
|
13
|
+
thickness?: number
|
|
14
|
+
opacity?: number // < 1 renders semi/fully transparent (e.g. invisible hover proxies)
|
|
15
|
+
} = $props()
|
|
12
16
|
|
|
13
17
|
let from_vec = $derived(new Vector3(...from))
|
|
14
18
|
let to_vec = $derived(new Vector3(...to))
|
|
@@ -39,7 +43,7 @@
|
|
|
39
43
|
}
|
|
40
44
|
</script>
|
|
41
45
|
|
|
42
|
-
<T.Mesh {position} {rotation} scale={[thickness, height, thickness]}>
|
|
46
|
+
<T.Mesh {...rest} {position} {rotation} scale={[thickness, height, thickness]}>
|
|
43
47
|
<T.CylinderGeometry args={[thickness, thickness, 1, 8]} />
|
|
44
|
-
<T.MeshStandardMaterial {color} />
|
|
48
|
+
<T.MeshStandardMaterial {color} transparent={opacity < 1} {opacity} depthWrite={opacity >= 1} />
|
|
45
49
|
</T.Mesh>
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { Vec3 } from '../math';
|
|
2
|
-
|
|
2
|
+
import { T } from '@threlte/core';
|
|
3
|
+
import type { ComponentProps } from 'svelte';
|
|
4
|
+
type $$ComponentProps = ComponentProps<typeof T.Mesh> & {
|
|
3
5
|
from: Vec3;
|
|
4
6
|
to: Vec3;
|
|
5
7
|
color?: string;
|
|
6
8
|
thickness?: number;
|
|
9
|
+
opacity?: number;
|
|
7
10
|
};
|
|
8
11
|
declare const Cylinder: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
9
12
|
type Cylinder = ReturnType<typeof Cylinder>;
|