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
|
@@ -75,12 +75,12 @@
|
|
|
75
75
|
|
|
76
76
|
// Single element: full circle with no radial stroke line, label at center
|
|
77
77
|
if (fraction === 1) {
|
|
78
|
-
const
|
|
78
|
+
const radius = outer_radius
|
|
79
79
|
const ir = inner_radius_adjusted
|
|
80
80
|
// Two semicircular arcs to form a full circle (avoids SVG 360° arc bug)
|
|
81
|
-
const outer_arc = `M ${center} ${center -
|
|
82
|
-
center +
|
|
83
|
-
} A ${
|
|
81
|
+
const outer_arc = `M ${center} ${center - radius} A ${radius} ${radius} 0 1 1 ${center} ${
|
|
82
|
+
center + radius
|
|
83
|
+
} A ${radius} ${radius} 0 1 1 ${center} ${center - radius} Z`
|
|
84
84
|
const path = ir > 0
|
|
85
85
|
? `${outer_arc} M ${center} ${
|
|
86
86
|
center - ir
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
label_x: center,
|
|
102
102
|
label_y: center,
|
|
103
103
|
is_outside_slice: false,
|
|
104
|
-
font_scale: get_chart_font_scale(2.6, label_text,
|
|
104
|
+
font_scale: get_chart_font_scale(2.6, label_text, radius * 2),
|
|
105
105
|
text_color: pick_contrast_color({ bg_color: color }),
|
|
106
106
|
}
|
|
107
107
|
}
|
|
@@ -151,11 +151,9 @@
|
|
|
151
151
|
} else if (is_medium_slice) {
|
|
152
152
|
// Medium slices: place closer to outer edge, proportional to chart size
|
|
153
153
|
label_radius = outer_radius - outer_radius * 0.3
|
|
154
|
-
is_outside_slice = false
|
|
155
154
|
} else {
|
|
156
155
|
// Large slices: place in middle of ring
|
|
157
156
|
label_radius = (outer_radius + inner_radius_adjusted) / 2
|
|
158
|
-
is_outside_slice = false
|
|
159
157
|
}
|
|
160
158
|
|
|
161
159
|
// Calculate font scale based on slice size and smart text fitting
|
|
@@ -293,9 +291,15 @@
|
|
|
293
291
|
.pie-segment.interactive:focus {
|
|
294
292
|
outline: none;
|
|
295
293
|
}
|
|
294
|
+
svg {
|
|
295
|
+
/* very thin slices place their labels outside the pie at 1.2x the outer radius,
|
|
296
|
+
past the square viewBox - the default svg overflow: hidden would clip them */
|
|
297
|
+
overflow: visible;
|
|
298
|
+
}
|
|
296
299
|
foreignobject {
|
|
297
300
|
pointer-events: none;
|
|
298
301
|
transition: all 0.2s ease;
|
|
302
|
+
overflow: visible;
|
|
299
303
|
}
|
|
300
304
|
foreignobject.hovered {
|
|
301
305
|
font-weight: 700;
|
|
@@ -310,9 +314,6 @@
|
|
|
310
314
|
transition: all 0.2s ease;
|
|
311
315
|
white-space: nowrap;
|
|
312
316
|
}
|
|
313
|
-
foreignobject {
|
|
314
|
-
overflow: visible;
|
|
315
|
-
}
|
|
316
317
|
.pie-label.hovered {
|
|
317
318
|
font-weight: 700;
|
|
318
319
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SunburstNode } from '../plot/core/types';
|
|
2
|
+
export interface ChemSysSunburstMetadata {
|
|
3
|
+
chem_sys: string;
|
|
4
|
+
arity: number;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
}
|
|
7
|
+
export declare const arity_name: (arity: number) => string;
|
|
8
|
+
export declare function chem_sys_sunburst_data(entries: readonly string[]): SunburstNode<ChemSysSunburstMetadata>[];
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// Build arity -> chemical-system hierarchy data for the Sunburst component
|
|
2
|
+
// (counterpart to pymatviz's chem_sys_sunburst).
|
|
3
|
+
import { is_elem_symbol } from '../element';
|
|
4
|
+
import { parse_formula } from './parse';
|
|
5
|
+
const ARITY_NAMES = [
|
|
6
|
+
``,
|
|
7
|
+
`unary`,
|
|
8
|
+
`binary`,
|
|
9
|
+
`ternary`,
|
|
10
|
+
`quaternary`,
|
|
11
|
+
`quinary`,
|
|
12
|
+
`senary`,
|
|
13
|
+
`septenary`,
|
|
14
|
+
`octonary`,
|
|
15
|
+
`nonary`,
|
|
16
|
+
`denary`,
|
|
17
|
+
];
|
|
18
|
+
// || (not ??) so the empty index-0 placeholder also falls through to "0-ary"
|
|
19
|
+
export const arity_name = (arity) => ARITY_NAMES[arity] || `${arity}-ary`;
|
|
20
|
+
// Build arity -> chemical-system sunburst data from a list of chemical systems
|
|
21
|
+
// ("Li-Fe-O") and/or formulas ("LiFePO4"), one entry per occurrence (counts become
|
|
22
|
+
// leaf values). Systems are normalized to alphabetical element order, so "O-Li" and
|
|
23
|
+
// "Li2O" both count toward "Li-O". Ids follow the "<arity>/<system>" scheme.
|
|
24
|
+
export function chem_sys_sunburst_data(entries) {
|
|
25
|
+
// Inputs are one entry per occurrence, so the same formula typically repeats many
|
|
26
|
+
// times - memoize raw entry -> normalized system (null = invalid) to parse each
|
|
27
|
+
// distinct string only once
|
|
28
|
+
const normalized = new Map();
|
|
29
|
+
const normalize = (entry) => {
|
|
30
|
+
let elements;
|
|
31
|
+
if (entry.includes(`-`)) {
|
|
32
|
+
elements = entry.split(`-`).map((el) => el.trim());
|
|
33
|
+
if (!elements.every(is_elem_symbol))
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
try {
|
|
38
|
+
elements = Object.keys(parse_formula(entry));
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (elements.length === 0)
|
|
45
|
+
return null;
|
|
46
|
+
return [...new Set(elements)].sort().join(`-`);
|
|
47
|
+
};
|
|
48
|
+
const counts = new Map();
|
|
49
|
+
let n_invalid = 0;
|
|
50
|
+
for (const entry of entries) {
|
|
51
|
+
let chem_sys = normalized.get(entry);
|
|
52
|
+
if (chem_sys === undefined) {
|
|
53
|
+
chem_sys = normalize(entry);
|
|
54
|
+
normalized.set(entry, chem_sys);
|
|
55
|
+
}
|
|
56
|
+
if (chem_sys === null) {
|
|
57
|
+
n_invalid += 1;
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
counts.set(chem_sys, (counts.get(chem_sys) ?? 0) + 1);
|
|
61
|
+
}
|
|
62
|
+
if (n_invalid > 0) {
|
|
63
|
+
console.warn(`chem_sys_sunburst_data: skipped ${n_invalid} invalid entr${n_invalid === 1 ? `y` : `ies`} (expected chemical systems like "Li-Fe-O" or formulas like "LiFePO4")`);
|
|
64
|
+
}
|
|
65
|
+
// One composite sort (arity ascending, then count descending) puts systems in
|
|
66
|
+
// final order; consecutive same-arity runs then collapse into one branch each
|
|
67
|
+
const sorted = [...counts]
|
|
68
|
+
.map(([chem_sys, count]) => ({ chem_sys, count, arity: chem_sys.split(`-`).length }))
|
|
69
|
+
.sort((sys_a, sys_b) => sys_a.arity - sys_b.arity || sys_b.count - sys_a.count);
|
|
70
|
+
const roots = [];
|
|
71
|
+
let branch;
|
|
72
|
+
for (const { chem_sys, count, arity } of sorted) {
|
|
73
|
+
const name = arity_name(arity);
|
|
74
|
+
if (branch?.id !== name) {
|
|
75
|
+
branch = { id: name, label: name, children: [] };
|
|
76
|
+
roots.push(branch);
|
|
77
|
+
}
|
|
78
|
+
branch.children?.push({
|
|
79
|
+
id: `${name}/${chem_sys}`,
|
|
80
|
+
label: chem_sys,
|
|
81
|
+
value: count,
|
|
82
|
+
metadata: { chem_sys, arity },
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return roots;
|
|
86
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { format_num } from '../labels';
|
|
2
|
-
import {
|
|
2
|
+
import { is_elem_symbol } from '../element';
|
|
3
|
+
import { ELEMENT_ELECTRONEGATIVITY_MAP, parse_composition } from './parse';
|
|
3
4
|
// Extract composition from structure object
|
|
4
5
|
const structure_to_composition = (structure) => {
|
|
5
6
|
if (!structure.sites || !Array.isArray(structure.sites)) {
|
|
@@ -20,14 +21,16 @@ const structure_to_composition = (structure) => {
|
|
|
20
21
|
const is_structure_like = (input) => `sites` in input || `lattice` in input;
|
|
21
22
|
// Format composition into chemical formula string
|
|
22
23
|
export const format_composition_formula = (composition, sort_fn, plain_text = false, delim = ` `, amount_format = `.3~s`) => {
|
|
23
|
-
const symbols = Object.keys(composition).filter(
|
|
24
|
+
const symbols = Object.keys(composition).filter(is_elem_symbol);
|
|
24
25
|
return sort_fn(symbols)
|
|
25
26
|
.filter((el) => composition[el] && composition[el] > 0)
|
|
26
27
|
.map((el) => {
|
|
27
|
-
const amount = composition[el];
|
|
28
|
+
const amount = Number(composition[el]);
|
|
28
29
|
if (amount === 1)
|
|
29
30
|
return el;
|
|
30
|
-
|
|
31
|
+
// avoid d3 SI prefixes for sub-1 amounts (`s` formats render 0.5 as 500m)
|
|
32
|
+
const fmt = amount_format.endsWith(`s`) && Math.abs(amount) < 1 ? `.3~g` : amount_format;
|
|
33
|
+
const formatted_amount = format_num(amount, fmt);
|
|
31
34
|
return plain_text ? `${el}${formatted_amount}` : `${el}<sub>${formatted_amount}</sub>`;
|
|
32
35
|
})
|
|
33
36
|
.join(delim);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ElementSymbol } from '../element';
|
|
2
2
|
export { default as BarChart } from './BarChart.svelte';
|
|
3
3
|
export { default as BubbleChart } from './BubbleChart.svelte';
|
|
4
|
+
export * from './chem-sys';
|
|
4
5
|
export { default as Composition } from './Composition.svelte';
|
|
5
6
|
export * from './format';
|
|
6
7
|
export { default as Formula } from './Formula.svelte';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as BarChart } from './BarChart.svelte';
|
|
2
2
|
export { default as BubbleChart } from './BubbleChart.svelte';
|
|
3
|
+
export * from './chem-sys';
|
|
3
4
|
export { default as Composition } from './Composition.svelte';
|
|
4
5
|
export * from './format';
|
|
5
6
|
export { default as Formula } from './Formula.svelte';
|
|
@@ -6,7 +6,6 @@ export declare const ATOMIC_WEIGHTS: Map<"S" | "K" | "B" | "H" | "He" | "Li" | "
|
|
|
6
6
|
export declare const ELEMENT_ELECTRONEGATIVITY_MAP: Map<"S" | "K" | "B" | "H" | "He" | "Li" | "Be" | "C" | "N" | "O" | "F" | "Ne" | "Na" | "Mg" | "Al" | "Si" | "P" | "Cl" | "Ar" | "Ca" | "Sc" | "Ti" | "V" | "Cr" | "Mn" | "Fe" | "Co" | "Ni" | "Cu" | "Zn" | "Ga" | "Ge" | "As" | "Se" | "Br" | "Kr" | "Rb" | "Sr" | "Y" | "Zr" | "Nb" | "Mo" | "Tc" | "Ru" | "Rh" | "Pd" | "Ag" | "Cd" | "In" | "Sn" | "Sb" | "Te" | "I" | "Xe" | "Cs" | "Ba" | "La" | "Ce" | "Pr" | "Nd" | "Pm" | "Sm" | "Eu" | "Gd" | "Tb" | "Dy" | "Ho" | "Er" | "Tm" | "Yb" | "Lu" | "Hf" | "Ta" | "W" | "Re" | "Os" | "Ir" | "Pt" | "Au" | "Hg" | "Tl" | "Pb" | "Bi" | "Po" | "At" | "Rn" | "Fr" | "Ra" | "Ac" | "Th" | "Pa" | "U" | "Np" | "Pu" | "Am" | "Cm" | "Bk" | "Cf" | "Es" | "Fm" | "Md" | "No" | "Lr" | "Rf" | "Db" | "Sg" | "Bh" | "Hs" | "Mt" | "Ds" | "Rg" | "Cn" | "Nh" | "Fl" | "Mc" | "Lv" | "Ts" | "Og", number>;
|
|
7
7
|
export declare const ELEM_NAME_TO_SYMBOL: Record<string, ElementSymbol>;
|
|
8
8
|
export declare const ELEM_SYMBOL_TO_NAME: Partial<Record<ElementSymbol, string>>;
|
|
9
|
-
export declare const is_valid_element: (sym: string) => sym is ElementSymbol;
|
|
10
9
|
export declare const atomic_num_to_symbols: (atomic_composition: Record<number, number>) => CompositionType;
|
|
11
10
|
export declare const atomic_symbol_to_num: (symbol_composition: CompositionType) => Record<number, number>;
|
|
12
11
|
export declare const parse_formula: (formula: string) => CompositionType;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { element_data } from '../element';
|
|
1
|
+
import { element_data, is_elem_symbol } from '../element';
|
|
2
2
|
import { ELEM_SYMBOLS } from '../labels';
|
|
3
3
|
// Create symbol/number/mass/electronegativity lookup maps for O(1) access
|
|
4
4
|
export const ATOMIC_NUMBER_TO_SYMBOL = {};
|
|
@@ -16,8 +16,6 @@ for (const element of element_data) {
|
|
|
16
16
|
ELEM_NAME_TO_SYMBOL[element.name] = element.symbol;
|
|
17
17
|
ELEM_SYMBOL_TO_NAME[element.symbol] = element.name;
|
|
18
18
|
}
|
|
19
|
-
// Type guard: check if a string is a valid element symbol
|
|
20
|
-
export const is_valid_element = (sym) => ELEM_SYMBOLS.includes(sym);
|
|
21
19
|
// Check if object has atomic numbers as keys (1-118)
|
|
22
20
|
const is_atomic_number_composition = (obj) => {
|
|
23
21
|
const keys = Object.keys(obj);
|
|
@@ -51,7 +49,7 @@ export const atomic_num_to_symbols = (atomic_composition) => {
|
|
|
51
49
|
export const atomic_symbol_to_num = (symbol_composition) => {
|
|
52
50
|
const atomic_composition = {};
|
|
53
51
|
for (const [symbol, amount] of Object.entries(symbol_composition)) {
|
|
54
|
-
if (!
|
|
52
|
+
if (!is_elem_symbol(symbol))
|
|
55
53
|
throw new Error(`Invalid element symbol: ${symbol}`);
|
|
56
54
|
const atomic_num = SYMBOL_TO_ATOMIC_NUMBER[symbol];
|
|
57
55
|
if (!atomic_num)
|
|
@@ -65,26 +63,38 @@ export const atomic_symbol_to_num = (symbol_composition) => {
|
|
|
65
63
|
// Expand parentheses in chemical formulas
|
|
66
64
|
const expand_parentheses = (formula) => {
|
|
67
65
|
while (formula.includes(`(`)) {
|
|
68
|
-
|
|
66
|
+
const expanded = formula.replaceAll(/\(([^()]+)\)(\d+(?:\.\d+)?|\.\d+)?/g, (_match, group, multiplier) => {
|
|
69
67
|
const mult = parse_count(multiplier);
|
|
70
|
-
return group.
|
|
68
|
+
return group.replaceAll(/([A-Z][a-z]?)(\d+(?:\.\d+)?|\.\d+)?/g, (_m, element, count) => {
|
|
71
69
|
const count_str = format_count(parse_count(count) * mult);
|
|
72
70
|
return element + (count_str === `1` ? `` : count_str);
|
|
73
71
|
});
|
|
74
72
|
});
|
|
73
|
+
if (expanded === formula) {
|
|
74
|
+
// unclosed/empty parens match nothing -> would loop forever
|
|
75
|
+
throw new Error(`Unbalanced or empty parentheses in formula: ${formula}`);
|
|
76
|
+
}
|
|
77
|
+
formula = expanded;
|
|
75
78
|
}
|
|
76
79
|
return formula;
|
|
77
80
|
};
|
|
78
|
-
// Parse chemical formula string into composition object
|
|
81
|
+
// Parse chemical formula string into composition object. Hydrate/adduct segments
|
|
82
|
+
// joined by ·, ⋅, or * are scaled by their leading coefficient (CuSO4·5H2O -> Cu S O9 H10)
|
|
79
83
|
export const parse_formula = (formula) => {
|
|
80
84
|
const composition = {};
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
const cleaned = formula.replaceAll(/\s/g, ``);
|
|
86
|
+
const segments = cleaned.split(/[·⋅*]/).filter(Boolean);
|
|
87
|
+
for (const [seg_idx, segment] of segments.entries()) {
|
|
88
|
+
// only hydrate segments (after a separator) carry a leading multiplier
|
|
89
|
+
const coeff = seg_idx > 0 ? /^(?:\d+(?:\.\d+)?|\.\d+)/.exec(segment)?.[0] : undefined;
|
|
90
|
+
const multiplier = coeff ? parseFloat(coeff) : 1;
|
|
91
|
+
const expanded = expand_parentheses(segment.slice(coeff?.length ?? 0));
|
|
92
|
+
for (const match of expanded.matchAll(/([A-Z][a-z]?)(\d+(?:\.\d+)?|\.\d+)?/g)) {
|
|
93
|
+
const [, element, count] = match;
|
|
94
|
+
if (!is_elem_symbol(element))
|
|
95
|
+
throw new Error(`Invalid element symbol: ${element}`);
|
|
96
|
+
composition[element] = (composition[element] ?? 0) + parse_count(count) * multiplier;
|
|
97
|
+
}
|
|
88
98
|
}
|
|
89
99
|
return composition;
|
|
90
100
|
};
|
|
@@ -95,7 +105,7 @@ export const normalize_composition = (composition) => {
|
|
|
95
105
|
}
|
|
96
106
|
const normalized = {};
|
|
97
107
|
for (const [element, amount] of Object.entries(composition)) {
|
|
98
|
-
if (typeof amount === `number` && amount > 0 &&
|
|
108
|
+
if (typeof amount === `number` && amount > 0 && is_elem_symbol(element)) {
|
|
99
109
|
normalized[element] = amount;
|
|
100
110
|
}
|
|
101
111
|
}
|
|
@@ -113,7 +123,7 @@ export const sanitize_composition_keys = (composition) => {
|
|
|
113
123
|
if (typeof amount !== `number` || amount <= 0)
|
|
114
124
|
continue;
|
|
115
125
|
// Extract first valid element symbol from key (e.g. "B0." -> "B", "Fe2+" -> "Fe")
|
|
116
|
-
const elem = (key.match(/[A-Z][a-z]?/g) ?? []).find(
|
|
126
|
+
const elem = (key.match(/[A-Z][a-z]?/g) ?? []).find(is_elem_symbol);
|
|
117
127
|
if (elem)
|
|
118
128
|
sanitized[elem] = (sanitized[elem] || 0) + amount;
|
|
119
129
|
}
|
|
@@ -127,7 +137,7 @@ export const fractional_composition = (composition, by_weight = false) => {
|
|
|
127
137
|
const filtered = Object.fromEntries(Object.entries(composition).filter(([, amount]) => amount > 0));
|
|
128
138
|
if (by_weight) {
|
|
129
139
|
const element_weights = Object.fromEntries(Object.entries(filtered).map(([element, amount]) => {
|
|
130
|
-
if (!
|
|
140
|
+
if (!is_elem_symbol(element))
|
|
131
141
|
throw new Error(`Unknown element: ${element}`);
|
|
132
142
|
const atomic_mass = ATOMIC_WEIGHTS.get(element);
|
|
133
143
|
if (!atomic_mass)
|
|
@@ -179,14 +189,14 @@ export const get_reduced_formula = (composition) => {
|
|
|
179
189
|
return composition;
|
|
180
190
|
const reduced = {};
|
|
181
191
|
for (const [elem, amt] of Object.entries(composition)) {
|
|
182
|
-
if (
|
|
192
|
+
if (is_elem_symbol(elem))
|
|
183
193
|
reduced[elem] = amt / divisor;
|
|
184
194
|
}
|
|
185
195
|
return reduced;
|
|
186
196
|
};
|
|
187
197
|
// Calculate molecular weight (sum of atomic masses * amounts)
|
|
188
198
|
export const get_molecular_weight = (composition) => Object.entries(composition).reduce((total, [elem, amount]) => {
|
|
189
|
-
const mass =
|
|
199
|
+
const mass = is_elem_symbol(elem) ? (ATOMIC_WEIGHTS.get(elem) ?? 0) : 0;
|
|
190
200
|
return total + mass * amount;
|
|
191
201
|
}, 0);
|
|
192
202
|
// Parse oxidation state string (e.g. "+2", "2+", "-", "[2-]") to number
|
|
@@ -210,7 +220,7 @@ const parse_oxidation_state = (oxidation_str) => {
|
|
|
210
220
|
// When strict=true, throws on conflicting oxidation states for the same element.
|
|
211
221
|
export const parse_formula_with_oxidation = (formula, strict = false) => {
|
|
212
222
|
const elements = [];
|
|
213
|
-
const cleaned_formula = expand_parentheses(formula.
|
|
223
|
+
const cleaned_formula = expand_parentheses(formula.replaceAll(/\s/g, ``));
|
|
214
224
|
// Regex to match: Element, optional oxidation state and/or count in either order
|
|
215
225
|
// Pattern: ([A-Z][a-z]?) - element symbol
|
|
216
226
|
// Followed by one of:
|
|
@@ -229,7 +239,7 @@ export const parse_formula_with_oxidation = (formula, strict = false) => {
|
|
|
229
239
|
const oxidation_str = match[2] || match[3] || match[6] || match[7];
|
|
230
240
|
const count_str = match[4] || match[5];
|
|
231
241
|
const count = parse_count(count_str);
|
|
232
|
-
if (!
|
|
242
|
+
if (!is_elem_symbol(element))
|
|
233
243
|
throw new Error(`Invalid element symbol: ${element}`);
|
|
234
244
|
const oxidation_state = oxidation_str ? parse_oxidation_state(oxidation_str) : undefined;
|
|
235
245
|
// Find or add element entry
|
|
@@ -257,7 +267,7 @@ export const parse_formula_with_oxidation = (formula, strict = false) => {
|
|
|
257
267
|
};
|
|
258
268
|
// Convert OxiComposition to ElementWithOxidation array
|
|
259
269
|
// Does not preserve original order since objects don't have a defined order
|
|
260
|
-
export const oxi_composition_to_elements = (composition) => Object.entries(composition).flatMap(([element, { amount, oxidation_state }], idx) =>
|
|
270
|
+
export const oxi_composition_to_elements = (composition) => Object.entries(composition).flatMap(([element, { amount, oxidation_state }], idx) => is_elem_symbol(element) ? [{ element, amount, oxidation_state, orig_idx: idx }] : []);
|
|
261
271
|
// Extract element symbols from a chemical formula.
|
|
262
272
|
// Default (unique=true, sorted=true): "NbZr2Nb" -> ["Nb", "Zr"]
|
|
263
273
|
// unique=false: Fast token extraction preserving order without parentheses expansion
|
|
@@ -271,12 +281,12 @@ export function extract_formula_elements(formula, { unique = true, sorted = true
|
|
|
271
281
|
const matches = formula.match(/[A-Z][a-z]?/g) ?? [];
|
|
272
282
|
const elements = [];
|
|
273
283
|
for (const match of matches) {
|
|
274
|
-
if (
|
|
284
|
+
if (is_elem_symbol(match))
|
|
275
285
|
elements.push(match);
|
|
276
286
|
}
|
|
277
287
|
return elements;
|
|
278
288
|
}
|
|
279
|
-
const symbols = Object.keys(parse_formula(formula)).filter(
|
|
289
|
+
const symbols = Object.keys(parse_formula(formula)).filter(is_elem_symbol);
|
|
280
290
|
return sorted ? symbols.sort() : symbols;
|
|
281
291
|
}
|
|
282
292
|
// Generate all non-empty subsets of a chemical system as hyphenated strings.
|
|
@@ -290,7 +300,7 @@ export function generate_chem_sys_subspaces(input) {
|
|
|
290
300
|
else if (Array.isArray(input)) {
|
|
291
301
|
const uniq = [...new Set(input)];
|
|
292
302
|
for (const elem of uniq) {
|
|
293
|
-
if (!
|
|
303
|
+
if (!is_elem_symbol(elem))
|
|
294
304
|
throw new Error(`Invalid element symbol: ${elem}`);
|
|
295
305
|
}
|
|
296
306
|
elements = uniq;
|
|
@@ -298,7 +308,7 @@ export function generate_chem_sys_subspaces(input) {
|
|
|
298
308
|
else {
|
|
299
309
|
elements = [];
|
|
300
310
|
for (const elem of Object.keys(input)) {
|
|
301
|
-
if (!
|
|
311
|
+
if (!is_elem_symbol(elem))
|
|
302
312
|
throw new Error(`Invalid element symbol: ${elem}`);
|
|
303
313
|
elements.push(elem);
|
|
304
314
|
}
|
|
@@ -332,7 +342,7 @@ export const has_wildcards = (input) => input.includes(`*`);
|
|
|
332
342
|
// Throws if any non-wildcard token is not a valid element symbol.
|
|
333
343
|
export function parse_chemsys_with_wildcards(input) {
|
|
334
344
|
const tokens = input
|
|
335
|
-
.
|
|
345
|
+
.replaceAll('-', `,`)
|
|
336
346
|
.split(`,`)
|
|
337
347
|
.map((tok) => tok.trim())
|
|
338
348
|
.filter(Boolean);
|
|
@@ -342,7 +352,7 @@ export function parse_chemsys_with_wildcards(input) {
|
|
|
342
352
|
if (token === `*`) {
|
|
343
353
|
wildcard_count++;
|
|
344
354
|
}
|
|
345
|
-
else if (
|
|
355
|
+
else if (is_elem_symbol(token)) {
|
|
346
356
|
elements.push(token);
|
|
347
357
|
}
|
|
348
358
|
else {
|
|
@@ -368,7 +378,7 @@ export const ELEM_WILDCARD = {
|
|
|
368
378
|
export function parse_formula_with_wildcards(formula) {
|
|
369
379
|
const tokens = [];
|
|
370
380
|
// Expand parentheses, treating * as a pseudo-element (temporarily replace to protect it)
|
|
371
|
-
let cleaned = formula.
|
|
381
|
+
let cleaned = formula.replaceAll(/\s/g, ``);
|
|
372
382
|
// Protect wildcards from parentheses expansion by replacing * with placeholder
|
|
373
383
|
cleaned = cleaned.replace(ELEM_WILDCARD.to_placeholder, ELEM_WILDCARD.placeholder);
|
|
374
384
|
cleaned = expand_parentheses(cleaned);
|
|
@@ -389,7 +399,7 @@ export function parse_formula_with_wildcards(formula) {
|
|
|
389
399
|
// Element symbol match
|
|
390
400
|
const element = match[1];
|
|
391
401
|
const count = parse_count(match[2]);
|
|
392
|
-
if (!
|
|
402
|
+
if (!is_elem_symbol(element)) {
|
|
393
403
|
throw new Error(`Invalid element symbol: ${element}`);
|
|
394
404
|
}
|
|
395
405
|
tokens.push({ element, count });
|
|
@@ -410,7 +420,7 @@ export function matches_chemsys_wildcard(formula, explicit_elements, wildcard_co
|
|
|
410
420
|
// Must contain all explicit elements
|
|
411
421
|
const formula_set = new Set(formula_elements);
|
|
412
422
|
for (const elem of explicit_elements) {
|
|
413
|
-
if (!
|
|
423
|
+
if (!is_elem_symbol(elem) || !formula_set.has(elem))
|
|
414
424
|
return false;
|
|
415
425
|
}
|
|
416
426
|
return true;
|
package/dist/controls.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export type ShowControlsConfig = {
|
|
|
5
5
|
style?: string;
|
|
6
6
|
};
|
|
7
7
|
export type ShowControlsProp = ControlsVisibility | ShowControlsConfig | boolean;
|
|
8
|
+
export type ShowControlsState = ReturnType<typeof normalize_show_controls>;
|
|
8
9
|
export declare function normalize_show_controls(prop: ShowControlsProp | undefined): {
|
|
9
10
|
mode: ControlsVisibility;
|
|
10
11
|
hidden: Set<string>;
|
package/dist/controls.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Controls visibility configuration for visualization components
|
|
2
2
|
// Manages visibility of control buttons in Structure, Trajectory, BrillouinZone
|
|
3
|
-
// Normalize show_controls prop into consistent config with helper methods
|
|
4
3
|
export function normalize_show_controls(prop) {
|
|
5
4
|
// Extract mode, hidden, style from various prop forms
|
|
6
5
|
let mode = `hover`;
|
|
@@ -8,17 +8,13 @@
|
|
|
8
8
|
import ConvexHull3D from './ConvexHull3D.svelte'
|
|
9
9
|
import ConvexHull4D from './ConvexHull4D.svelte'
|
|
10
10
|
import type { BaseConvexHullProps, Hull3DProps } from './index'
|
|
11
|
-
import type { GasSpecies, GasThermodynamicsConfig } from './types'
|
|
12
11
|
|
|
13
12
|
// Union type combining all possible props from 2D, 3D, and 4D components
|
|
14
13
|
// each specific component will only use its relevant props from this super set
|
|
14
|
+
// (gas_config/gas_pressures already come from BaseConvexHullProps)
|
|
15
15
|
type ConvexHullProps = BaseConvexHullProps & Hull3DProps & {
|
|
16
16
|
x_axis?: AxisConfig
|
|
17
17
|
y_axis?: AxisConfig
|
|
18
|
-
// Gas thermodynamics config - enables atmosphere-controlled phase diagrams
|
|
19
|
-
gas_config?: GasThermodynamicsConfig
|
|
20
|
-
// Gas pressure binding - enables two-way binding for atmosphere control
|
|
21
|
-
gas_pressures?: Partial<Record<GasSpecies, number>>
|
|
22
18
|
}
|
|
23
19
|
|
|
24
20
|
let {
|
|
@@ -28,6 +24,7 @@
|
|
|
28
24
|
wrapper = $bindable(),
|
|
29
25
|
show_stable = $bindable(true),
|
|
30
26
|
show_unstable = $bindable(true),
|
|
27
|
+
hidden_categories = $bindable([]),
|
|
31
28
|
show_hull_faces = $bindable(true),
|
|
32
29
|
hull_face_opacity: hull_face_opacity_prop = $bindable(
|
|
33
30
|
undefined as number | undefined,
|
|
@@ -35,7 +32,7 @@
|
|
|
35
32
|
color_mode = $bindable(`energy`),
|
|
36
33
|
color_scale = $bindable(`interpolateViridis`),
|
|
37
34
|
info_pane_open = $bindable(false),
|
|
38
|
-
|
|
35
|
+
controls_open = $bindable(false),
|
|
39
36
|
max_hull_dist_show_phases = $bindable(0.1),
|
|
40
37
|
max_hull_dist_show_labels = $bindable(0.1),
|
|
41
38
|
show_stable_labels = $bindable(true),
|
|
@@ -87,9 +84,9 @@
|
|
|
87
84
|
hull_face_opacity_prop = hull_face_opacity
|
|
88
85
|
})
|
|
89
86
|
|
|
90
|
-
// Map element count to
|
|
91
|
-
//
|
|
92
|
-
//
|
|
87
|
+
// Map element count to component. Deliberate cast: the wrapper passes the prop superset
|
|
88
|
+
// while each component declares only its dimension's props (2D lacks Hull3DProps, 3D/4D
|
|
89
|
+
// lack x/y_axis), so a constructor union wouldn't compile. Svelte ignores extra props.
|
|
93
90
|
const ConvexHullComponent = $derived(
|
|
94
91
|
{ 2: ConvexHull2D, 3: ConvexHull3D, 4: ConvexHull4D }[element_count] ??
|
|
95
92
|
null,
|
|
@@ -104,12 +101,13 @@
|
|
|
104
101
|
bind:wrapper
|
|
105
102
|
bind:show_stable
|
|
106
103
|
bind:show_unstable
|
|
104
|
+
bind:hidden_categories
|
|
107
105
|
bind:show_hull_faces
|
|
108
106
|
bind:hull_face_opacity
|
|
109
107
|
bind:color_mode
|
|
110
108
|
bind:color_scale
|
|
111
109
|
bind:info_pane_open
|
|
112
|
-
bind:
|
|
110
|
+
bind:controls_open
|
|
113
111
|
bind:max_hull_dist_show_phases
|
|
114
112
|
bind:max_hull_dist_show_labels
|
|
115
113
|
bind:show_stable_labels
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import type { AxisConfig } from '../plot';
|
|
2
2
|
import type { Component } from 'svelte';
|
|
3
3
|
import type { BaseConvexHullProps, Hull3DProps } from './index';
|
|
4
|
-
import type { GasSpecies, GasThermodynamicsConfig } from './types';
|
|
5
4
|
type ConvexHullProps = BaseConvexHullProps & Hull3DProps & {
|
|
6
5
|
x_axis?: AxisConfig;
|
|
7
6
|
y_axis?: AxisConfig;
|
|
8
|
-
gas_config?: GasThermodynamicsConfig;
|
|
9
|
-
gas_pressures?: Partial<Record<GasSpecies, number>>;
|
|
10
7
|
};
|
|
11
|
-
declare const ConvexHull: Component<ConvexHullProps, {}, "
|
|
8
|
+
declare const ConvexHull: Component<ConvexHullProps, {}, "display" | "temperature" | "fullscreen" | "wrapper" | "controls_open" | "color_scale" | "info_pane_open" | "show_hull_faces" | "hull_face_opacity" | "color_mode" | "show_stable" | "show_unstable" | "show_stable_labels" | "show_unstable_labels" | "max_hull_dist_show_phases" | "max_hull_dist_show_labels" | "hidden_categories" | "energy_source_mode" | "stable_entries" | "unstable_entries" | "phase_stats" | "highlighted_entries" | "selected_entry" | "gas_pressures">;
|
|
12
9
|
type ConvexHull = ReturnType<typeof ConvexHull>;
|
|
13
10
|
export default ConvexHull;
|