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,11 +1,13 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
-
import type { ConvexHullEntry, PhaseStats } from './types';
|
|
2
|
+
import type { ConvexHullEntry, EntryCategoryConfig, PhaseStats } from './types';
|
|
3
3
|
type $$ComponentProps = HTMLAttributes<HTMLDivElement> & {
|
|
4
4
|
phase_stats: PhaseStats | null;
|
|
5
5
|
stable_entries: ConvexHullEntry[];
|
|
6
6
|
unstable_entries: ConvexHullEntry[];
|
|
7
7
|
show_stable?: boolean;
|
|
8
8
|
show_unstable?: boolean;
|
|
9
|
+
entry_category?: EntryCategoryConfig | null;
|
|
10
|
+
hidden_categories?: string[];
|
|
9
11
|
layout?: `toggle` | `side-by-side`;
|
|
10
12
|
on_entry_click?: (entry: ConvexHullEntry) => void;
|
|
11
13
|
highlighted_entry_id?: string;
|
|
@@ -7,35 +7,35 @@
|
|
|
7
7
|
import { TooltipContent } from '../tooltip'
|
|
8
8
|
import type { PolymorphStats } from './helpers'
|
|
9
9
|
import type { ConvexHullTooltipProp, TooltipSnippetProps } from './index'
|
|
10
|
-
import type { HighlightStyle, PhaseData } from './types'
|
|
11
|
-
import {
|
|
10
|
+
import type { EntryCategoryConfig, HighlightStyle, PhaseData } from './types'
|
|
11
|
+
import { MAGNETIC_ORDERING_CATEGORY } from './types'
|
|
12
|
+
import { get_entry_category, is_unary_entry } from './helpers'
|
|
12
13
|
|
|
13
14
|
let {
|
|
14
15
|
entry,
|
|
15
16
|
polymorph_stats_map,
|
|
16
17
|
highlight_style,
|
|
18
|
+
entry_category = MAGNETIC_ORDERING_CATEGORY,
|
|
17
19
|
tooltip,
|
|
18
20
|
show_fractional = true,
|
|
19
21
|
}: {
|
|
20
22
|
entry: EntryT
|
|
21
23
|
polymorph_stats_map?: Map<string, PolymorphStats>
|
|
22
24
|
highlight_style?: HighlightStyle
|
|
25
|
+
entry_category?: EntryCategoryConfig | null
|
|
23
26
|
tooltip?: ConvexHullTooltipProp<EntryT>
|
|
24
27
|
show_fractional?: boolean
|
|
25
28
|
} = $props()
|
|
26
29
|
|
|
27
30
|
const is_element = $derived(is_unary_entry(entry))
|
|
28
31
|
const elem_symbol = $derived(
|
|
29
|
-
is_element
|
|
30
|
-
? (Object.entries(entry.composition).find(([, n]) => n > 0)?.[0] ?? ``)
|
|
31
|
-
: ``,
|
|
32
|
+
is_element ? (Object.entries(entry.composition).find(([, n]) => n > 0)?.[0] ?? ``) : ``,
|
|
32
33
|
) as ElementSymbol | ``
|
|
33
34
|
const elem_name = $derived(elem_symbol && ELEM_SYMBOL_TO_NAME[elem_symbol])
|
|
34
35
|
const polymorph_stats = $derived(
|
|
35
|
-
entry.entry_id && polymorph_stats_map
|
|
36
|
-
? polymorph_stats_map.get(entry.entry_id)
|
|
37
|
-
: null,
|
|
36
|
+
entry.entry_id && polymorph_stats_map ? polymorph_stats_map.get(entry.entry_id) : null,
|
|
38
37
|
)
|
|
38
|
+
const category_value = $derived(get_entry_category(entry, entry_category))
|
|
39
39
|
</script>
|
|
40
40
|
|
|
41
41
|
<TooltipContent
|
|
@@ -69,16 +69,18 @@
|
|
|
69
69
|
{#if entry.e_form_per_atom != null}
|
|
70
70
|
<div>E<sub>form</sub>: {format_num(entry.e_form_per_atom, `.3~`)} eV/atom</div>
|
|
71
71
|
{/if}
|
|
72
|
+
{#if entry_category && category_value}
|
|
73
|
+
<div title={entry_category.labels?.[category_value]}>
|
|
74
|
+
{entry_category.label}: {category_value}
|
|
75
|
+
</div>
|
|
76
|
+
{/if}
|
|
72
77
|
|
|
73
78
|
{#if show_fractional && !is_element}
|
|
74
|
-
{@const total = Object.values(entry.composition).reduce(
|
|
75
|
-
(sum, amt) => sum + amt,
|
|
76
|
-
0,
|
|
77
|
-
)}
|
|
79
|
+
{@const total = Object.values(entry.composition).reduce((sum, amt) => sum + amt, 0)}
|
|
78
80
|
{#if total > 0}
|
|
79
81
|
{@const fractions = Object.entries(entry.composition)
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
.filter(([, amt]) => amt > 0)
|
|
83
|
+
.map(([el, amt]) => `${el}<sub>${format_num(amt / total, `.2~`)}</sub>`)}
|
|
82
84
|
{#if fractions.length > 1}
|
|
83
85
|
<div>Fractional: {@html sanitize_html(fractions.join(` `))}</div>
|
|
84
86
|
{/if}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { PolymorphStats } from './helpers';
|
|
2
2
|
import type { ConvexHullTooltipProp } from './index';
|
|
3
|
-
import type { HighlightStyle, PhaseData } from './types';
|
|
3
|
+
import type { EntryCategoryConfig, HighlightStyle, PhaseData } from './types';
|
|
4
4
|
declare function $$render<EntryT extends PhaseData = PhaseData>(): {
|
|
5
5
|
props: {
|
|
6
6
|
entry: EntryT;
|
|
7
7
|
polymorph_stats_map?: Map<string, PolymorphStats>;
|
|
8
8
|
highlight_style?: HighlightStyle;
|
|
9
|
+
entry_category?: EntryCategoryConfig | null;
|
|
9
10
|
tooltip?: ConvexHullTooltipProp<EntryT>;
|
|
10
11
|
show_fractional?: boolean;
|
|
11
12
|
};
|
|
@@ -59,8 +59,7 @@
|
|
|
59
59
|
|
|
60
60
|
// Convert pressure to log scale slider position (0-100)
|
|
61
61
|
const pressure_to_slider = (P: number): number =>
|
|
62
|
-
((Math.max(LOG_P_MIN, Math.min(LOG_P_MAX, Math.log10(P))) - LOG_P_MIN) /
|
|
63
|
-
LOG_P_RANGE) * 100
|
|
62
|
+
((Math.max(LOG_P_MIN, Math.min(LOG_P_MAX, Math.log10(P))) - LOG_P_MIN) / LOG_P_RANGE) * 100
|
|
64
63
|
|
|
65
64
|
// Convert slider position (0-100) to pressure
|
|
66
65
|
const slider_to_pressure = (value: number): number =>
|
|
@@ -68,7 +67,7 @@
|
|
|
68
67
|
|
|
69
68
|
// Format gas name for display (subscript numbers)
|
|
70
69
|
const format_gas_name = (gas: GasSpecies): string =>
|
|
71
|
-
gas.replaceAll(/(
|
|
70
|
+
gas.replaceAll(/(?<digits>\d+)/g, `<sub>$1</sub>`)
|
|
72
71
|
|
|
73
72
|
// Format pressure as plain text (no HTML) for the number input
|
|
74
73
|
function format_pressure(P: number): string {
|
|
@@ -102,24 +101,18 @@
|
|
|
102
101
|
}
|
|
103
102
|
|
|
104
103
|
function set_pressure_direct(gas: GasSpecies, value: number): void {
|
|
105
|
-
const clamped = Math.max(
|
|
106
|
-
10 ** LOG_P_MIN,
|
|
107
|
-
Math.min(10 ** LOG_P_MAX, value),
|
|
108
|
-
)
|
|
104
|
+
const clamped = Math.max(10 ** LOG_P_MIN, Math.min(10 ** LOG_P_MAX, value))
|
|
109
105
|
pressures = { ...pressures, [gas]: clamped }
|
|
110
106
|
}
|
|
111
107
|
</script>
|
|
112
108
|
|
|
113
109
|
{#if enabled_gases.length > 0}
|
|
114
|
-
<div {...rest} class=
|
|
110
|
+
<div {...rest} class={[`pressure-controls`, position, rest.class]}>
|
|
115
111
|
{#each enabled_gases as gas (gas)}
|
|
116
112
|
{@const P = get_pressure(gas)}
|
|
117
113
|
{@const mu = get_mu(gas)}
|
|
118
114
|
{@const tooltip_content = `${gas} partial pressure for μ(T,P)\nμ = ${format_chemical_potential(mu, 3)}`}
|
|
119
|
-
<div
|
|
120
|
-
class="pressure-slider"
|
|
121
|
-
{@attach tooltip({ content: tooltip_content })}
|
|
122
|
-
>
|
|
115
|
+
<div class="pressure-slider" {@attach tooltip({ content: tooltip_content })}>
|
|
123
116
|
<label class="pressure-label">
|
|
124
117
|
<input
|
|
125
118
|
type="text"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { get_electro_neg_formula } from '../composition'
|
|
4
4
|
import Icon from '../Icon.svelte'
|
|
5
5
|
import { format_num } from '../labels'
|
|
6
|
-
import { DragControlTab } from '../overlays'
|
|
6
|
+
import { DragControlTab, GlassChip } from '../overlays'
|
|
7
7
|
import { sanitize_formula } from '../sanitize'
|
|
8
8
|
import { Structure } from '../structure'
|
|
9
9
|
import type { StructurePopupContext, StructurePopupStats } from './types'
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
width = 500,
|
|
18
18
|
height = 400,
|
|
19
19
|
onclose,
|
|
20
|
+
close_on_outside = true,
|
|
21
|
+
show_drag_handle = true,
|
|
20
22
|
stats,
|
|
21
23
|
top_left,
|
|
22
24
|
children,
|
|
@@ -28,6 +30,8 @@
|
|
|
28
30
|
width?: number
|
|
29
31
|
height?: number
|
|
30
32
|
onclose?: () => void
|
|
33
|
+
close_on_outside?: boolean
|
|
34
|
+
show_drag_handle?: boolean
|
|
31
35
|
stats?: StructurePopupStats
|
|
32
36
|
top_left?: Snippet<[StructurePopupContext]>
|
|
33
37
|
children?: Snippet<[StructurePopupContext]>
|
|
@@ -35,7 +39,8 @@
|
|
|
35
39
|
} = $props()
|
|
36
40
|
|
|
37
41
|
const formula_html = $derived.by(() =>
|
|
38
|
-
sanitize_formula(get_electro_neg_formula(stats?.formula ?? structure, true))
|
|
42
|
+
sanitize_formula(get_electro_neg_formula(stats?.formula ?? structure, true)),
|
|
43
|
+
)
|
|
39
44
|
const context = $derived({ structure, stats, formula_html })
|
|
40
45
|
</script>
|
|
41
46
|
|
|
@@ -48,6 +53,7 @@
|
|
|
48
53
|
<svelte:window
|
|
49
54
|
onkeydown={(event) => event.key === `Escape` && onclose?.()}
|
|
50
55
|
onmousedown={(event) => {
|
|
56
|
+
if (!close_on_outside) return
|
|
51
57
|
if (!popup_div || !(event.target instanceof Node)) return
|
|
52
58
|
if (!popup_div.contains(event.target)) onclose?.()
|
|
53
59
|
}}
|
|
@@ -58,34 +64,36 @@
|
|
|
58
64
|
handle_selector: `.drag-handle`,
|
|
59
65
|
})}
|
|
60
66
|
{...rest}
|
|
61
|
-
class=
|
|
67
|
+
class={[`structure-popup`, place_right ? `right` : `left`, rest.class]}
|
|
62
68
|
role="dialog"
|
|
63
69
|
aria-modal="true"
|
|
64
70
|
tabindex="-1"
|
|
65
71
|
bind:this={popup_div}
|
|
66
72
|
>
|
|
67
|
-
|
|
73
|
+
{#if show_drag_handle}
|
|
74
|
+
<DragControlTab />
|
|
75
|
+
{/if}
|
|
68
76
|
<div class="structure-popup-content">
|
|
69
77
|
{#if top_left || stats}
|
|
70
|
-
<
|
|
78
|
+
<GlassChip class="structure-stats">
|
|
71
79
|
{#if top_left}
|
|
72
80
|
{@render top_left(context)}
|
|
73
81
|
{:else if stats}
|
|
74
82
|
{#if stats.id}
|
|
75
|
-
ID = {stats.id}<br
|
|
83
|
+
ID = {stats.id}<br />
|
|
76
84
|
{/if}
|
|
77
85
|
{#if formula_html}
|
|
78
|
-
{@html formula_html}<br
|
|
86
|
+
{@html formula_html}<br />
|
|
79
87
|
{/if}
|
|
80
88
|
{#if stats.e_above_hull != null}
|
|
81
|
-
E<sub>above hull</sub> = {format_num(stats.e_above_hull, `.3~`)} eV/atom<br
|
|
89
|
+
E<sub>above hull</sub> = {format_num(stats.e_above_hull, `.3~`)} eV/atom<br />
|
|
82
90
|
{/if}
|
|
83
91
|
{#if stats.e_form != null}
|
|
84
92
|
E<sub>form</sub> = {format_num(stats.e_form, `.3~`)}
|
|
85
93
|
eV/atom
|
|
86
94
|
{/if}
|
|
87
95
|
{/if}
|
|
88
|
-
</
|
|
96
|
+
</GlassChip>
|
|
89
97
|
{/if}
|
|
90
98
|
|
|
91
99
|
<Structure
|
|
@@ -136,16 +144,4 @@
|
|
|
136
144
|
.close-btn:hover {
|
|
137
145
|
background: var(--pane-btn-bg-hover);
|
|
138
146
|
}
|
|
139
|
-
.structure-stats {
|
|
140
|
-
position: absolute;
|
|
141
|
-
top: 10px;
|
|
142
|
-
left: 10px;
|
|
143
|
-
background: transparent;
|
|
144
|
-
backdrop-filter: blur(8px);
|
|
145
|
-
color: var(--text-color);
|
|
146
|
-
padding: 4px 8px;
|
|
147
|
-
border-radius: 6px;
|
|
148
|
-
font-size: 0.85em;
|
|
149
|
-
z-index: 2;
|
|
150
|
-
}
|
|
151
147
|
</style>
|
|
@@ -8,6 +8,8 @@ type $$ComponentProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
|
8
8
|
width?: number;
|
|
9
9
|
height?: number;
|
|
10
10
|
onclose?: () => void;
|
|
11
|
+
close_on_outside?: boolean;
|
|
12
|
+
show_drag_handle?: boolean;
|
|
11
13
|
stats?: StructurePopupStats;
|
|
12
14
|
top_left?: Snippet<[StructurePopupContext]>;
|
|
13
15
|
children?: Snippet<[StructurePopupContext]>;
|
|
@@ -16,15 +16,11 @@
|
|
|
16
16
|
let last_update_time = 0
|
|
17
17
|
const THROTTLE_MS = 100
|
|
18
18
|
|
|
19
|
-
const temp_index = $derived(
|
|
20
|
-
Math.max(0, available_temperatures.indexOf(temperature)),
|
|
21
|
-
)
|
|
19
|
+
const temp_index = $derived(Math.max(0, available_temperatures.indexOf(temperature)))
|
|
22
20
|
const display_index = $derived(preview_index ?? temp_index)
|
|
23
21
|
const display_temp = $derived(available_temperatures[display_index] ?? temperature)
|
|
24
22
|
|
|
25
|
-
function handle_slider_input(
|
|
26
|
-
event: Event & { currentTarget: HTMLInputElement },
|
|
27
|
-
): void {
|
|
23
|
+
function handle_slider_input(event: Event & { currentTarget: HTMLInputElement }): void {
|
|
28
24
|
const new_index = Number(event.currentTarget.value)
|
|
29
25
|
preview_index = new_index
|
|
30
26
|
// Throttle parent updates during drag to prevent scene flashing
|
|
@@ -35,9 +31,7 @@
|
|
|
35
31
|
}
|
|
36
32
|
}
|
|
37
33
|
|
|
38
|
-
function handle_slider_end(
|
|
39
|
-
event: Event & { currentTarget: HTMLInputElement },
|
|
40
|
-
): void {
|
|
34
|
+
function handle_slider_end(event: Event & { currentTarget: HTMLInputElement }): void {
|
|
41
35
|
const new_temp = available_temperatures[Number(event.currentTarget.value)]
|
|
42
36
|
if (new_temp !== undefined) temperature = new_temp
|
|
43
37
|
preview_index = null
|
|
@@ -53,7 +47,7 @@
|
|
|
53
47
|
|
|
54
48
|
<div
|
|
55
49
|
{...rest}
|
|
56
|
-
class=
|
|
50
|
+
class={[`temperature-slider`, rest.class]}
|
|
57
51
|
{@attach tooltip({ content: `Temperature for G(T) free energies` })}
|
|
58
52
|
>
|
|
59
53
|
<label class="temp-label">
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import type { ElementSymbol } from '../element';
|
|
2
|
-
import type { Point3D, Vec3 } from '../math';
|
|
2
|
+
import type { Point3D, Vec2, Vec3 } from '../math';
|
|
3
3
|
import type { ConvexHullEntry, PhaseData } from './types';
|
|
4
4
|
export declare const TRIANGLE_VERTICES: readonly [readonly [1, 0], readonly [0.5, number], readonly [0, 0]];
|
|
5
5
|
export declare function composition_to_barycentric_3d(composition: Record<string, number>, elements: ElementSymbol[]): Vec3;
|
|
6
|
-
export declare function barycentric_to_ternary_xy(barycentric: Vec3):
|
|
6
|
+
export declare function barycentric_to_ternary_xy(barycentric: Vec3): Vec2;
|
|
7
7
|
export declare function barycentric_to_ternary_xyz(barycentric: Vec3, formation_energy: number): Point3D;
|
|
8
8
|
export declare function get_triangle_centroid(): Point3D;
|
|
9
|
-
export declare function calculate_face_normal(p1: Point3D, p2: Point3D, p3: Point3D): Point3D;
|
|
10
|
-
export declare const calculate_face_centroid: (p1: Point3D, p2: Point3D, p3: Point3D) => Point3D;
|
|
11
9
|
export declare function get_ternary_3d_coordinates(entries: PhaseData[], elements: ElementSymbol[], el_refs?: Record<string, PhaseData>): ConvexHullEntry[];
|
|
12
10
|
export declare function get_triangle_edges(): [Point3D, Point3D][];
|
|
13
11
|
export declare function get_triangle_vertical_edges(min_z: number, max_z: number): [Point3D, Point3D][];
|
|
@@ -10,13 +10,7 @@ export function composition_to_barycentric_3d(composition, elements) {
|
|
|
10
10
|
if (elements.length !== 3) {
|
|
11
11
|
throw new Error(`Ternary system requires exactly 3 elements, got ${elements.length}`);
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
const total = amounts.reduce((sum, amt) => sum + amt, 0);
|
|
15
|
-
if (total === 0) {
|
|
16
|
-
throw new Error(`Composition has no elements from the ternary system: ${elements.join(`-`)}`);
|
|
17
|
-
}
|
|
18
|
-
const normalized = amounts.map((amount) => amount / total);
|
|
19
|
-
return [normalized[0], normalized[1], normalized[2]];
|
|
13
|
+
return composition_to_barycentric_nd(composition, elements);
|
|
20
14
|
}
|
|
21
15
|
// map barycentric coordinates to triangular 2D coordinates
|
|
22
16
|
export function barycentric_to_ternary_xy(barycentric) {
|
|
@@ -37,22 +31,6 @@ export function get_triangle_centroid() {
|
|
|
37
31
|
const centroid_y = (v0[1] + v1[1] + v2[1]) / 3;
|
|
38
32
|
return { x: centroid_x, y: centroid_y, z: 0 };
|
|
39
33
|
}
|
|
40
|
-
export function calculate_face_normal(p1, p2, p3) {
|
|
41
|
-
const edge1 = { x: p2.x - p1.x, y: p2.y - p1.y, z: p2.z - p1.z };
|
|
42
|
-
const edge2 = { x: p3.x - p1.x, y: p3.y - p1.y, z: p3.z - p1.z };
|
|
43
|
-
const nx = edge1.y * edge2.z - edge1.z * edge2.y;
|
|
44
|
-
const ny = edge1.z * edge2.x - edge1.x * edge2.z;
|
|
45
|
-
const nz = edge1.x * edge2.y - edge1.y * edge2.x;
|
|
46
|
-
const magnitude = Math.hypot(nx, ny, nz);
|
|
47
|
-
if (magnitude === 0)
|
|
48
|
-
return { x: 0, y: 0, z: 1 };
|
|
49
|
-
return { x: nx / magnitude, y: ny / magnitude, z: nz / magnitude };
|
|
50
|
-
}
|
|
51
|
-
export const calculate_face_centroid = (p1, p2, p3) => ({
|
|
52
|
-
x: (p1.x + p2.x + p3.x) / 3,
|
|
53
|
-
y: (p1.y + p2.y + p3.y) / 3,
|
|
54
|
-
z: (p1.z + p2.z + p3.z) / 3,
|
|
55
|
-
});
|
|
56
34
|
export function get_ternary_3d_coordinates(entries, elements, el_refs) {
|
|
57
35
|
if (elements.length !== 3) {
|
|
58
36
|
throw new Error(`Ternary convex hull requires exactly 3 elements, got ${elements.length}`);
|
|
@@ -105,14 +83,14 @@ export function get_triangle_vertical_edges(min_z, max_z) {
|
|
|
105
83
|
{ ...vertex, z: max_z },
|
|
106
84
|
]);
|
|
107
85
|
}
|
|
108
|
-
// --- N-dimensional barycentric coordinates (
|
|
86
|
+
// --- N-dimensional barycentric coordinates (the 3D/4D converters wrap this) ---
|
|
109
87
|
// Convert composition to N-dimensional barycentric coordinates
|
|
110
88
|
// Returns array of length N where coords sum to 1 (all N coords are explicit)
|
|
111
89
|
// The last coordinate represents formation energy when used in hull calculations
|
|
112
90
|
export function composition_to_barycentric_nd(composition, elements) {
|
|
113
|
-
const
|
|
114
|
-
if (
|
|
115
|
-
throw new Error(`Barycentric coordinates require at least 2 elements, got ${
|
|
91
|
+
const n_elems = elements.length;
|
|
92
|
+
if (n_elems < 2) {
|
|
93
|
+
throw new Error(`Barycentric coordinates require at least 2 elements, got ${n_elems}`);
|
|
116
94
|
}
|
|
117
95
|
// NaN and undefined/missing elements are treated as 0
|
|
118
96
|
const amounts = elements.map((el) => {
|
|
@@ -146,12 +124,7 @@ export function composition_to_barycentric_4d(composition, elements) {
|
|
|
146
124
|
if (elements.length !== 4) {
|
|
147
125
|
throw new Error(`Quaternary barycentric coordinates require exactly 4 elements`);
|
|
148
126
|
}
|
|
149
|
-
|
|
150
|
-
const total = amounts.reduce((sum, amount) => sum + amount, 0);
|
|
151
|
-
if (total === 0) {
|
|
152
|
-
throw new Error(`Composition has no elements from the quaternary system: ${elements.join(`-`)}`);
|
|
153
|
-
}
|
|
154
|
-
return amounts.map((amount) => amount / total);
|
|
127
|
+
return composition_to_barycentric_nd(composition, elements);
|
|
155
128
|
}
|
|
156
129
|
// map barycentric coordinates to tetrahedral 3D coordinates
|
|
157
130
|
export function barycentric_to_tetrahedral(barycentric) {
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { AnyStructure } from '../structure';
|
|
2
|
+
import type { ConvexHullEntry, EntryCategoryConfig, HoverData3D, PhaseData } from './types';
|
|
3
|
+
export interface CanvasInteractionInputs {
|
|
4
|
+
wheel_clamp: [min: number, max: number];
|
|
5
|
+
fullscreen_bg_var: string;
|
|
6
|
+
canvas: () => HTMLCanvasElement | undefined;
|
|
7
|
+
wrapper: () => HTMLDivElement | undefined;
|
|
8
|
+
ctx: () => CanvasRenderingContext2D | null;
|
|
9
|
+
set_ctx: (ctx: CanvasRenderingContext2D | null) => void;
|
|
10
|
+
set_canvas_dims: (dims: {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
scale: number;
|
|
14
|
+
}) => void;
|
|
15
|
+
visible_entries: () => ConvexHullEntry[];
|
|
16
|
+
plot_entries: () => ConvexHullEntry[];
|
|
17
|
+
selected_entry: () => ConvexHullEntry | null;
|
|
18
|
+
set_selected_entry: (entry: ConvexHullEntry | null) => void;
|
|
19
|
+
fullscreen: () => boolean;
|
|
20
|
+
enable_click_selection: () => boolean;
|
|
21
|
+
enable_structure_preview: () => boolean;
|
|
22
|
+
on_point_click: () => ((entry: ConvexHullEntry) => void) | undefined;
|
|
23
|
+
on_point_hover: () => ((data: HoverData3D | null) => void) | undefined;
|
|
24
|
+
on_file_drop: () => ((entries: PhaseData[]) => void) | undefined;
|
|
25
|
+
entry_category: () => EntryCategoryConfig | null;
|
|
26
|
+
zoom: () => number;
|
|
27
|
+
set_zoom: (zoom: number) => void;
|
|
28
|
+
project_point: (x: number, y: number, z: number) => {
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
depth: number;
|
|
32
|
+
};
|
|
33
|
+
extract_structure: (entry: ConvexHullEntry) => AnyStructure | null;
|
|
34
|
+
render_frame: () => void;
|
|
35
|
+
on_drag: (dx: number, dy: number, panning: boolean) => void;
|
|
36
|
+
on_fullscreen_change: () => void;
|
|
37
|
+
actions: () => Record<string, () => void>;
|
|
38
|
+
}
|
|
39
|
+
export declare function create_canvas_interactions(inputs: CanvasInteractionInputs): {
|
|
40
|
+
readonly is_dragging: boolean;
|
|
41
|
+
readonly hover_data: HoverData3D<ConvexHullEntry> | null;
|
|
42
|
+
readonly drag_over: boolean;
|
|
43
|
+
readonly modal_open: boolean;
|
|
44
|
+
readonly selected_structure: AnyStructure | null;
|
|
45
|
+
readonly modal_place_right: boolean;
|
|
46
|
+
readonly sorted_points_cache: {
|
|
47
|
+
entry: ConvexHullEntry;
|
|
48
|
+
projected: {
|
|
49
|
+
x: number;
|
|
50
|
+
y: number;
|
|
51
|
+
depth: number;
|
|
52
|
+
};
|
|
53
|
+
}[];
|
|
54
|
+
copy_feedback: {
|
|
55
|
+
visible: boolean;
|
|
56
|
+
position: {
|
|
57
|
+
x: number;
|
|
58
|
+
y: number;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
canvas_handlers: {
|
|
62
|
+
onmousedown: (event: MouseEvent) => void;
|
|
63
|
+
onmousemove: (event: MouseEvent) => void;
|
|
64
|
+
onclick: (event: MouseEvent) => void;
|
|
65
|
+
onkeydown: (event: KeyboardEvent) => void;
|
|
66
|
+
ondblclick: (event: MouseEvent) => void;
|
|
67
|
+
onwheel: (event: WheelEvent) => void;
|
|
68
|
+
};
|
|
69
|
+
wrapper_handlers: {
|
|
70
|
+
onkeydown: (event: KeyboardEvent) => void;
|
|
71
|
+
ondrop: (event: DragEvent) => Promise<void>;
|
|
72
|
+
ondragover: (event: DragEvent) => void;
|
|
73
|
+
ondragleave: (event: DragEvent) => void;
|
|
74
|
+
};
|
|
75
|
+
handle_mouse_move: (event: MouseEvent) => void;
|
|
76
|
+
handle_mouse_up: () => void;
|
|
77
|
+
close_structure_popup: () => void;
|
|
78
|
+
render_once: () => void;
|
|
79
|
+
};
|