matterviz 0.4.0 → 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 +132 -219
- package/dist/brillouin/BrillouinZone.svelte.d.ts +9 -20
- package/dist/brillouin/BrillouinZoneControls.svelte +3 -6
- package/dist/brillouin/BrillouinZoneExportPane.svelte +47 -96
- package/dist/brillouin/BrillouinZoneExportPane.svelte.d.ts +1 -1
- package/dist/brillouin/BrillouinZoneInfoPane.svelte +15 -42
- package/dist/brillouin/BrillouinZoneInfoPane.svelte.d.ts +2 -3
- package/dist/brillouin/BrillouinZoneScene.svelte +63 -230
- package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +3 -23
- 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 +80 -77
- 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 +33 -38
- package/dist/chempot-diagram/ChemPotDiagram.svelte.d.ts +1 -1
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +143 -246
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +4 -1
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +652 -976
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +7 -1
- package/dist/chempot-diagram/async-compute.svelte.js +1 -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 +3 -3
- package/dist/chempot-diagram/compute.js +3 -1
- 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.d.ts +0 -4
- package/dist/colors/index.js +21 -22
- 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 +96 -98
- package/dist/composition/PieChart.svelte +60 -46
- package/dist/composition/chem-sys.js +3 -2
- package/dist/composition/format.js +4 -3
- package/dist/composition/index.d.ts +2 -0
- package/dist/composition/index.js +14 -0
- package/dist/composition/parse.d.ts +2 -3
- package/dist/composition/parse.js +27 -28
- package/dist/constants.js +11 -9
- package/dist/controls.d.ts +1 -0
- package/dist/controls.js +0 -1
- package/dist/convex-hull/ConvexHull.svelte +20 -25
- package/dist/convex-hull/ConvexHull.svelte.d.ts +1 -4
- package/dist/convex-hull/ConvexHull2D.svelte +176 -256
- package/dist/convex-hull/ConvexHull2D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull3D.svelte +269 -804
- package/dist/convex-hull/ConvexHull3D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull4D.svelte +236 -755
- package/dist/convex-hull/ConvexHull4D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHullChrome.svelte +264 -0
- package/dist/convex-hull/ConvexHullChrome.svelte.d.ts +30 -0
- package/dist/convex-hull/ConvexHullControls.svelte +128 -49
- 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 +210 -351
- package/dist/convex-hull/ConvexHullStats.svelte.d.ts +3 -1
- package/dist/convex-hull/ConvexHullTooltip.svelte +16 -14
- package/dist/convex-hull/ConvexHullTooltip.svelte.d.ts +2 -1
- 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/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 +279 -0
- package/dist/convex-hull/helpers.d.ts +47 -17
- package/dist/convex-hull/helpers.js +186 -101
- 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 +9 -7
- package/dist/convex-hull/index.js +7 -2
- package/dist/convex-hull/thermodynamics.js +109 -937
- package/dist/convex-hull/types.d.ts +12 -4
- package/dist/convex-hull/types.js +12 -0
- package/dist/coordination/CoordinationBarPlot.svelte +41 -43
- 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 +6 -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/ElementTile.svelte.d.ts +1 -1
- 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 -0
- package/dist/element/index.js +3 -0
- package/dist/feedback/DragOverlay.svelte +5 -3
- package/dist/feedback/DragOverlay.svelte.d.ts +2 -1
- package/dist/feedback/StatusMessage.svelte +20 -7
- package/dist/fermi-surface/FermiSlice.svelte +21 -18
- package/dist/fermi-surface/FermiSurface.svelte +78 -165
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +9 -20
- package/dist/fermi-surface/FermiSurfaceControls.svelte +6 -20
- package/dist/fermi-surface/FermiSurfaceScene.svelte +93 -272
- package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +3 -23
- package/dist/fermi-surface/FermiSurfaceTooltip.svelte +9 -6
- package/dist/fermi-surface/compute.js +14 -13
- package/dist/fermi-surface/export.js +4 -15
- 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 +84 -97
- package/dist/fermi-surface/types.d.ts +2 -2
- package/dist/heatmap-matrix/HeatmapMatrix.svelte +161 -185
- package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +6 -5
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +12 -9
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +5 -5
- package/dist/heatmap-matrix/index.d.ts +8 -2
- package/dist/icons.d.ts +4 -0
- package/dist/icons.js +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/io/ExportPane.svelte +170 -0
- package/dist/io/ExportPane.svelte.d.ts +17 -0
- package/dist/io/decompress.d.ts +2 -1
- package/dist/io/decompress.js +22 -36
- package/dist/io/export.d.ts +9 -1
- package/dist/io/export.js +37 -29
- package/dist/io/fetch.d.ts +2 -4
- package/dist/io/fetch.js +0 -11
- package/dist/io/file-drop.d.ts +7 -0
- package/dist/io/file-drop.js +13 -0
- package/dist/io/index.d.ts +1 -0
- package/dist/io/index.js +3 -0
- package/dist/io/is-binary.d.ts +9 -0
- package/dist/io/is-binary.js +45 -1
- package/dist/io/types.d.ts +13 -0
- 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 +50 -48
- package/dist/labels.d.ts +6 -2
- package/dist/labels.js +44 -14
- package/dist/layout/FullscreenButton.svelte +34 -0
- package/dist/layout/FullscreenButton.svelte.d.ts +10 -0
- package/dist/layout/FullscreenToggle.svelte +12 -12
- 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 +115 -0
- package/dist/layout/ViewerChrome.svelte.d.ts +18 -0
- package/dist/layout/fullscreen.d.ts +4 -0
- package/dist/layout/fullscreen.js +3 -5
- package/dist/layout/fullscreen.svelte.d.ts +8 -0
- package/dist/layout/fullscreen.svelte.js +36 -0
- package/dist/layout/index.d.ts +4 -0
- package/dist/layout/index.js +4 -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 +9 -3
- package/dist/math.js +37 -21
- 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 +11 -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 +115 -146
- 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 +73 -96
- 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 +49 -134
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte.d.ts +3 -4
- 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/colors.js +1 -1
- package/dist/phase-diagram/diagram-input.d.ts +1 -2
- package/dist/phase-diagram/parse.d.ts +2 -1
- 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 +494 -692
- package/dist/plot/bar/BarPlot.svelte.d.ts +9 -15
- package/dist/plot/bar/BarPlotControls.svelte +1 -3
- package/dist/plot/bar/BarPlotControls.svelte.d.ts +5 -7
- package/dist/plot/bar/SpacegroupBarPlot.svelte +31 -37
- package/dist/plot/bar/data.d.ts +5 -4
- package/dist/plot/bar/data.js +2 -1
- package/dist/plot/box/BoxPlot.svelte +361 -439
- package/dist/plot/box/BoxPlot.svelte.d.ts +6 -3
- package/dist/plot/box/BoxPlotControls.svelte.d.ts +1 -1
- package/dist/plot/box/Violin.svelte.d.ts +2 -1
- package/dist/plot/box/box-plot.d.ts +3 -2
- package/dist/plot/box/box-plot.js +6 -3
- package/dist/plot/box/kde.d.ts +2 -1
- package/dist/plot/box/kde.js +4 -4
- package/dist/plot/core/auto-place.d.ts +1 -1
- package/dist/plot/core/auto-place.js +5 -2
- 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 +106 -111
- package/dist/plot/core/components/ColorBar.svelte.d.ts +5 -4
- 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 +21 -11
- package/dist/plot/core/components/Line.svelte.d.ts +5 -2
- package/dist/plot/core/components/PlotAxis.svelte +42 -18
- package/dist/plot/core/components/PlotAxis.svelte.d.ts +2 -1
- package/dist/plot/core/components/PlotControls.svelte +65 -41
- package/dist/plot/core/components/PlotControls.svelte.d.ts +1 -1
- 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 +56 -59
- package/dist/plot/core/components/ReferenceLine3D.svelte.d.ts +4 -4
- package/dist/plot/core/components/ReferencePlane.svelte +9 -10
- package/dist/plot/core/components/ReferencePlane.svelte.d.ts +4 -4
- 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 +29 -476
- package/dist/plot/core/data-transform.js +9 -5
- package/dist/plot/core/fill-utils.d.ts +7 -4
- package/dist/plot/core/fill-utils.js +34 -9
- package/dist/plot/core/index.d.ts +1 -0
- package/dist/plot/core/index.js +1 -0
- package/dist/plot/core/interactions.d.ts +5 -1
- package/dist/plot/core/interactions.js +14 -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/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/core/reference-line.d.ts +10 -10
- package/dist/plot/core/reference-line.js +7 -7
- package/dist/plot/core/scales.d.ts +40 -25
- package/dist/plot/core/scales.js +49 -21
- package/dist/plot/core/svg.d.ts +2 -1
- 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 +47 -331
- 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.d.ts +1 -1
- package/dist/plot/core/utils/label-placement.js +5 -5
- package/dist/plot/core/utils.d.ts +2 -1
- package/dist/plot/histogram/Histogram.svelte +373 -631
- package/dist/plot/histogram/Histogram.svelte.d.ts +7 -7
- package/dist/plot/histogram/HistogramControls.svelte +30 -28
- package/dist/plot/histogram/HistogramControls.svelte.d.ts +1 -1
- 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 +79 -73
- package/dist/plot/sankey/Sankey.svelte.d.ts +3 -3
- package/dist/plot/sankey/SankeyControls.svelte +22 -16
- package/dist/plot/sankey/sankey.js +3 -1
- package/dist/plot/scatter/BinnedScatterPlot.svelte +264 -112
- package/dist/plot/scatter/BinnedScatterPlot.svelte.d.ts +11 -4
- package/dist/plot/scatter/ElementScatter.svelte +4 -1
- package/dist/plot/scatter/ScatterPlot.svelte +623 -821
- package/dist/plot/scatter/ScatterPlot.svelte.d.ts +9 -15
- 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 +6 -12
- package/dist/plot/scatter/binned-scatter-types.js +6 -1
- package/dist/plot/scatter/index.d.ts +1 -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 +40 -60
- package/dist/plot/scatter-3d/ScatterPlot3D.svelte.d.ts +6 -14
- package/dist/plot/scatter-3d/ScatterPlot3DControls.svelte +17 -15
- package/dist/plot/scatter-3d/ScatterPlot3DControls.svelte.d.ts +5 -5
- package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte +232 -234
- package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte.d.ts +5 -14
- package/dist/plot/scatter-3d/Surface3D.svelte +9 -17
- package/dist/plot/scatter-3d/Surface3D.svelte.d.ts +4 -3
- package/dist/plot/sunburst/Sunburst.svelte +256 -338
- package/dist/plot/sunburst/Sunburst.svelte.d.ts +4 -3
- 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 +14 -4
- 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 +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 +22 -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 +33 -11
- package/dist/settings.js +136 -51
- package/dist/spectral/Bands.svelte +231 -237
- package/dist/spectral/Bands.svelte.d.ts +3 -2
- package/dist/spectral/BandsAndDos.svelte +29 -29
- package/dist/spectral/BrillouinBandsDos.svelte +21 -29
- package/dist/spectral/Dos.svelte +75 -77
- package/dist/spectral/Dos.svelte.d.ts +2 -1
- package/dist/spectral/helpers.d.ts +9 -9
- package/dist/spectral/helpers.js +66 -70
- package/dist/state.svelte.d.ts +0 -7
- package/dist/state.svelte.js +5 -24
- package/dist/structure/Arrow.svelte +6 -21
- 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 +16 -3
- package/dist/structure/CellSelect.svelte +22 -29
- package/dist/structure/CellSelect.svelte.d.ts +2 -1
- 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 +725 -735
- package/dist/structure/Structure.svelte.d.ts +8 -16
- package/dist/structure/StructureCarousel.svelte +630 -0
- package/dist/structure/StructureCarousel.svelte.d.ts +19 -0
- package/dist/structure/StructureControls.svelte +298 -325
- package/dist/structure/StructureControls.svelte.d.ts +5 -3
- package/dist/structure/StructureExportPane.svelte +62 -168
- package/dist/structure/StructureExportPane.svelte.d.ts +4 -5
- package/dist/structure/StructureInfoPane.svelte +77 -69
- package/dist/structure/StructureInfoPane.svelte.d.ts +6 -6
- package/dist/structure/StructureScene.svelte +758 -600
- package/dist/structure/StructureScene.svelte.d.ts +24 -20
- package/dist/structure/StructureViewport.svelte +386 -0
- package/dist/structure/StructureViewport.svelte.d.ts +63 -0
- package/dist/structure/atom-label-placement.d.ts +18 -0
- package/dist/structure/atom-label-placement.js +115 -0
- package/dist/structure/atom-properties.d.ts +3 -1
- package/dist/structure/atom-properties.js +115 -54
- package/dist/structure/bond-order-perception.js +2 -4
- package/dist/structure/bonding.d.ts +12 -2
- package/dist/structure/bonding.js +172 -73
- package/dist/structure/edit-history.d.ts +6 -0
- package/dist/structure/edit-history.js +27 -0
- package/dist/structure/export.d.ts +25 -4
- package/dist/structure/export.js +103 -153
- 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 +18 -1
- package/dist/structure/index.js +15 -2
- package/dist/structure/measure.d.ts +1 -1
- package/dist/structure/measure.js +6 -12
- package/dist/structure/parse.d.ts +5 -3
- package/dist/structure/parse.js +551 -567
- package/dist/structure/partial-occupancy.d.ts +0 -1
- package/dist/structure/partial-occupancy.js +5 -3
- package/dist/structure/pbc.d.ts +1 -1
- package/dist/structure/pbc.js +204 -51
- package/dist/structure/polyhedra.d.ts +40 -0
- package/dist/structure/polyhedra.js +587 -0
- package/dist/structure/site.d.ts +4 -0
- package/dist/structure/site.js +1 -0
- package/dist/structure/supercell.d.ts +1 -2
- package/dist/structure/supercell.js +10 -15
- 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 +350 -0
- package/dist/symmetry/SymmetryElements.svelte.d.ts +24 -0
- package/dist/symmetry/SymmetryStats.svelte +142 -49
- package/dist/symmetry/WyckoffTable.svelte +58 -16
- package/dist/symmetry/WyckoffTable.svelte.d.ts +3 -0
- package/dist/symmetry/cell-transform.js +8 -14
- package/dist/symmetry/index.d.ts +15 -4
- package/dist/symmetry/index.js +308 -81
- package/dist/symmetry/spacegroups.d.ts +5 -1
- package/dist/symmetry/spacegroups.js +18 -3
- 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 +1104 -378
- 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 +556 -352
- package/dist/trajectory/Trajectory.svelte.d.ts +10 -22
- package/dist/trajectory/TrajectoryError.svelte +11 -8
- package/dist/trajectory/TrajectoryExportPane.svelte +28 -54
- package/dist/trajectory/TrajectoryExportPane.svelte.d.ts +4 -5
- package/dist/trajectory/TrajectoryInfoPane.svelte +88 -99
- package/dist/trajectory/TrajectoryInfoPane.svelte.d.ts +3 -2
- package/dist/trajectory/constants.js +6 -2
- package/dist/trajectory/extract.js +73 -71
- package/dist/trajectory/format-detect.d.ts +0 -1
- package/dist/trajectory/format-detect.js +13 -17
- package/dist/trajectory/frame-reader.d.ts +2 -1
- package/dist/trajectory/frame-reader.js +74 -136
- package/dist/trajectory/helpers.d.ts +12 -2
- package/dist/trajectory/helpers.js +68 -37
- package/dist/trajectory/index.d.ts +1 -0
- package/dist/trajectory/index.js +3 -0
- 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/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 +3 -4
- package/dist/trajectory/parse/index.js +68 -119
- package/dist/trajectory/parse/lammps.d.ts +0 -2
- package/dist/trajectory/parse/lammps.js +14 -16
- package/dist/trajectory/parse/pymatgen.d.ts +2 -0
- package/dist/trajectory/parse/pymatgen.js +74 -0
- package/dist/trajectory/parse/vasp.js +13 -9
- 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.d.ts +9 -21
- package/dist/trajectory/parse/xyz.js +38 -39
- package/dist/trajectory/plotting.d.ts +8 -10
- package/dist/trajectory/plotting.js +102 -127
- package/dist/utils.d.ts +4 -0
- package/dist/utils.js +8 -1
- package/dist/xrd/XrdPlot.svelte +56 -85
- package/dist/xrd/broadening.d.ts +2 -1
- package/dist/xrd/broadening.js +2 -1
- package/dist/xrd/calc-xrd.js +8 -15
- package/dist/xrd/index.d.ts +2 -2
- package/dist/xrd/parse.d.ts +0 -1
- package/dist/xrd/parse.js +56 -73
- package/package.json +77 -36
- package/dist/api/mp.d.ts +0 -6
- package/dist/api/mp.js +0 -22
- 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/core/hover-lock.svelte.d.ts +0 -14
- package/dist/plot/core/hover-lock.svelte.js +0 -45
- package/dist/plot/sunburst/SunburstControls.svelte +0 -200
- package/dist/structure/label-placement.d.ts +0 -14
- package/dist/structure/label-placement.js +0 -72
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { CompositionType } from '../composition';
|
|
2
|
-
import type { ShowControlsProp } from '../controls';
|
|
3
2
|
import type { ElementSymbol } from '../element';
|
|
4
|
-
import type { Point2D, Point3D, Vec3 } from '../math';
|
|
3
|
+
import type { Point2D, Point3D, Vec2, Vec3 } from '../math';
|
|
5
4
|
import type { Rect, Sides } from '../plot/core/layout';
|
|
6
5
|
import type { AnyStructure } from '../structure';
|
|
7
6
|
export interface StructurePopupStats {
|
|
@@ -36,7 +35,17 @@ export interface PhaseData {
|
|
|
36
35
|
data?: Record<string, unknown>;
|
|
37
36
|
structure?: Record<string, unknown>;
|
|
38
37
|
attributes?: Record<string, unknown>;
|
|
38
|
+
magnetic_ordering?: MagneticOrdering | (string & {});
|
|
39
39
|
}
|
|
40
|
+
export interface EntryCategoryConfig {
|
|
41
|
+
label: string;
|
|
42
|
+
property: string | string[];
|
|
43
|
+
markers: Record<string, MarkerSymbol>;
|
|
44
|
+
labels?: Record<string, string>;
|
|
45
|
+
aliases?: Record<string, string>;
|
|
46
|
+
}
|
|
47
|
+
export type MagneticOrdering = `FM` | `FiM` | `AFM` | `NM`;
|
|
48
|
+
export declare const MAGNETIC_ORDERING_CATEGORY: EntryCategoryConfig;
|
|
40
49
|
export interface ProcessedPhaseData {
|
|
41
50
|
entries: PhaseData[];
|
|
42
51
|
stable_entries: PhaseData[];
|
|
@@ -77,7 +86,6 @@ export interface ConvexHullConfig {
|
|
|
77
86
|
}
|
|
78
87
|
export interface ConvexHullControlsType {
|
|
79
88
|
title?: string;
|
|
80
|
-
show?: ShowControlsProp;
|
|
81
89
|
position?: `top-left` | `top-right` | `bottom-left` | `bottom-right`;
|
|
82
90
|
width?: number;
|
|
83
91
|
show_counts?: boolean;
|
|
@@ -145,7 +153,7 @@ export declare const DEFAULT_GAS_PRESSURES: Readonly<Record<GasSpecies, number>>
|
|
|
145
153
|
export interface GasThermodynamicsProvider {
|
|
146
154
|
get_standard_chemical_potential(gas: GasSpecies, T: number): number;
|
|
147
155
|
get_supported_gases(): GasSpecies[];
|
|
148
|
-
get_temperature_range():
|
|
156
|
+
get_temperature_range(): Vec2;
|
|
149
157
|
}
|
|
150
158
|
export interface GasThermodynamicsConfig {
|
|
151
159
|
enabled_gases?: GasSpecies[];
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
// Built-in preset for magnetic orderings (MP/pymatgen conventions) and the default
|
|
2
|
+
// entry_category of all convex hull components: entries carrying magnetic_ordering
|
|
3
|
+
// (or an MP-style `ordering` field) auto-render as shape-coded points with filter toggles
|
|
4
|
+
export const MAGNETIC_ORDERING_CATEGORY = {
|
|
5
|
+
label: `Magnetic`,
|
|
6
|
+
property: [`magnetic_ordering`, `ordering`],
|
|
7
|
+
markers: { FM: `triangle`, FiM: `diamond`, AFM: `square`, NM: `circle` },
|
|
8
|
+
// oxfmt-ignore
|
|
9
|
+
labels: { FM: `Ferromagnetic`, FiM: `Ferrimagnetic`, AFM: `Antiferromagnetic`, NM: `Non-magnetic` },
|
|
10
|
+
// oxfmt-ignore
|
|
11
|
+
aliases: { ferromagnetic: `FM`, ferrimagnetic: `FiM`, antiferromagnetic: `AFM`, 'non-magnetic': `NM`, nonmagnetic: `NM`, diamagnetic: `NM` },
|
|
12
|
+
};
|
|
1
13
|
export const HULL_FACE_COLOR_MODES = [
|
|
2
14
|
`uniform`,
|
|
3
15
|
`formation_energy`,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { PLOT_COLORS } from '../colors'
|
|
3
3
|
import { StatusMessage } from '../feedback'
|
|
4
|
-
import { create_file_drop_handler } from '../io'
|
|
4
|
+
import { create_file_drop_handler, drag_over_handlers } from '../io'
|
|
5
5
|
import { format_value } from '../labels'
|
|
6
|
+
import type { Vec2 } from '../math'
|
|
6
7
|
import { BarPlot } from '../plot'
|
|
7
8
|
import type {
|
|
8
9
|
AxisConfig,
|
|
@@ -11,12 +12,13 @@
|
|
|
11
12
|
Orientation,
|
|
12
13
|
} from '../plot/core/types'
|
|
13
14
|
import type { AnyStructure } from '../structure'
|
|
15
|
+
import { calc_structure_coordination } from '../structure/atom-properties'
|
|
14
16
|
import type { BondingStrategy } from '../structure/bonding'
|
|
15
17
|
import { parse_any_structure } from '../structure/parse'
|
|
16
18
|
import { is_crystal } from '../structure/validation'
|
|
17
19
|
import type { ComponentProps } from 'svelte'
|
|
18
20
|
import { SvelteMap, SvelteSet } from 'svelte/reactivity'
|
|
19
|
-
import {
|
|
21
|
+
import type { CoordinationData } from './calc-coordination'
|
|
20
22
|
import type { SplitMode } from './index'
|
|
21
23
|
import { to_error } from '../utils'
|
|
22
24
|
|
|
@@ -69,28 +71,31 @@
|
|
|
69
71
|
|
|
70
72
|
const base_entries = Array.isArray(structures)
|
|
71
73
|
? (structures as StructureEntry[])
|
|
72
|
-
:
|
|
74
|
+
: is_crystal(structures)
|
|
73
75
|
? [{ label: `Structure`, structure: structures as AnyStructure }]
|
|
74
76
|
: Object.entries(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
77
|
+
structures as Record<
|
|
78
|
+
string,
|
|
79
|
+
AnyStructure | { structure: AnyStructure; color?: string }
|
|
80
|
+
>,
|
|
81
|
+
).map(([label, value]) =>
|
|
82
|
+
`structure` in value
|
|
83
|
+
? { label, ...value }
|
|
84
|
+
: { label, structure: value as AnyStructure },
|
|
85
|
+
)
|
|
84
86
|
|
|
85
87
|
// Merge user-provided structures with dropped structures
|
|
86
88
|
return [...base_entries, ...dropped_entries]
|
|
87
89
|
})
|
|
88
90
|
|
|
89
|
-
// Compute coordination data for each structure
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
// Compute coordination data for each structure via the shared PBC-aware helper so
|
|
92
|
+
// boundary-atom coordination matches the 3D viewer (which uses the same path).
|
|
93
|
+
const entries_with_data = $derived(
|
|
94
|
+
structure_entries.map((entry) => ({
|
|
95
|
+
...entry,
|
|
96
|
+
data: calc_structure_coordination(entry.structure, strategy),
|
|
97
|
+
})),
|
|
98
|
+
)
|
|
94
99
|
|
|
95
100
|
// Compute appropriate ranges
|
|
96
101
|
const ranges = $derived.by(() => {
|
|
@@ -99,7 +104,7 @@
|
|
|
99
104
|
for (const entry of entries_with_data) {
|
|
100
105
|
for (const [cn] of entry.data.cn_histogram) max_cn = Math.max(max_cn, cn)
|
|
101
106
|
}
|
|
102
|
-
const cn_range:
|
|
107
|
+
const cn_range: Vec2 = [-0.5, max_cn + 0.5]
|
|
103
108
|
|
|
104
109
|
return { count: [0, null] as [number, null], cn: cn_range } // Count axis should always start at 0
|
|
105
110
|
})
|
|
@@ -115,7 +120,6 @@
|
|
|
115
120
|
}
|
|
116
121
|
return Array.from(all_cns).sort((cn1, cn2) => cn1 - cn2)
|
|
117
122
|
})
|
|
118
|
-
|
|
119
123
|
// Build BarPlot series based on split_mode
|
|
120
124
|
const bar_series = $derived.by<BarSeries<CoordinationMetadata>[]>(() => {
|
|
121
125
|
if (split_mode === `by_element`) {
|
|
@@ -207,29 +211,28 @@
|
|
|
207
211
|
|
|
208
212
|
const compute_and_add = (content: string | ArrayBuffer, filename: string) => {
|
|
209
213
|
try {
|
|
210
|
-
const text_content =
|
|
211
|
-
? new TextDecoder().decode(content)
|
|
212
|
-
: content
|
|
214
|
+
const text_content =
|
|
215
|
+
content instanceof ArrayBuffer ? new TextDecoder().decode(content) : content
|
|
213
216
|
const parsed_structure = parse_any_structure(text_content, filename)
|
|
214
217
|
if (is_crystal(parsed_structure)) {
|
|
215
|
-
dropped_entries = [
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
218
|
+
dropped_entries = [
|
|
219
|
+
{
|
|
220
|
+
label: filename || `Dropped structure`,
|
|
221
|
+
structure: parsed_structure,
|
|
222
|
+
},
|
|
223
|
+
...dropped_entries,
|
|
224
|
+
]
|
|
219
225
|
} else {
|
|
220
226
|
error_msg = `Structure has no lattice or sites; cannot compute coordination`
|
|
221
227
|
}
|
|
222
228
|
} catch (exc) {
|
|
223
|
-
error_msg = `Failed to process structure: ${
|
|
224
|
-
to_error(exc).message
|
|
225
|
-
}`
|
|
229
|
+
error_msg = `Failed to process structure: ${to_error(exc).message}`
|
|
226
230
|
}
|
|
227
231
|
}
|
|
228
232
|
|
|
229
233
|
const handle_file_drop = create_file_drop_handler({
|
|
230
234
|
allow: () => allow_file_drop,
|
|
231
|
-
on_drop: (content, filename) =>
|
|
232
|
-
(on_file_drop || compute_and_add)(content, filename),
|
|
235
|
+
on_drop: (content, filename) => (on_file_drop || compute_and_add)(content, filename),
|
|
233
236
|
on_error: (msg) => {
|
|
234
237
|
error_msg = msg
|
|
235
238
|
},
|
|
@@ -255,8 +258,8 @@
|
|
|
255
258
|
{#if bar_series.length === 0}
|
|
256
259
|
<StatusMessage
|
|
257
260
|
message={allow_file_drop
|
|
258
|
-
|
|
259
|
-
|
|
261
|
+
? `Drag and drop structure files here to compute coordination numbers`
|
|
262
|
+
: `No coordination data to display`}
|
|
260
263
|
/>
|
|
261
264
|
{:else}
|
|
262
265
|
{#snippet tooltip(info: BarHandlerProps<CoordinationMetadata>)}
|
|
@@ -297,15 +300,10 @@
|
|
|
297
300
|
bind:display
|
|
298
301
|
{tooltip}
|
|
299
302
|
ondrop={handle_file_drop}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
}
|
|
305
|
-
ondragleave={(event) => {
|
|
306
|
-
event.preventDefault()
|
|
307
|
-
dragover = false
|
|
308
|
-
}}
|
|
309
|
-
class={(rest.class ?? ``) + (dragover ? ` dragover` : ``)}
|
|
303
|
+
{...drag_over_handlers({
|
|
304
|
+
allow: () => allow_file_drop,
|
|
305
|
+
set_dragover: (over) => (dragover = over),
|
|
306
|
+
})}
|
|
307
|
+
class={[rest.class, dragover && `dragover`]}
|
|
310
308
|
/>
|
|
311
309
|
{/if}
|
|
@@ -3,7 +3,7 @@ import type { AxisConfig } from '../plot/core/types';
|
|
|
3
3
|
import type { AnyStructure } from '../structure';
|
|
4
4
|
import type { BondingStrategy } from '../structure/bonding';
|
|
5
5
|
import type { ComponentProps } from 'svelte';
|
|
6
|
-
import {
|
|
6
|
+
import type { CoordinationData } from './calc-coordination';
|
|
7
7
|
import type { SplitMode } from './index';
|
|
8
8
|
interface StructureEntry {
|
|
9
9
|
label: string;
|
|
@@ -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
|
>
|
|
@@ -115,8 +111,10 @@
|
|
|
115
111
|
{shell_idx + 1}.{elec_idx + 1}
|
|
116
112
|
<!-- {:else if [`sequential`, true].includes(number_electrons)} -->
|
|
117
113
|
{:else}
|
|
118
|
-
{@const nth_electron =
|
|
119
|
-
|
|
114
|
+
{@const nth_electron =
|
|
115
|
+
shells.slice(0, shell_idx).reduce((sum, count) => sum + count, 0) +
|
|
116
|
+
elec_idx +
|
|
117
|
+
1}
|
|
120
118
|
{nth_electron}
|
|
121
119
|
{/if}
|
|
122
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 {
|
|
@@ -24,6 +24,6 @@ type $$ComponentProps = Omit<HTMLAttributes<HTMLElement>, `onclick`> & {
|
|
|
24
24
|
event: MouseEvent;
|
|
25
25
|
}) => void;
|
|
26
26
|
};
|
|
27
|
-
declare const ElementTile: import("svelte").Component<$$ComponentProps, {}, "
|
|
27
|
+
declare const ElementTile: import("svelte").Component<$$ComponentProps, {}, "text_color" | "node">;
|
|
28
28
|
type ElementTile = ReturnType<typeof ElementTile>;
|
|
29
29
|
export default ElementTile;
|
|
@@ -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
|
@@ -5,4 +5,5 @@ export { default as ElementHeading } from './ElementHeading.svelte';
|
|
|
5
5
|
export { default as ElementPhoto } from './ElementPhoto.svelte';
|
|
6
6
|
export { default as ElementStats } from './ElementStats.svelte';
|
|
7
7
|
export { default as ElementTile } from './ElementTile.svelte';
|
|
8
|
+
export * from './helpers';
|
|
8
9
|
export { default as Nucleus } from './Nucleus.svelte';
|
package/dist/element/index.js
CHANGED
|
@@ -4,4 +4,7 @@ export { default as ElementHeading } from './ElementHeading.svelte';
|
|
|
4
4
|
export { default as ElementPhoto } from './ElementPhoto.svelte';
|
|
5
5
|
export { default as ElementStats } from './ElementStats.svelte';
|
|
6
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';
|
|
7
10
|
export { default as Nucleus } from './Nucleus.svelte';
|