matterviz 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/EmptyState.svelte +10 -4
- package/dist/FilePicker.svelte +12 -14
- package/dist/Icon.svelte +7 -4
- package/dist/MillerIndexInput.svelte +2 -2
- package/dist/app.css +53 -0
- package/dist/brillouin/BrillouinZone.svelte +75 -85
- package/dist/brillouin/BrillouinZone.svelte.d.ts +5 -7
- package/dist/brillouin/BrillouinZoneControls.svelte +3 -6
- package/dist/brillouin/BrillouinZoneExportPane.svelte +18 -14
- package/dist/brillouin/BrillouinZoneInfoPane.svelte +6 -10
- package/dist/brillouin/BrillouinZoneScene.svelte +26 -39
- package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +1 -1
- package/dist/chempot-diagram/ChemPotDiagram.svelte +33 -38
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +62 -74
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +1 -1
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +511 -547
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +1 -1
- package/dist/chempot-diagram/async-compute.svelte.js +1 -1
- package/dist/chempot-diagram/controls-state.svelte.js +1 -1
- package/dist/colors/index.d.ts +0 -4
- package/dist/colors/index.js +19 -20
- package/dist/composition/BarChart.svelte +37 -31
- package/dist/composition/BubbleChart.svelte +17 -17
- package/dist/composition/Composition.svelte +7 -11
- package/dist/composition/Formula.svelte +18 -25
- package/dist/composition/FormulaFilter.svelte +92 -95
- package/dist/composition/PieChart.svelte +55 -41
- package/dist/composition/format.js +1 -1
- package/dist/composition/index.d.ts +2 -0
- package/dist/composition/index.js +14 -0
- package/dist/composition/parse.d.ts +2 -2
- package/dist/composition/parse.js +11 -10
- package/dist/constants.js +11 -9
- package/dist/convex-hull/ConvexHull.svelte +12 -15
- package/dist/convex-hull/ConvexHull.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull2D.svelte +93 -92
- package/dist/convex-hull/ConvexHull2D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull3D.svelte +109 -140
- package/dist/convex-hull/ConvexHull3D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull4D.svelte +75 -94
- package/dist/convex-hull/ConvexHull4D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHullChrome.svelte +36 -40
- package/dist/convex-hull/ConvexHullControls.svelte +46 -48
- package/dist/convex-hull/ConvexHullStats.svelte +193 -195
- package/dist/convex-hull/ConvexHullTooltip.svelte +5 -12
- package/dist/convex-hull/GasPressureControls.svelte +5 -12
- package/dist/convex-hull/StructurePopup.svelte +17 -21
- package/dist/convex-hull/StructurePopup.svelte.d.ts +2 -0
- package/dist/convex-hull/TemperatureSlider.svelte +4 -10
- package/dist/convex-hull/canvas-interactions.svelte.js +2 -1
- package/dist/convex-hull/helpers.d.ts +8 -10
- package/dist/convex-hull/helpers.js +36 -36
- package/dist/convex-hull/hull-state.svelte.d.ts +1 -1
- package/dist/convex-hull/thermodynamics.js +18 -17
- package/dist/coordination/CoordinationBarPlot.svelte +38 -33
- package/dist/coordination/CoordinationBarPlot.svelte.d.ts +1 -1
- package/dist/coordination/calc-coordination.d.ts +1 -1
- package/dist/coordination/calc-coordination.js +28 -25
- package/dist/element/BohrAtom.svelte +5 -8
- package/dist/element/ElementHeading.svelte +4 -1
- package/dist/element/ElementPhoto.svelte +11 -9
- package/dist/element/ElementStats.svelte +12 -10
- package/dist/element/ElementTile.svelte +24 -29
- package/dist/element/Nucleus.svelte +4 -2
- package/dist/element/data.d.ts +1 -2
- package/dist/element/helpers.d.ts +4 -0
- package/dist/element/helpers.js +18 -0
- package/dist/element/index.d.ts +1 -4
- package/dist/element/index.js +3 -18
- package/dist/feedback/DragOverlay.svelte +5 -5
- package/dist/feedback/DragOverlay.svelte.d.ts +2 -2
- package/dist/feedback/StatusMessage.svelte +7 -4
- package/dist/fermi-surface/FermiSlice.svelte +21 -18
- package/dist/fermi-surface/FermiSurface.svelte +14 -22
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +5 -7
- package/dist/fermi-surface/FermiSurfaceControls.svelte +6 -20
- package/dist/fermi-surface/FermiSurfaceControls.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceScene.svelte +37 -64
- package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceTooltip.svelte +9 -6
- package/dist/fermi-surface/compute.js +3 -3
- package/dist/fermi-surface/parse.js +22 -24
- package/dist/heatmap-matrix/HeatmapMatrix.svelte +109 -148
- package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +2 -2
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +9 -7
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +1 -1
- package/dist/heatmap-matrix/index.d.ts +5 -0
- package/dist/icons.d.ts +4 -0
- package/dist/icons.js +4 -0
- package/dist/io/ExportPane.svelte +10 -6
- package/dist/io/decompress.d.ts +2 -1
- package/dist/io/decompress.js +22 -35
- package/dist/io/export.d.ts +4 -0
- package/dist/io/export.js +5 -1
- package/dist/io/fetch.d.ts +0 -3
- package/dist/io/fetch.js +0 -11
- package/dist/io/index.d.ts +0 -1
- package/dist/io/index.js +2 -9
- package/dist/io/is-binary.d.ts +9 -0
- package/dist/io/is-binary.js +45 -1
- package/dist/io/url-drop.js +13 -25
- package/dist/isosurface/Isosurface.svelte +17 -23
- package/dist/isosurface/IsosurfaceControls.svelte +37 -42
- package/dist/isosurface/parse-vaspwave.d.ts +3 -0
- package/dist/isosurface/parse-vaspwave.js +138 -0
- package/dist/isosurface/parse.js +6 -6
- package/dist/labels.d.ts +6 -2
- package/dist/labels.js +43 -13
- package/dist/layout/FullscreenButton.svelte +2 -1
- package/dist/layout/FullscreenToggle.svelte +10 -4
- package/dist/layout/InfoCard.svelte +7 -18
- package/dist/layout/InfoTag.svelte +1 -3
- package/dist/layout/NumberRangeInput.svelte +46 -0
- package/dist/layout/NumberRangeInput.svelte.d.ts +12 -0
- package/dist/layout/PropertyFilter.svelte +2 -6
- package/dist/layout/SettingsSection.svelte +21 -17
- package/dist/layout/SubpageGrid.svelte +3 -1
- package/dist/layout/ViewerChrome.svelte +9 -10
- package/dist/layout/ViewerChrome.svelte.d.ts +2 -1
- package/dist/layout/fullscreen.js +3 -5
- package/dist/layout/fullscreen.svelte.js +1 -2
- package/dist/layout/index.d.ts +1 -0
- package/dist/layout/index.js +1 -0
- package/dist/layout/json-tree/JsonNode.svelte +8 -11
- package/dist/layout/json-tree/JsonTree.svelte +53 -77
- package/dist/layout/json-tree/JsonValue.svelte +7 -15
- package/dist/layout/json-tree/utils.js +14 -23
- package/dist/math.d.ts +2 -0
- package/dist/math.js +19 -0
- package/dist/overlays/ContextMenu.svelte +4 -2
- package/dist/overlays/CopyButton.svelte +11 -5
- package/dist/overlays/DragControlTab.svelte +6 -1
- package/dist/overlays/DraggablePane.svelte +81 -26
- package/dist/overlays/DraggablePane.svelte.d.ts +1 -0
- package/dist/overlays/GlassChip.svelte +30 -0
- package/dist/overlays/GlassChip.svelte.d.ts +8 -0
- package/dist/overlays/InfoPaneCards.svelte +11 -23
- package/dist/overlays/index.d.ts +7 -0
- package/dist/overlays/index.js +26 -0
- package/dist/overlays/portal.d.ts +2 -0
- package/dist/overlays/portal.js +14 -0
- package/dist/periodic-table/PeriodicTable.svelte +113 -145
- package/dist/periodic-table/PeriodicTable.svelte.d.ts +5 -3
- package/dist/periodic-table/PeriodicTableControls.svelte +11 -63
- package/dist/periodic-table/TableInset.svelte +9 -4
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +50 -71
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +6 -8
- package/dist/phase-diagram/PhaseDiagramControls.svelte +70 -94
- package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +1 -1
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +2 -1
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte +12 -12
- package/dist/phase-diagram/PhaseDiagramTooltip.svelte +54 -58
- package/dist/phase-diagram/TdbInfoPanel.svelte +21 -15
- package/dist/phase-diagram/build-diagram.js +3 -3
- package/dist/phase-diagram/diagram-input.d.ts +1 -2
- package/dist/phase-diagram/parse.js +15 -15
- package/dist/phase-diagram/svg-to-diagram.js +21 -15
- package/dist/phase-diagram/utils.js +2 -3
- package/dist/plot/bar/BarPlot.svelte +430 -391
- package/dist/plot/bar/BarPlot.svelte.d.ts +2 -0
- package/dist/plot/bar/BarPlotControls.svelte +1 -3
- package/dist/plot/bar/BarPlotControls.svelte.d.ts +4 -6
- package/dist/plot/bar/SpacegroupBarPlot.svelte +29 -36
- package/dist/plot/bar/data.d.ts +5 -4
- package/dist/plot/bar/data.js +2 -1
- package/dist/plot/box/BoxPlot.svelte +301 -209
- package/dist/plot/box/BoxPlot.svelte.d.ts +2 -0
- package/dist/plot/box/Violin.svelte.d.ts +1 -0
- package/dist/plot/box/box-plot.js +1 -1
- package/dist/plot/core/auto-place.js +1 -1
- package/dist/plot/core/axis-utils.d.ts +12 -7
- package/dist/plot/core/axis-utils.js +48 -48
- package/dist/plot/core/components/AxisLabel.svelte +82 -20
- package/dist/plot/core/components/AxisLabel.svelte.d.ts +1 -0
- package/dist/plot/core/components/ColorBar.svelte +101 -106
- package/dist/plot/core/components/ColorScaleSelect.svelte +1 -1
- package/dist/plot/core/components/FillArea.svelte +10 -17
- package/dist/plot/core/components/HierarchyControls.svelte +249 -0
- package/dist/plot/{sunburst/SunburstControls.svelte.d.ts → core/components/HierarchyControls.svelte.d.ts} +12 -8
- package/dist/plot/core/components/InteractiveAxisLabel.svelte +1 -1
- package/dist/plot/core/components/InteractiveAxisLabel.svelte.d.ts +1 -1
- package/dist/plot/core/components/Line.svelte +18 -9
- package/dist/plot/core/components/Line.svelte.d.ts +2 -0
- package/dist/plot/core/components/PlotAxis.svelte +40 -17
- package/dist/plot/core/components/PlotControls.svelte +65 -41
- package/dist/plot/core/components/PlotLegend.svelte +31 -35
- package/dist/plot/core/components/PlotMarginals.svelte +616 -0
- package/dist/plot/core/components/PlotMarginals.svelte.d.ts +15 -0
- package/dist/plot/core/components/PlotTooltip.svelte +1 -1
- package/dist/plot/core/components/PortalSelect.svelte +4 -8
- package/dist/plot/core/components/ReferenceLine.svelte +27 -24
- package/dist/plot/core/components/ReferenceLine3D.svelte +54 -57
- package/dist/plot/core/components/ReferencePlane.svelte +7 -8
- package/dist/plot/core/components/ZeroLines.svelte +4 -8
- package/dist/plot/core/components/ZoomRect.svelte +1 -2
- package/dist/plot/core/components/index.d.ts +1 -0
- package/dist/plot/core/components/index.js +1 -0
- package/dist/plot/core/data-cleaning-signal.d.ts +46 -0
- package/dist/plot/core/data-cleaning-signal.js +467 -0
- package/dist/plot/core/data-cleaning.d.ts +2 -42
- package/dist/plot/core/data-cleaning.js +27 -474
- package/dist/plot/core/data-transform.js +9 -5
- package/dist/plot/core/fill-utils.d.ts +3 -1
- package/dist/plot/core/fill-utils.js +28 -6
- package/dist/plot/core/index.d.ts +1 -0
- package/dist/plot/core/index.js +1 -0
- package/dist/plot/core/interactions.js +0 -2
- package/dist/plot/core/layout.d.ts +3 -1
- package/dist/plot/core/layout.js +22 -13
- package/dist/plot/core/marginals.d.ts +170 -0
- package/dist/plot/core/marginals.js +436 -0
- package/dist/plot/core/reference-line.js +1 -1
- package/dist/plot/core/scales.d.ts +23 -0
- package/dist/plot/core/scales.js +39 -13
- package/dist/plot/core/types/fills.d.ts +101 -0
- package/dist/plot/core/types/fills.js +15 -0
- package/dist/plot/core/types/plot-3d.d.ts +87 -0
- package/dist/plot/core/types/plot-3d.js +4 -0
- package/dist/plot/core/types/reference-lines.d.ts +140 -0
- package/dist/plot/core/types/reference-lines.js +9 -0
- package/dist/plot/core/types.d.ts +29 -324
- package/dist/plot/core/types.js +23 -20
- package/dist/plot/core/utils/hierarchy-chart.d.ts +51 -0
- package/dist/plot/core/utils/hierarchy-chart.js +179 -0
- package/dist/plot/core/utils/hierarchy-labels.d.ts +20 -0
- package/dist/plot/core/utils/hierarchy-labels.js +99 -0
- package/dist/plot/core/utils/label-placement.js +2 -2
- package/dist/plot/histogram/Histogram.svelte +304 -325
- package/dist/plot/histogram/Histogram.svelte.d.ts +7 -7
- package/dist/plot/histogram/HistogramControls.svelte +30 -28
- package/dist/plot/histogram/histogram.d.ts +31 -0
- package/dist/plot/histogram/histogram.js +70 -0
- package/dist/plot/histogram/index.d.ts +1 -0
- package/dist/plot/histogram/index.js +1 -0
- package/dist/plot/index.d.ts +1 -0
- package/dist/plot/index.js +1 -0
- package/dist/plot/sankey/Sankey.svelte +78 -69
- package/dist/plot/sankey/Sankey.svelte.d.ts +2 -2
- package/dist/plot/sankey/SankeyControls.svelte +22 -16
- package/dist/plot/scatter/BinnedScatterPlot.svelte +263 -109
- package/dist/plot/scatter/BinnedScatterPlot.svelte.d.ts +7 -0
- package/dist/plot/scatter/ElementScatter.svelte +4 -1
- package/dist/plot/scatter/ScatterPlot.svelte +477 -385
- package/dist/plot/scatter/ScatterPlot.svelte.d.ts +2 -0
- package/dist/plot/scatter/ScatterPlotControls.svelte +18 -19
- package/dist/plot/scatter/ScatterPlotControls.svelte.d.ts +1 -1
- package/dist/plot/scatter/ScatterPoint.svelte +16 -9
- package/dist/plot/scatter/binned-scatter-types.d.ts +3 -2
- package/dist/plot/scatter/binned-scatter-types.js +6 -1
- package/dist/plot/scatter/scatter-data.d.ts +1 -1
- package/dist/plot/scatter/scatter-data.js +8 -7
- package/dist/plot/scatter-3d/ScatterPlot3D.svelte +25 -34
- package/dist/plot/scatter-3d/ScatterPlot3D.svelte.d.ts +2 -2
- package/dist/plot/scatter-3d/ScatterPlot3DControls.svelte +8 -5
- package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte +113 -116
- package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte.d.ts +2 -2
- package/dist/plot/scatter-3d/Surface3D.svelte +4 -13
- package/dist/plot/sunburst/Sunburst.svelte +251 -329
- package/dist/plot/sunburst/Sunburst.svelte.d.ts +2 -2
- package/dist/plot/sunburst/index.d.ts +1 -1
- package/dist/plot/sunburst/index.js +2 -1
- package/dist/plot/sunburst/render.d.ts +2 -2
- package/dist/plot/sunburst/render.js +47 -22
- package/dist/plot/sunburst/sunburst.d.ts +5 -1
- package/dist/plot/sunburst/sunburst.js +10 -3
- package/dist/plot/treemap/Treemap.svelte +907 -0
- package/dist/plot/treemap/Treemap.svelte.d.ts +84 -0
- package/dist/plot/treemap/index.d.ts +3 -0
- package/dist/plot/treemap/index.js +4 -0
- package/dist/plot/treemap/treemap.d.ts +26 -0
- package/dist/plot/treemap/treemap.js +99 -0
- package/dist/rdf/RdfPlot.svelte +22 -26
- package/dist/rdf/RdfPlot.svelte.d.ts +1 -1
- package/dist/rdf/calc-rdf.js +4 -8
- package/dist/sanitize.js +1 -1
- package/dist/scene/bind-renderer.svelte.js +14 -6
- package/dist/settings.d.ts +19 -9
- package/dist/settings.js +77 -50
- package/dist/spectral/Bands.svelte +223 -230
- package/dist/spectral/BandsAndDos.svelte +11 -9
- package/dist/spectral/BrillouinBandsDos.svelte +19 -27
- package/dist/spectral/Dos.svelte +70 -73
- package/dist/spectral/helpers.d.ts +3 -3
- package/dist/spectral/helpers.js +25 -35
- package/dist/state.svelte.js +5 -18
- package/dist/structure/Arrow.svelte +5 -18
- package/dist/structure/ArrowInstances.svelte +160 -0
- package/dist/structure/ArrowInstances.svelte.d.ts +16 -0
- package/dist/structure/AtomLegend.svelte +115 -75
- package/dist/structure/AtomLegend.svelte.d.ts +1 -1
- package/dist/structure/Bond.svelte +31 -23
- package/dist/structure/CanvasTooltip.svelte +15 -3
- package/dist/structure/CellSelect.svelte +11 -26
- package/dist/structure/Cylinder.svelte +24 -40
- package/dist/structure/InstancedAtoms.svelte +114 -0
- package/dist/structure/InstancedAtoms.svelte.d.ts +15 -0
- package/dist/structure/Lattice.svelte +85 -149
- package/dist/structure/SiteLabels.svelte +122 -0
- package/dist/structure/SiteLabels.svelte.d.ts +18 -0
- package/dist/structure/Structure.svelte +473 -419
- package/dist/structure/Structure.svelte.d.ts +4 -2
- package/dist/structure/StructureCarousel.svelte +630 -0
- package/dist/structure/StructureCarousel.svelte.d.ts +19 -0
- package/dist/structure/StructureControls.svelte +157 -399
- package/dist/structure/StructureControls.svelte.d.ts +1 -1
- package/dist/structure/StructureExportPane.svelte +17 -21
- package/dist/structure/StructureInfoPane.svelte +72 -66
- package/dist/structure/StructureInfoPane.svelte.d.ts +1 -1
- package/dist/structure/StructureScene.svelte +467 -476
- package/dist/structure/StructureScene.svelte.d.ts +3 -1
- package/dist/structure/StructureViewport.svelte +386 -0
- package/dist/structure/StructureViewport.svelte.d.ts +63 -0
- package/dist/structure/atom-label-placement.d.ts +16 -12
- package/dist/structure/atom-label-placement.js +70 -37
- package/dist/structure/atom-properties.d.ts +2 -0
- package/dist/structure/atom-properties.js +104 -38
- package/dist/structure/bonding.d.ts +10 -3
- package/dist/structure/bonding.js +84 -28
- package/dist/structure/edit-history.d.ts +6 -0
- package/dist/structure/edit-history.js +27 -0
- package/dist/structure/export.d.ts +1 -0
- package/dist/structure/export.js +39 -31
- package/dist/structure/format-detect.d.ts +1 -0
- package/dist/structure/format-detect.js +22 -0
- package/dist/structure/geometry.d.ts +9 -0
- package/dist/structure/geometry.js +27 -0
- package/dist/structure/index.d.ts +16 -1
- package/dist/structure/index.js +13 -2
- package/dist/structure/measure.d.ts +1 -1
- package/dist/structure/measure.js +6 -12
- package/dist/structure/parse.d.ts +2 -1
- package/dist/structure/parse.js +243 -222
- package/dist/structure/partial-occupancy.js +4 -2
- package/dist/structure/pbc.js +78 -98
- package/dist/structure/polyhedra.d.ts +0 -1
- package/dist/structure/polyhedra.js +3 -18
- package/dist/structure/supercell.d.ts +1 -2
- package/dist/structure/supercell.js +7 -13
- package/dist/symmetry/SymmetryElements.svelte +11 -15
- package/dist/symmetry/SymmetryStats.svelte +56 -68
- package/dist/symmetry/WyckoffTable.svelte +5 -24
- package/dist/symmetry/cell-transform.js +1 -0
- package/dist/symmetry/index.d.ts +1 -0
- package/dist/symmetry/index.js +8 -2
- package/dist/symmetry/spacegroups.js +3 -2
- package/dist/table/HeatmapTable.svelte +1102 -365
- package/dist/table/HeatmapTable.svelte.d.ts +12 -2
- package/dist/table/ToggleMenu.svelte +5 -12
- package/dist/table/index.d.ts +21 -6
- package/dist/table/index.js +34 -21
- package/dist/theme/ThemeControl.svelte +16 -8
- package/dist/theme/index.d.ts +1 -5
- package/dist/theme/index.js +4 -10
- package/dist/theme/themes.mjs +14 -7
- package/dist/tooltip/KCoords.svelte +4 -1
- package/dist/tooltip/TooltipContent.svelte +2 -5
- package/dist/trajectory/Trajectory.svelte +515 -308
- package/dist/trajectory/Trajectory.svelte.d.ts +1 -1
- package/dist/trajectory/TrajectoryError.svelte +11 -8
- package/dist/trajectory/TrajectoryExportPane.svelte +14 -31
- package/dist/trajectory/TrajectoryInfoPane.svelte +85 -97
- package/dist/trajectory/extract.js +56 -34
- package/dist/trajectory/format-detect.js +11 -9
- package/dist/trajectory/frame-reader.d.ts +2 -0
- package/dist/trajectory/frame-reader.js +33 -29
- package/dist/trajectory/helpers.d.ts +2 -0
- package/dist/trajectory/helpers.js +18 -7
- package/dist/trajectory/index.d.ts +1 -0
- package/dist/trajectory/index.js +3 -0
- package/dist/trajectory/parse/h5-utils.d.ts +13 -0
- package/dist/trajectory/parse/h5-utils.js +109 -0
- package/dist/trajectory/parse/hdf5.d.ts +1 -1
- package/dist/trajectory/parse/hdf5.js +116 -106
- package/dist/trajectory/parse/index.d.ts +2 -3
- package/dist/trajectory/parse/index.js +17 -20
- package/dist/trajectory/parse/lammps.js +8 -12
- package/dist/trajectory/parse/vasp.js +10 -7
- package/dist/trajectory/parse/vaspout-electronic.d.ts +13 -0
- package/dist/trajectory/parse/vaspout-electronic.js +207 -0
- package/dist/trajectory/parse/vaspout-h5.d.ts +5 -0
- package/dist/trajectory/parse/vaspout-h5.js +284 -0
- package/dist/trajectory/parse/xyz.js +11 -7
- package/dist/trajectory/plotting.d.ts +8 -9
- package/dist/trajectory/plotting.js +99 -27
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +7 -0
- package/dist/xrd/XrdPlot.svelte +47 -61
- package/dist/xrd/broadening.js +2 -1
- package/dist/xrd/calc-xrd.js +2 -4
- package/dist/xrd/parse.d.ts +0 -1
- package/dist/xrd/parse.js +56 -73
- package/package.json +61 -33
- package/dist/api/mp.d.ts +0 -6
- package/dist/api/mp.js +0 -22
- package/dist/plot/sunburst/SunburstControls.svelte +0 -200
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { element_data
|
|
1
|
+
import { default as element_data } from '../element/data';
|
|
2
|
+
import { is_elem_symbol } from '../element/helpers';
|
|
2
3
|
import { ELEM_SYMBOLS } from '../labels';
|
|
3
4
|
// Create symbol/number/mass/electronegativity lookup maps for O(1) access
|
|
4
5
|
export const ATOMIC_NUMBER_TO_SYMBOL = {};
|
|
@@ -24,7 +25,7 @@ const is_atomic_number_composition = (obj) => {
|
|
|
24
25
|
atomic_nums.every((atomic_num) => Number.isInteger(atomic_num) && Object.hasOwn(ATOMIC_NUMBER_TO_SYMBOL, atomic_num)));
|
|
25
26
|
};
|
|
26
27
|
const format_state = (state) => (state > 0 ? `+` : ``) + state;
|
|
27
|
-
const parse_count = (count) => (count ?
|
|
28
|
+
const parse_count = (count) => (count ? Number(count) : 1);
|
|
28
29
|
const format_count = (count) => {
|
|
29
30
|
if (!Number.isFinite(count))
|
|
30
31
|
return `${count}`;
|
|
@@ -63,9 +64,9 @@ export const atomic_symbol_to_num = (symbol_composition) => {
|
|
|
63
64
|
// Expand parentheses in chemical formulas
|
|
64
65
|
const expand_parentheses = (formula) => {
|
|
65
66
|
while (formula.includes(`(`)) {
|
|
66
|
-
const expanded = formula.replaceAll(/\(([^()]+)\)(
|
|
67
|
+
const expanded = formula.replaceAll(/\((?<group>[^()]+)\)(?<multiplier>\d+(?:\.\d+)?|\.\d+)?/g, (_match, group, multiplier) => {
|
|
67
68
|
const mult = parse_count(multiplier);
|
|
68
|
-
return group.replaceAll(/([A-Z][a-z]?)(
|
|
69
|
+
return group.replaceAll(/(?<element>[A-Z][a-z]?)(?<count>\d+(?:\.\d+)?|\.\d+)?/g, (_m, element, count) => {
|
|
69
70
|
const count_str = format_count(parse_count(count) * mult);
|
|
70
71
|
return element + (count_str === `1` ? `` : count_str);
|
|
71
72
|
});
|
|
@@ -87,9 +88,9 @@ export const parse_formula = (formula) => {
|
|
|
87
88
|
for (const [seg_idx, segment] of segments.entries()) {
|
|
88
89
|
// only hydrate segments (after a separator) carry a leading multiplier
|
|
89
90
|
const coeff = seg_idx > 0 ? /^(?:\d+(?:\.\d+)?|\.\d+)/.exec(segment)?.[0] : undefined;
|
|
90
|
-
const multiplier = coeff ?
|
|
91
|
+
const multiplier = coeff ? Number(coeff) : 1;
|
|
91
92
|
const expanded = expand_parentheses(segment.slice(coeff?.length ?? 0));
|
|
92
|
-
for (const match of expanded.matchAll(/([A-Z][a-z]?)(
|
|
93
|
+
for (const match of expanded.matchAll(/(?<element>[A-Z][a-z]?)(?<count>\d+(?:\.\d+)?|\.\d+)?/g)) {
|
|
93
94
|
const [, element, count] = match;
|
|
94
95
|
if (!is_elem_symbol(element))
|
|
95
96
|
throw new Error(`Invalid element symbol: ${element}`);
|
|
@@ -206,12 +207,12 @@ const parse_oxidation_state = (oxidation_str) => {
|
|
|
206
207
|
return oxidation_str === `+` ? 1 : -1;
|
|
207
208
|
}
|
|
208
209
|
// Handle formats like "2+", "+2", "2-", "-2"
|
|
209
|
-
const ox_match = /([+-]?)(
|
|
210
|
+
const ox_match = /(?<sign_before>[+-]?)(?<number>\d+)(?<sign_after>[+-]?)/.exec(oxidation_str);
|
|
210
211
|
if (!ox_match)
|
|
211
212
|
return 0;
|
|
212
213
|
const [, sign_before, number, sign_after] = ox_match;
|
|
213
214
|
const sign = sign_before || sign_after || `+`;
|
|
214
|
-
return sign === `-` ? -
|
|
215
|
+
return sign === `-` ? -Number(number) : Number(number);
|
|
215
216
|
};
|
|
216
217
|
// Parse chemical formula string with oxidation states into structured data.
|
|
217
218
|
// Supports both ^2+ and [2+] syntax for oxidation states.
|
|
@@ -229,7 +230,7 @@ export const parse_formula_with_oxidation = (formula, strict = false) => {
|
|
|
229
230
|
// - just oxidation: (?:\^([+-]?\d+[+-]?|[+-])|\[([+-]?\d+[+-]?|[+-])\])
|
|
230
231
|
// - just count: count
|
|
231
232
|
// - neither
|
|
232
|
-
const regex = /([A-Z][a-z]?)(?:(?:\^([+-]?\d+[+-]?|[+-])|\[([+-]?\d+[+-]?|[+-])\])((?:\d+(?:\.\d+)?|\.\d+)?)|((?:\d+(?:\.\d+)?|\.\d+))(?:\^([+-]?\d+[+-]?|[+-])|\[([+-]?\d+[+-]?|[+-])\])?)?/g;
|
|
233
|
+
const regex = /(?<element>[A-Z][a-z]?)(?:(?:\^(?<oxi_caret>[+-]?\d+[+-]?|[+-])|\[(?<oxi_bracket>[+-]?\d+[+-]?|[+-])\])(?<count_after>(?:\d+(?:\.\d+)?|\.\d+)?)|(?<count_before>(?:\d+(?:\.\d+)?|\.\d+))(?:\^(?<oxi_caret_2>[+-]?\d+[+-]?|[+-])|\[(?<oxi_bracket_2>[+-]?\d+[+-]?|[+-])\])?)?/g;
|
|
233
234
|
let match;
|
|
234
235
|
let orig_idx = 0;
|
|
235
236
|
while ((match = regex.exec(cleaned_formula)) !== null) {
|
|
@@ -387,7 +388,7 @@ export function parse_formula_with_wildcards(formula) {
|
|
|
387
388
|
// Regex to match either:
|
|
388
389
|
// 1. Standard element symbol with optional decimal count
|
|
389
390
|
// 2. Wildcard with optional decimal count
|
|
390
|
-
const regex = /([A-Z][a-z]?)((?:\d+(?:\.\d+)?|\.\d+)?)|(
|
|
391
|
+
const regex = /(?<element>[A-Z][a-z]?)(?<count>(?:\d+(?:\.\d+)?|\.\d+)?)|(?<wildcard>\*)(?<wildcard_count>(?:\d+(?:\.\d+)?|\.\d+)?)/g;
|
|
391
392
|
let match;
|
|
392
393
|
while ((match = regex.exec(cleaned)) !== null) {
|
|
393
394
|
if (match[3] === `*`) {
|
package/dist/constants.js
CHANGED
|
@@ -61,9 +61,11 @@ export const TRAJ_KEYWORDS_REGEX = new RegExp(`(^|[-_.])(${TRAJ_KEYWORDS.join(`|
|
|
|
61
61
|
export const STRUCT_KEYWORDS_REGEX = new RegExp(`(${STRUCT_KEYWORDS.join(`|`)})`, `i`);
|
|
62
62
|
export const STRUCT_KEYWORDS_STRICT_REGEX = new RegExp(`(${STRUCT_KEYWORDS_STRICT.join(`|`)})`, `i`);
|
|
63
63
|
export const TRAJ_KEYWORDS_SIMPLE_REGEX = new RegExp(`(${TRAJ_KEYWORDS.join(`|`)})`, `i`);
|
|
64
|
+
// Build a case-insensitive `\.(ext1|ext2|...)$` regex from extensions (leading dots stripped)
|
|
65
|
+
const ext_regex = (exts) => new RegExp(`\\.(${exts.map((ext) => ext.slice(1)).join(`|`)})$`, `i`);
|
|
64
66
|
// File extensions for different file types
|
|
65
67
|
export const TRAJ_EXTENSIONS = Object.freeze([`.traj`, `.xtc`, `.lammpstrj`]);
|
|
66
|
-
export const TRAJ_EXTENSIONS_REGEX =
|
|
68
|
+
export const TRAJ_EXTENSIONS_REGEX = ext_regex(TRAJ_EXTENSIONS);
|
|
67
69
|
export const STRUCTURE_EXTENSIONS = Object.freeze([
|
|
68
70
|
`.cif`,
|
|
69
71
|
`.mcif`,
|
|
@@ -79,7 +81,7 @@ export const STRUCTURE_EXTENSIONS = Object.freeze([
|
|
|
79
81
|
`.sdf`,
|
|
80
82
|
`.mmcif`,
|
|
81
83
|
]);
|
|
82
|
-
export const STRUCTURE_EXTENSIONS_REGEX =
|
|
84
|
+
export const STRUCTURE_EXTENSIONS_REGEX = ext_regex(STRUCTURE_EXTENSIONS);
|
|
83
85
|
export const TRAJ_FALLBACK_EXTENSIONS = Object.freeze([
|
|
84
86
|
`.dat`,
|
|
85
87
|
`.data`,
|
|
@@ -87,13 +89,13 @@ export const TRAJ_FALLBACK_EXTENSIONS = Object.freeze([
|
|
|
87
89
|
`.out`,
|
|
88
90
|
`.json`,
|
|
89
91
|
]);
|
|
90
|
-
export const TRAJ_FALLBACK_EXTENSIONS_REGEX =
|
|
92
|
+
export const TRAJ_FALLBACK_EXTENSIONS_REGEX = ext_regex(TRAJ_FALLBACK_EXTENSIONS);
|
|
91
93
|
// Special regex patterns
|
|
92
|
-
export const VASP_FILES_REGEX = /(?:^|[\\/_.-])(poscar|contcar|potcar|incar|kpoints|outcar)(?:[\\/_.-]|$)/i;
|
|
93
|
-
export const VASP_VOLUMETRIC_REGEX = /(?:^|[\\/_.-])(chgcar|aeccar[012]?|elfcar|locpot|parchg)(?:[\\/_.-]|$)/i;
|
|
94
|
+
export const VASP_FILES_REGEX = /(?:^|[\\/_.-])(?:poscar|contcar|potcar|incar|kpoints|outcar)(?:[\\/_.-]|$)/i;
|
|
95
|
+
export const VASP_VOLUMETRIC_REGEX = /(?:^|[\\/_.-])(?:chgcar|aeccar[012]?|elfcar|locpot|parchg)(?:[\\/_.-]|$)/i;
|
|
94
96
|
export const XDATCAR_REGEX = /xdatcar/i;
|
|
95
|
-
export const CONFIG_DIRS_REGEX = /(?:^|[\\/])(
|
|
96
|
-
export const MD_SIM_EXCLUDE_REGEX = /md_simulation\.(out|txt|yml|py|csv|html|css|md|js|ts)$/i;
|
|
97
|
-
export const XYZ_EXTXYZ_REGEX = /\.(xyz|extxyz)$/i;
|
|
97
|
+
export const CONFIG_DIRS_REGEX = /(?:^|[\\/])(?:\.vscode|\.idea|\.nyc_output|\.cache|\.tmp|\.temp|node_modules|dist|build|coverage)(?:[\\/]|$)/i;
|
|
98
|
+
export const MD_SIM_EXCLUDE_REGEX = /md_simulation\.(?:out|txt|yml|py|csv|html|css|md|js|ts)$/i;
|
|
99
|
+
export const XYZ_EXTXYZ_REGEX = /\.(?:xyz|extxyz)$/i;
|
|
98
100
|
// Compression extensions regex (shared across files)
|
|
99
|
-
export const COMPRESSION_EXTENSIONS_REGEX =
|
|
101
|
+
export const COMPRESSION_EXTENSIONS_REGEX = ext_regex(COMPRESSION_EXTENSIONS);
|
|
@@ -12,10 +12,11 @@
|
|
|
12
12
|
// Union type combining all possible props from 2D, 3D, and 4D components
|
|
13
13
|
// each specific component will only use its relevant props from this super set
|
|
14
14
|
// (gas_config/gas_pressures already come from BaseConvexHullProps)
|
|
15
|
-
type ConvexHullProps = BaseConvexHullProps &
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
type ConvexHullProps = BaseConvexHullProps &
|
|
16
|
+
Hull3DProps & {
|
|
17
|
+
x_axis?: AxisConfig
|
|
18
|
+
y_axis?: AxisConfig
|
|
19
|
+
}
|
|
19
20
|
|
|
20
21
|
let {
|
|
21
22
|
entries = [],
|
|
@@ -26,9 +27,7 @@
|
|
|
26
27
|
show_unstable = $bindable(true),
|
|
27
28
|
hidden_categories = $bindable([]),
|
|
28
29
|
show_hull_faces = $bindable(true),
|
|
29
|
-
hull_face_opacity: hull_face_opacity_prop = $bindable(
|
|
30
|
-
undefined as number | undefined,
|
|
31
|
-
),
|
|
30
|
+
hull_face_opacity: hull_face_opacity_prop = $bindable(undefined as number | undefined),
|
|
32
31
|
color_mode = $bindable(`energy`),
|
|
33
32
|
color_scale = $bindable(`interpolateViridis`),
|
|
34
33
|
info_pane_open = $bindable(false),
|
|
@@ -88,8 +87,7 @@
|
|
|
88
87
|
// while each component declares only its dimension's props (2D lacks Hull3DProps, 3D/4D
|
|
89
88
|
// lack x/y_axis), so a constructor union wouldn't compile. Svelte ignores extra props.
|
|
90
89
|
const ConvexHullComponent = $derived(
|
|
91
|
-
{ 2: ConvexHull2D, 3: ConvexHull3D, 4: ConvexHull4D }[element_count] ??
|
|
92
|
-
null,
|
|
90
|
+
{ 2: ConvexHull2D, 3: ConvexHull3D, 4: ConvexHull4D }[element_count] ?? null,
|
|
93
91
|
) as Component<ConvexHullProps> | null
|
|
94
92
|
</script>
|
|
95
93
|
|
|
@@ -125,14 +123,13 @@
|
|
|
125
123
|
{:else}
|
|
126
124
|
<!-- Error state for unsupported dimensionalities -->
|
|
127
125
|
<div class="convex-hull-error">
|
|
128
|
-
<div
|
|
129
|
-
style="text-align: center; padding: 2em; color: var(--convex-hull-text-color, #666)"
|
|
130
|
-
>
|
|
126
|
+
<div style="text-align: center; padding: 2em; color: var(--convex-hull-text-color, #666)">
|
|
131
127
|
<h3 id="unsupported-chemical-system" style="margin: 0 0 1em 0">Unsupported Chemical System</h3>
|
|
132
128
|
<p style="margin: 0">
|
|
133
|
-
Convex hulls require 2, 3, or 4 elements. Found {element_count} element{
|
|
134
|
-
|
|
135
|
-
|
|
129
|
+
Convex hulls require 2, 3, or 4 elements. Found {element_count} element{element_count ===
|
|
130
|
+
1
|
|
131
|
+
? ``
|
|
132
|
+
: `s`}:
|
|
136
133
|
</p>
|
|
137
134
|
<p style="margin: 0.5em 0 0 0; font-weight: bold">
|
|
138
135
|
{elements.join(`, `)}
|
|
@@ -5,6 +5,6 @@ type ConvexHullProps = BaseConvexHullProps & Hull3DProps & {
|
|
|
5
5
|
x_axis?: AxisConfig;
|
|
6
6
|
y_axis?: AxisConfig;
|
|
7
7
|
};
|
|
8
|
-
declare const ConvexHull: Component<ConvexHullProps, {}, "display" | "
|
|
8
|
+
declare const ConvexHull: Component<ConvexHullProps, {}, "display" | "fullscreen" | "wrapper" | "controls_open" | "color_scale" | "info_pane_open" | "temperature" | "show_hull_faces" | "hull_face_opacity" | "color_mode" | "show_stable" | "show_unstable" | "show_stable_labels" | "show_unstable_labels" | "max_hull_dist_show_phases" | "max_hull_dist_show_labels" | "hidden_categories" | "energy_source_mode" | "stable_entries" | "unstable_entries" | "phase_stats" | "highlighted_entries" | "selected_entry" | "gas_pressures">;
|
|
9
9
|
type ConvexHull = ReturnType<typeof ConvexHull>;
|
|
10
10
|
export default ConvexHull;
|
|
@@ -32,12 +32,7 @@
|
|
|
32
32
|
import StructurePopup from './StructurePopup.svelte'
|
|
33
33
|
import TemperatureSlider from './TemperatureSlider.svelte'
|
|
34
34
|
import * as thermo from './thermodynamics'
|
|
35
|
-
import type {
|
|
36
|
-
ConvexHullEntry,
|
|
37
|
-
HighlightStyle,
|
|
38
|
-
HoverData3D,
|
|
39
|
-
PhaseData,
|
|
40
|
-
} from './types'
|
|
35
|
+
import type { ConvexHullEntry, HighlightStyle, HoverData3D, PhaseData } from './types'
|
|
41
36
|
import { MAGNETIC_ORDERING_CATEGORY } from './types'
|
|
42
37
|
|
|
43
38
|
// Binary convex hull rendered as energy vs composition (x in [0, 1])
|
|
@@ -58,9 +53,7 @@
|
|
|
58
53
|
entry_category = MAGNETIC_ORDERING_CATEGORY,
|
|
59
54
|
hidden_categories = $bindable([]),
|
|
60
55
|
color_mode = $bindable(DEFAULTS.convex_hull.binary.color_mode),
|
|
61
|
-
color_scale = $bindable(
|
|
62
|
-
DEFAULTS.convex_hull.binary.color_scale as D3InterpolateName,
|
|
63
|
-
),
|
|
56
|
+
color_scale = $bindable(DEFAULTS.convex_hull.binary.color_scale as D3InterpolateName),
|
|
64
57
|
info_pane_open = $bindable(DEFAULTS.convex_hull.binary.info_pane_open),
|
|
65
58
|
controls_open = $bindable(DEFAULTS.convex_hull.binary.legend_pane_open),
|
|
66
59
|
max_hull_dist_show_phases = $bindable(
|
|
@@ -70,9 +63,7 @@
|
|
|
70
63
|
DEFAULTS.convex_hull.binary.max_hull_dist_show_labels,
|
|
71
64
|
),
|
|
72
65
|
show_stable_labels = $bindable(DEFAULTS.convex_hull.binary.show_stable_labels),
|
|
73
|
-
show_unstable_labels = $bindable(
|
|
74
|
-
DEFAULTS.convex_hull.binary.show_unstable_labels,
|
|
75
|
-
),
|
|
66
|
+
show_unstable_labels = $bindable(DEFAULTS.convex_hull.binary.show_unstable_labels),
|
|
76
67
|
on_file_drop,
|
|
77
68
|
enable_click_selection = true,
|
|
78
69
|
enable_structure_preview = true,
|
|
@@ -117,9 +108,7 @@
|
|
|
117
108
|
const show_hull_line = $derived(merged_config.show_hull)
|
|
118
109
|
|
|
119
110
|
// Merge highlight style with defaults (consistent with 3D/4D)
|
|
120
|
-
const merged_highlight_style = $derived(
|
|
121
|
-
helpers.merge_highlight_style(highlight_style),
|
|
122
|
-
)
|
|
111
|
+
const merged_highlight_style = $derived(helpers.merge_highlight_style(highlight_style))
|
|
123
112
|
|
|
124
113
|
// Helper to check if entry is highlighted
|
|
125
114
|
const is_highlighted = (entry: ConvexHullEntry): boolean =>
|
|
@@ -142,12 +131,11 @@
|
|
|
142
131
|
show_unstable: () => show_unstable,
|
|
143
132
|
entry_category: () => entry_category,
|
|
144
133
|
hidden_categories: () => hidden_categories,
|
|
145
|
-
keep_plot_entry:
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
set_unstable_entries: (value) => unstable_entries = value,
|
|
134
|
+
keep_plot_entry: helpers.entry_within_hull_dist,
|
|
135
|
+
set_temperature: (next_temp) => (temperature = next_temp),
|
|
136
|
+
set_max_hull_dist_show_phases: (value) => (max_hull_dist_show_phases = value),
|
|
137
|
+
set_stable_entries: (value) => (stable_entries = value),
|
|
138
|
+
set_unstable_entries: (value) => (unstable_entries = value),
|
|
151
139
|
})
|
|
152
140
|
const merged_gas_config = $derived(hull_data.merged_gas_config)
|
|
153
141
|
const elements = $derived(hull_data.elements)
|
|
@@ -210,30 +198,35 @@
|
|
|
210
198
|
return { all_enriched_entries: [], hull_points: [] }
|
|
211
199
|
}
|
|
212
200
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
201
|
+
// Build lower hull input: one minimum-energy point per composition x.
|
|
202
|
+
// Excluded entries don't participate in hull construction.
|
|
203
|
+
const min_y_by_x = new SvelteMap<number, number>()
|
|
204
|
+
for (const entry of coords_entries) {
|
|
205
|
+
if (entry.exclude_from_hull) continue
|
|
206
|
+
const current_min_y = min_y_by_x.get(entry.x)
|
|
207
|
+
if (current_min_y === undefined || entry.y < current_min_y) {
|
|
208
|
+
min_y_by_x.set(entry.x, entry.y)
|
|
209
|
+
}
|
|
221
210
|
}
|
|
222
|
-
}
|
|
223
211
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
212
|
+
const hull_input = [...min_y_by_x].map(([x_coord, min_y]) => ({
|
|
213
|
+
x: x_coord,
|
|
214
|
+
y: min_y,
|
|
215
|
+
}))
|
|
216
|
+
const computed_hull_points = thermo.compute_lower_hull_2d(hull_input)
|
|
217
|
+
|
|
218
|
+
const enriched_entries = coords_entries.map((entry) => {
|
|
219
|
+
const y_hull = thermo.interpolate_hull_2d(computed_hull_points, entry.x)
|
|
220
|
+
// degenerate hull (<2 points): y_hull null -> unknown distance (not 0/stable)
|
|
221
|
+
const raw_dist = y_hull == null ? undefined : entry.y - y_hull
|
|
222
|
+
return {
|
|
223
|
+
...entry,
|
|
224
|
+
...helpers.compute_hull_stability(raw_dist, entry.exclude_from_hull),
|
|
225
|
+
}
|
|
226
|
+
})
|
|
227
|
+
return { all_enriched_entries: enriched_entries, hull_points: computed_hull_points }
|
|
228
|
+
},
|
|
229
|
+
)
|
|
237
230
|
|
|
238
231
|
let reset_counter = $state(0)
|
|
239
232
|
// Drag and drop state (to match 3D/4D components)
|
|
@@ -259,13 +252,12 @@
|
|
|
259
252
|
const y_domain = $derived.by((): Vec2 => {
|
|
260
253
|
const ys = plot_entries.map((entry) => entry.y)
|
|
261
254
|
if (ys.length === 0) return [-1, 0]
|
|
262
|
-
const min_y_data =
|
|
263
|
-
const max_y_data =
|
|
255
|
+
const min_y_data = helpers.array_min(ys)
|
|
256
|
+
const max_y_data = helpers.array_max(ys)
|
|
264
257
|
const span = Math.max(1e-9, max_y_data - min_y_data)
|
|
265
258
|
const pad = 0.05 * span
|
|
266
259
|
return [min_y_data - pad, max_y_data + pad]
|
|
267
260
|
})
|
|
268
|
-
|
|
269
261
|
// Build ScatterPlot series --------------------------------------------------
|
|
270
262
|
|
|
271
263
|
// Map MarkerSymbol to D3SymbolName (type-safe via symbol_map lookup)
|
|
@@ -296,15 +288,19 @@
|
|
|
296
288
|
const hl = is_highlighted(entry) ? merged_highlight_style : null
|
|
297
289
|
|
|
298
290
|
point_style[idx] = {
|
|
299
|
-
fill:
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
291
|
+
fill:
|
|
292
|
+
hl?.effect === `color` || hl?.effect === `both`
|
|
293
|
+
? hl?.color
|
|
294
|
+
: is_energy_mode
|
|
295
|
+
? undefined
|
|
296
|
+
: is_stable
|
|
297
|
+
? stable_color
|
|
298
|
+
: unstable_color,
|
|
304
299
|
stroke: is_stable ? `#ffffff` : `#000000`,
|
|
305
|
-
radius:
|
|
306
|
-
|
|
307
|
-
|
|
300
|
+
radius:
|
|
301
|
+
hl?.effect === `size` || hl?.effect === `both`
|
|
302
|
+
? base_radius * (hl?.size_multiplier ?? 1)
|
|
303
|
+
: base_radius,
|
|
308
304
|
symbol_type: marker_to_d3_symbol(entry.marker),
|
|
309
305
|
is_highlighted: Boolean(hl),
|
|
310
306
|
highlight_effect: hl?.effect,
|
|
@@ -400,8 +396,7 @@
|
|
|
400
396
|
show_unstable_labels !== DEFAULTS.convex_hull.binary.show_unstable_labels ||
|
|
401
397
|
// Compare with auto-computed threshold, with small tolerance for floating point
|
|
402
398
|
Math.abs(max_hull_dist_show_phases - auto_default_threshold) > 0.001 ||
|
|
403
|
-
max_hull_dist_show_labels !==
|
|
404
|
-
DEFAULTS.convex_hull.binary.max_hull_dist_show_labels,
|
|
399
|
+
max_hull_dist_show_labels !== DEFAULTS.convex_hull.binary.max_hull_dist_show_labels,
|
|
405
400
|
)
|
|
406
401
|
|
|
407
402
|
// Custom hover tooltip state used with ScatterPlot events
|
|
@@ -422,11 +417,13 @@
|
|
|
422
417
|
const current_popup = helpers.current_entry(structure_popup.entry, plot_entries)
|
|
423
418
|
if (structure_popup.open) {
|
|
424
419
|
const structure = current_popup && extract_structure_from_entry(current_popup)
|
|
425
|
-
if (!structure)
|
|
420
|
+
if (!structure)
|
|
421
|
+
structure_popup = { open: false, structure: null, entry: null, place_right: true }
|
|
426
422
|
else if (
|
|
427
423
|
current_popup !== structure_popup.entry ||
|
|
428
424
|
structure !== structure_popup.structure
|
|
429
|
-
)
|
|
425
|
+
)
|
|
426
|
+
structure_popup = { ...structure_popup, entry: current_popup, structure }
|
|
430
427
|
}
|
|
431
428
|
})
|
|
432
429
|
|
|
@@ -434,10 +431,10 @@
|
|
|
434
431
|
const target = event.target
|
|
435
432
|
if (target instanceof HTMLElement && target.tagName.match(/INPUT|TEXTAREA/)) return
|
|
436
433
|
const actions: Record<string, () => void> = {
|
|
437
|
-
b: () => color_mode = color_mode === `stability` ? `energy` : `stability
|
|
438
|
-
s: () => show_stable = !show_stable,
|
|
439
|
-
u: () => show_unstable = !show_unstable,
|
|
440
|
-
l: () => show_stable_labels = !show_stable_labels,
|
|
434
|
+
b: () => (color_mode = color_mode === `stability` ? `energy` : `stability`),
|
|
435
|
+
s: () => (show_stable = !show_stable),
|
|
436
|
+
u: () => (show_unstable = !show_unstable),
|
|
437
|
+
l: () => (show_stable_labels = !show_stable_labels),
|
|
441
438
|
}
|
|
442
439
|
actions[event.key.toLowerCase()]?.()
|
|
443
440
|
}
|
|
@@ -448,14 +445,16 @@
|
|
|
448
445
|
if (data) on_file_drop?.(data)
|
|
449
446
|
}
|
|
450
447
|
|
|
451
|
-
async function copy_entry_data(
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
448
|
+
async function copy_entry_data(entry: ConvexHullEntry, position: { x: number; y: number }) {
|
|
449
|
+
await helpers.copy_entry_to_clipboard(
|
|
450
|
+
entry,
|
|
451
|
+
position,
|
|
452
|
+
(visible, pos) => {
|
|
453
|
+
copy_feedback.visible = visible
|
|
454
|
+
copy_feedback.position = pos
|
|
455
|
+
},
|
|
456
|
+
entry_category,
|
|
457
|
+
)
|
|
459
458
|
}
|
|
460
459
|
|
|
461
460
|
function close_structure_popup() {
|
|
@@ -472,8 +471,7 @@
|
|
|
472
471
|
if (!entry) return
|
|
473
472
|
|
|
474
473
|
const now = Date.now()
|
|
475
|
-
const is_double_click = last_clicked_entry === entry &&
|
|
476
|
-
now - last_click_time < 300
|
|
474
|
+
const is_double_click = last_clicked_entry === entry && now - last_click_time < 300
|
|
477
475
|
|
|
478
476
|
if (is_double_click) {
|
|
479
477
|
// Double-click: copy to clipboard
|
|
@@ -524,9 +522,8 @@
|
|
|
524
522
|
<!-- Hover tooltip matching 3D/4D style (content only; container handled by ScatterPlot) -->
|
|
525
523
|
{#snippet tooltip(point: ScatterHandlerProps<ConvexHullEntry>)}
|
|
526
524
|
{@const entry = point.metadata}
|
|
527
|
-
{@const entry_highlight =
|
|
528
|
-
? merged_highlight_style
|
|
529
|
-
: undefined}
|
|
525
|
+
{@const entry_highlight =
|
|
526
|
+
entry && is_highlighted(entry) ? merged_highlight_style : undefined}
|
|
530
527
|
{#if entry}
|
|
531
528
|
<ConvexHullTooltip
|
|
532
529
|
{entry}
|
|
@@ -600,9 +597,14 @@
|
|
|
600
597
|
{/if}
|
|
601
598
|
{/snippet}
|
|
602
599
|
|
|
603
|
-
{#snippet user_content(
|
|
604
|
-
|
|
605
|
-
|
|
600
|
+
{#snippet user_content({
|
|
601
|
+
x_scale_fn,
|
|
602
|
+
pad,
|
|
603
|
+
height,
|
|
604
|
+
y_scale_fn,
|
|
605
|
+
y_range,
|
|
606
|
+
width,
|
|
607
|
+
}: UserContentProps)}
|
|
606
608
|
{@const [x0, x1, y0] = [x_scale_fn(0), x_scale_fn(1), y_scale_fn(y_range[0])]}
|
|
607
609
|
{@const stroke = {
|
|
608
610
|
stroke: `var(--scatter-grid-stroke, gray)`,
|
|
@@ -616,7 +618,7 @@
|
|
|
616
618
|
{#key reset_counter}
|
|
617
619
|
<ScatterPlot
|
|
618
620
|
{...rest}
|
|
619
|
-
class=
|
|
621
|
+
class={[`convex-hull-2d`, rest.class, drag_over && `dragover`]}
|
|
620
622
|
style={`${style}; ${rest.style ?? ``}`}
|
|
621
623
|
data-has-selection={selected_entry !== null}
|
|
622
624
|
bind:wrapper
|
|
@@ -668,9 +670,7 @@
|
|
|
668
670
|
return
|
|
669
671
|
}
|
|
670
672
|
const { metadata: entry, event } = data
|
|
671
|
-
hover_data = entry
|
|
672
|
-
? { entry, position: { x: event.clientX, y: event.clientY } }
|
|
673
|
-
: null
|
|
673
|
+
hover_data = entry ? { entry, position: { x: event.clientX, y: event.clientY } } : null
|
|
674
674
|
on_point_hover?.(hover_data)
|
|
675
675
|
}}
|
|
676
676
|
padding={{ t: 30, b: 60, l: 60, r: 30 }}
|
|
@@ -685,14 +685,14 @@
|
|
|
685
685
|
{@html sanitize_html(merged_controls.title || phase_stats?.chemical_system || ``)}
|
|
686
686
|
</h3>
|
|
687
687
|
|
|
688
|
-
<ClickFeedback
|
|
689
|
-
|
|
690
|
-
position={copy_feedback.position}
|
|
691
|
-
/>
|
|
692
|
-
<DragOverlay visible={drag_over} />
|
|
688
|
+
<ClickFeedback bind:visible={copy_feedback.visible} position={copy_feedback.position} />
|
|
689
|
+
<DragOverlay visible={drag_over} message="Drop JSON file to load phase diagram data" />
|
|
693
690
|
|
|
694
691
|
{#if hull_data.has_temp_data && temperature !== undefined}
|
|
695
|
-
<TemperatureSlider
|
|
692
|
+
<TemperatureSlider
|
|
693
|
+
available_temperatures={hull_data.available_temperatures}
|
|
694
|
+
bind:temperature
|
|
695
|
+
/>
|
|
696
696
|
{/if}
|
|
697
697
|
|
|
698
698
|
{#if hull_data.gas_analysis.has_gas_dependent_elements && merged_gas_config}
|
|
@@ -720,8 +720,7 @@
|
|
|
720
720
|
|
|
721
721
|
<style>
|
|
722
722
|
:global(.convex-hull-2d:fullscreen) {
|
|
723
|
-
background: var(--hull-2d-bg-fullscreen, var(--hull-2d-bg, var(--hull-bg)))
|
|
724
|
-
!important;
|
|
723
|
+
background: var(--hull-2d-bg-fullscreen, var(--hull-2d-bg, var(--hull-bg))) !important;
|
|
725
724
|
overflow: hidden;
|
|
726
725
|
}
|
|
727
726
|
:global(.convex-hull-2d.dragover) {
|
|
@@ -736,9 +735,11 @@
|
|
|
736
735
|
cursor: pointer;
|
|
737
736
|
border-radius: 3px;
|
|
738
737
|
color: var(--text-color, currentColor);
|
|
739
|
-
transition:
|
|
738
|
+
transition:
|
|
739
|
+
background-color 0.2s,
|
|
740
|
+
opacity 0.2s;
|
|
740
741
|
display: flex;
|
|
741
|
-
font-size: clamp(0.
|
|
742
|
+
font-size: var(--ctrl-btn-icon-size, clamp(0.7rem, 2cqmin, 0.85rem));
|
|
742
743
|
}
|
|
743
744
|
:global(.convex-hull-2d :is(.control-btn, .fullscreen-btn):hover) {
|
|
744
745
|
background-color: color-mix(in srgb, currentColor 8%, transparent);
|
|
@@ -6,6 +6,6 @@ type $$ComponentProps = BaseConvexHullProps<ConvexHullEntry> & {
|
|
|
6
6
|
x_axis?: AxisConfig;
|
|
7
7
|
y_axis?: AxisConfig;
|
|
8
8
|
};
|
|
9
|
-
declare const ConvexHull2D: import("svelte").Component<$$ComponentProps, {}, "display" | "
|
|
9
|
+
declare const ConvexHull2D: import("svelte").Component<$$ComponentProps, {}, "display" | "fullscreen" | "wrapper" | "controls_open" | "color_scale" | "info_pane_open" | "temperature" | "color_mode" | "show_stable" | "show_unstable" | "show_stable_labels" | "show_unstable_labels" | "max_hull_dist_show_phases" | "max_hull_dist_show_labels" | "hidden_categories" | "energy_source_mode" | "stable_entries" | "unstable_entries" | "phase_stats" | "highlighted_entries" | "selected_entry" | "gas_pressures">;
|
|
10
10
|
type ConvexHull2D = ReturnType<typeof ConvexHull2D>;
|
|
11
11
|
export default ConvexHull2D;
|