matterviz 0.3.7 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Icon.svelte +7 -4
- package/dist/MillerIndexInput.svelte +1 -1
- package/dist/api/optimade.js +32 -26
- package/dist/app.css +0 -3
- package/dist/brillouin/BrillouinZone.svelte +76 -148
- package/dist/brillouin/BrillouinZone.svelte.d.ts +6 -14
- package/dist/brillouin/BrillouinZoneExportPane.svelte +43 -96
- package/dist/brillouin/BrillouinZoneExportPane.svelte.d.ts +1 -1
- package/dist/brillouin/BrillouinZoneInfoPane.svelte +9 -32
- package/dist/brillouin/BrillouinZoneInfoPane.svelte.d.ts +2 -3
- package/dist/brillouin/BrillouinZoneScene.svelte +97 -205
- package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +4 -23
- package/dist/brillouin/BrillouinZoneTooltip.svelte +16 -25
- package/dist/brillouin/ReciprocalVectors.svelte +39 -0
- package/dist/brillouin/ReciprocalVectors.svelte.d.ts +9 -0
- package/dist/brillouin/compute.d.ts +2 -0
- package/dist/brillouin/compute.js +89 -90
- package/dist/brillouin/geometry.d.ts +8 -0
- package/dist/brillouin/geometry.js +57 -0
- package/dist/brillouin/index.d.ts +2 -0
- package/dist/brillouin/index.js +2 -0
- package/dist/brillouin/types.d.ts +2 -2
- package/dist/chempot-diagram/ChemPotDiagram.svelte +14 -13
- package/dist/chempot-diagram/ChemPotDiagram.svelte.d.ts +1 -1
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +109 -203
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +4 -1
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +180 -470
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +7 -1
- package/dist/chempot-diagram/async-compute.svelte.js +3 -1
- package/dist/chempot-diagram/chempot-worker.js +2 -1
- package/dist/chempot-diagram/color.d.ts +3 -6
- package/dist/chempot-diagram/color.js +5 -5
- package/dist/chempot-diagram/compute.d.ts +4 -4
- package/dist/chempot-diagram/compute.js +20 -20
- package/dist/chempot-diagram/controls-state.svelte.d.ts +10 -0
- package/dist/chempot-diagram/controls-state.svelte.js +42 -0
- package/dist/chempot-diagram/export.d.ts +47 -0
- package/dist/chempot-diagram/export.js +133 -0
- package/dist/chempot-diagram/index.d.ts +1 -0
- package/dist/chempot-diagram/index.js +1 -0
- package/dist/chempot-diagram/pointer.d.ts +0 -10
- package/dist/chempot-diagram/pointer.js +4 -4
- package/dist/chempot-diagram/types.d.ts +3 -3
- package/dist/colors/index.js +8 -7
- package/dist/composition/FormulaFilter.svelte +18 -11
- package/dist/composition/PieChart.svelte +11 -10
- package/dist/composition/chem-sys.d.ts +8 -0
- package/dist/composition/chem-sys.js +86 -0
- package/dist/composition/format.js +7 -4
- package/dist/composition/index.d.ts +1 -0
- package/dist/composition/index.js +1 -0
- package/dist/composition/parse.d.ts +0 -1
- package/dist/composition/parse.js +41 -31
- package/dist/controls.d.ts +1 -0
- package/dist/controls.js +0 -1
- package/dist/convex-hull/ConvexHull.svelte +8 -10
- package/dist/convex-hull/ConvexHull.svelte.d.ts +1 -4
- package/dist/convex-hull/ConvexHull2D.svelte +106 -185
- package/dist/convex-hull/ConvexHull2D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull3D.svelte +179 -683
- package/dist/convex-hull/ConvexHull3D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull4D.svelte +183 -687
- package/dist/convex-hull/ConvexHull4D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHullChrome.svelte +268 -0
- package/dist/convex-hull/ConvexHullChrome.svelte.d.ts +30 -0
- package/dist/convex-hull/ConvexHullControls.svelte +88 -7
- package/dist/convex-hull/ConvexHullControls.svelte.d.ts +7 -6
- package/dist/convex-hull/ConvexHullInfoPane.svelte +18 -5
- package/dist/convex-hull/ConvexHullInfoPane.svelte.d.ts +6 -5
- package/dist/convex-hull/ConvexHullStats.svelte +36 -175
- package/dist/convex-hull/ConvexHullStats.svelte.d.ts +3 -1
- package/dist/convex-hull/ConvexHullTooltip.svelte +11 -2
- package/dist/convex-hull/ConvexHullTooltip.svelte.d.ts +2 -1
- package/dist/convex-hull/GasPressureControls.svelte +4 -4
- package/dist/convex-hull/TemperatureSlider.svelte +2 -2
- package/dist/convex-hull/barycentric-coords.d.ts +2 -4
- package/dist/convex-hull/barycentric-coords.js +6 -33
- package/dist/convex-hull/canvas-interactions.svelte.d.ts +79 -0
- package/dist/convex-hull/canvas-interactions.svelte.js +278 -0
- package/dist/convex-hull/demo-temperature.d.ts +1 -1
- package/dist/convex-hull/demo-temperature.js +20 -22
- package/dist/convex-hull/gas-thermodynamics.d.ts +2 -2
- package/dist/convex-hull/gas-thermodynamics.js +22 -30
- package/dist/convex-hull/helpers.d.ts +42 -7
- package/dist/convex-hull/helpers.js +171 -78
- package/dist/convex-hull/hull-state.svelte.d.ts +44 -0
- package/dist/convex-hull/hull-state.svelte.js +124 -0
- package/dist/convex-hull/index.d.ts +10 -8
- package/dist/convex-hull/index.js +7 -2
- package/dist/convex-hull/thermodynamics.js +136 -960
- package/dist/convex-hull/types.d.ts +13 -5
- package/dist/convex-hull/types.js +12 -0
- package/dist/coordination/CoordinationBarPlot.svelte +27 -34
- package/dist/coordination/CoordinationBarPlot.svelte.d.ts +1 -1
- package/dist/element/BohrAtom.svelte +2 -1
- package/dist/element/index.d.ts +4 -0
- package/dist/element/index.js +18 -0
- package/dist/feedback/DragOverlay.svelte +3 -1
- package/dist/feedback/DragOverlay.svelte.d.ts +1 -0
- package/dist/feedback/StatusMessage.svelte +13 -3
- package/dist/fermi-surface/FermiSlice.svelte +13 -5
- package/dist/fermi-surface/FermiSurface.svelte +78 -151
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +5 -14
- package/dist/fermi-surface/FermiSurfaceControls.svelte +1 -1
- package/dist/fermi-surface/FermiSurfaceControls.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceScene.svelte +72 -221
- package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +3 -23
- package/dist/fermi-surface/FermiSurfaceTooltip.svelte +8 -34
- package/dist/fermi-surface/compute.js +67 -66
- package/dist/fermi-surface/export.js +6 -16
- package/dist/fermi-surface/index.d.ts +0 -1
- package/dist/fermi-surface/index.js +0 -1
- package/dist/fermi-surface/parse.d.ts +1 -1
- package/dist/fermi-surface/parse.js +71 -79
- package/dist/fermi-surface/types.d.ts +3 -2
- package/dist/heatmap-matrix/HeatmapMatrix.svelte +69 -52
- package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +4 -3
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +3 -2
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +5 -5
- package/dist/heatmap-matrix/index.d.ts +3 -2
- package/dist/heatmap-matrix/index.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/io/ExportPane.svelte +166 -0
- package/dist/io/ExportPane.svelte.d.ts +17 -0
- package/dist/io/decompress.js +5 -4
- package/dist/io/export.d.ts +9 -5
- package/dist/io/export.js +77 -51
- package/dist/io/fetch.d.ts +2 -1
- package/dist/io/fetch.js +5 -1
- package/dist/io/file-drop.d.ts +8 -1
- package/dist/io/file-drop.js +48 -36
- package/dist/io/index.d.ts +2 -0
- package/dist/io/index.js +10 -0
- package/dist/io/types.d.ts +13 -0
- package/dist/io/url-drop.js +64 -33
- package/dist/isosurface/parse.js +52 -51
- package/dist/isosurface/slice.js +5 -4
- package/dist/isosurface/types.js +1 -1
- package/dist/keyboard.d.ts +3 -0
- package/dist/keyboard.js +23 -0
- package/dist/labels.d.ts +1 -1
- package/dist/labels.js +9 -8
- package/dist/layout/FullscreenButton.svelte +33 -0
- package/dist/layout/FullscreenButton.svelte.d.ts +10 -0
- package/dist/layout/FullscreenToggle.svelte +8 -14
- package/dist/layout/PropertyFilter.svelte +3 -2
- package/dist/layout/SettingsSection.svelte +1 -1
- package/dist/layout/ViewerChrome.svelte +116 -0
- package/dist/layout/ViewerChrome.svelte.d.ts +17 -0
- package/dist/layout/fullscreen.d.ts +4 -0
- package/dist/layout/fullscreen.svelte.d.ts +8 -0
- package/dist/layout/fullscreen.svelte.js +37 -0
- package/dist/layout/index.d.ts +3 -0
- package/dist/layout/index.js +3 -0
- package/dist/layout/json-tree/JsonNode.svelte +1 -1
- package/dist/layout/json-tree/JsonTree.svelte +2 -2
- package/dist/layout/json-tree/utils.js +5 -4
- package/dist/marching-cubes.js +8 -13
- package/dist/math.d.ts +12 -4
- package/dist/math.js +42 -30
- package/dist/overlays/DraggablePane.svelte +4 -4
- package/dist/overlays/index.d.ts +4 -0
- package/dist/periodic-table/PeriodicTable.svelte +27 -15
- package/dist/periodic-table/PropertySelect.svelte +1 -0
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +9 -3
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +1 -1
- package/dist/phase-diagram/PhaseDiagramControls.svelte +3 -2
- package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +4 -3
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +4 -2
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte.d.ts +2 -3
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte +47 -132
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte.d.ts +3 -4
- package/dist/phase-diagram/PhaseDiagramTooltip.svelte +1 -1
- package/dist/phase-diagram/build-diagram.js +2 -2
- package/dist/phase-diagram/colors.js +1 -1
- package/dist/phase-diagram/parse.d.ts +2 -1
- package/dist/phase-diagram/parse.js +6 -5
- package/dist/phase-diagram/types.d.ts +1 -1
- package/dist/phase-diagram/utils.d.ts +3 -3
- package/dist/phase-diagram/utils.js +8 -12
- package/dist/plot/{BarPlot.svelte → bar/BarPlot.svelte} +246 -841
- package/dist/plot/{BarPlot.svelte.d.ts → bar/BarPlot.svelte.d.ts} +8 -16
- package/dist/plot/{BarPlotControls.svelte → bar/BarPlotControls.svelte} +6 -5
- package/dist/plot/{BarPlotControls.svelte.d.ts → bar/BarPlotControls.svelte.d.ts} +3 -3
- package/dist/plot/{SpacegroupBarPlot.svelte → bar/SpacegroupBarPlot.svelte} +8 -7
- package/dist/plot/{SpacegroupBarPlot.svelte.d.ts → bar/SpacegroupBarPlot.svelte.d.ts} +1 -1
- package/dist/plot/bar/data.d.ts +40 -0
- package/dist/plot/bar/data.js +154 -0
- package/dist/plot/bar/geometry.d.ts +39 -0
- package/dist/plot/bar/geometry.js +60 -0
- package/dist/plot/bar/index.d.ts +3 -0
- package/dist/plot/bar/index.js +3 -0
- package/dist/plot/box/BoxPlot.svelte +1292 -0
- package/dist/plot/box/BoxPlot.svelte.d.ts +95 -0
- package/dist/plot/box/BoxPlotControls.svelte +109 -0
- package/dist/plot/box/BoxPlotControls.svelte.d.ts +19 -0
- package/dist/plot/box/Violin.svelte +14 -0
- package/dist/plot/box/Violin.svelte.d.ts +70 -0
- package/dist/plot/box/box-plot.d.ts +56 -0
- package/dist/plot/box/box-plot.js +129 -0
- package/dist/plot/box/index.d.ts +5 -0
- package/dist/plot/box/index.js +5 -0
- package/dist/plot/box/kde.d.ts +17 -0
- package/dist/plot/box/kde.js +160 -0
- package/dist/plot/box/quantile.d.ts +3 -0
- package/dist/plot/box/quantile.js +53 -0
- package/dist/plot/{auto-place.d.ts → core/auto-place.d.ts} +1 -1
- package/dist/plot/{auto-place.js → core/auto-place.js} +6 -3
- package/dist/plot/core/axis-utils.d.ts +46 -0
- package/dist/plot/core/axis-utils.js +110 -0
- package/dist/plot/{AxisLabel.svelte → core/components/AxisLabel.svelte} +2 -2
- package/dist/plot/{AxisLabel.svelte.d.ts → core/components/AxisLabel.svelte.d.ts} +1 -1
- package/dist/plot/{ColorBar.svelte → core/components/ColorBar.svelte} +41 -38
- package/dist/plot/{ColorBar.svelte.d.ts → core/components/ColorBar.svelte.d.ts} +7 -6
- package/dist/plot/{ColorScaleSelect.svelte → core/components/ColorScaleSelect.svelte} +4 -3
- package/dist/plot/{ColorScaleSelect.svelte.d.ts → core/components/ColorScaleSelect.svelte.d.ts} +2 -2
- package/dist/plot/core/components/ControlPane.svelte +46 -0
- package/dist/plot/core/components/ControlPane.svelte.d.ts +13 -0
- package/dist/plot/{FillArea.svelte → core/components/FillArea.svelte} +17 -6
- package/dist/plot/{FillArea.svelte.d.ts → core/components/FillArea.svelte.d.ts} +1 -1
- package/dist/plot/{InteractiveAxisLabel.svelte → core/components/InteractiveAxisLabel.svelte} +3 -3
- package/dist/plot/{InteractiveAxisLabel.svelte.d.ts → core/components/InteractiveAxisLabel.svelte.d.ts} +2 -2
- package/dist/plot/{Line.svelte → core/components/Line.svelte} +33 -15
- package/dist/plot/{Line.svelte.d.ts → core/components/Line.svelte.d.ts} +3 -2
- package/dist/plot/{PlotAxis.svelte → core/components/PlotAxis.svelte} +9 -6
- package/dist/plot/{PlotAxis.svelte.d.ts → core/components/PlotAxis.svelte.d.ts} +5 -3
- package/dist/plot/{PlotControls.svelte → core/components/PlotControls.svelte} +17 -29
- package/dist/plot/core/components/PlotControls.svelte.d.ts +4 -0
- package/dist/plot/{PlotLegend.svelte → core/components/PlotLegend.svelte} +21 -10
- package/dist/plot/{PlotLegend.svelte.d.ts → core/components/PlotLegend.svelte.d.ts} +3 -2
- package/dist/plot/{PlotTooltip.svelte → core/components/PlotTooltip.svelte} +17 -1
- package/dist/plot/{PlotTooltip.svelte.d.ts → core/components/PlotTooltip.svelte.d.ts} +8 -0
- package/dist/plot/{PortalSelect.svelte → core/components/PortalSelect.svelte} +11 -7
- package/dist/plot/{ReferenceLine.svelte → core/components/ReferenceLine.svelte} +3 -3
- package/dist/plot/{ReferenceLine.svelte.d.ts → core/components/ReferenceLine.svelte.d.ts} +1 -1
- package/dist/plot/{ReferenceLine3D.svelte → core/components/ReferenceLine3D.svelte} +5 -5
- package/dist/plot/{ReferenceLine3D.svelte.d.ts → core/components/ReferenceLine3D.svelte.d.ts} +5 -5
- package/dist/plot/{ReferencePlane.svelte → core/components/ReferencePlane.svelte} +8 -8
- package/dist/plot/{ReferencePlane.svelte.d.ts → core/components/ReferencePlane.svelte.d.ts} +5 -5
- package/dist/plot/{ZeroLines.svelte → core/components/ZeroLines.svelte} +3 -3
- package/dist/plot/{ZeroLines.svelte.d.ts → core/components/ZeroLines.svelte.d.ts} +3 -3
- package/dist/plot/{ZoomRect.svelte → core/components/ZoomRect.svelte} +1 -1
- package/dist/plot/{ZoomRect.svelte.d.ts → core/components/ZoomRect.svelte.d.ts} +1 -1
- package/dist/plot/core/components/index.d.ts +17 -0
- package/dist/plot/core/components/index.js +17 -0
- package/dist/plot/{data-cleaning.d.ts → core/data-cleaning.d.ts} +71 -1
- package/dist/plot/{data-cleaning.js → core/data-cleaning.js} +21 -23
- package/dist/plot/{data-transform.d.ts → core/data-transform.d.ts} +2 -2
- package/dist/plot/{data-transform.js → core/data-transform.js} +3 -3
- package/dist/plot/core/fill-utils.d.ts +34 -0
- package/dist/plot/core/fill-utils.js +391 -0
- package/dist/plot/core/index.d.ts +10 -0
- package/dist/plot/core/index.js +11 -0
- package/dist/plot/core/interactions.d.ts +39 -0
- package/dist/plot/core/interactions.js +209 -0
- package/dist/plot/{layout.d.ts → core/layout.d.ts} +1 -0
- package/dist/plot/{layout.js → core/layout.js} +16 -8
- package/dist/plot/core/pan-zoom.svelte.d.ts +35 -0
- package/dist/plot/core/pan-zoom.svelte.js +221 -0
- package/dist/plot/core/placed-tween.svelte.d.ts +21 -0
- package/dist/plot/core/placed-tween.svelte.js +68 -0
- package/dist/plot/{reference-line.d.ts → core/reference-line.d.ts} +11 -11
- package/dist/plot/{reference-line.js → core/reference-line.js} +29 -42
- package/dist/plot/core/scales.d.ts +40 -0
- package/dist/plot/{scales.js → core/scales.js} +94 -93
- package/dist/plot/core/svg.d.ts +3 -0
- package/dist/plot/core/svg.js +41 -0
- package/dist/plot/{types.d.ts → core/types.d.ts} +36 -85
- package/dist/plot/{types.js → core/types.js} +1 -1
- package/dist/plot/{utils → core/utils}/label-placement.d.ts +3 -3
- package/dist/plot/{utils → core/utils}/label-placement.js +3 -3
- package/dist/plot/core/utils/series-visibility.d.ts +26 -0
- package/dist/plot/{utils → core/utils}/series-visibility.js +29 -2
- package/dist/plot/core/utils.d.ts +12 -0
- package/dist/plot/core/utils.js +27 -0
- package/dist/plot/{Histogram.svelte → histogram/Histogram.svelte} +174 -551
- package/dist/plot/{Histogram.svelte.d.ts → histogram/Histogram.svelte.d.ts} +2 -2
- package/dist/plot/{HistogramControls.svelte → histogram/HistogramControls.svelte} +6 -6
- package/dist/plot/{HistogramControls.svelte.d.ts → histogram/HistogramControls.svelte.d.ts} +4 -4
- package/dist/plot/histogram/index.d.ts +2 -0
- package/dist/plot/histogram/index.js +2 -0
- package/dist/plot/index.d.ts +8 -41
- package/dist/plot/index.js +10 -39
- package/dist/plot/sankey/Sankey.svelte +697 -0
- package/dist/plot/sankey/Sankey.svelte.d.ts +74 -0
- package/dist/plot/sankey/SankeyControls.svelte +98 -0
- package/dist/plot/sankey/SankeyControls.svelte.d.ts +19 -0
- package/dist/plot/sankey/index.d.ts +4 -0
- package/dist/plot/sankey/index.js +3 -0
- package/dist/plot/sankey/sankey-types.d.ts +42 -0
- package/dist/plot/sankey/sankey-types.js +4 -0
- package/dist/plot/sankey/sankey.d.ts +52 -0
- package/dist/plot/sankey/sankey.js +189 -0
- package/dist/plot/{BinnedScatterPlot.svelte → scatter/BinnedScatterPlot.svelte} +64 -64
- package/dist/plot/{BinnedScatterPlot.svelte.d.ts → scatter/BinnedScatterPlot.svelte.d.ts} +6 -6
- package/dist/plot/{ElementScatter.svelte → scatter/ElementScatter.svelte} +6 -6
- package/dist/plot/{ElementScatter.svelte.d.ts → scatter/ElementScatter.svelte.d.ts} +2 -2
- package/dist/plot/{ScatterPlot.svelte → scatter/ScatterPlot.svelte} +297 -1008
- package/dist/plot/{ScatterPlot.svelte.d.ts → scatter/ScatterPlot.svelte.d.ts} +10 -18
- package/dist/plot/{ScatterPlotControls.svelte → scatter/ScatterPlotControls.svelte} +6 -5
- package/dist/plot/{ScatterPlotControls.svelte.d.ts → scatter/ScatterPlotControls.svelte.d.ts} +2 -2
- package/dist/plot/{ScatterPoint.svelte → scatter/ScatterPoint.svelte} +7 -7
- package/dist/plot/{ScatterPoint.svelte.d.ts → scatter/ScatterPoint.svelte.d.ts} +3 -3
- package/dist/plot/{adaptive-density.d.ts → scatter/adaptive-density.d.ts} +14 -4
- package/dist/plot/{adaptive-density.js → scatter/adaptive-density.js} +46 -20
- package/dist/plot/{binned-scatter-types.d.ts → scatter/binned-scatter-types.d.ts} +5 -12
- package/dist/plot/scatter/index.d.ts +7 -0
- package/dist/plot/scatter/index.js +5 -0
- package/dist/plot/scatter/scatter-data.d.ts +19 -0
- package/dist/plot/scatter/scatter-data.js +212 -0
- package/dist/plot/{ScatterPlot3D.svelte → scatter-3d/ScatterPlot3D.svelte} +25 -34
- package/dist/plot/{ScatterPlot3D.svelte.d.ts → scatter-3d/ScatterPlot3D.svelte.d.ts} +9 -17
- package/dist/plot/{ScatterPlot3DControls.svelte → scatter-3d/ScatterPlot3DControls.svelte} +14 -14
- package/dist/plot/{ScatterPlot3DControls.svelte.d.ts → scatter-3d/ScatterPlot3DControls.svelte.d.ts} +6 -6
- package/dist/plot/{ScatterPlot3DScene.svelte → scatter-3d/ScatterPlot3DScene.svelte} +129 -128
- package/dist/plot/{ScatterPlot3DScene.svelte.d.ts → scatter-3d/ScatterPlot3DScene.svelte.d.ts} +6 -15
- package/dist/plot/{Surface3D.svelte → scatter-3d/Surface3D.svelte} +7 -6
- package/dist/plot/{Surface3D.svelte.d.ts → scatter-3d/Surface3D.svelte.d.ts} +5 -4
- package/dist/plot/scatter-3d/index.d.ts +4 -0
- package/dist/plot/scatter-3d/index.js +4 -0
- package/dist/plot/sunburst/Sunburst.svelte +1041 -0
- package/dist/plot/sunburst/Sunburst.svelte.d.ts +97 -0
- package/dist/plot/sunburst/SunburstControls.svelte +200 -0
- package/dist/plot/sunburst/SunburstControls.svelte.d.ts +26 -0
- package/dist/plot/sunburst/index.d.ts +4 -0
- package/dist/plot/sunburst/index.js +4 -0
- package/dist/plot/sunburst/render.d.ts +34 -0
- package/dist/plot/sunburst/render.js +122 -0
- package/dist/plot/sunburst/sunburst.d.ts +62 -0
- package/dist/plot/sunburst/sunburst.js +269 -0
- package/dist/rdf/RdfPlot.svelte +2 -1
- package/dist/rdf/RdfPlot.svelte.d.ts +1 -1
- package/dist/rdf/calc-rdf.js +11 -24
- package/dist/sanitize.js +14 -3
- package/dist/scene/SceneCamera.svelte +62 -0
- package/dist/scene/SceneCamera.svelte.d.ts +19 -0
- package/dist/scene/bind-renderer.svelte.d.ts +2 -0
- package/dist/scene/bind-renderer.svelte.js +14 -0
- package/dist/scene/index.d.ts +4 -0
- package/dist/scene/index.js +5 -0
- package/dist/scene/props.js +52 -0
- package/dist/scene/types.d.ts +26 -0
- package/dist/scene/types.js +1 -0
- package/dist/settings.d.ts +79 -3
- package/dist/settings.js +321 -1
- package/dist/spectral/Bands.svelte +47 -36
- package/dist/spectral/Bands.svelte.d.ts +6 -6
- package/dist/spectral/BandsAndDos.svelte +23 -25
- package/dist/spectral/BrillouinBandsDos.svelte +42 -30
- package/dist/spectral/Dos.svelte +15 -23
- package/dist/spectral/Dos.svelte.d.ts +4 -3
- package/dist/spectral/helpers.d.ts +8 -6
- package/dist/spectral/helpers.js +137 -65
- package/dist/state.svelte.d.ts +0 -7
- package/dist/state.svelte.js +0 -6
- package/dist/structure/Arrow.svelte +2 -4
- package/dist/structure/AtomLegend.svelte +8 -9
- package/dist/structure/AtomLegend.svelte.d.ts +1 -1
- package/dist/structure/CanvasTooltip.svelte +1 -0
- package/dist/structure/CellSelect.svelte +12 -5
- package/dist/structure/CellSelect.svelte.d.ts +2 -1
- package/dist/structure/Cylinder.svelte +12 -8
- package/dist/structure/Cylinder.svelte.d.ts +4 -1
- package/dist/structure/Lattice.svelte +2 -2
- package/dist/structure/Structure.svelte +365 -423
- package/dist/structure/Structure.svelte.d.ts +5 -15
- package/dist/structure/StructureControls.svelte +217 -2
- package/dist/structure/StructureControls.svelte.d.ts +5 -3
- package/dist/structure/StructureExportPane.svelte +54 -156
- package/dist/structure/StructureExportPane.svelte.d.ts +4 -5
- package/dist/structure/StructureInfoPane.svelte +10 -9
- package/dist/structure/StructureInfoPane.svelte.d.ts +5 -5
- package/dist/structure/StructureScene.svelte +376 -208
- package/dist/structure/StructureScene.svelte.d.ts +22 -20
- package/dist/structure/{label-placement.d.ts → atom-label-placement.d.ts} +3 -3
- package/dist/structure/{label-placement.js → atom-label-placement.js} +15 -5
- package/dist/structure/atom-properties.d.ts +1 -1
- package/dist/structure/atom-properties.js +17 -22
- package/dist/structure/bond-order-perception.js +3 -5
- package/dist/structure/bonding.d.ts +4 -0
- package/dist/structure/bonding.js +134 -63
- package/dist/structure/export.d.ts +24 -4
- package/dist/structure/export.js +89 -143
- package/dist/structure/index.d.ts +4 -4
- package/dist/structure/index.js +3 -3
- package/dist/structure/measure.d.ts +3 -2
- package/dist/structure/measure.js +6 -5
- package/dist/structure/parse.d.ts +3 -2
- package/dist/structure/parse.js +419 -438
- package/dist/structure/partial-occupancy.d.ts +0 -1
- package/dist/structure/partial-occupancy.js +1 -1
- package/dist/structure/pbc.d.ts +1 -1
- package/dist/structure/pbc.js +190 -13
- package/dist/structure/polyhedra.d.ts +41 -0
- package/dist/structure/polyhedra.js +602 -0
- package/dist/structure/site.d.ts +4 -0
- package/dist/structure/site.js +1 -0
- package/dist/structure/supercell.js +3 -2
- package/dist/structure/validation.js +5 -6
- package/dist/symmetry/SymmetryElementControls.svelte +69 -0
- package/dist/symmetry/SymmetryElementControls.svelte.d.ts +9 -0
- package/dist/symmetry/SymmetryElements.svelte +354 -0
- package/dist/symmetry/SymmetryElements.svelte.d.ts +24 -0
- package/dist/symmetry/SymmetryStats.svelte +113 -8
- package/dist/symmetry/WyckoffTable.svelte +68 -7
- package/dist/symmetry/WyckoffTable.svelte.d.ts +3 -0
- package/dist/symmetry/cell-transform.js +7 -14
- package/dist/symmetry/index.d.ts +14 -4
- package/dist/symmetry/index.js +291 -72
- package/dist/symmetry/spacegroups.d.ts +12 -1
- package/dist/symmetry/spacegroups.js +63 -14
- package/dist/symmetry/symmetry-elements.d.ts +33 -0
- package/dist/symmetry/symmetry-elements.js +521 -0
- package/dist/symmetry/wyckoff-db.d.ts +9 -0
- package/dist/symmetry/wyckoff-db.js +87 -0
- package/dist/table/HeatmapTable.svelte +66 -25
- package/dist/table/HeatmapTable.svelte.d.ts +1 -1
- package/dist/table/index.d.ts +1 -3
- package/dist/table/index.js +1 -1
- package/dist/theme/index.js +8 -8
- package/dist/tooltip/KCoords.svelte +45 -0
- package/dist/tooltip/KCoords.svelte.d.ts +8 -0
- package/dist/tooltip/index.d.ts +1 -0
- package/dist/tooltip/index.js +1 -0
- package/dist/trajectory/Trajectory.svelte +123 -100
- package/dist/trajectory/Trajectory.svelte.d.ts +11 -22
- package/dist/trajectory/TrajectoryExportPane.svelte +17 -25
- package/dist/trajectory/TrajectoryExportPane.svelte.d.ts +4 -5
- package/dist/trajectory/TrajectoryInfoPane.svelte +5 -3
- package/dist/trajectory/TrajectoryInfoPane.svelte.d.ts +3 -2
- package/dist/trajectory/constants.js +6 -2
- package/dist/trajectory/extract.js +17 -37
- package/dist/trajectory/format-detect.d.ts +1 -1
- package/dist/trajectory/format-detect.js +27 -19
- package/dist/trajectory/frame-reader.d.ts +0 -1
- package/dist/trajectory/frame-reader.js +63 -162
- package/dist/trajectory/helpers.d.ts +10 -2
- package/dist/trajectory/helpers.js +56 -36
- package/dist/trajectory/index.js +1 -1
- package/dist/trajectory/parse/ase.d.ts +9 -1
- package/dist/trajectory/parse/ase.js +47 -32
- package/dist/trajectory/parse/diagnostics.d.ts +3 -0
- package/dist/trajectory/parse/diagnostics.js +14 -0
- package/dist/trajectory/parse/hdf5.js +1 -1
- package/dist/trajectory/parse/index.d.ts +1 -1
- package/dist/trajectory/parse/index.js +65 -105
- package/dist/trajectory/parse/lammps.d.ts +0 -2
- package/dist/trajectory/parse/lammps.js +8 -6
- package/dist/trajectory/parse/pymatgen.d.ts +2 -0
- package/dist/trajectory/parse/pymatgen.js +74 -0
- package/dist/trajectory/parse/vasp.js +38 -18
- package/dist/trajectory/parse/xyz.d.ts +13 -1
- package/dist/trajectory/parse/xyz.js +102 -94
- package/dist/trajectory/plotting.d.ts +1 -2
- package/dist/trajectory/plotting.js +16 -113
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +7 -5
- package/dist/xrd/XrdPlot.svelte +16 -30
- package/dist/xrd/broadening.d.ts +2 -1
- package/dist/xrd/calc-xrd.js +18 -20
- package/dist/xrd/index.d.ts +2 -2
- package/dist/xrd/parse.js +2 -2
- package/package.json +43 -26
- package/dist/element/data.json +0 -11864
- package/dist/fermi-surface/marching-cubes.d.ts +0 -2
- package/dist/fermi-surface/marching-cubes.js +0 -2
- package/dist/plot/PlotControls.svelte.d.ts +0 -4
- package/dist/plot/axis-utils.d.ts +0 -19
- package/dist/plot/axis-utils.js +0 -78
- package/dist/plot/defaults.d.ts +0 -19
- package/dist/plot/defaults.js +0 -9
- package/dist/plot/fill-utils.d.ts +0 -46
- package/dist/plot/fill-utils.js +0 -322
- package/dist/plot/hover-lock.svelte.d.ts +0 -14
- package/dist/plot/hover-lock.svelte.js +0 -46
- package/dist/plot/interactions.d.ts +0 -12
- package/dist/plot/interactions.js +0 -101
- package/dist/plot/scales.d.ts +0 -48
- package/dist/plot/svg.d.ts +0 -1
- package/dist/plot/svg.js +0 -11
- package/dist/plot/utils/series-visibility.d.ts +0 -15
- package/dist/plot/utils.d.ts +0 -1
- package/dist/plot/utils.js +0 -14
- /package/dist/plot/{PortalSelect.svelte.d.ts → core/components/PortalSelect.svelte.d.ts} +0 -0
- /package/dist/plot/{binned-scatter-types.js → scatter/binned-scatter-types.js} +0 -0
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
// Shared canvas-interaction scaffold (runes-in-closure factory) for ConvexHull3D/4D.
|
|
2
|
+
import { set_fullscreen_bg, setup_fullscreen_effect } from '../layout';
|
|
3
|
+
import * as helpers from './helpers';
|
|
4
|
+
export function create_canvas_interactions(inputs) {
|
|
5
|
+
const [zoom_min, zoom_max] = inputs.wheel_clamp;
|
|
6
|
+
// Performance optimization: coalesce renders into one rAF
|
|
7
|
+
let frame_id = 0;
|
|
8
|
+
// Interaction state
|
|
9
|
+
let is_dragging = $state(false);
|
|
10
|
+
let drag_started = $state(false);
|
|
11
|
+
let last_mouse = $state({ x: 0, y: 0 });
|
|
12
|
+
let hover_data = $state.raw(null);
|
|
13
|
+
let copy_feedback = $state({ visible: false, position: { x: 0, y: 0 } });
|
|
14
|
+
// Drag and drop state
|
|
15
|
+
let drag_over = $state(false);
|
|
16
|
+
// Structure popup state
|
|
17
|
+
let modal_open = $state(false);
|
|
18
|
+
let selected_structure = $state(null);
|
|
19
|
+
let modal_place_right = $state(true);
|
|
20
|
+
// Keep selection, hover, and popup pointing at current plot entry objects
|
|
21
|
+
$effect(() => {
|
|
22
|
+
const current_selection = helpers.current_entry(inputs.selected_entry(), inputs.plot_entries());
|
|
23
|
+
if (inputs.selected_entry() && !current_selection)
|
|
24
|
+
inputs.set_selected_entry(null);
|
|
25
|
+
else if (current_selection &&
|
|
26
|
+
!helpers.same_entry(current_selection, inputs.selected_entry()))
|
|
27
|
+
inputs.set_selected_entry(current_selection);
|
|
28
|
+
const current_hover = helpers.current_entry(hover_data?.entry, inputs.plot_entries());
|
|
29
|
+
if (hover_data?.entry && !current_hover) {
|
|
30
|
+
hover_data = null;
|
|
31
|
+
inputs.on_point_hover()?.(null);
|
|
32
|
+
}
|
|
33
|
+
else if (hover_data && current_hover && current_hover !== hover_data.entry) {
|
|
34
|
+
hover_data = { ...hover_data, entry: current_hover };
|
|
35
|
+
}
|
|
36
|
+
if (modal_open) {
|
|
37
|
+
const structure = current_selection && inputs.extract_structure(current_selection);
|
|
38
|
+
if (structure)
|
|
39
|
+
selected_structure = structure;
|
|
40
|
+
else {
|
|
41
|
+
modal_open = false;
|
|
42
|
+
selected_structure = null;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
// Shared selection logic for click and Enter key
|
|
47
|
+
function select_entry(entry) {
|
|
48
|
+
inputs.on_point_click()?.(entry);
|
|
49
|
+
if (inputs.enable_click_selection()) {
|
|
50
|
+
inputs.set_selected_entry(entry);
|
|
51
|
+
if (inputs.enable_structure_preview()) {
|
|
52
|
+
const structure = inputs.extract_structure(entry);
|
|
53
|
+
if (structure) {
|
|
54
|
+
selected_structure = structure;
|
|
55
|
+
modal_place_right = helpers.calculate_modal_side(inputs.wrapper());
|
|
56
|
+
modal_open = true;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const handle_keydown = (event) => {
|
|
62
|
+
const target = event.target;
|
|
63
|
+
if (target instanceof HTMLElement && /INPUT|TEXTAREA/.test(target.tagName))
|
|
64
|
+
return;
|
|
65
|
+
// Stop canvas-originated keydown re-running on wrapper (both have onkeydown)
|
|
66
|
+
if (target === inputs.canvas())
|
|
67
|
+
event.stopPropagation();
|
|
68
|
+
if (event.key === `Escape` && modal_open) {
|
|
69
|
+
close_structure_popup();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
// Handle Enter for keyboard accessibility - select hovered entry
|
|
73
|
+
if (event.key === `Enter`) {
|
|
74
|
+
const entry = hover_data?.entry;
|
|
75
|
+
if (entry)
|
|
76
|
+
select_entry(entry);
|
|
77
|
+
else if (modal_open)
|
|
78
|
+
close_structure_popup();
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
inputs.actions()[event.key.toLowerCase()]?.();
|
|
82
|
+
};
|
|
83
|
+
async function handle_file_drop(event) {
|
|
84
|
+
drag_over = false;
|
|
85
|
+
const data = await helpers.parse_hull_entries_from_drop(event);
|
|
86
|
+
if (data)
|
|
87
|
+
inputs.on_file_drop()?.(data);
|
|
88
|
+
}
|
|
89
|
+
const set_drag_over = (over) => (event) => {
|
|
90
|
+
event.preventDefault();
|
|
91
|
+
drag_over = over;
|
|
92
|
+
};
|
|
93
|
+
const handle_drag_over = set_drag_over(true);
|
|
94
|
+
const handle_drag_leave = set_drag_over(false);
|
|
95
|
+
async function copy_entry_data(entry, position) {
|
|
96
|
+
await helpers.copy_entry_to_clipboard(entry, position, (visible, pos) => {
|
|
97
|
+
copy_feedback.visible = visible;
|
|
98
|
+
copy_feedback.position = pos;
|
|
99
|
+
}, inputs.entry_category());
|
|
100
|
+
}
|
|
101
|
+
function handle_mouse_down(event) {
|
|
102
|
+
is_dragging = true;
|
|
103
|
+
drag_started = false;
|
|
104
|
+
hover_data = null;
|
|
105
|
+
inputs.on_point_hover()?.(null);
|
|
106
|
+
last_mouse = { x: event.clientX, y: event.clientY };
|
|
107
|
+
}
|
|
108
|
+
const handle_mouse_move = (event) => {
|
|
109
|
+
if (!is_dragging)
|
|
110
|
+
return;
|
|
111
|
+
const [dx, dy] = [event.clientX - last_mouse.x, event.clientY - last_mouse.y];
|
|
112
|
+
// Mark as drag if any movement occurred
|
|
113
|
+
if (dx !== 0 || dy !== 0)
|
|
114
|
+
drag_started = true;
|
|
115
|
+
// With Cmd/Ctrl held: pan the view instead of rotating
|
|
116
|
+
inputs.on_drag(dx, dy, event.metaKey || event.ctrlKey);
|
|
117
|
+
last_mouse = { x: event.clientX, y: event.clientY };
|
|
118
|
+
};
|
|
119
|
+
const handle_mouse_up = () => {
|
|
120
|
+
// leave drag_started set so the trailing click can detect a concluded drag;
|
|
121
|
+
// handle_click reads then clears it, and handle_mouse_down resets it next interaction
|
|
122
|
+
is_dragging = false;
|
|
123
|
+
};
|
|
124
|
+
const handle_wheel = (event) => {
|
|
125
|
+
event.preventDefault();
|
|
126
|
+
inputs.set_zoom(Math.max(zoom_min, Math.min(zoom_max, inputs.zoom() * (event.deltaY > 0 ? 0.98 : 1.02))));
|
|
127
|
+
};
|
|
128
|
+
const handle_hover = (event) => {
|
|
129
|
+
if (is_dragging)
|
|
130
|
+
return;
|
|
131
|
+
const entry = find_entry_at_mouse(event);
|
|
132
|
+
hover_data = entry ? { entry, position: { x: event.clientX, y: event.clientY } } : null;
|
|
133
|
+
inputs.on_point_hover()?.(hover_data);
|
|
134
|
+
};
|
|
135
|
+
const find_entry_at_mouse = (event) => helpers.find_hull_entry_at_mouse(inputs.canvas(), event, inputs.visible_entries(), inputs.project_point);
|
|
136
|
+
const handle_click = (event) => {
|
|
137
|
+
event.stopPropagation();
|
|
138
|
+
const was_drag = drag_started; // Check if this was a drag operation (any mouse movement during drag)
|
|
139
|
+
drag_started = false; // Reset for next interaction
|
|
140
|
+
if (was_drag)
|
|
141
|
+
return; // Don't trigger click if this was a drag
|
|
142
|
+
const entry = find_entry_at_mouse(event);
|
|
143
|
+
if (!entry) {
|
|
144
|
+
if (modal_open)
|
|
145
|
+
close_structure_popup();
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
select_entry(entry);
|
|
149
|
+
};
|
|
150
|
+
function close_structure_popup() {
|
|
151
|
+
modal_open = false;
|
|
152
|
+
selected_structure = null;
|
|
153
|
+
inputs.set_selected_entry(null);
|
|
154
|
+
}
|
|
155
|
+
const handle_double_click = (event) => {
|
|
156
|
+
const entry = find_entry_at_mouse(event);
|
|
157
|
+
if (entry)
|
|
158
|
+
void copy_entry_data(entry, { x: event.clientX, y: event.clientY });
|
|
159
|
+
};
|
|
160
|
+
function render_once() {
|
|
161
|
+
if (frame_id)
|
|
162
|
+
return;
|
|
163
|
+
frame_id = requestAnimationFrame(() => {
|
|
164
|
+
inputs.render_frame();
|
|
165
|
+
frame_id = 0;
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
function update_canvas_size() {
|
|
169
|
+
const canvas = inputs.canvas();
|
|
170
|
+
if (!canvas)
|
|
171
|
+
return;
|
|
172
|
+
const dpr = globalThis.devicePixelRatio || 1;
|
|
173
|
+
const container = canvas.parentElement;
|
|
174
|
+
const rect = container?.getBoundingClientRect();
|
|
175
|
+
const [width, height] = rect ? [rect.width, rect.height] : [400, 400];
|
|
176
|
+
// Only update canvas dimensions if they actually changed
|
|
177
|
+
// (assigning canvas.width/height clears the canvas even if values are the same)
|
|
178
|
+
const new_width = Math.max(0, Math.round(width * dpr));
|
|
179
|
+
const new_height = Math.max(0, Math.round(height * dpr));
|
|
180
|
+
if (!inputs.ctx() || canvas.width !== new_width || canvas.height !== new_height) {
|
|
181
|
+
canvas.width = new_width;
|
|
182
|
+
canvas.height = new_height;
|
|
183
|
+
const ctx = canvas.getContext(`2d`);
|
|
184
|
+
inputs.set_ctx(ctx);
|
|
185
|
+
if (ctx) {
|
|
186
|
+
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
187
|
+
ctx.imageSmoothingEnabled = true;
|
|
188
|
+
ctx.imageSmoothingQuality = `high`;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
inputs.set_canvas_dims({ width, height, scale: Math.min(width, height) / 600 });
|
|
192
|
+
render_once();
|
|
193
|
+
}
|
|
194
|
+
$effect(() => {
|
|
195
|
+
const canvas = inputs.canvas();
|
|
196
|
+
if (!canvas)
|
|
197
|
+
return undefined;
|
|
198
|
+
update_canvas_size(); // Initial setup
|
|
199
|
+
// Watch for resize events - only update canvas, don't reset camera
|
|
200
|
+
const resize_observer = new ResizeObserver(update_canvas_size);
|
|
201
|
+
const container = canvas.parentElement;
|
|
202
|
+
if (container)
|
|
203
|
+
resize_observer.observe(container);
|
|
204
|
+
return () => {
|
|
205
|
+
if (frame_id)
|
|
206
|
+
cancelAnimationFrame(frame_id);
|
|
207
|
+
resize_observer.disconnect(); // Cleanup on unmount
|
|
208
|
+
};
|
|
209
|
+
});
|
|
210
|
+
// Fullscreen handling with camera reset
|
|
211
|
+
let was_fullscreen = $state(inputs.fullscreen());
|
|
212
|
+
$effect(() => {
|
|
213
|
+
setup_fullscreen_effect(inputs.fullscreen(), inputs.wrapper(), (entering) => {
|
|
214
|
+
if (entering !== was_fullscreen) {
|
|
215
|
+
inputs.on_fullscreen_change();
|
|
216
|
+
was_fullscreen = entering;
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
set_fullscreen_bg(inputs.wrapper(), inputs.fullscreen(), inputs.fullscreen_bg_var);
|
|
220
|
+
});
|
|
221
|
+
// Performance: Pre-compute and cache all point projections + depth sorting
|
|
222
|
+
const sorted_points_cache = $derived.by(() => {
|
|
223
|
+
if (!inputs.canvas() || inputs.visible_entries().length === 0)
|
|
224
|
+
return [];
|
|
225
|
+
return inputs
|
|
226
|
+
.visible_entries()
|
|
227
|
+
.map((entry) => ({
|
|
228
|
+
entry,
|
|
229
|
+
projected: inputs.project_point(entry.x, entry.y, entry.z),
|
|
230
|
+
}))
|
|
231
|
+
.sort((left, right) => left.projected.depth - right.projected.depth);
|
|
232
|
+
});
|
|
233
|
+
return {
|
|
234
|
+
get is_dragging() {
|
|
235
|
+
return is_dragging;
|
|
236
|
+
},
|
|
237
|
+
get hover_data() {
|
|
238
|
+
return hover_data;
|
|
239
|
+
},
|
|
240
|
+
get drag_over() {
|
|
241
|
+
return drag_over;
|
|
242
|
+
},
|
|
243
|
+
get modal_open() {
|
|
244
|
+
return modal_open;
|
|
245
|
+
},
|
|
246
|
+
get selected_structure() {
|
|
247
|
+
return selected_structure;
|
|
248
|
+
},
|
|
249
|
+
get modal_place_right() {
|
|
250
|
+
return modal_place_right;
|
|
251
|
+
},
|
|
252
|
+
get sorted_points_cache() {
|
|
253
|
+
return sorted_points_cache;
|
|
254
|
+
},
|
|
255
|
+
copy_feedback, // stable $state proxy; mutated in place for ClickFeedback binding
|
|
256
|
+
// Event handler groups, spread onto their target elements by ConvexHull3D/4D
|
|
257
|
+
canvas_handlers: {
|
|
258
|
+
onmousedown: handle_mouse_down,
|
|
259
|
+
onmousemove: handle_hover,
|
|
260
|
+
onclick: handle_click,
|
|
261
|
+
onkeydown: handle_keydown,
|
|
262
|
+
ondblclick: handle_double_click,
|
|
263
|
+
onwheel: handle_wheel,
|
|
264
|
+
},
|
|
265
|
+
wrapper_handlers: {
|
|
266
|
+
onkeydown: handle_keydown,
|
|
267
|
+
ondrop: handle_file_drop,
|
|
268
|
+
ondragover: handle_drag_over,
|
|
269
|
+
ondragleave: handle_drag_leave,
|
|
270
|
+
},
|
|
271
|
+
// document-level so drags continue outside the canvas; attached individually
|
|
272
|
+
// since <svelte:document> rejects spread attributes
|
|
273
|
+
handle_mouse_move,
|
|
274
|
+
handle_mouse_up,
|
|
275
|
+
close_structure_popup,
|
|
276
|
+
render_once,
|
|
277
|
+
};
|
|
278
|
+
}
|
|
@@ -2,5 +2,5 @@ import type { PhaseData } from './types';
|
|
|
2
2
|
export declare const demo_temperatures: number[];
|
|
3
3
|
type Composition = Record<string, number>;
|
|
4
4
|
export declare function make_demo_phase(composition: Composition, seed: number, entropy_boost?: number): PhaseData;
|
|
5
|
-
export declare
|
|
5
|
+
export declare const create_temp_ternary_entries_li_fe_o: () => PhaseData[];
|
|
6
6
|
export {};
|
|
@@ -16,25 +16,23 @@ export function make_demo_phase(composition, seed, entropy_boost = 0) {
|
|
|
16
16
|
0.00005 * temp_kelvin * Math.log(temp_kelvin)),
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
];
|
|
40
|
-
}
|
|
19
|
+
export const create_temp_ternary_entries_li_fe_o = () => [
|
|
20
|
+
...[`Li`, `Fe`, `O`].map((element, idx) => make_demo_phase({ [element]: 1 }, idx)),
|
|
21
|
+
...[
|
|
22
|
+
[`Li`, `Fe`],
|
|
23
|
+
[`Li`, `O`],
|
|
24
|
+
[`Fe`, `O`],
|
|
25
|
+
].flatMap(([element_a, element_b], idx) => [0.33, 0.5, 0.67].flatMap((fraction, jdx) => [
|
|
26
|
+
make_demo_phase({ [element_a]: fraction, [element_b]: 1 - fraction }, 100 + idx * 10 + jdx),
|
|
27
|
+
make_demo_phase({ [element_a]: fraction, [element_b]: 1 - fraction }, 200 + idx * 10 + jdx, 3),
|
|
28
|
+
])),
|
|
29
|
+
...[
|
|
30
|
+
{ Li: 0.33, Fe: 0.33, O: 0.34 },
|
|
31
|
+
{ Li: 0.5, Fe: 0.25, O: 0.25 },
|
|
32
|
+
{ Li: 0.25, Fe: 0.5, O: 0.25 },
|
|
33
|
+
{ Li: 0.25, Fe: 0.25, O: 0.5 },
|
|
34
|
+
].flatMap((composition, idx) => [
|
|
35
|
+
make_demo_phase(composition, 300 + idx),
|
|
36
|
+
make_demo_phase(composition, 400 + idx, 4),
|
|
37
|
+
]),
|
|
38
|
+
];
|
|
@@ -4,7 +4,7 @@ export declare const R_EV_PER_K = 0.00008617333262;
|
|
|
4
4
|
export declare const P_REF = 1;
|
|
5
5
|
export declare const DEFAULT_ELEMENT_TO_GAS: Readonly<Partial<Record<ElementSymbol, GasSpecies>>>;
|
|
6
6
|
export declare const GAS_STOICHIOMETRY: Readonly<Record<GasSpecies, Partial<Record<ElementSymbol, number>>>>;
|
|
7
|
-
export declare
|
|
7
|
+
export declare const create_default_gas_provider: () => GasThermodynamicsProvider;
|
|
8
8
|
export declare function get_default_gas_provider(): GasThermodynamicsProvider;
|
|
9
9
|
export declare function compute_gas_chemical_potential(provider: GasThermodynamicsProvider, gas: GasSpecies, T: number, P: number): number;
|
|
10
10
|
export declare function compute_element_chemical_potential(provider: GasThermodynamicsProvider, gas: GasSpecies, element: ElementSymbol, T: number, P: number): number;
|
|
@@ -12,5 +12,5 @@ export declare function analyze_gas_data(entries: PhaseData[], config: GasThermo
|
|
|
12
12
|
export declare function get_effective_pressures(config: GasThermodynamicsConfig): Record<GasSpecies, number>;
|
|
13
13
|
export declare function compute_gas_correction(entry: PhaseData, config: GasThermodynamicsConfig, T: number, pressures: Record<GasSpecies, number>): number;
|
|
14
14
|
export declare function apply_gas_corrections(entries: PhaseData[], config: GasThermodynamicsConfig | undefined, T: number): PhaseData[];
|
|
15
|
-
export declare
|
|
15
|
+
export declare const format_chemical_potential: (mu: number, decimals?: number) => string;
|
|
16
16
|
export declare function format_pressure(P: number): string;
|
|
@@ -100,23 +100,21 @@ function interpolate_ts(data, T) {
|
|
|
100
100
|
}
|
|
101
101
|
// Default Provider Implementation
|
|
102
102
|
// Create the default gas thermodynamics provider using built-in data
|
|
103
|
-
export
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
};
|
|
119
|
-
}
|
|
103
|
+
export const create_default_gas_provider = () => ({
|
|
104
|
+
get_standard_chemical_potential(gas, T) {
|
|
105
|
+
// μ°(T) = H_f - T*S
|
|
106
|
+
// For elemental gases (O2, N2, H2, F2), H_f = 0
|
|
107
|
+
const H_f = DEFAULT_ENTHALPY[gas] ?? 0;
|
|
108
|
+
const TS = interpolate_ts(DEFAULT_TS_DATA[gas], T);
|
|
109
|
+
return H_f - TS;
|
|
110
|
+
},
|
|
111
|
+
get_supported_gases() {
|
|
112
|
+
return [...GAS_SPECIES];
|
|
113
|
+
},
|
|
114
|
+
get_temperature_range() {
|
|
115
|
+
return [0, 2000];
|
|
116
|
+
},
|
|
117
|
+
});
|
|
120
118
|
// Singleton default provider
|
|
121
119
|
let default_provider = null;
|
|
122
120
|
// Get the default gas thermodynamics provider (lazy initialization)
|
|
@@ -237,7 +235,7 @@ export function compute_gas_correction(entry, config, T, pressures) {
|
|
|
237
235
|
...DEFAULT_ELEMENT_TO_GAS,
|
|
238
236
|
...config.element_to_gas,
|
|
239
237
|
};
|
|
240
|
-
const enabled_gases = new Set(config.enabled_gases
|
|
238
|
+
const enabled_gases = new Set(config.enabled_gases);
|
|
241
239
|
let correction = 0;
|
|
242
240
|
const n_atoms = count_atoms_in_composition(entry.composition);
|
|
243
241
|
for (const [el_str, amount] of Object.entries(entry.composition)) {
|
|
@@ -290,21 +288,15 @@ export function apply_gas_corrections(entries, config, T) {
|
|
|
290
288
|
// If no correction needed, return entry unchanged
|
|
291
289
|
if (Math.abs(correction) < 1e-12)
|
|
292
290
|
return entry;
|
|
293
|
-
//
|
|
294
|
-
// so downstream formation
|
|
295
|
-
|
|
296
|
-
const
|
|
297
|
-
return {
|
|
298
|
-
...entry,
|
|
299
|
-
energy: corrected_energy,
|
|
300
|
-
energy_per_atom: corrected_energy,
|
|
301
|
-
};
|
|
291
|
+
// compute_gas_correction is PER-ATOM: shift energy_per_atom by it and rescale total
|
|
292
|
+
// energy by atom count so downstream formation energies use the corrected values
|
|
293
|
+
const atoms = count_atoms_in_composition(entry.composition);
|
|
294
|
+
const energy_per_atom = (entry.energy_per_atom ?? entry.energy / atoms) + correction;
|
|
295
|
+
return { ...entry, energy: energy_per_atom * atoms, energy_per_atom };
|
|
302
296
|
});
|
|
303
297
|
}
|
|
304
298
|
// Format chemical potential for display (e.g., "-1.23 eV")
|
|
305
|
-
export
|
|
306
|
-
return `${mu >= 0 ? `+` : ``}${mu.toFixed(decimals)} eV`;
|
|
307
|
-
}
|
|
299
|
+
export const format_chemical_potential = (mu, decimals = 3) => `${mu >= 0 ? `+` : ``}${mu.toFixed(decimals)} eV`;
|
|
308
300
|
// Format pressure for display (scientific notation for very small/large values)
|
|
309
301
|
export function format_pressure(P) {
|
|
310
302
|
if (P >= 0.01 && P < 100) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type D3InterpolateName } from '../colors';
|
|
2
2
|
import type { EnergyModeInfo } from './';
|
|
3
3
|
import type { ElementSymbol } from '../element';
|
|
4
|
-
import type {
|
|
4
|
+
import type { AnyStructure } from '../structure';
|
|
5
|
+
import type { ConvexHullConfig, EntryCategoryConfig, GasAnalysis, GasThermodynamicsConfig, HighlightStyle, MarkerSymbol, PhaseData } from './types';
|
|
5
6
|
import { DEFAULT_GAS_TEMP } from './types';
|
|
6
7
|
export { DEFAULT_GAS_TEMP };
|
|
7
8
|
export declare const HULL_STABILITY_TOL = 0.000001;
|
|
@@ -13,13 +14,24 @@ type StabilityEntry = {
|
|
|
13
14
|
is_stable?: boolean;
|
|
14
15
|
e_above_hull?: number;
|
|
15
16
|
};
|
|
17
|
+
export declare const extract_structure_from_entry: (entries: PhaseData[], entry: {
|
|
18
|
+
entry_id?: string;
|
|
19
|
+
}) => AnyStructure | null;
|
|
20
|
+
export declare const hull_distance_range: (entries: PhaseData[]) => [number, number];
|
|
16
21
|
export declare const entry_is_stable: (entry: StabilityEntry, tol?: number) => boolean;
|
|
17
22
|
export declare const is_on_hull: (entry: PhaseData, tol?: number) => boolean;
|
|
18
23
|
export declare const get_arity: (entry: PhaseData) => number;
|
|
19
24
|
export declare const is_unary_entry: (entry: PhaseData) => boolean;
|
|
20
25
|
export declare const entry_is_unstable: (entry: StabilityEntry) => boolean;
|
|
21
|
-
|
|
22
|
-
export declare
|
|
26
|
+
type CategorySource = Pick<PhaseData, `data` | `attributes`>;
|
|
27
|
+
export declare function get_entry_category(entry: CategorySource, config: EntryCategoryConfig | null | undefined): string | null;
|
|
28
|
+
export declare function apply_category_markers(entries: (PhaseData & {
|
|
29
|
+
marker?: MarkerSymbol;
|
|
30
|
+
})[], config: EntryCategoryConfig | null | undefined): (PhaseData & {
|
|
31
|
+
marker?: MarkerSymbol;
|
|
32
|
+
})[];
|
|
33
|
+
export declare const entry_is_visible: (entry: StabilityEntry & CategorySource, show_stable: boolean, show_unstable: boolean, category?: EntryCategoryConfig | null, hidden_categories?: readonly string[]) => boolean;
|
|
34
|
+
export declare const visible_entries: <Entry extends StabilityEntry & CategorySource>(entries: readonly Entry[], show_stable: boolean, show_unstable: boolean, category?: EntryCategoryConfig | null, hidden_categories?: readonly string[]) => Entry[];
|
|
23
35
|
export declare function get_energy_color_scale(color_mode: `stability` | `energy`, color_scale: D3InterpolateName, plot_entries: {
|
|
24
36
|
e_above_hull?: number;
|
|
25
37
|
}[]): ((value: number) => string) | null;
|
|
@@ -34,7 +46,10 @@ export declare function auto_threshold_reset(default_threshold: number): (next_s
|
|
|
34
46
|
export declare function current_entry<Entry extends {
|
|
35
47
|
entry_id?: string;
|
|
36
48
|
}>(entry: Entry | null | undefined, entries: readonly Entry[]): Entry | null;
|
|
37
|
-
export declare function
|
|
49
|
+
export declare function same_entry<Entry extends {
|
|
50
|
+
entry_id?: string;
|
|
51
|
+
}>(a: Entry | null | undefined, b: Entry | null | undefined): boolean;
|
|
52
|
+
export declare function build_entry_tooltip_text(entry: PhaseData, category?: EntryCategoryConfig | null): string;
|
|
38
53
|
export declare function find_hull_entry_at_mouse<T extends {
|
|
39
54
|
x: number;
|
|
40
55
|
y: number;
|
|
@@ -46,6 +61,7 @@ export declare function find_hull_entry_at_mouse<T extends {
|
|
|
46
61
|
x: number;
|
|
47
62
|
y: number;
|
|
48
63
|
}): T | null;
|
|
64
|
+
export declare const hull_style_css: (colors: ConvexHullConfig[`colors`] | undefined) => string;
|
|
49
65
|
export declare function calculate_modal_side(wrapper: HTMLDivElement | undefined): boolean;
|
|
50
66
|
export declare function compute_energy_mode_info(entries: PhaseData[], // Array of phase entries to analyze
|
|
51
67
|
find_lowest_energy_unary_refs_fn: (entries: PhaseData[]) => Record<string, PhaseData>, // Function to find unary references
|
|
@@ -60,7 +76,7 @@ export declare function copy_entry_to_clipboard(entry: PhaseData, position: {
|
|
|
60
76
|
}, on_feedback: (visible: boolean, pos: {
|
|
61
77
|
x: number;
|
|
62
78
|
y: number;
|
|
63
|
-
}) => void): Promise<void>;
|
|
79
|
+
}) => void, category?: EntryCategoryConfig | null): Promise<void>;
|
|
64
80
|
export declare const DEFAULT_HIGHLIGHT_STYLE: Required<HighlightStyle>;
|
|
65
81
|
export declare const merge_highlight_style: (custom_style: HighlightStyle | undefined) => Required<HighlightStyle>;
|
|
66
82
|
export declare function is_entry_highlighted<T extends {
|
|
@@ -85,6 +101,27 @@ export declare function draw_selection_highlight(ctx: CanvasRenderingContext2D,
|
|
|
85
101
|
y: number;
|
|
86
102
|
}, base_size: number, container_scale: number, pulse_time: number, pulse_opacity: number): void;
|
|
87
103
|
export declare function get_canvas_text_color(dark_mode: boolean, element?: HTMLElement | null): string;
|
|
104
|
+
export declare function draw_hull_points<Entry extends PhaseData & {
|
|
105
|
+
z: number;
|
|
106
|
+
size?: number;
|
|
107
|
+
marker?: MarkerSymbol;
|
|
108
|
+
}>(ctx: CanvasRenderingContext2D, sorted_points: {
|
|
109
|
+
entry: Entry;
|
|
110
|
+
projected: {
|
|
111
|
+
x: number;
|
|
112
|
+
y: number;
|
|
113
|
+
};
|
|
114
|
+
}[], opts: {
|
|
115
|
+
scale: number;
|
|
116
|
+
shadow_factor: number;
|
|
117
|
+
selected_entry: Entry | null;
|
|
118
|
+
is_highlighted: (entry: Entry) => boolean;
|
|
119
|
+
get_point_color: (entry: Entry) => string;
|
|
120
|
+
highlight_style: Required<HighlightStyle>;
|
|
121
|
+
pulse_time: number;
|
|
122
|
+
pulse_opacity: number;
|
|
123
|
+
}): void;
|
|
124
|
+
export declare function marker_path_data(radius: number, marker: MarkerSymbol): string | null;
|
|
88
125
|
export declare function create_marker_path(size: number, marker?: MarkerSymbol): Path2D;
|
|
89
126
|
export interface TemperatureAnalysis {
|
|
90
127
|
has_temp_data: boolean;
|
|
@@ -100,8 +137,6 @@ export interface TemperatureFilterOptions {
|
|
|
100
137
|
max_interpolation_gap?: number;
|
|
101
138
|
}
|
|
102
139
|
export declare function filter_entries_at_temperature(entries: PhaseData[], T: number, options?: TemperatureFilterOptions): PhaseData[];
|
|
103
|
-
export declare function safe_analyze_gas_data(entries: PhaseData[], config?: GasThermodynamicsConfig): GasAnalysis;
|
|
104
|
-
export declare function safe_apply_gas_corrections(entries: PhaseData[], config: GasThermodynamicsConfig | undefined, T: number): PhaseData[];
|
|
105
140
|
export declare function get_gas_corrected_entries(entries: PhaseData[], gas_config: GasThermodynamicsConfig | undefined, gas_pressures: Partial<Record<string, number>>, temperature: number): {
|
|
106
141
|
entries: PhaseData[];
|
|
107
142
|
analysis: GasAnalysis;
|