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
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import type { AxisConfig } from '../plot'
|
|
7
7
|
import ColorBar from '../plot/core/components/ColorBar.svelte'
|
|
8
8
|
import { quickselect } from '../plot/box/quantile'
|
|
9
|
+
import { clamp01 } from '../utils'
|
|
9
10
|
import { type ComponentProps, onDestroy, onMount, type Snippet } from 'svelte'
|
|
10
11
|
import type { HTMLAttributes } from 'svelte/elements'
|
|
11
12
|
import { SvelteMap, SvelteSet } from 'svelte/reactivity'
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
HeatmapExportFormat,
|
|
18
19
|
HeatmapTooltipProp,
|
|
19
20
|
LegendPosition,
|
|
21
|
+
MissingCellStyle,
|
|
20
22
|
NormalizeMode,
|
|
21
23
|
SymmetricMode,
|
|
22
24
|
} from './index'
|
|
@@ -38,7 +40,7 @@
|
|
|
38
40
|
color_scale = $bindable(`interpolateViridis`),
|
|
39
41
|
color_scale_range = [null, null],
|
|
40
42
|
color_overrides = {},
|
|
41
|
-
|
|
43
|
+
missing = {},
|
|
42
44
|
log = false,
|
|
43
45
|
value_transform,
|
|
44
46
|
normalize = `linear`,
|
|
@@ -113,13 +115,11 @@
|
|
|
113
115
|
}: Omit<HTMLAttributes<HTMLDivElement>, `onclick` | `ondblclick`> & {
|
|
114
116
|
x_items: AxisItem[]
|
|
115
117
|
y_items: AxisItem[]
|
|
116
|
-
values?:
|
|
117
|
-
| CellValue[][]
|
|
118
|
-
| Record<string, Record<string, CellValue>>
|
|
118
|
+
values?: CellValue[][] | Record<string, Record<string, CellValue>>
|
|
119
119
|
color_scale?: D3InterpolateName | ((val: number) => string)
|
|
120
120
|
color_scale_range?: [number | null, number | null]
|
|
121
121
|
color_overrides?: Record<string, string>
|
|
122
|
-
|
|
122
|
+
missing?: MissingCellStyle
|
|
123
123
|
log?: boolean
|
|
124
124
|
value_transform?: (
|
|
125
125
|
value: number,
|
|
@@ -145,11 +145,7 @@
|
|
|
145
145
|
onpin?: (cell: CellPos | null) => void
|
|
146
146
|
oncontextmenu?: (cell: CellContext, event: MouseEvent) => void
|
|
147
147
|
enable_brush?: boolean
|
|
148
|
-
onbrush?: (payload: {
|
|
149
|
-
x_range: Vec2
|
|
150
|
-
y_range: Vec2
|
|
151
|
-
cells: CellContext[]
|
|
152
|
-
}) => void
|
|
148
|
+
onbrush?: (payload: { x_range: Vec2; y_range: Vec2; cells: CellContext[] }) => void
|
|
153
149
|
tile_size?: string
|
|
154
150
|
gap?: string
|
|
155
151
|
// false: show all rows/cols. 'compact': remove all-null rows/cols.
|
|
@@ -199,9 +195,7 @@
|
|
|
199
195
|
} = $props()
|
|
200
196
|
|
|
201
197
|
// Normalize symmetric prop: true→'lower', otherwise pass through
|
|
202
|
-
const symmetric = $derived(
|
|
203
|
-
symmetric_prop === true ? `lower` : symmetric_prop,
|
|
204
|
-
)
|
|
198
|
+
const symmetric = $derived(symmetric_prop === true ? `lower` : symmetric_prop)
|
|
205
199
|
|
|
206
200
|
// Check if a cell should be skipped in symmetric mode
|
|
207
201
|
function is_hidden_cell(x_idx: number, y_idx: number): boolean {
|
|
@@ -220,8 +214,7 @@
|
|
|
220
214
|
let get_value = $derived.by(() => {
|
|
221
215
|
if (Array.isArray(values)) {
|
|
222
216
|
const matrix_values = values as CellValue[][]
|
|
223
|
-
return (x_idx: number, y_idx: number): CellValue =>
|
|
224
|
-
matrix_values[y_idx]?.[x_idx] ?? null
|
|
217
|
+
return (x_idx: number, y_idx: number): CellValue => matrix_values[y_idx]?.[x_idx] ?? null
|
|
225
218
|
}
|
|
226
219
|
// Record<y_key, Record<x_key, value>>
|
|
227
220
|
const record = values as Record<string, Record<string, CellValue>>
|
|
@@ -266,19 +259,23 @@
|
|
|
266
259
|
const all_y = Array.from({ length: y_items.length }, (_, idx) => idx)
|
|
267
260
|
const filtered_x = search_query_norm
|
|
268
261
|
? all_x.filter((idx) => {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
262
|
+
const item = x_items[idx]
|
|
263
|
+
const key = item.key ?? item.label
|
|
264
|
+
return (
|
|
265
|
+
key.toLowerCase().includes(search_query_norm) ||
|
|
266
|
+
item.label.toLowerCase().includes(search_query_norm)
|
|
267
|
+
)
|
|
268
|
+
})
|
|
274
269
|
: all_x
|
|
275
270
|
const filtered_y = search_query_norm
|
|
276
271
|
? all_y.filter((idx) => {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
272
|
+
const item = y_items[idx]
|
|
273
|
+
const key = item.key ?? item.label
|
|
274
|
+
return (
|
|
275
|
+
key.toLowerCase().includes(search_query_norm) ||
|
|
276
|
+
item.label.toLowerCase().includes(search_query_norm)
|
|
277
|
+
)
|
|
278
|
+
})
|
|
282
279
|
: all_y
|
|
283
280
|
if (!hide_empty) {
|
|
284
281
|
return {
|
|
@@ -345,7 +342,7 @@
|
|
|
345
342
|
// Interpolated quantile via quickselect (O(n) avg vs full sort); reorders `scratch_values` in place so callers must pass a copy they own
|
|
346
343
|
function get_quantile(scratch_values: number[], quantile: number): number {
|
|
347
344
|
if (scratch_values.length === 0) return 0
|
|
348
|
-
const clipped_quantile =
|
|
345
|
+
const clipped_quantile = clamp01(quantile)
|
|
349
346
|
const float_idx = (scratch_values.length - 1) * clipped_quantile
|
|
350
347
|
const low_idx = Math.floor(float_idx)
|
|
351
348
|
const high_idx = Math.ceil(float_idx)
|
|
@@ -390,8 +387,8 @@
|
|
|
390
387
|
const clipped_min = get_quantile(scratch, q_low)
|
|
391
388
|
const clipped_max = get_quantile(scratch, q_high)
|
|
392
389
|
return clipped_min <= clipped_max
|
|
393
|
-
? [clipped_min, clipped_max] as const
|
|
394
|
-
: [clipped_max, clipped_min] as const
|
|
390
|
+
? ([clipped_min, clipped_max] as const)
|
|
391
|
+
: ([clipped_max, clipped_min] as const)
|
|
395
392
|
})
|
|
396
393
|
|
|
397
394
|
let [domain_min, domain_max] = $derived.by(() => {
|
|
@@ -410,41 +407,44 @@
|
|
|
410
407
|
let cs_max = $derived(color_scale_range[1] ?? domain_max)
|
|
411
408
|
let use_log_norm = $derived(normalize === `log` || log)
|
|
412
409
|
|
|
410
|
+
// fill for cells with no mappable value (default transparent)
|
|
411
|
+
let missing_fill = $derived(missing.color ?? `transparent`)
|
|
412
|
+
|
|
413
|
+
// whether a value lacks a mappable scale color (-> missing fill + label/style decorations)
|
|
414
|
+
function cell_is_missing(val: CellValue): boolean {
|
|
415
|
+
if (val === null) return true
|
|
416
|
+
if (typeof val === `string`) return !is_color(val)
|
|
417
|
+
return !Number.isFinite(val) || (use_log_norm && val <= 0)
|
|
418
|
+
}
|
|
419
|
+
|
|
413
420
|
// Map a single value to a background color
|
|
414
421
|
function value_to_color(val: CellValue): string | null {
|
|
415
|
-
if (val ===
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
return missing_color || null
|
|
419
|
-
}
|
|
420
|
-
if (!Number.isFinite(val) || !color_scale_fn) return missing_color || null
|
|
421
|
-
if (use_log_norm && val <= 0) return missing_color || null
|
|
422
|
+
if (typeof val === `string`) return is_color(val) ? val : missing_fill || null
|
|
423
|
+
// null/string excluded above -> val narrows to number past this guard
|
|
424
|
+
if (val === null || !color_scale_fn || cell_is_missing(val)) return missing_fill || null
|
|
422
425
|
|
|
423
426
|
const span = cs_max - cs_min
|
|
424
427
|
if (!Number.isFinite(span) || span === 0) return color_scale_fn(0.5)
|
|
425
428
|
|
|
426
|
-
let normalized =
|
|
427
|
-
? normalize(val, cs_min, cs_max)
|
|
428
|
-
: (val - cs_min) / span
|
|
429
|
+
let normalized =
|
|
430
|
+
typeof normalize === `function` ? normalize(val, cs_min, cs_max) : (val - cs_min) / span
|
|
429
431
|
if (use_log_norm) {
|
|
430
432
|
const is_descending_range = cs_min > cs_max
|
|
431
433
|
const lower_bound = Math.min(cs_min, cs_max)
|
|
432
434
|
const upper_bound = Math.max(cs_min, cs_max)
|
|
433
|
-
if (upper_bound <= 0) return
|
|
435
|
+
if (upper_bound <= 0) return missing_fill || null
|
|
434
436
|
const safe_lower_bound = lower_bound > 0 ? lower_bound : (min_pos ?? upper_bound)
|
|
435
437
|
const safe_value = Math.max(val, safe_lower_bound)
|
|
436
438
|
const log_min = Math.log(safe_lower_bound)
|
|
437
439
|
const log_max = Math.log(upper_bound)
|
|
438
|
-
if (
|
|
439
|
-
!Number.isFinite(log_min) || !Number.isFinite(log_max) || log_max === log_min
|
|
440
|
-
) {
|
|
440
|
+
if (!Number.isFinite(log_min) || !Number.isFinite(log_max) || log_max === log_min) {
|
|
441
441
|
return color_scale_fn(0.5)
|
|
442
442
|
}
|
|
443
443
|
const log_normalized = (Math.log(safe_value) - log_min) / (log_max - log_min)
|
|
444
444
|
normalized = is_descending_range ? 1 - log_normalized : log_normalized
|
|
445
445
|
}
|
|
446
|
-
if (!Number.isFinite(normalized)) return
|
|
447
|
-
return color_scale_fn(
|
|
446
|
+
if (!Number.isFinite(normalized)) return missing_fill || null
|
|
447
|
+
return color_scale_fn(clamp01(normalized))
|
|
448
448
|
}
|
|
449
449
|
|
|
450
450
|
// Batch compute background colors as a flat array indexed by y_idx * n_x + x_idx.
|
|
@@ -462,21 +462,19 @@
|
|
|
462
462
|
}
|
|
463
463
|
const override_key = make_color_override_key(x_keys[x_idx], y_keys[y_idx])
|
|
464
464
|
const raw_value = get_value(x_idx, y_idx)
|
|
465
|
-
const transformed_value =
|
|
466
|
-
? get_transformed_value(x_idx, y_idx)
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
465
|
+
const transformed_value =
|
|
466
|
+
typeof raw_value === `number` ? get_transformed_value(x_idx, y_idx) : raw_value
|
|
467
|
+
colors[row_offset + x_idx] =
|
|
468
|
+
override_key in color_overrides
|
|
469
|
+
? color_overrides[override_key]
|
|
470
|
+
: value_to_color(transformed_value)
|
|
471
471
|
}
|
|
472
472
|
}
|
|
473
473
|
return colors
|
|
474
474
|
})
|
|
475
475
|
|
|
476
476
|
const to_contrast_colors = (bg_values: (string | null)[]): (string | null)[] =>
|
|
477
|
-
bg_values.map((bg_color) =>
|
|
478
|
-
bg_color ? pick_contrast_color({ bg_color }) : null
|
|
479
|
-
)
|
|
477
|
+
bg_values.map((bg_color) => (bg_color ? pick_contrast_color({ bg_color }) : null))
|
|
480
478
|
|
|
481
479
|
// Compute text colors when cells render content that needs contrast (cell snippet or show_values)
|
|
482
480
|
let text_flat = $derived.by(() => {
|
|
@@ -530,12 +528,10 @@
|
|
|
530
528
|
symmetric && symmetric_label_position === `diagonal`,
|
|
531
529
|
)
|
|
532
530
|
let use_staggered_x_labels = $derived(
|
|
533
|
-
stagger_axis_labels === true ||
|
|
534
|
-
(stagger_axis_labels === `auto` && vis_x.length >= 24),
|
|
531
|
+
stagger_axis_labels === true || (stagger_axis_labels === `auto` && vis_x.length >= 24),
|
|
535
532
|
)
|
|
536
533
|
let use_staggered_y_labels = $derived(
|
|
537
|
-
stagger_axis_labels === true ||
|
|
538
|
-
(stagger_axis_labels === `auto` && vis_y.length >= 24),
|
|
534
|
+
stagger_axis_labels === true || (stagger_axis_labels === `auto` && vis_y.length >= 24),
|
|
539
535
|
)
|
|
540
536
|
let use_side_split_x_labels = $derived(
|
|
541
537
|
use_staggered_x_labels && !use_diagonal_symmetric_labels,
|
|
@@ -560,7 +556,7 @@
|
|
|
560
556
|
)
|
|
561
557
|
|
|
562
558
|
function parse_px_size(size: string): number {
|
|
563
|
-
const parsed = Number.
|
|
559
|
+
const parsed = Number(size.replace(`px`, ``))
|
|
564
560
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : 12
|
|
565
561
|
}
|
|
566
562
|
|
|
@@ -573,8 +569,7 @@
|
|
|
573
569
|
Math.floor((scroll_left - grid_offset_left) / tile_stride_px) - overscan
|
|
574
570
|
const start_pos = Math.max(0, raw_start_pos)
|
|
575
571
|
const raw_end_pos =
|
|
576
|
-
Math.ceil((scroll_left - grid_offset_left + viewport_width) / tile_stride_px) +
|
|
577
|
-
overscan
|
|
572
|
+
Math.ceil((scroll_left - grid_offset_left + viewport_width) / tile_stride_px) + overscan
|
|
578
573
|
const end_pos = Math.min(vis_x.length, raw_end_pos)
|
|
579
574
|
return vis_x.slice(start_pos, end_pos)
|
|
580
575
|
})
|
|
@@ -584,8 +579,7 @@
|
|
|
584
579
|
Math.floor((scroll_top - grid_offset_top) / tile_stride_px) - overscan
|
|
585
580
|
const start_pos = Math.max(0, raw_start_pos)
|
|
586
581
|
const raw_end_pos =
|
|
587
|
-
Math.ceil((scroll_top - grid_offset_top + viewport_height) / tile_stride_px) +
|
|
588
|
-
overscan
|
|
582
|
+
Math.ceil((scroll_top - grid_offset_top + viewport_height) / tile_stride_px) + overscan
|
|
589
583
|
const end_pos = Math.min(vis_y.length, raw_end_pos)
|
|
590
584
|
return vis_y.slice(start_pos, end_pos)
|
|
591
585
|
})
|
|
@@ -610,16 +604,12 @@
|
|
|
610
604
|
})
|
|
611
605
|
let highlight_x_by_idx = $derived(
|
|
612
606
|
new SvelteSet(
|
|
613
|
-
vis_x.filter((idx) =>
|
|
614
|
-
highlight_x_key_set.has(x_items[idx].key ?? x_items[idx].label)
|
|
615
|
-
),
|
|
607
|
+
vis_x.filter((idx) => highlight_x_key_set.has(x_items[idx].key ?? x_items[idx].label)),
|
|
616
608
|
),
|
|
617
609
|
)
|
|
618
610
|
let highlight_y_by_idx = $derived(
|
|
619
611
|
new SvelteSet(
|
|
620
|
-
vis_y.filter((idx) =>
|
|
621
|
-
highlight_y_key_set.has(y_items[idx].key ?? y_items[idx].label)
|
|
622
|
-
),
|
|
612
|
+
vis_y.filter((idx) => highlight_y_key_set.has(y_items[idx].key ?? y_items[idx].label)),
|
|
623
613
|
),
|
|
624
614
|
)
|
|
625
615
|
|
|
@@ -708,18 +698,14 @@
|
|
|
708
698
|
click_timeout_id = null
|
|
709
699
|
}
|
|
710
700
|
|
|
711
|
-
function parse_cell_indices(
|
|
712
|
-
cell_el: HTMLElement,
|
|
713
|
-
): { x_idx: number; y_idx: number } | null {
|
|
701
|
+
function parse_cell_indices(cell_el: HTMLElement): { x_idx: number; y_idx: number } | null {
|
|
714
702
|
const x_value = Number(cell_el.dataset.x)
|
|
715
703
|
const y_value = Number(cell_el.dataset.y)
|
|
716
704
|
if (!Number.isInteger(x_value) || !Number.isInteger(y_value)) return null
|
|
717
705
|
return { x_idx: x_value, y_idx: y_value }
|
|
718
706
|
}
|
|
719
707
|
|
|
720
|
-
function get_cell_context_from_target(
|
|
721
|
-
event_target: EventTarget | null,
|
|
722
|
-
): CellContext | null {
|
|
708
|
+
function get_cell_context_from_target(event_target: EventTarget | null): CellContext | null {
|
|
723
709
|
const cell_el = get_cell_el_from_target(event_target)
|
|
724
710
|
if (!cell_el) return null
|
|
725
711
|
const indices = parse_cell_indices(cell_el)
|
|
@@ -740,9 +726,7 @@
|
|
|
740
726
|
}, dblclick_delay_ms)
|
|
741
727
|
}
|
|
742
728
|
|
|
743
|
-
function get_cell_el_from_target(
|
|
744
|
-
event_target: EventTarget | null,
|
|
745
|
-
): HTMLElement | null {
|
|
729
|
+
function get_cell_el_from_target(event_target: EventTarget | null): HTMLElement | null {
|
|
746
730
|
const target_node = event_target
|
|
747
731
|
if (!(target_node instanceof Element)) return null
|
|
748
732
|
if (target_node instanceof HTMLElement && target_node.dataset.x !== undefined) {
|
|
@@ -752,21 +736,14 @@
|
|
|
752
736
|
return closest_cell instanceof HTMLElement ? closest_cell : null
|
|
753
737
|
}
|
|
754
738
|
|
|
755
|
-
function update_selected_cells(
|
|
756
|
-
event: MouseEvent,
|
|
757
|
-
clicked_cell: CellPos,
|
|
758
|
-
): void {
|
|
739
|
+
function update_selected_cells(event: MouseEvent, clicked_cell: CellPos): void {
|
|
759
740
|
if (selection_mode === `single`) {
|
|
760
741
|
selected_cells = [clicked_cell]
|
|
761
742
|
last_selected_cell = clicked_cell
|
|
762
743
|
onselect?.(selected_cells)
|
|
763
744
|
return
|
|
764
745
|
}
|
|
765
|
-
if (
|
|
766
|
-
selection_mode === `range` &&
|
|
767
|
-
event.shiftKey &&
|
|
768
|
-
last_selected_cell
|
|
769
|
-
) {
|
|
746
|
+
if (selection_mode === `range` && event.shiftKey && last_selected_cell) {
|
|
770
747
|
const x_min = Math.min(last_selected_cell.x_idx, clicked_cell.x_idx)
|
|
771
748
|
const x_max = Math.max(last_selected_cell.x_idx, clicked_cell.x_idx)
|
|
772
749
|
const y_min = Math.min(last_selected_cell.y_idx, clicked_cell.y_idx)
|
|
@@ -784,8 +761,8 @@
|
|
|
784
761
|
}
|
|
785
762
|
const clicked_key = cell_pos_key(clicked_cell.x_idx, clicked_cell.y_idx)
|
|
786
763
|
const next_cells = [...selected_cells]
|
|
787
|
-
const existing_idx = next_cells.findIndex(
|
|
788
|
-
cell_pos_key(pos.x_idx, pos.y_idx) === clicked_key
|
|
764
|
+
const existing_idx = next_cells.findIndex(
|
|
765
|
+
(pos) => cell_pos_key(pos.x_idx, pos.y_idx) === clicked_key,
|
|
789
766
|
)
|
|
790
767
|
const toggle_mode = selection_mode === `multi` && (event.metaKey || event.ctrlKey)
|
|
791
768
|
if (existing_idx !== -1 && toggle_mode) next_cells.splice(existing_idx, 1)
|
|
@@ -801,8 +778,10 @@
|
|
|
801
778
|
const tw = tooltip_div.offsetWidth
|
|
802
779
|
const th = tooltip_div.offsetHeight
|
|
803
780
|
// Flip to opposite side of cursor when near viewport edges
|
|
804
|
-
const left =
|
|
805
|
-
|
|
781
|
+
const left =
|
|
782
|
+
client_x + 10 + tw > globalThis.innerWidth ? client_x - 10 - tw : client_x + 10
|
|
783
|
+
const top =
|
|
784
|
+
client_y + 12 + th > globalThis.innerHeight ? client_y - 12 - th : client_y + 12
|
|
806
785
|
tooltip_div.style.left = `${Math.max(0, left)}px`
|
|
807
786
|
tooltip_div.style.top = `${Math.max(0, top)}px`
|
|
808
787
|
}
|
|
@@ -813,19 +792,12 @@
|
|
|
813
792
|
}
|
|
814
793
|
|
|
815
794
|
// Write default tooltip content imperatively (no reactive state)
|
|
816
|
-
function update_tooltip_content(
|
|
817
|
-
td: HTMLElement,
|
|
818
|
-
x_idx: number,
|
|
819
|
-
y_idx: number,
|
|
820
|
-
): void {
|
|
795
|
+
function update_tooltip_content(td: HTMLElement, x_idx: number, y_idx: number): void {
|
|
821
796
|
const x_label = x_items[x_idx]?.label ?? ``
|
|
822
797
|
const y_label = y_items[y_idx]?.label ?? ``
|
|
823
798
|
const val = get_value(x_idx, y_idx)
|
|
824
|
-
const value_str =
|
|
825
|
-
? ``
|
|
826
|
-
: typeof val === `number`
|
|
827
|
-
? format_num(val)
|
|
828
|
-
: String(val)
|
|
799
|
+
const value_str =
|
|
800
|
+
val == null ? `` : typeof val === `number` ? format_num(val) : String(val)
|
|
829
801
|
td.textContent = value_str
|
|
830
802
|
? `${x_label} - ${y_label}: ${value_str}`
|
|
831
803
|
: `${x_label} - ${y_label}`
|
|
@@ -873,8 +845,8 @@
|
|
|
873
845
|
// Clear active state imperatively
|
|
874
846
|
last_hover_x = -1
|
|
875
847
|
last_hover_y = -1
|
|
876
|
-
const keep_tooltip_visible =
|
|
877
|
-
(tooltip_mode === `both` && pinned_cell !== null)
|
|
848
|
+
const keep_tooltip_visible =
|
|
849
|
+
tooltip_mode === `pinned` || (tooltip_mode === `both` && pinned_cell !== null)
|
|
878
850
|
if (!keep_tooltip_visible) {
|
|
879
851
|
tooltip_div?.classList.remove(`visible`)
|
|
880
852
|
}
|
|
@@ -982,10 +954,7 @@
|
|
|
982
954
|
for (let step_idx = 0; step_idx < max_steps; step_idx++) {
|
|
983
955
|
next_x += x_step
|
|
984
956
|
next_y += y_step
|
|
985
|
-
if (
|
|
986
|
-
next_x < 0 || next_y < 0 || next_x >= x_items.length ||
|
|
987
|
-
next_y >= y_items.length
|
|
988
|
-
) {
|
|
957
|
+
if (next_x < 0 || next_y < 0 || next_x >= x_items.length || next_y >= y_items.length) {
|
|
989
958
|
return
|
|
990
959
|
}
|
|
991
960
|
if (is_hidden_cell(next_x, next_y)) continue
|
|
@@ -1078,23 +1047,19 @@
|
|
|
1078
1047
|
let legend_wrapper_style = $derived.by(() =>
|
|
1079
1048
|
legend_position === `right`
|
|
1080
1049
|
? `--cbar-height: 120px; --cbar-min-height: 120px; --cbar-max-height: 120px;`
|
|
1081
|
-
: `--cbar-width: 180px
|
|
1050
|
+
: `--cbar-width: 180px;`,
|
|
1082
1051
|
)
|
|
1083
1052
|
|
|
1084
1053
|
let has_interaction_handlers = $derived(
|
|
1085
1054
|
!disabled &&
|
|
1086
|
-
(
|
|
1087
|
-
Boolean(onclick) ||
|
|
1055
|
+
(Boolean(onclick) ||
|
|
1088
1056
|
Boolean(ondblclick) ||
|
|
1089
1057
|
Boolean(oncontextmenu) ||
|
|
1090
1058
|
selection_mode !== `single` ||
|
|
1091
|
-
tooltip_mode !== `hover`
|
|
1092
|
-
),
|
|
1059
|
+
tooltip_mode !== `hover`),
|
|
1093
1060
|
)
|
|
1094
1061
|
let cell_tag_name = $derived(has_interaction_handlers ? `button` : `div`)
|
|
1095
|
-
let cell_class_name = $derived(
|
|
1096
|
-
has_interaction_handlers ? `cell interactive` : `cell`,
|
|
1097
|
-
)
|
|
1062
|
+
let cell_class_name = $derived(has_interaction_handlers ? `cell interactive` : `cell`)
|
|
1098
1063
|
|
|
1099
1064
|
// Tooltip state: only used for custom tooltip snippets (function tooltips)
|
|
1100
1065
|
let tooltip_cell: CellContext | null = $state(null)
|
|
@@ -1103,7 +1068,8 @@
|
|
|
1103
1068
|
keys_a.length === keys_b.length && keys_a.every((key, idx) => key === keys_b[idx])
|
|
1104
1069
|
let prev_axis_keys: { x: string[]; y: string[] } | null = null
|
|
1105
1070
|
$effect(() => {
|
|
1106
|
-
const changed =
|
|
1071
|
+
const changed =
|
|
1072
|
+
prev_axis_keys !== null &&
|
|
1107
1073
|
!(keys_equal(x_keys, prev_axis_keys.x) && keys_equal(y_keys, prev_axis_keys.y))
|
|
1108
1074
|
prev_axis_keys = { x: x_keys, y: y_keys }
|
|
1109
1075
|
if (!changed) return
|
|
@@ -1151,8 +1117,8 @@
|
|
|
1151
1117
|
bind:search_query
|
|
1152
1118
|
{export_formats}
|
|
1153
1119
|
onexport={onexport
|
|
1154
|
-
|
|
1155
|
-
|
|
1120
|
+
? (fmt: HeatmapExportFormat) => onexport(fmt, build_export_payload(fmt))
|
|
1121
|
+
: undefined}
|
|
1156
1122
|
toggle_visible
|
|
1157
1123
|
children={controls_children}
|
|
1158
1124
|
{...controls_props}
|
|
@@ -1161,12 +1127,14 @@
|
|
|
1161
1127
|
<div
|
|
1162
1128
|
{...rest}
|
|
1163
1129
|
bind:this={matrix_el}
|
|
1164
|
-
class=
|
|
1130
|
+
class={[`grid`, `theme-${theme}`, rest.class]}
|
|
1165
1131
|
style:--n-cols={gaps_mode ? x_items.length : grid_col_count}
|
|
1166
1132
|
style:--n-rows={gaps_mode ? y_items.length : grid_row_count}
|
|
1167
|
-
style:--extra-right-y={
|
|
1133
|
+
style:--extra-right-y={use_side_split_y_labels || symmetric === `upper` ? 1 : 0}
|
|
1168
1134
|
style:--extra-bottom-x={use_side_split_x_labels ? 1 : 0}
|
|
1169
|
-
style:--right-y-track={
|
|
1135
|
+
style:--right-y-track={use_side_split_y_labels || symmetric === `upper`
|
|
1136
|
+
? `max-content`
|
|
1137
|
+
: `0`}
|
|
1170
1138
|
style:--bottom-x-track={use_side_split_x_labels ? `max-content` : `0`}
|
|
1171
1139
|
style:--tile-size={tile_size}
|
|
1172
1140
|
style:--heatmap-gridline-color={gridline_color}
|
|
@@ -1241,6 +1209,11 @@
|
|
|
1241
1209
|
{@const bg = bg_flat[flat_idx]}
|
|
1242
1210
|
{@const should_render = !is_hidden_cell(x_idx, y_idx)}
|
|
1243
1211
|
{#if should_render}
|
|
1212
|
+
{@const raw = get_value(x_idx, y_idx)}
|
|
1213
|
+
<!-- missing-state must match bg_flat, which colors from the transformed value -->
|
|
1214
|
+
{@const cell_missing = cell_is_missing(
|
|
1215
|
+
typeof raw === `number` ? get_transformed_value(x_idx, y_idx) : raw,
|
|
1216
|
+
)}
|
|
1244
1217
|
<svelte:element
|
|
1245
1218
|
this={cell_tag_name}
|
|
1246
1219
|
class={cell_class_name}
|
|
@@ -1249,6 +1222,7 @@
|
|
|
1249
1222
|
class:animated={animate_updates}
|
|
1250
1223
|
data-x={x_idx}
|
|
1251
1224
|
data-y={y_idx}
|
|
1225
|
+
style={cell_missing ? missing.style : undefined}
|
|
1252
1226
|
style:background-color={bg}
|
|
1253
1227
|
style:color={text_flat?.[flat_idx]}
|
|
1254
1228
|
style:--heatmap-selected-outline-color={selected_outline_flat[flat_idx]}
|
|
@@ -1257,15 +1231,14 @@
|
|
|
1257
1231
|
>
|
|
1258
1232
|
{#if cell}
|
|
1259
1233
|
{@render cell(build_cell_context(x_idx, y_idx))}
|
|
1260
|
-
{:else if
|
|
1261
|
-
{
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1234
|
+
{:else if cell_missing}
|
|
1235
|
+
{#if missing.label}<span class="cell-value">{missing.label}</span>{/if}
|
|
1236
|
+
{:else if show_values && raw !== null}
|
|
1237
|
+
<span class="cell-value"
|
|
1238
|
+
>{typeof raw === `number`
|
|
1265
1239
|
? format_num(raw, show_values === true ? `.3~g` : show_values)
|
|
1266
|
-
: raw
|
|
1267
|
-
|
|
1268
|
-
{/if}
|
|
1240
|
+
: raw}</span
|
|
1241
|
+
>
|
|
1269
1242
|
{/if}
|
|
1270
1243
|
</svelte:element>
|
|
1271
1244
|
{:else}
|
|
@@ -1273,8 +1246,7 @@
|
|
|
1273
1246
|
class="cell empty"
|
|
1274
1247
|
style:grid-column={cell_grid_col(x_idx)}
|
|
1275
1248
|
style:grid-row={cell_grid_row(y_idx)}
|
|
1276
|
-
>
|
|
1277
|
-
</div>
|
|
1249
|
+
></div>
|
|
1278
1250
|
{/if}
|
|
1279
1251
|
{/each}
|
|
1280
1252
|
{/each}
|
|
@@ -1379,25 +1351,17 @@
|
|
|
1379
1351
|
.grid {
|
|
1380
1352
|
display: grid;
|
|
1381
1353
|
grid-template-columns:
|
|
1382
|
-
max-content repeat(
|
|
1383
|
-
var(--
|
|
1384
|
-
minmax(var(--tile-size, 6px), 1fr)
|
|
1385
|
-
) var(--right-y-track, 0);
|
|
1354
|
+
max-content repeat(var(--n-cols), minmax(var(--tile-size, 6px), 1fr))
|
|
1355
|
+
var(--right-y-track, 0);
|
|
1386
1356
|
grid-template-rows:
|
|
1387
|
-
max-content repeat(
|
|
1388
|
-
var(--
|
|
1389
|
-
minmax(var(--tile-size, 6px), 1fr)
|
|
1390
|
-
) var(--bottom-x-track, 0);
|
|
1357
|
+
max-content repeat(var(--n-rows), minmax(var(--tile-size, 6px), 1fr))
|
|
1358
|
+
var(--bottom-x-track, 0);
|
|
1391
1359
|
position: relative;
|
|
1392
1360
|
width: min(100%, var(--heatmap-max-width, 1200px));
|
|
1393
1361
|
max-width: var(--heatmap-max-width, 1200px);
|
|
1394
1362
|
aspect-ratio: calc(
|
|
1395
|
-
(
|
|
1396
|
-
var(--n-
|
|
1397
|
-
)
|
|
1398
|
-
/ (
|
|
1399
|
-
var(--n-rows) + 1 + var(--extra-bottom-x, 0)
|
|
1400
|
-
)
|
|
1363
|
+
(var(--n-cols) + 1 + var(--extra-right-y, 0)) /
|
|
1364
|
+
(var(--n-rows) + 1 + var(--extra-bottom-x, 0))
|
|
1401
1365
|
);
|
|
1402
1366
|
overflow: auto;
|
|
1403
1367
|
&.theme-publication {
|
|
@@ -1527,10 +1491,7 @@
|
|
|
1527
1491
|
display: none;
|
|
1528
1492
|
position: fixed;
|
|
1529
1493
|
transform: none;
|
|
1530
|
-
background: var(
|
|
1531
|
-
--tooltip-bg,
|
|
1532
|
-
light-dark(rgba(255, 255, 255, 0.95), rgba(0, 0, 0, 0.85))
|
|
1533
|
-
);
|
|
1494
|
+
background: var(--tooltip-bg, light-dark(rgba(255, 255, 255, 0.95), rgba(0, 0, 0, 0.85)));
|
|
1534
1495
|
color: var(--tooltip-color, light-dark(#222, #eee));
|
|
1535
1496
|
padding: var(--tooltip-padding, 4px 6px);
|
|
1536
1497
|
border-radius: var(--tooltip-border-radius, var(--border-radius, 3pt));
|
|
@@ -4,7 +4,7 @@ import type { AxisConfig } from '../plot';
|
|
|
4
4
|
import { type ComponentProps, type Snippet } from 'svelte';
|
|
5
5
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
6
6
|
import HeatmapMatrixControls from './HeatmapMatrixControls.svelte';
|
|
7
|
-
import type { AxisItem, CellContext, DomainMode, HeatmapExportFormat, HeatmapTooltipProp, LegendPosition, NormalizeMode, SymmetricMode } from './index';
|
|
7
|
+
import type { AxisItem, CellContext, DomainMode, HeatmapExportFormat, HeatmapTooltipProp, LegendPosition, MissingCellStyle, NormalizeMode, SymmetricMode } from './index';
|
|
8
8
|
type CellValue = number | string | null;
|
|
9
9
|
type SelectionMode = `single` | `multi` | `range`;
|
|
10
10
|
type AxisOrderKey = `label` | `key` | `sort_value`;
|
|
@@ -20,7 +20,7 @@ type $$ComponentProps = Omit<HTMLAttributes<HTMLDivElement>, `onclick` | `ondblc
|
|
|
20
20
|
color_scale?: D3InterpolateName | ((val: number) => string);
|
|
21
21
|
color_scale_range?: [number | null, number | null];
|
|
22
22
|
color_overrides?: Record<string, string>;
|
|
23
|
-
|
|
23
|
+
missing?: MissingCellStyle;
|
|
24
24
|
log?: boolean;
|
|
25
25
|
value_transform?: (value: number, ctx: {
|
|
26
26
|
x_item: AxisItem;
|
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
import type { PaneProps, PaneToggleProps } from '../overlays'
|
|
3
3
|
import DraggablePane from '../overlays/DraggablePane.svelte'
|
|
4
4
|
import type { ComponentProps, Snippet } from 'svelte'
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { ELEMENT_ORDERINGS, ORDERING_LABELS } from './index'
|
|
6
|
+
import type {
|
|
7
|
+
ElementAxisOrderingKey,
|
|
8
|
+
DomainMode,
|
|
9
|
+
HeatmapExportFormat,
|
|
10
|
+
LegendPosition,
|
|
11
|
+
NormalizeMode,
|
|
12
|
+
SymmetricMode,
|
|
8
13
|
} from './index'
|
|
9
|
-
import type { ElementAxisOrderingKey, DomainMode, HeatmapExportFormat, LegendPosition, NormalizeMode, SymmetricMode } from './index'
|
|
10
14
|
|
|
11
15
|
let {
|
|
12
16
|
ordering = $bindable(`atomic_number`),
|
|
@@ -53,9 +57,7 @@
|
|
|
53
57
|
} = $props()
|
|
54
58
|
|
|
55
59
|
function merge_styles(base_style: string, override_style: unknown): string {
|
|
56
|
-
const override_style_str = typeof override_style === `string`
|
|
57
|
-
? override_style
|
|
58
|
-
: ``
|
|
60
|
+
const override_style_str = typeof override_style === `string` ? override_style : ``
|
|
59
61
|
return override_style_str ? `${base_style}; ${override_style_str}` : base_style
|
|
60
62
|
}
|
|
61
63
|
|
|
@@ -25,6 +25,6 @@ type $$ComponentProps = {
|
|
|
25
25
|
controls_open: boolean;
|
|
26
26
|
}]>;
|
|
27
27
|
};
|
|
28
|
-
declare const HeatmapMatrixControls: import("svelte").Component<$$ComponentProps, {}, "normalize" | "show_values" | "show_legend" | "controls_open" | "ordering" | "
|
|
28
|
+
declare const HeatmapMatrixControls: import("svelte").Component<$$ComponentProps, {}, "normalize" | "theme" | "show_values" | "show_legend" | "controls_open" | "ordering" | "search_query" | "toggle_visible" | "domain_mode" | "legend_position" | "symmetric" | "show_row_summaries" | "show_col_summaries">;
|
|
29
29
|
type HeatmapMatrixControls = ReturnType<typeof HeatmapMatrixControls>;
|
|
30
30
|
export default HeatmapMatrixControls;
|
|
@@ -17,6 +17,11 @@ export type CellContext = {
|
|
|
17
17
|
value: number | string | null;
|
|
18
18
|
bg_color: string | null;
|
|
19
19
|
};
|
|
20
|
+
export interface MissingCellStyle {
|
|
21
|
+
color?: `element-category` | (string & {});
|
|
22
|
+
label?: string;
|
|
23
|
+
style?: string;
|
|
24
|
+
}
|
|
20
25
|
export declare const ORDERING_LABELS: {
|
|
21
26
|
readonly atomic_number: "Atomic Number";
|
|
22
27
|
readonly mendeleev_number: "Pettifor Chemical Similarity";
|
package/dist/icons.d.ts
CHANGED
|
@@ -540,6 +540,10 @@ export declare const ICON_DATA: {
|
|
|
540
540
|
readonly viewBox: "0 0 24 24";
|
|
541
541
|
readonly path: "<path fill=\"currentColor\" d=\"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2M4 4h5v16H4zm7 0h9v8h-9zm0 10h9v6h-9z\"/>";
|
|
542
542
|
};
|
|
543
|
+
readonly Grid2x2: {
|
|
544
|
+
readonly viewBox: "0 0 24 24";
|
|
545
|
+
readonly path: "<path fill=\"currentColor\" d=\"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2M4 4h7v7H4zm0 9h7v7H4zm9-9h7v7h-7zm0 9h7v7h-7z\"/>";
|
|
546
|
+
};
|
|
543
547
|
readonly FermiSurface: {
|
|
544
548
|
readonly viewBox: "0 0 24 24";
|
|
545
549
|
readonly stroke: "currentColor";
|
package/dist/icons.js
CHANGED
|
@@ -620,6 +620,10 @@ export const ICON_DATA = {
|
|
|
620
620
|
viewBox: `0 0 24 24`,
|
|
621
621
|
path: `<path fill="currentColor" d="M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2M4 4h5v16H4zm7 0h9v8h-9zm0 10h9v6h-9z"/>`,
|
|
622
622
|
},
|
|
623
|
+
Grid2x2: {
|
|
624
|
+
viewBox: `0 0 24 24`,
|
|
625
|
+
path: `<path fill="currentColor" d="M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2M4 4h7v7H4zm0 9h7v7H4zm9-9h7v7h-7zm0 9h7v7h-7z"/>`,
|
|
626
|
+
},
|
|
623
627
|
FermiSurface: {
|
|
624
628
|
viewBox: `0 0 24 24`,
|
|
625
629
|
stroke: `currentColor`,
|