matterviz 0.4.0 → 0.4.1
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/brillouin/BrillouinZone.svelte +68 -145
- package/dist/brillouin/BrillouinZone.svelte.d.ts +5 -14
- package/dist/brillouin/BrillouinZoneExportPane.svelte +43 -96
- package/dist/brillouin/BrillouinZoneExportPane.svelte.d.ts +1 -1
- package/dist/brillouin/BrillouinZoneInfoPane.svelte +9 -32
- package/dist/brillouin/BrillouinZoneInfoPane.svelte.d.ts +2 -3
- package/dist/brillouin/BrillouinZoneScene.svelte +49 -203
- 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.d.ts +1 -1
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +100 -191
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +4 -1
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +176 -464
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +7 -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.js +2 -2
- package/dist/composition/FormulaFilter.svelte +6 -5
- package/dist/composition/PieChart.svelte +5 -5
- package/dist/composition/chem-sys.js +3 -2
- package/dist/composition/format.js +3 -2
- package/dist/composition/parse.d.ts +0 -1
- package/dist/composition/parse.js +17 -19
- package/dist/controls.d.ts +1 -0
- package/dist/controls.js +0 -1
- package/dist/convex-hull/ConvexHull.svelte +8 -10
- package/dist/convex-hull/ConvexHull.svelte.d.ts +1 -4
- package/dist/convex-hull/ConvexHull2D.svelte +94 -175
- package/dist/convex-hull/ConvexHull2D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull3D.svelte +176 -680
- package/dist/convex-hull/ConvexHull3D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull4D.svelte +180 -680
- package/dist/convex-hull/ConvexHull4D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHullChrome.svelte +268 -0
- package/dist/convex-hull/ConvexHullChrome.svelte.d.ts +30 -0
- package/dist/convex-hull/ConvexHullControls.svelte +88 -7
- 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 +29 -168
- package/dist/convex-hull/ConvexHullStats.svelte.d.ts +3 -1
- package/dist/convex-hull/ConvexHullTooltip.svelte +11 -2
- package/dist/convex-hull/ConvexHullTooltip.svelte.d.ts +2 -1
- 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 +278 -0
- package/dist/convex-hull/helpers.d.ts +39 -7
- package/dist/convex-hull/helpers.js +154 -69
- 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 +91 -920
- package/dist/convex-hull/types.d.ts +12 -4
- package/dist/convex-hull/types.js +12 -0
- package/dist/coordination/CoordinationBarPlot.svelte +4 -11
- package/dist/element/BohrAtom.svelte +2 -1
- package/dist/element/ElementTile.svelte.d.ts +1 -1
- package/dist/element/index.d.ts +4 -0
- package/dist/element/index.js +18 -0
- package/dist/feedback/DragOverlay.svelte +3 -1
- package/dist/feedback/DragOverlay.svelte.d.ts +1 -0
- package/dist/feedback/StatusMessage.svelte +13 -3
- package/dist/fermi-surface/FermiSurface.svelte +67 -146
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +5 -14
- package/dist/fermi-surface/FermiSurfaceControls.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceScene.svelte +72 -224
- package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +3 -23
- package/dist/fermi-surface/compute.js +11 -10
- 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 +64 -75
- package/dist/fermi-surface/types.d.ts +2 -2
- package/dist/heatmap-matrix/HeatmapMatrix.svelte +55 -40
- package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +4 -3
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +3 -2
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +5 -5
- package/dist/heatmap-matrix/index.d.ts +3 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/io/ExportPane.svelte +166 -0
- package/dist/io/ExportPane.svelte.d.ts +17 -0
- package/dist/io/decompress.js +1 -2
- package/dist/io/export.d.ts +5 -1
- package/dist/io/export.js +32 -28
- package/dist/io/fetch.d.ts +2 -1
- package/dist/io/file-drop.d.ts +7 -0
- package/dist/io/file-drop.js +13 -0
- package/dist/io/index.d.ts +2 -0
- package/dist/io/index.js +10 -0
- package/dist/io/types.d.ts +13 -0
- package/dist/isosurface/parse.js +46 -44
- package/dist/labels.js +1 -1
- package/dist/layout/FullscreenButton.svelte +33 -0
- package/dist/layout/FullscreenButton.svelte.d.ts +10 -0
- package/dist/layout/FullscreenToggle.svelte +8 -14
- package/dist/layout/ViewerChrome.svelte +116 -0
- package/dist/layout/ViewerChrome.svelte.d.ts +17 -0
- package/dist/layout/fullscreen.d.ts +4 -0
- package/dist/layout/fullscreen.svelte.d.ts +8 -0
- package/dist/layout/fullscreen.svelte.js +37 -0
- package/dist/layout/index.d.ts +3 -0
- package/dist/layout/index.js +3 -0
- package/dist/math.d.ts +7 -3
- package/dist/math.js +18 -21
- package/dist/overlays/index.d.ts +4 -0
- package/dist/periodic-table/PeriodicTable.svelte +9 -8
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +1 -1
- package/dist/phase-diagram/PhaseDiagramControls.svelte +3 -2
- package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +4 -3
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +2 -1
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte.d.ts +2 -3
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte +47 -132
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte.d.ts +3 -4
- package/dist/phase-diagram/colors.js +1 -1
- package/dist/phase-diagram/parse.d.ts +2 -1
- package/dist/plot/bar/BarPlot.svelte +79 -316
- package/dist/plot/bar/BarPlot.svelte.d.ts +7 -15
- package/dist/plot/bar/BarPlotControls.svelte.d.ts +1 -1
- package/dist/plot/bar/SpacegroupBarPlot.svelte +2 -1
- package/dist/plot/box/BoxPlot.svelte +76 -246
- package/dist/plot/box/BoxPlot.svelte.d.ts +4 -3
- package/dist/plot/box/BoxPlotControls.svelte.d.ts +1 -1
- package/dist/plot/box/Violin.svelte.d.ts +1 -1
- package/dist/plot/box/box-plot.d.ts +3 -2
- package/dist/plot/box/box-plot.js +5 -2
- 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 +4 -1
- package/dist/plot/core/components/ColorBar.svelte +5 -5
- package/dist/plot/core/components/ColorBar.svelte.d.ts +5 -4
- package/dist/plot/core/components/Line.svelte +3 -2
- package/dist/plot/core/components/Line.svelte.d.ts +3 -2
- package/dist/plot/core/components/PlotAxis.svelte +2 -1
- package/dist/plot/core/components/PlotAxis.svelte.d.ts +2 -1
- package/dist/plot/core/components/PlotControls.svelte.d.ts +1 -1
- package/dist/plot/core/components/ReferenceLine3D.svelte +2 -2
- package/dist/plot/core/components/ReferenceLine3D.svelte.d.ts +4 -4
- package/dist/plot/core/components/ReferencePlane.svelte +2 -2
- package/dist/plot/core/components/ReferencePlane.svelte.d.ts +4 -4
- package/dist/plot/core/data-cleaning.js +18 -18
- package/dist/plot/core/fill-utils.d.ts +4 -3
- package/dist/plot/core/fill-utils.js +6 -3
- package/dist/plot/core/interactions.d.ts +5 -1
- package/dist/plot/core/interactions.js +14 -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 +6 -6
- package/dist/plot/core/scales.d.ts +17 -25
- package/dist/plot/core/scales.js +10 -8
- package/dist/plot/core/svg.d.ts +2 -1
- package/dist/plot/core/types.d.ts +18 -7
- package/dist/plot/core/utils/label-placement.d.ts +1 -1
- package/dist/plot/core/utils/label-placement.js +3 -3
- package/dist/plot/core/utils.d.ts +2 -1
- package/dist/plot/histogram/Histogram.svelte +77 -314
- package/dist/plot/histogram/HistogramControls.svelte.d.ts +1 -1
- package/dist/plot/sankey/Sankey.svelte +2 -5
- package/dist/plot/sankey/Sankey.svelte.d.ts +1 -1
- package/dist/plot/sankey/sankey.js +3 -1
- package/dist/plot/scatter/BinnedScatterPlot.svelte +3 -5
- package/dist/plot/scatter/BinnedScatterPlot.svelte.d.ts +4 -4
- package/dist/plot/scatter/ScatterPlot.svelte +160 -450
- package/dist/plot/scatter/ScatterPlot.svelte.d.ts +7 -15
- package/dist/plot/scatter/ScatterPlotControls.svelte.d.ts +1 -1
- package/dist/plot/scatter/binned-scatter-types.d.ts +4 -11
- package/dist/plot/scatter/index.d.ts +1 -1
- package/dist/plot/scatter-3d/ScatterPlot3D.svelte +15 -26
- package/dist/plot/scatter-3d/ScatterPlot3D.svelte.d.ts +6 -14
- package/dist/plot/scatter-3d/ScatterPlot3DControls.svelte +9 -10
- package/dist/plot/scatter-3d/ScatterPlot3DControls.svelte.d.ts +5 -5
- package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte +122 -121
- package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte.d.ts +5 -14
- package/dist/plot/scatter-3d/Surface3D.svelte +6 -5
- package/dist/plot/scatter-3d/Surface3D.svelte.d.ts +4 -3
- package/dist/plot/sunburst/Sunburst.svelte +16 -20
- package/dist/plot/sunburst/Sunburst.svelte.d.ts +4 -3
- package/dist/plot/sunburst/SunburstControls.svelte.d.ts +1 -1
- package/dist/plot/sunburst/sunburst.js +4 -1
- package/dist/rdf/RdfPlot.svelte.d.ts +1 -1
- package/dist/sanitize.js +13 -2
- 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 +14 -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 +14 -2
- package/dist/settings.js +59 -1
- package/dist/spectral/Bands.svelte +8 -7
- package/dist/spectral/Bands.svelte.d.ts +3 -2
- package/dist/spectral/BandsAndDos.svelte +22 -24
- package/dist/spectral/BrillouinBandsDos.svelte +3 -3
- package/dist/spectral/Dos.svelte +5 -4
- package/dist/spectral/Dos.svelte.d.ts +2 -1
- package/dist/spectral/helpers.d.ts +6 -6
- package/dist/spectral/helpers.js +43 -37
- package/dist/state.svelte.d.ts +0 -7
- package/dist/state.svelte.js +0 -6
- package/dist/structure/Arrow.svelte +2 -4
- package/dist/structure/AtomLegend.svelte.d.ts +1 -1
- package/dist/structure/CanvasTooltip.svelte +1 -0
- package/dist/structure/CellSelect.svelte +11 -3
- package/dist/structure/CellSelect.svelte.d.ts +2 -1
- package/dist/structure/Lattice.svelte +2 -2
- package/dist/structure/Structure.svelte +291 -355
- package/dist/structure/Structure.svelte.d.ts +5 -15
- package/dist/structure/StructureControls.svelte +217 -2
- package/dist/structure/StructureControls.svelte.d.ts +5 -3
- package/dist/structure/StructureExportPane.svelte +54 -156
- package/dist/structure/StructureExportPane.svelte.d.ts +4 -5
- package/dist/structure/StructureInfoPane.svelte +5 -3
- package/dist/structure/StructureInfoPane.svelte.d.ts +5 -5
- package/dist/structure/StructureScene.svelte +365 -198
- package/dist/structure/StructureScene.svelte.d.ts +22 -20
- package/dist/structure/{label-placement.d.ts → atom-label-placement.d.ts} +3 -3
- package/dist/structure/{label-placement.js → atom-label-placement.js} +12 -2
- package/dist/structure/atom-properties.d.ts +1 -1
- package/dist/structure/atom-properties.js +11 -16
- package/dist/structure/bond-order-perception.js +2 -4
- package/dist/structure/bonding.d.ts +3 -0
- package/dist/structure/bonding.js +91 -48
- package/dist/structure/export.d.ts +24 -4
- package/dist/structure/export.js +64 -122
- package/dist/structure/index.d.ts +2 -0
- package/dist/structure/index.js +2 -0
- package/dist/structure/parse.d.ts +3 -2
- package/dist/structure/parse.js +333 -370
- package/dist/structure/partial-occupancy.d.ts +0 -1
- package/dist/structure/partial-occupancy.js +1 -1
- package/dist/structure/pbc.d.ts +1 -1
- package/dist/structure/pbc.js +186 -13
- package/dist/structure/polyhedra.d.ts +41 -0
- package/dist/structure/polyhedra.js +602 -0
- package/dist/structure/site.d.ts +4 -0
- package/dist/structure/site.js +1 -0
- package/dist/structure/supercell.js +3 -2
- 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 +354 -0
- package/dist/symmetry/SymmetryElements.svelte.d.ts +24 -0
- package/dist/symmetry/SymmetryStats.svelte +111 -6
- package/dist/symmetry/WyckoffTable.svelte +68 -7
- package/dist/symmetry/WyckoffTable.svelte.d.ts +3 -0
- package/dist/symmetry/cell-transform.js +7 -14
- package/dist/symmetry/index.d.ts +14 -4
- package/dist/symmetry/index.js +301 -80
- package/dist/symmetry/spacegroups.d.ts +5 -1
- package/dist/symmetry/spacegroups.js +15 -1
- 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 +4 -15
- package/dist/table/HeatmapTable.svelte.d.ts +1 -1
- package/dist/trajectory/Trajectory.svelte +58 -61
- package/dist/trajectory/Trajectory.svelte.d.ts +10 -22
- package/dist/trajectory/TrajectoryExportPane.svelte +15 -24
- package/dist/trajectory/TrajectoryExportPane.svelte.d.ts +4 -5
- package/dist/trajectory/TrajectoryInfoPane.svelte +3 -2
- package/dist/trajectory/TrajectoryInfoPane.svelte.d.ts +3 -2
- package/dist/trajectory/constants.js +6 -2
- package/dist/trajectory/extract.js +17 -37
- package/dist/trajectory/format-detect.d.ts +0 -1
- package/dist/trajectory/format-detect.js +3 -9
- package/dist/trajectory/frame-reader.d.ts +0 -1
- package/dist/trajectory/frame-reader.js +62 -128
- package/dist/trajectory/helpers.d.ts +10 -2
- package/dist/trajectory/helpers.js +56 -36
- 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/index.d.ts +1 -1
- package/dist/trajectory/parse/index.js +54 -102
- package/dist/trajectory/parse/lammps.d.ts +0 -2
- package/dist/trajectory/parse/lammps.js +8 -6
- package/dist/trajectory/parse/pymatgen.d.ts +2 -0
- package/dist/trajectory/parse/pymatgen.js +74 -0
- package/dist/trajectory/parse/vasp.js +4 -3
- package/dist/trajectory/parse/xyz.d.ts +9 -21
- package/dist/trajectory/parse/xyz.js +28 -33
- package/dist/trajectory/plotting.d.ts +0 -1
- package/dist/trajectory/plotting.js +3 -100
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +1 -1
- package/dist/xrd/XrdPlot.svelte +14 -29
- package/dist/xrd/broadening.d.ts +2 -1
- package/dist/xrd/calc-xrd.js +6 -11
- package/dist/xrd/index.d.ts +2 -2
- package/package.json +29 -16
- 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
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type
|
|
3
|
-
import { normalize_show_controls } from '../controls'
|
|
2
|
+
import { normalize_show_controls, type ShowControlsProp } from '../controls'
|
|
4
3
|
import EmptyState from '../EmptyState.svelte'
|
|
5
4
|
import { StatusMessage } from '../feedback'
|
|
6
5
|
import Spinner from '../feedback/Spinner.svelte'
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { create_file_drop_handler, drag_over_handlers, load_from_url } from '../io'
|
|
7
|
+
import { type FullscreenToggleProp, toggle_fullscreen, ViewerChrome } from '../layout'
|
|
8
|
+
import { sync_fullscreen } from '../layout/fullscreen.svelte'
|
|
10
9
|
import type { Vec3 } from '../math'
|
|
11
10
|
import { PlotTooltip } from '../plot'
|
|
12
11
|
import { type CameraProjection, DEFAULTS } from '../settings'
|
|
@@ -16,7 +15,6 @@
|
|
|
16
15
|
import { Canvas } from '@threlte/core'
|
|
17
16
|
import type { ComponentProps, Snippet } from 'svelte'
|
|
18
17
|
import { untrack } from 'svelte'
|
|
19
|
-
import { tooltip } from 'svelte-multiselect/attachments'
|
|
20
18
|
import type { HTMLAttributes } from 'svelte/elements'
|
|
21
19
|
import BrillouinZoneControls from './BrillouinZoneControls.svelte'
|
|
22
20
|
import BrillouinZoneExportPane from './BrillouinZoneExportPane.svelte'
|
|
@@ -90,6 +88,7 @@
|
|
|
90
88
|
on_file_load,
|
|
91
89
|
on_error,
|
|
92
90
|
on_fullscreen_change,
|
|
91
|
+
on_point_hover,
|
|
93
92
|
on_hover,
|
|
94
93
|
...rest
|
|
95
94
|
}:
|
|
@@ -111,15 +110,13 @@
|
|
|
111
110
|
ibz_color?: string
|
|
112
111
|
ibz_opacity?: number
|
|
113
112
|
ibz_data?: IrreducibleBZData | null
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
* Control names: 'filename', 'fullscreen', 'info-pane', 'export-pane', 'controls'
|
|
122
|
-
*/
|
|
113
|
+
// Controls visibility configuration.
|
|
114
|
+
// - 'always': controls always visible
|
|
115
|
+
// - 'hover': controls visible on component hover (default)
|
|
116
|
+
// - 'never': controls never visible
|
|
117
|
+
// - object: { mode, hidden, style } for fine-grained control
|
|
118
|
+
//
|
|
119
|
+
// Control names: 'filename', 'fullscreen', 'info-pane', 'export-pane', 'controls'
|
|
123
120
|
show_controls?: ShowControlsProp
|
|
124
121
|
fullscreen?: boolean
|
|
125
122
|
width?: number
|
|
@@ -129,7 +126,7 @@
|
|
|
129
126
|
hovered?: boolean
|
|
130
127
|
dragover?: boolean
|
|
131
128
|
allow_file_drop?: boolean
|
|
132
|
-
fullscreen_toggle?:
|
|
129
|
+
fullscreen_toggle?: FullscreenToggleProp
|
|
133
130
|
data_url?: string
|
|
134
131
|
on_file_drop?: (content: string | ArrayBuffer, filename: string) => void
|
|
135
132
|
spinner_props?: ComponentProps<typeof Spinner>
|
|
@@ -155,6 +152,8 @@
|
|
|
155
152
|
on_file_load?: (data: BZHandlerData) => void
|
|
156
153
|
on_error?: (data: BZHandlerData) => void
|
|
157
154
|
on_fullscreen_change?: (data: BZHandlerData) => void
|
|
155
|
+
on_point_hover?: (data: BZHoverData | null) => void
|
|
156
|
+
// Deprecated alias for on_point_hover (honored when on_point_hover is unset)
|
|
158
157
|
on_hover?: (data: BZHoverData | null) => void
|
|
159
158
|
}
|
|
160
159
|
& HTMLAttributes<HTMLDivElement> = $props()
|
|
@@ -165,9 +164,16 @@
|
|
|
165
164
|
let current_filename = $state<string | undefined>(undefined)
|
|
166
165
|
let hover_data = $state<BZHoverData | null>(null)
|
|
167
166
|
|
|
168
|
-
// Call
|
|
167
|
+
// Call on_point_hover callback when hover_data changes (on_hover is a deprecated alias)
|
|
168
|
+
let warned_deprecated_on_hover = false
|
|
169
169
|
$effect(() => {
|
|
170
|
-
on_hover
|
|
170
|
+
if (on_hover && !on_point_hover && !warned_deprecated_on_hover) {
|
|
171
|
+
warned_deprecated_on_hover = true
|
|
172
|
+
console.warn(
|
|
173
|
+
`BrillouinZone: the on_hover prop was renamed to on_point_hover; the alias will be removed in a future release`,
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
;(on_point_hover ?? on_hover)?.(hover_data)
|
|
171
177
|
})
|
|
172
178
|
|
|
173
179
|
// Normalize show_controls prop into consistent config
|
|
@@ -311,23 +317,16 @@
|
|
|
311
317
|
}
|
|
312
318
|
}
|
|
313
319
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
320
|
+
sync_fullscreen({
|
|
321
|
+
get_wrapper: () => wrapper,
|
|
322
|
+
get_fullscreen: () => fullscreen,
|
|
323
|
+
set_fullscreen: (val) => (fullscreen = val),
|
|
324
|
+
bg_css_var: `--bz-bg-fullscreen`,
|
|
325
|
+
on_change: (val) =>
|
|
326
|
+
on_fullscreen_change?.({ structure, bz_data, bz_order, fullscreen: val }),
|
|
321
327
|
})
|
|
322
328
|
</script>
|
|
323
329
|
|
|
324
|
-
<svelte:document
|
|
325
|
-
onfullscreenchange={() => {
|
|
326
|
-
fullscreen = Boolean(document.fullscreenElement)
|
|
327
|
-
on_fullscreen_change?.({ structure, bz_data, bz_order, fullscreen })
|
|
328
|
-
}}
|
|
329
|
-
/>
|
|
330
|
-
|
|
331
330
|
<div
|
|
332
331
|
class:dragover
|
|
333
332
|
class:active={info_pane_open || controls_open || export_pane_open}
|
|
@@ -339,15 +338,7 @@
|
|
|
339
338
|
onmouseenter={() => (hovered = true)}
|
|
340
339
|
onmouseleave={() => (hovered = false)}
|
|
341
340
|
ondrop={handle_file_drop}
|
|
342
|
-
|
|
343
|
-
event.preventDefault()
|
|
344
|
-
if (!allow_file_drop) return
|
|
345
|
-
dragover = true
|
|
346
|
-
}}
|
|
347
|
-
ondragleave={(event) => {
|
|
348
|
-
event.preventDefault()
|
|
349
|
-
dragover = false
|
|
350
|
-
}}
|
|
341
|
+
{...drag_over_handlers({ allow: () => allow_file_drop, set_dragover: (over) => dragover = over })}
|
|
351
342
|
{onkeydown}
|
|
352
343
|
{...rest}
|
|
353
344
|
class="brillouin-zone {rest.class ?? ``}"
|
|
@@ -358,65 +349,45 @@
|
|
|
358
349
|
{:else if error_msg}
|
|
359
350
|
<StatusMessage bind:message={error_msg} type="error" dismissible />
|
|
360
351
|
{:else if structure && `lattice` in structure}
|
|
361
|
-
<
|
|
362
|
-
|
|
363
|
-
|
|
352
|
+
<ViewerChrome
|
|
353
|
+
{controls_config}
|
|
354
|
+
filename={current_filename}
|
|
355
|
+
{fullscreen}
|
|
356
|
+
{fullscreen_toggle}
|
|
357
|
+
{wrapper}
|
|
364
358
|
>
|
|
365
|
-
{#if controls_config.
|
|
366
|
-
{
|
|
367
|
-
|
|
368
|
-
{/if}
|
|
369
|
-
|
|
370
|
-
{#if fullscreen_toggle && controls_config.visible(`fullscreen`)}
|
|
371
|
-
<button
|
|
372
|
-
type="button"
|
|
373
|
-
onclick={() => fullscreen_toggle && toggle_fullscreen(wrapper)}
|
|
374
|
-
title="{fullscreen ? `Exit` : `Enter`} fullscreen"
|
|
375
|
-
aria-pressed={fullscreen}
|
|
376
|
-
class="fullscreen-toggle"
|
|
377
|
-
{@attach tooltip()}
|
|
378
|
-
>
|
|
379
|
-
{#if typeof fullscreen_toggle === `function`}
|
|
380
|
-
{@render fullscreen_toggle({ fullscreen })}
|
|
381
|
-
{:else}
|
|
382
|
-
<Icon icon="{fullscreen ? `Exit` : ``}Fullscreen" />
|
|
383
|
-
{/if}
|
|
384
|
-
</button>
|
|
385
|
-
{/if}
|
|
386
|
-
|
|
387
|
-
{#if controls_config.visible(`info-pane`)}
|
|
388
|
-
<BrillouinZoneInfoPane {structure} {bz_data} bind:pane_open={info_pane_open} />
|
|
389
|
-
{/if}
|
|
359
|
+
{#if controls_config.visible(`info-pane`)}
|
|
360
|
+
<BrillouinZoneInfoPane {structure} {bz_data} bind:pane_open={info_pane_open} />
|
|
361
|
+
{/if}
|
|
390
362
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
363
|
+
{#if controls_config.visible(`export-pane`)}
|
|
364
|
+
<BrillouinZoneExportPane
|
|
365
|
+
bind:export_pane_open
|
|
366
|
+
{bz_data}
|
|
367
|
+
{wrapper}
|
|
368
|
+
{scene}
|
|
369
|
+
{camera}
|
|
370
|
+
bind:png_dpi
|
|
371
|
+
filename={current_filename || `brillouin-zone`}
|
|
372
|
+
/>
|
|
373
|
+
{/if}
|
|
402
374
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
{/if}
|
|
375
|
+
{#if controls_config.visible(`controls`)}
|
|
376
|
+
<BrillouinZoneControls
|
|
377
|
+
bind:controls_open
|
|
378
|
+
bind:bz_order
|
|
379
|
+
bind:surface_color
|
|
380
|
+
bind:surface_opacity
|
|
381
|
+
bind:edge_color
|
|
382
|
+
bind:edge_width
|
|
383
|
+
bind:show_vectors
|
|
384
|
+
bind:camera_projection
|
|
385
|
+
bind:show_ibz
|
|
386
|
+
bind:ibz_color
|
|
387
|
+
bind:ibz_opacity
|
|
388
|
+
/>
|
|
418
389
|
{/if}
|
|
419
|
-
</
|
|
390
|
+
</ViewerChrome>
|
|
420
391
|
|
|
421
392
|
{#if typeof WebGLRenderingContext !== `undefined`}
|
|
422
393
|
<div style="overflow: hidden; height: 100%">
|
|
@@ -452,7 +423,7 @@
|
|
|
452
423
|
y={hover_data.screen_position.y}
|
|
453
424
|
bg_color={hover_data.is_ibz ? ibz_color : surface_color}
|
|
454
425
|
fixed
|
|
455
|
-
style="z-index: calc(var(--
|
|
426
|
+
style="z-index: calc(var(--z-index-overlay-controls, 100000000) + 1); backdrop-filter: blur(4px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3)"
|
|
456
427
|
>
|
|
457
428
|
<BrillouinZoneTooltip {hover_data} tooltip={tooltip_config} />
|
|
458
429
|
</PlotTooltip>
|
|
@@ -499,54 +470,6 @@
|
|
|
499
470
|
.brillouin-zone :global(canvas) {
|
|
500
471
|
user-select: none;
|
|
501
472
|
}
|
|
502
|
-
section.control-buttons {
|
|
503
|
-
position: absolute;
|
|
504
|
-
display: flex;
|
|
505
|
-
top: var(--bz-buttons-top, var(--ctrl-btn-top, 1ex));
|
|
506
|
-
right: var(--bz-buttons-right, var(--ctrl-btn-right, 1ex));
|
|
507
|
-
gap: clamp(6pt, 1cqmin, 9pt);
|
|
508
|
-
z-index: var(
|
|
509
|
-
--bz-buttons-z-index,
|
|
510
|
-
var(--z-index-overlay-controls, 100000000)
|
|
511
|
-
);
|
|
512
|
-
opacity: 0;
|
|
513
|
-
pointer-events: none;
|
|
514
|
-
transition: opacity 0.2s ease;
|
|
515
|
-
align-items: center;
|
|
516
|
-
}
|
|
517
|
-
/* Mode: always - controls always visible */
|
|
518
|
-
section.control-buttons.always-visible {
|
|
519
|
-
opacity: 1;
|
|
520
|
-
pointer-events: auto;
|
|
521
|
-
}
|
|
522
|
-
/* Mode: hover - controls visible on component hover */
|
|
523
|
-
.brillouin-zone:hover section.control-buttons.hover-visible,
|
|
524
|
-
.brillouin-zone:focus-within section.control-buttons.hover-visible {
|
|
525
|
-
opacity: 1;
|
|
526
|
-
pointer-events: auto;
|
|
527
|
-
}
|
|
528
|
-
/* Mode: never - stays hidden (default state, no additional CSS needed) */
|
|
529
|
-
section.control-buttons > :global(button) {
|
|
530
|
-
background-color: transparent;
|
|
531
|
-
display: flex;
|
|
532
|
-
padding: 4px;
|
|
533
|
-
border-radius: var(--border-radius, 3pt);
|
|
534
|
-
font-size: clamp(0.85em, 2cqmin, 1.3em);
|
|
535
|
-
}
|
|
536
|
-
section.control-buttons :global(button:hover) {
|
|
537
|
-
background-color: color-mix(in srgb, currentColor 8%, transparent);
|
|
538
|
-
}
|
|
539
|
-
.filename {
|
|
540
|
-
font-family: monospace;
|
|
541
|
-
font-size: 0.9em;
|
|
542
|
-
background: var(--code-bg, rgba(0, 0, 0, 0.1));
|
|
543
|
-
padding: 3pt 6pt;
|
|
544
|
-
border-radius: 3pt;
|
|
545
|
-
max-width: 200px;
|
|
546
|
-
overflow: hidden;
|
|
547
|
-
text-overflow: ellipsis;
|
|
548
|
-
white-space: nowrap;
|
|
549
|
-
}
|
|
550
473
|
p.warn {
|
|
551
474
|
text-align: center;
|
|
552
475
|
padding: 2rem;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ShowControlsProp } from '../controls';
|
|
2
2
|
import Spinner from '../feedback/Spinner.svelte';
|
|
3
|
+
import { type FullscreenToggleProp } from '../layout';
|
|
3
4
|
import type { Vec3 } from '../math';
|
|
4
5
|
import { type CameraProjection } from '../settings';
|
|
5
6
|
import type { Crystal } from '../structure';
|
|
@@ -32,15 +33,6 @@ type $$ComponentProps = {
|
|
|
32
33
|
ibz_color?: string;
|
|
33
34
|
ibz_opacity?: number;
|
|
34
35
|
ibz_data?: IrreducibleBZData | null;
|
|
35
|
-
/**
|
|
36
|
-
* Controls visibility configuration.
|
|
37
|
-
* - 'always': controls always visible
|
|
38
|
-
* - 'hover': controls visible on component hover (default)
|
|
39
|
-
* - 'never': controls never visible
|
|
40
|
-
* - object: { mode, hidden, style } for fine-grained control
|
|
41
|
-
*
|
|
42
|
-
* Control names: 'filename', 'fullscreen', 'info-pane', 'export-pane', 'controls'
|
|
43
|
-
*/
|
|
44
36
|
show_controls?: ShowControlsProp;
|
|
45
37
|
fullscreen?: boolean;
|
|
46
38
|
width?: number;
|
|
@@ -50,9 +42,7 @@ type $$ComponentProps = {
|
|
|
50
42
|
hovered?: boolean;
|
|
51
43
|
dragover?: boolean;
|
|
52
44
|
allow_file_drop?: boolean;
|
|
53
|
-
fullscreen_toggle?:
|
|
54
|
-
fullscreen: boolean;
|
|
55
|
-
}]> | boolean;
|
|
45
|
+
fullscreen_toggle?: FullscreenToggleProp;
|
|
56
46
|
data_url?: string;
|
|
57
47
|
on_file_drop?: (content: string | ArrayBuffer, filename: string) => void;
|
|
58
48
|
spinner_props?: ComponentProps<typeof Spinner>;
|
|
@@ -77,8 +67,9 @@ type $$ComponentProps = {
|
|
|
77
67
|
on_file_load?: (data: BZHandlerData) => void;
|
|
78
68
|
on_error?: (data: BZHandlerData) => void;
|
|
79
69
|
on_fullscreen_change?: (data: BZHandlerData) => void;
|
|
70
|
+
on_point_hover?: (data: BZHoverData | null) => void;
|
|
80
71
|
on_hover?: (data: BZHoverData | null) => void;
|
|
81
72
|
} & HTMLAttributes<HTMLDivElement>;
|
|
82
|
-
declare const BrillouinZone: import("svelte").Component<$$ComponentProps, {}, "structure" | "
|
|
73
|
+
declare const BrillouinZone: import("svelte").Component<$$ComponentProps, {}, "structure" | "height" | "width" | "dragover" | "fullscreen" | "wrapper" | "hovered" | "controls_open" | "loading" | "camera_projection" | "vector_scale" | "png_dpi" | "info_pane_open" | "error_msg" | "bz_order" | "surface_color" | "surface_opacity" | "edge_color" | "edge_width" | "show_vectors" | "show_ibz" | "ibz_color" | "ibz_opacity" | "bz_data" | "ibz_data">;
|
|
83
74
|
type BrillouinZone = ReturnType<typeof BrillouinZone>;
|
|
84
75
|
export default BrillouinZone;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import type { ExportSection } from '../io'
|
|
3
|
+
import ExportPane from '../io/ExportPane.svelte'
|
|
2
4
|
import { export_canvas_as_png } from '../io/export'
|
|
3
|
-
import
|
|
4
|
-
import type { ComponentProps } from 'svelte'
|
|
5
|
-
import { CopyButton } from 'svelte-multiselect'
|
|
6
|
-
import { tooltip } from 'svelte-multiselect/attachments'
|
|
5
|
+
import { download } from '../io/fetch'
|
|
7
6
|
import type { HTMLAttributes } from 'svelte/elements'
|
|
8
7
|
import type { Camera, Scene } from 'three'
|
|
9
8
|
import type { BrillouinZoneData } from './types'
|
|
@@ -27,30 +26,11 @@
|
|
|
27
26
|
png_dpi?: number
|
|
28
27
|
} = $props()
|
|
29
28
|
|
|
30
|
-
let json_copy_state = $state<ComponentProps<typeof CopyButton>[`state`]>(`ready`)
|
|
31
|
-
|
|
32
29
|
function export_as_png() {
|
|
33
30
|
const canvas = wrapper?.querySelector(`canvas`)
|
|
34
31
|
if (!canvas || !scene || !camera) return
|
|
35
|
-
|
|
36
|
-
const dpi = Math.max(50, Math.min(600, Math.trunc(png_dpi)))
|
|
37
32
|
const png_name = `${filename}-${bz_data?.order ?? `1`}.png`
|
|
38
|
-
export_canvas_as_png(canvas, png_name,
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function export_as_json() {
|
|
42
|
-
const json_data = get_json_data()
|
|
43
|
-
if (!json_data || !bz_data) return
|
|
44
|
-
|
|
45
|
-
const blob = new Blob([JSON.stringify(json_data, null, 2)], {
|
|
46
|
-
type: `application/json`,
|
|
47
|
-
})
|
|
48
|
-
const url = URL.createObjectURL(blob)
|
|
49
|
-
const link = document.createElement(`a`)
|
|
50
|
-
link.href = url
|
|
51
|
-
link.download = `${filename}-bz-order-${bz_data.order}.json`
|
|
52
|
-
link.click()
|
|
53
|
-
URL.revokeObjectURL(url)
|
|
33
|
+
export_canvas_as_png(canvas, png_name, png_dpi, scene, camera)
|
|
54
34
|
}
|
|
55
35
|
|
|
56
36
|
function get_json_data() {
|
|
@@ -65,82 +45,49 @@
|
|
|
65
45
|
}
|
|
66
46
|
}
|
|
67
47
|
|
|
68
|
-
|
|
48
|
+
function export_as_json() {
|
|
69
49
|
const json_data = get_json_data()
|
|
70
|
-
|
|
71
|
-
|
|
50
|
+
if (!json_data || !bz_data) return
|
|
51
|
+
download(
|
|
52
|
+
JSON.stringify(json_data, null, 2),
|
|
53
|
+
`${filename}-bz-order-${bz_data.order}.json`,
|
|
54
|
+
`application/json`,
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const sections = $derived<ExportSection[]>([
|
|
59
|
+
{
|
|
60
|
+
title: `Export as image`,
|
|
61
|
+
items: [{
|
|
62
|
+
label: `PNG`,
|
|
63
|
+
disabled: !scene || !camera,
|
|
64
|
+
show_dpi: true,
|
|
65
|
+
on_download: export_as_png,
|
|
66
|
+
}],
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
title: `Export as data`,
|
|
70
|
+
tooltip: `Includes vertices, faces, edges, and reciprocal lattice vectors`,
|
|
71
|
+
items: [{
|
|
72
|
+
label: `JSON`,
|
|
73
|
+
disabled: !bz_data,
|
|
74
|
+
on_download: export_as_json,
|
|
75
|
+
copy_text: () => {
|
|
76
|
+
const json_data = get_json_data()
|
|
77
|
+
return json_data ? JSON.stringify(json_data, null, 2) : null
|
|
78
|
+
},
|
|
79
|
+
}],
|
|
80
|
+
},
|
|
81
|
+
])
|
|
72
82
|
</script>
|
|
73
83
|
|
|
74
|
-
<
|
|
75
|
-
bind:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
pane_props={{ ...rest, class: `export-pane ${rest.class ?? ``}` }}
|
|
84
|
+
<ExportPane
|
|
85
|
+
bind:export_pane_open
|
|
86
|
+
bind:png_dpi
|
|
87
|
+
{sections}
|
|
79
88
|
toggle_props={{
|
|
80
89
|
class: `bz-export-toggle`,
|
|
81
90
|
title: export_pane_open ? `` : `Export Brillouin zone`,
|
|
82
91
|
}}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
<label>
|
|
86
|
-
PNG
|
|
87
|
-
<button
|
|
88
|
-
type="button"
|
|
89
|
-
onclick={export_as_png}
|
|
90
|
-
disabled={!scene || !camera}
|
|
91
|
-
title="PNG ({png_dpi} DPI)"
|
|
92
|
-
>
|
|
93
|
-
⬇
|
|
94
|
-
</button>
|
|
95
|
-
(DPI: <input
|
|
96
|
-
type="number"
|
|
97
|
-
min={72}
|
|
98
|
-
max={600}
|
|
99
|
-
bind:value={png_dpi}
|
|
100
|
-
title="Export resolution in dots per inch"
|
|
101
|
-
/>)
|
|
102
|
-
</label>
|
|
103
|
-
|
|
104
|
-
<h4 id="export-as-data"
|
|
105
|
-
{@attach tooltip({ content: `Includes vertices, faces, edges, and reciprocal lattice vectors` })}
|
|
106
|
-
>
|
|
107
|
-
Export as data
|
|
108
|
-
</h4>
|
|
109
|
-
<label>
|
|
110
|
-
JSON
|
|
111
|
-
<button
|
|
112
|
-
type="button"
|
|
113
|
-
onclick={export_as_json}
|
|
114
|
-
disabled={!bz_data}
|
|
115
|
-
title="Download JSON"
|
|
116
|
-
>
|
|
117
|
-
⬇
|
|
118
|
-
</button>
|
|
119
|
-
<CopyButton
|
|
120
|
-
content={json_string ?? ``}
|
|
121
|
-
bind:state={json_copy_state}
|
|
122
|
-
disabled={!json_string}
|
|
123
|
-
title="Copy JSON to clipboard"
|
|
124
|
-
/>
|
|
125
|
-
</label>
|
|
126
|
-
</DraggablePane>
|
|
127
|
-
|
|
128
|
-
<style>
|
|
129
|
-
label {
|
|
130
|
-
display: flex;
|
|
131
|
-
flex-wrap: wrap;
|
|
132
|
-
align-items: center;
|
|
133
|
-
gap: 4pt;
|
|
134
|
-
font-size: 0.95em;
|
|
135
|
-
}
|
|
136
|
-
button {
|
|
137
|
-
width: 1.9em;
|
|
138
|
-
height: 1.6em;
|
|
139
|
-
padding: 0 6pt;
|
|
140
|
-
margin: 0 0 0 4pt;
|
|
141
|
-
box-sizing: border-box;
|
|
142
|
-
}
|
|
143
|
-
input {
|
|
144
|
-
margin: 0 0 0 2pt;
|
|
145
|
-
}
|
|
146
|
-
</style>
|
|
92
|
+
{...rest}
|
|
93
|
+
/>
|
|
@@ -10,6 +10,6 @@ type $$ComponentProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
10
10
|
filename?: string;
|
|
11
11
|
png_dpi?: number;
|
|
12
12
|
};
|
|
13
|
-
declare const BrillouinZoneExportPane: import("svelte").Component<$$ComponentProps, {}, "
|
|
13
|
+
declare const BrillouinZoneExportPane: import("svelte").Component<$$ComponentProps, {}, "export_pane_open" | "png_dpi">;
|
|
14
14
|
type BrillouinZoneExportPane = ReturnType<typeof BrillouinZoneExportPane>;
|
|
15
15
|
export default BrillouinZoneExportPane;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import type { PaneProps } from '../overlays'
|
|
2
3
|
import type { InfoItem } from '../layout'
|
|
3
4
|
import DraggablePane from '../overlays/DraggablePane.svelte'
|
|
5
|
+
import InfoPaneCards from '../overlays/InfoPaneCards.svelte'
|
|
4
6
|
import { format_num } from '../labels'
|
|
5
|
-
import { sanitize_html } from '../sanitize'
|
|
6
7
|
import type { Crystal } from '../structure'
|
|
7
8
|
import { analyze_structure_symmetry } from '../symmetry'
|
|
8
9
|
import type { MoyoDataset } from '@spglib/moyo-wasm'
|
|
@@ -18,7 +19,7 @@
|
|
|
18
19
|
pane_open?: boolean
|
|
19
20
|
structure?: Crystal
|
|
20
21
|
bz_data?: BrillouinZoneData
|
|
21
|
-
pane_props?:
|
|
22
|
+
pane_props?: PaneProps
|
|
22
23
|
} = $props()
|
|
23
24
|
|
|
24
25
|
let sym_data = $state<MoyoDataset | null>(null)
|
|
@@ -112,35 +113,11 @@
|
|
|
112
113
|
toggle_props={{ class: `bz-info-toggle`, title: `Brillouin zone info` }}
|
|
113
114
|
pane_props={{ ...pane_props, class: `bz-info-pane ${pane_props?.class ?? ``}` }}
|
|
114
115
|
>
|
|
115
|
-
|
|
116
|
-
{
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
<span>{item.label}</span>
|
|
122
|
-
<span>{@html sanitize_html(item.value)}</span>
|
|
123
|
-
</div>
|
|
124
|
-
{/each}
|
|
125
|
-
</section>
|
|
126
|
-
{/each}
|
|
116
|
+
<InfoPaneCards
|
|
117
|
+
cards={pane_data.map(({ title, items }) => ({ title, rows: items }))}
|
|
118
|
+
show_filter={false}
|
|
119
|
+
filter_placeholder="Filter Brillouin zone info"
|
|
120
|
+
empty_label="Brillouin zone info"
|
|
121
|
+
/>
|
|
127
122
|
</DraggablePane>
|
|
128
123
|
{/if}
|
|
129
|
-
|
|
130
|
-
<style>
|
|
131
|
-
section div.info-item {
|
|
132
|
-
display: flex;
|
|
133
|
-
justify-content: space-between;
|
|
134
|
-
gap: 6pt;
|
|
135
|
-
padding: 1pt;
|
|
136
|
-
line-height: 1.5;
|
|
137
|
-
}
|
|
138
|
-
h4 {
|
|
139
|
-
margin: 0.5em 0;
|
|
140
|
-
}
|
|
141
|
-
hr {
|
|
142
|
-
border: none;
|
|
143
|
-
border-top: 1px solid var(--divider-color, rgba(128, 128, 128, 0.2));
|
|
144
|
-
margin: 0.5em 0;
|
|
145
|
-
}
|
|
146
|
-
</style>
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { PaneProps } from '../overlays';
|
|
2
2
|
import type { Crystal } from '../structure';
|
|
3
|
-
import type { ComponentProps } from 'svelte';
|
|
4
3
|
import type { BrillouinZoneData } from './types';
|
|
5
4
|
type $$ComponentProps = {
|
|
6
5
|
pane_open?: boolean;
|
|
7
6
|
structure?: Crystal;
|
|
8
7
|
bz_data?: BrillouinZoneData;
|
|
9
|
-
pane_props?:
|
|
8
|
+
pane_props?: PaneProps;
|
|
10
9
|
};
|
|
11
10
|
declare const BrillouinZoneInfoPane: import("svelte").Component<$$ComponentProps, {}, "pane_open">;
|
|
12
11
|
type BrillouinZoneInfoPane = ReturnType<typeof BrillouinZoneInfoPane>;
|