matterviz 0.4.1 → 0.4.3
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 +48 -60
- package/dist/Icon.svelte +7 -4
- package/dist/MillerIndexInput.svelte +2 -2
- package/dist/api/optimade.js +10 -7
- package/dist/app.css +68 -0
- package/dist/brillouin/BrillouinZone.svelte +90 -91
- 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 +46 -68
- package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +1 -1
- package/dist/brillouin/compute.js +10 -16
- package/dist/brillouin/geometry.js +2 -2
- package/dist/chempot-diagram/ChemPotDiagram.svelte +48 -50
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +61 -169
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +1 -1
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +559 -755
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +1 -1
- package/dist/chempot-diagram/async-compute.svelte.js +13 -14
- package/dist/chempot-diagram/color.d.ts +21 -1
- package/dist/chempot-diagram/color.js +70 -1
- package/dist/chempot-diagram/compute.d.ts +7 -0
- package/dist/chempot-diagram/compute.js +85 -26
- package/dist/chempot-diagram/controls-state.svelte.js +1 -1
- package/dist/chempot-diagram/export.js +1 -6
- package/dist/chempot-diagram/temperature.js +9 -10
- package/dist/colors/index.d.ts +0 -4
- package/dist/colors/index.js +19 -20
- package/dist/composition/BarChart.svelte +30 -26
- package/dist/composition/BubbleChart.svelte +17 -17
- package/dist/composition/Composition.svelte +10 -19
- package/dist/composition/Formula.svelte +20 -27
- package/dist/composition/FormulaFilter.svelte +115 -184
- package/dist/composition/PieChart.svelte +55 -41
- package/dist/composition/format.js +7 -9
- 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 +61 -115
- package/dist/constants.d.ts +0 -1
- package/dist/constants.js +17 -26
- 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 -94
- package/dist/convex-hull/ConvexHull2D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull3D.svelte +127 -186
- package/dist/convex-hull/ConvexHull3D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull4D.svelte +131 -180
- 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 +18 -22
- 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/gas-thermodynamics.js +21 -53
- package/dist/convex-hull/helpers.d.ts +8 -10
- package/dist/convex-hull/helpers.js +37 -43
- package/dist/convex-hull/hull-state.svelte.d.ts +1 -1
- package/dist/convex-hull/thermodynamics.js +37 -44
- package/dist/coordination/CoordinationBarPlot.svelte +49 -53
- 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 -9
- 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 +44 -67
- package/dist/element/Nucleus.svelte +4 -2
- package/dist/element/data.d.ts +3 -2
- package/dist/element/data.js +5 -1
- package/dist/element/helpers.d.ts +4 -0
- package/dist/element/helpers.js +18 -0
- package/dist/element/index.d.ts +2 -5
- package/dist/element/index.js +4 -19
- 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 +35 -44
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +7 -13
- package/dist/fermi-surface/FermiSurfaceControls.svelte +6 -20
- package/dist/fermi-surface/FermiSurfaceControls.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceScene.svelte +64 -136
- package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceTooltip.svelte +9 -6
- package/dist/fermi-surface/compute.js +25 -58
- package/dist/fermi-surface/parse.js +54 -88
- package/dist/file-viewer/JsonBrowser.svelte +1043 -0
- package/dist/file-viewer/JsonBrowser.svelte.d.ts +9 -0
- package/dist/file-viewer/PlotPanel.svelte +350 -0
- package/dist/file-viewer/PlotPanel.svelte.d.ts +9 -0
- package/dist/file-viewer/TrajectoryWithDos.svelte +30 -0
- package/dist/file-viewer/TrajectoryWithDos.svelte.d.ts +10 -0
- package/dist/file-viewer/detect.d.ts +11 -0
- package/dist/file-viewer/detect.js +381 -0
- package/dist/file-viewer/eligibility.d.ts +4 -0
- package/dist/file-viewer/eligibility.js +53 -0
- package/dist/file-viewer/host-protocol.d.ts +50 -0
- package/dist/file-viewer/host-transfer.d.ts +25 -0
- package/dist/file-viewer/host-transfer.js +42 -0
- package/dist/file-viewer/index.d.ts +5 -0
- package/dist/file-viewer/index.js +5 -0
- package/dist/file-viewer/main.d.ts +44 -0
- package/dist/file-viewer/main.js +535 -0
- package/dist/file-viewer/parse.d.ts +9 -0
- package/dist/file-viewer/parse.js +170 -0
- package/dist/file-viewer/plot-utils.d.ts +24 -0
- package/dist/file-viewer/plot-utils.js +191 -0
- package/dist/file-viewer/types.d.ts +4 -0
- package/dist/file-viewer/types.js +5 -0
- package/dist/heatmap-matrix/HeatmapMatrix.svelte +153 -219
- 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/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/io/ExportPane.svelte +11 -7
- package/dist/io/decompress.d.ts +4 -1
- package/dist/io/decompress.js +24 -36
- package/dist/io/export.d.ts +11 -4
- package/dist/io/export.js +75 -19
- package/dist/io/fetch.d.ts +0 -3
- package/dist/io/fetch.js +0 -11
- package/dist/io/file-drop.js +60 -35
- 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.d.ts +2 -0
- package/dist/io/url-drop.js +40 -40
- package/dist/isosurface/Isosurface.svelte +700 -215
- package/dist/isosurface/Isosurface.svelte.d.ts +7 -1
- package/dist/isosurface/IsosurfaceControls.svelte +590 -116
- package/dist/isosurface/IsosurfaceControls.svelte.d.ts +1 -1
- package/dist/isosurface/VolumeSlice.svelte +224 -0
- package/dist/isosurface/VolumeSlice.svelte.d.ts +28 -0
- package/dist/isosurface/coloring.d.ts +20 -0
- package/dist/isosurface/coloring.js +118 -0
- package/dist/isosurface/geometry-worker-types.d.ts +38 -0
- package/dist/isosurface/geometry.worker.d.ts +1 -0
- package/dist/isosurface/geometry.worker.js +59 -0
- package/dist/isosurface/grid.d.ts +10 -0
- package/dist/isosurface/grid.js +31 -0
- package/dist/isosurface/index.d.ts +4 -0
- package/dist/isosurface/index.js +4 -0
- 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/isosurface/profile.d.ts +12 -0
- package/dist/isosurface/profile.js +19 -0
- package/dist/isosurface/sampling.d.ts +34 -0
- package/dist/isosurface/sampling.js +408 -0
- package/dist/isosurface/slice-rendering.d.ts +13 -0
- package/dist/isosurface/slice-rendering.js +79 -0
- package/dist/isosurface/slice.d.ts +22 -2
- package/dist/isosurface/slice.js +200 -116
- package/dist/isosurface/types.d.ts +24 -1
- package/dist/isosurface/types.js +120 -8
- package/dist/json-path.d.ts +4 -0
- package/dist/json-path.js +89 -0
- package/dist/labels.d.ts +6 -2
- package/dist/labels.js +44 -14
- package/dist/layout/FullscreenButton.svelte +2 -1
- package/dist/layout/FullscreenToggle.svelte +10 -4
- package/dist/layout/InfoCard.svelte +8 -21
- 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 +57 -62
- package/dist/layout/SettingsSection.svelte.d.ts +6 -7
- package/dist/layout/SubpageGrid.svelte +3 -1
- package/dist/layout/ViewerChrome.svelte +16 -11
- 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 +22 -59
- package/dist/layout/json-tree/JsonTree.svelte +101 -172
- package/dist/layout/json-tree/JsonValue.svelte +9 -32
- package/dist/layout/json-tree/utils.d.ts +0 -3
- package/dist/layout/json-tree/utils.js +50 -188
- package/dist/marching-cubes.d.ts +8 -1
- package/dist/marching-cubes.js +115 -48
- package/dist/math.d.ts +5 -2
- package/dist/math.js +48 -38
- package/dist/overlays/ContextMenu.svelte +19 -34
- package/dist/overlays/CopyButton.svelte +11 -5
- package/dist/overlays/DragControlTab.svelte +6 -1
- package/dist/overlays/DraggablePane.svelte +110 -74
- package/dist/overlays/DraggablePane.svelte.d.ts +2 -1
- package/dist/overlays/GlassChip.svelte +32 -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 +37 -115
- package/dist/periodic-table/TableInset.svelte +9 -4
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +68 -105
- 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 +4 -9
- 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 +28 -27
- package/dist/phase-diagram/utils.js +2 -3
- package/dist/plot/bar/BarPlot.svelte +461 -426
- 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 +46 -77
- package/dist/plot/bar/data.d.ts +5 -4
- package/dist/plot/bar/data.js +2 -1
- package/dist/plot/box/BoxPlot.svelte +322 -226
- 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.d.ts +1 -1
- package/dist/plot/core/auto-place.js +2 -2
- package/dist/plot/core/axis-utils.d.ts +12 -7
- package/dist/plot/core/axis-utils.js +48 -48
- package/dist/plot/core/components/AxisLabel.svelte +82 -20
- package/dist/plot/core/components/AxisLabel.svelte.d.ts +1 -0
- package/dist/plot/core/components/ColorBar.svelte +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.d.ts +1 -2
- package/dist/plot/core/data-transform.js +9 -15
- 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 +15 -6
- package/dist/plot/core/layout.js +57 -38
- package/dist/plot/core/marginals.d.ts +170 -0
- package/dist/plot/core/marginals.js +436 -0
- package/dist/plot/core/pan-zoom.svelte.d.ts +2 -4
- package/dist/plot/core/pan-zoom.svelte.js +34 -17
- package/dist/plot/core/placed-tween.svelte.d.ts +3 -0
- package/dist/plot/core/placed-tween.svelte.js +68 -21
- 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/svg.js +0 -1
- package/dist/plot/core/types/fills.d.ts +101 -0
- package/dist/plot/core/types/fills.js +15 -0
- package/dist/plot/core/types/plot-3d.d.ts +87 -0
- package/dist/plot/core/types/plot-3d.js +4 -0
- package/dist/plot/core/types/reference-lines.d.ts +140 -0
- package/dist/plot/core/types/reference-lines.js +9 -0
- package/dist/plot/core/types.d.ts +29 -324
- package/dist/plot/core/types.js +23 -20
- package/dist/plot/core/utils/hierarchy-chart.d.ts +52 -0
- package/dist/plot/core/utils/hierarchy-chart.js +191 -0
- package/dist/plot/core/utils/hierarchy-labels.d.ts +20 -0
- package/dist/plot/core/utils/hierarchy-labels.js +100 -0
- package/dist/plot/core/utils/label-placement.js +2 -2
- package/dist/plot/histogram/Histogram.svelte +314 -340
- 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/sankey/sankey.js +13 -9
- package/dist/plot/scatter/BinnedScatterPlot.svelte +311 -141
- package/dist/plot/scatter/BinnedScatterPlot.svelte.d.ts +7 -0
- package/dist/plot/scatter/ElementScatter.svelte +4 -1
- package/dist/plot/scatter/ScatterPlot.svelte +517 -410
- 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/adaptive-density.d.ts +1 -1
- package/dist/plot/scatter/adaptive-density.js +36 -20
- 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 +269 -347
- 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 +1022 -0
- package/dist/plot/treemap/Treemap.svelte.d.ts +90 -0
- package/dist/plot/treemap/index.d.ts +4 -0
- package/dist/plot/treemap/index.js +4 -0
- package/dist/plot/treemap/labels.d.ts +38 -0
- package/dist/plot/treemap/labels.js +80 -0
- package/dist/plot/treemap/treemap.d.ts +28 -0
- package/dist/plot/treemap/treemap.js +102 -0
- package/dist/rdf/RdfPlot.svelte +37 -59
- package/dist/rdf/RdfPlot.svelte.d.ts +1 -1
- package/dist/rdf/calc-rdf.js +63 -52
- package/dist/rdf/index.d.ts +0 -1
- package/dist/sanitize.js +85 -27
- package/dist/scene/SceneCamera.svelte +1 -1
- package/dist/scene/SceneCamera.svelte.d.ts +1 -1
- package/dist/scene/bind-renderer.svelte.js +14 -6
- package/dist/scene/index.d.ts +1 -2
- package/dist/scene/index.js +1 -1
- package/dist/scene/{props.js → props.svelte.js} +15 -1
- package/dist/settings.d.ts +19 -9
- package/dist/settings.js +229 -525
- package/dist/spectral/Bands.svelte +207 -221
- package/dist/spectral/BandsAndDos.svelte +11 -9
- package/dist/spectral/BrillouinBandsDos.svelte +19 -42
- package/dist/spectral/Dos.svelte +92 -93
- package/dist/spectral/helpers.d.ts +3 -3
- package/dist/spectral/helpers.js +65 -140
- 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 +120 -85
- package/dist/structure/AtomLegend.svelte.d.ts +2 -3
- package/dist/structure/Bond.svelte +31 -23
- package/dist/structure/CanvasTooltip.svelte +15 -3
- package/dist/structure/CellSelect.svelte +45 -35
- 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 +636 -504
- package/dist/structure/Structure.svelte.d.ts +4 -2
- package/dist/structure/StructureCarousel.svelte +637 -0
- package/dist/structure/StructureCarousel.svelte.d.ts +19 -0
- package/dist/structure/StructureControls.svelte +165 -425
- package/dist/structure/StructureControls.svelte.d.ts +1 -1
- package/dist/structure/StructureExportPane.svelte +17 -21
- package/dist/structure/StructureInfoPane.svelte +128 -133
- package/dist/structure/StructureInfoPane.svelte.d.ts +1 -1
- package/dist/structure/StructureScene.svelte +535 -578
- package/dist/structure/StructureScene.svelte.d.ts +6 -2
- package/dist/structure/StructureViewport.svelte +451 -0
- package/dist/structure/StructureViewport.svelte.d.ts +65 -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 +105 -38
- package/dist/structure/bond-order-perception.js +3 -8
- package/dist/structure/bonding.d.ts +9 -3
- package/dist/structure/bonding.js +95 -46
- 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 +89 -105
- package/dist/structure/format-detect.d.ts +1 -0
- package/dist/structure/format-detect.js +20 -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 +15 -10
- 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 +272 -313
- package/dist/structure/partial-occupancy.js +10 -5
- package/dist/structure/pbc.js +85 -107
- package/dist/structure/polyhedra.d.ts +0 -1
- package/dist/structure/polyhedra.js +7 -21
- package/dist/structure/prop-groups.d.ts +85 -0
- package/dist/structure/prop-groups.js +18 -0
- 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 +55 -71
- package/dist/symmetry/WyckoffTable.svelte +10 -28
- package/dist/symmetry/cell-transform.js +6 -14
- package/dist/symmetry/index.d.ts +1 -0
- package/dist/symmetry/index.js +13 -10
- package/dist/symmetry/spacegroups.js +3 -2
- package/dist/table/HeatmapTable.svelte +1142 -447
- package/dist/table/HeatmapTable.svelte.d.ts +12 -2
- package/dist/table/ToggleMenu.svelte +168 -53
- package/dist/table/ToggleMenu.svelte.d.ts +1 -1
- 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/embedded.d.ts +18 -0
- package/dist/theme/embedded.js +206 -0
- package/dist/theme/index.d.ts +5 -5
- package/dist/theme/index.js +5 -12
- package/dist/theme/themes.mjs +44 -66
- package/dist/tooltip/KCoords.svelte +4 -1
- package/dist/tooltip/TooltipContent.svelte +3 -6
- package/dist/tooltip/TooltipContent.svelte.d.ts +1 -1
- package/dist/tooltip/index.d.ts +8 -1
- package/dist/trajectory/Trajectory.svelte +613 -386
- package/dist/trajectory/Trajectory.svelte.d.ts +1 -1
- package/dist/trajectory/TrajectoryError.svelte +12 -74
- package/dist/trajectory/TrajectoryExportPane.svelte +14 -32
- package/dist/trajectory/TrajectoryInfoPane.svelte +127 -164
- package/dist/trajectory/TrajectoryInfoPane.svelte.d.ts +2 -1
- package/dist/trajectory/extract.js +61 -49
- package/dist/trajectory/format-detect.d.ts +2 -0
- package/dist/trajectory/format-detect.js +17 -13
- package/dist/trajectory/frame-reader.d.ts +2 -0
- package/dist/trajectory/frame-reader.js +35 -32
- package/dist/trajectory/helpers.d.ts +2 -0
- package/dist/trajectory/helpers.js +34 -56
- package/dist/trajectory/index.d.ts +1 -0
- package/dist/trajectory/index.js +5 -8
- package/dist/trajectory/parse/ase.js +1 -1
- 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 +6 -6
- package/dist/trajectory/parse/index.js +25 -33
- 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 +4 -0
- package/dist/trajectory/parse/vaspout-h5.js +281 -0
- package/dist/trajectory/parse/xyz.js +59 -9
- package/dist/trajectory/plotting.d.ts +8 -9
- package/dist/trajectory/plotting.js +113 -64
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +7 -0
- package/dist/xrd/XrdPlot.svelte +79 -118
- package/dist/xrd/broadening.js +2 -1
- package/dist/xrd/calc-xrd.js +24 -62
- package/dist/xrd/parse.d.ts +0 -1
- package/dist/xrd/parse.js +69 -95
- package/package.json +94 -34
- package/readme.md +6 -5
- package/dist/api/mp.d.ts +0 -6
- package/dist/api/mp.js +0 -22
- package/dist/plot/sunburst/SunburstControls.svelte +0 -200
- package/dist/scene/types.d.ts +0 -26
- package/dist/tooltip/types.d.ts +0 -8
- package/dist/trajectory/constants.d.ts +0 -6
- package/dist/trajectory/constants.js +0 -11
- /package/dist/{scene/types.js → file-viewer/host-protocol.js} +0 -0
- /package/dist/{tooltip/types.js → isosurface/geometry-worker-types.js} +0 -0
package/dist/xrd/parse.js
CHANGED
|
@@ -2,17 +2,13 @@
|
|
|
2
2
|
const MAX_POINTS = 1000;
|
|
3
3
|
// Default step size in degrees for XRD scans when not specified in file
|
|
4
4
|
const DEFAULT_STEP_SIZE = 0.02;
|
|
5
|
-
//
|
|
6
|
-
// Used by formats that store metadata + intensity-only data.
|
|
7
|
-
const generate_x_from_scan = (start, step, count) => Array.from({ length: count }, (_, idx) => start + idx * step);
|
|
8
|
-
// Create normalized XrdPattern from scan metadata and intensities.
|
|
5
|
+
// Create normalized XrdPattern from scan metadata (start angle, step size) and intensities.
|
|
9
6
|
// Returns null if no intensity data. Used by all parsers as final step.
|
|
10
7
|
function create_pattern(start, step, intensities) {
|
|
11
8
|
if (intensities.length === 0)
|
|
12
9
|
return null;
|
|
13
|
-
const x_values =
|
|
14
|
-
|
|
15
|
-
return { x: normalized.x, y: normalized.y };
|
|
10
|
+
const x_values = intensities.map((_, idx) => start + idx * step);
|
|
11
|
+
return normalize_and_subsample(x_values, intensities);
|
|
16
12
|
}
|
|
17
13
|
// Parse whitespace-separated numbers from text. Used by multiple formats.
|
|
18
14
|
const parse_number_list = (text) => text
|
|
@@ -20,13 +16,24 @@ const parse_number_list = (text) => text
|
|
|
20
16
|
.split(/\s+/)
|
|
21
17
|
.map(parseFloat)
|
|
22
18
|
.filter((val) => !isNaN(val));
|
|
19
|
+
// Return the first parseable number from the text content of any of `tags`
|
|
20
|
+
// (in order) that also passes the optional `ok` predicate. Null when none match.
|
|
21
|
+
const query_first_number = (doc, tags, ok = () => true) => {
|
|
22
|
+
for (const tag of tags) {
|
|
23
|
+
const text = doc.querySelector(tag)?.textContent?.trim();
|
|
24
|
+
const val = text ? Number(text) : NaN;
|
|
25
|
+
if (!isNaN(val) && ok(val))
|
|
26
|
+
return val;
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
};
|
|
23
30
|
// Extract numeric value from header line matching "KEY=VALUE" or "KEY VALUE" pattern.
|
|
24
31
|
// Returns null if not found or not a valid number.
|
|
25
32
|
function extract_header_value(lines, key_pattern) {
|
|
26
33
|
for (const line of lines) {
|
|
27
34
|
const match = line.match(key_pattern);
|
|
28
35
|
if (match?.[1]) {
|
|
29
|
-
const val =
|
|
36
|
+
const val = Number(match[1]);
|
|
30
37
|
if (!isNaN(val))
|
|
31
38
|
return val;
|
|
32
39
|
}
|
|
@@ -53,17 +60,17 @@ function normalize_and_subsample(x_values, y_values) {
|
|
|
53
60
|
}
|
|
54
61
|
// Subsample data while preserving peaks (local maxima).
|
|
55
62
|
// Uses a combination of uniform sampling and peak preservation.
|
|
56
|
-
function subsample_preserve_peaks(
|
|
57
|
-
const num_points =
|
|
63
|
+
function subsample_preserve_peaks(x_vals, y_vals, target_points) {
|
|
64
|
+
const num_points = x_vals.length;
|
|
58
65
|
if (num_points <= target_points)
|
|
59
|
-
return { x:
|
|
66
|
+
return { x: x_vals, y: y_vals };
|
|
60
67
|
// Find peaks (local maxima with significant height)
|
|
61
68
|
const peaks = [];
|
|
62
|
-
const threshold = Math.max(...
|
|
69
|
+
const threshold = Math.max(...y_vals) * 0.05; // 5% of max as significance threshold
|
|
63
70
|
for (let idx = 1; idx < num_points - 1; idx++) {
|
|
64
|
-
if (
|
|
65
|
-
|
|
66
|
-
|
|
71
|
+
if (y_vals[idx] > y_vals[idx - 1] &&
|
|
72
|
+
y_vals[idx] > y_vals[idx + 1] &&
|
|
73
|
+
y_vals[idx] > threshold) {
|
|
67
74
|
peaks.push(idx);
|
|
68
75
|
}
|
|
69
76
|
}
|
|
@@ -72,7 +79,7 @@ function subsample_preserve_peaks(x_values, y_values, target_points) {
|
|
|
72
79
|
const uniform_slots = target_points - peak_slots;
|
|
73
80
|
// Select top peaks by height
|
|
74
81
|
const top_peaks = peaks
|
|
75
|
-
.map((idx) => ({ idx, y:
|
|
82
|
+
.map((idx) => ({ idx, y: y_vals[idx] }))
|
|
76
83
|
.sort((a, b) => b.y - a.y)
|
|
77
84
|
.slice(0, peak_slots)
|
|
78
85
|
.map((peak) => peak.idx);
|
|
@@ -90,8 +97,8 @@ function subsample_preserve_peaks(x_values, y_values, target_points) {
|
|
|
90
97
|
// Merge and sort all selected indices
|
|
91
98
|
const selected = [...new Set([...uniform_indices, ...top_peaks])].sort((a, b) => a - b);
|
|
92
99
|
return {
|
|
93
|
-
x: selected.map((idx) =>
|
|
94
|
-
y: selected.map((idx) =>
|
|
100
|
+
x: selected.map((idx) => x_vals[idx]),
|
|
101
|
+
y: selected.map((idx) => y_vals[idx]),
|
|
95
102
|
};
|
|
96
103
|
}
|
|
97
104
|
// Parse a two-column ASCII file containing XRD data (2θ, intensity).
|
|
@@ -110,8 +117,8 @@ export function parse_xy_file(content) {
|
|
|
110
117
|
const parts = trimmed.split(/[\s,]+/).filter(Boolean);
|
|
111
118
|
if (parts.length < 2)
|
|
112
119
|
continue;
|
|
113
|
-
const two_theta =
|
|
114
|
-
const intensity =
|
|
120
|
+
const two_theta = Number(parts[0]);
|
|
121
|
+
const intensity = Number(parts[1]);
|
|
115
122
|
if (!isNaN(two_theta) && !isNaN(intensity)) {
|
|
116
123
|
x_values.push(two_theta);
|
|
117
124
|
y_values.push(intensity);
|
|
@@ -119,15 +126,7 @@ export function parse_xy_file(content) {
|
|
|
119
126
|
}
|
|
120
127
|
if (x_values.length === 0)
|
|
121
128
|
return null;
|
|
122
|
-
|
|
123
|
-
return { x: normalized.x, y: normalized.y };
|
|
124
|
-
}
|
|
125
|
-
// Parse a .xye file containing three-column XRD data (2θ, intensity, error).
|
|
126
|
-
// Same as .xy but with an optional third column for uncertainties (ignored for plotting).
|
|
127
|
-
export function parse_xye_file(content) {
|
|
128
|
-
// XYE is just XY with an extra error column - reuse parse_xy_file which already
|
|
129
|
-
// handles extra columns by only taking the first two
|
|
130
|
-
return parse_xy_file(content);
|
|
129
|
+
return normalize_and_subsample(x_values, y_values);
|
|
131
130
|
}
|
|
132
131
|
// Parse a Rigaku .ras file (ASCII format with structured header).
|
|
133
132
|
// Format: *RAS_HEADER_START ... *RAS_HEADER_END followed by *RAS_INT_START ... *RAS_INT_END
|
|
@@ -135,11 +134,11 @@ export function parse_xye_file(content) {
|
|
|
135
134
|
export function parse_ras_file(content) {
|
|
136
135
|
const lines = content.split(/\r?\n/);
|
|
137
136
|
// Extract header values (used as fallback for single-column data)
|
|
138
|
-
const header_start = extract_header_value(lines, /\*MEAS_SCAN_START\s*=\s*([\d.+-]+)/i) ??
|
|
139
|
-
extract_header_value(lines, /\*SCAN_START\s*=\s*([\d.+-]+)/i) ??
|
|
137
|
+
const header_start = extract_header_value(lines, /\*MEAS_SCAN_START\s*=\s*(?<value>[\d.+-]+)/i) ??
|
|
138
|
+
extract_header_value(lines, /\*SCAN_START\s*=\s*(?<value>[\d.+-]+)/i) ??
|
|
140
139
|
0;
|
|
141
|
-
const header_step = extract_header_value(lines, /\*MEAS_SCAN_STEP\s*=\s*([\d.+-]+)/i) ??
|
|
142
|
-
extract_header_value(lines, /\*SCAN_STEP\s*=\s*([\d.+-]+)/i) ??
|
|
140
|
+
const header_step = extract_header_value(lines, /\*MEAS_SCAN_STEP\s*=\s*(?<value>[\d.+-]+)/i) ??
|
|
141
|
+
extract_header_value(lines, /\*SCAN_STEP\s*=\s*(?<value>[\d.+-]+)/i) ??
|
|
143
142
|
DEFAULT_STEP_SIZE;
|
|
144
143
|
// Find intensity data section between *RAS_INT_START and *RAS_INT_END
|
|
145
144
|
// Also handle older format with *RAS_DATA_START
|
|
@@ -204,11 +203,11 @@ export function parse_ras_file(content) {
|
|
|
204
203
|
export function parse_uxd_file(content) {
|
|
205
204
|
const lines = content.split(/\r?\n/);
|
|
206
205
|
// Extract header values (underscore-prefixed keys)
|
|
207
|
-
const start = extract_header_value(lines, /_2THETA_?START\s*=?\s*([\d.+-]+)/i) ??
|
|
208
|
-
extract_header_value(lines, /_START\s*=?\s*([\d.+-]+)/i) ??
|
|
206
|
+
const start = extract_header_value(lines, /_2THETA_?START\s*=?\s*(?<value>[\d.+-]+)/i) ??
|
|
207
|
+
extract_header_value(lines, /_START\s*=?\s*(?<value>[\d.+-]+)/i) ??
|
|
209
208
|
0;
|
|
210
|
-
const step = extract_header_value(lines, /_STEP_?SIZE\s*=?\s*([\d.+-]+)/i) ??
|
|
211
|
-
extract_header_value(lines, /_STEPWIDTH\s*=?\s*([\d.+-]+)/i) ??
|
|
209
|
+
const step = extract_header_value(lines, /_STEP_?SIZE\s*=?\s*(?<value>[\d.+-]+)/i) ??
|
|
210
|
+
extract_header_value(lines, /_STEPWIDTH\s*=?\s*(?<value>[\d.+-]+)/i) ??
|
|
212
211
|
DEFAULT_STEP_SIZE;
|
|
213
212
|
// Find intensity data after _COUNTS marker
|
|
214
213
|
let in_data_section = false;
|
|
@@ -247,13 +246,13 @@ export function parse_gsas_file(content) {
|
|
|
247
246
|
let bin_type = `CONST`; // CONST, RALF, or others
|
|
248
247
|
let found_bank = false;
|
|
249
248
|
for (const line of lines) {
|
|
250
|
-
const bank_match = /BANK\s+\d+\s+(
|
|
249
|
+
const bank_match = /BANK\s+\d+\s+(?<npts>\d+)\s+\d+\s+(?<bin_type>\w+)\s+(?<bcoef1>[\d.+-]+)\s+(?<bcoef2>[\d.+-]+)/i.exec(line);
|
|
251
250
|
if (bank_match) {
|
|
252
251
|
bin_type = bank_match[2].toUpperCase();
|
|
253
252
|
// For CONST type: BCOEF1 is start*100 (centidegrees), BCOEF2 is step*100
|
|
254
253
|
if (bin_type === `CONST`) {
|
|
255
|
-
start =
|
|
256
|
-
step =
|
|
254
|
+
start = Number(bank_match[3]) / 100; // Convert centidegrees to degrees
|
|
255
|
+
step = Number(bank_match[4]) / 100;
|
|
257
256
|
}
|
|
258
257
|
else if (bin_type !== `FXYE`) {
|
|
259
258
|
// Other bin types like RALF (time-of-flight) are not fully supported
|
|
@@ -335,15 +334,15 @@ function parse_bruker_raw_v1(view, bytes) {
|
|
|
335
334
|
// V1 has ASCII header with scan parameters followed by binary data
|
|
336
335
|
const header_text = String.fromCharCode(...bytes.slice(0, 512));
|
|
337
336
|
// Try to find scan parameters in ASCII header
|
|
338
|
-
const start_match = /START\s*=\s*([\d.+-]+)/i.exec(header_text);
|
|
339
|
-
const step_match = /STEP\s*=\s*([\d.+-]+)/i.exec(header_text);
|
|
340
|
-
const count_match = /(?:COUNT|POINTS|NPTS)\s*=\s*(
|
|
341
|
-
const start = start_match ?
|
|
342
|
-
const step = step_match ?
|
|
337
|
+
const start_match = /START\s*=\s*(?<value>[\d.+-]+)/i.exec(header_text);
|
|
338
|
+
const step_match = /STEP\s*=\s*(?<value>[\d.+-]+)/i.exec(header_text);
|
|
339
|
+
const count_match = /(?:COUNT|POINTS|NPTS)\s*=\s*(?<value>\d+)/i.exec(header_text);
|
|
340
|
+
const start = start_match ? Number(start_match[1]) : 0;
|
|
341
|
+
const step = step_match ? Number(step_match[1]) : DEFAULT_STEP_SIZE;
|
|
343
342
|
// Find where binary data starts (after header)
|
|
344
343
|
let data_offset = 512;
|
|
345
344
|
if (count_match) {
|
|
346
|
-
const expected_count =
|
|
345
|
+
const expected_count = Math.trunc(Number(count_match[1]));
|
|
347
346
|
// Binary data is typically 4 bytes per intensity (float32)
|
|
348
347
|
data_offset = bytes.length - expected_count * 4;
|
|
349
348
|
}
|
|
@@ -399,14 +398,14 @@ function parse_rigaku_raw_file(data) {
|
|
|
399
398
|
const bytes = new Uint8Array(data);
|
|
400
399
|
// Try to find ASCII header section with scan parameters
|
|
401
400
|
const header_text = String.fromCharCode(...bytes.slice(0, Math.min(2048, bytes.length)));
|
|
402
|
-
const start_match = /(?:START|2THETA_START|SCAN_START)\s*[:=]?\s*([\d.+-]+)/i.exec(header_text);
|
|
403
|
-
const step_match = /(?:STEP|STEP_SIZE|SCAN_STEP)\s*[:=]?\s*([\d.+-]+)/i.exec(header_text);
|
|
404
|
-
const count_match = /(?:COUNT|POINTS|NPTS|STEPS)\s*[:=]?\s*(
|
|
401
|
+
const start_match = /(?:START|2THETA_START|SCAN_START)\s*[:=]?\s*(?<value>[\d.+-]+)/i.exec(header_text);
|
|
402
|
+
const step_match = /(?:STEP|STEP_SIZE|SCAN_STEP)\s*[:=]?\s*(?<value>[\d.+-]+)/i.exec(header_text);
|
|
403
|
+
const count_match = /(?:COUNT|POINTS|NPTS|STEPS)\s*[:=]?\s*(?<value>\d+)/i.exec(header_text);
|
|
405
404
|
if (!start_match && !step_match && !count_match)
|
|
406
405
|
return null; // Not a recognizable Rigaku format
|
|
407
|
-
const start = start_match ?
|
|
408
|
-
const step = step_match ?
|
|
409
|
-
const expected_count = count_match ?
|
|
406
|
+
const start = start_match ? Number(start_match[1]) : 0;
|
|
407
|
+
const step = step_match ? Number(step_match[1]) : DEFAULT_STEP_SIZE;
|
|
408
|
+
const expected_count = count_match ? Math.trunc(Number(count_match[1])) : 0;
|
|
410
409
|
// Find binary data section
|
|
411
410
|
// Rigaku typically stores intensities as 32-bit floats or integers
|
|
412
411
|
let data_offset = 0;
|
|
@@ -521,28 +520,24 @@ function extract_scan_parameters_xml(doc) {
|
|
|
521
520
|
// Try to find intensity data - multiple possible tag names
|
|
522
521
|
let intensities = null;
|
|
523
522
|
let two_theta_values = null;
|
|
524
|
-
// Method 1: <Intensities> tag with space-separated values
|
|
525
|
-
const
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
const counts_el = doc.querySelector(`Counts`);
|
|
532
|
-
if (counts_el?.textContent) {
|
|
533
|
-
intensities = parse_number_list(counts_el.textContent);
|
|
534
|
-
}
|
|
523
|
+
// Method 1: <Intensities> or <Counts> tag with space-separated values
|
|
524
|
+
for (const tag of [`Intensities`, `Counts`]) {
|
|
525
|
+
const text = doc.querySelector(tag)?.textContent;
|
|
526
|
+
if (text)
|
|
527
|
+
intensities = parse_number_list(text);
|
|
528
|
+
if (intensities?.length)
|
|
529
|
+
break;
|
|
535
530
|
}
|
|
536
|
-
// Method
|
|
531
|
+
// Method 2: Individual <I> or <Count> elements
|
|
537
532
|
if (!intensities?.length) {
|
|
538
533
|
const intensity_elements = doc.querySelectorAll(`I, Count`);
|
|
539
534
|
if (intensity_elements.length > 0) {
|
|
540
535
|
intensities = Array.from(intensity_elements)
|
|
541
|
-
.map((el) =>
|
|
536
|
+
.map((el) => Number(el.textContent?.trim() || NaN))
|
|
542
537
|
.filter((val) => !isNaN(val));
|
|
543
538
|
}
|
|
544
539
|
}
|
|
545
|
-
// Method
|
|
540
|
+
// Method 3: <Datum> elements with comma-separated values
|
|
546
541
|
// Bruker uses different formats depending on instrument/software version:
|
|
547
542
|
// - 8-column HRXRD: "1,1,TwoTheta,Omega,...,Intensity" (indices 2 and 7)
|
|
548
543
|
// - 5-column powder: "time,1,TwoTheta,Theta,Intensity" (indices 2 and 4)
|
|
@@ -559,9 +554,9 @@ function extract_scan_parameters_xml(doc) {
|
|
|
559
554
|
const parts = text.split(`,`);
|
|
560
555
|
// Need at least 5 columns: time, flag, 2Theta, Theta/Omega, Intensity
|
|
561
556
|
if (parts.length >= 5) {
|
|
562
|
-
const two_theta =
|
|
557
|
+
const two_theta = Number(parts[2]);
|
|
563
558
|
// Intensity is always the last column
|
|
564
|
-
const intensity =
|
|
559
|
+
const intensity = Number(parts[parts.length - 1]);
|
|
565
560
|
if (!isNaN(two_theta) && !isNaN(intensity)) {
|
|
566
561
|
two_theta_values.push(two_theta);
|
|
567
562
|
intensities.push(intensity);
|
|
@@ -582,9 +577,7 @@ function extract_scan_parameters_xml(doc) {
|
|
|
582
577
|
if (!intensities?.length)
|
|
583
578
|
return null;
|
|
584
579
|
// Extract scan range parameters
|
|
585
|
-
|
|
586
|
-
let step_size = DEFAULT_STEP_SIZE;
|
|
587
|
-
// Try to find start angle - multiple possible locations
|
|
580
|
+
// Try multiple possible tag names, returning the first that parses (and passes `ok`)
|
|
588
581
|
const start_candidates = [
|
|
589
582
|
`Start`,
|
|
590
583
|
`TwoThetaStart`,
|
|
@@ -593,17 +586,6 @@ function extract_scan_parameters_xml(doc) {
|
|
|
593
586
|
`ScanAxisBeginPosition`,
|
|
594
587
|
`Begin`,
|
|
595
588
|
];
|
|
596
|
-
for (const tag of start_candidates) {
|
|
597
|
-
const el = doc.querySelector(tag);
|
|
598
|
-
if (el?.textContent) {
|
|
599
|
-
const val = parseFloat(el.textContent);
|
|
600
|
-
if (!isNaN(val)) {
|
|
601
|
-
start_angle = val;
|
|
602
|
-
break;
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
// Try to find step size - multiple possible locations
|
|
607
589
|
const step_candidates = [
|
|
608
590
|
`Step`,
|
|
609
591
|
`StepSize`,
|
|
@@ -612,23 +594,15 @@ function extract_scan_parameters_xml(doc) {
|
|
|
612
594
|
`ScanAxisIncrement`,
|
|
613
595
|
`StepWidth`,
|
|
614
596
|
];
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
if (el?.textContent) {
|
|
618
|
-
const val = parseFloat(el.textContent);
|
|
619
|
-
if (!isNaN(val) && val > 0) {
|
|
620
|
-
step_size = val;
|
|
621
|
-
break;
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
}
|
|
597
|
+
const start_angle = query_first_number(doc, start_candidates) ?? 0;
|
|
598
|
+
let step_size = query_first_number(doc, step_candidates, (val) => val > 0) ?? DEFAULT_STEP_SIZE;
|
|
625
599
|
// Alternative: calculate step from start/end and count
|
|
626
600
|
if (step_size === DEFAULT_STEP_SIZE) {
|
|
627
601
|
const end_candidates = [`Stop`, `TwoThetaEnd`, `EndPosition`, `2ThetaEnd`, `End`];
|
|
628
602
|
for (const tag of end_candidates) {
|
|
629
603
|
const el = doc.querySelector(tag);
|
|
630
604
|
if (el?.textContent) {
|
|
631
|
-
const end_val =
|
|
605
|
+
const end_val = Number(el.textContent);
|
|
632
606
|
if (!isNaN(end_val) && end_val > start_angle && intensities.length > 1) {
|
|
633
607
|
step_size = (end_val - start_angle) / (intensities.length - 1);
|
|
634
608
|
break;
|
|
@@ -660,8 +634,8 @@ export function parse_xrdml_file(content) {
|
|
|
660
634
|
const end_el = two_theta_positions.querySelector(`endPosition`);
|
|
661
635
|
if (!start_el?.textContent || !end_el?.textContent)
|
|
662
636
|
return null;
|
|
663
|
-
const start_angle =
|
|
664
|
-
const end_angle =
|
|
637
|
+
const start_angle = Number(start_el.textContent);
|
|
638
|
+
const end_angle = Number(end_el.textContent);
|
|
665
639
|
if (isNaN(start_angle) || isNaN(end_angle))
|
|
666
640
|
return null;
|
|
667
641
|
// Extract intensities
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "matterviz",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "Interactive visualizations for materials science: periodic tables, 3D structures, MD trajectories, heatmaps, scatter plots.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chemistry",
|
|
@@ -20,7 +20,10 @@
|
|
|
20
20
|
],
|
|
21
21
|
"type": "module",
|
|
22
22
|
"sideEffects": [
|
|
23
|
-
"**/*.css"
|
|
23
|
+
"**/*.css",
|
|
24
|
+
"**/file-viewer/main.*",
|
|
25
|
+
"**/theme/embedded.*",
|
|
26
|
+
"**/theme/themes.*"
|
|
24
27
|
],
|
|
25
28
|
"exports": {
|
|
26
29
|
".": {
|
|
@@ -63,6 +66,30 @@
|
|
|
63
66
|
"types": "./dist/feedback/index.d.ts",
|
|
64
67
|
"default": "./dist/feedback/index.js"
|
|
65
68
|
},
|
|
69
|
+
"./file-viewer": {
|
|
70
|
+
"types": "./dist/file-viewer/index.d.ts",
|
|
71
|
+
"default": "./dist/file-viewer/index.js"
|
|
72
|
+
},
|
|
73
|
+
"./file-viewer/parse": {
|
|
74
|
+
"types": "./dist/file-viewer/parse.d.ts",
|
|
75
|
+
"default": "./dist/file-viewer/parse.js"
|
|
76
|
+
},
|
|
77
|
+
"./file-viewer/eligibility": {
|
|
78
|
+
"types": "./dist/file-viewer/eligibility.d.ts",
|
|
79
|
+
"default": "./dist/file-viewer/eligibility.js"
|
|
80
|
+
},
|
|
81
|
+
"./file-viewer/host-protocol": {
|
|
82
|
+
"types": "./dist/file-viewer/host-protocol.d.ts",
|
|
83
|
+
"default": "./dist/file-viewer/host-protocol.js"
|
|
84
|
+
},
|
|
85
|
+
"./file-viewer/host-transfer": {
|
|
86
|
+
"types": "./dist/file-viewer/host-transfer.d.ts",
|
|
87
|
+
"default": "./dist/file-viewer/host-transfer.js"
|
|
88
|
+
},
|
|
89
|
+
"./file-viewer/webview": {
|
|
90
|
+
"types": "./dist/file-viewer/main.d.ts",
|
|
91
|
+
"default": "./dist/file-viewer/main.js"
|
|
92
|
+
},
|
|
66
93
|
"./fermi-surface": {
|
|
67
94
|
"types": "./dist/fermi-surface/index.d.ts",
|
|
68
95
|
"default": "./dist/fermi-surface/index.js"
|
|
@@ -147,6 +174,10 @@
|
|
|
147
174
|
"types": "./dist/theme/index.d.ts",
|
|
148
175
|
"default": "./dist/theme/index.js"
|
|
149
176
|
},
|
|
177
|
+
"./theme/embedded": {
|
|
178
|
+
"types": "./dist/theme/embedded.d.ts",
|
|
179
|
+
"default": "./dist/theme/embedded.js"
|
|
180
|
+
},
|
|
150
181
|
"./theme/themes": {
|
|
151
182
|
"default": "./dist/theme/themes.mjs"
|
|
152
183
|
},
|
|
@@ -177,8 +208,7 @@
|
|
|
177
208
|
},
|
|
178
209
|
"scripts": {
|
|
179
210
|
"test": "vp test --run && playwright test",
|
|
180
|
-
"knip": "knip --include dependencies,
|
|
181
|
-
"knip:exports": "knip --include exports,types,nsExports",
|
|
211
|
+
"knip": "knip --include dependencies,exports,types,nsExports",
|
|
182
212
|
"publint": "publint",
|
|
183
213
|
"package-dist-assets": "node scripts/package-dist-assets.ts",
|
|
184
214
|
"package:dist": "svelte-package && pnpm run package-dist-assets",
|
|
@@ -186,12 +216,13 @@
|
|
|
186
216
|
"prepublishOnly": "pnpm run package:dist"
|
|
187
217
|
},
|
|
188
218
|
"dependencies": {
|
|
189
|
-
"@spglib/moyo-wasm": "^0.
|
|
190
|
-
"@sveltejs/kit": "2.
|
|
219
|
+
"@spglib/moyo-wasm": "^0.15.0",
|
|
220
|
+
"@sveltejs/kit": "2.69.3",
|
|
191
221
|
"@threlte/core": "^8.5.16",
|
|
192
222
|
"@threlte/extras": "^9.21.0",
|
|
193
223
|
"d3-array": "^3.2.4",
|
|
194
224
|
"d3-color": "^3.1.0",
|
|
225
|
+
"d3-contour": "^4.0.2",
|
|
195
226
|
"d3-format": "^3.1.2",
|
|
196
227
|
"d3-hierarchy": "^3.1.2",
|
|
197
228
|
"d3-interpolate-path": "^2.3.0",
|
|
@@ -203,18 +234,19 @@
|
|
|
203
234
|
"dompurify": "3.4.7",
|
|
204
235
|
"fflate": "^0.8.3",
|
|
205
236
|
"h5wasm": "^0.10.3",
|
|
206
|
-
"js-yaml": "^
|
|
207
|
-
"svelte-multiselect": "^11.
|
|
208
|
-
"three": "^0.
|
|
237
|
+
"js-yaml": "^5.2.1",
|
|
238
|
+
"svelte-multiselect": "^11.8.0",
|
|
239
|
+
"three": "^0.185.1"
|
|
209
240
|
},
|
|
210
241
|
"devDependencies": {
|
|
211
242
|
"@janosh/vite-config": "github:janosh/dotfiles",
|
|
212
|
-
"@playwright/test": "^1.
|
|
243
|
+
"@playwright/test": "^1.61.1",
|
|
213
244
|
"@sveltejs/adapter-static": "3.0.10",
|
|
214
245
|
"@sveltejs/package": "^2.5.8",
|
|
215
|
-
"@sveltejs/vite-plugin-svelte": "^7.
|
|
246
|
+
"@sveltejs/vite-plugin-svelte": "^7.2.0",
|
|
216
247
|
"@types/d3-array": "^3.2.2",
|
|
217
248
|
"@types/d3-color": "^3.1.3",
|
|
249
|
+
"@types/d3-contour": "^3.0.6",
|
|
218
250
|
"@types/d3-format": "^3.0.4",
|
|
219
251
|
"@types/d3-hierarchy": "^3.1.7",
|
|
220
252
|
"@types/d3-interpolate-path": "^2.0.3",
|
|
@@ -223,24 +255,21 @@
|
|
|
223
255
|
"@types/d3-scale-chromatic": "^3.1.0",
|
|
224
256
|
"@types/d3-shape": "^3.1.8",
|
|
225
257
|
"@types/d3-time-format": "^4.0.3",
|
|
226
|
-
"@types/
|
|
227
|
-
"@
|
|
228
|
-
"@types/three": "^0.184.1",
|
|
229
|
-
"@typescript/native-preview": "7.0.0-dev.20260614.1",
|
|
230
|
-
"@vitest/coverage-v8": "4.1.8",
|
|
258
|
+
"@types/three": "^0.185.1",
|
|
259
|
+
"@vitest/coverage-v8": "4.1.10",
|
|
231
260
|
"@wooorm/starry-night": "^3.10.0",
|
|
232
|
-
"happy-dom": "^20.10.
|
|
233
|
-
"knip": "^6.
|
|
261
|
+
"happy-dom": "^20.10.6",
|
|
262
|
+
"knip": "^6.26.0",
|
|
234
263
|
"mdsvex": "^0.12.7",
|
|
235
264
|
"publint": "^0.3.21",
|
|
236
265
|
"rehype-katex": "^7.0.1",
|
|
237
266
|
"remark-math": "3.0.1",
|
|
238
|
-
"svelte": "^5.56.
|
|
239
|
-
"svelte-check
|
|
240
|
-
"typescript": "6.0.3",
|
|
241
|
-
"vite": "^8.
|
|
242
|
-
"vite-plus": "
|
|
243
|
-
"vitest": "4.1.
|
|
267
|
+
"svelte": "^5.56.5",
|
|
268
|
+
"svelte-check": "^4.7.2",
|
|
269
|
+
"typescript": "^6.0.3",
|
|
270
|
+
"vite": "^8.1.4",
|
|
271
|
+
"vite-plus": "^0.2.4",
|
|
272
|
+
"vitest": "4.1.10"
|
|
244
273
|
},
|
|
245
274
|
"peerDependencies": {
|
|
246
275
|
"svelte": "^5.0.0"
|
|
@@ -250,16 +279,47 @@
|
|
|
250
279
|
},
|
|
251
280
|
"packageManager": "pnpm@11.5.0",
|
|
252
281
|
"knip": {
|
|
253
|
-
"entry": [
|
|
254
|
-
"svelte.config.ts",
|
|
255
|
-
"src/site/**/*.{js,ts,svelte}"
|
|
256
|
-
],
|
|
257
|
-
"ignore": [
|
|
258
|
-
"extensions/**"
|
|
259
|
-
],
|
|
260
282
|
"ignoreDependencies": [
|
|
261
|
-
"
|
|
262
|
-
|
|
263
|
-
|
|
283
|
+
"svelte-check"
|
|
284
|
+
],
|
|
285
|
+
"workspaces": {
|
|
286
|
+
".": {
|
|
287
|
+
"entry": [
|
|
288
|
+
"svelte.config.ts",
|
|
289
|
+
"src/site/**/*.{js,ts,svelte}"
|
|
290
|
+
],
|
|
291
|
+
"paths": {
|
|
292
|
+
"$lib": [
|
|
293
|
+
"./src/lib"
|
|
294
|
+
],
|
|
295
|
+
"$lib/*": [
|
|
296
|
+
"./src/lib/*"
|
|
297
|
+
],
|
|
298
|
+
"$site": [
|
|
299
|
+
"./src/site"
|
|
300
|
+
],
|
|
301
|
+
"$site/*": [
|
|
302
|
+
"./src/site/*"
|
|
303
|
+
]
|
|
304
|
+
},
|
|
305
|
+
"ignore": [
|
|
306
|
+
"extensions/anywidget/**",
|
|
307
|
+
"extensions/dash/**"
|
|
308
|
+
]
|
|
309
|
+
},
|
|
310
|
+
"extensions/vscode": {
|
|
311
|
+
"entry": [
|
|
312
|
+
"src/extension.ts"
|
|
313
|
+
],
|
|
314
|
+
"paths": {
|
|
315
|
+
"$lib": [
|
|
316
|
+
"../../src/lib"
|
|
317
|
+
],
|
|
318
|
+
"$lib/*": [
|
|
319
|
+
"../../src/lib/*"
|
|
320
|
+
]
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
264
324
|
}
|
|
265
325
|
}
|
package/readme.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
[](https://marketplace.visualstudio.com/items?itemName=janosh.matterviz)
|
|
10
10
|
[](https://matterviz.janosh.dev)
|
|
11
11
|
[](https://stackblitz.com/github/janosh/matterviz)
|
|
12
|
-
[](https://doi.org/10.5281/zenodo.17094509)
|
|
13
13
|
|
|
14
14
|
</h4>
|
|
15
15
|
|
|
@@ -100,7 +100,8 @@ npm add -D matterviz
|
|
|
100
100
|
```svelte
|
|
101
101
|
<script>
|
|
102
102
|
import { Trajectory } from 'matterviz'
|
|
103
|
-
// supports .xyz/.extxyz, .traj, .hdf5, .npz, .pkl, .dat
|
|
103
|
+
// supports .xyz/.extxyz, .traj, .hdf5, .npz, .pkl, .dat and .gz;
|
|
104
|
+
// decompress .zip/.bz2/.xz first because browsers cannot decode them
|
|
104
105
|
</script>
|
|
105
106
|
|
|
106
107
|
<Trajectory data_url="/traj/ase-md.xyz" auto_play fps={10} style="max-height: 700px" />
|
|
@@ -135,12 +136,12 @@ Use [`citation.cff`](citation.cff) or cite the [Zenodo record](https://zenodo.or
|
|
|
135
136
|
@software{riebesell_matterviz_2022,
|
|
136
137
|
title = {matterviz: visualization toolkit for materials informatics},
|
|
137
138
|
author = {Riebesell, Janosh and Evans, Matthew},
|
|
138
|
-
date = {2026-
|
|
139
|
+
date = {2026-07-15},
|
|
139
140
|
year = {2026},
|
|
140
141
|
doi = {10.5281/zenodo.17094509},
|
|
141
142
|
url = {https://github.com/janosh/matterviz},
|
|
142
143
|
note = {10.5281/zenodo.17094509 - https://github.com/janosh/matterviz},
|
|
143
|
-
urldate = {2026-
|
|
144
|
-
version = {0.3
|
|
144
|
+
urldate = {2026-07-15}, % optional, replace with your date of access
|
|
145
|
+
version = {0.4.3}, % replace with the version you use
|
|
145
146
|
}
|
|
146
147
|
```
|
package/dist/api/mp.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const mp_bucket = "https://materialsproject-build.s3.amazonaws.com/collections/2022-10-28";
|
|
2
|
-
export declare function fetch_material_data<T extends Record<string, unknown>>(material_id: string, bucket?: string): Promise<{
|
|
3
|
-
summary: T | null;
|
|
4
|
-
similarity: T | null;
|
|
5
|
-
robocrys: T | null;
|
|
6
|
-
}>;
|
package/dist/api/mp.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { fetch_zipped } from '../io/fetch';
|
|
2
|
-
// Materials Project S3 bucket for pre-computed data (may be outdated)
|
|
3
|
-
export const mp_bucket = `https://materialsproject-build.s3.amazonaws.com/collections/2022-10-28`;
|
|
4
|
-
// Fetch all material data in parallel
|
|
5
|
-
export async function fetch_material_data(material_id, bucket = mp_bucket) {
|
|
6
|
-
try {
|
|
7
|
-
const results = await Promise.allSettled([
|
|
8
|
-
fetch_zipped(`${bucket}/summary/${material_id}.json.gz`),
|
|
9
|
-
fetch_zipped(`${bucket}/similarity/${material_id}.json.gz`),
|
|
10
|
-
fetch_zipped(`${bucket}/robocrys/${material_id}.json.gz`),
|
|
11
|
-
]);
|
|
12
|
-
return {
|
|
13
|
-
summary: results[0].status === `fulfilled` ? results[0].value : null,
|
|
14
|
-
similarity: results[1].status === `fulfilled` ? results[1].value : null,
|
|
15
|
-
robocrys: results[2].status === `fulfilled` ? results[2].value : null,
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
catch (err) {
|
|
19
|
-
console.error(`Failed to fetch material data:`, err);
|
|
20
|
-
return { summary: null, similarity: null, robocrys: null };
|
|
21
|
-
}
|
|
22
|
-
}
|