matterviz 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/EmptyState.svelte +10 -4
- package/dist/FilePicker.svelte +12 -14
- package/dist/Icon.svelte +7 -4
- package/dist/MillerIndexInput.svelte +2 -2
- package/dist/app.css +53 -0
- package/dist/brillouin/BrillouinZone.svelte +75 -85
- package/dist/brillouin/BrillouinZone.svelte.d.ts +5 -7
- package/dist/brillouin/BrillouinZoneControls.svelte +3 -6
- package/dist/brillouin/BrillouinZoneExportPane.svelte +18 -14
- package/dist/brillouin/BrillouinZoneInfoPane.svelte +6 -10
- package/dist/brillouin/BrillouinZoneScene.svelte +26 -39
- package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +1 -1
- package/dist/chempot-diagram/ChemPotDiagram.svelte +33 -38
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +62 -74
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +1 -1
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +511 -547
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +1 -1
- package/dist/chempot-diagram/async-compute.svelte.js +1 -1
- package/dist/chempot-diagram/controls-state.svelte.js +1 -1
- package/dist/colors/index.d.ts +0 -4
- package/dist/colors/index.js +19 -20
- package/dist/composition/BarChart.svelte +37 -31
- package/dist/composition/BubbleChart.svelte +17 -17
- package/dist/composition/Composition.svelte +7 -11
- package/dist/composition/Formula.svelte +18 -25
- package/dist/composition/FormulaFilter.svelte +92 -95
- package/dist/composition/PieChart.svelte +55 -41
- package/dist/composition/format.js +1 -1
- package/dist/composition/index.d.ts +2 -0
- package/dist/composition/index.js +14 -0
- package/dist/composition/parse.d.ts +2 -2
- package/dist/composition/parse.js +11 -10
- package/dist/constants.js +11 -9
- package/dist/convex-hull/ConvexHull.svelte +12 -15
- package/dist/convex-hull/ConvexHull.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull2D.svelte +93 -92
- package/dist/convex-hull/ConvexHull2D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull3D.svelte +109 -140
- package/dist/convex-hull/ConvexHull3D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull4D.svelte +75 -94
- package/dist/convex-hull/ConvexHull4D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHullChrome.svelte +36 -40
- package/dist/convex-hull/ConvexHullControls.svelte +46 -48
- package/dist/convex-hull/ConvexHullStats.svelte +193 -195
- package/dist/convex-hull/ConvexHullTooltip.svelte +5 -12
- package/dist/convex-hull/GasPressureControls.svelte +5 -12
- package/dist/convex-hull/StructurePopup.svelte +17 -21
- package/dist/convex-hull/StructurePopup.svelte.d.ts +2 -0
- package/dist/convex-hull/TemperatureSlider.svelte +4 -10
- package/dist/convex-hull/canvas-interactions.svelte.js +2 -1
- package/dist/convex-hull/helpers.d.ts +8 -10
- package/dist/convex-hull/helpers.js +36 -36
- package/dist/convex-hull/hull-state.svelte.d.ts +1 -1
- package/dist/convex-hull/thermodynamics.js +18 -17
- package/dist/coordination/CoordinationBarPlot.svelte +38 -33
- package/dist/coordination/CoordinationBarPlot.svelte.d.ts +1 -1
- package/dist/coordination/calc-coordination.d.ts +1 -1
- package/dist/coordination/calc-coordination.js +28 -25
- package/dist/element/BohrAtom.svelte +5 -8
- package/dist/element/ElementHeading.svelte +4 -1
- package/dist/element/ElementPhoto.svelte +11 -9
- package/dist/element/ElementStats.svelte +12 -10
- package/dist/element/ElementTile.svelte +24 -29
- package/dist/element/Nucleus.svelte +4 -2
- package/dist/element/data.d.ts +1 -2
- package/dist/element/helpers.d.ts +4 -0
- package/dist/element/helpers.js +18 -0
- package/dist/element/index.d.ts +1 -4
- package/dist/element/index.js +3 -18
- package/dist/feedback/DragOverlay.svelte +5 -5
- package/dist/feedback/DragOverlay.svelte.d.ts +2 -2
- package/dist/feedback/StatusMessage.svelte +7 -4
- package/dist/fermi-surface/FermiSlice.svelte +21 -18
- package/dist/fermi-surface/FermiSurface.svelte +14 -22
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +5 -7
- package/dist/fermi-surface/FermiSurfaceControls.svelte +6 -20
- package/dist/fermi-surface/FermiSurfaceControls.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceScene.svelte +37 -64
- package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceTooltip.svelte +9 -6
- package/dist/fermi-surface/compute.js +3 -3
- package/dist/fermi-surface/parse.js +22 -24
- package/dist/heatmap-matrix/HeatmapMatrix.svelte +109 -148
- package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +2 -2
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +9 -7
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +1 -1
- package/dist/heatmap-matrix/index.d.ts +5 -0
- package/dist/icons.d.ts +4 -0
- package/dist/icons.js +4 -0
- package/dist/io/ExportPane.svelte +10 -6
- package/dist/io/decompress.d.ts +2 -1
- package/dist/io/decompress.js +22 -35
- package/dist/io/export.d.ts +4 -0
- package/dist/io/export.js +5 -1
- package/dist/io/fetch.d.ts +0 -3
- package/dist/io/fetch.js +0 -11
- package/dist/io/index.d.ts +0 -1
- package/dist/io/index.js +2 -9
- package/dist/io/is-binary.d.ts +9 -0
- package/dist/io/is-binary.js +45 -1
- package/dist/io/url-drop.js +13 -25
- package/dist/isosurface/Isosurface.svelte +17 -23
- package/dist/isosurface/IsosurfaceControls.svelte +37 -42
- package/dist/isosurface/parse-vaspwave.d.ts +3 -0
- package/dist/isosurface/parse-vaspwave.js +138 -0
- package/dist/isosurface/parse.js +6 -6
- package/dist/labels.d.ts +6 -2
- package/dist/labels.js +43 -13
- package/dist/layout/FullscreenButton.svelte +2 -1
- package/dist/layout/FullscreenToggle.svelte +10 -4
- package/dist/layout/InfoCard.svelte +7 -18
- package/dist/layout/InfoTag.svelte +1 -3
- package/dist/layout/NumberRangeInput.svelte +46 -0
- package/dist/layout/NumberRangeInput.svelte.d.ts +12 -0
- package/dist/layout/PropertyFilter.svelte +2 -6
- package/dist/layout/SettingsSection.svelte +21 -17
- package/dist/layout/SubpageGrid.svelte +3 -1
- package/dist/layout/ViewerChrome.svelte +9 -10
- package/dist/layout/ViewerChrome.svelte.d.ts +2 -1
- package/dist/layout/fullscreen.js +3 -5
- package/dist/layout/fullscreen.svelte.js +1 -2
- package/dist/layout/index.d.ts +1 -0
- package/dist/layout/index.js +1 -0
- package/dist/layout/json-tree/JsonNode.svelte +8 -11
- package/dist/layout/json-tree/JsonTree.svelte +53 -77
- package/dist/layout/json-tree/JsonValue.svelte +7 -15
- package/dist/layout/json-tree/utils.js +14 -23
- package/dist/math.d.ts +2 -0
- package/dist/math.js +19 -0
- package/dist/overlays/ContextMenu.svelte +4 -2
- package/dist/overlays/CopyButton.svelte +11 -5
- package/dist/overlays/DragControlTab.svelte +6 -1
- package/dist/overlays/DraggablePane.svelte +81 -26
- package/dist/overlays/DraggablePane.svelte.d.ts +1 -0
- package/dist/overlays/GlassChip.svelte +30 -0
- package/dist/overlays/GlassChip.svelte.d.ts +8 -0
- package/dist/overlays/InfoPaneCards.svelte +11 -23
- package/dist/overlays/index.d.ts +7 -0
- package/dist/overlays/index.js +26 -0
- package/dist/overlays/portal.d.ts +2 -0
- package/dist/overlays/portal.js +14 -0
- package/dist/periodic-table/PeriodicTable.svelte +113 -145
- package/dist/periodic-table/PeriodicTable.svelte.d.ts +5 -3
- package/dist/periodic-table/PeriodicTableControls.svelte +11 -63
- package/dist/periodic-table/TableInset.svelte +9 -4
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +50 -71
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +6 -8
- package/dist/phase-diagram/PhaseDiagramControls.svelte +70 -94
- package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +1 -1
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +2 -1
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte +12 -12
- package/dist/phase-diagram/PhaseDiagramTooltip.svelte +54 -58
- package/dist/phase-diagram/TdbInfoPanel.svelte +21 -15
- package/dist/phase-diagram/build-diagram.js +3 -3
- package/dist/phase-diagram/diagram-input.d.ts +1 -2
- package/dist/phase-diagram/parse.js +15 -15
- package/dist/phase-diagram/svg-to-diagram.js +21 -15
- package/dist/phase-diagram/utils.js +2 -3
- package/dist/plot/bar/BarPlot.svelte +430 -391
- package/dist/plot/bar/BarPlot.svelte.d.ts +2 -0
- package/dist/plot/bar/BarPlotControls.svelte +1 -3
- package/dist/plot/bar/BarPlotControls.svelte.d.ts +4 -6
- package/dist/plot/bar/SpacegroupBarPlot.svelte +29 -36
- package/dist/plot/bar/data.d.ts +5 -4
- package/dist/plot/bar/data.js +2 -1
- package/dist/plot/box/BoxPlot.svelte +301 -209
- package/dist/plot/box/BoxPlot.svelte.d.ts +2 -0
- package/dist/plot/box/Violin.svelte.d.ts +1 -0
- package/dist/plot/box/box-plot.js +1 -1
- package/dist/plot/core/auto-place.js +1 -1
- package/dist/plot/core/axis-utils.d.ts +12 -7
- package/dist/plot/core/axis-utils.js +48 -48
- package/dist/plot/core/components/AxisLabel.svelte +82 -20
- package/dist/plot/core/components/AxisLabel.svelte.d.ts +1 -0
- package/dist/plot/core/components/ColorBar.svelte +101 -106
- package/dist/plot/core/components/ColorScaleSelect.svelte +1 -1
- package/dist/plot/core/components/FillArea.svelte +10 -17
- package/dist/plot/core/components/HierarchyControls.svelte +249 -0
- package/dist/plot/{sunburst/SunburstControls.svelte.d.ts → core/components/HierarchyControls.svelte.d.ts} +12 -8
- package/dist/plot/core/components/InteractiveAxisLabel.svelte +1 -1
- package/dist/plot/core/components/InteractiveAxisLabel.svelte.d.ts +1 -1
- package/dist/plot/core/components/Line.svelte +18 -9
- package/dist/plot/core/components/Line.svelte.d.ts +2 -0
- package/dist/plot/core/components/PlotAxis.svelte +40 -17
- package/dist/plot/core/components/PlotControls.svelte +65 -41
- package/dist/plot/core/components/PlotLegend.svelte +31 -35
- package/dist/plot/core/components/PlotMarginals.svelte +616 -0
- package/dist/plot/core/components/PlotMarginals.svelte.d.ts +15 -0
- package/dist/plot/core/components/PlotTooltip.svelte +1 -1
- package/dist/plot/core/components/PortalSelect.svelte +4 -8
- package/dist/plot/core/components/ReferenceLine.svelte +27 -24
- package/dist/plot/core/components/ReferenceLine3D.svelte +54 -57
- package/dist/plot/core/components/ReferencePlane.svelte +7 -8
- package/dist/plot/core/components/ZeroLines.svelte +4 -8
- package/dist/plot/core/components/ZoomRect.svelte +1 -2
- package/dist/plot/core/components/index.d.ts +1 -0
- package/dist/plot/core/components/index.js +1 -0
- package/dist/plot/core/data-cleaning-signal.d.ts +46 -0
- package/dist/plot/core/data-cleaning-signal.js +467 -0
- package/dist/plot/core/data-cleaning.d.ts +2 -42
- package/dist/plot/core/data-cleaning.js +27 -474
- package/dist/plot/core/data-transform.js +9 -5
- package/dist/plot/core/fill-utils.d.ts +3 -1
- package/dist/plot/core/fill-utils.js +28 -6
- package/dist/plot/core/index.d.ts +1 -0
- package/dist/plot/core/index.js +1 -0
- package/dist/plot/core/interactions.js +0 -2
- package/dist/plot/core/layout.d.ts +3 -1
- package/dist/plot/core/layout.js +22 -13
- package/dist/plot/core/marginals.d.ts +170 -0
- package/dist/plot/core/marginals.js +436 -0
- package/dist/plot/core/reference-line.js +1 -1
- package/dist/plot/core/scales.d.ts +23 -0
- package/dist/plot/core/scales.js +39 -13
- package/dist/plot/core/types/fills.d.ts +101 -0
- package/dist/plot/core/types/fills.js +15 -0
- package/dist/plot/core/types/plot-3d.d.ts +87 -0
- package/dist/plot/core/types/plot-3d.js +4 -0
- package/dist/plot/core/types/reference-lines.d.ts +140 -0
- package/dist/plot/core/types/reference-lines.js +9 -0
- package/dist/plot/core/types.d.ts +29 -324
- package/dist/plot/core/types.js +23 -20
- package/dist/plot/core/utils/hierarchy-chart.d.ts +51 -0
- package/dist/plot/core/utils/hierarchy-chart.js +179 -0
- package/dist/plot/core/utils/hierarchy-labels.d.ts +20 -0
- package/dist/plot/core/utils/hierarchy-labels.js +99 -0
- package/dist/plot/core/utils/label-placement.js +2 -2
- package/dist/plot/histogram/Histogram.svelte +304 -325
- package/dist/plot/histogram/Histogram.svelte.d.ts +7 -7
- package/dist/plot/histogram/HistogramControls.svelte +30 -28
- package/dist/plot/histogram/histogram.d.ts +31 -0
- package/dist/plot/histogram/histogram.js +70 -0
- package/dist/plot/histogram/index.d.ts +1 -0
- package/dist/plot/histogram/index.js +1 -0
- package/dist/plot/index.d.ts +1 -0
- package/dist/plot/index.js +1 -0
- package/dist/plot/sankey/Sankey.svelte +78 -69
- package/dist/plot/sankey/Sankey.svelte.d.ts +2 -2
- package/dist/plot/sankey/SankeyControls.svelte +22 -16
- package/dist/plot/scatter/BinnedScatterPlot.svelte +263 -109
- package/dist/plot/scatter/BinnedScatterPlot.svelte.d.ts +7 -0
- package/dist/plot/scatter/ElementScatter.svelte +4 -1
- package/dist/plot/scatter/ScatterPlot.svelte +477 -385
- package/dist/plot/scatter/ScatterPlot.svelte.d.ts +2 -0
- package/dist/plot/scatter/ScatterPlotControls.svelte +18 -19
- package/dist/plot/scatter/ScatterPlotControls.svelte.d.ts +1 -1
- package/dist/plot/scatter/ScatterPoint.svelte +16 -9
- package/dist/plot/scatter/binned-scatter-types.d.ts +3 -2
- package/dist/plot/scatter/binned-scatter-types.js +6 -1
- package/dist/plot/scatter/scatter-data.d.ts +1 -1
- package/dist/plot/scatter/scatter-data.js +8 -7
- package/dist/plot/scatter-3d/ScatterPlot3D.svelte +25 -34
- package/dist/plot/scatter-3d/ScatterPlot3D.svelte.d.ts +2 -2
- package/dist/plot/scatter-3d/ScatterPlot3DControls.svelte +8 -5
- package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte +113 -116
- package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte.d.ts +2 -2
- package/dist/plot/scatter-3d/Surface3D.svelte +4 -13
- package/dist/plot/sunburst/Sunburst.svelte +251 -329
- package/dist/plot/sunburst/Sunburst.svelte.d.ts +2 -2
- package/dist/plot/sunburst/index.d.ts +1 -1
- package/dist/plot/sunburst/index.js +2 -1
- package/dist/plot/sunburst/render.d.ts +2 -2
- package/dist/plot/sunburst/render.js +47 -22
- package/dist/plot/sunburst/sunburst.d.ts +5 -1
- package/dist/plot/sunburst/sunburst.js +10 -3
- package/dist/plot/treemap/Treemap.svelte +907 -0
- package/dist/plot/treemap/Treemap.svelte.d.ts +84 -0
- package/dist/plot/treemap/index.d.ts +3 -0
- package/dist/plot/treemap/index.js +4 -0
- package/dist/plot/treemap/treemap.d.ts +26 -0
- package/dist/plot/treemap/treemap.js +99 -0
- package/dist/rdf/RdfPlot.svelte +22 -26
- package/dist/rdf/RdfPlot.svelte.d.ts +1 -1
- package/dist/rdf/calc-rdf.js +4 -8
- package/dist/sanitize.js +1 -1
- package/dist/scene/bind-renderer.svelte.js +14 -6
- package/dist/settings.d.ts +19 -9
- package/dist/settings.js +77 -50
- package/dist/spectral/Bands.svelte +223 -230
- package/dist/spectral/BandsAndDos.svelte +11 -9
- package/dist/spectral/BrillouinBandsDos.svelte +19 -27
- package/dist/spectral/Dos.svelte +70 -73
- package/dist/spectral/helpers.d.ts +3 -3
- package/dist/spectral/helpers.js +25 -35
- package/dist/state.svelte.js +5 -18
- package/dist/structure/Arrow.svelte +5 -18
- package/dist/structure/ArrowInstances.svelte +160 -0
- package/dist/structure/ArrowInstances.svelte.d.ts +16 -0
- package/dist/structure/AtomLegend.svelte +115 -75
- package/dist/structure/AtomLegend.svelte.d.ts +1 -1
- package/dist/structure/Bond.svelte +31 -23
- package/dist/structure/CanvasTooltip.svelte +15 -3
- package/dist/structure/CellSelect.svelte +11 -26
- package/dist/structure/Cylinder.svelte +24 -40
- package/dist/structure/InstancedAtoms.svelte +114 -0
- package/dist/structure/InstancedAtoms.svelte.d.ts +15 -0
- package/dist/structure/Lattice.svelte +85 -149
- package/dist/structure/SiteLabels.svelte +122 -0
- package/dist/structure/SiteLabels.svelte.d.ts +18 -0
- package/dist/structure/Structure.svelte +473 -419
- package/dist/structure/Structure.svelte.d.ts +4 -2
- package/dist/structure/StructureCarousel.svelte +630 -0
- package/dist/structure/StructureCarousel.svelte.d.ts +19 -0
- package/dist/structure/StructureControls.svelte +157 -399
- package/dist/structure/StructureControls.svelte.d.ts +1 -1
- package/dist/structure/StructureExportPane.svelte +17 -21
- package/dist/structure/StructureInfoPane.svelte +72 -66
- package/dist/structure/StructureInfoPane.svelte.d.ts +1 -1
- package/dist/structure/StructureScene.svelte +467 -476
- package/dist/structure/StructureScene.svelte.d.ts +3 -1
- package/dist/structure/StructureViewport.svelte +386 -0
- package/dist/structure/StructureViewport.svelte.d.ts +63 -0
- package/dist/structure/atom-label-placement.d.ts +16 -12
- package/dist/structure/atom-label-placement.js +70 -37
- package/dist/structure/atom-properties.d.ts +2 -0
- package/dist/structure/atom-properties.js +104 -38
- package/dist/structure/bonding.d.ts +10 -3
- package/dist/structure/bonding.js +84 -28
- package/dist/structure/edit-history.d.ts +6 -0
- package/dist/structure/edit-history.js +27 -0
- package/dist/structure/export.d.ts +1 -0
- package/dist/structure/export.js +39 -31
- package/dist/structure/format-detect.d.ts +1 -0
- package/dist/structure/format-detect.js +22 -0
- package/dist/structure/geometry.d.ts +9 -0
- package/dist/structure/geometry.js +27 -0
- package/dist/structure/index.d.ts +16 -1
- package/dist/structure/index.js +13 -2
- package/dist/structure/measure.d.ts +1 -1
- package/dist/structure/measure.js +6 -12
- package/dist/structure/parse.d.ts +2 -1
- package/dist/structure/parse.js +243 -222
- package/dist/structure/partial-occupancy.js +4 -2
- package/dist/structure/pbc.js +78 -98
- package/dist/structure/polyhedra.d.ts +0 -1
- package/dist/structure/polyhedra.js +3 -18
- package/dist/structure/supercell.d.ts +1 -2
- package/dist/structure/supercell.js +7 -13
- package/dist/symmetry/SymmetryElements.svelte +11 -15
- package/dist/symmetry/SymmetryStats.svelte +56 -68
- package/dist/symmetry/WyckoffTable.svelte +5 -24
- package/dist/symmetry/cell-transform.js +1 -0
- package/dist/symmetry/index.d.ts +1 -0
- package/dist/symmetry/index.js +8 -2
- package/dist/symmetry/spacegroups.js +3 -2
- package/dist/table/HeatmapTable.svelte +1102 -365
- package/dist/table/HeatmapTable.svelte.d.ts +12 -2
- package/dist/table/ToggleMenu.svelte +5 -12
- package/dist/table/index.d.ts +21 -6
- package/dist/table/index.js +34 -21
- package/dist/theme/ThemeControl.svelte +16 -8
- package/dist/theme/index.d.ts +1 -5
- package/dist/theme/index.js +4 -10
- package/dist/theme/themes.mjs +14 -7
- package/dist/tooltip/KCoords.svelte +4 -1
- package/dist/tooltip/TooltipContent.svelte +2 -5
- package/dist/trajectory/Trajectory.svelte +515 -308
- package/dist/trajectory/Trajectory.svelte.d.ts +1 -1
- package/dist/trajectory/TrajectoryError.svelte +11 -8
- package/dist/trajectory/TrajectoryExportPane.svelte +14 -31
- package/dist/trajectory/TrajectoryInfoPane.svelte +85 -97
- package/dist/trajectory/extract.js +56 -34
- package/dist/trajectory/format-detect.js +11 -9
- package/dist/trajectory/frame-reader.d.ts +2 -0
- package/dist/trajectory/frame-reader.js +33 -29
- package/dist/trajectory/helpers.d.ts +2 -0
- package/dist/trajectory/helpers.js +18 -7
- package/dist/trajectory/index.d.ts +1 -0
- package/dist/trajectory/index.js +3 -0
- package/dist/trajectory/parse/h5-utils.d.ts +13 -0
- package/dist/trajectory/parse/h5-utils.js +109 -0
- package/dist/trajectory/parse/hdf5.d.ts +1 -1
- package/dist/trajectory/parse/hdf5.js +116 -106
- package/dist/trajectory/parse/index.d.ts +2 -3
- package/dist/trajectory/parse/index.js +17 -20
- package/dist/trajectory/parse/lammps.js +8 -12
- package/dist/trajectory/parse/vasp.js +10 -7
- package/dist/trajectory/parse/vaspout-electronic.d.ts +13 -0
- package/dist/trajectory/parse/vaspout-electronic.js +207 -0
- package/dist/trajectory/parse/vaspout-h5.d.ts +5 -0
- package/dist/trajectory/parse/vaspout-h5.js +284 -0
- package/dist/trajectory/parse/xyz.js +11 -7
- package/dist/trajectory/plotting.d.ts +8 -9
- package/dist/trajectory/plotting.js +99 -27
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +7 -0
- package/dist/xrd/XrdPlot.svelte +47 -61
- package/dist/xrd/broadening.js +2 -1
- package/dist/xrd/calc-xrd.js +2 -4
- package/dist/xrd/parse.d.ts +0 -1
- package/dist/xrd/parse.js +56 -73
- package/package.json +61 -33
- package/dist/api/mp.d.ts +0 -6
- package/dist/api/mp.js +0 -22
- package/dist/plot/sunburst/SunburstControls.svelte +0 -200
|
@@ -12,4 +12,4 @@ export interface CoordinationData {
|
|
|
12
12
|
cn_histogram: Map<number, number>;
|
|
13
13
|
cn_histogram_by_element: Map<string, Map<number, number>>;
|
|
14
14
|
}
|
|
15
|
-
export declare function calc_coordination_nums(structure: AnyStructure, strategy?: BondingStrategy): CoordinationData;
|
|
15
|
+
export declare function calc_coordination_nums(structure: AnyStructure, strategy?: BondingStrategy, center_count?: number): CoordinationData;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BONDING_STRATEGIES } from '../structure/bonding';
|
|
1
|
+
import { BONDING_STRATEGIES, get_majority_element } from '../structure/bonding';
|
|
2
2
|
// Calculate coordination numbers for all sites in a structure using the specified bonding strategy.
|
|
3
3
|
//
|
|
4
4
|
// Note: This function operates on the sites present in the structure. For structures with periodic
|
|
@@ -10,48 +10,51 @@ import { BONDING_STRATEGIES } from '../structure/bonding';
|
|
|
10
10
|
// - Image atoms are appended after the original sites
|
|
11
11
|
// - Bonds will be calculated between original and image atoms
|
|
12
12
|
// - Caller should extract coordination numbers for only the first N sites (original atoms)
|
|
13
|
-
export function calc_coordination_nums(structure, strategy = `electroneg_ratio
|
|
13
|
+
export function calc_coordination_nums(structure, strategy = `electroneg_ratio`,
|
|
14
|
+
// Limit bond centers to the first `center_count` sites (default: all). Callers that
|
|
15
|
+
// appended PBC image atoms pass the original-atom count so images count as neighbors
|
|
16
|
+
// but aren't iterated as centers — identical coordination for the originals, faster.
|
|
17
|
+
center_count) {
|
|
14
18
|
// Get bonds using the specified strategy
|
|
15
|
-
const bonds = BONDING_STRATEGIES[strategy](structure);
|
|
16
|
-
// Count neighbors for each site
|
|
17
|
-
const neighbor_counts = new Map();
|
|
19
|
+
const bonds = BONDING_STRATEGIES[strategy](structure, { center_count });
|
|
18
20
|
const sites = structure.sites;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (neighbors_1)
|
|
30
|
-
neighbors_1.add(site_idx_2);
|
|
31
|
-
if (neighbors_2)
|
|
32
|
-
neighbors_2.add(site_idx_1);
|
|
21
|
+
// Build adjacency sets: each bond adds both endpoints to the other's neighbor set
|
|
22
|
+
const neighbor_counts = new Map();
|
|
23
|
+
const add_neighbor = (site_idx, neighbor_idx) => {
|
|
24
|
+
const neighbors = neighbor_counts.get(site_idx) ?? new Set();
|
|
25
|
+
neighbors.add(neighbor_idx);
|
|
26
|
+
neighbor_counts.set(site_idx, neighbors);
|
|
27
|
+
};
|
|
28
|
+
for (const { site_idx_1, site_idx_2 } of bonds) {
|
|
29
|
+
add_neighbor(site_idx_1, site_idx_2);
|
|
30
|
+
add_neighbor(site_idx_2, site_idx_1);
|
|
33
31
|
}
|
|
34
32
|
// Build coordination site data
|
|
35
33
|
const coordination_sites = [];
|
|
36
34
|
const cn_by_element = new Map();
|
|
37
35
|
const cn_histogram = new Map();
|
|
38
36
|
const cn_histogram_by_element = new Map();
|
|
37
|
+
const inc = (map, key) => map.set(key, (map.get(key) ?? 0) + 1);
|
|
38
|
+
// PBC-expanded structures pass center_count: only the first center_count sites are real
|
|
39
|
+
// centers; image atoms still count as neighbors but aren't iterated as centers
|
|
40
|
+
const center_limit = center_count ?? sites.length;
|
|
39
41
|
for (const [site_idx, site] of sites.entries()) {
|
|
40
|
-
|
|
42
|
+
if (site_idx >= center_limit)
|
|
43
|
+
break;
|
|
44
|
+
const element = get_majority_element(site) ?? `Unknown`;
|
|
41
45
|
const neighbors_set = neighbor_counts.get(site_idx) ?? new Set();
|
|
42
46
|
const coordination_num = neighbors_set.size;
|
|
43
47
|
// Get neighbor elements
|
|
44
|
-
const neighbor_elements = Array.from(neighbors_set).map((neighbor_idx) => sites[neighbor_idx]
|
|
48
|
+
const neighbor_elements = Array.from(neighbors_set).map((neighbor_idx) => get_majority_element(sites[neighbor_idx]) ?? `Unknown`);
|
|
45
49
|
coordination_sites.push({ site_idx, element, coordination_num, neighbor_elements });
|
|
46
50
|
// Update cn_by_element
|
|
47
51
|
const element_array = cn_by_element.get(element) ?? [];
|
|
48
52
|
element_array.push(coordination_num);
|
|
49
53
|
cn_by_element.set(element, element_array);
|
|
50
|
-
// Update overall
|
|
51
|
-
cn_histogram
|
|
52
|
-
// Update cn_histogram_by_element
|
|
54
|
+
// Update overall + per-element histograms
|
|
55
|
+
inc(cn_histogram, coordination_num);
|
|
53
56
|
const element_histogram = cn_histogram_by_element.get(element) ?? new Map();
|
|
54
|
-
element_histogram
|
|
57
|
+
inc(element_histogram, coordination_num);
|
|
55
58
|
cn_histogram_by_element.set(element, element_histogram);
|
|
56
59
|
}
|
|
57
60
|
return {
|
|
@@ -33,11 +33,7 @@
|
|
|
33
33
|
electron_props?: Record<string, string | number>
|
|
34
34
|
highlight_shell?: number | null
|
|
35
35
|
// if function, it'll be called with electron index and should return a string
|
|
36
|
-
number_electrons?:
|
|
37
|
-
| boolean
|
|
38
|
-
| `hierarchical`
|
|
39
|
-
| `sequential`
|
|
40
|
-
| ((idx: number) => string)
|
|
36
|
+
number_electrons?: boolean | `hierarchical` | `sequential` | ((idx: number) => string)
|
|
41
37
|
electron_label_props?: Record<string, string | number>
|
|
42
38
|
} = $props()
|
|
43
39
|
|
|
@@ -68,7 +64,7 @@
|
|
|
68
64
|
fill={base_fill}
|
|
69
65
|
{viewBox}
|
|
70
66
|
role={name || symbol ? `img` : undefined}
|
|
71
|
-
aria-label={
|
|
67
|
+
aria-label={name || symbol || undefined}
|
|
72
68
|
aria-hidden={name || symbol ? undefined : `true`}
|
|
73
69
|
{...rest}
|
|
74
70
|
>
|
|
@@ -116,8 +112,9 @@
|
|
|
116
112
|
<!-- {:else if [`sequential`, true].includes(number_electrons)} -->
|
|
117
113
|
{:else}
|
|
118
114
|
{@const nth_electron =
|
|
119
|
-
|
|
120
|
-
|
|
115
|
+
shells.slice(0, shell_idx).reduce((sum, count) => sum + count, 0) +
|
|
116
|
+
elec_idx +
|
|
117
|
+
1}
|
|
121
118
|
{nth_electron}
|
|
122
119
|
{/if}
|
|
123
120
|
</text>
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
import type { ChemicalElement } from './'
|
|
3
3
|
import type { HTMLAttributes } from 'svelte/elements'
|
|
4
4
|
|
|
5
|
-
let {
|
|
5
|
+
let {
|
|
6
|
+
element,
|
|
7
|
+
...rest
|
|
8
|
+
}: HTMLAttributes<HTMLHeadingElement> & {
|
|
6
9
|
element: ChemicalElement
|
|
7
10
|
} = $props()
|
|
8
11
|
</script>
|
|
@@ -3,9 +3,14 @@
|
|
|
3
3
|
import Icon from '../Icon.svelte'
|
|
4
4
|
import type { HTMLAttributes } from 'svelte/elements'
|
|
5
5
|
|
|
6
|
-
let {
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
let {
|
|
7
|
+
element,
|
|
8
|
+
missing_msg = `No image for `,
|
|
9
|
+
...rest
|
|
10
|
+
}: HTMLAttributes<HTMLImageElement | HTMLDivElement> & {
|
|
11
|
+
element: ChemicalElement
|
|
12
|
+
missing_msg?: string
|
|
13
|
+
} = $props()
|
|
9
14
|
|
|
10
15
|
let { name, number } = $derived(element ?? {})
|
|
11
16
|
let file = $derived(`elements/${number}-${name?.toLowerCase()}.avif`)
|
|
@@ -21,7 +26,8 @@
|
|
|
21
26
|
{#if hidden && missing_msg}
|
|
22
27
|
<div {...rest}>
|
|
23
28
|
<span>
|
|
24
|
-
<Icon icon="NoImage" /> {missing_msg}
|
|
29
|
+
<Icon icon="NoImage" /> {missing_msg}
|
|
30
|
+
{name}
|
|
25
31
|
</span>
|
|
26
32
|
</div>
|
|
27
33
|
{/if}
|
|
@@ -41,11 +47,7 @@
|
|
|
41
47
|
padding: var(--element-photo-padding, 3pt);
|
|
42
48
|
box-sizing: border-box;
|
|
43
49
|
place-items: center;
|
|
44
|
-
background-image: linear-gradient(
|
|
45
|
-
to top left,
|
|
46
|
-
rgba(0, 100, 0, 0.5),
|
|
47
|
-
rgba(0, 0, 100, 0.3)
|
|
48
|
-
);
|
|
50
|
+
background-image: linear-gradient(to top left, rgba(0, 100, 0, 0.5), rgba(0, 0, 100, 0.3));
|
|
49
51
|
color: var(--text-color);
|
|
50
52
|
border-radius: var(--element-photo-border-radius, var(--border-radius, 3pt));
|
|
51
53
|
width: 100%;
|
|
@@ -5,24 +5,25 @@
|
|
|
5
5
|
import ElementHeading from './ElementHeading.svelte'
|
|
6
6
|
import type { HTMLAttributes } from 'svelte/elements'
|
|
7
7
|
|
|
8
|
-
let {
|
|
8
|
+
let {
|
|
9
|
+
element,
|
|
10
|
+
...rest
|
|
11
|
+
}: HTMLAttributes<HTMLDivElement> & {
|
|
9
12
|
element: ChemicalElement | null
|
|
10
13
|
} = $props()
|
|
11
14
|
</script>
|
|
12
15
|
|
|
13
16
|
{#if element}
|
|
14
17
|
<div {...rest}>
|
|
15
|
-
<ElementHeading
|
|
16
|
-
{element}
|
|
17
|
-
style="font-size: 6cqw; grid-column: 1/-1; margin: auto 0 0"
|
|
18
|
-
/>
|
|
18
|
+
<ElementHeading {element} style="font-size: 6cqw; grid-column: 1/-1; margin: auto 0 0" />
|
|
19
19
|
<section>
|
|
20
20
|
<p>
|
|
21
21
|
Atomic Mass
|
|
22
22
|
<abbr title="Dalton aka atomic mass unit">(u)</abbr>
|
|
23
23
|
</p>
|
|
24
24
|
<strong>
|
|
25
|
-
<Icon icon="Weight" />
|
|
25
|
+
<Icon icon="Weight" />
|
|
26
|
+
{format_num(element.atomic_mass)}
|
|
26
27
|
</strong>
|
|
27
28
|
</section>
|
|
28
29
|
<section>
|
|
@@ -31,18 +32,19 @@
|
|
|
31
32
|
<abbr title="grams per cubic centimeter">(g/cm³)</abbr>
|
|
32
33
|
</p>
|
|
33
34
|
<strong>
|
|
34
|
-
<Icon icon="Scale" />
|
|
35
|
+
<Icon icon="Scale" />
|
|
36
|
+
{format_num(element.density)}
|
|
35
37
|
</strong>
|
|
36
38
|
</section>
|
|
37
39
|
<section>
|
|
38
40
|
<p>Phase</p>
|
|
39
|
-
<strong>
|
|
40
|
-
<Icon icon={element.phase} /> {element.phase}</strong>
|
|
41
|
+
<strong> <Icon icon={element.phase} /> {element.phase}</strong>
|
|
41
42
|
</section>
|
|
42
43
|
<section>
|
|
43
44
|
<p>Year of Discovery</p>
|
|
44
45
|
<strong>
|
|
45
|
-
<Icon icon="CalendarBlank" />
|
|
46
|
+
<Icon icon="CalendarBlank" />
|
|
47
|
+
{element.year}
|
|
46
48
|
</strong>
|
|
47
49
|
</section>
|
|
48
50
|
</div>
|
|
@@ -5,12 +5,7 @@
|
|
|
5
5
|
import { colors, selected } from '../state.svelte'
|
|
6
6
|
import type { HTMLAttributes } from 'svelte/elements'
|
|
7
7
|
|
|
8
|
-
type SplitLayout =
|
|
9
|
-
| `diagonal`
|
|
10
|
-
| `horizontal`
|
|
11
|
-
| `vertical`
|
|
12
|
-
| `triangular`
|
|
13
|
-
| `quadrant`
|
|
8
|
+
type SplitLayout = `diagonal` | `horizontal` | `vertical` | `triangular` | `quadrant`
|
|
14
9
|
let {
|
|
15
10
|
element,
|
|
16
11
|
bg_color = undefined,
|
|
@@ -56,9 +51,7 @@
|
|
|
56
51
|
} = $props()
|
|
57
52
|
|
|
58
53
|
// background color defaults to category color (initialized in colors/index.ts, user editable in PeriodicTableControls.svelte)
|
|
59
|
-
let fallback_bg_color = $derived(
|
|
60
|
-
bg_color ?? colors.category[element.category] ?? `#cccccc`,
|
|
61
|
-
)
|
|
54
|
+
let fallback_bg_color = $derived(bg_color ?? colors.category[element.category] ?? `#cccccc`)
|
|
62
55
|
|
|
63
56
|
// Compute contrast text color from background when in heatmap mode (single bg_color)
|
|
64
57
|
let computed_text_color = $derived(
|
|
@@ -85,7 +78,7 @@
|
|
|
85
78
|
|
|
86
79
|
// Handle string values - check if it's a numeric string
|
|
87
80
|
if (typeof val === `string`) {
|
|
88
|
-
const parsed_num =
|
|
81
|
+
const parsed_num = Number(val)
|
|
89
82
|
if (isFinite(parsed_num)) return format_num(parsed_num, float_fmt)
|
|
90
83
|
// If show_values is true, return the string as-is to preserve non-numeric strings
|
|
91
84
|
return show_values === true ? val : ``
|
|
@@ -107,11 +100,13 @@
|
|
|
107
100
|
|
|
108
101
|
const count = value.length
|
|
109
102
|
// Use explicit split_layout or auto-determine based on count
|
|
110
|
-
const layout =
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
103
|
+
const layout =
|
|
104
|
+
split_layout ??
|
|
105
|
+
({
|
|
106
|
+
2: `diagonal`,
|
|
107
|
+
3: `horizontal`,
|
|
108
|
+
4: `quadrant`,
|
|
109
|
+
}[count] as SplitLayout | undefined)
|
|
115
110
|
|
|
116
111
|
if (!layout) return null
|
|
117
112
|
|
|
@@ -139,9 +134,7 @@
|
|
|
139
134
|
if (layout === `triangular` && count === 4) {
|
|
140
135
|
return {
|
|
141
136
|
segments: [`top`, `right`, `bottom`, `left`].map((pos) => `triangle-${pos}`),
|
|
142
|
-
positions: [`top`, `right`, `bottom`, `left`].map((pos) =>
|
|
143
|
-
`triangle-${pos}-pos`
|
|
144
|
-
),
|
|
137
|
+
positions: [`top`, `right`, `bottom`, `left`].map((pos) => `triangle-${pos}-pos`),
|
|
145
138
|
}
|
|
146
139
|
}
|
|
147
140
|
|
|
@@ -158,16 +151,18 @@
|
|
|
158
151
|
<svelte:element
|
|
159
152
|
this={href ? `a` : `div`}
|
|
160
153
|
bind:this={node}
|
|
161
|
-
{...
|
|
154
|
+
{...href ? { href } : {}}
|
|
162
155
|
class="element-tile"
|
|
163
156
|
data-category={element.category}
|
|
164
157
|
class:active
|
|
165
158
|
class:last-active={selected.last_element === element}
|
|
166
159
|
class:clickable={Boolean(onclick)}
|
|
167
|
-
style:background-color={Array.isArray(value) && bg_colors?.length > 1
|
|
160
|
+
style:background-color={Array.isArray(value) && bg_colors?.length > 1
|
|
161
|
+
? `transparent`
|
|
162
|
+
: fallback_bg_color}
|
|
168
163
|
style:color={computed_text_color}
|
|
169
164
|
{@attach computed_text_color ? null : contrast_color()}
|
|
170
|
-
{...
|
|
165
|
+
{...href ? { role: `link`, tabindex: 0 } : {}}
|
|
171
166
|
onclick={(event: MouseEvent) => onclick?.({ element, event })}
|
|
172
167
|
{...rest}
|
|
173
168
|
>
|
|
@@ -189,11 +184,11 @@
|
|
|
189
184
|
<span
|
|
190
185
|
class="value multi-value {layout_config.positions[idx]}"
|
|
191
186
|
style:color={bg_colors?.[idx]
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
187
|
+
? pick_contrast_color({
|
|
188
|
+
bg_color: bg_colors[idx] ?? fallback_bg_color,
|
|
189
|
+
luminance_threshold,
|
|
190
|
+
})
|
|
191
|
+
: null}
|
|
197
192
|
>
|
|
198
193
|
{format_value(val)}
|
|
199
194
|
</span>
|
|
@@ -219,8 +214,7 @@
|
|
|
219
214
|
<div
|
|
220
215
|
class="segment {layout_config.segments[idx]}"
|
|
221
216
|
style:background-color={bg_color}
|
|
222
|
-
>
|
|
223
|
-
</div>
|
|
217
|
+
></div>
|
|
224
218
|
{/if}
|
|
225
219
|
{/each}
|
|
226
220
|
{/if}
|
|
@@ -247,7 +241,8 @@
|
|
|
247
241
|
.element-tile span {
|
|
248
242
|
line-height: 1em;
|
|
249
243
|
}
|
|
250
|
-
.element-tile.active,
|
|
244
|
+
.element-tile.active,
|
|
245
|
+
.element-tile:hover {
|
|
251
246
|
border: var(--elem-tile-active-border, 1px solid currentColor);
|
|
252
247
|
}
|
|
253
248
|
.element-tile.clickable {
|
|
@@ -64,7 +64,8 @@
|
|
|
64
64
|
y={radius + (radius / 2) * Math.sin(Math.PI * -proton_frac)}
|
|
65
65
|
{...text}
|
|
66
66
|
>
|
|
67
|
-
{protons}
|
|
67
|
+
{protons}
|
|
68
|
+
{proton_label}
|
|
68
69
|
</text>
|
|
69
70
|
|
|
70
71
|
<text
|
|
@@ -72,7 +73,8 @@
|
|
|
72
73
|
y={radius + (radius / 2) * Math.sin(Math.PI * neutron_frac)}
|
|
73
74
|
{...text}
|
|
74
75
|
>
|
|
75
|
-
{neutrons}
|
|
76
|
+
{neutrons}
|
|
77
|
+
{neutron_label}
|
|
76
78
|
</text>
|
|
77
79
|
|
|
78
80
|
{#if symbol}
|
package/dist/element/data.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default data;
|
|
1
|
+
export { default } from './data.json.gz';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ElementSymbol } from './types';
|
|
2
|
+
export declare const is_elem_symbol: (symbol: string) => symbol is ElementSymbol;
|
|
3
|
+
export declare const coerce_elem_symbol: (symbol: string) => ElementSymbol | undefined;
|
|
4
|
+
export declare const FALLBACK_ELEMENTS: readonly ["H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne"];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ELEM_SYMBOLS } from '../labels';
|
|
2
|
+
// Set-backed O(1) element-symbol guard shared by all parsers
|
|
3
|
+
const ELEM_SYMBOL_SET = new Set(ELEM_SYMBOLS);
|
|
4
|
+
export const is_elem_symbol = (symbol) => ELEM_SYMBOL_SET.has(symbol);
|
|
5
|
+
export const coerce_elem_symbol = (symbol) => is_elem_symbol(symbol) ? symbol : undefined;
|
|
6
|
+
// Default element symbols used when a file omits or mangles element info
|
|
7
|
+
export const FALLBACK_ELEMENTS = [
|
|
8
|
+
`H`,
|
|
9
|
+
`He`,
|
|
10
|
+
`Li`,
|
|
11
|
+
`Be`,
|
|
12
|
+
`B`,
|
|
13
|
+
`C`,
|
|
14
|
+
`N`,
|
|
15
|
+
`O`,
|
|
16
|
+
`F`,
|
|
17
|
+
`Ne`,
|
|
18
|
+
];
|
package/dist/element/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ElementSymbol } from './types';
|
|
2
1
|
export type * from './types';
|
|
3
2
|
export { default as BohrAtom } from './BohrAtom.svelte';
|
|
4
3
|
export { default as element_data } from './data';
|
|
@@ -6,7 +5,5 @@ export { default as ElementHeading } from './ElementHeading.svelte';
|
|
|
6
5
|
export { default as ElementPhoto } from './ElementPhoto.svelte';
|
|
7
6
|
export { default as ElementStats } from './ElementStats.svelte';
|
|
8
7
|
export { default as ElementTile } from './ElementTile.svelte';
|
|
8
|
+
export * from './helpers';
|
|
9
9
|
export { default as Nucleus } from './Nucleus.svelte';
|
|
10
|
-
export declare const is_elem_symbol: (symbol: string) => symbol is ElementSymbol;
|
|
11
|
-
export declare const coerce_elem_symbol: (symbol: string) => ElementSymbol | undefined;
|
|
12
|
-
export declare const FALLBACK_ELEMENTS: readonly ["H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne"];
|
package/dist/element/index.js
CHANGED
|
@@ -1,25 +1,10 @@
|
|
|
1
|
-
import { ELEM_SYMBOLS } from '../labels';
|
|
2
1
|
export { default as BohrAtom } from './BohrAtom.svelte';
|
|
3
2
|
export { default as element_data } from './data';
|
|
4
3
|
export { default as ElementHeading } from './ElementHeading.svelte';
|
|
5
4
|
export { default as ElementPhoto } from './ElementPhoto.svelte';
|
|
6
5
|
export { default as ElementStats } from './ElementStats.svelte';
|
|
7
6
|
export { default as ElementTile } from './ElementTile.svelte';
|
|
7
|
+
// Pure helpers live in ./helpers (no Svelte imports) so parser modules can use
|
|
8
|
+
// them inside Web Workers; re-exported here for everyone else.
|
|
9
|
+
export * from './helpers';
|
|
8
10
|
export { default as Nucleus } from './Nucleus.svelte';
|
|
9
|
-
// Set-backed O(1) element-symbol guard shared by all parsers
|
|
10
|
-
const ELEM_SYMBOL_SET = new Set(ELEM_SYMBOLS);
|
|
11
|
-
export const is_elem_symbol = (symbol) => ELEM_SYMBOL_SET.has(symbol);
|
|
12
|
-
export const coerce_elem_symbol = (symbol) => is_elem_symbol(symbol) ? symbol : undefined;
|
|
13
|
-
// Default element symbols used when a file omits or mangles element info
|
|
14
|
-
export const FALLBACK_ELEMENTS = [
|
|
15
|
-
`H`,
|
|
16
|
-
`He`,
|
|
17
|
-
`Li`,
|
|
18
|
-
`Be`,
|
|
19
|
-
`B`,
|
|
20
|
-
`C`,
|
|
21
|
-
`N`,
|
|
22
|
-
`O`,
|
|
23
|
-
`F`,
|
|
24
|
-
`Ne`,
|
|
25
|
-
];
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import Icon from '../Icon.svelte'
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
3
4
|
|
|
4
5
|
let {
|
|
5
6
|
visible = false,
|
|
6
|
-
message = `Drop
|
|
7
|
-
|
|
7
|
+
message = `Drop file to load`,
|
|
8
|
+
...rest
|
|
8
9
|
}: {
|
|
9
10
|
visible?: boolean
|
|
10
11
|
message?: string
|
|
11
|
-
|
|
12
|
-
} = $props()
|
|
12
|
+
} & HTMLAttributes<HTMLDivElement> = $props()
|
|
13
13
|
</script>
|
|
14
14
|
|
|
15
15
|
{#if visible}
|
|
16
|
-
<div class=
|
|
16
|
+
<div {...rest} class={[`drag-overlay`, rest.class]}>
|
|
17
17
|
<div class="drag-message">
|
|
18
18
|
<Icon icon="Info" />
|
|
19
19
|
<span>{message}</span>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
1
2
|
type $$ComponentProps = {
|
|
2
3
|
visible?: boolean;
|
|
3
4
|
message?: string;
|
|
4
|
-
|
|
5
|
-
};
|
|
5
|
+
} & HTMLAttributes<HTMLDivElement>;
|
|
6
6
|
declare const DragOverlay: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
7
|
type DragOverlay = ReturnType<typeof DragOverlay>;
|
|
8
8
|
export default DragOverlay;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements'
|
|
3
3
|
|
|
4
|
-
let {
|
|
4
|
+
let {
|
|
5
|
+
message = $bindable(),
|
|
6
|
+
type = `info`,
|
|
7
|
+
dismissible = false,
|
|
8
|
+
...rest
|
|
9
|
+
}: {
|
|
5
10
|
message?: string
|
|
6
11
|
type?: `info` | `error` | `warning`
|
|
7
12
|
dismissible?: boolean
|
|
@@ -17,9 +22,7 @@
|
|
|
17
22
|
>
|
|
18
23
|
{message}
|
|
19
24
|
{#if dismissible}
|
|
20
|
-
<button onclick={() => (message = undefined)} aria-label="Dismiss message">
|
|
21
|
-
✕
|
|
22
|
-
</button>
|
|
25
|
+
<button onclick={() => (message = undefined)} aria-label="Dismiss message"> ✕ </button>
|
|
23
26
|
{/if}
|
|
24
27
|
</div>
|
|
25
28
|
{/if}
|
|
@@ -86,7 +86,10 @@
|
|
|
86
86
|
const isolines = slice_data?.isolines
|
|
87
87
|
if (!isolines?.length) return { min: [-1, -1], max: [1, 1] }
|
|
88
88
|
|
|
89
|
-
let xmin = Infinity,
|
|
89
|
+
let xmin = Infinity,
|
|
90
|
+
xmax = -Infinity,
|
|
91
|
+
ymin = Infinity,
|
|
92
|
+
ymax = -Infinity
|
|
90
93
|
for (const iso of isolines) {
|
|
91
94
|
for (const pt of iso.points_2d) {
|
|
92
95
|
if (pt[0] < xmin) xmin = pt[0]
|
|
@@ -97,13 +100,14 @@
|
|
|
97
100
|
}
|
|
98
101
|
if (!isFinite(xmin)) return { min: [-1, -1], max: [1, 1] }
|
|
99
102
|
|
|
100
|
-
const pad = 0.1,
|
|
103
|
+
const pad = 0.1,
|
|
104
|
+
rx = xmax - xmin || 1,
|
|
105
|
+
ry = ymax - ymin || 1
|
|
101
106
|
return {
|
|
102
107
|
min: [xmin - rx * pad, ymin - ry * pad],
|
|
103
108
|
max: [xmax + rx * pad, ymax + ry * pad],
|
|
104
109
|
}
|
|
105
110
|
})
|
|
106
|
-
|
|
107
111
|
function toggle_band(series_idx: number) {
|
|
108
112
|
const band = slice_data?.isolines[series_idx]?.band_index
|
|
109
113
|
if (band === undefined) return
|
|
@@ -114,9 +118,7 @@
|
|
|
114
118
|
function isolate_band(series_idx: number) {
|
|
115
119
|
const band = slice_data?.isolines[series_idx]?.band_index
|
|
116
120
|
if (band === undefined) return
|
|
117
|
-
const all_bands = [
|
|
118
|
-
...new Set(slice_data?.isolines.map((iso) => iso.band_index)),
|
|
119
|
-
]
|
|
121
|
+
const all_bands = [...new Set(slice_data?.isolines.map((iso) => iso.band_index))]
|
|
120
122
|
const is_solo = all_bands.every((bid) => bid === band || hidden_bands.has(bid))
|
|
121
123
|
hidden_bands.clear()
|
|
122
124
|
if (!is_solo) {
|
|
@@ -127,8 +129,7 @@
|
|
|
127
129
|
}
|
|
128
130
|
|
|
129
131
|
// Returns null if SVG not found, making export failures explicit
|
|
130
|
-
const export_svg = (): string | null =>
|
|
131
|
-
wrapper?.querySelector(`svg`)?.outerHTML ?? null
|
|
132
|
+
const export_svg = (): string | null => wrapper?.querySelector(`svg`)?.outerHTML ?? null
|
|
132
133
|
</script>
|
|
133
134
|
|
|
134
135
|
<ScatterPlot
|
|
@@ -143,16 +144,16 @@
|
|
|
143
144
|
controls={{ show: false }}
|
|
144
145
|
fullscreen_toggle={false}
|
|
145
146
|
legend={show_legend && series.length > 0
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
147
|
+
? {
|
|
148
|
+
on_toggle: toggle_band,
|
|
149
|
+
on_double_click: isolate_band,
|
|
150
|
+
draggable: false,
|
|
151
|
+
// pin bottom-right so it clears the top-left title/controls overlay (e.g. in the demo)
|
|
152
|
+
style: `left: auto; top: auto; right: 8px; bottom: 8px`,
|
|
153
|
+
}
|
|
154
|
+
: null}
|
|
154
155
|
padding={{ t: 5, b: 5, l: 5, r: 5 }}
|
|
155
|
-
class=
|
|
156
|
+
class={[`fermi-slice`, rest.class]}
|
|
156
157
|
style={rest.style}
|
|
157
158
|
>
|
|
158
159
|
{#snippet user_content({ x_scale_fn, y_scale_fn, pad, width, height })}
|
|
@@ -192,6 +193,8 @@
|
|
|
192
193
|
}
|
|
193
194
|
.fermi-label {
|
|
194
195
|
fill: var(--fermi-surface-axis-color, #888);
|
|
195
|
-
font:
|
|
196
|
+
font:
|
|
197
|
+
12px system-ui,
|
|
198
|
+
sans-serif;
|
|
196
199
|
}
|
|
197
200
|
</style>
|