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
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { D3InterpolateName } from '../../colors';
|
|
2
|
+
import type { Vec2 } from '../../math';
|
|
3
|
+
import type { BasePlotProps, LegendConfig, SunburstLabelText, SunburstSort, SunburstValueMode } from '..';
|
|
4
|
+
import { ColorBar } from '..';
|
|
5
|
+
import type { Rect, Sides } from '../core/layout';
|
|
6
|
+
import type { PositionedArc } from '../sunburst/sunburst';
|
|
7
|
+
import type { TreemapNode, TreemapNodeHandlerProps } from './treemap';
|
|
8
|
+
import type { ComponentProps, Snippet } from 'svelte';
|
|
9
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
10
|
+
import { type TweenOptions } from 'svelte/motion';
|
|
11
|
+
declare function $$render<Metadata extends Record<string, unknown> = Record<string, unknown>>(): {
|
|
12
|
+
props: HTMLAttributes<HTMLDivElement> & Omit<BasePlotProps, "change"> & {
|
|
13
|
+
data?: TreemapNode<Metadata> | TreemapNode<Metadata>[];
|
|
14
|
+
value_mode?: SunburstValueMode;
|
|
15
|
+
sort?: SunburstSort;
|
|
16
|
+
level_lighten?: number;
|
|
17
|
+
min_fraction?: number;
|
|
18
|
+
other_label?: string;
|
|
19
|
+
max_depth?: number;
|
|
20
|
+
padding_inner?: number;
|
|
21
|
+
padding_top?: number;
|
|
22
|
+
padding_outer?: number;
|
|
23
|
+
show_labels?: boolean;
|
|
24
|
+
label_text?: SunburstLabelText;
|
|
25
|
+
zoom_on_click?: boolean;
|
|
26
|
+
zoom_root_id?: string | number | null;
|
|
27
|
+
show_breadcrumbs?: boolean;
|
|
28
|
+
color_values?: (rect: PositionedArc<Metadata>) => number | null;
|
|
29
|
+
color_scale?: D3InterpolateName;
|
|
30
|
+
color_range?: Vec2;
|
|
31
|
+
colorbar?: ComponentProps<typeof ColorBar> | null;
|
|
32
|
+
export_buttons?: boolean;
|
|
33
|
+
export_filename?: string;
|
|
34
|
+
tween?: Omit<TweenOptions<Rect[]>, `interpolate`>;
|
|
35
|
+
value_format?: string;
|
|
36
|
+
padding?: Sides;
|
|
37
|
+
legend?: LegendConfig | null;
|
|
38
|
+
show_legend?: boolean;
|
|
39
|
+
tooltip?: Snippet<[TreemapNodeHandlerProps<Metadata>]>;
|
|
40
|
+
cell_content?: Snippet<[{
|
|
41
|
+
arc: PositionedArc<Metadata>;
|
|
42
|
+
rect: Rect;
|
|
43
|
+
}]>;
|
|
44
|
+
change?: (data: TreemapNodeHandlerProps<Metadata> | null) => void;
|
|
45
|
+
on_node_click?: (data: TreemapNodeHandlerProps<Metadata> & {
|
|
46
|
+
event: MouseEvent | KeyboardEvent;
|
|
47
|
+
}) => void;
|
|
48
|
+
on_node_hover?: (data: (TreemapNodeHandlerProps<Metadata> & {
|
|
49
|
+
event: MouseEvent | FocusEvent;
|
|
50
|
+
}) | null) => void;
|
|
51
|
+
on_zoom?: (data: {
|
|
52
|
+
root: TreemapNodeHandlerProps<Metadata> | null;
|
|
53
|
+
}) => void;
|
|
54
|
+
header_controls?: Snippet<[{
|
|
55
|
+
height: number;
|
|
56
|
+
width: number;
|
|
57
|
+
fullscreen: boolean;
|
|
58
|
+
}]>;
|
|
59
|
+
controls_extra?: Snippet<[{
|
|
60
|
+
zoom_root_id: string | number | null;
|
|
61
|
+
}]>;
|
|
62
|
+
};
|
|
63
|
+
exports: {};
|
|
64
|
+
bindings: "show_controls" | "data" | "show_labels" | "fullscreen" | "hovered" | "controls_open" | "padding_inner" | "padding_top" | "padding_outer" | "value_mode" | "max_depth" | "min_fraction" | "label_text" | "zoom_on_click" | "show_breadcrumbs" | "zoom_root_id";
|
|
65
|
+
slots: {};
|
|
66
|
+
events: {};
|
|
67
|
+
};
|
|
68
|
+
declare class __sveltets_Render<Metadata extends Record<string, unknown> = Record<string, unknown>> {
|
|
69
|
+
props(): ReturnType<typeof $$render<Metadata>>['props'];
|
|
70
|
+
events(): ReturnType<typeof $$render<Metadata>>['events'];
|
|
71
|
+
slots(): ReturnType<typeof $$render<Metadata>>['slots'];
|
|
72
|
+
bindings(): "show_controls" | "data" | "show_labels" | "fullscreen" | "hovered" | "controls_open" | "padding_inner" | "padding_top" | "padding_outer" | "value_mode" | "max_depth" | "min_fraction" | "label_text" | "zoom_on_click" | "show_breadcrumbs" | "zoom_root_id";
|
|
73
|
+
exports(): {};
|
|
74
|
+
}
|
|
75
|
+
interface $$IsomorphicComponent {
|
|
76
|
+
new <Metadata extends Record<string, unknown> = Record<string, unknown>>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<Metadata>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<Metadata>['props']>, ReturnType<__sveltets_Render<Metadata>['events']>, ReturnType<__sveltets_Render<Metadata>['slots']>> & {
|
|
77
|
+
$$bindings?: ReturnType<__sveltets_Render<Metadata>['bindings']>;
|
|
78
|
+
} & ReturnType<__sveltets_Render<Metadata>['exports']>;
|
|
79
|
+
<Metadata extends Record<string, unknown> = Record<string, unknown>>(internal: unknown, props: ReturnType<__sveltets_Render<Metadata>['props']> & {}): ReturnType<__sveltets_Render<Metadata>['exports']>;
|
|
80
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
81
|
+
}
|
|
82
|
+
declare const Treemap: $$IsomorphicComponent;
|
|
83
|
+
type Treemap<Metadata extends Record<string, unknown> = Record<string, unknown>> = InstanceType<typeof Treemap<Metadata>>;
|
|
84
|
+
export default Treemap;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Rect } from '../core/layout';
|
|
2
|
+
import type { PositionedArc, SunburstLayoutOptions, SunburstNode, SunburstNodeHandlerProps } from '../sunburst/sunburst';
|
|
3
|
+
export type TreemapNode<Metadata = Record<string, unknown>> = SunburstNode<Metadata>;
|
|
4
|
+
export type TreemapArc<Metadata = Record<string, unknown>> = PositionedArc<Metadata>;
|
|
5
|
+
export type TreemapNodeHandlerProps<Metadata = Record<string, unknown>> = SunburstNodeHandlerProps<Metadata>;
|
|
6
|
+
export type TreemapLayoutOptions = SunburstLayoutOptions;
|
|
7
|
+
export interface TilePadding {
|
|
8
|
+
padding_inner: number;
|
|
9
|
+
padding_top: number;
|
|
10
|
+
padding_outer: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function tile_rects<Metadata>(arcs: readonly PositionedArc<Metadata>[], root_idx: number, size: {
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
}, pad: TilePadding): Rect[];
|
|
16
|
+
export declare function lerp_rects(prev: readonly Rect[], next: readonly Rect[], t: number): Rect[];
|
|
17
|
+
export interface TreemapLayoutResult<Metadata = Record<string, unknown>> {
|
|
18
|
+
arcs: TreemapArc<Metadata>[];
|
|
19
|
+
rects: Rect[];
|
|
20
|
+
root: TreemapArc<Metadata> | null;
|
|
21
|
+
max_depth: number;
|
|
22
|
+
}
|
|
23
|
+
export declare function compute_treemap_layout<Metadata = Record<string, unknown>>(data: TreemapNode<Metadata> | TreemapNode<Metadata>[], size: {
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
}, opts?: TreemapLayoutOptions & Partial<TilePadding>): TreemapLayoutResult<Metadata>;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// Layout helpers for Treemap charts. All tree semantics (value modes, sorting,
|
|
2
|
+
// 'Other' bucketing, color inheritance, stable ids, pre-order indexing) are
|
|
3
|
+
// delegated to compute_sunburst_layout — a treemap is the same hierarchy with
|
|
4
|
+
// squarified pixel rects instead of polar partition coordinates, so the two
|
|
5
|
+
// charts share data builders (sunburst_from_paths, chem_sys_sunburst_data, …)
|
|
6
|
+
// and value semantics (plotly branchvalues) by construction.
|
|
7
|
+
import { hierarchy, treemap, treemapSquarify } from 'd3-hierarchy';
|
|
8
|
+
import { compute_sunburst_layout } from '../sunburst/sunburst';
|
|
9
|
+
import { DEFAULTS } from '../../settings';
|
|
10
|
+
// Fresh object per call: returned rect arrays hand these to consumers, and a
|
|
11
|
+
// shared constant would let mutating one zero rect corrupt every other one
|
|
12
|
+
const zero_rect = () => ({ x: 0, y: 0, width: 0, height: 0 });
|
|
13
|
+
// Squarify the subtree under arcs[root_idx] into pixel rects filling `size`.
|
|
14
|
+
// Returns an array aligned with `arcs` by node_idx (nodes outside the subtree
|
|
15
|
+
// get zero rects). Separate from tree-semantics so zooming re-tiles the new
|
|
16
|
+
// root's subtree to the full viewport (plotly behavior) — unlike the sunburst's
|
|
17
|
+
// size-independent partition, squarified tiling depends on the target aspect
|
|
18
|
+
// ratio, so projecting one fixed layout through a zoom window would distort
|
|
19
|
+
// cells and scale up the fixed-px header strips.
|
|
20
|
+
export function tile_rects(arcs, root_idx, size, pad) {
|
|
21
|
+
const rects = arcs.map(zero_rect);
|
|
22
|
+
const root_arc = arcs[root_idx];
|
|
23
|
+
if (!root_arc || !(size.width > 0) || !(size.height > 0))
|
|
24
|
+
return rects;
|
|
25
|
+
// Rebuild the (already value-resolved, sorted and bucketed) subtree from the
|
|
26
|
+
// flat pre-order arcs: children of arc N are the top-level subtree ranges in
|
|
27
|
+
// (N, N.subtree_end].
|
|
28
|
+
const children_of = (arc) => {
|
|
29
|
+
const kids = [];
|
|
30
|
+
for (let idx = arc.node_idx + 1; idx <= arc.subtree_end; idx = arcs[idx].subtree_end + 1) {
|
|
31
|
+
kids.push(arcs[idx]);
|
|
32
|
+
}
|
|
33
|
+
return kids;
|
|
34
|
+
};
|
|
35
|
+
const root = hierarchy(root_arc, children_of);
|
|
36
|
+
// Values are assigned manually (the documented d3 way to bypass .sum()) so all
|
|
37
|
+
// three value modes carry over — with 'total', children summing to less than
|
|
38
|
+
// their parent leave unfilled space in the parent cell, matching plotly.
|
|
39
|
+
// Non-finite/negative values would make d3's tiling emit NaN/out-of-bounds
|
|
40
|
+
// rects; coerce them to zero-size instead of corrupting the whole chart.
|
|
41
|
+
root.each((node) => {
|
|
42
|
+
const { value } = node.data;
|
|
43
|
+
node.value = Number.isFinite(value) && value >= 0 ? value : 0;
|
|
44
|
+
});
|
|
45
|
+
const tiled = treemap()
|
|
46
|
+
.tile(treemapSquarify)
|
|
47
|
+
.size([size.width, size.height])
|
|
48
|
+
.paddingInner(pad.padding_inner)
|
|
49
|
+
// inset children within branch cells below the tiling root (the root fills
|
|
50
|
+
// the viewport and is labeled by breadcrumbs, not a frame + header) …
|
|
51
|
+
.paddingOuter((node) => (node.depth > 0 ? pad.padding_outer : 0))
|
|
52
|
+
// … with the top inset enlarged into the label header strip. paddingTop is
|
|
53
|
+
// applied after paddingOuter, overriding its top component.
|
|
54
|
+
.paddingTop((node) => node.depth > 0 && node.children ? Math.max(pad.padding_top, pad.padding_outer) : 0)(root);
|
|
55
|
+
// Clamp to the tiling area: with value_mode 'total', children exceeding their
|
|
56
|
+
// parent's value overflow the parent rect (d3 scales children by parent value;
|
|
57
|
+
// compute_sunburst_layout warns). Clamping keeps overflow inside the chart,
|
|
58
|
+
// mirroring the sunburst's clamp01 window projection.
|
|
59
|
+
const clamp_x = (val) => Math.min(Math.max(val, 0), size.width);
|
|
60
|
+
const clamp_y = (val) => Math.min(Math.max(val, 0), size.height);
|
|
61
|
+
tiled.each((node) => {
|
|
62
|
+
const x = clamp_x(node.x0);
|
|
63
|
+
const y = clamp_y(node.y0);
|
|
64
|
+
rects[node.data.node_idx] = {
|
|
65
|
+
x,
|
|
66
|
+
y,
|
|
67
|
+
width: Math.max(0, clamp_x(node.x1) - x),
|
|
68
|
+
height: Math.max(0, clamp_y(node.y1) - y),
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
return rects;
|
|
72
|
+
}
|
|
73
|
+
// Interpolate between two tilings (zoom animation). Rects are aligned by
|
|
74
|
+
// node_idx; frames allocate one array but reuse rect objects at t = 0/1.
|
|
75
|
+
export function lerp_rects(prev, next, t) {
|
|
76
|
+
if (t >= 1 || prev.length !== next.length)
|
|
77
|
+
return next;
|
|
78
|
+
if (t <= 0)
|
|
79
|
+
return prev;
|
|
80
|
+
return next.map((to, idx) => {
|
|
81
|
+
const from = prev[idx];
|
|
82
|
+
return {
|
|
83
|
+
x: from.x + (to.x - from.x) * t,
|
|
84
|
+
y: from.y + (to.y - from.y) * t,
|
|
85
|
+
width: from.width + (to.width - from.width) * t,
|
|
86
|
+
height: from.height + (to.height - from.height) * t,
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
// One-shot semantic layout + root tiling (tests and non-zooming callers; the
|
|
91
|
+
// component calls compute_sunburst_layout and tile_rects separately so zoom
|
|
92
|
+
// re-tiles without recomputing tree semantics).
|
|
93
|
+
export function compute_treemap_layout(data, size, opts = {}) {
|
|
94
|
+
// padding fallbacks derive from DEFAULTS.treemap to prevent drift with the component
|
|
95
|
+
const { padding_inner = DEFAULTS.treemap.padding_inner, padding_top = DEFAULTS.treemap.padding_top, padding_outer = DEFAULTS.treemap.padding_outer, ...tree_opts } = opts;
|
|
96
|
+
const { arcs, root, max_depth } = compute_sunburst_layout(data, tree_opts);
|
|
97
|
+
const rects = tile_rects(arcs, 0, size, { padding_inner, padding_top, padding_outer });
|
|
98
|
+
return { arcs, rects, root, max_depth };
|
|
99
|
+
}
|
package/dist/rdf/RdfPlot.svelte
CHANGED
|
@@ -56,9 +56,7 @@
|
|
|
56
56
|
|
|
57
57
|
const compute_and_add = (content: string | ArrayBuffer, filename: string) => {
|
|
58
58
|
try {
|
|
59
|
-
const text = content instanceof ArrayBuffer
|
|
60
|
-
? new TextDecoder().decode(content)
|
|
61
|
-
: content
|
|
59
|
+
const text = content instanceof ArrayBuffer ? new TextDecoder().decode(content) : content
|
|
62
60
|
const parsed_struct = parse_any_structure(text, filename)
|
|
63
61
|
if (is_crystal(parsed_struct)) {
|
|
64
62
|
drag_dropped = [...drag_dropped, parsed_struct]
|
|
@@ -66,16 +64,13 @@
|
|
|
66
64
|
error_msg = `Crystal has no lattice or sites; cannot compute RDF`
|
|
67
65
|
}
|
|
68
66
|
} catch (exc) {
|
|
69
|
-
error_msg = `Failed to process structure: ${
|
|
70
|
-
to_error(exc).message
|
|
71
|
-
}`
|
|
67
|
+
error_msg = `Failed to process structure: ${to_error(exc).message}`
|
|
72
68
|
}
|
|
73
69
|
}
|
|
74
70
|
|
|
75
71
|
const handle_drop = create_file_drop_handler({
|
|
76
72
|
allow: () => enable_drop,
|
|
77
|
-
on_drop: (content, filename) =>
|
|
78
|
-
(on_file_drop || compute_and_add)(content, filename),
|
|
73
|
+
on_drop: (content, filename) => (on_file_drop || compute_and_add)(content, filename),
|
|
79
74
|
on_error: (msg) => {
|
|
80
75
|
error_msg = msg
|
|
81
76
|
},
|
|
@@ -85,9 +80,9 @@
|
|
|
85
80
|
},
|
|
86
81
|
})
|
|
87
82
|
|
|
88
|
-
function handle_dragover(
|
|
89
|
-
|
|
90
|
-
if (
|
|
83
|
+
function handle_dragover(event: DragEvent) {
|
|
84
|
+
event.preventDefault()
|
|
85
|
+
if (event.dataTransfer) event.dataTransfer.dropEffect = `copy`
|
|
91
86
|
dragging = true
|
|
92
87
|
}
|
|
93
88
|
|
|
@@ -108,7 +103,7 @@
|
|
|
108
103
|
struct_list.push({
|
|
109
104
|
struct,
|
|
110
105
|
label: format_structure_label(struct, `Crystal ${idx + 1}`),
|
|
111
|
-
})
|
|
106
|
+
}),
|
|
112
107
|
)
|
|
113
108
|
} else if (is_crystal(structures)) {
|
|
114
109
|
struct_list.push({
|
|
@@ -117,7 +112,7 @@
|
|
|
117
112
|
})
|
|
118
113
|
} else {
|
|
119
114
|
Object.entries(structures).forEach(([label, struct]) =>
|
|
120
|
-
struct_list.push({ struct, label: format_structure_label(struct, label) })
|
|
115
|
+
struct_list.push({ struct, label: format_structure_label(struct, label) }),
|
|
121
116
|
)
|
|
122
117
|
}
|
|
123
118
|
}
|
|
@@ -125,17 +120,21 @@
|
|
|
125
120
|
struct_list.push({
|
|
126
121
|
struct,
|
|
127
122
|
label: format_structure_label(struct, `Dropped ${idx + 1}`),
|
|
128
|
-
})
|
|
123
|
+
}),
|
|
129
124
|
)
|
|
130
125
|
|
|
131
126
|
for (const { struct, label } of struct_list) {
|
|
132
127
|
if (mode === `element_pairs`) {
|
|
133
128
|
const pairs = calculate_all_pair_rdfs(struct, { cutoff, n_bins, pbc })
|
|
134
|
-
result.push(
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
129
|
+
result.push(
|
|
130
|
+
...pairs.map((pair) => ({
|
|
131
|
+
label: pair.element_pair
|
|
132
|
+
? `${pair.element_pair[0]}-${pair.element_pair[1]}`
|
|
133
|
+
: label,
|
|
134
|
+
legend_group: label, // Group by structure name for multi-structure plots
|
|
135
|
+
pattern: pair,
|
|
136
|
+
})),
|
|
137
|
+
)
|
|
139
138
|
} else {
|
|
140
139
|
const pattern = calculate_rdf(struct, { cutoff, n_bins, pbc })
|
|
141
140
|
result.push({ label, pattern })
|
|
@@ -146,7 +145,6 @@
|
|
|
146
145
|
|
|
147
146
|
const max_r = $derived(Math.max(...entries.flatMap((entry) => entry.pattern.r), 0))
|
|
148
147
|
const max_g = $derived(Math.max(1.2, ...entries.flatMap((entry) => entry.pattern.g_r)))
|
|
149
|
-
|
|
150
148
|
const series = $derived<DataSeries[]>(
|
|
151
149
|
entries.map((ent, idx) => ({
|
|
152
150
|
x: ent.pattern.r,
|
|
@@ -182,8 +180,8 @@
|
|
|
182
180
|
>
|
|
183
181
|
<StatusMessage
|
|
184
182
|
message={enable_drop
|
|
185
|
-
|
|
186
|
-
|
|
183
|
+
? `Drag and drop structure files here to visualize RDFs`
|
|
184
|
+
: `No RDF data to display`}
|
|
187
185
|
style="border: none"
|
|
188
186
|
/>
|
|
189
187
|
</div>
|
|
@@ -194,7 +192,7 @@
|
|
|
194
192
|
x_axis={{ label: `r (Å)`, range: [0, max_r], ...x_axis }}
|
|
195
193
|
y_axis={{ label: `g(r)`, range: [0, max_g * 1.05], ...y_axis }}
|
|
196
194
|
styles={{ show_lines: true, show_points: false }}
|
|
197
|
-
class=
|
|
195
|
+
class={[rest.class, dragging && `dragging`]}
|
|
198
196
|
style={rest.style ?? `height: 400px;`}
|
|
199
197
|
ondragover={enable_drop ? handle_dragover : undefined}
|
|
200
198
|
ondragleave={enable_drop ? () => (dragging = false) : undefined}
|
|
@@ -207,9 +205,7 @@
|
|
|
207
205
|
{@const [x1, x2] = [pad.l, width - pad.r]}
|
|
208
206
|
{@const [x, y] = [width - pad.r - 5, y1 - 5]}
|
|
209
207
|
<line {x1} {x2} {y1} y2={y1} stroke="gray" stroke-dasharray="4" opacity="0.5" />
|
|
210
|
-
<text {x} {y} text-anchor="end" fill="gray" font-size="0.8em">
|
|
211
|
-
g(r) = 1
|
|
212
|
-
</text>
|
|
208
|
+
<text {x} {y} text-anchor="end" fill="gray" font-size="0.8em"> g(r) = 1 </text>
|
|
213
209
|
{/if}
|
|
214
210
|
{/if}
|
|
215
211
|
{/snippet}
|
|
@@ -22,6 +22,6 @@ type $$ComponentProps = {
|
|
|
22
22
|
drag_dropped?: Crystal[];
|
|
23
23
|
dragging?: boolean;
|
|
24
24
|
} & ComponentProps<typeof ScatterPlot>;
|
|
25
|
-
declare const RdfPlot: import("svelte").Component<$$ComponentProps, {}, "
|
|
25
|
+
declare const RdfPlot: import("svelte").Component<$$ComponentProps, {}, "dragging" | "loading" | "error_msg" | "drag_dropped">;
|
|
26
26
|
type RdfPlot = ReturnType<typeof RdfPlot>;
|
|
27
27
|
export default RdfPlot;
|
package/dist/rdf/calc-rdf.js
CHANGED
|
@@ -42,12 +42,11 @@ export function calculate_rdf(structure, options = {}) {
|
|
|
42
42
|
// Get occupancy weight for a site-species pair (supports mixed occupancy)
|
|
43
43
|
const centers = center_sites.filter((site) => has_species(site, center_species));
|
|
44
44
|
const neighbors = sites.filter((site) => has_species(site, neighbor_species));
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
const element_pair = center_species && neighbor_species
|
|
46
|
+
? [center_species, neighbor_species]
|
|
47
|
+
: undefined;
|
|
48
|
+
if (centers.length === 0 || neighbors.length === 0)
|
|
49
49
|
return { r, g_r, element_pair };
|
|
50
|
-
}
|
|
51
50
|
// Calculate distances and bin them with occupancy weighting
|
|
52
51
|
const use_pbc = pbc.some(Boolean);
|
|
53
52
|
const converters = use_pbc ? create_lattice_converters(lattice) : undefined;
|
|
@@ -78,9 +77,6 @@ export function calculate_rdf(structure, options = {}) {
|
|
|
78
77
|
g_r[idx] /= n_pairs * ((4 * Math.PI * r[idx] ** 2 * bin_size) / volume);
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
|
-
const element_pair = center_species && neighbor_species
|
|
82
|
-
? [center_species, neighbor_species]
|
|
83
|
-
: undefined;
|
|
84
80
|
return { r, g_r, element_pair };
|
|
85
81
|
}
|
|
86
82
|
// Calculate RDF for all element pairs
|
package/dist/sanitize.js
CHANGED
|
@@ -3,7 +3,7 @@ import { format_formula_html } from './phase-diagram/utils';
|
|
|
3
3
|
const SAFE_TAGS = [`a`, `b`, `i`, `em`, `strong`, `sub`, `sup`, `br`, `span`, `code`, `small`];
|
|
4
4
|
const SAFE_ATTRS = [`style`, `class`, `title`, `href`, `target`, `rel`];
|
|
5
5
|
// only allow safe CSS properties for text formatting
|
|
6
|
-
const SAFE_STYLE_RE = /^\s*(color|font-weight|font-style|font-size|text-decoration|vertical-align)\s*:/;
|
|
6
|
+
const SAFE_STYLE_RE = /^\s*(?:color|font-weight|font-style|font-size|text-decoration|vertical-align)\s*:/;
|
|
7
7
|
// Add a token to a space-separated string if not already present
|
|
8
8
|
const ensure_token = (value, token) => {
|
|
9
9
|
const tokens = new Set(value.split(/\s+/).filter(Boolean));
|
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
import { renderer_registry } from '../io/export';
|
|
1
|
+
import { renderer_registry, scene_registry } from '../io/export';
|
|
2
2
|
import { useThrelte } from '@threlte/core';
|
|
3
|
-
// Mirror the Threlte scene + active camera into bindable props (for export panes etc.) and register the canvas->renderer
|
|
3
|
+
// Mirror the Threlte scene + active camera into bindable props (for export panes etc.) and register the canvas->renderer/scene mappings so PNG-export and element-capture helpers can find them. Creates an $effect (call during component init). Returns the Threlte context for further use (e.g. clipping planes).
|
|
4
4
|
export function bind_renderer(on_bind, on_renderer) {
|
|
5
5
|
const threlte = useThrelte();
|
|
6
6
|
$effect(() => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
const renderer = threlte.renderer;
|
|
8
|
+
// `camera.current` is not reactive, so subscribe to be notified when the active camera changes
|
|
9
|
+
const unsubscribe = threlte.camera.subscribe((camera) => {
|
|
10
|
+
on_bind(threlte.scene, camera);
|
|
11
|
+
if (renderer) {
|
|
12
|
+
scene_registry.set(renderer.domElement, { scene: threlte.scene, camera });
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
if (renderer) {
|
|
16
|
+
on_renderer?.(renderer);
|
|
17
|
+
renderer_registry.set(renderer.domElement, renderer);
|
|
11
18
|
}
|
|
19
|
+
return unsubscribe;
|
|
12
20
|
});
|
|
13
21
|
return threlte;
|
|
14
22
|
}
|
package/dist/settings.d.ts
CHANGED
|
@@ -111,6 +111,15 @@ type ConvexHullWith3DType = ConvexHullCommonType & {
|
|
|
111
111
|
hull_face_opacity: SettingType<number>;
|
|
112
112
|
hull_face_color_mode: SettingType<HullFaceColorMode>;
|
|
113
113
|
};
|
|
114
|
+
type HierarchyChartSettingsSchema = {
|
|
115
|
+
value_mode: SettingType<SunburstValueMode>;
|
|
116
|
+
max_depth: SettingType<number>;
|
|
117
|
+
min_fraction: SettingType<number>;
|
|
118
|
+
show_labels: SettingType<boolean>;
|
|
119
|
+
label_text: SettingType<SunburstLabelText>;
|
|
120
|
+
zoom_on_click: SettingType<boolean>;
|
|
121
|
+
show_breadcrumbs: SettingType<boolean>;
|
|
122
|
+
};
|
|
114
123
|
export interface SettingsConfig {
|
|
115
124
|
color_scheme: SettingType<string>;
|
|
116
125
|
background_color: SettingType<string>;
|
|
@@ -289,18 +298,16 @@ export interface SettingsConfig {
|
|
|
289
298
|
show_node_labels: SettingType<boolean>;
|
|
290
299
|
iterations: SettingType<number>;
|
|
291
300
|
};
|
|
292
|
-
sunburst: {
|
|
301
|
+
sunburst: HierarchyChartSettingsSchema & {
|
|
293
302
|
shape: SettingType<SunburstShape>;
|
|
294
|
-
value_mode: SettingType<SunburstValueMode>;
|
|
295
|
-
max_depth: SettingType<number>;
|
|
296
303
|
inner_radius: SettingType<number>;
|
|
297
304
|
pad_angle: SettingType<number>;
|
|
298
|
-
min_fraction: SettingType<number>;
|
|
299
|
-
show_labels: SettingType<boolean>;
|
|
300
305
|
label_rotation: SettingType<SunburstLabelRotation>;
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
306
|
+
};
|
|
307
|
+
treemap: HierarchyChartSettingsSchema & {
|
|
308
|
+
padding_inner: SettingType<number>;
|
|
309
|
+
padding_top: SettingType<number>;
|
|
310
|
+
padding_outer: SettingType<number>;
|
|
304
311
|
};
|
|
305
312
|
composition: {
|
|
306
313
|
display_mode: SettingType<`pie` | `bubble` | `bar`>;
|
|
@@ -327,5 +334,8 @@ export type DefaultSettings = {
|
|
|
327
334
|
} : never;
|
|
328
335
|
};
|
|
329
336
|
export declare const DEFAULTS: DefaultSettings;
|
|
330
|
-
export
|
|
337
|
+
export type PartialSettings = {
|
|
338
|
+
[Key in keyof DefaultSettings]?: DefaultSettings[Key] extends Record<string, unknown> ? Partial<DefaultSettings[Key]> : DefaultSettings[Key];
|
|
339
|
+
};
|
|
340
|
+
export declare const merge: (user?: PartialSettings) => DefaultSettings;
|
|
331
341
|
export {};
|