matterviz 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/EmptyState.svelte +10 -2
- package/dist/FilePicker.svelte +154 -96
- package/dist/Icon.svelte +20 -14
- package/dist/MillerIndexInput.svelte +27 -21
- package/dist/api/optimade.js +6 -6
- package/dist/app.css +216 -178
- package/dist/brillouin/BrillouinZone.svelte +299 -198
- package/dist/brillouin/BrillouinZone.svelte.d.ts +1 -1
- package/dist/brillouin/BrillouinZoneControls.svelte +32 -5
- package/dist/brillouin/BrillouinZoneExportPane.svelte +74 -55
- package/dist/brillouin/BrillouinZoneExportPane.svelte.d.ts +1 -1
- package/dist/brillouin/BrillouinZoneInfoPane.svelte +99 -68
- package/dist/brillouin/BrillouinZoneScene.svelte +277 -165
- package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +1 -1
- package/dist/brillouin/BrillouinZoneTooltip.svelte +17 -7
- package/dist/brillouin/compute.js +11 -6
- package/dist/chempot-diagram/ChemPotDiagram.svelte +327 -0
- package/dist/chempot-diagram/ChemPotDiagram.svelte.d.ts +13 -0
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +847 -0
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +16 -0
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +3194 -0
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +16 -0
- package/dist/chempot-diagram/ChemPotScene3D.svelte +11 -0
- package/dist/chempot-diagram/ChemPotScene3D.svelte.d.ts +7 -0
- package/dist/chempot-diagram/async-compute.svelte.d.ts +3 -0
- package/dist/chempot-diagram/async-compute.svelte.js +77 -0
- package/dist/chempot-diagram/chempot-worker.d.ts +1 -0
- package/dist/chempot-diagram/chempot-worker.js +11 -0
- package/dist/chempot-diagram/color.d.ts +10 -0
- package/dist/chempot-diagram/color.js +32 -0
- package/dist/chempot-diagram/compute.d.ts +48 -0
- package/dist/chempot-diagram/compute.js +812 -0
- package/dist/chempot-diagram/index.d.ts +6 -0
- package/dist/chempot-diagram/index.js +6 -0
- package/dist/chempot-diagram/pointer.d.ts +16 -0
- package/dist/chempot-diagram/pointer.js +40 -0
- package/dist/chempot-diagram/temperature.d.ts +15 -0
- package/dist/chempot-diagram/temperature.js +36 -0
- package/dist/chempot-diagram/types.d.ts +86 -0
- package/dist/chempot-diagram/types.js +28 -0
- package/dist/colors/index.d.ts +3 -1
- package/dist/colors/index.js +9 -3
- package/dist/composition/BarChart.svelte +141 -77
- package/dist/composition/BubbleChart.svelte +107 -52
- package/dist/composition/Composition.svelte +100 -79
- package/dist/composition/Formula.svelte +108 -62
- package/dist/composition/FormulaFilter.svelte +973 -353
- package/dist/composition/FormulaFilter.svelte.d.ts +35 -1
- package/dist/composition/PieChart.svelte +199 -99
- package/dist/composition/PieChart.svelte.d.ts +1 -1
- package/dist/composition/format.d.ts +5 -0
- package/dist/composition/format.js +20 -3
- package/dist/composition/parse.js +14 -9
- package/dist/convex-hull/ConvexHull.svelte +93 -38
- package/dist/convex-hull/ConvexHull2D.svelte +551 -393
- package/dist/convex-hull/ConvexHull3D.svelte +1303 -825
- package/dist/convex-hull/ConvexHull4D.svelte +1012 -686
- package/dist/convex-hull/ConvexHullControls.svelte +115 -28
- package/dist/convex-hull/ConvexHullInfoPane.svelte +29 -3
- package/dist/convex-hull/ConvexHullStats.svelte +821 -249
- package/dist/convex-hull/ConvexHullStats.svelte.d.ts +6 -1
- package/dist/convex-hull/ConvexHullTooltip.svelte +41 -16
- package/dist/convex-hull/GasPressureControls.svelte +104 -61
- package/dist/convex-hull/StructurePopup.svelte +25 -4
- package/dist/convex-hull/TemperatureSlider.svelte +45 -25
- package/dist/convex-hull/barycentric-coords.js +13 -7
- package/dist/convex-hull/demo-temperature.d.ts +6 -0
- package/dist/convex-hull/demo-temperature.js +40 -0
- package/dist/convex-hull/gas-thermodynamics.js +17 -12
- package/dist/convex-hull/helpers.d.ts +10 -1
- package/dist/convex-hull/helpers.js +79 -38
- package/dist/convex-hull/index.d.ts +1 -0
- package/dist/convex-hull/index.js +1 -0
- package/dist/convex-hull/thermodynamics.d.ts +8 -21
- package/dist/convex-hull/thermodynamics.js +163 -69
- package/dist/convex-hull/types.d.ts +12 -12
- package/dist/convex-hull/types.js +0 -12
- package/dist/coordination/CoordinationBarPlot.svelte +232 -176
- package/dist/element/BohrAtom.svelte +56 -13
- package/dist/element/ElementHeading.svelte +7 -2
- package/dist/element/ElementPhoto.svelte +15 -9
- package/dist/element/ElementStats.svelte +10 -4
- package/dist/element/ElementTile.svelte +137 -73
- package/dist/element/Nucleus.svelte +39 -11
- package/dist/element/data.js +2 -14
- package/dist/element/data.json.gz +0 -0
- package/dist/element/types.d.ts +1 -0
- package/dist/feedback/ClickFeedback.svelte +16 -5
- package/dist/feedback/DragOverlay.svelte +10 -2
- package/dist/feedback/Spinner.svelte +4 -2
- package/dist/feedback/StatusMessage.svelte +8 -2
- package/dist/fermi-surface/FermiSlice.svelte +118 -88
- package/dist/fermi-surface/FermiSurface.svelte +336 -239
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceControls.svelte +113 -46
- package/dist/fermi-surface/FermiSurfaceScene.svelte +536 -343
- package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceTooltip.svelte +14 -5
- package/dist/fermi-surface/compute.js +16 -20
- package/dist/fermi-surface/parse.js +37 -33
- package/dist/fermi-surface/symmetry.js +2 -7
- package/dist/fermi-surface/types.d.ts +3 -5
- package/dist/heatmap-matrix/HeatmapMatrix.svelte +1527 -0
- package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +110 -0
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +225 -0
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +30 -0
- package/dist/heatmap-matrix/index.d.ts +53 -0
- package/dist/heatmap-matrix/index.js +100 -0
- package/dist/heatmap-matrix/shared.d.ts +2 -0
- package/dist/heatmap-matrix/shared.js +4 -0
- package/dist/icons.d.ts +111 -0
- package/dist/icons.js +158 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +5 -2
- package/dist/io/decompress.js +1 -1
- package/dist/io/export.d.ts +3 -0
- package/dist/io/export.js +138 -140
- package/dist/io/file-drop.d.ts +7 -0
- package/dist/io/file-drop.js +43 -0
- package/dist/io/index.d.ts +2 -2
- package/dist/io/index.js +2 -112
- package/dist/io/is-binary.js +2 -3
- package/dist/io/types.d.ts +1 -0
- package/dist/io/url-drop.d.ts +2 -0
- package/dist/io/url-drop.js +117 -0
- package/dist/isosurface/Isosurface.svelte +220 -110
- package/dist/isosurface/IsosurfaceControls.svelte +65 -28
- package/dist/isosurface/parse.js +104 -56
- package/dist/isosurface/slice.d.ts +2 -1
- package/dist/isosurface/slice.js +8 -13
- package/dist/isosurface/types.d.ts +14 -1
- package/dist/isosurface/types.js +152 -5
- package/dist/labels.d.ts +2 -1
- package/dist/labels.js +12 -8
- package/dist/layout/FullscreenToggle.svelte +11 -2
- package/dist/layout/InfoCard.svelte +38 -6
- package/dist/layout/InfoTag.svelte +125 -94
- package/dist/layout/PropertyFilter.svelte +82 -37
- package/dist/layout/SettingsSection.svelte +85 -55
- package/dist/layout/SubpageGrid.svelte +82 -0
- package/dist/layout/SubpageGrid.svelte.d.ts +14 -0
- package/dist/layout/index.d.ts +1 -0
- package/dist/layout/index.js +1 -0
- package/dist/layout/json-tree/JsonNode.svelte +266 -223
- package/dist/layout/json-tree/JsonTree.svelte +516 -429
- package/dist/layout/json-tree/JsonTree.svelte.d.ts +1 -1
- package/dist/layout/json-tree/JsonValue.svelte +281 -173
- package/dist/layout/json-tree/types.d.ts +10 -2
- package/dist/layout/json-tree/utils.d.ts +2 -0
- package/dist/layout/json-tree/utils.js +37 -2
- package/dist/marching-cubes.js +25 -2
- package/dist/math.d.ts +20 -17
- package/dist/math.js +474 -57
- package/dist/overlays/ContextMenu.svelte +66 -40
- package/dist/overlays/DraggablePane.svelte +331 -154
- package/dist/overlays/DraggablePane.svelte.d.ts +2 -0
- package/dist/periodic-table/PeriodicTable.svelte +278 -145
- package/dist/periodic-table/PeriodicTableControls.svelte +178 -128
- package/dist/periodic-table/PropertySelect.svelte +25 -7
- package/dist/periodic-table/TableInset.svelte +8 -3
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +559 -267
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +6 -2
- package/dist/phase-diagram/PhaseDiagramControls.svelte +131 -51
- package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +3 -2
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +126 -0
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte.d.ts +15 -0
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte +160 -110
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte.d.ts +8 -1
- package/dist/phase-diagram/PhaseDiagramTooltip.svelte +217 -86
- package/dist/phase-diagram/PhaseDiagramTooltip.svelte.d.ts +6 -3
- package/dist/phase-diagram/TdbInfoPanel.svelte +28 -4
- package/dist/phase-diagram/build-diagram.js +9 -9
- package/dist/phase-diagram/colors.js +1 -3
- package/dist/phase-diagram/index.d.ts +2 -0
- package/dist/phase-diagram/index.js +2 -0
- package/dist/phase-diagram/parse.js +10 -9
- package/dist/phase-diagram/svg-to-diagram.d.ts +2 -0
- package/dist/phase-diagram/svg-to-diagram.js +869 -0
- package/dist/phase-diagram/types.d.ts +10 -0
- package/dist/phase-diagram/utils.d.ts +8 -4
- package/dist/phase-diagram/utils.js +219 -74
- package/dist/plot/AxisLabel.svelte +51 -0
- package/dist/plot/AxisLabel.svelte.d.ts +16 -0
- package/dist/plot/BarPlot.svelte +1461 -768
- package/dist/plot/BarPlot.svelte.d.ts +3 -3
- package/dist/plot/BarPlotControls.svelte +33 -6
- package/dist/plot/BarPlotControls.svelte.d.ts +1 -1
- package/dist/plot/ColorBar.svelte +533 -383
- package/dist/plot/ColorBar.svelte.d.ts +1 -1
- package/dist/plot/ColorScaleSelect.svelte +28 -7
- package/dist/plot/ElementScatter.svelte +38 -16
- package/dist/plot/FillArea.svelte +152 -92
- package/dist/plot/Histogram.svelte +1162 -709
- package/dist/plot/Histogram.svelte.d.ts +1 -1
- package/dist/plot/HistogramControls.svelte +81 -18
- package/dist/plot/HistogramControls.svelte.d.ts +6 -2
- package/dist/plot/InteractiveAxisLabel.svelte +34 -11
- package/dist/plot/InteractiveAxisLabel.svelte.d.ts +1 -1
- package/dist/plot/Line.svelte +63 -28
- package/dist/plot/PlotControls.svelte +221 -96
- package/dist/plot/PlotControls.svelte.d.ts +1 -1
- package/dist/plot/PlotLegend.svelte +174 -91
- package/dist/plot/PlotTooltip.svelte +45 -6
- package/dist/plot/PortalSelect.svelte +175 -146
- package/dist/plot/ReferenceLine.svelte +77 -22
- package/dist/plot/ReferenceLine.svelte.d.ts +1 -0
- package/dist/plot/ReferenceLine3D.svelte +132 -107
- package/dist/plot/ReferencePlane.svelte +146 -123
- package/dist/plot/ScatterPlot.svelte +1880 -1156
- package/dist/plot/ScatterPlot.svelte.d.ts +3 -3
- package/dist/plot/ScatterPlot3D.svelte +256 -131
- package/dist/plot/ScatterPlot3D.svelte.d.ts +2 -2
- package/dist/plot/ScatterPlot3DControls.svelte +300 -297
- package/dist/plot/ScatterPlot3DControls.svelte.d.ts +2 -1
- package/dist/plot/ScatterPlot3DScene.svelte +608 -406
- package/dist/plot/ScatterPlot3DScene.svelte.d.ts +2 -2
- package/dist/plot/ScatterPlotControls.svelte +150 -70
- package/dist/plot/ScatterPlotControls.svelte.d.ts +1 -1
- package/dist/plot/ScatterPoint.svelte +98 -26
- package/dist/plot/ScatterPoint.svelte.d.ts +1 -0
- package/dist/plot/SpacegroupBarPlot.svelte +142 -85
- package/dist/plot/Surface3D.svelte +159 -108
- package/dist/plot/ZeroLines.svelte +96 -0
- package/dist/plot/ZeroLines.svelte.d.ts +32 -0
- package/dist/plot/ZoomRect.svelte +23 -0
- package/dist/plot/ZoomRect.svelte.d.ts +8 -0
- package/dist/plot/axis-utils.d.ts +1 -1
- package/dist/plot/axis-utils.js +1 -3
- package/dist/plot/data-cleaning.js +12 -28
- package/dist/plot/data-transform.js +2 -1
- package/dist/plot/fill-utils.js +2 -0
- package/dist/plot/index.d.ts +6 -2
- package/dist/plot/index.js +6 -2
- package/dist/plot/interactions.d.ts +8 -10
- package/dist/plot/interactions.js +2 -3
- package/dist/plot/layout.d.ts +11 -2
- package/dist/plot/layout.js +44 -17
- package/dist/plot/reference-line.d.ts +5 -22
- package/dist/plot/reference-line.js +12 -84
- package/dist/plot/scales.js +24 -36
- package/dist/plot/types.d.ts +53 -40
- package/dist/plot/types.js +12 -7
- package/dist/plot/utils/label-placement.d.ts +32 -15
- package/dist/plot/utils/label-placement.js +227 -63
- package/dist/plot/utils/series-visibility.js +2 -3
- package/dist/plot/utils.d.ts +1 -0
- package/dist/plot/utils.js +14 -0
- package/dist/rdf/RdfPlot.svelte +173 -132
- package/dist/rdf/calc-rdf.js +4 -5
- package/dist/sanitize.d.ts +4 -0
- package/dist/sanitize.js +107 -0
- package/dist/settings.d.ts +21 -6
- package/dist/settings.js +63 -19
- package/dist/spectral/Bands.svelte +963 -412
- package/dist/spectral/Bands.svelte.d.ts +22 -2
- package/dist/spectral/BandsAndDos.svelte +90 -49
- package/dist/spectral/BrillouinBandsDos.svelte +151 -93
- package/dist/spectral/Dos.svelte +389 -258
- package/dist/spectral/helpers.d.ts +23 -1
- package/dist/spectral/helpers.js +119 -51
- package/dist/spectral/types.d.ts +2 -0
- package/dist/state.svelte.d.ts +1 -1
- package/dist/state.svelte.js +3 -2
- package/dist/structure/Arrow.svelte +59 -20
- package/dist/structure/AtomLegend.svelte +231 -129
- package/dist/structure/AtomLegend.svelte.d.ts +1 -1
- package/dist/structure/Bond.svelte +73 -47
- package/dist/structure/CanvasTooltip.svelte +10 -2
- package/dist/structure/CellSelect.svelte +148 -51
- package/dist/structure/Cylinder.svelte +33 -17
- package/dist/structure/Lattice.svelte +88 -33
- package/dist/structure/Structure.svelte +1077 -821
- package/dist/structure/Structure.svelte.d.ts +1 -1
- package/dist/structure/StructureControls.svelte +373 -139
- package/dist/structure/StructureControls.svelte.d.ts +1 -1
- package/dist/structure/StructureExportPane.svelte +124 -89
- package/dist/structure/StructureExportPane.svelte.d.ts +1 -1
- package/dist/structure/StructureInfoPane.svelte +304 -231
- package/dist/structure/StructureScene.svelte +919 -445
- package/dist/structure/StructureScene.svelte.d.ts +16 -7
- package/dist/structure/atom-properties.d.ts +6 -2
- package/dist/structure/atom-properties.js +42 -29
- package/dist/structure/bonding.js +6 -7
- package/dist/structure/export.js +22 -34
- package/dist/structure/ferrox-wasm-types.d.ts +3 -2
- package/dist/structure/ferrox-wasm-types.js +0 -3
- package/dist/structure/ferrox-wasm.d.ts +3 -2
- package/dist/structure/ferrox-wasm.js +2 -3
- package/dist/structure/index.d.ts +16 -0
- package/dist/structure/index.js +88 -6
- package/dist/structure/measure.d.ts +2 -2
- package/dist/structure/measure.js +4 -44
- package/dist/structure/parse.js +130 -155
- package/dist/structure/partial-occupancy.d.ts +25 -0
- package/dist/structure/partial-occupancy.js +99 -0
- package/dist/structure/pbc.d.ts +1 -0
- package/dist/structure/pbc.js +16 -6
- package/dist/structure/supercell.d.ts +2 -2
- package/dist/structure/supercell.js +12 -22
- package/dist/structure/validation.js +5 -3
- package/dist/symmetry/SymmetryStats.svelte +94 -37
- package/dist/symmetry/WyckoffTable.svelte +42 -14
- package/dist/symmetry/cell-transform.js +5 -3
- package/dist/symmetry/index.d.ts +7 -4
- package/dist/symmetry/index.js +87 -21
- package/dist/symmetry/spacegroups.js +148 -148
- package/dist/table/HeatmapTable.svelte +1112 -516
- package/dist/table/HeatmapTable.svelte.d.ts +12 -1
- package/dist/table/ToggleMenu.svelte +125 -90
- package/dist/table/index.d.ts +2 -0
- package/dist/table/index.js +2 -4
- package/dist/theme/ThemeControl.svelte +21 -12
- package/dist/time.js +4 -1
- package/dist/tooltip/TooltipContent.svelte +33 -8
- package/dist/trajectory/Trajectory.svelte +889 -687
- package/dist/trajectory/TrajectoryError.svelte +14 -3
- package/dist/trajectory/TrajectoryExportPane.svelte +148 -90
- package/dist/trajectory/TrajectoryExportPane.svelte.d.ts +1 -1
- package/dist/trajectory/TrajectoryInfoPane.svelte +272 -143
- package/dist/trajectory/constants.d.ts +6 -0
- package/dist/trajectory/constants.js +7 -0
- package/dist/trajectory/extract.js +13 -31
- package/dist/trajectory/format-detect.d.ts +9 -0
- package/dist/trajectory/format-detect.js +76 -0
- package/dist/trajectory/frame-reader.d.ts +17 -0
- package/dist/trajectory/frame-reader.js +332 -0
- package/dist/trajectory/helpers.d.ts +14 -0
- package/dist/trajectory/helpers.js +172 -0
- package/dist/trajectory/index.d.ts +1 -0
- package/dist/trajectory/index.js +23 -14
- package/dist/trajectory/parse/ase.d.ts +2 -0
- package/dist/trajectory/parse/ase.js +77 -0
- package/dist/trajectory/parse/hdf5.d.ts +2 -0
- package/dist/trajectory/parse/hdf5.js +129 -0
- package/dist/trajectory/parse/index.d.ts +12 -0
- package/dist/trajectory/parse/index.js +299 -0
- package/dist/trajectory/parse/lammps.d.ts +5 -0
- package/dist/trajectory/parse/lammps.js +179 -0
- package/dist/trajectory/parse/vasp.d.ts +2 -0
- package/dist/trajectory/parse/vasp.js +68 -0
- package/dist/trajectory/parse/xyz.d.ts +2 -0
- package/dist/trajectory/parse/xyz.js +110 -0
- package/dist/trajectory/plotting.js +13 -8
- package/dist/trajectory/types.d.ts +11 -0
- package/dist/trajectory/types.js +1 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +17 -0
- package/dist/xrd/XrdPlot.svelte +337 -245
- package/dist/xrd/broadening.js +14 -9
- package/dist/xrd/calc-xrd.js +12 -19
- package/dist/xrd/parse.d.ts +1 -1
- package/dist/xrd/parse.js +17 -17
- package/package.json +103 -101
- package/readme.md +4 -4
- package/dist/trajectory/parse.d.ts +0 -42
- package/dist/trajectory/parse.js +0 -1267
- /package/dist/element/{data.json.d.ts → data.json.gz.d.ts} +0 -0
- /package/dist/theme/{themes.js → themes.mjs} +0 -0
|
@@ -1,240 +1,364 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { BrillouinZoneData } from '../brillouin'
|
|
3
|
+
import { compute_brillouin_zone, reciprocal_lattice } from '../brillouin'
|
|
4
|
+
import type { ShowControlsProp } from '../controls'
|
|
5
|
+
import { normalize_show_controls } from '../controls'
|
|
6
|
+
import EmptyState from '../EmptyState.svelte'
|
|
7
|
+
import { StatusMessage } from '../feedback'
|
|
8
|
+
import Spinner from '../feedback/Spinner.svelte'
|
|
9
|
+
import Icon from '../Icon.svelte'
|
|
10
|
+
import { create_file_drop_handler, load_from_url } from '../io'
|
|
11
|
+
import { set_fullscreen_bg, toggle_fullscreen } from '../layout'
|
|
12
|
+
import { PlotTooltip } from '../plot'
|
|
13
|
+
import type { CameraProjection } from '../settings'
|
|
14
|
+
import { DEFAULTS } from '../settings'
|
|
15
|
+
import type { Crystal } from '../structure'
|
|
16
|
+
import { Canvas } from '@threlte/core'
|
|
17
|
+
import type { ComponentProps, Snippet } from 'svelte'
|
|
18
|
+
import { untrack } from 'svelte'
|
|
19
|
+
import { tooltip } from 'svelte-multiselect/attachments'
|
|
20
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
21
|
+
import type { Camera, Scene } from 'three'
|
|
22
|
+
import { detect_irreducible_bz, extract_fermi_surface } from './compute'
|
|
23
|
+
import FermiSurfaceControls from './FermiSurfaceControls.svelte'
|
|
24
|
+
import FermiSurfaceScene from './FermiSurfaceScene.svelte'
|
|
25
|
+
import FermiSurfaceTooltip from './FermiSurfaceTooltip.svelte'
|
|
26
|
+
import { parse_fermi_file } from './parse'
|
|
27
|
+
import type {
|
|
28
|
+
BandGridData,
|
|
29
|
+
ColorProperty,
|
|
30
|
+
FermiErrorData,
|
|
31
|
+
FermiFileLoadData,
|
|
32
|
+
FermiHoverData,
|
|
33
|
+
FermiSurfaceData,
|
|
34
|
+
FermiTooltipConfig,
|
|
35
|
+
RepresentationMode,
|
|
36
|
+
} from './types'
|
|
37
|
+
|
|
38
|
+
type FermiHandlerData = {
|
|
39
|
+
fermi_data?: FermiSurfaceData
|
|
40
|
+
band_data?: BandGridData
|
|
41
|
+
bz_data?: BrillouinZoneData
|
|
42
|
+
filename?: string
|
|
43
|
+
file_size?: number
|
|
44
|
+
error_msg?: string
|
|
45
|
+
fullscreen?: boolean
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
let {
|
|
49
|
+
fermi_data = $bindable(),
|
|
50
|
+
band_data = $bindable(),
|
|
51
|
+
structure,
|
|
52
|
+
bz_data = $bindable(),
|
|
53
|
+
mu = $bindable(0),
|
|
54
|
+
controls_open = $bindable(false),
|
|
55
|
+
color_property = $bindable(`band`),
|
|
56
|
+
color_scale = $bindable(`interpolateViridis`),
|
|
57
|
+
custom_property_label,
|
|
58
|
+
representation = $bindable(`solid`),
|
|
59
|
+
surface_opacity = $bindable(0.8),
|
|
60
|
+
selected_bands = $bindable(),
|
|
61
|
+
show_bz = $bindable(true),
|
|
62
|
+
bz_opacity = $bindable(0.1),
|
|
63
|
+
show_vectors = $bindable(true),
|
|
64
|
+
tile_bz = $bindable(false),
|
|
65
|
+
// Clipping plane
|
|
66
|
+
clip_enabled = $bindable(false),
|
|
67
|
+
clip_axis = $bindable(`z`),
|
|
68
|
+
clip_position = $bindable(0),
|
|
69
|
+
clip_flip = $bindable(false),
|
|
70
|
+
// Interpolation
|
|
71
|
+
interpolation_factor = $bindable(1),
|
|
72
|
+
camera_projection = $bindable(`perspective`),
|
|
73
|
+
show_controls,
|
|
74
|
+
fullscreen = $bindable(false),
|
|
75
|
+
wrapper = $bindable(),
|
|
76
|
+
width = $bindable(0),
|
|
77
|
+
height = $bindable(0),
|
|
78
|
+
hovered = $bindable(false),
|
|
79
|
+
dragover = $bindable(false),
|
|
80
|
+
allow_file_drop = true,
|
|
81
|
+
fullscreen_toggle = DEFAULTS.structure.fullscreen_toggle,
|
|
82
|
+
data_url,
|
|
83
|
+
spinner_props = {},
|
|
84
|
+
loading = $bindable(false),
|
|
85
|
+
error_msg = $bindable(),
|
|
86
|
+
children,
|
|
87
|
+
tooltip_config,
|
|
88
|
+
on_file_drop,
|
|
89
|
+
on_file_load,
|
|
90
|
+
on_error,
|
|
91
|
+
on_fullscreen_change,
|
|
92
|
+
on_mu_change,
|
|
93
|
+
on_hover,
|
|
94
|
+
...rest
|
|
95
|
+
}: {
|
|
96
|
+
fermi_data?: FermiSurfaceData
|
|
97
|
+
band_data?: BandGridData
|
|
98
|
+
structure?: Crystal
|
|
99
|
+
bz_data?: BrillouinZoneData
|
|
100
|
+
mu?: number
|
|
101
|
+
controls_open?: boolean
|
|
102
|
+
color_property?: ColorProperty
|
|
103
|
+
color_scale?: string
|
|
104
|
+
// Label for custom property coloring (e.g. "λ(k)", "DOS", etc.)
|
|
105
|
+
custom_property_label?: string
|
|
106
|
+
representation?: RepresentationMode
|
|
107
|
+
surface_opacity?: number
|
|
108
|
+
selected_bands?: number[]
|
|
109
|
+
show_bz?: boolean
|
|
110
|
+
bz_opacity?: number
|
|
111
|
+
show_vectors?: boolean
|
|
112
|
+
tile_bz?: boolean
|
|
113
|
+
clip_enabled?: boolean
|
|
114
|
+
clip_axis?: `x` | `y` | `z`
|
|
115
|
+
clip_position?: number
|
|
116
|
+
clip_flip?: boolean
|
|
117
|
+
interpolation_factor?: number
|
|
118
|
+
camera_projection?: CameraProjection
|
|
119
|
+
/**
|
|
120
|
+
* Controls visibility configuration.
|
|
121
|
+
* - 'always': controls always visible
|
|
122
|
+
* - 'hover': controls visible on component hover (default)
|
|
123
|
+
* - 'never': controls never visible
|
|
124
|
+
* - object: { mode, hidden, style } for fine-grained control
|
|
125
|
+
*
|
|
126
|
+
* Control names: 'filename', 'fullscreen', 'controls'
|
|
127
|
+
*/
|
|
128
|
+
show_controls?: ShowControlsProp
|
|
129
|
+
fullscreen?: boolean
|
|
130
|
+
width?: number
|
|
131
|
+
height?: number
|
|
132
|
+
wrapper?: HTMLDivElement
|
|
133
|
+
hovered?: boolean
|
|
134
|
+
dragover?: boolean
|
|
135
|
+
allow_file_drop?: boolean
|
|
136
|
+
fullscreen_toggle?: Snippet<[{ fullscreen: boolean }]> | boolean
|
|
137
|
+
data_url?: string
|
|
138
|
+
spinner_props?: ComponentProps<typeof Spinner>
|
|
139
|
+
loading?: boolean
|
|
140
|
+
error_msg?: string
|
|
141
|
+
children?: Snippet<
|
|
142
|
+
[{ fermi_data?: FermiSurfaceData; bz_data?: BrillouinZoneData }]
|
|
143
|
+
>
|
|
144
|
+
on_file_drop?: (filename: string) => void
|
|
145
|
+
on_file_load?: (data: FermiFileLoadData) => void
|
|
146
|
+
on_error?: (data: FermiErrorData) => void
|
|
147
|
+
on_fullscreen_change?: (data: FermiHandlerData) => void
|
|
148
|
+
on_mu_change?: (mu: number) => void
|
|
149
|
+
tooltip_config?: Snippet<[{ hover_data: FermiHoverData }]> | FermiTooltipConfig
|
|
150
|
+
on_hover?: (data: FermiHoverData | null) => void
|
|
151
|
+
} & HTMLAttributes<HTMLDivElement> = $props()
|
|
152
|
+
|
|
153
|
+
let scene = $state<Scene | undefined>(undefined)
|
|
154
|
+
let camera = $state<Camera | undefined>(undefined)
|
|
155
|
+
let current_filename = $state<string | undefined>(undefined)
|
|
156
|
+
let recompute_job_id = 0 // monotonic counter to track latest recompute call
|
|
157
|
+
let hover_data = $state<FermiHoverData | null>(null)
|
|
158
|
+
|
|
159
|
+
// Call on_hover callback when hover_data changes
|
|
160
|
+
$effect(() => {
|
|
161
|
+
on_hover?.(hover_data)
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
let controls_config = $derived(normalize_show_controls(show_controls))
|
|
165
|
+
|
|
166
|
+
// Yield to browser so spinner can render before heavy computation
|
|
167
|
+
const tick = () =>
|
|
168
|
+
new Promise<void>((r) =>
|
|
169
|
+
requestAnimationFrame(() => requestAnimationFrame(() => r()))
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
// Parse and load Fermi surface from content (async for UI responsiveness)
|
|
173
|
+
async function parse_fermi_content(
|
|
174
|
+
content: string | ArrayBuffer,
|
|
175
|
+
filename: string,
|
|
176
|
+
) {
|
|
37
177
|
const text = content instanceof ArrayBuffer
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
178
|
+
? new TextDecoder().decode(content)
|
|
179
|
+
: content
|
|
180
|
+
|
|
181
|
+
const parsed = parse_fermi_file(text, filename)
|
|
182
|
+
if (!parsed) throw new Error(`Failed to parse Fermi surface from ${filename}`)
|
|
183
|
+
|
|
184
|
+
const file_size = new Blob([content]).size
|
|
185
|
+
current_filename = filename
|
|
186
|
+
|
|
45
187
|
// Check if it's already FermiSurfaceData or BandGridData
|
|
46
188
|
if (`isosurfaces` in parsed) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
fermi_data = extract_fermi_surface(band_data, { mu, wigner_seitz: true });
|
|
189
|
+
fermi_data = parsed as FermiSurfaceData
|
|
190
|
+
band_data = undefined
|
|
191
|
+
} else {
|
|
192
|
+
band_data = parsed as BandGridData
|
|
193
|
+
fermi_data = extract_fermi_surface(band_data, { mu, wigner_seitz: true })
|
|
53
194
|
}
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
195
|
+
|
|
196
|
+
on_file_load?.({ fermi_data, band_data, filename, file_size })
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Load with error handling
|
|
200
|
+
async function safe_parse(content: string | ArrayBuffer, filename: string) {
|
|
58
201
|
try {
|
|
59
|
-
|
|
202
|
+
await parse_fermi_content(content, filename)
|
|
203
|
+
} catch (err) {
|
|
204
|
+
error_msg = `Failed to parse ${filename}: ${
|
|
205
|
+
err instanceof Error ? err.message : err
|
|
206
|
+
}`
|
|
207
|
+
on_error?.({ error_msg, filename })
|
|
60
208
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (!band_data)
|
|
69
|
-
return;
|
|
70
|
-
const job_id = ++recompute_job_id; // capture this job's ID
|
|
71
|
-
await tick(); // yield to check for newer jobs before committing to work
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// Re-extract Fermi surface from band data with current settings
|
|
212
|
+
async function recompute_fermi_surface() {
|
|
213
|
+
if (!band_data) return
|
|
214
|
+
const job_id = ++recompute_job_id // capture this job's ID
|
|
215
|
+
await tick() // yield to check for newer jobs before committing to work
|
|
72
216
|
// Check if this job is still the latest before proceeding
|
|
73
217
|
// If stale, return without setting loading - the superseding job handles it
|
|
74
|
-
if (job_id !== recompute_job_id)
|
|
75
|
-
return;
|
|
218
|
+
if (job_id !== recompute_job_id) return
|
|
76
219
|
// Only set loading after stale check to avoid orphaned loading states
|
|
77
|
-
loading = true
|
|
220
|
+
loading = true
|
|
78
221
|
try {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
// Only clear loading if this is still the latest job
|
|
94
|
-
if (job_id === recompute_job_id)
|
|
95
|
-
loading = false;
|
|
222
|
+
const result = extract_fermi_surface(band_data, {
|
|
223
|
+
mu,
|
|
224
|
+
wigner_seitz: true,
|
|
225
|
+
interpolation_factor,
|
|
226
|
+
})
|
|
227
|
+
// Only update state if this is still the latest job
|
|
228
|
+
if (job_id === recompute_job_id) {
|
|
229
|
+
fermi_data = result
|
|
230
|
+
}
|
|
231
|
+
} catch (err) {
|
|
232
|
+
console.error(`Failed to re-extract Fermi surface:`, err)
|
|
233
|
+
} finally {
|
|
234
|
+
// Only clear loading if this is still the latest job
|
|
235
|
+
if (job_id === recompute_job_id) loading = false
|
|
96
236
|
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// Debounce recompute to avoid excessive re-computation during rapid slider drags
|
|
240
|
+
let recompute_timeout: ReturnType<typeof setTimeout>
|
|
241
|
+
|
|
242
|
+
function handle_mu_change(new_mu: number) {
|
|
243
|
+
mu = new_mu
|
|
244
|
+
clearTimeout(recompute_timeout)
|
|
245
|
+
recompute_timeout = setTimeout(() => void recompute_fermi_surface(), 150)
|
|
246
|
+
on_mu_change?.(new_mu)
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function handle_interpolation_change(new_factor: number) {
|
|
250
|
+
interpolation_factor = new_factor
|
|
251
|
+
clearTimeout(recompute_timeout)
|
|
252
|
+
recompute_timeout = setTimeout(() => void recompute_fermi_surface(), 150)
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Export Fermi surface to various formats
|
|
256
|
+
async function handle_export(format: `stl` | `obj` | `gltf`) {
|
|
113
257
|
if (!scene) {
|
|
114
|
-
|
|
115
|
-
|
|
258
|
+
console.error(`No scene available for export`)
|
|
259
|
+
return
|
|
116
260
|
}
|
|
117
261
|
try {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
error_msg = `Export failed: ${err instanceof Error ? err.message : err}`;
|
|
262
|
+
const { export_scene } = await import(`./export`)
|
|
263
|
+
await export_scene(scene, format, current_filename || `fermi-surface`)
|
|
264
|
+
} catch (err) {
|
|
265
|
+
console.error(`Export failed:`, err)
|
|
266
|
+
error_msg = `Export failed: ${err instanceof Error ? err.message : err}`
|
|
124
267
|
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// Compute BZ when structure or fermi_data changes
|
|
271
|
+
$effect(() => {
|
|
128
272
|
// Get k_lattice from available sources (priority order)
|
|
129
273
|
const k_lattice = fermi_data?.k_lattice ??
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
274
|
+
band_data?.k_lattice ??
|
|
275
|
+
(structure?.lattice?.matrix
|
|
276
|
+
? reciprocal_lattice(structure.lattice.matrix)
|
|
277
|
+
: null)
|
|
278
|
+
|
|
134
279
|
if (!k_lattice) {
|
|
135
|
-
|
|
136
|
-
|
|
280
|
+
bz_data = undefined
|
|
281
|
+
return
|
|
137
282
|
}
|
|
283
|
+
|
|
138
284
|
try {
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
285
|
+
bz_data = compute_brillouin_zone(k_lattice, 1)
|
|
286
|
+
} catch (err) {
|
|
287
|
+
const msg = err instanceof Error ? err.message : String(err)
|
|
288
|
+
console.warn(`BZ computation failed:`, msg)
|
|
289
|
+
bz_data = undefined
|
|
290
|
+
// Only report error for structure-derived lattice (user-provided data)
|
|
291
|
+
if (structure?.lattice?.matrix) {
|
|
292
|
+
const err_msg = `BZ computation failed: ${msg}`
|
|
293
|
+
error_msg = err_msg
|
|
294
|
+
untrack(() => on_error?.({ error_msg: err_msg }))
|
|
295
|
+
}
|
|
151
296
|
}
|
|
152
|
-
})
|
|
153
|
-
|
|
154
|
-
|
|
297
|
+
})
|
|
298
|
+
|
|
299
|
+
// Auto-enable BZ tiling when irreducible data is detected
|
|
300
|
+
$effect(() => {
|
|
155
301
|
if (fermi_data && detect_irreducible_bz(fermi_data)) {
|
|
156
|
-
|
|
302
|
+
tile_bz = true
|
|
157
303
|
}
|
|
158
|
-
})
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
304
|
+
})
|
|
305
|
+
|
|
306
|
+
// Load from URL (with race condition protection for rapid URL changes)
|
|
307
|
+
let load_id = 0
|
|
308
|
+
$effect(() => {
|
|
162
309
|
if (data_url && !fermi_data && !band_data) {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
310
|
+
const current_load_id = ++load_id
|
|
311
|
+
loading = true
|
|
312
|
+
error_msg = undefined
|
|
313
|
+
load_from_url(data_url, safe_parse)
|
|
314
|
+
.catch((err) => {
|
|
315
|
+
if (current_load_id !== load_id) return // stale request
|
|
316
|
+
error_msg = err instanceof Error ? err.message : String(err)
|
|
317
|
+
on_error?.({ error_msg, filename: data_url })
|
|
318
|
+
})
|
|
319
|
+
.finally(() => {
|
|
320
|
+
if (current_load_id === load_id) loading = false
|
|
172
321
|
})
|
|
173
|
-
.finally(() => {
|
|
174
|
-
if (current_load_id === load_id)
|
|
175
|
-
loading = false;
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
async function handle_file_drop(event) {
|
|
180
|
-
event.preventDefault();
|
|
181
|
-
dragover = false;
|
|
182
|
-
if (!allow_file_drop)
|
|
183
|
-
return;
|
|
184
|
-
loading = true;
|
|
185
|
-
error_msg = undefined;
|
|
186
|
-
try {
|
|
187
|
-
// Check for URL drop first
|
|
188
|
-
const url = event.dataTransfer?.getData(`text/uri-list`);
|
|
189
|
-
const url_filename = url?.split(`/`).pop()?.split(`?`)[0];
|
|
190
|
-
if (url_filename)
|
|
191
|
-
on_file_drop?.(url_filename);
|
|
192
|
-
const handled = await handle_url_drop(event, safe_parse).catch(() => false);
|
|
193
|
-
if (handled)
|
|
194
|
-
return;
|
|
195
|
-
const file = event.dataTransfer?.files[0];
|
|
196
|
-
if (file) {
|
|
197
|
-
if (!url_filename)
|
|
198
|
-
on_file_drop?.(file.name); // notify if not already
|
|
199
|
-
const { content, filename } = await decompress_file(file);
|
|
200
|
-
if (content)
|
|
201
|
-
await safe_parse(content, filename);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
catch (err) {
|
|
205
|
-
error_msg = `File drop failed: ${err}`;
|
|
206
|
-
on_error?.({ error_msg });
|
|
207
|
-
}
|
|
208
|
-
finally {
|
|
209
|
-
loading = false;
|
|
210
322
|
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
323
|
+
})
|
|
324
|
+
|
|
325
|
+
const handle_file_drop = create_file_drop_handler({
|
|
326
|
+
allow: () => allow_file_drop,
|
|
327
|
+
on_drop: async (content, filename) => {
|
|
328
|
+
on_file_drop?.(filename)
|
|
329
|
+
await safe_parse(content, filename)
|
|
330
|
+
},
|
|
331
|
+
on_error: (msg) => {
|
|
332
|
+
error_msg = msg
|
|
333
|
+
on_error?.({ error_msg: msg })
|
|
334
|
+
},
|
|
335
|
+
set_loading: (val) => {
|
|
336
|
+
loading = val
|
|
337
|
+
if (val) [error_msg, dragover] = [undefined, false]
|
|
338
|
+
},
|
|
339
|
+
})
|
|
340
|
+
|
|
341
|
+
function handle_keydown(event: KeyboardEvent) {
|
|
342
|
+
const target = event.target as HTMLElement
|
|
343
|
+
if ([`INPUT`, `TEXTAREA`].includes(target.tagName)) return
|
|
216
344
|
// Only handle shortcuts when component is focused/hovered or contains focus
|
|
217
|
-
if (!wrapper?.contains(document.activeElement) && !hovered)
|
|
218
|
-
|
|
219
|
-
if (event.key === `f` && fullscreen_toggle)
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
return;
|
|
227
|
-
const fs_el = document.fullscreenElement;
|
|
345
|
+
if (!wrapper?.contains(document.activeElement) && !hovered) return
|
|
346
|
+
|
|
347
|
+
if (event.key === `f` && fullscreen_toggle) toggle_fullscreen(wrapper)
|
|
348
|
+
else if (event.key === `Escape`) controls_open = false
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
$effect(() => {
|
|
352
|
+
if (typeof window === `undefined`) return
|
|
353
|
+
const fs_el = document.fullscreenElement
|
|
228
354
|
if (fullscreen && fs_el !== wrapper && wrapper) {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
set_fullscreen_bg(wrapper, fullscreen, `--fermi-bg-fullscreen`);
|
|
237
|
-
});
|
|
355
|
+
wrapper.requestFullscreen().catch((err) => {
|
|
356
|
+
console.error(err)
|
|
357
|
+
fullscreen = false
|
|
358
|
+
})
|
|
359
|
+
} else if (!fullscreen && fs_el === wrapper) document.exitFullscreen()
|
|
360
|
+
set_fullscreen_bg(wrapper, fullscreen, `--fermi-bg-fullscreen`)
|
|
361
|
+
})
|
|
238
362
|
</script>
|
|
239
363
|
|
|
240
364
|
<svelte:window onkeydown={handle_keydown} />
|
|
@@ -277,10 +401,7 @@ $effect(() => {
|
|
|
277
401
|
{...spinner_props}
|
|
278
402
|
/>
|
|
279
403
|
{:else if error_msg}
|
|
280
|
-
<
|
|
281
|
-
<p class="error">{error_msg}</p>
|
|
282
|
-
<button onclick={() => (error_msg = undefined)}>Dismiss</button>
|
|
283
|
-
</div>
|
|
404
|
+
<StatusMessage bind:message={error_msg} type="error" dismissible />
|
|
284
405
|
{:else if fermi_data || band_data}
|
|
285
406
|
<section
|
|
286
407
|
class="control-buttons {controls_config.class}"
|
|
@@ -446,7 +567,8 @@ $effect(() => {
|
|
|
446
567
|
pointer-events: auto;
|
|
447
568
|
}
|
|
448
569
|
/* Mode: hover - controls visible on component hover */
|
|
449
|
-
.fermi-surface:hover section.control-buttons.hover-visible
|
|
570
|
+
.fermi-surface:hover section.control-buttons.hover-visible,
|
|
571
|
+
.fermi-surface:focus-within section.control-buttons.hover-visible {
|
|
450
572
|
opacity: 1;
|
|
451
573
|
pointer-events: auto;
|
|
452
574
|
}
|
|
@@ -472,29 +594,4 @@ $effect(() => {
|
|
|
472
594
|
text-overflow: ellipsis;
|
|
473
595
|
white-space: nowrap;
|
|
474
596
|
}
|
|
475
|
-
.error-state {
|
|
476
|
-
display: flex;
|
|
477
|
-
flex-direction: column;
|
|
478
|
-
align-items: center;
|
|
479
|
-
justify-content: center;
|
|
480
|
-
height: 100%;
|
|
481
|
-
padding: 2rem;
|
|
482
|
-
text-align: center;
|
|
483
|
-
box-sizing: border-box;
|
|
484
|
-
}
|
|
485
|
-
.error-state p {
|
|
486
|
-
color: var(--error-color, #ff6b6b);
|
|
487
|
-
margin: 0 0 1rem;
|
|
488
|
-
}
|
|
489
|
-
.error-state button {
|
|
490
|
-
padding: 0.5rem 1rem;
|
|
491
|
-
background: var(--error-color, #ff6b6b);
|
|
492
|
-
color: white;
|
|
493
|
-
border: none;
|
|
494
|
-
border-radius: 4px;
|
|
495
|
-
cursor: pointer;
|
|
496
|
-
}
|
|
497
|
-
.error-state button:hover {
|
|
498
|
-
background: var(--error-color-hover, #ff5252);
|
|
499
|
-
}
|
|
500
597
|
</style>
|
|
@@ -78,6 +78,6 @@ type $$ComponentProps = {
|
|
|
78
78
|
}]> | FermiTooltipConfig;
|
|
79
79
|
on_hover?: (data: FermiHoverData | null) => void;
|
|
80
80
|
} & HTMLAttributes<HTMLDivElement>;
|
|
81
|
-
declare const FermiSurface: import("svelte").Component<$$ComponentProps, {}, "height" | "width" | "dragover" | "fullscreen" | "hovered" | "controls_open" | "
|
|
81
|
+
declare const FermiSurface: import("svelte").Component<$$ComponentProps, {}, "height" | "width" | "dragover" | "fullscreen" | "hovered" | "controls_open" | "loading" | "camera_projection" | "color_scale" | "wrapper" | "error_msg" | "surface_opacity" | "show_vectors" | "bz_data" | "mu" | "selected_bands" | "interpolation_factor" | "fermi_data" | "band_data" | "color_property" | "representation" | "show_bz" | "bz_opacity" | "tile_bz" | "clip_enabled" | "clip_axis" | "clip_position" | "clip_flip">;
|
|
82
82
|
type FermiSurface = ReturnType<typeof FermiSurface>;
|
|
83
83
|
export default FermiSurface;
|