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,7 +1,8 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type
|
|
1
|
+
import { type ShowControlsProp } from '../controls';
|
|
2
|
+
import { type ElementSymbol } from '../element';
|
|
3
3
|
import Spinner from '../feedback/Spinner.svelte';
|
|
4
4
|
import type { IsosurfaceSettings, VolumetricData } from '../isosurface/types';
|
|
5
|
+
import { type FullscreenToggleProp } from '../layout';
|
|
5
6
|
import type { AnyStructure, BondEditMode, BondOrder, MeasureMode, StructureBond } from './';
|
|
6
7
|
import type { CellType, SymmetrySettings } from '../symmetry';
|
|
7
8
|
import type { MoyoDataset } from '@spglib/moyo-wasm';
|
|
@@ -17,15 +18,6 @@ type $$ComponentProps = {
|
|
|
17
18
|
structure?: AnyStructure;
|
|
18
19
|
bonds?: StructureBond[];
|
|
19
20
|
scene_props?: ComponentProps<typeof StructureScene>;
|
|
20
|
-
/**
|
|
21
|
-
* Controls visibility configuration.
|
|
22
|
-
* - 'always': controls always visible
|
|
23
|
-
* - 'hover': controls visible on component hover (default)
|
|
24
|
-
* - 'never': controls never visible
|
|
25
|
-
* - object: { mode, hidden, style } for fine-grained control
|
|
26
|
-
*
|
|
27
|
-
* Control names: 'reset-camera', 'fullscreen', 'measure-mode', 'info-pane', 'export-pane', 'controls'
|
|
28
|
-
*/
|
|
29
21
|
show_controls?: ShowControlsProp;
|
|
30
22
|
fullscreen?: boolean;
|
|
31
23
|
width?: number;
|
|
@@ -42,9 +34,7 @@ type $$ComponentProps = {
|
|
|
42
34
|
bond_edit_mode?: BondEditMode;
|
|
43
35
|
bond_edit_order?: BondOrder;
|
|
44
36
|
info_pane_open?: boolean;
|
|
45
|
-
fullscreen_toggle?:
|
|
46
|
-
fullscreen: boolean;
|
|
47
|
-
}]> | boolean;
|
|
37
|
+
fullscreen_toggle?: FullscreenToggleProp;
|
|
48
38
|
bottom_left?: Snippet<[{
|
|
49
39
|
structure?: AnyStructure;
|
|
50
40
|
}]>;
|
|
@@ -84,6 +74,6 @@ type $$ComponentProps = {
|
|
|
84
74
|
on_camera_reset?: EventHandler;
|
|
85
75
|
on_bonds_change?: (bonds: StructureBond[] | undefined) => void;
|
|
86
76
|
} & Omit<ComponentProps<typeof StructureControls>, `children` | `onclose`> & Omit<HTMLAttributes<HTMLDivElement>, `children`>;
|
|
87
|
-
declare const Structure: import("svelte").Component<$$ComponentProps, {}, "structure" | "
|
|
77
|
+
declare const Structure: import("svelte").Component<$$ComponentProps, {}, "structure" | "height" | "width" | "dragover" | "color_scheme" | "fullscreen" | "wrapper" | "hovered" | "controls_open" | "bonds" | "sym_data" | "background_color" | "background_opacity" | "atom_color_config" | "hidden_elements" | "hidden_prop_vals" | "element_mapping" | "element_radius_overrides" | "site_radius_overrides" | "selected_sites" | "supercell_scaling" | "cell_type" | "loading" | "active_volume_idx" | "measured_sites" | "bond_edit_mode" | "scene_props" | "lattice_props" | "show_image_atoms" | "volumetric_data" | "isosurface_settings" | "png_dpi" | "highlighted_sites" | "hovered_site_idx" | "measure_mode" | "bond_edit_order" | "info_pane_open" | "enable_measure_mode" | "error_msg" | "performance_mode" | "displayed_structure" | "symmetry_settings">;
|
|
88
78
|
type Structure = ReturnType<typeof Structure>;
|
|
89
79
|
export default Structure;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import type { PaneProps, PaneToggleProps } from '../overlays'
|
|
2
3
|
import type { ColorSchemeName, D3InterpolateName } from '../colors'
|
|
3
4
|
import { AXIS_COLORS, ELEMENT_COLOR_SCHEMES } from '../colors'
|
|
4
5
|
import IsosurfaceControls from '../isosurface/IsosurfaceControls.svelte'
|
|
@@ -19,6 +20,7 @@
|
|
|
19
20
|
VECTOR_PALETTE,
|
|
20
21
|
} from './'
|
|
21
22
|
import type { AtomColorConfig } from './atom-properties'
|
|
23
|
+
import { get_majority_element } from './bonding'
|
|
22
24
|
import { is_valid_supercell_input } from './supercell'
|
|
23
25
|
import type { CellType } from '../symmetry'
|
|
24
26
|
import type { MoyoDataset } from '@spglib/moyo-wasm'
|
|
@@ -54,6 +56,7 @@
|
|
|
54
56
|
volumetric_data = $bindable<VolumetricData[]>(),
|
|
55
57
|
isosurface_settings = $bindable<IsosurfaceSettings>(),
|
|
56
58
|
active_volume_idx = $bindable(0),
|
|
59
|
+
polyhedra_rendered_elements = [],
|
|
57
60
|
pane_props = {},
|
|
58
61
|
toggle_props = {},
|
|
59
62
|
...rest
|
|
@@ -74,8 +77,9 @@
|
|
|
74
77
|
volumetric_data?: VolumetricData[] // Volumetric data volumes for isosurface controls
|
|
75
78
|
isosurface_settings?: IsosurfaceSettings // Isosurface rendering settings
|
|
76
79
|
active_volume_idx?: number // Active volume index
|
|
77
|
-
|
|
78
|
-
|
|
80
|
+
polyhedra_rendered_elements?: string[] // elements currently anchoring polyhedra
|
|
81
|
+
pane_props?: PaneProps
|
|
82
|
+
toggle_props?: PaneToggleProps
|
|
79
83
|
} = $props()
|
|
80
84
|
|
|
81
85
|
// Color scheme selection state
|
|
@@ -112,6 +116,44 @@
|
|
|
112
116
|
}
|
|
113
117
|
})
|
|
114
118
|
|
|
119
|
+
// Unique majority elements in the structure, for polyhedra center toggles.
|
|
120
|
+
// Majority (not all) species so the list matches what compute_polyhedra can
|
|
121
|
+
// actually use as centers - minority occupancies of disordered sites never are.
|
|
122
|
+
let structure_elements = $derived(
|
|
123
|
+
[
|
|
124
|
+
...new Set(
|
|
125
|
+
(structure?.sites ?? []).flatMap((site) => get_majority_element(site) ?? []),
|
|
126
|
+
),
|
|
127
|
+
].sort(),
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
// An element counts as an enabled polyhedra center if it isn't excluded and is
|
|
131
|
+
// either force-included or currently rendered. Using configured intent (not just
|
|
132
|
+
// the transient render state) keeps the checkbox reversible: a force-included
|
|
133
|
+
// element that the CN/geometry filters can't render still shows checked, so the
|
|
134
|
+
// user can toggle it back off.
|
|
135
|
+
const is_polyhedra_center_enabled = (element: string): boolean => {
|
|
136
|
+
const excluded = scene_props.polyhedra_excluded_elements ?? []
|
|
137
|
+
const included = scene_props.polyhedra_included_elements ?? []
|
|
138
|
+
return !excluded.includes(element) &&
|
|
139
|
+
(included.includes(element) || polyhedra_rendered_elements.includes(element))
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Toggle an element as polyhedra center. Enabled elements get excluded; disabled
|
|
143
|
+
// ones get force-included (which also bypasses the automatic hiding of spectator
|
|
144
|
+
// cations like Li/Na/Ba).
|
|
145
|
+
function toggle_polyhedra_element(element: string) {
|
|
146
|
+
const excluded = scene_props.polyhedra_excluded_elements ?? []
|
|
147
|
+
const included = scene_props.polyhedra_included_elements ?? []
|
|
148
|
+
if (is_polyhedra_center_enabled(element)) {
|
|
149
|
+
scene_props.polyhedra_excluded_elements = [...new Set([...excluded, element])]
|
|
150
|
+
scene_props.polyhedra_included_elements = included.filter((el) => el !== element)
|
|
151
|
+
} else {
|
|
152
|
+
scene_props.polyhedra_excluded_elements = excluded.filter((el) => el !== element)
|
|
153
|
+
scene_props.polyhedra_included_elements = [...new Set([...included, element])]
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
115
157
|
const hex_color_pattern = /^#[0-9a-f]{3}([0-9a-f]{3})?$/i
|
|
116
158
|
const color_mix_pattern =
|
|
117
159
|
/^color-mix\(in srgb,\s*(#[0-9a-f]{3}(?:[0-9a-f]{3})?)\s+(\d+(?:\.\d+)?)%,\s*transparent\)$/i
|
|
@@ -293,6 +335,7 @@
|
|
|
293
335
|
current_values={{
|
|
294
336
|
show_atoms: scene_props.show_atoms,
|
|
295
337
|
show_bonds: scene_props.show_bonds,
|
|
338
|
+
show_polyhedra: scene_props.show_polyhedra,
|
|
296
339
|
show_image_atoms,
|
|
297
340
|
show_site_labels: scene_props.show_site_labels,
|
|
298
341
|
show_site_indices: scene_props.show_site_indices,
|
|
@@ -302,6 +345,7 @@
|
|
|
302
345
|
on_reset={() => {
|
|
303
346
|
scene_props.show_atoms = DEFAULTS.structure.show_atoms
|
|
304
347
|
scene_props.show_bonds = DEFAULTS.structure.show_bonds
|
|
348
|
+
scene_props.show_polyhedra = DEFAULTS.structure.show_polyhedra
|
|
305
349
|
scene_props.show_site_labels = DEFAULTS.structure.show_site_labels
|
|
306
350
|
scene_props.show_site_indices = DEFAULTS.structure.show_site_indices
|
|
307
351
|
scene_props.vector_configs = default_vector_configs(available_vector_keys)
|
|
@@ -394,6 +438,20 @@
|
|
|
394
438
|
{/each}
|
|
395
439
|
</select>
|
|
396
440
|
</label>
|
|
441
|
+
<label
|
|
442
|
+
{@attach tooltip({ content: SETTINGS_CONFIG.structure.show_polyhedra.description })}
|
|
443
|
+
style="gap: 6pt"
|
|
444
|
+
>
|
|
445
|
+
Polyhedra:
|
|
446
|
+
<select bind:value={scene_props.show_polyhedra}>
|
|
447
|
+
{#each Object.entries(SETTINGS_CONFIG.structure.show_polyhedra.enum ?? {}) as
|
|
448
|
+
[value, label]
|
|
449
|
+
(value)
|
|
450
|
+
}
|
|
451
|
+
<option {value}>{label}</option>
|
|
452
|
+
{/each}
|
|
453
|
+
</select>
|
|
454
|
+
</label>
|
|
397
455
|
</SettingsSection>
|
|
398
456
|
|
|
399
457
|
<SettingsSection
|
|
@@ -1215,6 +1273,163 @@
|
|
|
1215
1273
|
</label>
|
|
1216
1274
|
</SettingsSection>
|
|
1217
1275
|
{/if}
|
|
1276
|
+
|
|
1277
|
+
{#if scene_props.show_polyhedra && scene_props.show_polyhedra !== `never`}
|
|
1278
|
+
<SettingsSection
|
|
1279
|
+
title="Polyhedra"
|
|
1280
|
+
current_values={{
|
|
1281
|
+
polyhedra_opacity: scene_props.polyhedra_opacity,
|
|
1282
|
+
polyhedra_show_edges: scene_props.polyhedra_show_edges,
|
|
1283
|
+
polyhedra_edge_color: scene_props.polyhedra_edge_color,
|
|
1284
|
+
polyhedra_color_mode: scene_props.polyhedra_color_mode,
|
|
1285
|
+
polyhedra_color: scene_props.polyhedra_color,
|
|
1286
|
+
polyhedra_hide_center_atoms: scene_props.polyhedra_hide_center_atoms,
|
|
1287
|
+
polyhedra_min_neighbors: scene_props.polyhedra_min_neighbors,
|
|
1288
|
+
polyhedra_max_neighbors: scene_props.polyhedra_max_neighbors,
|
|
1289
|
+
polyhedra_excluded_elements: scene_props.polyhedra_excluded_elements,
|
|
1290
|
+
polyhedra_included_elements: scene_props.polyhedra_included_elements,
|
|
1291
|
+
}}
|
|
1292
|
+
on_reset={() => {
|
|
1293
|
+
scene_props.polyhedra_opacity = DEFAULTS.structure.polyhedra_opacity
|
|
1294
|
+
scene_props.polyhedra_show_edges = DEFAULTS.structure.polyhedra_show_edges
|
|
1295
|
+
scene_props.polyhedra_edge_color = DEFAULTS.structure.polyhedra_edge_color
|
|
1296
|
+
scene_props.polyhedra_color_mode = DEFAULTS.structure.polyhedra_color_mode
|
|
1297
|
+
scene_props.polyhedra_color = DEFAULTS.structure.polyhedra_color
|
|
1298
|
+
scene_props.polyhedra_hide_center_atoms =
|
|
1299
|
+
DEFAULTS.structure.polyhedra_hide_center_atoms
|
|
1300
|
+
scene_props.polyhedra_min_neighbors = DEFAULTS.structure.polyhedra_min_neighbors
|
|
1301
|
+
scene_props.polyhedra_max_neighbors = DEFAULTS.structure.polyhedra_max_neighbors
|
|
1302
|
+
scene_props.polyhedra_excluded_elements =
|
|
1303
|
+
DEFAULTS.structure.polyhedra_excluded_elements
|
|
1304
|
+
scene_props.polyhedra_included_elements =
|
|
1305
|
+
DEFAULTS.structure.polyhedra_included_elements
|
|
1306
|
+
}}
|
|
1307
|
+
>
|
|
1308
|
+
<label
|
|
1309
|
+
{@attach tooltip({
|
|
1310
|
+
content: SETTINGS_CONFIG.structure.polyhedra_opacity.description,
|
|
1311
|
+
})}
|
|
1312
|
+
>
|
|
1313
|
+
Opacity
|
|
1314
|
+
<input
|
|
1315
|
+
type="number"
|
|
1316
|
+
min={0}
|
|
1317
|
+
max={1}
|
|
1318
|
+
step={0.05}
|
|
1319
|
+
bind:value={scene_props.polyhedra_opacity}
|
|
1320
|
+
/>
|
|
1321
|
+
<input
|
|
1322
|
+
type="range"
|
|
1323
|
+
min={0}
|
|
1324
|
+
max={1}
|
|
1325
|
+
step={0.05}
|
|
1326
|
+
bind:value={scene_props.polyhedra_opacity}
|
|
1327
|
+
/>
|
|
1328
|
+
</label>
|
|
1329
|
+
<label
|
|
1330
|
+
{@attach tooltip({
|
|
1331
|
+
content: SETTINGS_CONFIG.structure.polyhedra_color_mode.description,
|
|
1332
|
+
})}
|
|
1333
|
+
>
|
|
1334
|
+
Color <select bind:value={scene_props.polyhedra_color_mode}>
|
|
1335
|
+
{#each Object.entries(
|
|
1336
|
+
SETTINGS_CONFIG.structure.polyhedra_color_mode.enum ?? {},
|
|
1337
|
+
) as
|
|
1338
|
+
[value, label]
|
|
1339
|
+
(value)
|
|
1340
|
+
}
|
|
1341
|
+
<option {value}>{label}</option>
|
|
1342
|
+
{/each}
|
|
1343
|
+
</select>
|
|
1344
|
+
{#if scene_props.polyhedra_color_mode === `uniform`}
|
|
1345
|
+
<input type="color" bind:value={scene_props.polyhedra_color} />
|
|
1346
|
+
{/if}
|
|
1347
|
+
</label>
|
|
1348
|
+
<label
|
|
1349
|
+
style="gap: 6pt"
|
|
1350
|
+
{@attach tooltip({
|
|
1351
|
+
content: SETTINGS_CONFIG.structure.polyhedra_show_edges.description,
|
|
1352
|
+
})}
|
|
1353
|
+
>
|
|
1354
|
+
<input type="checkbox" bind:checked={scene_props.polyhedra_show_edges} />
|
|
1355
|
+
Edges
|
|
1356
|
+
{#if scene_props.polyhedra_show_edges}
|
|
1357
|
+
<input type="color" bind:value={scene_props.polyhedra_edge_color} />
|
|
1358
|
+
{/if}
|
|
1359
|
+
</label>
|
|
1360
|
+
<label
|
|
1361
|
+
style="gap: 6pt"
|
|
1362
|
+
{@attach tooltip({
|
|
1363
|
+
content: SETTINGS_CONFIG.structure.polyhedra_hide_center_atoms.description,
|
|
1364
|
+
})}
|
|
1365
|
+
>
|
|
1366
|
+
<input type="checkbox" bind:checked={scene_props.polyhedra_hide_center_atoms} />
|
|
1367
|
+
Hide center atoms
|
|
1368
|
+
</label>
|
|
1369
|
+
<label
|
|
1370
|
+
{@attach tooltip({
|
|
1371
|
+
content: SETTINGS_CONFIG.structure.polyhedra_min_neighbors.description,
|
|
1372
|
+
})}
|
|
1373
|
+
>
|
|
1374
|
+
Min neighbors
|
|
1375
|
+
<input
|
|
1376
|
+
type="number"
|
|
1377
|
+
min={4}
|
|
1378
|
+
max={12}
|
|
1379
|
+
step={1}
|
|
1380
|
+
bind:value={scene_props.polyhedra_min_neighbors}
|
|
1381
|
+
/>
|
|
1382
|
+
<input
|
|
1383
|
+
type="range"
|
|
1384
|
+
min={4}
|
|
1385
|
+
max={12}
|
|
1386
|
+
step={1}
|
|
1387
|
+
bind:value={scene_props.polyhedra_min_neighbors}
|
|
1388
|
+
/>
|
|
1389
|
+
</label>
|
|
1390
|
+
<label
|
|
1391
|
+
{@attach tooltip({
|
|
1392
|
+
content: SETTINGS_CONFIG.structure.polyhedra_max_neighbors.description,
|
|
1393
|
+
})}
|
|
1394
|
+
>
|
|
1395
|
+
Max neighbors
|
|
1396
|
+
<input
|
|
1397
|
+
type="number"
|
|
1398
|
+
min={4}
|
|
1399
|
+
max={16}
|
|
1400
|
+
step={1}
|
|
1401
|
+
bind:value={scene_props.polyhedra_max_neighbors}
|
|
1402
|
+
/>
|
|
1403
|
+
<input
|
|
1404
|
+
type="range"
|
|
1405
|
+
min={4}
|
|
1406
|
+
max={16}
|
|
1407
|
+
step={1}
|
|
1408
|
+
bind:value={scene_props.polyhedra_max_neighbors}
|
|
1409
|
+
/>
|
|
1410
|
+
</label>
|
|
1411
|
+
{#if structure_elements.length > 0}
|
|
1412
|
+
<div
|
|
1413
|
+
style="display: flex; flex-wrap: wrap; gap: 8pt; align-items: center"
|
|
1414
|
+
{@attach tooltip({
|
|
1415
|
+
content: SETTINGS_CONFIG.structure.polyhedra_excluded_elements.description,
|
|
1416
|
+
})}
|
|
1417
|
+
>
|
|
1418
|
+
Centers:
|
|
1419
|
+
{#each structure_elements as element (element)}
|
|
1420
|
+
<label style="gap: 4pt">
|
|
1421
|
+
<input
|
|
1422
|
+
type="checkbox"
|
|
1423
|
+
checked={is_polyhedra_center_enabled(element)}
|
|
1424
|
+
onchange={() => toggle_polyhedra_element(element)}
|
|
1425
|
+
/>
|
|
1426
|
+
{element}
|
|
1427
|
+
</label>
|
|
1428
|
+
{/each}
|
|
1429
|
+
</div>
|
|
1430
|
+
{/if}
|
|
1431
|
+
</SettingsSection>
|
|
1432
|
+
{/if}
|
|
1218
1433
|
</DraggablePane>
|
|
1219
1434
|
|
|
1220
1435
|
<style>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PaneProps, PaneToggleProps } from '../overlays';
|
|
1
2
|
import type { IsosurfaceSettings, VolumetricData } from '../isosurface/types';
|
|
2
3
|
import DraggablePane from '../overlays/DraggablePane.svelte';
|
|
3
4
|
import type { AnyStructure } from './';
|
|
@@ -23,9 +24,10 @@ type $$ComponentProps = Omit<ComponentProps<typeof DraggablePane>, `children`> &
|
|
|
23
24
|
volumetric_data?: VolumetricData[];
|
|
24
25
|
isosurface_settings?: IsosurfaceSettings;
|
|
25
26
|
active_volume_idx?: number;
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
polyhedra_rendered_elements?: string[];
|
|
28
|
+
pane_props?: PaneProps;
|
|
29
|
+
toggle_props?: PaneToggleProps;
|
|
28
30
|
};
|
|
29
|
-
declare const StructureControls: import("svelte").Component<$$ComponentProps, {}, "
|
|
31
|
+
declare const StructureControls: import("svelte").Component<$$ComponentProps, {}, "color_scheme" | "controls_open" | "background_color" | "background_opacity" | "atom_color_config" | "supercell_scaling" | "cell_type" | "active_volume_idx" | "scene_props" | "lattice_props" | "show_image_atoms" | "supercell_loading" | "volumetric_data" | "isosurface_settings">;
|
|
30
32
|
type StructureControls = ReturnType<typeof StructureControls>;
|
|
31
33
|
export default StructureControls;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import type { PaneProps, PaneToggleProps } from '../overlays'
|
|
3
|
+
import type { ExportSection } from '../io'
|
|
4
|
+
import ExportPane from '../io/ExportPane.svelte'
|
|
5
|
+
import { export_canvas_as_png, observe_canvas_presence } from '../io/export'
|
|
2
6
|
import type { AnyStructure } from './'
|
|
3
|
-
import DraggablePane from '../overlays/DraggablePane.svelte'
|
|
4
|
-
import { export_canvas_as_png } from '../io/export'
|
|
5
|
-
import { sanitize_html } from '../sanitize'
|
|
6
7
|
import * as exports from './export'
|
|
8
|
+
import type { StructTextFormat } from './export'
|
|
7
9
|
import type { ComponentProps } from 'svelte'
|
|
8
|
-
import { tooltip } from 'svelte-multiselect/attachments'
|
|
9
10
|
import type { Camera, Scene } from 'three'
|
|
10
11
|
|
|
11
12
|
let {
|
|
@@ -25,18 +26,10 @@
|
|
|
25
26
|
scene?: Scene
|
|
26
27
|
camera?: Camera
|
|
27
28
|
png_dpi?: number
|
|
28
|
-
pane_props?:
|
|
29
|
-
toggle_props?:
|
|
29
|
+
pane_props?: PaneProps
|
|
30
|
+
toggle_props?: PaneToggleProps
|
|
30
31
|
} = $props()
|
|
31
32
|
|
|
32
|
-
// Copy button feedback state
|
|
33
|
-
let copy_status = $state<
|
|
34
|
-
{ json: boolean; xyz: boolean; cif: boolean; poscar: boolean }
|
|
35
|
-
>({ json: false, xyz: false, cif: false, poscar: false })
|
|
36
|
-
|
|
37
|
-
// Dynamic button text based on copy status
|
|
38
|
-
const copy_confirm = `✅`
|
|
39
|
-
|
|
40
33
|
const text_export_formats = [
|
|
41
34
|
{
|
|
42
35
|
label: `JSON`,
|
|
@@ -79,43 +72,14 @@
|
|
|
79
72
|
},
|
|
80
73
|
] as const
|
|
81
74
|
|
|
82
|
-
//
|
|
83
|
-
function
|
|
84
|
-
if (!structure) return
|
|
85
|
-
const export_fns = {
|
|
86
|
-
json: exports.export_structure_as_json,
|
|
87
|
-
xyz: exports.export_structure_as_xyz,
|
|
88
|
-
cif: exports.export_structure_as_cif,
|
|
89
|
-
poscar: exports.export_structure_as_poscar,
|
|
90
|
-
} as const
|
|
91
|
-
export_fns[format](structure)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// Handle clipboard copy with user feedback
|
|
95
|
-
async function handle_copy(format: `json` | `xyz` | `cif` | `poscar`) {
|
|
96
|
-
if (!structure) {
|
|
97
|
-
console.warn(`No structure available for copying`)
|
|
98
|
-
return
|
|
99
|
-
}
|
|
100
|
-
|
|
75
|
+
// Clipboard content for a text format; must not throw (ExportPane evaluates on click)
|
|
76
|
+
function get_text_content(format: StructTextFormat): string | null {
|
|
77
|
+
if (!structure) return null
|
|
101
78
|
try {
|
|
102
|
-
|
|
103
|
-
if (format === `json`) content = exports.structure_to_json_str(structure)
|
|
104
|
-
else if (format === `xyz`) content = exports.structure_to_xyz_str(structure)
|
|
105
|
-
else if (format === `cif`) content = exports.structure_to_cif_str(structure)
|
|
106
|
-
else if (format === `poscar`) {
|
|
107
|
-
content = exports.structure_to_poscar_str(structure)
|
|
108
|
-
} else throw new Error(`Invalid format: ${format}`)
|
|
109
|
-
|
|
110
|
-
await navigator.clipboard.writeText(content)
|
|
111
|
-
|
|
112
|
-
// Show temporary feedback in button text
|
|
113
|
-
copy_status[format] = true
|
|
114
|
-
setTimeout(() => {
|
|
115
|
-
copy_status[format] = false
|
|
116
|
-
}, 1000)
|
|
79
|
+
return exports.STRUCT_TEXT_FORMATS[format].to_str(structure)
|
|
117
80
|
} catch (error) {
|
|
118
81
|
console.error(`Failed to copy ${format.toUpperCase()} to clipboard`, error)
|
|
82
|
+
return null
|
|
119
83
|
}
|
|
120
84
|
}
|
|
121
85
|
|
|
@@ -124,7 +88,6 @@
|
|
|
124
88
|
console.warn(`No scene available for ${format.toUpperCase()} export`)
|
|
125
89
|
return
|
|
126
90
|
}
|
|
127
|
-
|
|
128
91
|
try {
|
|
129
92
|
if (format === `glb`) exports.export_structure_as_glb(scene, structure)
|
|
130
93
|
else if (format === `obj`) exports.export_structure_as_obj(scene, structure)
|
|
@@ -135,118 +98,53 @@
|
|
|
135
98
|
|
|
136
99
|
let has_canvas = $state(false)
|
|
137
100
|
|
|
138
|
-
$effect(() =>
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
101
|
+
$effect(() => observe_canvas_presence(wrapper, (val) => (has_canvas = val)))
|
|
102
|
+
|
|
103
|
+
const sections = $derived<ExportSection[]>([
|
|
104
|
+
{
|
|
105
|
+
title: `Export as text`,
|
|
106
|
+
items: text_export_formats.map(({ label, format, hint }) => ({
|
|
107
|
+
label,
|
|
108
|
+
hint,
|
|
109
|
+
disabled: !structure,
|
|
110
|
+
on_download: () => structure && exports.export_structure_as(format, structure),
|
|
111
|
+
copy_text: () => get_text_content(format),
|
|
112
|
+
})),
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
title: `Export as image`,
|
|
116
|
+
items: [{
|
|
117
|
+
label: `PNG`,
|
|
118
|
+
disabled: !has_canvas,
|
|
119
|
+
show_dpi: true,
|
|
120
|
+
on_download: () => {
|
|
121
|
+
const canvas = wrapper?.querySelector(`canvas`)
|
|
122
|
+
if (canvas) export_canvas_as_png(canvas, structure, png_dpi, scene, camera)
|
|
123
|
+
else console.warn(`Canvas element not found for PNG export`)
|
|
124
|
+
},
|
|
125
|
+
}],
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
title: `Export as 3D model`,
|
|
129
|
+
items: model_3d_formats.map(({ label, format, hint }) => ({
|
|
130
|
+
label,
|
|
131
|
+
hint,
|
|
132
|
+
disabled: !scene,
|
|
133
|
+
on_download: () => handle_3d_export(format),
|
|
134
|
+
})),
|
|
135
|
+
},
|
|
136
|
+
])
|
|
149
137
|
</script>
|
|
150
138
|
|
|
151
|
-
<
|
|
152
|
-
bind:
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
139
|
+
<ExportPane
|
|
140
|
+
bind:export_pane_open
|
|
141
|
+
bind:png_dpi
|
|
142
|
+
{sections}
|
|
143
|
+
{pane_props}
|
|
156
144
|
toggle_props={{
|
|
157
145
|
title: export_pane_open ? `` : `Export Structure`,
|
|
158
146
|
...toggle_props,
|
|
159
147
|
class: `structure-export-toggle ${toggle_props?.class ?? ``}`,
|
|
160
148
|
}}
|
|
161
149
|
{...rest}
|
|
162
|
-
|
|
163
|
-
<h4 id="export-as-text">Export as text</h4>
|
|
164
|
-
<div class="export-buttons">
|
|
165
|
-
{#each text_export_formats as { label, format, hint } (format)}
|
|
166
|
-
<div style="display: flex; align-items: center; gap: 4pt">
|
|
167
|
-
<span {@attach tooltip({ allow_html: true, content: sanitize_html(hint) })}>{label}</span>
|
|
168
|
-
<button
|
|
169
|
-
type="button"
|
|
170
|
-
onclick={() => export_structure(format)}
|
|
171
|
-
title="Download {label}"
|
|
172
|
-
>
|
|
173
|
-
⬇
|
|
174
|
-
</button>
|
|
175
|
-
<button
|
|
176
|
-
type="button"
|
|
177
|
-
onclick={() => handle_copy(format)}
|
|
178
|
-
title="Copy {label} to clipboard"
|
|
179
|
-
>
|
|
180
|
-
{copy_status[format] ? copy_confirm : `📋`}
|
|
181
|
-
</button>
|
|
182
|
-
</div>
|
|
183
|
-
{/each}
|
|
184
|
-
</div>
|
|
185
|
-
|
|
186
|
-
<h4 id="export-as-image">Export as image</h4>
|
|
187
|
-
<div class="export-buttons">
|
|
188
|
-
<label>
|
|
189
|
-
PNG
|
|
190
|
-
<button
|
|
191
|
-
type="button"
|
|
192
|
-
disabled={!has_canvas}
|
|
193
|
-
onclick={() => {
|
|
194
|
-
const canvas = wrapper?.querySelector(`canvas`) as HTMLCanvasElement
|
|
195
|
-
if (canvas) {
|
|
196
|
-
export_canvas_as_png(
|
|
197
|
-
canvas,
|
|
198
|
-
structure,
|
|
199
|
-
png_dpi,
|
|
200
|
-
scene,
|
|
201
|
-
camera,
|
|
202
|
-
)
|
|
203
|
-
} else console.warn(`Canvas element not found for PNG export`)
|
|
204
|
-
}}
|
|
205
|
-
title="PNG ({png_dpi} DPI)"
|
|
206
|
-
>
|
|
207
|
-
⬇
|
|
208
|
-
</button>
|
|
209
|
-
(DPI: <input
|
|
210
|
-
type="number"
|
|
211
|
-
min={50}
|
|
212
|
-
max={500}
|
|
213
|
-
bind:value={png_dpi}
|
|
214
|
-
title="Export resolution in dots per inch"
|
|
215
|
-
style="margin: 0 0 0 2pt"
|
|
216
|
-
/>)
|
|
217
|
-
</label>
|
|
218
|
-
</div>
|
|
219
|
-
|
|
220
|
-
<h4 id="export-as-3d-model">Export as 3D model</h4>
|
|
221
|
-
<div class="export-buttons">
|
|
222
|
-
{#each model_3d_formats as { label, format, hint } (format)}
|
|
223
|
-
<div style="display: flex; align-items: center; gap: 4pt">
|
|
224
|
-
<span {@attach tooltip({ content: hint })}>{label}</span>
|
|
225
|
-
<button
|
|
226
|
-
type="button"
|
|
227
|
-
onclick={() => handle_3d_export(format)}
|
|
228
|
-
disabled={!scene}
|
|
229
|
-
title="Download {label}"
|
|
230
|
-
>
|
|
231
|
-
⬇
|
|
232
|
-
</button>
|
|
233
|
-
</div>
|
|
234
|
-
{/each}
|
|
235
|
-
</div>
|
|
236
|
-
</DraggablePane>
|
|
237
|
-
|
|
238
|
-
<style>
|
|
239
|
-
.export-buttons {
|
|
240
|
-
display: flex;
|
|
241
|
-
flex-wrap: wrap;
|
|
242
|
-
gap: 9pt;
|
|
243
|
-
font-size: 0.95em;
|
|
244
|
-
}
|
|
245
|
-
.export-buttons button {
|
|
246
|
-
min-width: 1.9em;
|
|
247
|
-
height: 1.6em;
|
|
248
|
-
padding: 0 4pt;
|
|
249
|
-
margin: 0 0 0 4pt;
|
|
250
|
-
box-sizing: border-box;
|
|
251
|
-
}
|
|
252
|
-
</style>
|
|
150
|
+
/>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
+
import type { PaneProps, PaneToggleProps } from '../overlays';
|
|
1
2
|
import type { AnyStructure } from './';
|
|
2
|
-
import DraggablePane from '../overlays/DraggablePane.svelte';
|
|
3
|
-
import type { ComponentProps } from 'svelte';
|
|
4
3
|
import type { Camera, Scene } from 'three';
|
|
5
4
|
type $$ComponentProps = {
|
|
6
5
|
export_pane_open?: boolean;
|
|
@@ -9,9 +8,9 @@ type $$ComponentProps = {
|
|
|
9
8
|
scene?: Scene;
|
|
10
9
|
camera?: Camera;
|
|
11
10
|
png_dpi?: number;
|
|
12
|
-
pane_props?:
|
|
13
|
-
toggle_props?:
|
|
11
|
+
pane_props?: PaneProps;
|
|
12
|
+
toggle_props?: PaneToggleProps;
|
|
14
13
|
};
|
|
15
|
-
declare const StructureExportPane: import("svelte").Component<$$ComponentProps, {}, "
|
|
14
|
+
declare const StructureExportPane: import("svelte").Component<$$ComponentProps, {}, "export_pane_open" | "png_dpi">;
|
|
16
15
|
type StructureExportPane = ReturnType<typeof StructureExportPane>;
|
|
17
16
|
export default StructureExportPane;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import type { PaneProps, PaneToggleProps } from '../overlays'
|
|
2
3
|
import { get_electro_neg_formula } from '../composition'
|
|
3
4
|
import { element_data, type ElementSymbol } from '../element'
|
|
4
5
|
import Icon from '../Icon.svelte'
|
|
5
6
|
import { format_num } from '../labels'
|
|
6
7
|
import type { InfoItem } from '../layout'
|
|
8
|
+
import type { Vec2 } from '../math'
|
|
7
9
|
import CopyButton from '../overlays/CopyButton.svelte'
|
|
8
10
|
import DraggablePane from '../overlays/DraggablePane.svelte'
|
|
9
11
|
import { sanitize_html } from '../sanitize'
|
|
@@ -75,9 +77,9 @@
|
|
|
75
77
|
}: Omit<HTMLAttributes<HTMLDivElement>, `onclose`> & {
|
|
76
78
|
structure: AnyStructure
|
|
77
79
|
pane_open?: boolean
|
|
78
|
-
atom_count_thresholds?:
|
|
79
|
-
toggle_props?:
|
|
80
|
-
pane_props?:
|
|
80
|
+
atom_count_thresholds?: Vec2 // if atom count is less than min_threshold, show sites, if atom count is greater than max_threshold, hide sites. in between, show sites behind a toggle button.
|
|
81
|
+
toggle_props?: PaneToggleProps
|
|
82
|
+
pane_props?: PaneProps
|
|
81
83
|
highlighted_sites?: number[] // Sites highlighted from Wyckoff table hover
|
|
82
84
|
hovered_site_idx?: number | null // Site hovered in this pane or in the 3D scene
|
|
83
85
|
selected_sites?: number[] // Sites selected from Wyckoff table click
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { PaneProps, PaneToggleProps } from '../overlays';
|
|
2
|
+
import type { Vec2 } from '../math';
|
|
2
3
|
import type { AnyStructure } from './';
|
|
3
4
|
import type { MoyoDataset } from '@spglib/moyo-wasm';
|
|
4
|
-
import type { ComponentProps } from 'svelte';
|
|
5
5
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
6
6
|
type $$ComponentProps = Omit<HTMLAttributes<HTMLDivElement>, `onclose`> & {
|
|
7
7
|
structure: AnyStructure;
|
|
8
8
|
pane_open?: boolean;
|
|
9
|
-
atom_count_thresholds?:
|
|
10
|
-
toggle_props?:
|
|
11
|
-
pane_props?:
|
|
9
|
+
atom_count_thresholds?: Vec2;
|
|
10
|
+
toggle_props?: PaneToggleProps;
|
|
11
|
+
pane_props?: PaneProps;
|
|
12
12
|
highlighted_sites?: number[];
|
|
13
13
|
hovered_site_idx?: number | null;
|
|
14
14
|
selected_sites?: number[];
|