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,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import Icon from '../Icon.svelte'
|
|
3
3
|
import { get_alphabetical_formula } from './format'
|
|
4
|
-
import {
|
|
4
|
+
import { is_elem_symbol, type ElementSymbol } from '../element'
|
|
5
5
|
import { tooltip } from 'svelte-multiselect/attachments'
|
|
6
6
|
import type { HTMLAttributes } from 'svelte/elements'
|
|
7
7
|
import type { FormulaSearchMode } from './index'
|
|
@@ -46,20 +46,17 @@
|
|
|
46
46
|
const DEFAULT_SEARCH_EXAMPLES: SearchExampleCategory[] = [
|
|
47
47
|
{
|
|
48
48
|
label: `Has elements`,
|
|
49
|
-
description:
|
|
50
|
-
`Materials containing these elements. Operators/ranges: +Li,-O,Fe:1-2. Use * for any element.`,
|
|
49
|
+
description: `Materials containing these elements. Operators/ranges: +Li,-O,Fe:1-2. Use * for any element.`,
|
|
51
50
|
examples: [`Li,Fe`, `+Li,-O`, `Li,*,*`],
|
|
52
51
|
},
|
|
53
52
|
{
|
|
54
53
|
label: `Chemical system`,
|
|
55
|
-
description:
|
|
56
|
-
`Materials with only these elements (no others). Wildcards/ranges supported.`,
|
|
54
|
+
description: `Materials with only these elements (no others). Wildcards/ranges supported.`,
|
|
57
55
|
examples: [`Li-Fe-O`, `Li-Fe-*-*`, `*-*-O`],
|
|
58
56
|
},
|
|
59
57
|
{
|
|
60
58
|
label: `Exact formula`,
|
|
61
|
-
description:
|
|
62
|
-
`Materials with this exact stoichiometry. Unicode paste, wildcards, and canonicalization supported.`,
|
|
59
|
+
description: `Materials with this exact stoichiometry. Unicode paste, wildcards, and canonicalization supported.`,
|
|
63
60
|
examples: [`LiFePO4`, `LiFe*2*`, `*2O3`],
|
|
64
61
|
},
|
|
65
62
|
]
|
|
@@ -162,10 +159,9 @@
|
|
|
162
159
|
if (!raw) return []
|
|
163
160
|
const parsed: unknown = JSON.parse(raw)
|
|
164
161
|
if (!Array.isArray(parsed)) return []
|
|
165
|
-
return parsed
|
|
166
|
-
|
|
167
|
-
max_history
|
|
168
|
-
)
|
|
162
|
+
return parsed
|
|
163
|
+
.filter((item): item is string => typeof item === `string`)
|
|
164
|
+
.slice(0, max_history)
|
|
169
165
|
} catch {
|
|
170
166
|
return []
|
|
171
167
|
}
|
|
@@ -249,9 +245,7 @@
|
|
|
249
245
|
let visible_history = $derived.by(() => {
|
|
250
246
|
const filtered = history
|
|
251
247
|
.filter((item) => item !== value)
|
|
252
|
-
.filter((item) =>
|
|
253
|
-
item.toLowerCase().includes(history_query.toLowerCase().trim())
|
|
254
|
-
)
|
|
248
|
+
.filter((item) => item.toLowerCase().includes(history_query.toLowerCase().trim()))
|
|
255
249
|
const pinned = filtered.filter((item) => pinned_history.includes(item))
|
|
256
250
|
const unpinned = filtered.filter((item) => !pinned_history.includes(item))
|
|
257
251
|
return [...pinned, ...unpinned]
|
|
@@ -305,9 +299,9 @@
|
|
|
305
299
|
$effect(() => {
|
|
306
300
|
if (!examples_open || !examples_wrapper) return
|
|
307
301
|
requestAnimationFrame(() => {
|
|
308
|
-
const dropdown = examples_wrapper?.querySelector(
|
|
309
|
-
|
|
310
|
-
|
|
302
|
+
const dropdown = examples_wrapper?.querySelector(
|
|
303
|
+
`.examples-dropdown`,
|
|
304
|
+
) as HTMLElement | null
|
|
311
305
|
if (!dropdown) return
|
|
312
306
|
const rect = dropdown.getBoundingClientRect()
|
|
313
307
|
if (rect.right > window.innerWidth && !anchor_left) anchor_left = true
|
|
@@ -337,11 +331,13 @@
|
|
|
337
331
|
for (const [superscript, ascii] of Object.entries(SUPERSCRIPT_TO_ASCII)) {
|
|
338
332
|
normalized = normalized.replaceAll(superscript, ascii)
|
|
339
333
|
}
|
|
340
|
-
return
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
334
|
+
return (
|
|
335
|
+
normalized
|
|
336
|
+
// keep hydrate dots (deleting would glue digits: CuSO4·5H2O -> CuSO45H2O)
|
|
337
|
+
.replaceAll(`⋅`, `·`)
|
|
338
|
+
.replaceAll(`−`, `-`)
|
|
339
|
+
.replaceAll(/\s+/g, ``)
|
|
340
|
+
)
|
|
345
341
|
}
|
|
346
342
|
|
|
347
343
|
function normalize_exact_formula(input: string): string {
|
|
@@ -356,28 +352,29 @@
|
|
|
356
352
|
try {
|
|
357
353
|
const tokens = parse_formula_with_wildcards(sanitized_input)
|
|
358
354
|
const explicit = tokens
|
|
359
|
-
.filter(
|
|
360
|
-
|
|
355
|
+
.filter(
|
|
356
|
+
(token): token is { element: ElementSymbol; count: number } =>
|
|
357
|
+
token.element !== null,
|
|
358
|
+
)
|
|
359
|
+
.map((token) => ({ element: token.element, count: token.count }))
|
|
361
360
|
const wildcard_tokens = tokens.filter((token) => token.element === null)
|
|
362
361
|
|
|
363
362
|
// Merge explicit element counts before sorting.
|
|
364
363
|
const merged_explicit: { element: string; count: number }[] = []
|
|
365
364
|
for (const token of explicit) {
|
|
366
|
-
const existing = merged_explicit.find((item) =>
|
|
367
|
-
item.element === token.element
|
|
368
|
-
)
|
|
365
|
+
const existing = merged_explicit.find((item) => item.element === token.element)
|
|
369
366
|
if (existing) existing.count += token.count
|
|
370
367
|
else merged_explicit.push(token)
|
|
371
368
|
}
|
|
372
369
|
const sorted_explicit = merged_explicit.sort((elem_a, elem_b) =>
|
|
373
|
-
elem_a.element.localeCompare(elem_b.element)
|
|
370
|
+
elem_a.element.localeCompare(elem_b.element),
|
|
374
371
|
)
|
|
375
|
-
const wildcard_str = wildcard_tokens
|
|
376
|
-
token.count > 1 ? `*${token.count}` : `*`
|
|
377
|
-
|
|
378
|
-
const explicit_str = sorted_explicit
|
|
379
|
-
token.count > 1 ? `${token.element}${token.count}` : token.element
|
|
380
|
-
|
|
372
|
+
const wildcard_str = wildcard_tokens
|
|
373
|
+
.map((token) => (token.count > 1 ? `*${token.count}` : `*`))
|
|
374
|
+
.join(``)
|
|
375
|
+
const explicit_str = sorted_explicit
|
|
376
|
+
.map((token) => (token.count > 1 ? `${token.element}${token.count}` : token.element))
|
|
377
|
+
.join(``)
|
|
381
378
|
return `${explicit_str}${wildcard_str}`
|
|
382
379
|
} catch {
|
|
383
380
|
return sanitized_input
|
|
@@ -386,16 +383,18 @@
|
|
|
386
383
|
|
|
387
384
|
function is_valid_constraint(constraint: string): boolean {
|
|
388
385
|
if (!constraint) return true
|
|
389
|
-
return
|
|
390
|
-
|
|
386
|
+
return (
|
|
387
|
+
/^\d+$/.test(constraint) ||
|
|
388
|
+
/^\d+-\d+$/.test(constraint) ||
|
|
389
|
+
/^(?:>=|<=|>|<)\d+$/.test(constraint)
|
|
390
|
+
)
|
|
391
391
|
}
|
|
392
392
|
|
|
393
|
-
function strip_operator_prefix(
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
: `include`
|
|
393
|
+
function strip_operator_prefix(token: string): {
|
|
394
|
+
operator: FormulaFilterToken[`operator`]
|
|
395
|
+
value: string
|
|
396
|
+
} {
|
|
397
|
+
const operator = token.startsWith(`-`) || token.startsWith(`!`) ? `exclude` : `include`
|
|
399
398
|
const stripped_value =
|
|
400
399
|
token.startsWith(`+`) || token.startsWith(`-`) || token.startsWith(`!`)
|
|
401
400
|
? token.slice(1)
|
|
@@ -425,11 +424,11 @@
|
|
|
425
424
|
const [element_part, constraint] = without_operator.split(`:`)
|
|
426
425
|
const element = element_part.trim()
|
|
427
426
|
const is_wildcard = element === `*`
|
|
428
|
-
const is_valid_element = is_wildcard ||
|
|
429
|
-
ELEM_SYMBOLS.includes(element as (typeof ELEM_SYMBOLS)[number])
|
|
427
|
+
const is_valid_element = is_wildcard || is_elem_symbol(element)
|
|
430
428
|
const normalized_constraint = constraint?.trim() || null
|
|
431
|
-
const is_valid =
|
|
432
|
-
|
|
429
|
+
const is_valid =
|
|
430
|
+
is_valid_element &&
|
|
431
|
+
(normalized_constraint === null || is_valid_constraint(normalized_constraint))
|
|
433
432
|
|
|
434
433
|
return {
|
|
435
434
|
raw: raw_token,
|
|
@@ -441,36 +440,37 @@
|
|
|
441
440
|
}
|
|
442
441
|
}
|
|
443
442
|
|
|
444
|
-
function tokenize_query(
|
|
445
|
-
input: string,
|
|
446
|
-
mode: FormulaSearchMode,
|
|
447
|
-
): FormulaFilterToken[] {
|
|
443
|
+
function tokenize_query(input: string, mode: FormulaSearchMode): FormulaFilterToken[] {
|
|
448
444
|
const trimmed = input.trim()
|
|
449
445
|
if (!trimmed) return []
|
|
450
446
|
if (mode === `exact`) {
|
|
451
|
-
return [
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
447
|
+
return [
|
|
448
|
+
{
|
|
449
|
+
raw: trimmed,
|
|
450
|
+
element: trimmed,
|
|
451
|
+
operator: `include`,
|
|
452
|
+
constraint: null,
|
|
453
|
+
is_wildcard: has_wildcards(trimmed),
|
|
454
|
+
is_valid: sanitize_exact_formula(trimmed).is_valid,
|
|
455
|
+
},
|
|
456
|
+
]
|
|
459
457
|
}
|
|
460
458
|
const normalized = mode === `chemsys` ? trimmed.replaceAll(`,`, `-`) : trimmed
|
|
461
|
-
const tokens =
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
459
|
+
const tokens =
|
|
460
|
+
mode === `chemsys`
|
|
461
|
+
? // Keep range constraints like Fe:1-2 intact while splitting token separators.
|
|
462
|
+
normalized.split(/-(?!\d)/)
|
|
463
|
+
: normalized.split(`,`)
|
|
465
464
|
return tokens
|
|
466
465
|
.map((token) => token.trim())
|
|
467
466
|
.filter(Boolean)
|
|
468
467
|
.map(parse_token)
|
|
469
468
|
}
|
|
470
469
|
|
|
471
|
-
function sanitize_exact_formula(
|
|
472
|
-
|
|
473
|
-
|
|
470
|
+
function sanitize_exact_formula(input: string): {
|
|
471
|
+
is_valid: boolean
|
|
472
|
+
error_message: string | null
|
|
473
|
+
} {
|
|
474
474
|
const trimmed = input.trim()
|
|
475
475
|
if (!trimmed) return { is_valid: true, error_message: null }
|
|
476
476
|
try {
|
|
@@ -509,9 +509,7 @@
|
|
|
509
509
|
return token_a.element.localeCompare(token_b.element)
|
|
510
510
|
})
|
|
511
511
|
|
|
512
|
-
return normalized_tokens
|
|
513
|
-
.map(serialize_token)
|
|
514
|
-
.join(separator)
|
|
512
|
+
return normalized_tokens.map(serialize_token).join(separator)
|
|
515
513
|
}
|
|
516
514
|
|
|
517
515
|
function parse_query(
|
|
@@ -520,14 +518,15 @@
|
|
|
520
518
|
): FormulaFilterParseResult {
|
|
521
519
|
const tokens = tokenize_query(normalized_value, mode)
|
|
522
520
|
const first_invalid_token = tokens.find((token) => !token.is_valid)
|
|
523
|
-
const exact_validation =
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
521
|
+
const exact_validation =
|
|
522
|
+
mode === `exact`
|
|
523
|
+
? sanitize_exact_formula(normalized_value)
|
|
524
|
+
: {
|
|
525
|
+
is_valid: !first_invalid_token,
|
|
526
|
+
error_message: first_invalid_token
|
|
527
|
+
? `Invalid token: ${first_invalid_token.raw}`
|
|
528
|
+
: null,
|
|
529
|
+
}
|
|
531
530
|
return {
|
|
532
531
|
value: normalized_value,
|
|
533
532
|
normalized_value,
|
|
@@ -558,7 +557,10 @@
|
|
|
558
557
|
if (!trimmed) return []
|
|
559
558
|
// If contains commas or dashes, split by those and sort alphabetically
|
|
560
559
|
if (trimmed.includes(`,`) || trimmed.includes(`-`)) {
|
|
561
|
-
const parts = trimmed
|
|
560
|
+
const parts = trimmed
|
|
561
|
+
.split(/[-,]/)
|
|
562
|
+
.map((str) => str.trim())
|
|
563
|
+
.filter(Boolean)
|
|
562
564
|
// Separate wildcards from regular elements
|
|
563
565
|
const wildcards = parts.filter((part) => part === `*`)
|
|
564
566
|
const regular_parts = parts.filter((part) => part !== `*`)
|
|
@@ -568,7 +570,8 @@
|
|
|
568
570
|
}
|
|
569
571
|
// Otherwise parse as formula (already returns sorted by default)
|
|
570
572
|
// For formulas with wildcards, we can't parse them normally
|
|
571
|
-
if (has_wildcards(trimmed)) {
|
|
573
|
+
if (has_wildcards(trimmed)) {
|
|
574
|
+
// Use shared utility and extract unique elements
|
|
572
575
|
const tokens = parse_formula_with_wildcards(trimmed)
|
|
573
576
|
const unique_elements: string[] = []
|
|
574
577
|
for (const token of tokens) {
|
|
@@ -577,9 +580,7 @@
|
|
|
577
580
|
}
|
|
578
581
|
}
|
|
579
582
|
const elements = unique_elements.sort()
|
|
580
|
-
const wildcards = tokens.filter((token) => token.element === null).map(() =>
|
|
581
|
-
`*`
|
|
582
|
-
)
|
|
583
|
+
const wildcards = tokens.filter((token) => token.element === null).map(() => `*`)
|
|
583
584
|
return [...elements, ...wildcards]
|
|
584
585
|
}
|
|
585
586
|
try {
|
|
@@ -671,9 +672,7 @@
|
|
|
671
672
|
focused_history_idx = (focused_history_idx + 1) % len
|
|
672
673
|
} else if (event.key === `ArrowUp`) {
|
|
673
674
|
event.preventDefault()
|
|
674
|
-
focused_history_idx = focused_history_idx <= 0
|
|
675
|
-
? len - 1
|
|
676
|
-
: focused_history_idx - 1
|
|
675
|
+
focused_history_idx = focused_history_idx <= 0 ? len - 1 : focused_history_idx - 1
|
|
677
676
|
}
|
|
678
677
|
}
|
|
679
678
|
}
|
|
@@ -708,8 +707,8 @@
|
|
|
708
707
|
function handle_menu_keydown(event: KeyboardEvent): void {
|
|
709
708
|
const len = all_examples.length
|
|
710
709
|
if (!len) return
|
|
711
|
-
const is_button_activation =
|
|
712
|
-
event.target instanceof HTMLButtonElement
|
|
710
|
+
const is_button_activation =
|
|
711
|
+
(event.key === `Enter` || event.key === ` `) && event.target instanceof HTMLButtonElement
|
|
713
712
|
if (is_button_activation) return
|
|
714
713
|
|
|
715
714
|
const key_actions: Record<string, () => void> = {
|
|
@@ -733,8 +732,9 @@
|
|
|
733
732
|
function remove_token(token_idx: number): void {
|
|
734
733
|
if (search_mode === `exact`) return
|
|
735
734
|
const separator = search_mode === `chemsys` ? `-` : `,`
|
|
736
|
-
const tokens = tokenize_query(input_value, search_mode)
|
|
737
|
-
|
|
735
|
+
const tokens = tokenize_query(input_value, search_mode).filter(
|
|
736
|
+
(_, idx) => idx !== token_idx,
|
|
737
|
+
)
|
|
738
738
|
const next_value = tokens.map(serialize_token).join(separator)
|
|
739
739
|
input_value = next_value
|
|
740
740
|
set_value(next_value, search_mode)
|
|
@@ -751,8 +751,8 @@
|
|
|
751
751
|
search_mode === `chemsys`
|
|
752
752
|
? `Li-Fe-O or Li-*-*`
|
|
753
753
|
: search_mode === `exact`
|
|
754
|
-
|
|
755
|
-
|
|
754
|
+
? `LiFePO4 or LiFe*2*`
|
|
755
|
+
: `Li,Fe,O or Li,*,*`,
|
|
756
756
|
)
|
|
757
757
|
|
|
758
758
|
const MODE_LABELS: Record<FormulaSearchMode, string> = {
|
|
@@ -876,8 +876,8 @@
|
|
|
876
876
|
class:locked={mode_locked}
|
|
877
877
|
onclick={cycle_mode}
|
|
878
878
|
title={mode_locked
|
|
879
|
-
|
|
880
|
-
|
|
879
|
+
? `Mode is locked`
|
|
880
|
+
: `Click to switch to '${next_mode.mode}' → ${next_mode.value}`}
|
|
881
881
|
{@attach tooltip()}
|
|
882
882
|
aria-label="Change search mode"
|
|
883
883
|
>
|
|
@@ -958,11 +958,7 @@
|
|
|
958
958
|
</div>
|
|
959
959
|
{#if show_chip_row}
|
|
960
960
|
<div class="token-chip-row">
|
|
961
|
-
{#each parsed_tokens as
|
|
962
|
-
token,
|
|
963
|
-
idx
|
|
964
|
-
(`${token.operator}:${token.element}:${token.constraint ?? ``}:${idx}`)
|
|
965
|
-
}
|
|
961
|
+
{#each parsed_tokens as token, idx (`${token.operator}:${token.element}:${token.constraint ?? ``}:${idx}`)}
|
|
966
962
|
<button
|
|
967
963
|
type="button"
|
|
968
964
|
class="token-chip"
|
|
@@ -1036,7 +1032,9 @@
|
|
|
1036
1032
|
cursor: pointer;
|
|
1037
1033
|
color: var(--highlight, #4db6ff);
|
|
1038
1034
|
opacity: 0.8;
|
|
1039
|
-
transition:
|
|
1035
|
+
transition:
|
|
1036
|
+
opacity 0.15s,
|
|
1037
|
+
background 0.15s;
|
|
1040
1038
|
&:hover {
|
|
1041
1039
|
opacity: 1;
|
|
1042
1040
|
background: rgba(77, 182, 255, 0.2);
|
|
@@ -6,7 +6,12 @@
|
|
|
6
6
|
import { format_num } from '../labels'
|
|
7
7
|
import type { Snippet } from 'svelte'
|
|
8
8
|
import type { SVGAttributes } from 'svelte/elements'
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
chart_segment_label,
|
|
11
|
+
chart_segment_suffix,
|
|
12
|
+
type ChartSegmentData,
|
|
13
|
+
get_chart_font_scale,
|
|
14
|
+
} from './index'
|
|
10
15
|
import { count_atoms_in_composition, fractional_composition } from './parse'
|
|
11
16
|
|
|
12
17
|
// Constants for pie chart calculations
|
|
@@ -75,21 +80,25 @@
|
|
|
75
80
|
|
|
76
81
|
// Single element: full circle with no radial stroke line, label at center
|
|
77
82
|
if (fraction === 1) {
|
|
78
|
-
const
|
|
83
|
+
const radius = outer_radius
|
|
79
84
|
const ir = inner_radius_adjusted
|
|
80
85
|
// Two semicircular arcs to form a full circle (avoids SVG 360° arc bug)
|
|
81
|
-
const outer_arc = `M ${center} ${center -
|
|
82
|
-
center +
|
|
83
|
-
} A ${
|
|
84
|
-
const path =
|
|
85
|
-
|
|
86
|
-
center - ir
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
const outer_arc = `M ${center} ${center - radius} A ${radius} ${radius} 0 1 1 ${center} ${
|
|
87
|
+
center + radius
|
|
88
|
+
} A ${radius} ${radius} 0 1 1 ${center} ${center - radius} Z`
|
|
89
|
+
const path =
|
|
90
|
+
ir > 0
|
|
91
|
+
? `${outer_arc} M ${center} ${center - ir} A ${ir} ${ir} 0 1 0 ${center} ${
|
|
92
|
+
center + ir
|
|
93
|
+
} A ${ir} ${ir} 0 1 0 ${center} ${center - ir} Z`
|
|
94
|
+
: outer_arc
|
|
95
|
+
const label_text = chart_segment_label(
|
|
96
|
+
element,
|
|
97
|
+
amount,
|
|
98
|
+
fraction,
|
|
99
|
+
show_amounts,
|
|
100
|
+
show_percentages,
|
|
101
|
+
)
|
|
93
102
|
return {
|
|
94
103
|
element,
|
|
95
104
|
amount,
|
|
@@ -101,7 +110,7 @@
|
|
|
101
110
|
label_x: center,
|
|
102
111
|
label_y: center,
|
|
103
112
|
is_outside_slice: false,
|
|
104
|
-
font_scale: get_chart_font_scale(2.6, label_text,
|
|
113
|
+
font_scale: get_chart_font_scale(2.6, label_text, radius * 2),
|
|
105
114
|
text_color: pick_contrast_color({ bg_color: color }),
|
|
106
115
|
}
|
|
107
116
|
}
|
|
@@ -132,14 +141,15 @@
|
|
|
132
141
|
const large_arc = angle_span > 180 ? 1 : 0
|
|
133
142
|
|
|
134
143
|
// Create donut path if inner radius > 0, otherwise regular pie slice
|
|
135
|
-
const path =
|
|
136
|
-
|
|
137
|
-
|
|
144
|
+
const path =
|
|
145
|
+
inner_radius_adjusted > 0
|
|
146
|
+
? `M ${x1_outer} ${y1_outer} A ${outer_radius} ${outer_radius} 0 ${large_arc} 1 ${x2_outer} ${y2_outer} L ${x2_inner} ${y2_inner} A ${inner_radius_adjusted} ${inner_radius_adjusted} 0 ${large_arc} 0 ${x1_inner} ${y1_inner} Z`
|
|
147
|
+
: `M ${center} ${center} L ${x1_outer} ${y1_outer} A ${outer_radius} ${outer_radius} 0 ${large_arc} 1 ${x2_outer} ${y2_outer} Z`
|
|
138
148
|
|
|
139
149
|
// Position labels with three-tier strategy
|
|
140
150
|
const is_very_thin_slice = angle_span < VERY_THIN_SLICE_THRESHOLD // Place outside
|
|
141
|
-
const is_medium_slice =
|
|
142
|
-
angle_span < MEDIUM_SLICE_THRESHOLD // Near outer edge
|
|
151
|
+
const is_medium_slice =
|
|
152
|
+
angle_span >= VERY_THIN_SLICE_THRESHOLD && angle_span < MEDIUM_SLICE_THRESHOLD // Near outer edge
|
|
143
153
|
|
|
144
154
|
let label_radius: number
|
|
145
155
|
let is_outside_slice = false
|
|
@@ -159,22 +169,22 @@
|
|
|
159
169
|
// Calculate font scale based on slice size and smart text fitting
|
|
160
170
|
const [min_font_scale, max_font_scale] = [1.4, 2] as const
|
|
161
171
|
const scale_factor = angle_span / MAX_ANGLE_FOR_FULL_SCALE
|
|
162
|
-
const base_scale = min_font_scale +
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
172
|
+
const base_scale = min_font_scale + scale_factor * (max_font_scale - min_font_scale)
|
|
173
|
+
const label_text = chart_segment_label(
|
|
174
|
+
element,
|
|
175
|
+
amount,
|
|
176
|
+
fraction,
|
|
177
|
+
show_amounts,
|
|
178
|
+
show_percentages,
|
|
179
|
+
)
|
|
166
180
|
const available_space = is_very_thin_slice
|
|
167
181
|
? outer_radius * 0.8 // More space outside the slice
|
|
168
182
|
: Math.min(
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
183
|
+
outer_radius - inner_radius_adjusted, // Radial space
|
|
184
|
+
((angle_span * Math.PI) / 180) * label_radius * 0.8, // Arc space at label radius
|
|
185
|
+
)
|
|
172
186
|
|
|
173
|
-
const font_scale = get_chart_font_scale(
|
|
174
|
-
base_scale,
|
|
175
|
-
label_text,
|
|
176
|
-
available_space,
|
|
177
|
-
)
|
|
187
|
+
const font_scale = get_chart_font_scale(base_scale, label_text, available_space)
|
|
178
188
|
|
|
179
189
|
return {
|
|
180
190
|
element,
|
|
@@ -202,7 +212,7 @@
|
|
|
202
212
|
viewBox="0 0 {size} {size}"
|
|
203
213
|
style:max-width="{size}px"
|
|
204
214
|
{...rest}
|
|
205
|
-
class=
|
|
215
|
+
class={[`pie-chart`, rest.class]}
|
|
206
216
|
bind:this={svg_node}
|
|
207
217
|
>
|
|
208
218
|
{#each segments as segment (segment.element)}
|
|
@@ -211,10 +221,10 @@
|
|
|
211
221
|
fill={segment.color}
|
|
212
222
|
stroke="white"
|
|
213
223
|
stroke-width={segments.length === 1
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
224
|
+
? 0
|
|
225
|
+
: hovered_element === segment.element
|
|
226
|
+
? stroke_width + 1
|
|
227
|
+
: stroke_width}
|
|
218
228
|
class="pie-segment"
|
|
219
229
|
class:interactive
|
|
220
230
|
class:hovered={hovered_element === segment.element}
|
|
@@ -254,15 +264,18 @@
|
|
|
254
264
|
class:outside-slice={segment.is_outside_slice}
|
|
255
265
|
style:color={segment.text_color}
|
|
256
266
|
>
|
|
257
|
-
<span class="element-symbol" style:font-size="{14 * segment.font_scale}px"
|
|
258
|
-
segment.element
|
|
259
|
-
|
|
267
|
+
<span class="element-symbol" style:font-size="{14 * segment.font_scale}px"
|
|
268
|
+
>{segment.element}</span
|
|
269
|
+
>
|
|
260
270
|
{#if show_amounts || show_percentages}
|
|
261
|
-
<sub class="amount" style:font-size="{8 * segment.font_scale}px"
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
271
|
+
<sub class="amount" style:font-size="{8 * segment.font_scale}px"
|
|
272
|
+
>{chart_segment_suffix(
|
|
273
|
+
segment.amount,
|
|
274
|
+
segment.fraction,
|
|
275
|
+
show_amounts,
|
|
276
|
+
show_percentages,
|
|
277
|
+
)}</sub
|
|
278
|
+
>
|
|
266
279
|
{/if}
|
|
267
280
|
</div>
|
|
268
281
|
</foreignObject>
|
|
@@ -285,7 +298,8 @@
|
|
|
285
298
|
.pie-segment.interactive {
|
|
286
299
|
cursor: pointer;
|
|
287
300
|
}
|
|
288
|
-
.pie-segment.interactive:hover,
|
|
301
|
+
.pie-segment.interactive:hover,
|
|
302
|
+
.pie-segment.hovered {
|
|
289
303
|
filter: brightness(1.1);
|
|
290
304
|
}
|
|
291
305
|
.pie-segment.interactive:focus {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Build arity -> chemical-system hierarchy data for the Sunburst component
|
|
2
2
|
// (counterpart to pymatviz's chem_sys_sunburst).
|
|
3
|
-
import {
|
|
3
|
+
import { is_elem_symbol } from '../element';
|
|
4
|
+
import { parse_formula } from './parse';
|
|
4
5
|
const ARITY_NAMES = [
|
|
5
6
|
``,
|
|
6
7
|
`unary`,
|
|
@@ -29,7 +30,7 @@ export function chem_sys_sunburst_data(entries) {
|
|
|
29
30
|
let elements;
|
|
30
31
|
if (entry.includes(`-`)) {
|
|
31
32
|
elements = entry.split(`-`).map((el) => el.trim());
|
|
32
|
-
if (!elements.every(
|
|
33
|
+
if (!elements.every(is_elem_symbol))
|
|
33
34
|
return null;
|
|
34
35
|
}
|
|
35
36
|
else {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { format_num } from '../labels';
|
|
2
|
-
import {
|
|
2
|
+
import { is_elem_symbol } from '../element';
|
|
3
|
+
import { ELEMENT_ELECTRONEGATIVITY_MAP, parse_composition } from './parse';
|
|
3
4
|
// Extract composition from structure object
|
|
4
5
|
const structure_to_composition = (structure) => {
|
|
5
6
|
if (!structure.sites || !Array.isArray(structure.sites)) {
|
|
@@ -20,7 +21,7 @@ const structure_to_composition = (structure) => {
|
|
|
20
21
|
const is_structure_like = (input) => `sites` in input || `lattice` in input;
|
|
21
22
|
// Format composition into chemical formula string
|
|
22
23
|
export const format_composition_formula = (composition, sort_fn, plain_text = false, delim = ` `, amount_format = `.3~s`) => {
|
|
23
|
-
const symbols = Object.keys(composition).filter(
|
|
24
|
+
const symbols = Object.keys(composition).filter(is_elem_symbol);
|
|
24
25
|
return sort_fn(symbols)
|
|
25
26
|
.filter((el) => composition[el] && composition[el] > 0)
|
|
26
27
|
.map((el) => {
|
|
@@ -85,7 +86,7 @@ export const get_electro_neg_formula = (input, plain_text = false, delim = ` `,
|
|
|
85
86
|
export function get_formula_label_segments(formula) {
|
|
86
87
|
const segments = [];
|
|
87
88
|
let cursor = 0;
|
|
88
|
-
for (const match of formula.matchAll(/([A-Za-z])(
|
|
89
|
+
for (const match of formula.matchAll(/(?<letter>[A-Za-z])(?<amount>\d+(?:\.\d+)?)/g)) {
|
|
89
90
|
const match_idx = match.index ?? 0;
|
|
90
91
|
const prefix = match[1];
|
|
91
92
|
const amount = match[2];
|
|
@@ -18,4 +18,6 @@ export type ChartSegmentData = {
|
|
|
18
18
|
font_scale: number;
|
|
19
19
|
text_color: string;
|
|
20
20
|
};
|
|
21
|
+
export declare const chart_segment_suffix: (amount: number | undefined, fraction: number, show_amounts: boolean, show_percentages: boolean) => string;
|
|
22
|
+
export declare const chart_segment_label: (element: string, amount: number | undefined, fraction: number, show_amounts: boolean, show_percentages: boolean) => string;
|
|
21
23
|
export declare function get_chart_font_scale(base_scale: number, label_text: string, available_space: number, min_scale_factor?: number, base_font_size?: number): number;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { format_num } from '../labels';
|
|
1
2
|
export { default as BarChart } from './BarChart.svelte';
|
|
2
3
|
export { default as BubbleChart } from './BubbleChart.svelte';
|
|
3
4
|
export * from './chem-sys';
|
|
@@ -7,6 +8,19 @@ export { default as Formula } from './Formula.svelte';
|
|
|
7
8
|
export { default as FormulaFilter } from './FormulaFilter.svelte';
|
|
8
9
|
export * from './parse';
|
|
9
10
|
export { default as PieChart } from './PieChart.svelte';
|
|
11
|
+
// Amount/percentage suffix rendered after the element symbol in bar/pie chart
|
|
12
|
+
// segments; `=` separates amount from percentage when both are shown (Fe2=20%).
|
|
13
|
+
// format_num (not toString) so float noise like 0.30000000000000004 can't leak
|
|
14
|
+
// into labels; same format convention as format_composition_formula subscripts
|
|
15
|
+
// (`.3~s`, avoiding SI prefixes for sub-1 amounts where `s` renders 0.5 as 500m)
|
|
16
|
+
export const chart_segment_suffix = (amount, fraction, show_amounts, show_percentages) => (show_amounts && amount !== undefined
|
|
17
|
+
? format_num(amount, Math.abs(amount) < 1 ? `.3~g` : `.3~s`)
|
|
18
|
+
: ``) +
|
|
19
|
+
(show_amounts && show_percentages ? `=` : ``) +
|
|
20
|
+
(show_percentages ? format_num(fraction, `.1~%`) : ``);
|
|
21
|
+
// Full segment label used to estimate label width for font scaling; must match
|
|
22
|
+
// the text the charts actually render (element symbol + chart_segment_suffix)
|
|
23
|
+
export const chart_segment_label = (element, amount, fraction, show_amounts, show_percentages) => element + chart_segment_suffix(amount, fraction, show_amounts, show_percentages);
|
|
10
24
|
export function get_chart_font_scale(base_scale, label_text, available_space, min_scale_factor = 0.7, base_font_size = 16) {
|
|
11
25
|
const text_width = label_text.length * 0.6 * base_font_size * base_scale;
|
|
12
26
|
return available_space > 0 && text_width > available_space
|