matterviz 0.4.0 → 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 +132 -219
- package/dist/brillouin/BrillouinZone.svelte.d.ts +9 -20
- package/dist/brillouin/BrillouinZoneControls.svelte +3 -6
- package/dist/brillouin/BrillouinZoneExportPane.svelte +47 -96
- package/dist/brillouin/BrillouinZoneExportPane.svelte.d.ts +1 -1
- package/dist/brillouin/BrillouinZoneInfoPane.svelte +15 -42
- package/dist/brillouin/BrillouinZoneInfoPane.svelte.d.ts +2 -3
- package/dist/brillouin/BrillouinZoneScene.svelte +63 -230
- package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +3 -23
- package/dist/brillouin/ReciprocalVectors.svelte +39 -0
- package/dist/brillouin/ReciprocalVectors.svelte.d.ts +9 -0
- package/dist/brillouin/compute.d.ts +2 -0
- package/dist/brillouin/compute.js +80 -77
- package/dist/brillouin/geometry.d.ts +8 -0
- package/dist/brillouin/geometry.js +57 -0
- package/dist/brillouin/index.d.ts +2 -0
- package/dist/brillouin/index.js +2 -0
- package/dist/brillouin/types.d.ts +2 -2
- package/dist/chempot-diagram/ChemPotDiagram.svelte +33 -38
- package/dist/chempot-diagram/ChemPotDiagram.svelte.d.ts +1 -1
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +143 -246
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +4 -1
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +652 -976
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +7 -1
- package/dist/chempot-diagram/async-compute.svelte.js +1 -1
- package/dist/chempot-diagram/color.d.ts +3 -6
- package/dist/chempot-diagram/color.js +5 -5
- package/dist/chempot-diagram/compute.d.ts +3 -3
- package/dist/chempot-diagram/compute.js +3 -1
- package/dist/chempot-diagram/controls-state.svelte.d.ts +10 -0
- package/dist/chempot-diagram/controls-state.svelte.js +42 -0
- package/dist/chempot-diagram/export.d.ts +47 -0
- package/dist/chempot-diagram/export.js +133 -0
- package/dist/chempot-diagram/index.d.ts +1 -0
- package/dist/chempot-diagram/index.js +1 -0
- package/dist/chempot-diagram/pointer.d.ts +0 -10
- package/dist/chempot-diagram/pointer.js +4 -4
- package/dist/chempot-diagram/types.d.ts +3 -3
- package/dist/colors/index.d.ts +0 -4
- package/dist/colors/index.js +21 -22
- 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 +96 -98
- package/dist/composition/PieChart.svelte +60 -46
- package/dist/composition/chem-sys.js +3 -2
- package/dist/composition/format.js +4 -3
- package/dist/composition/index.d.ts +2 -0
- package/dist/composition/index.js +14 -0
- package/dist/composition/parse.d.ts +2 -3
- package/dist/composition/parse.js +27 -28
- package/dist/constants.js +11 -9
- package/dist/controls.d.ts +1 -0
- package/dist/controls.js +0 -1
- package/dist/convex-hull/ConvexHull.svelte +20 -25
- package/dist/convex-hull/ConvexHull.svelte.d.ts +1 -4
- package/dist/convex-hull/ConvexHull2D.svelte +176 -256
- package/dist/convex-hull/ConvexHull2D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull3D.svelte +269 -804
- package/dist/convex-hull/ConvexHull3D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull4D.svelte +236 -755
- package/dist/convex-hull/ConvexHull4D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHullChrome.svelte +264 -0
- package/dist/convex-hull/ConvexHullChrome.svelte.d.ts +30 -0
- package/dist/convex-hull/ConvexHullControls.svelte +128 -49
- package/dist/convex-hull/ConvexHullControls.svelte.d.ts +7 -6
- package/dist/convex-hull/ConvexHullInfoPane.svelte +18 -5
- package/dist/convex-hull/ConvexHullInfoPane.svelte.d.ts +6 -5
- package/dist/convex-hull/ConvexHullStats.svelte +210 -351
- package/dist/convex-hull/ConvexHullStats.svelte.d.ts +3 -1
- package/dist/convex-hull/ConvexHullTooltip.svelte +16 -14
- package/dist/convex-hull/ConvexHullTooltip.svelte.d.ts +2 -1
- 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/barycentric-coords.d.ts +2 -4
- package/dist/convex-hull/barycentric-coords.js +6 -33
- package/dist/convex-hull/canvas-interactions.svelte.d.ts +79 -0
- package/dist/convex-hull/canvas-interactions.svelte.js +279 -0
- package/dist/convex-hull/helpers.d.ts +47 -17
- package/dist/convex-hull/helpers.js +186 -101
- package/dist/convex-hull/hull-state.svelte.d.ts +44 -0
- package/dist/convex-hull/hull-state.svelte.js +124 -0
- package/dist/convex-hull/index.d.ts +9 -7
- package/dist/convex-hull/index.js +7 -2
- package/dist/convex-hull/thermodynamics.js +109 -937
- package/dist/convex-hull/types.d.ts +12 -4
- package/dist/convex-hull/types.js +12 -0
- package/dist/coordination/CoordinationBarPlot.svelte +41 -43
- 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 +6 -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/ElementTile.svelte.d.ts +1 -1
- 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 -0
- package/dist/element/index.js +3 -0
- package/dist/feedback/DragOverlay.svelte +5 -3
- package/dist/feedback/DragOverlay.svelte.d.ts +2 -1
- package/dist/feedback/StatusMessage.svelte +20 -7
- package/dist/fermi-surface/FermiSlice.svelte +21 -18
- package/dist/fermi-surface/FermiSurface.svelte +78 -165
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +9 -20
- package/dist/fermi-surface/FermiSurfaceControls.svelte +6 -20
- package/dist/fermi-surface/FermiSurfaceScene.svelte +93 -272
- package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +3 -23
- package/dist/fermi-surface/FermiSurfaceTooltip.svelte +9 -6
- package/dist/fermi-surface/compute.js +14 -13
- package/dist/fermi-surface/export.js +4 -15
- package/dist/fermi-surface/index.d.ts +0 -1
- package/dist/fermi-surface/index.js +0 -1
- package/dist/fermi-surface/parse.d.ts +1 -1
- package/dist/fermi-surface/parse.js +84 -97
- package/dist/fermi-surface/types.d.ts +2 -2
- package/dist/heatmap-matrix/HeatmapMatrix.svelte +161 -185
- package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +6 -5
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +12 -9
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +5 -5
- package/dist/heatmap-matrix/index.d.ts +8 -2
- package/dist/icons.d.ts +4 -0
- package/dist/icons.js +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/io/ExportPane.svelte +170 -0
- package/dist/io/ExportPane.svelte.d.ts +17 -0
- package/dist/io/decompress.d.ts +2 -1
- package/dist/io/decompress.js +22 -36
- package/dist/io/export.d.ts +9 -1
- package/dist/io/export.js +37 -29
- package/dist/io/fetch.d.ts +2 -4
- package/dist/io/fetch.js +0 -11
- package/dist/io/file-drop.d.ts +7 -0
- package/dist/io/file-drop.js +13 -0
- package/dist/io/index.d.ts +1 -0
- package/dist/io/index.js +3 -0
- package/dist/io/is-binary.d.ts +9 -0
- package/dist/io/is-binary.js +45 -1
- package/dist/io/types.d.ts +13 -0
- 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 +50 -48
- package/dist/labels.d.ts +6 -2
- package/dist/labels.js +44 -14
- package/dist/layout/FullscreenButton.svelte +34 -0
- package/dist/layout/FullscreenButton.svelte.d.ts +10 -0
- package/dist/layout/FullscreenToggle.svelte +12 -12
- 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 +115 -0
- package/dist/layout/ViewerChrome.svelte.d.ts +18 -0
- package/dist/layout/fullscreen.d.ts +4 -0
- package/dist/layout/fullscreen.js +3 -5
- package/dist/layout/fullscreen.svelte.d.ts +8 -0
- package/dist/layout/fullscreen.svelte.js +36 -0
- package/dist/layout/index.d.ts +4 -0
- package/dist/layout/index.js +4 -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 +9 -3
- package/dist/math.js +37 -21
- 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 +11 -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 +115 -146
- 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 +73 -96
- package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +4 -3
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +4 -2
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte.d.ts +2 -3
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte +49 -134
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte.d.ts +3 -4
- 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/colors.js +1 -1
- package/dist/phase-diagram/diagram-input.d.ts +1 -2
- package/dist/phase-diagram/parse.d.ts +2 -1
- 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 +494 -692
- package/dist/plot/bar/BarPlot.svelte.d.ts +9 -15
- package/dist/plot/bar/BarPlotControls.svelte +1 -3
- package/dist/plot/bar/BarPlotControls.svelte.d.ts +5 -7
- package/dist/plot/bar/SpacegroupBarPlot.svelte +31 -37
- package/dist/plot/bar/data.d.ts +5 -4
- package/dist/plot/bar/data.js +2 -1
- package/dist/plot/box/BoxPlot.svelte +361 -439
- package/dist/plot/box/BoxPlot.svelte.d.ts +6 -3
- package/dist/plot/box/BoxPlotControls.svelte.d.ts +1 -1
- package/dist/plot/box/Violin.svelte.d.ts +2 -1
- package/dist/plot/box/box-plot.d.ts +3 -2
- package/dist/plot/box/box-plot.js +6 -3
- package/dist/plot/box/kde.d.ts +2 -1
- package/dist/plot/box/kde.js +4 -4
- package/dist/plot/core/auto-place.d.ts +1 -1
- package/dist/plot/core/auto-place.js +5 -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 +106 -111
- package/dist/plot/core/components/ColorBar.svelte.d.ts +5 -4
- 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 +21 -11
- package/dist/plot/core/components/Line.svelte.d.ts +5 -2
- package/dist/plot/core/components/PlotAxis.svelte +42 -18
- package/dist/plot/core/components/PlotAxis.svelte.d.ts +2 -1
- package/dist/plot/core/components/PlotControls.svelte +65 -41
- package/dist/plot/core/components/PlotControls.svelte.d.ts +1 -1
- 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 +56 -59
- package/dist/plot/core/components/ReferenceLine3D.svelte.d.ts +4 -4
- package/dist/plot/core/components/ReferencePlane.svelte +9 -10
- package/dist/plot/core/components/ReferencePlane.svelte.d.ts +4 -4
- 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 +29 -476
- package/dist/plot/core/data-transform.js +9 -5
- package/dist/plot/core/fill-utils.d.ts +7 -4
- package/dist/plot/core/fill-utils.js +34 -9
- package/dist/plot/core/index.d.ts +1 -0
- package/dist/plot/core/index.js +1 -0
- package/dist/plot/core/interactions.d.ts +5 -1
- package/dist/plot/core/interactions.js +14 -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/pan-zoom.svelte.d.ts +35 -0
- package/dist/plot/core/pan-zoom.svelte.js +221 -0
- package/dist/plot/core/placed-tween.svelte.d.ts +21 -0
- package/dist/plot/core/placed-tween.svelte.js +68 -0
- package/dist/plot/core/reference-line.d.ts +10 -10
- package/dist/plot/core/reference-line.js +7 -7
- package/dist/plot/core/scales.d.ts +40 -25
- package/dist/plot/core/scales.js +49 -21
- package/dist/plot/core/svg.d.ts +2 -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 +47 -331
- 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.d.ts +1 -1
- package/dist/plot/core/utils/label-placement.js +5 -5
- package/dist/plot/core/utils.d.ts +2 -1
- package/dist/plot/histogram/Histogram.svelte +373 -631
- package/dist/plot/histogram/Histogram.svelte.d.ts +7 -7
- package/dist/plot/histogram/HistogramControls.svelte +30 -28
- package/dist/plot/histogram/HistogramControls.svelte.d.ts +1 -1
- 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 +79 -73
- package/dist/plot/sankey/Sankey.svelte.d.ts +3 -3
- package/dist/plot/sankey/SankeyControls.svelte +22 -16
- package/dist/plot/sankey/sankey.js +3 -1
- package/dist/plot/scatter/BinnedScatterPlot.svelte +264 -112
- package/dist/plot/scatter/BinnedScatterPlot.svelte.d.ts +11 -4
- package/dist/plot/scatter/ElementScatter.svelte +4 -1
- package/dist/plot/scatter/ScatterPlot.svelte +623 -821
- package/dist/plot/scatter/ScatterPlot.svelte.d.ts +9 -15
- 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 +6 -12
- package/dist/plot/scatter/binned-scatter-types.js +6 -1
- package/dist/plot/scatter/index.d.ts +1 -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 +40 -60
- package/dist/plot/scatter-3d/ScatterPlot3D.svelte.d.ts +6 -14
- package/dist/plot/scatter-3d/ScatterPlot3DControls.svelte +17 -15
- package/dist/plot/scatter-3d/ScatterPlot3DControls.svelte.d.ts +5 -5
- package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte +232 -234
- package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte.d.ts +5 -14
- package/dist/plot/scatter-3d/Surface3D.svelte +9 -17
- package/dist/plot/scatter-3d/Surface3D.svelte.d.ts +4 -3
- package/dist/plot/sunburst/Sunburst.svelte +256 -338
- package/dist/plot/sunburst/Sunburst.svelte.d.ts +4 -3
- 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 +14 -4
- 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 +14 -3
- package/dist/scene/SceneCamera.svelte +62 -0
- package/dist/scene/SceneCamera.svelte.d.ts +19 -0
- package/dist/scene/bind-renderer.svelte.d.ts +2 -0
- package/dist/scene/bind-renderer.svelte.js +22 -0
- package/dist/scene/index.d.ts +4 -0
- package/dist/scene/index.js +5 -0
- package/dist/scene/props.js +52 -0
- package/dist/scene/types.d.ts +26 -0
- package/dist/scene/types.js +1 -0
- package/dist/settings.d.ts +33 -11
- package/dist/settings.js +136 -51
- package/dist/spectral/Bands.svelte +231 -237
- package/dist/spectral/Bands.svelte.d.ts +3 -2
- package/dist/spectral/BandsAndDos.svelte +29 -29
- package/dist/spectral/BrillouinBandsDos.svelte +21 -29
- package/dist/spectral/Dos.svelte +75 -77
- package/dist/spectral/Dos.svelte.d.ts +2 -1
- package/dist/spectral/helpers.d.ts +9 -9
- package/dist/spectral/helpers.js +66 -70
- package/dist/state.svelte.d.ts +0 -7
- package/dist/state.svelte.js +5 -24
- package/dist/structure/Arrow.svelte +6 -21
- 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 +16 -3
- package/dist/structure/CellSelect.svelte +22 -29
- package/dist/structure/CellSelect.svelte.d.ts +2 -1
- 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 +725 -735
- package/dist/structure/Structure.svelte.d.ts +8 -16
- package/dist/structure/StructureCarousel.svelte +630 -0
- package/dist/structure/StructureCarousel.svelte.d.ts +19 -0
- package/dist/structure/StructureControls.svelte +298 -325
- package/dist/structure/StructureControls.svelte.d.ts +5 -3
- package/dist/structure/StructureExportPane.svelte +62 -168
- package/dist/structure/StructureExportPane.svelte.d.ts +4 -5
- package/dist/structure/StructureInfoPane.svelte +77 -69
- package/dist/structure/StructureInfoPane.svelte.d.ts +6 -6
- package/dist/structure/StructureScene.svelte +758 -600
- package/dist/structure/StructureScene.svelte.d.ts +24 -20
- package/dist/structure/StructureViewport.svelte +386 -0
- package/dist/structure/StructureViewport.svelte.d.ts +63 -0
- package/dist/structure/atom-label-placement.d.ts +18 -0
- package/dist/structure/atom-label-placement.js +115 -0
- package/dist/structure/atom-properties.d.ts +3 -1
- package/dist/structure/atom-properties.js +115 -54
- package/dist/structure/bond-order-perception.js +2 -4
- package/dist/structure/bonding.d.ts +12 -2
- package/dist/structure/bonding.js +172 -73
- package/dist/structure/edit-history.d.ts +6 -0
- package/dist/structure/edit-history.js +27 -0
- package/dist/structure/export.d.ts +25 -4
- package/dist/structure/export.js +103 -153
- 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 +18 -1
- package/dist/structure/index.js +15 -2
- package/dist/structure/measure.d.ts +1 -1
- package/dist/structure/measure.js +6 -12
- package/dist/structure/parse.d.ts +5 -3
- package/dist/structure/parse.js +551 -567
- package/dist/structure/partial-occupancy.d.ts +0 -1
- package/dist/structure/partial-occupancy.js +5 -3
- package/dist/structure/pbc.d.ts +1 -1
- package/dist/structure/pbc.js +204 -51
- package/dist/structure/polyhedra.d.ts +40 -0
- package/dist/structure/polyhedra.js +587 -0
- package/dist/structure/site.d.ts +4 -0
- package/dist/structure/site.js +1 -0
- package/dist/structure/supercell.d.ts +1 -2
- package/dist/structure/supercell.js +10 -15
- package/dist/structure/validation.js +5 -6
- package/dist/symmetry/SymmetryElementControls.svelte +69 -0
- package/dist/symmetry/SymmetryElementControls.svelte.d.ts +9 -0
- package/dist/symmetry/SymmetryElements.svelte +350 -0
- package/dist/symmetry/SymmetryElements.svelte.d.ts +24 -0
- package/dist/symmetry/SymmetryStats.svelte +142 -49
- package/dist/symmetry/WyckoffTable.svelte +58 -16
- package/dist/symmetry/WyckoffTable.svelte.d.ts +3 -0
- package/dist/symmetry/cell-transform.js +8 -14
- package/dist/symmetry/index.d.ts +15 -4
- package/dist/symmetry/index.js +308 -81
- package/dist/symmetry/spacegroups.d.ts +5 -1
- package/dist/symmetry/spacegroups.js +18 -3
- package/dist/symmetry/symmetry-elements.d.ts +33 -0
- package/dist/symmetry/symmetry-elements.js +521 -0
- package/dist/symmetry/wyckoff-db.d.ts +9 -0
- package/dist/symmetry/wyckoff-db.js +87 -0
- package/dist/table/HeatmapTable.svelte +1104 -378
- 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 +556 -352
- package/dist/trajectory/Trajectory.svelte.d.ts +10 -22
- package/dist/trajectory/TrajectoryError.svelte +11 -8
- package/dist/trajectory/TrajectoryExportPane.svelte +28 -54
- package/dist/trajectory/TrajectoryExportPane.svelte.d.ts +4 -5
- package/dist/trajectory/TrajectoryInfoPane.svelte +88 -99
- package/dist/trajectory/TrajectoryInfoPane.svelte.d.ts +3 -2
- package/dist/trajectory/constants.js +6 -2
- package/dist/trajectory/extract.js +73 -71
- package/dist/trajectory/format-detect.d.ts +0 -1
- package/dist/trajectory/format-detect.js +13 -17
- package/dist/trajectory/frame-reader.d.ts +2 -1
- package/dist/trajectory/frame-reader.js +74 -136
- package/dist/trajectory/helpers.d.ts +12 -2
- package/dist/trajectory/helpers.js +68 -37
- package/dist/trajectory/index.d.ts +1 -0
- package/dist/trajectory/index.js +3 -0
- package/dist/trajectory/parse/ase.d.ts +9 -1
- package/dist/trajectory/parse/ase.js +47 -32
- package/dist/trajectory/parse/diagnostics.d.ts +3 -0
- package/dist/trajectory/parse/diagnostics.js +14 -0
- package/dist/trajectory/parse/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 +3 -4
- package/dist/trajectory/parse/index.js +68 -119
- package/dist/trajectory/parse/lammps.d.ts +0 -2
- package/dist/trajectory/parse/lammps.js +14 -16
- package/dist/trajectory/parse/pymatgen.d.ts +2 -0
- package/dist/trajectory/parse/pymatgen.js +74 -0
- package/dist/trajectory/parse/vasp.js +13 -9
- 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.d.ts +9 -21
- package/dist/trajectory/parse/xyz.js +38 -39
- package/dist/trajectory/plotting.d.ts +8 -10
- package/dist/trajectory/plotting.js +102 -127
- package/dist/utils.d.ts +4 -0
- package/dist/utils.js +8 -1
- package/dist/xrd/XrdPlot.svelte +56 -85
- package/dist/xrd/broadening.d.ts +2 -1
- package/dist/xrd/broadening.js +2 -1
- package/dist/xrd/calc-xrd.js +8 -15
- package/dist/xrd/index.d.ts +2 -2
- package/dist/xrd/parse.d.ts +0 -1
- package/dist/xrd/parse.js +56 -73
- package/package.json +77 -36
- package/dist/api/mp.d.ts +0 -6
- package/dist/api/mp.js +0 -22
- package/dist/element/data.json +0 -11864
- package/dist/fermi-surface/marching-cubes.d.ts +0 -2
- package/dist/fermi-surface/marching-cubes.js +0 -2
- package/dist/plot/core/hover-lock.svelte.d.ts +0 -14
- package/dist/plot/core/hover-lock.svelte.js +0 -45
- package/dist/plot/sunburst/SunburstControls.svelte +0 -200
- package/dist/structure/label-placement.d.ts +0 -14
- package/dist/structure/label-placement.js +0 -72
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CellSnippet, ExportData, InitialSort, Label, Pagination, RowData, Search, SortHint, SpecialCells } from './';
|
|
1
|
+
import type { CellSnippet, ExportData, InitialSort, Label, Pagination, VirtualScroll, RowData, Search, SortHint, SpecialCells } from './';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
4
|
type $$ComponentProps = HTMLAttributes<HTMLDivElement> & {
|
|
@@ -17,14 +17,24 @@ type $$ComponentProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
17
17
|
default_num_format?: string;
|
|
18
18
|
show_heatmap?: boolean;
|
|
19
19
|
heatmap_class?: string;
|
|
20
|
+
onrowpointerdown?: (event: PointerEvent, row: RowData) => void;
|
|
20
21
|
onrowclick?: (event: MouseEvent | KeyboardEvent, row: RowData) => void;
|
|
21
22
|
onrowdblclick?: (event: MouseEvent, row: RowData) => void;
|
|
23
|
+
row_title?: (row: RowData) => string | null | undefined;
|
|
22
24
|
column_order?: string[];
|
|
23
25
|
export_data?: ExportData;
|
|
24
26
|
show_column_toggle?: boolean;
|
|
25
27
|
search?: Search;
|
|
28
|
+
search_query?: string;
|
|
26
29
|
show_row_select?: boolean;
|
|
27
30
|
pagination?: Pagination;
|
|
31
|
+
virtual?: VirtualScroll;
|
|
32
|
+
on_visible_range?: (range: {
|
|
33
|
+
start: number;
|
|
34
|
+
end: number;
|
|
35
|
+
total: number;
|
|
36
|
+
}) => void;
|
|
37
|
+
controls_target?: HTMLElement | null;
|
|
28
38
|
selected_rows?: RowData[];
|
|
29
39
|
hidden_columns?: string[];
|
|
30
40
|
scroll_style?: string;
|
|
@@ -44,6 +54,6 @@ type $$ComponentProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
44
54
|
}]>;
|
|
45
55
|
footer?: Snippet;
|
|
46
56
|
};
|
|
47
|
-
declare const HeatmapTable: import("svelte").Component<$$ComponentProps, {}, "sort" | "
|
|
57
|
+
declare const HeatmapTable: import("svelte").Component<$$ComponentProps, {}, "sort" | "show_controls" | "data" | "controls_open" | "loading" | "show_heatmap" | "column_order" | "search_query" | "selected_rows" | "hidden_columns" | "heatmap_opacity">;
|
|
48
58
|
type HeatmapTable = ReturnType<typeof HeatmapTable>;
|
|
49
59
|
export default HeatmapTable;
|
|
@@ -115,9 +115,7 @@
|
|
|
115
115
|
|
|
116
116
|
// Grid template for section items
|
|
117
117
|
let grid_template = $derived(
|
|
118
|
-
n_columns
|
|
119
|
-
? `repeat(${n_columns}, max-content)`
|
|
120
|
-
: `repeat(auto-fill, minmax(135px, 1fr))`,
|
|
118
|
+
n_columns ? `repeat(${n_columns}, max-content)` : `repeat(auto-fill, minmax(135px, 1fr))`,
|
|
121
119
|
)
|
|
122
120
|
|
|
123
121
|
// Reposition dropdown: left-aligned by default, switch to right if it overflows viewport
|
|
@@ -128,9 +126,7 @@
|
|
|
128
126
|
void n_columns
|
|
129
127
|
void collapsed_sections
|
|
130
128
|
void sections
|
|
131
|
-
const dropdown = details_el.querySelector<HTMLElement>(
|
|
132
|
-
`.column-menu, .sections-container`,
|
|
133
|
-
)
|
|
129
|
+
const dropdown = details_el.querySelector<HTMLElement>(`.column-menu, .sections-container`)
|
|
134
130
|
if (!dropdown) return
|
|
135
131
|
// Reset to left-aligned
|
|
136
132
|
dropdown.style.left = `0`
|
|
@@ -198,8 +194,8 @@
|
|
|
198
194
|
{#if has_sections}
|
|
199
195
|
<div class="sections-container" role="group">
|
|
200
196
|
{#each sections as section (section.name)}
|
|
201
|
-
{@const is_collapsed =
|
|
202
|
-
|
|
197
|
+
{@const is_collapsed =
|
|
198
|
+
section.name !== `` && collapsed_sections.includes(section.name)}
|
|
203
199
|
<div class="section">
|
|
204
200
|
{#if section.name}
|
|
205
201
|
<div class="section-header-row">
|
|
@@ -325,10 +321,7 @@
|
|
|
325
321
|
margin-bottom: 4pt;
|
|
326
322
|
padding: 2pt 4pt;
|
|
327
323
|
border-radius: var(--tgl-border-radius, 3pt);
|
|
328
|
-
background: var(
|
|
329
|
-
--tgl-section-header-bg,
|
|
330
|
-
color-mix(in srgb, currentColor 5%, transparent)
|
|
331
|
-
);
|
|
324
|
+
background: var(--tgl-section-header-bg, color-mix(in srgb, currentColor 5%, transparent));
|
|
332
325
|
&:hover {
|
|
333
326
|
background: var(
|
|
334
327
|
--tgl-section-header-hover-bg,
|
package/dist/table/index.d.ts
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import * as d3sc from 'd3-scale-chromatic';
|
|
1
|
+
import type * as d3sc from 'd3-scale-chromatic';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
export { default as HeatmapTable } from './HeatmapTable.svelte';
|
|
4
4
|
export { default as ToggleMenu } from './ToggleMenu.svelte';
|
|
5
|
-
export type CellVal = string | number | boolean | undefined | null | Record<string, unknown> | Record<string, string | number | null | undefined | boolean>[];
|
|
5
|
+
export type CellVal = string | number | boolean | Date | undefined | null | Record<string, unknown> | Record<string, string | number | null | undefined | boolean>[];
|
|
6
6
|
export type RowData = {
|
|
7
7
|
style?: string;
|
|
8
8
|
class?: string;
|
|
9
9
|
[key: string]: CellVal;
|
|
10
10
|
};
|
|
11
|
+
export type DateTimeFormatMode = `date` | `time` | `datetime` | `iso` | `relative`;
|
|
11
12
|
export type Label = {
|
|
12
13
|
label: string;
|
|
13
14
|
key?: string;
|
|
14
15
|
group?: string;
|
|
15
16
|
description?: string;
|
|
16
17
|
format?: string;
|
|
18
|
+
format_type?: `datetime`;
|
|
19
|
+
datetime_format?: DateTimeFormatMode;
|
|
17
20
|
better?: `higher` | `lower`;
|
|
18
21
|
color_scale?: keyof typeof d3sc | null;
|
|
19
22
|
scale_type?: `linear` | `log`;
|
|
@@ -51,10 +54,17 @@ export type InitialSort = string | {
|
|
|
51
54
|
export type Pagination = boolean | {
|
|
52
55
|
page_size?: number;
|
|
53
56
|
page_sizes?: number[];
|
|
57
|
+
on_page_size_change?: (page_size: number) => void;
|
|
58
|
+
};
|
|
59
|
+
export type VirtualScroll = boolean | {
|
|
60
|
+
overscan?: number;
|
|
61
|
+
min_window?: number;
|
|
54
62
|
};
|
|
55
63
|
export type Search = boolean | {
|
|
56
64
|
placeholder?: string;
|
|
57
65
|
expanded?: boolean;
|
|
66
|
+
keys?: string[];
|
|
67
|
+
fuzzy?: boolean;
|
|
58
68
|
};
|
|
59
69
|
export type ExportData = boolean | {
|
|
60
70
|
formats?: (`csv` | `json`)[];
|
|
@@ -62,11 +72,16 @@ export type ExportData = boolean | {
|
|
|
62
72
|
};
|
|
63
73
|
export type OnSortCallback = (column: string, dir: `asc` | `desc`) => Promise<RowData[]>;
|
|
64
74
|
export declare const strip_html: (str: string) => string;
|
|
75
|
+
export type CellColor = {
|
|
76
|
+
bg: string | null;
|
|
77
|
+
text: string | null;
|
|
78
|
+
};
|
|
79
|
+
export declare function make_cell_color_scale(all_values: CellVal[], // all values in the column
|
|
80
|
+
better: `higher` | `lower` | undefined, // sort direction
|
|
81
|
+
color_scale?: keyof typeof d3sc | null, // color scale name
|
|
82
|
+
scale_type?: `linear` | `log`): (val: number | null | undefined) => CellColor;
|
|
65
83
|
export declare function calc_cell_color(val: number | null | undefined, // cell value
|
|
66
84
|
all_values: CellVal[], // all values in the column
|
|
67
85
|
better: `higher` | `lower` | undefined, // sort direction
|
|
68
86
|
color_scale?: keyof typeof d3sc | null, // color scale name
|
|
69
|
-
scale_type?: `linear` | `log`):
|
|
70
|
-
bg: string | null;
|
|
71
|
-
text: string | null;
|
|
72
|
-
};
|
|
87
|
+
scale_type?: `linear` | `log`): CellColor;
|
package/dist/table/index.js
CHANGED
|
@@ -1,38 +1,51 @@
|
|
|
1
|
-
import { pick_contrast_color } from '../colors';
|
|
1
|
+
import { get_d3_interpolator, pick_contrast_color } from '../colors';
|
|
2
2
|
import { max, min } from 'd3-array';
|
|
3
3
|
import { scaleLog, scaleSequential } from 'd3-scale';
|
|
4
|
-
import * as d3sc from 'd3-scale-chromatic';
|
|
5
4
|
export { default as HeatmapTable } from './HeatmapTable.svelte';
|
|
6
5
|
export { default as ToggleMenu } from './ToggleMenu.svelte';
|
|
7
6
|
// Strip HTML tags from a string (for search, export, etc.)
|
|
8
7
|
export const strip_html = (str) => str.replaceAll(/<[^>]*>/g, ``);
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const NULL_CELL_COLOR = { bg: null, text: null };
|
|
9
|
+
// Build a memoized value→color mapper for one column. The O(column-length)
|
|
10
|
+
// work (numeric filter + min/max) and d3 scale construction happen ONCE here;
|
|
11
|
+
// the returned function is O(1) per cell. HeatmapTable derives one mapper per
|
|
12
|
+
// colored column instead of rescanning the full column for every cell render.
|
|
13
|
+
export function make_cell_color_scale(all_values, // all values in the column
|
|
12
14
|
better, // sort direction
|
|
13
15
|
color_scale = `interpolateViridis`, // color scale name
|
|
14
16
|
scale_type = `linear`) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return { bg: null, text: null };
|
|
18
|
-
}
|
|
19
|
-
// Log scale cannot handle non-positive values, return null colors
|
|
20
|
-
if (scale_type === `log` && val <= 0) {
|
|
21
|
-
return { bg: null, text: null };
|
|
22
|
-
}
|
|
17
|
+
if (color_scale === null)
|
|
18
|
+
return () => NULL_CELL_COLOR;
|
|
23
19
|
const numeric_vals = all_values.filter((v) => typeof v === `number` && !Number.isNaN(v) && (scale_type === `log` ? v > 0 : true));
|
|
24
20
|
if (numeric_vals.length === 0)
|
|
25
|
-
return
|
|
21
|
+
return () => NULL_CELL_COLOR;
|
|
26
22
|
const range = [min(numeric_vals) ?? 0, max(numeric_vals) ?? 1];
|
|
27
23
|
// Reverse the range if lower values are better
|
|
28
24
|
if (better === `lower`)
|
|
29
25
|
range.reverse();
|
|
30
|
-
|
|
31
|
-
const scale_fn = d3sc[color_scale];
|
|
32
|
-
const interpolator = (typeof scale_fn === `function` ? scale_fn : d3sc.interpolateViridis);
|
|
26
|
+
const interpolator = get_d3_interpolator(color_scale);
|
|
33
27
|
// Use log scale for positive values, otherwise linear/sequential scale
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return
|
|
28
|
+
const use_log = scale_type === `log` && range[0] > 0 && range[1] > 0;
|
|
29
|
+
const log_scale = use_log ? scaleLog().domain(range).range([0, 1]).clamp(true) : null;
|
|
30
|
+
const seq_scale = scaleSequential().domain(range).interpolator(interpolator);
|
|
31
|
+
return (val) => {
|
|
32
|
+
// Skip color calculation for null/undefined/NaN values
|
|
33
|
+
if (val == null || Number.isNaN(val))
|
|
34
|
+
return NULL_CELL_COLOR;
|
|
35
|
+
// Log scale cannot handle non-positive values, return null colors
|
|
36
|
+
if (scale_type === `log` && val <= 0)
|
|
37
|
+
return NULL_CELL_COLOR;
|
|
38
|
+
const bg = log_scale ? interpolator(log_scale(val)) : seq_scale(val);
|
|
39
|
+
return { bg, text: pick_contrast_color({ bg_color: bg }) };
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
// Calculate table cell background color based on its value and column config.
|
|
43
|
+
// One-shot convenience wrapper around make_cell_color_scale — prefer the
|
|
44
|
+
// factory when coloring many cells of the same column.
|
|
45
|
+
export function calc_cell_color(val, // cell value
|
|
46
|
+
all_values, // all values in the column
|
|
47
|
+
better, // sort direction
|
|
48
|
+
color_scale = `interpolateViridis`, // color scale name
|
|
49
|
+
scale_type = `linear`) {
|
|
50
|
+
return make_cell_color_scale(all_values, better, color_scale, scale_type)(val);
|
|
38
51
|
}
|
|
@@ -4,14 +4,17 @@
|
|
|
4
4
|
import type { ThemeMode } from './index'
|
|
5
5
|
import { apply_theme_to_dom, save_theme_preference, THEME_OPTIONS } from './index'
|
|
6
6
|
|
|
7
|
-
let {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
let {
|
|
8
|
+
theme_mode = $bindable(theme_state.mode),
|
|
9
|
+
onchange = () => {},
|
|
10
|
+
...rest
|
|
11
|
+
}: Omit<HTMLAttributes<HTMLSelectElement>, `onchange`> & {
|
|
12
|
+
theme_mode?: ThemeMode // Current theme mode (now bindable to global state)
|
|
13
|
+
onchange?: (mode: ThemeMode) => void // Callback when theme changes
|
|
14
|
+
} = $props()
|
|
13
15
|
|
|
14
|
-
$effect(() => {
|
|
16
|
+
$effect(() => {
|
|
17
|
+
// Sync and save to local storage when theme changes
|
|
15
18
|
const prev = theme_state.mode
|
|
16
19
|
if (prev === theme_mode) return
|
|
17
20
|
theme_state.mode = theme_mode
|
|
@@ -21,7 +24,12 @@
|
|
|
21
24
|
})
|
|
22
25
|
</script>
|
|
23
26
|
|
|
24
|
-
<select
|
|
27
|
+
<select
|
|
28
|
+
aria-label="Color theme"
|
|
29
|
+
bind:value={theme_mode}
|
|
30
|
+
{...rest}
|
|
31
|
+
class={[`theme-control`, rest.class]}
|
|
32
|
+
>
|
|
25
33
|
{#each THEME_OPTIONS as { label, icon, value } (value)}
|
|
26
34
|
<option {value}>{icon} {label}</option>
|
|
27
35
|
{/each}
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare const THEME_STORAGE_KEY = "matterviz-theme";
|
|
1
2
|
export declare const COLOR_THEMES: {
|
|
2
3
|
readonly light: "light";
|
|
3
4
|
readonly dark: "dark";
|
|
@@ -22,8 +23,3 @@ export declare const get_theme_preference: () => ThemeMode;
|
|
|
22
23
|
export declare const save_theme_preference: (mode: ThemeMode) => void;
|
|
23
24
|
export declare const get_system_mode: () => ThemeType;
|
|
24
25
|
export declare const apply_theme_to_dom: (mode: ThemeMode) => void;
|
|
25
|
-
export declare const light_theme: () => any;
|
|
26
|
-
export declare const dark_theme: () => any;
|
|
27
|
-
export declare const white_theme: () => any;
|
|
28
|
-
export declare const black_theme: () => any;
|
|
29
|
-
export declare const get_theme_by_name: (name: ThemeName) => any;
|
package/dist/theme/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Theme System for MatterViz
|
|
2
2
|
const is_browser = typeof window !== `undefined`;
|
|
3
|
-
const
|
|
3
|
+
export const THEME_STORAGE_KEY = `matterviz-theme`;
|
|
4
4
|
// Core theme constants
|
|
5
5
|
export const COLOR_THEMES = {
|
|
6
6
|
light: `light`,
|
|
@@ -32,7 +32,7 @@ export const get_theme_preference = () => {
|
|
|
32
32
|
if (!is_browser)
|
|
33
33
|
return AUTO_THEME;
|
|
34
34
|
try {
|
|
35
|
-
const saved = localStorage[
|
|
35
|
+
const saved = localStorage[THEME_STORAGE_KEY];
|
|
36
36
|
return is_valid_theme_mode(saved ?? ``) ? saved : AUTO_THEME;
|
|
37
37
|
}
|
|
38
38
|
catch {
|
|
@@ -41,13 +41,13 @@ export const get_theme_preference = () => {
|
|
|
41
41
|
};
|
|
42
42
|
export const save_theme_preference = (mode) => {
|
|
43
43
|
try {
|
|
44
|
-
localStorage[
|
|
44
|
+
localStorage[THEME_STORAGE_KEY] = mode;
|
|
45
45
|
}
|
|
46
46
|
catch {
|
|
47
47
|
// Silently fail if localStorage is unavailable
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
|
-
export const get_system_mode = () => is_browser && matchMedia(`(prefers-color-scheme: dark)`)
|
|
50
|
+
export const get_system_mode = () => is_browser && globalThis.matchMedia?.(`(prefers-color-scheme: dark)`)?.matches
|
|
51
51
|
? COLOR_THEMES.dark
|
|
52
52
|
: COLOR_THEMES.light;
|
|
53
53
|
export const apply_theme_to_dom = (mode) => {
|
|
@@ -71,9 +71,3 @@ export const apply_theme_to_dom = (mode) => {
|
|
|
71
71
|
const color_scheme = THEME_TYPE[resolved];
|
|
72
72
|
root.style.setProperty(`color-scheme`, color_scheme);
|
|
73
73
|
};
|
|
74
|
-
// Theme getters
|
|
75
|
-
export const light_theme = () => globalThis.MATTERVIZ_THEMES?.[COLOR_THEMES.light] ?? {};
|
|
76
|
-
export const dark_theme = () => globalThis.MATTERVIZ_THEMES?.[COLOR_THEMES.dark] ?? {};
|
|
77
|
-
export const white_theme = () => globalThis.MATTERVIZ_THEMES?.[COLOR_THEMES.white] ?? {};
|
|
78
|
-
export const black_theme = () => globalThis.MATTERVIZ_THEMES?.[COLOR_THEMES.black] ?? {};
|
|
79
|
-
export const get_theme_by_name = (name) => globalThis.MATTERVIZ_THEMES?.[name] ?? {};
|
package/dist/theme/themes.mjs
CHANGED
|
@@ -41,6 +41,17 @@ const tooltip_bg = (light_bg, dark_bg, light_op = 0.95, dark_op = 0.95) => ({
|
|
|
41
41
|
black: `rgba(20, 20, 20, 0.98)`,
|
|
42
42
|
})
|
|
43
43
|
|
|
44
|
+
// Slight contrast shading drawn behind plot SVGs and structure canvases so they read
|
|
45
|
+
// as panels sitting on top of the page background. Shared so a plot and a structure
|
|
46
|
+
// shown side by side (e.g. trajectory view) get an identical tint. Kept subtle; light
|
|
47
|
+
// modes darken, dark modes lighten.
|
|
48
|
+
const canvas_bg = {
|
|
49
|
+
light: `rgba(0, 0, 0, 0.03)`,
|
|
50
|
+
dark: `rgba(255, 255, 255, 0.07)`,
|
|
51
|
+
white: `rgba(0, 0, 0, 0.025)`,
|
|
52
|
+
black: `rgba(255, 255, 255, 0.1)`,
|
|
53
|
+
}
|
|
54
|
+
|
|
44
55
|
const themes = {
|
|
45
56
|
// Core colors
|
|
46
57
|
'page-bg': {
|
|
@@ -167,13 +178,9 @@ const themes = {
|
|
|
167
178
|
black: `1px solid rgba(255, 255, 255, 0.075)`,
|
|
168
179
|
},
|
|
169
180
|
|
|
170
|
-
//
|
|
171
|
-
'
|
|
172
|
-
|
|
173
|
-
dark: `rgba(255, 255, 255, 0.07)`,
|
|
174
|
-
white: `rgba(0, 0, 0, 0.01)`,
|
|
175
|
-
black: `rgba(255, 255, 255, 0.1)`,
|
|
176
|
-
},
|
|
181
|
+
// Plot & structure canvas backgrounds (shared subtle panel shading)
|
|
182
|
+
'plot-bg': canvas_bg,
|
|
183
|
+
'struct-bg': canvas_bg,
|
|
177
184
|
'struct-bg-fullscreen': {
|
|
178
185
|
light: page_bg_light,
|
|
179
186
|
dark: page_bg_dark,
|
|
@@ -20,9 +20,7 @@
|
|
|
20
20
|
} = $props()
|
|
21
21
|
|
|
22
22
|
const is_snippet = $derived(typeof tooltip === `function`)
|
|
23
|
-
const config = $derived(
|
|
24
|
-
!is_snippet && tooltip ? (tooltip as TooltipConfig<T>) : null,
|
|
25
|
-
)
|
|
23
|
+
const config = $derived(!is_snippet && tooltip ? (tooltip as TooltipConfig<T>) : null)
|
|
26
24
|
const prefix = $derived(
|
|
27
25
|
typeof config?.prefix === `function` ? config.prefix(data) : config?.prefix,
|
|
28
26
|
)
|
|
@@ -47,8 +45,7 @@
|
|
|
47
45
|
.tooltip-prefix {
|
|
48
46
|
margin-bottom: 6px;
|
|
49
47
|
padding-bottom: 6px;
|
|
50
|
-
border-bottom: 1px solid
|
|
51
|
-
var(--tooltip-border, var(--border, rgba(128, 128, 128, 0.3)));
|
|
48
|
+
border-bottom: 1px solid var(--tooltip-border, var(--border, rgba(128, 128, 128, 0.3)));
|
|
52
49
|
}
|
|
53
50
|
.tooltip-suffix {
|
|
54
51
|
margin-top: 6px;
|